19 params.addParam<
bool>(
20 "mechanical",
false,
"If true, porosity will be a function of total volumetric strain");
21 params.addParam<
bool>(
22 "fluid",
false,
"If true, porosity will be a function of effective porepressure");
23 params.addParam<
bool>(
"thermal",
false,
"If true, porosity will be a function of temperature");
24 params.addParam<
bool>(
"chemical",
false,
"If true, porosity will be a function of precipitate");
25 params.addRequiredCoupledVar(
"porosity_zero",
26 "The porosity at zero volumetric strain and "
27 "reference temperature and reference effective "
28 "porepressure and reference chemistry. This must be a real number "
29 "or a constant monomial variable (not a linear lagrange or other "
31 params.addParam<Real>(
"thermal_expansion_coeff",
32 "Volumetric thermal expansion coefficient of the drained porous solid "
33 "skeleton (only used if thermal=true)");
34 params.addRangeCheckedParam<Real>(
35 "biot_coefficient", 1,
"biot_coefficient>=0 & biot_coefficient<=1",
"Biot coefficient");
36 params.addRangeCheckedParam<Real>(
39 "Bulk modulus of the drained porous solid skeleton (only used if fluid=true)");
41 "reference_temperature", 0.0,
"Reference temperature (only used if thermal=true)");
43 "reference_porepressure", 0.0,
"Reference porepressure (only used if fluid=true)");
44 params.addCoupledVar(
"reference_chemistry",
45 "Reference values of the solid mineral concentrations "
46 "(m^3(precipitate)/m^3(porous material)), entered as "
47 "a vector (one value per mineral). (Only used if chemical=true)");
49 "initial_mineral_concentrations",
50 "Initial mineral concentrations (m^3(precipitate)/m^3(porous material)), entered as "
51 "a vector (one value per mineral). (Only used if chemical=true)");
52 params.addParam<std::vector<Real>>(
"chemical_weights",
53 "When chemical=true, porosity is a linear combination of the "
54 "solid mineral concentrations multiplied by these weights. "
55 "Default=1 for all minerals.");
56 params.addClassDescription(
"This Material calculates the porosity PorousFlow simulations");
63 _mechanical(getParam<bool>(
"mechanical")),
64 _fluid(getParam<bool>(
"fluid")),
65 _thermal(getParam<bool>(
"thermal")),
66 _chemical(getParam<bool>(
"chemical")),
67 _phi0(coupledValue(
"porosity_zero")),
68 _biot(getParam<Real>(
"biot_coefficient")),
69 _exp_coeff(isParamValid(
"thermal_expansion_coeff") ? getParam<Real>(
"thermal_expansion_coeff")
71 _solid_bulk(isParamValid(
"solid_bulk") ? getParam<Real>(
"solid_bulk")
72 : std::numeric_limits<Real>::max()),
73 _coeff((_biot - 1.0) / _solid_bulk),
75 _t_reference(_nodal_material ? coupledDofValues(
"reference_temperature")
76 : coupledValue(
"reference_temperature")),
77 _p_reference(_nodal_material ? coupledDofValues(
"reference_porepressure")
78 : coupledValue(
"reference_porepressure")),
79 _num_c_ref(coupledComponents(
"reference_chemistry")),
80 _c_reference(_num_c_ref),
81 _num_initial_c(coupledComponents(
"initial_mineral_concentrations")),
82 _initial_c(_num_initial_c),
83 _c_weights(isParamValid(
"chemical_weights") ? getParam<std::vector<Real>>(
"chemical_weights")
84 : std::vector<Real>(_num_c_ref, 1.0)),
86 _porosity_old(_chemical ? (_nodal_material
87 ? &getMaterialPropertyOld<Real>(
"PorousFlow_porosity_nodal")
88 : &getMaterialPropertyOld<Real>(
"PorousFlow_porosity_qp"))
90 _vol_strain_qp(_mechanical ? &getMaterialProperty<Real>(
"PorousFlow_total_volumetric_strain_qp")
92 _dvol_strain_qp_dvar(_mechanical ? &getMaterialProperty<std::vector<
RealGradient>>(
93 "dPorousFlow_total_volumetric_strain_qp_dvar")
96 _pf(_fluid ? (_nodal_material
97 ? &getMaterialProperty<Real>(
"PorousFlow_effective_fluid_pressure_nodal")
98 : &getMaterialProperty<Real>(
"PorousFlow_effective_fluid_pressure_qp"))
100 _dpf_dvar(_fluid ? (_nodal_material ? &getMaterialProperty<std::vector<Real>>(
101 "dPorousFlow_effective_fluid_pressure_nodal_dvar")
102 : &getMaterialProperty<std::vector<Real>>(
103 "dPorousFlow_effective_fluid_pressure_qp_dvar"))
106 _temperature(_thermal
107 ? (_nodal_material ? &getMaterialProperty<Real>(
"PorousFlow_temperature_nodal")
108 : &getMaterialProperty<Real>(
"PorousFlow_temperature_qp"))
113 ? &getMaterialProperty<std::vector<Real>>(
"dPorousFlow_temperature_nodal_dvar")
114 : &getMaterialProperty<std::vector<Real>>(
"dPorousFlow_temperature_qp_dvar"))
117 _mineral_conc_old(_chemical ? (_nodal_material ? &getMaterialPropertyOld<std::vector<Real>>(
118 "PorousFlow_mineral_concentration_nodal")
119 : &getMaterialPropertyOld<std::vector<Real>>(
120 "PorousFlow_mineral_concentration_qp"))
122 _reaction_rate(_chemical ? (_nodal_material ? &getMaterialProperty<std::vector<Real>>(
123 "PorousFlow_mineral_reaction_rate_nodal")
124 : &getMaterialProperty<std::vector<Real>>(
125 "PorousFlow_mineral_reaction_rate_qp"))
127 _dreaction_rate_dvar(_chemical ? (_nodal_material
128 ? &getMaterialProperty<std::vector<std::vector<Real>>>(
129 "dPorousFlow_mineral_reaction_rate_nodal_dvar")
130 : &getMaterialProperty<std::vector<std::vector<Real>>>(
131 "dPorousFlow_mineral_reaction_rate_qp_dvar"))
133 _aq_ph(_dictator.aqueousPhaseNumber()),
134 _saturation(_chemical
136 ? &getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")
137 : &getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_qp"))
139 _dsaturation_dvar(_chemical
140 ? (_nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
141 "dPorousFlow_saturation_nodal_dvar")
142 : &getMaterialProperty<std::vector<std::vector<Real>>>(
143 "dPorousFlow_saturation_qp_dvar"))
146 if (
_thermal && !isParamValid(
"thermal_expansion_coeff"))
147 mooseError(
"PorousFlowPorosity: When thermal=true you must provide a thermal_expansion_coeff");
148 if (
_fluid && !isParamValid(
"solid_bulk"))
149 mooseError(
"PorousFlowPorosity: When fluid=true you must provide a solid_bulk");
151 mooseError(
"PorousFlowPorosity: When chemical=true you must provide the reference_chemistry "
152 "values. The Dictator proclaims there should be ",
153 _dictator.numAqueousKinetic(),
156 mooseError(
"PorousFlowPorosity: When chemical=true you must provide the "
157 "initial_mineral_concentrations. "
158 "The Dictator proclaims there should be ",
159 _dictator.numAqueousKinetic(),
163 "PorousFlowPorosity: When chemical=true you must provde the correct number of "
164 "chemical_weights (which the Dictator knows is ",
165 _dictator.numAqueousKinetic(),
166 ") or do not provide any chemical_weights and use the default value of 1 for each mineral");
170 _c_reference[i] = (_nodal_material ? &coupledDofValues(
"reference_chemistry", i)
171 : &coupledValue(
"reference_chemistry", i));
172 _initial_c[i] = (_nodal_material ? &coupledDofValues(
"initial_mineral_concentrations", i)
173 : &coupledValue(
"initial_mineral_concentrations", i));
194 if (_t_step == 0 && !_app.isRestarting())
200 (*_saturation)[_qp][
_aq_ph] *
201 (*_reaction_rate)[_qp][i]);
210 if (
_chemical && (_t_step >= 1 || _app.isRestarting()))
213 ((*_saturation)[_qp][
_aq_ph] * (*_dreaction_rate_dvar)[_qp][i][pvar] +
214 (*_dsaturation_dvar)[_qp][
_aq_ph][pvar] * (*_reaction_rate)[_qp][i]);
222 Real result =
_phi0[0];
225 if (_t_step == 0 && !_app.isRestarting())
231 _dt * (*_porosity_old)[_qp] * (*_saturation)[_qp][
_aq_ph] *
232 (*_reaction_rate)[_qp][i] -
242 if (
_chemical && (_t_step >= 1 || _app.isRestarting()))
245 ((*_saturation)[_qp][
_aq_ph] * (*_dreaction_rate_dvar)[_qp][i][pvar] +
246 (*_dsaturation_dvar)[_qp][
_aq_ph][pvar] * (*_reaction_rate)[_qp][i]);
267 const unsigned qp_to_use =
269 result += -(*_vol_strain_qp)[qp_to_use];
281 result +=
_exp_coeff * (*_dtemperature_dvar)[_qp][pvar];
284 result +=
_coeff * (*_dpf_dvar)[_qp][pvar];
295 const unsigned qp_to_use =
297 result += -(*_dvol_strain_qp_dvar)[qp_to_use][pvar];