19 params.addRequiredCoupledVar(
20 "primary_concentrations",
21 "List of MOOSE Variables that represent the concentrations of the primary species");
22 params.addRequiredParam<
unsigned>(
"num_reactions",
23 "Number of equations in the system of chemical reactions");
24 params.addParam<
bool>(
"equilibrium_constants_as_log10",
26 "If true, the equilibrium constants are written in their log10 form, eg, "
27 "-2. If false, the equilibrium constants are written in absolute terms, "
29 params.addRequiredCoupledVar(
"equilibrium_constants",
30 "Equilibrium constant for each equation (dimensionless). If these "
31 "are temperature dependent AuxVariables, the Jacobian will not be "
33 params.addRequiredParam<std::vector<Real>>(
34 "primary_activity_coefficients",
35 "Activity coefficients for the primary species (dimensionless) (one for each)");
36 params.addRequiredParam<std::vector<Real>>(
38 "A matrix defining the aqueous reactions. The matrix is entered as a long vector: the first "
40 "entered first, followed by the second row, etc. There should be num_reactions rows. All "
41 "primary species should appear only on the LHS of each reaction (and there should be just "
42 "one secondary species on the RHS, by definition) so they may have negative coefficients. "
43 "Each row should have number of primary_concentrations entries, which are the stoichiometric "
44 "coefficients. The first coefficient must always correspond to the first primary species, "
46 params.addRequiredParam<std::vector<Real>>(
"specific_reactive_surface_area",
47 "Specific reactive surface area in m^2/(L solution).");
48 params.addRequiredParam<std::vector<Real>>(
49 "kinetic_rate_constant",
50 "Kinetic rate constant in mol/(m^2 s), at the reference temperature (one for each reaction)");
51 params.addRequiredParam<std::vector<Real>>(
"molar_volume",
52 "Volume occupied by one mole of the secondary species "
53 "(L(solution)/mol) (one for each reaction)");
54 params.addRequiredParam<std::vector<Real>>(
"activation_energy",
55 "Activation energy, J/mol (one for each reaction)");
56 params.addParam<Real>(
"gas_constant", 8.31434,
"Gas constant, in J/(mol K)");
57 params.addParam<Real>(
"reference_temperature", 298.15,
"Reference temperature, K");
58 params.addParam<std::vector<Real>>(
"theta_exponent",
59 "Theta exponent. Defaults to 1. (one for each reaction)");
60 params.addParam<std::vector<Real>>(
"eta_exponent",
61 "Eta exponent. Defaults to 1. (one for each reaction)");
62 params.addPrivateParam<std::string>(
"pf_material_type",
"chemistry");
63 params.addClassDescription(
"This Material forms a std::vector of mineralisation reaction rates "
64 "(L(precipitate)/L(solution)/s) appropriate to the aqueous "
65 "precipitation-dissolution system provided. Note: the "
66 "PorousFlowTemperature must be measured in Kelvin.");
71 const InputParameters & parameters)
73 _porosity_old(_nodal_material ? getMaterialPropertyOld<Real>(
"PorousFlow_porosity_nodal")
74 : getMaterialPropertyOld<Real>(
"PorousFlow_porosity_qp")),
75 _aq_ph(_dictator.aqueousPhaseNumber()),
76 _saturation(_nodal_material
77 ? getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")
78 : getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_qp")),
80 _temperature(_nodal_material ? getMaterialProperty<Real>(
"PorousFlow_temperature_nodal")
81 : getMaterialProperty<Real>(
"PorousFlow_temperature_qp")),
84 ? getMaterialProperty<std::vector<Real>>(
"dPorousFlow_temperature_nodal_dvar")
85 : getMaterialProperty<std::vector<Real>>(
"dPorousFlow_temperature_qp_dvar")),
87 _num_primary(coupledComponents(
"primary_concentrations")),
88 _num_reactions(getParam<unsigned>(
"num_reactions")),
89 _equilibrium_constants_as_log10(getParam<bool>(
"equilibrium_constants_as_log10")),
90 _num_equilibrium_constants(coupledComponents(
"equilibrium_constants")),
91 _equilibrium_constants(_num_equilibrium_constants),
92 _primary_activity_coefficients(getParam<std::vector<Real>>(
"primary_activity_coefficients")),
93 _reactions(getParam<std::vector<Real>>(
"reactions")),
97 ? getMaterialPropertyOld<std::vector<Real>>(
"PorousFlow_mineral_concentration_nodal")
98 : getMaterialPropertyOld<std::vector<Real>>(
"PorousFlow_mineral_concentration_qp")),
100 _mineral_sat(_num_reactions),
101 _bounded_rate(_num_reactions),
104 ? declareProperty<std::vector<Real>>(
"PorousFlow_mineral_reaction_rate_nodal")
105 : declareProperty<std::vector<Real>>(
"PorousFlow_mineral_reaction_rate_qp")),
106 _dreaction_rate_dvar(_nodal_material ? declareProperty<std::vector<std::vector<Real>>>(
107 "dPorousFlow_mineral_reaction_rate_nodal_dvar")
108 : declareProperty<std::vector<std::vector<Real>>>(
109 "dPorousFlow_mineral_reaction_rate_qp_dvar")),
111 _r_area(getParam<std::vector<Real>>(
"specific_reactive_surface_area")),
112 _molar_volume(getParam<std::vector<Real>>(
"molar_volume")),
113 _ref_kconst(getParam<std::vector<Real>>(
"kinetic_rate_constant")),
114 _e_act(getParam<std::vector<Real>>(
"activation_energy")),
115 _gas_const(getParam<Real>(
"gas_constant")),
116 _one_over_ref_temp(1.0 / getParam<Real>(
"reference_temperature")),
117 _theta_exponent(isParamValid(
"theta_exponent") ? getParam<std::vector<Real>>(
"theta_exponent")
118 : std::vector<Real>(_num_reactions, 1.0)),
119 _eta_exponent(isParamValid(
"eta_exponent") ? getParam<std::vector<Real>>(
"eta_exponent")
120 : std::vector<Real>(_num_reactions, 1.0))
122 if (_dictator.numPhases() < 1)
123 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of fluid phases must not be zero");
126 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of mass_fraction_vars is ",
128 " which must be one greater than the number of primary concentrations (which is ",
134 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of equilibrium constants is ",
136 " which must be equal to the number of reactions (",
142 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of primary activity "
145 " which must be equal to the number of primary species (",
151 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of stoichiometric "
152 "coefficients specified in 'reactions' (",
154 ") must be equal to the number of reactions (",
156 ") multiplied by the number of primary species (",
161 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of specific reactive "
162 "surface areas provided is ",
164 " which must be equal to the number of reactions (",
169 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of kinetic rate constants is ",
171 " which must be equal to the number of reactions (",
176 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of activation energies is ",
178 " which must be equal to the number of reactions (",
183 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of molar volumes is ",
185 " which must be equal to the number of reactions (",
190 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of theta exponents is ",
192 " which must be equal to the number of reactions (",
197 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of eta exponents is ",
199 " which must be equal to the number of reactions (",
204 mooseError(
"PorousFlowAqueousPreDisChemistry: You have specified the number of "
207 " but the Dictator knows that the number of aqueous kinetic "
208 "(precipitation-dissolution) reactions is ",
209 _dictator.numAqueousKinetic());
216 _primary[i] = (_nodal_material ? &coupledDofValues(
"primary_concentrations", i)
217 : &coupledValue(
"primary_concentrations", i));
222 : &coupledValue(
"equilibrium_constants", i));
260 const unsigned pf_wrt = _dictator.porousFlowVariableNum(
_primary_var_num[wrt]);
269 for (
unsigned v = 0; v <
_num_var; ++v)
276 const unsigned index = reaction_num *
_num_primary + primary_num;
282 unsigned & zero_count)
const
326 const Real sgn = (fac < 0 ? -1.0 : 1.0);
366 std::vector<Real> & drr)
const
389 unsigned zero_count = 0;
390 unsigned zero_conc_index = 0;
406 if (zero_count == 1 &&
stoichiometry(reaction_num, zero_conc_index) == 1.0)
413 if (i == zero_conc_index)
420 drr[zero_conc_index] = conc_without_zero;
422 else if (zero_count == 0 and
stoichiometry(reaction_num, zero_conc_index) < 1.0)
423 drr[zero_conc_index] = std::numeric_limits<Real>::max();
439 drr[i] *= multiplier;
459 const Real sgn = (fac < 0 ? -1.0 : 1.0);
460 const Real dkinetic_rate = -sgn * drate_const *
_r_area[reaction_num] *
464 return dkinetic_rate;