https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowPermeabilityKozenyCarman.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
15template <bool is_ad>
18{
20 MooseEnum poroperm_function("kozeny_carman_fd2=0 kozeny_carman_phi0=1 kozeny_carman_A=2",
21 "kozeny_carman_fd2");
22 params.addParam<MooseEnum>(
23 "poroperm_function",
24 poroperm_function,
25 "Function relating porosity and permeability. The options are: kozeny_carman_fd2 = f d^2 "
26 "phi^n/(1-phi)^m (where phi is porosity, f is a scalar constant with typical values "
27 "0.01-0.001, and d is grain size). kozeny_carman_phi0 = k0 (1-phi0)^m/phi0^n * "
28 "phi^n/(1-phi)^m (where phi is porosity, and k0 is the permeability at porosity phi0) "
29 "kozeny_carman_A = A for directly supplying the permeability multiplying factor.");
30 params.addRangeCheckedParam<Real>("k0",
31 "k0 > 0",
32 "The permeability scalar value (usually in "
33 "m^2) at the reference porosity, required for "
34 "kozeny_carman_phi0");
35 params.addParam<RealTensorValue>("k_anisotropy",
36 "A tensor to multiply the calculated scalar "
37 "permeability, in order to obtain anisotropy if "
38 "required. Defaults to isotropic permeability "
39 "if not specified.");
40 params.addRangeCheckedParam<Real>(
41 "phi0", "phi0 > 0 & phi0 < 1", "The reference porosity, required for kozeny_carman_phi0");
42 params.addRangeCheckedParam<Real>(
43 "f", "f > 0", "The multiplying factor, required for kozeny_carman_fd2");
44 params.addRangeCheckedParam<Real>(
45 "d", "d > 0", "The grain diameter, required for kozeny_carman_fd2");
46 params.addRangeCheckedParam<Real>(
47 "A", "A > 0", "Kozeny Carman permeability multiplying factor, required for kozeny_carman_A");
48 params.addClassDescription("This Material calculates the permeability tensor from a form of the "
49 "Kozeny-Carman equation based on the spatially constant initial "
50 "permeability and porosity or grain size.");
51 return params;
52}
53
54template <bool is_ad>
56 const InputParameters & parameters)
58 _k0(parameters.isParamValid("k0") ? this->template getParam<Real>("k0") : -1),
59 _phi0(parameters.isParamValid("phi0") ? this->template getParam<Real>("phi0") : -1),
60 _f(parameters.isParamValid("f") ? this->template getParam<Real>("f") : -1),
61 _d(parameters.isParamValid("d") ? this->template getParam<Real>("d") : -1),
62 _poroperm_function(this->template getParam<MooseEnum>("poroperm_function")
63 .template getEnum<PoropermFunction>()),
64 _A(parameters.isParamValid("A") ? this->template getParam<Real>("A") : -1)
65{
66 auto checkForInvalidParams =
67 [&](const std::string & bad_param, const std::string & poroperm_function)
68 {
69 if (parameters.isParamValid(bad_param))
70 this->paramError(bad_param, "Not compatible with '" + poroperm_function + "'.");
71 };
72
73 switch (_poroperm_function)
74 {
76 if (!(parameters.isParamValid("f") && parameters.isParamValid("d")))
77 mooseError("You must specify f and d in order to use kozeny_carman_fd2 in "
78 "PorousFlowPermeabilityKozenyCarman");
79 checkForInvalidParams("A", "kozeny_carman_fd2");
80 checkForInvalidParams("k0", "kozeny_carman_fd2");
81 checkForInvalidParams("phi0", "kozeny_carman_fd2");
82 _A = _f * _d * _d;
83 break;
84
86 if (!(parameters.isParamValid("k0") && parameters.isParamValid("phi0")))
87 mooseError("You must specify k0 and phi0 in order to use kozeny_carman_phi0 in "
88 "PorousFlowPermeabilityKozenyCarman");
89 checkForInvalidParams("A", "kozeny_carman_phi0");
90 checkForInvalidParams("f", "kozeny_carman_phi0");
91 checkForInvalidParams("d", "kozeny_carman_phi0");
92 _A = _k0 * std::pow(1.0 - _phi0, this->_m) / std::pow(_phi0, this->_n);
93 break;
95 if (!(parameters.isParamValid("A")))
96 mooseError("You must specify A in order to use kozeny_carman_A in "
97 "PorousFlowPermeabilityKozenyCarman");
98 checkForInvalidParams("k0", "kozeny_carman_A");
99 checkForInvalidParams("phi0", "kozeny_carman_A");
100 checkForInvalidParams("f", "kozeny_carman_A");
101 checkForInvalidParams("d", "kozeny_carman_A");
102
103 break;
104 }
105}
106
107template <bool is_ad>
108Real
113
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowPermeabilityKozenyCarman)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
bool isParamValid(const std::string &name) const
Base class for material designed to provide the permeability tensor which is calculated from porosity...
const Real _m
Exponent in k = k_ijk * A * phi^n / (1 - phi)^m.
const Real _n
Exponent in k = k_ijk * A * phi^n / (1 - phi)^m.
Material designed to provide the permeability tensor which is calculated from porosity using a form o...
Real _A
Multiplying factor in k = k_ijk * A * phi^n / (1 - phi)^m.
const Real _f
Multiplying factor in A = f * d^2.
PoropermFunction
Name of porosity-permeability relationship.
enum PorousFlowPermeabilityKozenyCarmanTempl::PoropermFunction _poroperm_function
PorousFlowPermeabilityKozenyCarmanTempl(const InputParameters &parameters)
const Real _k0
Reference scalar permeability in A = k0 * (1 - phi0)^m / phi0^n.
Real computeA() const override
retrieve constant value for A computed in constructor
const Real _phi0
Reference porosity in A = k0 * (1 - phi0)^m / phi0^n.