19 "primary_concentrations",
20 "List of MOOSE Variables that represent the concentrations of the primary species");
22 "Number of equations in the system of chemical reactions");
23 params.
addParam<
bool>(
"equilibrium_constants_as_log10",
25 "If true, the equilibrium constants are written in their log10 form, eg, " 26 "-2. If false, the equilibrium constants are written in absolute terms, " 29 "Equilibrium constant for each equation (dimensionless). If these " 30 "are temperature dependent AuxVariables, the Jacobian will not be " 33 "primary_activity_coefficients",
34 "Activity coefficients for the primary species (dimensionless) (one for each)");
37 "A matrix defining the aqueous reactions. The matrix is entered as a long vector: the first " 39 "entered first, followed by the second row, etc. There should be num_reactions rows. All " 40 "primary species should appear only on the LHS of each reaction (and there should be just " 41 "one secondary species on the RHS, by definition) so they may have negative coefficients. " 42 "Each row should have number of primary_concentrations entries, which are the stoichiometric " 43 "coefficients. The first coefficient must always correspond to the first primary species, " 46 "Specific reactive surface area in m^2/(L solution).");
48 "kinetic_rate_constant",
49 "Kinetic rate constant in mol/(m^2 s), at the reference temperature (one for each reaction)");
51 "Volume occupied by one mole of the secondary species " 52 "(L(solution)/mol) (one for each reaction)");
54 "Activation energy, J/mol (one for each reaction)");
55 params.
addParam<
Real>(
"gas_constant", 8.31434,
"Gas constant, in J/(mol K)");
56 params.
addParam<
Real>(
"reference_temperature", 298.15,
"Reference temperature, K");
57 params.
addParam<std::vector<Real>>(
"theta_exponent",
58 "Theta exponent. Defaults to 1. (one for each reaction)");
59 params.
addParam<std::vector<Real>>(
"eta_exponent",
60 "Eta exponent. Defaults to 1. (one for each reaction)");
62 params.
addClassDescription(
"This Material forms a std::vector of mineralisation reaction rates " 63 "(L(precipitate)/L(solution)/s) appropriate to the aqueous " 64 "precipitation-dissolution system provided. Note: the " 65 "PorousFlowTemperature must be measured in Kelvin.");
72 _porosity_old(_nodal_material ? getMaterialPropertyOld<
Real>(
"PorousFlow_porosity_nodal")
73 : getMaterialPropertyOld<
Real>(
"PorousFlow_porosity_qp")),
74 _aq_ph(_dictator.aqueousPhaseNumber()),
75 _saturation(_nodal_material
76 ? getMaterialProperty<
std::vector<
Real>>(
"PorousFlow_saturation_nodal")
77 : getMaterialProperty<
std::vector<
Real>>(
"PorousFlow_saturation_qp")),
79 _temperature(_nodal_material ? getMaterialProperty<
Real>(
"PorousFlow_temperature_nodal")
80 : getMaterialProperty<
Real>(
"PorousFlow_temperature_qp")),
83 ? getMaterialProperty<
std::vector<
Real>>(
"dPorousFlow_temperature_nodal_dvar")
84 : getMaterialProperty<
std::vector<
Real>>(
"dPorousFlow_temperature_qp_dvar")),
86 _num_primary(coupledComponents(
"primary_concentrations")),
87 _num_reactions(getParam<unsigned>(
"num_reactions")),
88 _equilibrium_constants_as_log10(getParam<bool>(
"equilibrium_constants_as_log10")),
89 _num_equilibrium_constants(coupledComponents(
"equilibrium_constants")),
90 _equilibrium_constants(_num_equilibrium_constants),
91 _primary_activity_coefficients(getParam<
std::vector<
Real>>(
"primary_activity_coefficients")),
92 _reactions(getParam<
std::vector<
Real>>(
"reactions")),
96 ? getMaterialPropertyOld<
std::vector<
Real>>(
"PorousFlow_mineral_concentration_nodal")
97 : getMaterialPropertyOld<
std::vector<
Real>>(
"PorousFlow_mineral_concentration_qp")),
99 _mineral_sat(_num_reactions),
100 _bounded_rate(_num_reactions),
103 ? declareProperty<
std::vector<
Real>>(
"PorousFlow_mineral_reaction_rate_nodal")
104 : declareProperty<
std::vector<
Real>>(
"PorousFlow_mineral_reaction_rate_qp")),
105 _dreaction_rate_dvar(_nodal_material ? declareProperty<
std::vector<
std::vector<
Real>>>(
106 "dPorousFlow_mineral_reaction_rate_nodal_dvar")
107 : declareProperty<
std::vector<
std::vector<
Real>>>(
108 "dPorousFlow_mineral_reaction_rate_qp_dvar")),
110 _r_area(getParam<
std::vector<
Real>>(
"specific_reactive_surface_area")),
111 _molar_volume(getParam<
std::vector<
Real>>(
"molar_volume")),
112 _ref_kconst(getParam<
std::vector<
Real>>(
"kinetic_rate_constant")),
113 _e_act(getParam<
std::vector<
Real>>(
"activation_energy")),
114 _gas_const(getParam<
Real>(
"gas_constant")),
115 _one_over_ref_temp(1.0 / getParam<
Real>(
"reference_temperature")),
116 _theta_exponent(isParamValid(
"theta_exponent") ? getParam<
std::vector<
Real>>(
"theta_exponent")
117 :
std::vector<
Real>(_num_reactions, 1.0)),
118 _eta_exponent(isParamValid(
"eta_exponent") ? getParam<
std::vector<
Real>>(
"eta_exponent")
119 :
std::vector<
Real>(_num_reactions, 1.0))
121 if (_dictator.numPhases() < 1)
122 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of fluid phases must not be zero");
125 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of mass_fraction_vars is ",
127 " which must be one greater than the number of primary concentrations (which is ",
133 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of equilibrium constants is ",
135 " which must be equal to the number of reactions (",
141 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of primary activity " 144 " which must be equal to the number of primary species (",
150 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of stoichiometric " 151 "coefficients specified in 'reactions' (",
153 ") must be equal to the number of reactions (",
155 ") multiplied by the number of primary species (",
160 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of specific reactive " 161 "surface areas provided is ",
163 " which must be equal to the number of reactions (",
168 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of kinetic rate constants is ",
170 " which must be equal to the number of reactions (",
175 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of activation energies is ",
177 " which must be equal to the number of reactions (",
182 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of molar volumes is ",
184 " which must be equal to the number of reactions (",
189 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of theta exponents is ",
191 " which must be equal to the number of reactions (",
196 mooseError(
"PorousFlowAqueousPreDisChemistry: The number of eta exponents is ",
198 " which must be equal to the number of reactions (",
203 mooseError(
"PorousFlowAqueousPreDisChemistry: You have specified the number of " 206 " but the Dictator knows that the number of aqueous kinetic " 207 "(precipitation-dissolution) reactions is ",
208 _dictator.numAqueousKinetic());
215 _primary[i] = (_nodal_material ? &coupledDofValues(
"primary_concentrations", i)
216 : &coupledValue(
"primary_concentrations", i));
223 const bool is_nodal = isCoupled(
"equilibrium_constants")
224 ? getFieldVar(
"equilibrium_constants", i)->isNodal()
228 (_nodal_material && is_nodal ? &coupledDofValues(
"equilibrium_constants", i)
229 : &coupledValue(
"equilibrium_constants", i));
268 const unsigned pf_wrt = _dictator.porousFlowVariableNum(
_primary_var_num[wrt]);
284 const unsigned index = reaction_num *
_num_primary + primary_num;
290 unsigned & zero_count)
const 334 const Real sgn = (fac < 0 ? -1.0 : 1.0);
374 std::vector<Real> & drr)
const 397 unsigned zero_count = 0;
398 unsigned zero_conc_index = 0;
414 if (zero_count == 1 &&
stoichiometry(reaction_num, zero_conc_index) == 1.0)
421 if (i == zero_conc_index)
428 drr[zero_conc_index] = conc_without_zero;
430 else if (zero_count == 0 and
stoichiometry(reaction_num, zero_conc_index) < 1.0)
431 drr[zero_conc_index] = std::numeric_limits<Real>::max();
447 drr[i] *= multiplier;
467 const Real sgn = (fac < 0 ? -1.0 : 1.0);
468 const Real dkinetic_rate = -
sgn * drate_const *
_r_area[reaction_num] *
472 return dkinetic_rate;
const MaterialProperty< std::vector< Real > > & _sec_conc_old
const unsigned _num_equilibrium_constants
Number of equilibrium_constants provided.
std::vector< Real > _mineral_sat
Mineral saturation ratio - a useful temporary variable during computeQpProperties.
static InputParameters validParams()
void mooseError(Args &&... args)
virtual void computeQpReactionRates()
Compute the secondary-species concentration as defined by the chemistry Must be overridden by derived...
const std::vector< Real > _reactions
Stoichiometry defining the aqeuous geochemistry equilibrium reactions.
const bool _equilibrium_constants_as_log10
Whether the equilibium constants are written in their log10 form, or in absolute terms.
static InputParameters validParams()
int sgn(T val)
The sign function.
MaterialProperty< std::vector< Real > > & _reaction_rate
Reaction rate of mineralisation.
Material designed to form a std::vector of mass fractions of mineral concentrations from primary-spec...
const std::vector< Real > _molar_volume
Molar volume (L/mol) for each secondary species.
PorousFlowAqueousPreDisChemistry(const InputParameters ¶meters)
registerMooseObject("PorousFlowApp", PorousFlowAqueousPreDisChemistry)
MaterialProperty< std::vector< std::vector< Real > > > & _dreaction_rate_dvar
d(reaction rate of mineralisation)/d(porous flow var)
virtual void resize(const std::size_t size) override final
const std::vector< Real > _r_area
Reactive surface area (m^2/L) for each reaction.
const Real _gas_const
Gas constant (J/(mol K))
const MaterialProperty< Real > & _temperature
Temperature.
Real rateConstantQp(unsigned reaction_num) const
Base class for all PorousFlow vector materials.
const unsigned int _num_components
Number of fluid components.
std::vector< const VariableValue * > _primary
Values of the primary species' concentrations (dimensionless)
virtual Real dQpReactionRate_dT(unsigned reaction_num) const
Computes derivative of the reaction rate with respect to the temperature.
void initQpStatefulProperties() override
Real stoichiometry(unsigned reaction_num, unsigned primary_num) const
The stoichiometric coefficient.
const std::vector< Real > _eta_exponent
Eta exponent for the precipitation-dissolution for each reaction.
const std::vector< Real > _theta_exponent
Theta exponent for the precipitation-dissolution for each reaction.
const unsigned int _num_var
Number of PorousFlow variables.
void computeQpProperties() override
const MaterialProperty< std::vector< Real > > & _saturation
Saturation.
const unsigned int _num_primary
Number of primary species.
std::vector< bool > _bounded_rate
Whether the reaction rate has to be bounded in order that the precipitate stays inside [0...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
void findZeroConcentration(unsigned &zero_conc_index, unsigned &zero_count) const
Checks gamp[i] = _primary_activity_coefficients[i] * (*_primary[i])[qp].
const std::vector< Real > _ref_kconst
Rate constant (mol/(m^2 s)) at reference temperature for each reaction.
std::vector< unsigned int > _primary_var_num
The variable number of the primary variables.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const std::vector< Real > _primary_activity_coefficients
Activity coefficients for the primary species (dimensionless)
virtual void dQpReactionRate_dprimary(unsigned reaction_num, std::vector< Real > &drr) const
Computes derivative of the reaction rate with respect to the primary concentrations.
const unsigned int _num_reactions
Number of equations in the aqueous geochemistry system.
const MaterialProperty< Real > & _porosity_old
Old values of the porosity.
const unsigned int _aq_ph
Aqueous phase number.
MooseUnits pow(const MooseUnits &, int)
const std::vector< Real > _e_act
Activation energy (J/mol) for each reaction.
const Real _one_over_ref_temp
1/reference_temperature (1/K)
const MaterialProperty< std::vector< Real > > & _dtemperature_dvar
d(temperature)/(d porflow variable)
std::vector< const VariableValue * > _equilibrium_constants
Equilibrium constants (dimensionless)