www.mooseframework.org
PorousFlowPermeabilityKozenyCarman.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<PorousFlowPermeabilityBase>();
15  MooseEnum poroperm_function("kozeny_carman_fd2=0 kozeny_carman_phi0=1", "kozeny_carman_fd2");
16  params.addParam<MooseEnum>(
17  "poroperm_function",
18  poroperm_function,
19  "Function relating porosity and permeability. The options are: kozeny_carman_fd2 = f d^2 "
20  "phi^n/(1-phi)^m (where phi is porosity, f is a scalar constant with typical values "
21  "0.01-0.001, and d is grain size). kozeny_carman_phi0 = k0 (1-phi0)^m/phi0^n * "
22  "phi^n/(1-phi)^m (where phi is porosity, and k0 is the permeability at porosity phi0)");
23  params.addRangeCheckedParam<Real>("k0",
24  "k0 > 0",
25  "The permeability scalar value (usually in "
26  "m^2) at the reference porosity, required for "
27  "kozeny_carman_phi0");
28  params.addParam<RealTensorValue>("k_anisotropy",
29  "A tensor to multiply the calculated scalar "
30  "permeability, in order to obtain anisotropy if "
31  "required. Defaults to isotropic permeability "
32  "if not specified.");
33  params.addRangeCheckedParam<Real>(
34  "phi0", "phi0 > 0 & phi0 < 1", "The reference porosity, required for kozeny_carman_phi0");
35  params.addRangeCheckedParam<Real>(
36  "f", "f > 0", "The multiplying factor, required for kozeny_carman_fd2");
37  params.addRangeCheckedParam<Real>(
38  "d", "d > 0", "The grain diameter, required for kozeny_carman_fd2");
39  params.addRequiredRangeCheckedParam<Real>("n", "n >= 0", "Porosity exponent");
40  params.addRequiredRangeCheckedParam<Real>("m", "m >= 0", "(1-porosity) exponent");
41  params.addClassDescription(
42  "This Material calculates the permeability tensor from a form of the Kozeny-Carman equation, "
43  "k = k_ijk * A * phi^n / (1 - phi)^m, where k_ijk is a tensor providing the anisotropy, phi "
44  "is porosity, n and m are positive scalar constants and A is given in one of the following "
45  "forms: A = k0 * (1 - phi0)^m / phi0^n (where k0 and phi0 are a reference permeability and "
46  "porosity) or A = f * d^2 (where f is a scalar constant and d is grain diameter.");
47  return params;
48 }
49 
51  const InputParameters & parameters)
52  : PorousFlowPermeabilityBase(parameters),
53  _k0(parameters.isParamValid("k0") ? getParam<Real>("k0") : -1),
54  _phi0(parameters.isParamValid("phi0") ? getParam<Real>("phi0") : -1),
55  _f(parameters.isParamValid("f") ? getParam<Real>("f") : -1),
56  _d(parameters.isParamValid("d") ? getParam<Real>("d") : -1),
57  _m(getParam<Real>("m")),
58  _n(getParam<Real>("n")),
59  _k_anisotropy(parameters.isParamValid("k_anisotropy")
60  ? getParam<RealTensorValue>("k_anisotropy")
61  : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)),
62  _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
63  _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
64  _dporosity_qp_dgradvar(
65  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar")),
66  _poroperm_function(getParam<MooseEnum>("poroperm_function").getEnum<PoropermFunction>())
67 {
68  switch (_poroperm_function)
69  {
71  if (!(parameters.isParamValid("f") && parameters.isParamValid("d")))
72  mooseError("You must specify f and d in order to use kozeny_carman_fd2 in "
73  "PorousFlowPermeabilityKozenyCarman");
74  _A = _f * _d * _d;
75  break;
76 
78  if (!(parameters.isParamValid("k0") && parameters.isParamValid("phi0")))
79  mooseError("You must specify k0 and phi0 in order to use kozeny_carman_phi0 in "
80  "PorousFlowPermeabilityKozenyCarman");
81  _A = _k0 * std::pow(1.0 - _phi0, _m) / std::pow(_phi0, _n);
82  break;
83  }
84 }
85 
86 void
88 {
89  _permeability_qp[_qp] =
90  _k_anisotropy * _A * std::pow(_porosity_qp[_qp], _n) / std::pow(1.0 - _porosity_qp[_qp], _m);
91 
92  _dpermeability_qp_dvar[_qp].resize(_num_var, RealTensorValue());
93  for (unsigned int v = 0; v < _num_var; ++v)
95  (_n / _porosity_qp[_qp] + _m / (1.0 - _porosity_qp[_qp]));
96 
97  _dpermeability_qp_dgradvar[_qp].resize(LIBMESH_DIM);
98  for (unsigned i = 0; i < LIBMESH_DIM; ++i)
99  {
100  _dpermeability_qp_dgradvar[_qp][i].resize(_num_var, RealTensorValue());
101  for (unsigned int v = 0; v < _num_var; ++v)
102  _dpermeability_qp_dgradvar[_qp][i][v] =
103  _dporosity_qp_dgradvar[_qp][v](i) * _permeability_qp[_qp] *
104  (_n / _porosity_qp[_qp] + _m / (1.0 - _porosity_qp[_qp]));
105  }
106 }
const Real _k0
Reference scalar permeability in A = k0 * (1 - phi0)^m / phi0^n.
Real _A
Multiplying factor in k = k_ijk * A * phi^n / (1 - phi)^m.
const Real _phi0
Reference porosity in A = k0 * (1 - phi0)^m / phi0^n.
MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dpermeability_qp_dgradvar
d(quadpoint permeability)/d(grad(PorousFlow variable))
const MaterialProperty< Real > & _porosity_qp
quadpoint porosity
Base class Material designed to provide the permeability tensor.
InputParameters validParams< PorousFlowPermeabilityKozenyCarman >()
const MaterialProperty< std::vector< RealGradient > > & _dporosity_qp_dgradvar
d(quadpoint porosity)/d(grad(PorousFlow variable))
const RealTensorValue _k_anisotropy
Tensor multiplier k_ijk in k = k_ijk * A * phi^n / (1 - phi)^m.
const Real _f
Multiplying factor in A = f * d^2.
const unsigned int _num_var
Number of PorousFlow variables.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
MaterialProperty< std::vector< RealTensorValue > > & _dpermeability_qp_dvar
d(quadpoint permeability)/d(PorousFlow variable)
const Real _d
Grain diameter in A = f * d^2.
PoropermFunction
Name of porosity-permeability relationship.
const Real _n
Exponent in k = k_ijk * A * phi^n / (1 - phi)^m.
enum PorousFlowPermeabilityKozenyCarman::PoropermFunction _poroperm_function
MaterialProperty< RealTensorValue > & _permeability_qp
quadpoint permeability
PorousFlowPermeabilityKozenyCarman(const InputParameters &parameters)
const MaterialProperty< std::vector< Real > > & _dporosity_qp_dvar
d(quadpoint porosity)/d(PorousFlow variable)
InputParameters validParams< PorousFlowPermeabilityBase >()
const Real _m
Exponent in k = k_ijk * A * phi^n / (1 - phi)^m.