67 _mechanical(this->template getParam<bool>(
"mechanical")),
68 _fluid(this->template getParam<bool>(
"fluid")),
69 _thermal(this->template getParam<bool>(
"thermal")),
70 _chemical(this->template getParam<bool>(
"chemical")),
71 _phi0(coupledValue(
"porosity_zero")),
72 _biot(this->template getParam<Real>(
"biot_coefficient")),
73 _exp_coeff(this->isParamValid(
"thermal_expansion_coeff")
74 ? this->template getParam<Real>(
"thermal_expansion_coeff")
76 _solid_bulk(this->isParamValid(
"solid_bulk") ? &(this->template getFunctor<Real>(
"solid_bulk"))
78 _coeff(this->isParamValid(
"biot_coefficient_prime")
79 ? (this->template getParam<Real>(
"biot_coefficient_prime") - 1.0)
82 _t_reference(nodalOrQpValue(
"reference_temperature")),
83 _p_reference(nodalOrQpValue(
"reference_porepressure")),
84 _num_c_ref(coupledComponents(
"reference_chemistry")),
85 _c_reference(_num_c_ref),
86 _num_initial_c(coupledComponents(
"initial_mineral_concentrations")),
87 _initial_c(_num_initial_c),
88 _c_weights(this->isParamValid(
"chemical_weights")
89 ? this->template getParam<
std::vector<Real>>(
"chemical_weights")
90 :
std::vector<Real>(_num_c_ref, 1.0)),
93 _chemical ? (_nodal_material
94 ? &this->template getMaterialPropertyOld<Real>(
"PorousFlow_porosity_nodal")
95 : &this->template getMaterialPropertyOld<Real>(
"PorousFlow_porosity_qp"))
97 _vol_strain_qp(_mechanical ? &this->template getGenericMaterialProperty<Real, is_ad>(
98 "PorousFlow_total_volumetric_strain_qp")
100 _dvol_strain_qp_dvar((_mechanical && !is_ad)
101 ? &this->template getMaterialProperty<
std::vector<RealGradient>>(
102 "dPorousFlow_total_volumetric_strain_qp_dvar")
105 _pf(_fluid ? (_nodal_material ? &this->template getGenericMaterialProperty<Real, is_ad>(
106 "PorousFlow_effective_fluid_pressure_nodal")
107 : &this->template getGenericMaterialProperty<Real, is_ad>(
108 "PorousFlow_effective_fluid_pressure_qp"))
110 _dpf_dvar((_fluid && !is_ad)
111 ? (_nodal_material ? &this->template getMaterialProperty<
std::vector<Real>>(
112 "dPorousFlow_effective_fluid_pressure_nodal_dvar")
113 : &this->template getMaterialProperty<
std::vector<Real>>(
114 "dPorousFlow_effective_fluid_pressure_qp_dvar"))
117 _temperature(_thermal
118 ? (_nodal_material ? &this->template getGenericMaterialProperty<Real, is_ad>(
119 "PorousFlow_temperature_nodal")
120 : &this->template getGenericMaterialProperty<Real, is_ad>(
121 "PorousFlow_temperature_qp"))
123 _dtemperature_dvar((_thermal && !is_ad)
125 ? &this->template getMaterialProperty<
std::vector<Real>>(
126 "dPorousFlow_temperature_nodal_dvar")
127 : &this->template getMaterialProperty<
std::vector<Real>>(
128 "dPorousFlow_temperature_qp_dvar"))
131 _mineral_conc_old(_chemical ? (_nodal_material
132 ? &this->template getMaterialPropertyOld<
std::vector<Real>>(
133 "PorousFlow_mineral_concentration_nodal")
134 : &this->template getMaterialPropertyOld<
std::vector<Real>>(
135 "PorousFlow_mineral_concentration_qp"))
137 _reaction_rate(_chemical
138 ? (_nodal_material ? &this->template getMaterialProperty<
std::vector<Real>>(
139 "PorousFlow_mineral_reaction_rate_nodal")
140 : &this->template getMaterialProperty<
std::vector<Real>>(
141 "PorousFlow_mineral_reaction_rate_qp"))
143 _dreaction_rate_dvar(
144 _chemical ? (_nodal_material
145 ? &this->template getMaterialProperty<
std::vector<
std::vector<Real>>>(
146 "dPorousFlow_mineral_reaction_rate_nodal_dvar")
147 : &this->template getMaterialProperty<
std::vector<
std::vector<Real>>>(
148 "dPorousFlow_mineral_reaction_rate_qp_dvar"))
150 _aq_ph(_dictator.aqueousPhaseNumber()),
151 _saturation(_chemical
152 ? (_nodal_material ? &this->template getMaterialProperty<
std::vector<Real>>(
153 "PorousFlow_saturation_nodal")
154 : &this->template getMaterialProperty<
std::vector<Real>>(
155 "PorousFlow_saturation_qp"))
158 _chemical ? (_nodal_material
159 ? &this->template getMaterialProperty<
std::vector<
std::vector<Real>>>(
160 "dPorousFlow_saturation_nodal_dvar")
161 : &this->template getMaterialProperty<
std::vector<
std::vector<Real>>>(
162 "dPorousFlow_saturation_qp_dvar"))
170 "ADPorousFlowPorosity does not support chemical=true: the aqueous "
171 "precipitation/dissolution materials are not AD. Use the non-AD PorousFlowPorosity for "
172 "chemistry-coupled porosity");
174 if (
_thermal && !this->isParamValid(
"thermal_expansion_coeff"))
176 "PorousFlowPorosity: When thermal=true you must provide a thermal_expansion_coeff");
178 this->
mooseError(
"PorousFlowPorosity: When fluid=true you must provide a solid_bulk");
181 "PorousFlowPorosity: When chemical=true you must provide the reference_chemistry "
182 "values. The Dictator proclaims there should be ",
183 _dictator.numAqueousKinetic(),
186 this->
mooseError(
"PorousFlowPorosity: When chemical=true you must provide the "
187 "initial_mineral_concentrations. "
188 "The Dictator proclaims there should be ",
189 _dictator.numAqueousKinetic(),
193 "PorousFlowPorosity: When chemical=true you must provde the correct number of "
194 "chemical_weights (which the Dictator knows is ",
195 _dictator.numAqueousKinetic(),
196 ") or do not provide any chemical_weights and use the default value of 1 for each mineral");
200 _c_reference[i] = &nodalOrQpValue(
"reference_chemistry", i);
201 _initial_c[i] = &nodalOrQpValue(
"initial_mineral_concentrations", i);
289 result += _exp_coeff * ((*_temperature)[_qp] - _t_reference[_qp]);
296 unsigned int qp_used = (_constant_option == Material::ConstantTypeEnum::NONE) ? _qp : 0;
299 const std::set<SubdomainID> subdomain_set = {_current_elem->subdomain_id()};
300 const Moose::NodeArg space_arg = {_current_elem->node_ptr(qp_used), &subdomain_set};
306 _current_elem, _current_side, qp_used, _qrule, _q_point[qp_used]};
311 const Moose::ElemQpArg space_arg = {_current_elem, qp_used, _qrule, _q_point[qp_used]};
315 this->
mooseError(
"PorousFlowPorosity: solid_bulk must be larger than Zero");
316 result += _coeff / solid_bulk * ((*_pf)[_qp] - _p_reference[_qp]);
325 const unsigned qp_to_use =
326 (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
327 result += -(*_vol_strain_qp)[qp_to_use];
340 result += _exp_coeff * (*_dtemperature_dvar)[_qp][pvar];
347 unsigned int qp_used = (_constant_option == Material::ConstantTypeEnum::NONE) ? _qp : 0;
350 const std::set<SubdomainID> subdomain_set = {_current_elem->subdomain_id()};
351 const Moose::NodeArg space_arg = {_current_elem->node_ptr(qp_used), &subdomain_set};
357 _current_elem, _current_side, qp_used, _qrule, _q_point[qp_used]};
362 const Moose::ElemQpArg space_arg = {_current_elem, qp_used, _qrule, _q_point[qp_used]};
366 this->
mooseError(
"PorousFlowPorosity: solid_bulk must be larger than Zero.");
367 result += _coeff / solid_bulk * (*_dpf_dvar)[_qp][pvar];