www.mooseframework.org
PorousFlowPermeabilityKozenyCarman.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<PorousFlowPermeabilityBase>();
19  MooseEnum poroperm_function("kozeny_carman_fd2=0 kozeny_carman_phi0=1", "kozeny_carman_fd2");
20  params.addParam<MooseEnum>(
21  "poroperm_function",
22  poroperm_function,
23  "Function relating porosity and permeability. The options are: kozeny_carman_fd2 = f d^2 "
24  "phi^n/(1-phi)^m (where phi is porosity, f is a scalar constant with typical values "
25  "0.01-0.001, and d is grain size). kozeny_carman_phi0 = k0 (1-phi0)^m/phi0^n * "
26  "phi^n/(1-phi)^m (where phi is porosity, and k0 is the permeability at porosity phi0)");
27  params.addRangeCheckedParam<Real>("k0",
28  "k0 > 0",
29  "The permeability scalar value (usually in "
30  "m^2) at the reference porosity, required for "
31  "kozeny_carman_phi0");
32  params.addParam<RealTensorValue>("k_anisotropy",
33  "A tensor to multiply the calculated scalar "
34  "permeability, in order to obtain anisotropy if "
35  "required. Defaults to isotropic permeability "
36  "if not specified.");
37  params.addRangeCheckedParam<Real>(
38  "phi0", "phi0 > 0 & phi0 < 1", "The reference porosity, required for kozeny_carman_phi0");
39  params.addRangeCheckedParam<Real>(
40  "f", "f > 0", "The multiplying factor, required for kozeny_carman_fd2");
41  params.addRangeCheckedParam<Real>(
42  "d", "d > 0", "The grain diameter, required for kozeny_carman_fd2");
43  params.addRequiredRangeCheckedParam<Real>("n", "n >= 0", "Porosity exponent");
44  params.addRequiredRangeCheckedParam<Real>("m", "m >= 0", "(1-porosity) exponent");
45  params.addClassDescription(
46  "This Material calculates the permeability tensor from a form of the Kozeny-Carman equation, "
47  "k = k_ijk * A * phi^n / (1 - phi)^m, where k_ijk is a tensor providing the anisotropy, phi "
48  "is porosity, n and m are positive scalar constants and A is given in one of the following "
49  "forms: A = k0 * (1 - phi0)^m / phi0^n (where k0 and phi0 are a reference permeability and "
50  "porosity) or A = f * d^2 (where f is a scalar constant and d is grain diameter.");
51  return params;
52 }
53 
55  const InputParameters & parameters)
56  : PorousFlowPermeabilityBase(parameters),
57  _k0(parameters.isParamValid("k0") ? getParam<Real>("k0") : -1),
58  _phi0(parameters.isParamValid("phi0") ? getParam<Real>("phi0") : -1),
59  _f(parameters.isParamValid("f") ? getParam<Real>("f") : -1),
60  _d(parameters.isParamValid("d") ? getParam<Real>("d") : -1),
61  _m(getParam<Real>("m")),
62  _n(getParam<Real>("n")),
63  _k_anisotropy(parameters.isParamValid("k_anisotropy")
64  ? getParam<RealTensorValue>("k_anisotropy")
65  : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)),
66  _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
67  _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
68  _dporosity_qp_dgradvar(
69  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar")),
70  _poroperm_function(getParam<MooseEnum>("poroperm_function").getEnum<PoropermFunction>())
71 {
72  switch (_poroperm_function)
73  {
75  if (!(parameters.isParamValid("f") && parameters.isParamValid("d")))
76  mooseError("You must specify f and d in order to use kozeny_carman_fd2 in "
77  "PorousFlowPermeabilityKozenyCarman");
78  _A = _f * _d * _d;
79  break;
80 
82  if (!(parameters.isParamValid("k0") && parameters.isParamValid("phi0")))
83  mooseError("You must specify k0 and phi0 in order to use kozeny_carman_phi0 in "
84  "PorousFlowPermeabilityKozenyCarman");
85  _A = _k0 * std::pow(1.0 - _phi0, _m) / std::pow(_phi0, _n);
86  break;
87  }
88 }
89 
90 void
92 {
93  _permeability_qp[_qp] =
94  _k_anisotropy * _A * std::pow(_porosity_qp[_qp], _n) / std::pow(1.0 - _porosity_qp[_qp], _m);
95 
96  _dpermeability_qp_dvar[_qp].resize(_num_var, RealTensorValue());
97  for (unsigned int v = 0; v < _num_var; ++v)
99  (_n / _porosity_qp[_qp] + _m / (1.0 - _porosity_qp[_qp]));
100 
101  _dpermeability_qp_dgradvar[_qp].resize(LIBMESH_DIM);
102  for (unsigned i = 0; i < LIBMESH_DIM; ++i)
103  {
104  _dpermeability_qp_dgradvar[_qp][i].resize(_num_var, RealTensorValue());
105  for (unsigned int v = 0; v < _num_var; ++v)
106  _dpermeability_qp_dgradvar[_qp][i][v] =
107  _dporosity_qp_dgradvar[_qp][v](i) * _permeability_qp[_qp] *
108  (_n / _porosity_qp[_qp] + _m / (1.0 - _porosity_qp[_qp]));
109  }
110 }
VectorValue< Real > RealGradient
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.
Material designed to provide the permeability tensor which is calculated from porosity using a form o...
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 >()
registerMooseObject("PorousFlowApp", PorousFlowPermeabilityKozenyCarman)
const Real _m
Exponent in k = k_ijk * A * phi^n / (1 - phi)^m.