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(_nodal_material ? coupledDofValues(
"P_ref") : coupledValue(
"P_ref")),
74 _T_ref(_nodal_material ? coupledDofValues(
"T_ref") : coupledValue(
"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)
180 const unsigned qp_to_use =
const bool _strain_at_nearest_qp
When calculating nodal porosity, use the strain at the nearest quadpoint to the node.
Material designed to provide the porosity in PorousFlow simulations porosity_ref + P_coeff * (P - P_r...
const OptionalMaterialProperty< Real > & _temperature_nodal
Temperature at the quadpoints or nodes.
const VariableValue & _T_ref
Reference temperature.
MaterialProperty< std::vector< RealGradient > > *const _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
void mooseError(Args &&... args)
const OptionalMaterialProperty< std::vector< Real > > & _dpf_dvar_nodal
d(effective porepressure)/(d porflow variable)
virtual void initialSetup() override
const Real _P_coeff
coefficient of effective porepressure
const Real _T_coeff
coefficient of temperature
const VariableValue & _epv_ref
Reference volumetric strain.
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< std::vector< Real > > * _dtemperature_dvar
static const std::string porosity
const OptionalMaterialProperty< std::vector< Real > > & _dtemperature_dvar_qp
PorousFlowPorosityLinear(const InputParameters ¶meters)
static InputParameters validParams()
const OptionalMaterialProperty< Real > & _pf_qp
static InputParameters validParams()
Real deriv(unsigned n, unsigned alpha, unsigned beta, Real x)
const bool _uses_pf
whether P_coeff has been set
const OptionalMaterialProperty< std::vector< Real > > & _dpf_dvar_qp
Base class Material designed to provide the porosity.
const MaterialProperty< Real > * _temperature
const unsigned int _num_var
Number of PorousFlow variables.
const bool _uses_T
whether T_coeff has been set
const Real _epv_coeff
coefficient of volumetric strain
const bool _uses_volstrain
whether epv_coeff has been set
MaterialProperty< std::vector< Real > > *const _dporosity_dvar
d(porosity)/d(PorousFlow variable)
const Real _porosity_min
If the linear relationship produces porosity < _porosity_min, then porosity is set to _porosity_min...
const MaterialProperty< std::vector< Real > > * _dpf_dvar
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void initQpStatefulProperties() override
const Real _zero_modifier
If the linear relationship produces porosity < _porosity_min, then porosity is set to _porosity_min...
registerMooseObject("PorousFlowApp", PorousFlowPorosityLinear)
const VariableValue & _P_ref
Reference effective porepressure.
const VariableValue & _phi_ref
Porosity at reference porepressure, temperature and volumetric strain.
const OptionalMaterialProperty< Real > & _pf_nodal
Effective porepressure at the quadpoints or nodes.
const OptionalMaterialProperty< std::vector< Real > > & _dtemperature_dvar_nodal
d(temperature)/(d porflow variable)
const OptionalMaterialProperty< std::vector< RealGradient > > & _dvol_strain_qp_dvar
d(strain)/(dvar) (first const means we never want to dereference and change the value, second means we'll always be pointing to the same address after initialization (like a reference))
virtual void computeQpProperties() override
const MaterialProperty< Real > * _pf
const OptionalMaterialProperty< Real > & _temperature_qp