18 params.
addParam<
bool>(
"strain_at_nearest_qp",
20 "When calculating nodal porosity that depends on strain, use the strain at "
21 "the nearest quadpoint. This adds a small extra computational burden, and "
22 "is not necessary for simulations involving only linear lagrange elements. "
23 " If you set this to true, you will also want to set the same parameter to "
24 "true for related Kernels and Materials");
25 params.
addParam<
bool>(
"ensure_positive",
27 "Modify the usual exponential relationships that "
28 "governs porosity so that porosity is always "
32 std::numeric_limits<Real>::lowest(),
33 "Minimum allowed value of the porosity: if the computed porosity is less than this value, "
34 "porosity is set to this value instead. By default no floor is imposed. The "
36 "transform only acts for decay > 0, so chemistry-driven (precipitation) porosity is "
38 "unbounded below and can become negative once pore space is filled by mineral; set this to a "
39 "small positive value in that case.");
40 params.
addParam<Real>(
"zero_modifier",
42 "If the porosity_min floor is active, the porosity derivatives are set to "
43 "zero_modifier times their unfloored values (rather than exactly zero) to "
44 "hint to the Newton-Krylov nonlinear solver that porosity "
45 "is not strictly constant, which aids convergence");
47 params.
addClassDescription(
"Base class Material for porosity that is computed via an exponential "
48 "relationship with coupled variables (strain, porepressure, "
49 "temperature, chemistry)");
56 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
57 _ensure_positive(getParam<bool>(
"ensure_positive")),
58 _porosity_min(getParam<Real>(
"porosity_min")),
59 _zero_modifier(getParam<Real>(
"zero_modifier"))
68 mooseAssert(
a >
b,
"PorousFlowPorosityExponentialBase a must be larger than b");
75 const Real
c = std::log(
a / (
a -
b));
76 const Real expx = std::exp(-decay /
c);
95 exp_term = std::exp(decay);
101 const Real
c = std::log(
a / (
a -
b));
102 const Real expx = std::exp(-decay /
c);
105 exp_term = std::exp(
c * (1.0 - expx));
110 (*_dporosity_dvar)[_qp].resize(
_num_var);
111 (*_dporosity_dgradvar)[_qp].resize(
_num_var);
119 (*_dporosity_dvar)[_qp][
v] += da * (1 - exp_term) +
db * exp_term;
123 const Real
c = std::log(
a / (
a -
b));
124 const Real expx = std::exp(-decay /
c);
125 const Real dc = (
a -
b) * (da *
b /
a -
db) / std::pow(
a, 2);
126 (*_dporosity_dvar)[_qp][
v] += (
b -
a) * exp_term * dc * (1 - expx - expx /
c);
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
const unsigned int _num_var
Number of PorousFlow variables.
Base class Material designed to provide the porosity.
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
static InputParameters validParams()
virtual Real datZeroQp(unsigned pvar) const =0
d(a)/d(PorousFlow variable pvar)
virtual void computeQpProperties() override
virtual void initQpStatefulProperties() override
virtual Real atZeroQp() const =0
Returns "b" at the quadpoint (porosity = a + (b - a) * exp(decay))
virtual Real ddecayQp_dvar(unsigned pvar) const =0
d(decay)/d(PorousFlow variable pvar)
const Real _zero_modifier
If the porosity_min floor is active the porosity derivatives are set to _zero_modifier times their un...
virtual Real decayQp() const =0
Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))
const bool _ensure_positive
for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).
static InputParameters validParams()
const Real _porosity_min
Minimum allowed porosity.
virtual Real atNegInfinityQp() const =0
Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay))
virtual Real datNegInfinityQp(unsigned pvar) const =0
d(a)/d(PorousFlow variable pvar)
virtual RealGradient ddecayQp_dgradvar(unsigned pvar) const =0
d(decay)/d(grad(PorousFlow variable pvar))
PorousFlowPorosityExponentialBase(const InputParameters ¶meters)