https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowPermeabilityExponential.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("log_k ln_k exp_k", "exp_k");
21 params.addParam<MooseEnum>("poroperm_function",
22 poroperm_function,
23 "Form of the function relating porosity and permeability. The options "
24 "are: log_k (log k = A phi + B); ln_k (ln k = A phi + B); exp_k (k = "
25 "B exp(A phi)); where k is permeability, phi is porosity, A and B are "
26 "empirical constants.");
27 params.addParam<RealTensorValue>("k_anisotropy",
28 "A tensor to multiply the calculated scalar "
29 "permeability, in order to obtain anisotropy if "
30 "required. Defaults to isotropic permeability "
31 "if not specified.");
32 params.addRequiredParam<Real>("A", "Empirical constant; see poroperm_function.");
33 params.addRequiredParam<Real>("B", "Empirical constant; see poroperm_function.");
35 "This Material calculates the permeability tensor from an exponential function of porosity: "
36 "k = k_ijk * BB exp(AA phi), where k_ijk is a tensor providing the anisotropy, phi is "
37 "porosity, and AA and BB are empirical constants. The user can provide input for the "
38 "function expressed in ln k, log k or exponential forms (see poroperm_function).");
39 return params;
40}
41
42template <bool is_ad>
44 const InputParameters & parameters)
45 : PorousFlowPermeabilityBaseTempl<is_ad>(parameters),
46 _A(this->template getParam<Real>("A")),
47 _B(this->template getParam<Real>("B")),
48 _k_anisotropy(parameters.isParamValid("k_anisotropy")
49 ? this->template getParam<RealTensorValue>("k_anisotropy")
50 : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)),
51 _porosity_qp(this->template getGenericMaterialProperty<Real, is_ad>("PorousFlow_porosity_qp")),
52 _dporosity_qp_dvar(is_ad ? nullptr
53 : &this->template getMaterialProperty<std::vector<Real>>(
54 "dPorousFlow_porosity_qp_dvar")),
55 _dporosity_qp_dgradvar(is_ad ? nullptr
56 : &this->template getMaterialProperty<std::vector<RealGradient>>(
57 "dPorousFlow_porosity_qp_dgradvar")),
58 _poroperm_function(this->template getParam<MooseEnum>("poroperm_function")
59 .template getEnum<PoropermFunction>())
60{
61 switch (_poroperm_function)
62 {
64 _AA = _A * std::log(10.0);
65 _BB = std::pow(10.0, _B);
66 break;
67
69 _AA = _A;
70 _BB = std::exp(_B);
71 break;
72
74 _AA = _A;
75 _BB = _B;
76 break;
77 }
78
79 // Make sure that derivatives are included in the Jacobian calculations
80 _dictator.usePermDerivs(true);
81}
82
83template <bool is_ad>
84void
86{
87 using std::exp;
88
89 _permeability_qp[_qp] = _k_anisotropy * _BB * exp(_porosity_qp[_qp] * _AA);
90
91 if constexpr (!is_ad)
92 {
93 (*_dpermeability_qp_dvar)[_qp].resize(_num_var, RealTensorValue());
94 for (unsigned int v = 0; v < _num_var; ++v)
95 (*_dpermeability_qp_dvar)[_qp][v] =
96 _AA * _permeability_qp[_qp] * (*_dporosity_qp_dvar)[_qp][v];
97
98 (*_dpermeability_qp_dgradvar)[_qp].resize(LIBMESH_DIM);
99 for (const auto i : make_range(Moose::dim))
100 {
101 (*_dpermeability_qp_dgradvar)[_qp][i].resize(_num_var, RealTensorValue());
102 for (unsigned int v = 0; v < _num_var; ++v)
103 (*_dpermeability_qp_dgradvar)[_qp][i][v] =
104 _AA * _permeability_qp[_qp] * (*_dporosity_qp_dgradvar)[_qp][v](i);
105 }
106 }
107}
108
const double v
registerMooseObject("PorousFlowApp", PorousFlowPermeabilityExponential)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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)
Base class Material designed to provide the permeability tensor.
Material designed to provide the permeability tensor which is calculated from porosity using the equa...
Real _AA
Empirical constant AA in k = k_ijk * BB * exp(AA * phi)
enum PorousFlowPermeabilityExponentialTempl::PoropermFunction _poroperm_function
PorousFlowPermeabilityExponentialTempl(const InputParameters &parameters)
Real _BB
Empirical constant BB in k = k_ijk * BB * exp(AA * phi)
PoropermFunction
Name of porosity-permeability relationship.
static constexpr std::size_t dim