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");
27 "The porosity at reference effective porepressure, temperature and volumetric strain. This "
28 "must be a real number or a constant monomial variable (not a linear lagrange or other type "
33 "The reference effective porepressure. This should usually be a linear-lagrange variable");
37 "The reference temperature. This should usually be a linear-lagrange variable");
40 "The reference volumetric strain. This must be a real number or a constant "
41 "monomial variable (not a linear lagrange or other type of variable)");
42 params.
addParam<Real>(
"P_coeff", 0.0,
"Effective porepressure coefficient");
43 params.
addParam<Real>(
"T_coeff", 0.0,
"Temperature coefficient");
44 params.
addParam<Real>(
"epv_coeff", 0.0,
"Volumetric-strain coefficient");
49 "Minimum allowed value of the porosity: if the linear relationship gives "
50 "values less than this value, then porosity is set to this value instead");
54 "If the linear relationship produces porosity < porosity_min, then porosity is set "
55 "porosity_min. This means the derivatives of it will be zero. However, these zero "
56 "derivatives often result in poor NR convergence, so the derivatives are set to "
57 "_zero_modifier * (values that are relevant for min porosity) to hint to the NR that "
58 "porosity is not always constant");
61 "This Material calculates the porosity in PorousFlow simulations using the relationship "
62 "porosity_ref + P_coeff * (P - P_ref) + T_coeff * (T - T_ref) + epv_coeff * (epv - epv_ref), "
63 "where P is the effective porepressure, T is the temperature and epv is the volumetric "
70 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
71 _porosity_min(getParam<Real>(
"porosity_min")),
72 _phi_ref(coupledValue(
"porosity_ref")),
73 _P_ref(nodalOrQpValue(
"P_ref")),
74 _T_ref(nodalOrQpValue(
"T_ref")),
75 _epv_ref(coupledValue(
"epv_ref")),
76 _P_coeff(getParam<Real>(
"P_coeff")),
77 _T_coeff(getParam<Real>(
"T_coeff")),
78 _epv_coeff(getParam<Real>(
"epv_coeff")),
80 _uses_volstrain(parameters.isParamSetByUser(
"epv_coeff") && _epv_coeff != 0.0),
81 _vol_strain_qp(getOptionalMaterialProperty<Real>(
"PorousFlow_total_volumetric_strain_qp")),
82 _dvol_strain_qp_dvar(getOptionalMaterialProperty<
std::vector<RealGradient>>(
83 "dPorousFlow_total_volumetric_strain_qp_dvar")),
85 _uses_pf(parameters.isParamSetByUser(
"P_coeff") && _P_coeff != 0.0),
86 _pf_nodal(getOptionalMaterialProperty<Real>(
"PorousFlow_effective_fluid_pressure_nodal")),
87 _pf_qp(getOptionalMaterialProperty<Real>(
"PorousFlow_effective_fluid_pressure_qp")),
88 _dpf_dvar_nodal(getOptionalMaterialProperty<
std::vector<Real>>(
89 "dPorousFlow_effective_fluid_pressure_nodal_dvar")),
90 _dpf_dvar_qp(getOptionalMaterialProperty<
std::vector<Real>>(
91 "dPorousFlow_effective_fluid_pressure_qp_dvar")),
93 _uses_T(parameters.isParamSetByUser(
"T_coeff") && _T_coeff != 0.0),
94 _temperature_nodal(getOptionalMaterialProperty<Real>(
"PorousFlow_temperature_nodal")),
95 _temperature_qp(getOptionalMaterialProperty<Real>(
"PorousFlow_temperature_qp")),
96 _dtemperature_dvar_nodal(
97 getOptionalMaterialProperty<
std::vector<Real>>(
"dPorousFlow_temperature_nodal_dvar")),
98 _dtemperature_dvar_qp(
99 getOptionalMaterialProperty<
std::vector<Real>>(
"dPorousFlow_temperature_qp_dvar")),
100 _zero_modifier(getParam<Real>(
"zero_modifier"))
111 mooseError(
"PorousFlowPorosityLinear: When P_coeff is given you must have an effective fluid "
112 "pressure Material");
120 "PorousFlowPorosityLinear: When T_coeff is given you must have a temperature Material");
123 mooseError(
"PorousFlowPorosityLinear: When epv_coeff is given you must have a "
124 "volumetric-strain Material");
126 PorousFlowPorosityBase::initialSetup();
133 (*_dporosity_dvar)[_qp].assign(
_num_var, 0.0);
134 (*_dporosity_dgradvar)[_qp].assign(
_num_var, 0.0);
153 const unsigned qp_to_use =
163 (*_dporosity_dvar)[_qp].resize(
_num_var);
164 (*_dporosity_dgradvar)[_qp].resize(
_num_var);
165 for (
unsigned int pvar = 0; pvar <
_num_var; ++pvar)
169 deriv +=
_P_coeff * (*_dpf_dvar)[_qp][pvar];
171 deriv +=
_T_coeff * (*_dtemperature_dvar)[_qp][pvar];
177 RealGradient deriv_grad(0.0, 0.0, 0.0);
180 const unsigned qp_to_use =
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowPorosityLinear)
const MooseArray< Moose::GenericType< T, is_ad > > & get() const
const unsigned int _num_var
Number of PorousFlow variables.
Base class Material designed to provide the porosity.
MaterialProperty< std::vector< RealGradient > > *const _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
MaterialProperty< std::vector< Real > > *const _dporosity_dvar
d(porosity)/d(PorousFlow variable)
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
static InputParameters validParams()
Material designed to provide the porosity in PorousFlow simulations porosity_ref + P_coeff * (P - P_r...
virtual void initQpStatefulProperties() override
const OptionalMaterialProperty< Real > & _pf_nodal
Effective porepressure at the quadpoints or nodes.
const Real _P_coeff
coefficient of effective porepressure
const OptionalMaterialProperty< Real > & _pf_qp
const VariableValue & _P_ref
Reference effective porepressure.
const bool _uses_T
whether T_coeff has been set
const OptionalMaterialProperty< std::vector< RealGradient > > & _dvol_strain_qp_dvar
d(strain)/(dvar) (first const means we never want to dereference and change the value,...
const bool _uses_volstrain
whether epv_coeff has been set
const Real _T_coeff
coefficient of temperature
static InputParameters validParams()
const OptionalMaterialProperty< std::vector< Real > > & _dtemperature_dvar_qp
PorousFlowPorosityLinear(const InputParameters ¶meters)
const VariableValue & _phi_ref
Porosity at reference porepressure, temperature and volumetric strain.
const MaterialProperty< std::vector< Real > > * _dtemperature_dvar
virtual void computeQpProperties() override
const VariableValue & _epv_ref
Reference volumetric strain.
const OptionalMaterialProperty< std::vector< Real > > & _dtemperature_dvar_nodal
d(temperature)/(d porflow variable)
virtual void initialSetup() override
const OptionalMaterialProperty< std::vector< Real > > & _dpf_dvar_nodal
d(effective porepressure)/(d porflow variable)
const OptionalMaterialProperty< std::vector< Real > > & _dpf_dvar_qp
const bool _strain_at_nearest_qp
When calculating nodal porosity, use the strain at the nearest quadpoint to the node.
const OptionalMaterialProperty< Real > & _vol_strain_qp
Strain (first const means we never want to dereference and change the value, second means we'll alway...
const MaterialProperty< Real > * _pf
const bool _uses_pf
whether P_coeff has been set
const MaterialProperty< std::vector< Real > > * _dpf_dvar
const Real _zero_modifier
If the linear relationship produces porosity < _porosity_min, then porosity is set to _porosity_min....
const MaterialProperty< Real > * _temperature
const VariableValue & _T_ref
Reference temperature.
const Real _epv_coeff
coefficient of volumetric strain
const OptionalMaterialProperty< Real > & _temperature_qp
const Real _porosity_min
If the linear relationship produces porosity < _porosity_min, then porosity is set to _porosity_min.
const OptionalMaterialProperty< Real > & _temperature_nodal
Temperature at the quadpoints or nodes.