www.mooseframework.org
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 Member Functions

 PorousFlowPorosityExponentialBase (const InputParameters &parameters)
 

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...
 
MaterialProperty< Real > & _porosity
 Computed porosity at the nodes or quadpoints. More...
 
MaterialProperty< std::vector< Real > > & _dporosity_dvar
 d(porosity)/d(PorousFlow variable) More...
 
MaterialProperty< std::vector< RealGradient > > & _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 37 of file PorousFlowPorosityExponentialBase.h.

Constructor & Destructor Documentation

◆ PorousFlowPorosityExponentialBase()

PorousFlowPorosityExponentialBase::PorousFlowPorosityExponentialBase ( const InputParameters &  parameters)

Definition at line 35 of file PorousFlowPorosityExponentialBase.C.

37  : PorousFlowPorosityBase(parameters),
38  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
39  _ensure_positive(getParam<bool>("ensure_positive"))
40 {
41 }
const bool _ensure_positive
for decayQp() > 0, porosity can be negative when using porosity = a + (b - a) * exp(decay).
PorousFlowPorosityBase(const InputParameters &parameters)
const bool _strain_at_nearest_qp
When calculating nodal porosity, use the strain at the nearest quadpoint to the node.

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 62 of file PorousFlowPorosityExponentialBase.C.

63 {
64  const Real a = atNegInfinityQp();
65  const Real b = atZeroQp();
66  const Real decay = decayQp();
67  Real exp_term = 1.0; // set appropriately below
68 
69  Real deriv = 0.0; // = d(porosity)/d(decay)
70  if (decay <= 0.0 || !_ensure_positive)
71  {
72  exp_term = std::exp(decay);
73  _porosity[_qp] = a + (b - a) * exp_term;
74  deriv = _porosity[_qp] - a;
75  }
76  else
77  {
78  const Real c = std::log(a / (a - b));
79  const Real expx = std::exp(-decay / c);
80  // note that at decay = 0, we have expx = 1, so porosity = a + b - a = b
81  // and at decay = infinity, expx = 0, so porosity = a + (b - a) * a / (a - b) = 0
82  exp_term = std::exp(c * (1.0 - expx));
83  _porosity[_qp] = a + (b - a) * exp_term;
84  deriv = (_porosity[_qp] - a) * expx;
85  }
86 
87  _dporosity_dvar[_qp].resize(_num_var);
88  _dporosity_dgradvar[_qp].resize(_num_var);
89  for (unsigned int v = 0; v < _num_var; ++v)
90  {
91  _dporosity_dvar[_qp][v] = ddecayQp_dvar(v) * deriv;
92  _dporosity_dgradvar[_qp][v] = ddecayQp_dgradvar(v) * deriv;
93 
94  const Real da = datNegInfinityQp(v);
95  const Real db = datZeroQp(v);
96  _dporosity_dvar[_qp][v] += da * (1 - exp_term) + db * exp_term;
97 
98  if (!(decay <= 0.0 || !_ensure_positive))
99  {
100  const Real c = std::log(a / (a - b));
101  const Real expx = std::exp(-decay / c);
102  const Real dc = (a - b) * (da * b / a - db) / std::pow(a, 2);
103  _dporosity_dvar[_qp][v] += (b - a) * exp_term * dc * (1 - expx - expx / c);
104  }
105  }
106 }
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))
MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable)
MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
virtual Real datZeroQp(unsigned pvar) const =0
d(a)/d(PorousFlow variable pvar)
virtual Real decayQp() const =0
Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))
MaterialProperty< Real > & _porosity
Computed porosity at the nodes or quadpoints.
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))
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
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)

◆ 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 44 of file PorousFlowPorosityExponentialBase.C.

45 {
46  const Real a = atNegInfinityQp();
47  const Real b = atZeroQp();
48  mooseAssert(a > b, "PorousFlowPorosityExponentialBase a must be larger than b");
49  const Real decay = decayQp();
50 
51  if (decay <= 0.0 || !_ensure_positive)
52  _porosity[_qp] = a + (b - a) * std::exp(decay);
53  else
54  {
55  const Real c = std::log(a / (a - b));
56  const Real expx = std::exp(-decay / c);
57  _porosity[_qp] = a + (b - a) * std::exp(c * (1.0 - expx));
58  }
59 }
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))
virtual Real decayQp() const =0
Returns "decay" at the quadpoint (porosity = a + (b - a) * exp(decay))
MaterialProperty< Real > & _porosity
Computed porosity at the nodes or quadpoints.
virtual Real atNegInfinityQp() const =0
Returns "a" at the quadpoint (porosity = a + (b - a) * exp(decay))

Member Data Documentation

◆ _dporosity_dgradvar

MaterialProperty<std::vector<RealGradient> >& PorousFlowPorosityBase::_dporosity_dgradvar
protectedinherited

◆ _dporosity_dvar

MaterialProperty<std::vector<Real> >& PorousFlowPorosityBase::_dporosity_dvar
protectedinherited

◆ _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 77 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

MaterialProperty<Real>& PorousFlowPorosityBase::_porosity
protectedinherited

◆ _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 68 of file PorousFlowPorosityExponentialBase.h.

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


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