https://mooseframework.inl.gov
GeochemistryKineticRate.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13 
16 {
18  params.addRequiredParam<std::string>(
19  "kinetic_species_name",
20  "The name of the kinetic species that will be controlled by this rate");
21  params.addRequiredRangeCheckedParam<Real>("intrinsic_rate_constant",
22  "intrinsic_rate_constant >= 0.0",
23  "The intrinsic rate constant for the reaction");
24  params.addRangeCheckedParam<Real>(
25  "area_quantity",
26  1.0,
27  "area_quantity > 0.0",
28  "The surface area of the kinetic species in m^2 (if multiply_by_mass = false) or the "
29  "specific surface area of the kinetic species in m^2/g (if multiply_by_mass = true)");
30  params.addParam<bool>(
31  "multiply_by_mass",
32  false,
33  "Whether the rate should be multiplied by the kinetic_species mass (in grams)");
34  params.addParam<Real>("kinetic_molal_index",
35  0.0,
36  "The rate is multiplied by kinetic_species_molality^kinetic_molal_index / "
37  "(kinetic_species_molality^kinetic_molal_index + "
38  "kinetic_half_saturation^kinetic_molal_index)^kinetic_monod_index");
39  params.addParam<Real>("kinetic_monod_index",
40  0.0,
41  "The rate is multiplied by kinetic_species_molality^kinetic_molal_index / "
42  "(kinetic_species_molality^kinetic_molal_index + "
43  "kinetic_half_saturation^kinetic_molal_index)^kinetic_monod_index");
44  params.addParam<Real>("kinetic_half_saturation",
45  0.0,
46  "The rate is multiplied by kinetic_species_molality^kinetic_molal_index / "
47  "(kinetic_species_molality^kinetic_molal_index + "
48  "kinetic_half_saturation^kinetic_molal_index)^kinetic_monod_index");
49  params.addParam<std::vector<std::string>>(
50  "promoting_species_names", {}, "Names of any promoting species");
51  params.addParam<std::vector<Real>>("promoting_indices", {}, "Indices of the promoting species");
52  params.addParam<std::vector<Real>>(
53  "promoting_monod_indices",
54  "Indices of the monod denominators of the promoting species. If not given, then the default "
55  "is 0 for each promoting species, meaning that there is no monod form");
56  params.addParam<std::vector<Real>>("promoting_half_saturation",
57  "Half-saturation constants for the monod expression. If not "
58  "given, then the default is 0 for each promoting species");
59  params.addParam<Real>("theta", 1.0, "Theta parameter, which appears in |1 - (Q/K)^theta|^eta");
60  params.addParam<Real>("eta", 1.0, "Eta parameter, which appears in |1 - (Q/K)^theta|^eta");
61  params.addRangeCheckedParam<Real>(
62  "activation_energy",
63  0.0,
64  "activation_energy >= 0.0",
65  "Activation energy, in J.mol^-1, which appears in exp(activation_energy / R * (1/T0 - 1/T))");
66  params.addParam<Real>(
67  "one_over_T0",
68  0.0,
69  "1/T0, in 1/Kelvin, which appears in exp(activation_energy / R * (1/T0 - 1/T))");
70  MooseEnum direction("both dissolution precipitation raw death", "both");
71  params.addParam<MooseEnum>(
72  "direction",
73  direction,
74  "Direction of reaction. Let Q = the activity product of the kinetic reaction, and K = the "
75  "equilibrium constant of the reaction. Then direction means the following. both = "
76  "dissolution and precipitation are allowed. (Specifically, if Q < K then dissolution will "
77  "occur, that is, the kinetic species mass will decrease with time. If Q > K then "
78  "precipitation will occur, that is, the kinetic species mass will increase with time.) "
79  "dissolution = if Q < K then dissolution will occur, and when Q > K then the rate will be "
80  "set to zero so that precipitation will be prevented. precipitation = if Q > K then "
81  "precipitation will occur, and when Q < K then the rate will be set to zero so that "
82  "dissolution will be prevented. raw = the rate will not depend on sgn(1 - (Q/K)), which "
83  "means dissolution will occur if intrinsic_rate_constant > 0, and precipitation will occur "
84  "when intrinsic_rate_constant < 0. death = the rate will not depend on sgn(1 - (Q/K)), "
85  "which means dissolution will occur if intrinsic_rate_constant > 0, and precipitation will "
86  "occur when intrinsic_rate_constant < 0, and, in addition, no reactants will be produced or "
87  "consumed by this kinetic reaction (only the kinetic species mass will change).");
88  params.addParam<std::string>(
89  "non_kinetic_biological_catalyst",
90  "H2O",
91  "Name of the primary or equilibrium species that acts as a biological catalyst.");
92  params.addParam<Real>(
93  "non_kinetic_biological_efficiency",
94  0.0,
95  "When one mole of the kinetic species dissolves, non_kinetic_biological_efficiency moles of "
96  "the non_kinetic_biological_catalyst is created");
97  params.addParam<Real>(
98  "kinetic_biological_efficiency",
99  -1,
100  "This is used when modelling biologically-catalysed reactions, when the biomass is treated "
101  "as a kinetic species, and the reactants and reactant-products are in equilibrium in the "
102  "aqueous solution. When one mole of reaction is catalysed, the biomass increases by "
103  "kinetic_biological_efficiency moles");
104  params.addParam<Real>(
105  "energy_captured",
106  0.0,
107  "In biologically-catalysed kinetic reactions, this is the energy captured by the cell, per "
108  "mol of reaction turnover. Specifically, for each mole of kinetic reaction, the microbe "
109  "will produce m moles of ATP via a reaction such as ADP + PO4--- -> ATP + H2O, with "
110  "free-energy change G (usually around 45 kJ/mol). Then, energy_captured = m * G. For "
111  "non-biologically-catalysed reactions, this should be zero. The impact of energy_captured "
112  "is that the reaction's equilibrium constant is K_database * exp(-energy_captured / R / "
113  "T_in_Kelvin)");
114  params.addClassDescription(
115  "User object that defines a kinetic rate. Note that more than one rate can be prescribed to "
116  "a single kinetic_species: the sum the individual rates defines the overall rate. "
117  "GeochemistryKineticRate simply specifies the algebraic form for a kinetic rate: to actually "
118  "use it in a calculation, you must use it in the GeochemicalModelDefinition. The rate is "
119  "intrinsic_rate_constant * area_quantity * (optionally, mass of kinetic_species in "
120  "grams) * kinetic_molality^kinetic_molal_index / (kinetic_molality^kinetic_molal_index + "
121  "kinetic_half_saturation^kinetic_molal_index)^kinetic_monod_index * "
122  "(product_over_promoting_species m^promoting_index / (m^promoting_index + "
123  "promoting_half_saturation^promiting_index)^promoting_monod_index) * |1 - (Q/K)^theta|^eta * "
124  "exp(activation_energy / R * (1/T0 - 1/T)) * Direction(1 - (Q/K)). Please see the markdown "
125  "documentation for examples");
126 
127  return params;
128 }
129 
131  : GeneralUserObject(parameters),
132  _promoting_names(getParam<std::vector<std::string>>("promoting_species_names")),
133  _monod_ind(isParamValid("promoting_monod_indices")
134  ? getParam<std::vector<Real>>("promoting_monod_indices")
135  : std::vector<Real>(_promoting_names.size(), 0.0)),
136  _half_sat(isParamValid("promoting_half_saturation")
137  ? getParam<std::vector<Real>>("promoting_half_saturation")
138  : std::vector<Real>(_promoting_names.size(), 0.0)),
139  _rate_description(getParam<std::string>("kinetic_species_name"),
140  getParam<Real>("intrinsic_rate_constant"),
141  getParam<Real>("area_quantity"),
142  getParam<bool>("multiply_by_mass"),
143  getParam<Real>("kinetic_molal_index"),
144  getParam<Real>("kinetic_monod_index"),
145  getParam<Real>("kinetic_half_saturation"),
146  _promoting_names,
147  getParam<std::vector<Real>>("promoting_indices"),
148  _monod_ind,
149  _half_sat,
150  getParam<Real>("theta"),
151  getParam<Real>("eta"),
152  getParam<Real>("activation_energy"),
153  getParam<Real>("one_over_T0"),
154  getParam<MooseEnum>("direction").getEnum<DirectionChoiceEnum>(),
155  getParam<std::string>("non_kinetic_biological_catalyst"),
156  getParam<Real>("non_kinetic_biological_efficiency"),
157  getParam<Real>("kinetic_biological_efficiency"),
158  getParam<Real>("energy_captured"))
159 {
160 }
161 
162 void
164 {
165 }
166 
167 void
169 {
170 }
171 
172 void
174 {
175 }
176 
179 {
180  return _rate_description;
181 }
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
User object that defines a kinetic rate.
const KineticRateUserDescription _rate_description
virtual void finalize() override final
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
GeochemistryKineticRate(const InputParameters &parameters)
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual void execute() override final
registerMooseObject("GeochemistryApp", GeochemistryKineticRate)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
Holds a user-specified description of a kinetic rate.
virtual void initialize() override final
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
const KineticRateUserDescription & getRateDescription() const
provides a reference to the rate description held by this object
DirectionChoiceEnum
This controls the direction of a kinetic rate BOTH: both dissolution and precipitation are allowed PR...