https://mooseframework.inl.gov
PorousFlowPermeabilityTensorFromVar.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
14 
15 template <bool is_ad>
18 {
20  params.addRequiredCoupledVar("perm", "The scalar permeability");
21  params.addParam<RealTensorValue>("k_anisotropy",
22  "A tensor to multiply the scalar "
23  "permeability, in order to obtain anisotropy if "
24  "required. Defaults to isotropic permeability "
25  "if not specified.");
26  params.addClassDescription(
27  "This Material calculates the permeability tensor from a coupled variable "
28  "multiplied by a tensor");
29  return params;
30 }
31 
32 template <bool is_ad>
34  const InputParameters & parameters)
35  : PorousFlowPermeabilityBaseTempl<is_ad>(parameters),
36  _perm(coupledValue("perm")),
37  _k_anisotropy(parameters.isParamValid("k_anisotropy")
38  ? this->template getParam<RealTensorValue>("k_anisotropy")
39  : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0))
40 {
41 }
42 
43 template <bool is_ad>
44 void
46 {
47  _permeability_qp[_qp] = _k_anisotropy * _perm[_qp];
48 
49  if (!is_ad)
50  {
51  (*_dpermeability_qp_dvar)[_qp].resize(_num_var, RealTensorValue());
52  (*_dpermeability_qp_dgradvar)[_qp].resize(LIBMESH_DIM);
53 
54  for (const auto i : make_range(Moose::dim))
55  (*_dpermeability_qp_dgradvar)[_qp][i].resize(_num_var, RealTensorValue());
56  }
57 }
58 
PorousFlowPermeabilityTensorFromVarTempl(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static constexpr std::size_t dim
Base class Material designed to provide the permeability tensor.
TensorValue< Real > RealTensorValue
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
Material designed to provide the permeability tensor which is calculated from a tensor multiplied by ...
IntRange< T > make_range(T beg, T end)
void addClassDescription(const std::string &doc_string)
registerMooseObject("PorousFlowApp", PorousFlowPermeabilityTensorFromVar)