https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowPorosityExponentialBase Class Referenceabstract

Base class Material designed to provide the porosity. More...

#include <PorousFlowPorosityExponentialBase.h>

Inheritance diagram for PorousFlowPorosityExponentialBase:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 PorousFlowPorosityExponentialBase (const InputParameters &parameters)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void initQpStatefulProperties () override
 
virtual void computeQpProperties () override
 
virtual Real atNegInfinityQp () const =0
 Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay)) More...
 
virtual Real datNegInfinityQp (unsigned pvar) const =0
 d(a)/d(PorousFlow variable pvar) More...
 
virtual Real atZeroQp () const =0
 Returns "b" at the quadpoint (porosity = a + (b - a) * exp(decay)) More...
 
virtual Real datZeroQp (unsigned pvar) const =0
 d(a)/d(PorousFlow variable pvar) More...
 
virtual Real decayQp () const =0
 Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay)) More...
 
virtual Real ddecayQp_dvar (unsigned pvar) const =0
 d(decay)/d(PorousFlow variable pvar) More...
 
virtual RealGradient ddecayQp_dgradvar (unsigned pvar) const =0
 d(decay)/d(grad(PorousFlow variable pvar)) More...
 

Protected Attributes

const bool _strain_at_nearest_qp
 When calculating nodal porosity, use the strain at the nearest quadpoint to the node. More...
 
const bool _ensure_positive
 for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay). More...
 
const Real _porosity_min
 Minimum allowed porosity. More...
 
const Real _zero_modifier
 If the porosity_min floor is active the porosity derivatives are set to _zero_modifier times their unfloored values (rather than exactly zero) to hint to the Newton process that porosity is not strictly constant, which aids convergence. More...
 
GenericMaterialProperty< Real, is_ad > & _porosity
 Computed porosity at the nodes or quadpoints. More...
 
MaterialProperty< std::vector< Real > > *const _dporosity_dvar
 d(porosity)/d(PorousFlow variable) More...
 
MaterialProperty< std::vector< RealGradient > > *const _dporosity_dgradvar
 d(porosity)/d(grad PorousFlow variable) More...
 
const unsigned int _num_phases
 Number of phases. More...
 
const unsigned int _num_components
 Number of fluid components. More...
 
const unsigned int _num_var
 Number of PorousFlow variables. More...
 

Detailed Description

Base class Material designed to provide the porosity.

In this class porosity = a + (b - a) * exp(decay) where a = atNegInfinityQp() b = atZeroQp() decay = decayQp() Since this expression can become negative for decay > 0, if ensure_positive = true then for decay > 0 the following expression is used instead: porosity = a + (b - a) * exp(c * (1 - Exp(- decay / c))) where c = log(a/(b-a)) This latter expression is C1 continuous at decay=0 with the former expression. It is monotonically decreasing with "decay" and is positive.

Definition at line 31 of file PorousFlowPorosityExponentialBase.h.

Constructor & Destructor Documentation

◆ PorousFlowPorosityExponentialBase()

PorousFlowPorosityExponentialBase::PorousFlowPorosityExponentialBase ( const InputParameters parameters)

Definition at line 53 of file PorousFlowPorosityExponentialBase.C.

55  : PorousFlowPorosityBase(parameters),
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"))
60 {
61 }
const bool _ensure_positive
for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).
const bool _strain_at_nearest_qp
When calculating nodal porosity, use the strain at the nearest quadpoint to the node.
const Real _porosity_min
Minimum allowed porosity.
const Real _zero_modifier
If the porosity_min floor is active the porosity derivatives are set to _zero_modifier times their un...
PorousFlowPorosityBaseTempl< false > PorousFlowPorosityBase

Member Function Documentation

◆ atNegInfinityQp()

virtual Real PorousFlowPorosityExponentialBase::atNegInfinityQp ( ) const
protectedpure virtual

Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay))

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties(), and initQpStatefulProperties().

◆ atZeroQp()

virtual Real PorousFlowPorosityExponentialBase::atZeroQp ( ) const
protectedpure virtual

Returns "b" at the quadpoint (porosity = a + (b - a) * exp(decay))

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties(), and initQpStatefulProperties().

◆ computeQpProperties()

void PorousFlowPorosityExponentialBase::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented in PorousFlowPorosityHMBiotModulus.

Definition at line 85 of file PorousFlowPorosityExponentialBase.C.

86 {
87  const Real a = atNegInfinityQp();
88  const Real b = atZeroQp();
89  const Real decay = decayQp();
90  Real exp_term = 1.0; // set appropriately below
91 
92  Real deriv = 0.0; // = d(porosity)/d(decay)
93  if (decay <= 0.0 || !_ensure_positive)
94  {
95  exp_term = std::exp(decay);
96  _porosity[_qp] = a + (b - a) * exp_term;
97  deriv = _porosity[_qp] - a;
98  }
99  else
100  {
101  const Real c = std::log(a / (a - b));
102  const Real expx = std::exp(-decay / c);
103  // note that at decay = 0, we have expx = 1, so porosity = a + b - a = b
104  // and at decay = infinity, expx = 0, so porosity = a + (b - a) * a / (a - b) = 0
105  exp_term = std::exp(c * (1.0 - expx));
106  _porosity[_qp] = a + (b - a) * exp_term;
107  deriv = (_porosity[_qp] - a) * expx;
108  }
109 
110  (*_dporosity_dvar)[_qp].resize(_num_var);
111  (*_dporosity_dgradvar)[_qp].resize(_num_var);
112  for (unsigned int v = 0; v < _num_var; ++v)
113  {
114  (*_dporosity_dvar)[_qp][v] = ddecayQp_dvar(v) * deriv;
115  (*_dporosity_dgradvar)[_qp][v] = ddecayQp_dgradvar(v) * deriv;
116 
117  const Real da = datNegInfinityQp(v);
118  const Real db = datZeroQp(v);
119  (*_dporosity_dvar)[_qp][v] += da * (1 - exp_term) + db * exp_term;
120 
121  if (!(decay <= 0.0 || !_ensure_positive))
122  {
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);
127  }
128  }
129 
130  // Apply the porosity floor last, after the unfloored derivatives above have been
131  // formed. When floored, soften the derivatives with _zero_modifier so the Newton
132  // process still sees porosity as weakly varying (cf. PorousFlowPorosityLinear).
133  if (_porosity[_qp] < _porosity_min)
134  {
135  _porosity[_qp] = _porosity_min;
136  for (unsigned int v = 0; v < _num_var; ++v)
137  {
138  (*_dporosity_dvar)[_qp][v] *= _zero_modifier;
139  (*_dporosity_dgradvar)[_qp][v] *= _zero_modifier;
140  }
141  }
142 }
const bool _ensure_positive
for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).
virtual Real atZeroQp() const =0
Returns "b" at the quadpoint (porosity = a + (b - a) * exp(decay))
const double v
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
Real deriv(unsigned n, unsigned alpha, unsigned beta, Real x)
virtual Real datZeroQp(unsigned pvar) const =0
d(a)/d(PorousFlow variable pvar)
const Real _porosity_min
Minimum allowed porosity.
virtual Real decayQp() const =0
Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))
const unsigned int _num_var
Number of PorousFlow variables.
virtual Real atNegInfinityQp() const =0
Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay))
virtual RealGradient ddecayQp_dgradvar(unsigned pvar) const =0
d(decay)/d(grad(PorousFlow variable pvar))
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real datNegInfinityQp(unsigned pvar) const =0
d(a)/d(PorousFlow variable pvar)
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...
MooseUnits pow(const MooseUnits &, int)

◆ datNegInfinityQp()

virtual Real PorousFlowPorosityExponentialBase::datNegInfinityQp ( unsigned  pvar) const
protectedpure virtual

d(a)/d(PorousFlow variable pvar)

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties().

◆ datZeroQp()

virtual Real PorousFlowPorosityExponentialBase::datZeroQp ( unsigned  pvar) const
protectedpure virtual

d(a)/d(PorousFlow variable pvar)

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties().

◆ ddecayQp_dgradvar()

virtual RealGradient PorousFlowPorosityExponentialBase::ddecayQp_dgradvar ( unsigned  pvar) const
protectedpure virtual

d(decay)/d(grad(PorousFlow variable pvar))

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties().

◆ ddecayQp_dvar()

virtual Real PorousFlowPorosityExponentialBase::ddecayQp_dvar ( unsigned  pvar) const
protectedpure virtual

d(decay)/d(PorousFlow variable pvar)

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties().

◆ decayQp()

virtual Real PorousFlowPorosityExponentialBase::decayQp ( ) const
protectedpure virtual

Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))

Implemented in PorousFlowPorosity.

Referenced by computeQpProperties(), and initQpStatefulProperties().

◆ initQpStatefulProperties()

void PorousFlowPorosityExponentialBase::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 64 of file PorousFlowPorosityExponentialBase.C.

65 {
66  const Real a = atNegInfinityQp();
67  const Real b = atZeroQp();
68  mooseAssert(a > b, "PorousFlowPorosityExponentialBase a must be larger than b");
69  const Real decay = decayQp();
70 
71  if (decay <= 0.0 || !_ensure_positive)
72  _porosity[_qp] = a + (b - a) * std::exp(decay);
73  else
74  {
75  const Real c = std::log(a / (a - b));
76  const Real expx = std::exp(-decay / c);
77  _porosity[_qp] = a + (b - a) * std::exp(c * (1.0 - expx));
78  }
79 
80  if (_porosity[_qp] < _porosity_min)
81  _porosity[_qp] = _porosity_min;
82 }
const bool _ensure_positive
for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).
virtual Real atZeroQp() const =0
Returns "b" at the quadpoint (porosity = a + (b - a) * exp(decay))
const Real _porosity_min
Minimum allowed porosity.
virtual Real decayQp() const =0
Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))
virtual Real atNegInfinityQp() const =0
Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay))
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ validParams()

InputParameters PorousFlowPorosityExponentialBase::validParams ( )
static

Definition at line 15 of file PorousFlowPorosityExponentialBase.C.

Referenced by PorousFlowPorosity::validParams().

16 {
18  params.addParam<bool>("strain_at_nearest_qp",
19  false,
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",
26  true,
27  "Modify the usual exponential relationships that "
28  "governs porosity so that porosity is always "
29  "positive");
30  params.addParam<Real>(
31  "porosity_min",
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 "
35  "ensure_positive "
36  "transform only acts for decay > 0, so chemistry-driven (precipitation) porosity is "
37  "otherwise "
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",
41  1E-3,
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");
46  params.addParamNamesToGroup("zero_modifier", "Advanced");
47  params.addClassDescription("Base class Material for porosity that is computed via an exponential "
48  "relationship with coupled variables (strain, porepressure, "
49  "temperature, chemistry)");
50  return params;
51 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

Member Data Documentation

◆ _dporosity_dgradvar

template<bool is_ad>
MaterialProperty<std::vector<RealGradient> >* const PorousFlowPorosityBaseTempl< is_ad >::_dporosity_dgradvar
protectedinherited

d(porosity)/d(grad PorousFlow variable)

Definition at line 33 of file PorousFlowPorosityBase.h.

Referenced by PorousFlowPorosityLinear::computeQpProperties(), and PorousFlowPorosityHMBiotModulus::computeQpProperties().

◆ _dporosity_dvar

template<bool is_ad>
MaterialProperty<std::vector<Real> >* const PorousFlowPorosityBaseTempl< is_ad >::_dporosity_dvar
protectedinherited

d(porosity)/d(PorousFlow variable)

Definition at line 30 of file PorousFlowPorosityBase.h.

Referenced by PorousFlowPorosityLinear::computeQpProperties(), and PorousFlowPorosityHMBiotModulus::computeQpProperties().

◆ _ensure_positive

const bool PorousFlowPorosityExponentialBase::_ensure_positive
protected

for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).

This expression is modified if ensure_positive = true to read porosity = a + (b - a) * exp(c * (1 - Exp(- decay / c))) where c = log(a/(b-a))

Definition at line 73 of file PorousFlowPorosityExponentialBase.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().

◆ _num_components

const unsigned int PorousFlowMaterialVectorBase::_num_components
protectedinherited

◆ _num_phases

const unsigned int PorousFlowMaterialVectorBase::_num_phases
protectedinherited

◆ _num_var

const unsigned int PorousFlowMaterialVectorBase::_num_var
protectedinherited

◆ _porosity

template<bool is_ad>
GenericMaterialProperty<Real, is_ad>& PorousFlowPorosityBaseTempl< is_ad >::_porosity
protectedinherited

◆ _porosity_min

const Real PorousFlowPorosityExponentialBase::_porosity_min
protected

Minimum allowed porosity.

The ensure_positive transform above only acts for decay > 0, so chemistry-driven porosity (which enters through "a" and "b", not "decay") is otherwise unbounded below and can go negative once pore space is filled by precipitated mineral. If the computed porosity is less than this value it is set to this value instead. Defaults to no floor.

Definition at line 82 of file PorousFlowPorosityExponentialBase.h.

Referenced by computeQpProperties(), and initQpStatefulProperties().

◆ _strain_at_nearest_qp

const bool PorousFlowPorosityExponentialBase::_strain_at_nearest_qp
protected

When calculating nodal porosity, use the strain at the nearest quadpoint to the node.

Definition at line 64 of file PorousFlowPorosityExponentialBase.h.

Referenced by PorousFlowPorosityHMBiotModulus::computeQpProperties(), PorousFlowPorosity::ddecayQp_dgradvar(), and PorousFlowPorosity::decayQp().

◆ _zero_modifier

const Real PorousFlowPorosityExponentialBase::_zero_modifier
protected

If the porosity_min floor is active the porosity derivatives are set to _zero_modifier times their unfloored values (rather than exactly zero) to hint to the Newton process that porosity is not strictly constant, which aids convergence.

Definition at line 90 of file PorousFlowPorosityExponentialBase.h.

Referenced by computeQpProperties().


The documentation for this class was generated from the following files: