22 params.
addClassDescription(
"Forms the equations for the chemical reaction networks in a fluid"
23 " medium using a continuous Galerkin finite element discretization.");
27 params.
renameParam(
"solver_variables",
"primary_species",
"The list of primary species to add");
29 "auxiliary_variables",
"secondary_species",
"The list of secondary species to add");
31 "variable_order",
"order",
"Order of both the primary and secondary species variables");
32 params.
renameParam(
"equation_scaling",
"scaling",
"");
33 params.
setDocString(
"reactions",
"The list of equilibrium reactions occuring in the fluid");
37 params.
addParam<
bool>(
"add_darcy_advection_term",
39 "Whether to add an advection term using the Darcy equation to compute the "
40 "advecting velocity");
41 params.
addParam<std::vector<VariableName>>(
42 "pressure", {},
"Pressure variable (for Darcy advection)");
44 "gravity", RealVectorValue(0, 0, -9.81),
"Gravity vector (for Darcy advection)");
52 _sto_u(_num_solver_species),
53 _sto_v(_num_solver_species),
54 _weights(_num_solver_species),
55 _primary_participation(_num_solver_species),
56 _coupled_v(_num_solver_species),
57 _pressure_var(getParam<
std::vector<VariableName>>(
"pressure"))
65 _stos.push_back(reaction.getStoichiometricCoefficients());
68 const auto & products = reaction.getProductSpecies();
69 if (products.size() != 1)
71 "\n has more than one product species (on the RHS). This Physics only supports "
72 "one product species per reaction");
76 if (reaction.hasMetaData<Real>(
"log10_K"))
77 _log_eq_const.push_back(std::stod(reaction.getMetaData(
"log10_K")));
78 else if (reaction.hasMetaData<Real>(
"K"))
79 _log_eq_const.push_back(std::log10(std::stod(reaction.getMetaData(
"K"))));
80 else if (reaction.hasMetaData(
"K") || reaction.hasMetaData(
"log10_K"))
82 "Equilibrium constant species in square brackets must be specified as a float, "
87 "'\n is missing an equilibrium constant [K=] or its logarithm [log10_K=] in "
151 params_sub.
set<Real>(
"sto_u") =
_sto_u[i][j];
152 params_sub.
set<std::vector<Real>>(
"sto_v") =
_sto_v[i][j];
153 params_sub.
set<std::vector<VariableName>>(
"v") =
_coupled_v[i][j];
154 _problem->addKernel(
"CoupledBEEquilibriumSub",
165 params_cd.
set<Real>(
"sto_u") =
_sto_u[i][j];
166 params_cd.
set<std::vector<Real>>(
"sto_v") =
_sto_v[i][j];
167 params_cd.
set<std::vector<VariableName>>(
"v") =
_coupled_v[i][j];
168 _problem->addKernel(
"CoupledDiffusionReactionSub",
174 if (getParam<bool>(
"add_darcy_advection_term") &&
isParamValid(
"pressure"))
181 params_conv.
set<Real>(
"sto_u") =
_sto_u[i][j];
182 params_conv.
set<std::vector<Real>>(
"sto_v") =
_sto_v[i][j];
183 params_conv.
set<std::vector<VariableName>>(
"v") =
_coupled_v[i][j];
185 params_conv.
set<RealVectorValue>(
"gravity") = getParam<RealVectorValue>(
"gravity");
186 _problem->addKernel(
"CoupledConvectionReactionSub",
210 "Coefs are for solver + auxiliary");
211 std::vector<Real> stos_primary(
_stos[j].begin(),
213 params_eq.
set<std::vector<Real>>(
"sto_v") = stos_primary;
registerMooseAction("ChemicalReactionsApp", AqueousReactionsEquilibriumPhysics, "add_kernel")
registerReactionNetworkPhysicsBaseTasks("ChemicalReactionsApp", AqueousReactionsEquilibriumPhysics)
std::shared_ptr< FEProblemBase > & _problem
Creates all the objects needed to solve a reaction network of chemical reactions at equilibrium in an...
const std::vector< VariableName > & _pressure_var
Name of the pressure variable.
std::vector< std::vector< bool > > _primary_participation
Vector of vectors, indexed by (i, j), of whether primary solver species 'i' is present in reaction 'j...
AqueousReactionsEquilibriumPhysics(const InputParameters ¶meters)
std::vector< std::vector< Real > > _stos
Stoichiometric coefficients for each primary species (outer indexing) in each reaction.
std::vector< std::vector< Real > > _sto_u
Stoichiometric coefficients of primary/solver variables (outer indexing) in each reaction.
std::vector< std::vector< std::vector< VariableName > > > _coupled_v
Coupled primary species for each reaction (outer indexing is primary species, then reactions then inn...
static InputParameters validParams()
virtual void addAuxiliaryKernels() override
std::vector< VariableName > _eq_species
Equilibrium species: only one per reaction. This is a restriction of this implementation.
virtual void addFEKernels() override
std::vector< std::vector< VariableName > > _solver_species_involved
Primary species involved in the ith equilibrium reaction (outer indexing)
std::vector< std::vector< Real > > _weights
Weight of each primary species (outer indexing) in each reaction.
std::vector< Real > _log_eq_const
log10(Equilibrium constants) for each reaction
std::vector< std::vector< std::vector< Real > > > _sto_v
Stoichiometric coefficients of coupled primary variables (outer indexing) in each reaction.
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
virtual FEProblemBase & getProblem()
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
std::vector< SubdomainName > _blocks
Base class to host all common parameters and attributes of Physics actions to solve equations for mul...
const std::vector< ReactionNetworkUtils::Reaction > _reactions
Reaction network after being parsed in initializePhysics()
std::vector< std::string > _reactions_input
Reaction network as a vector of lines for pretty output.
static InputParameters validParams()
const std::vector< AuxVariableName > & _aux_species
Name of the species variables that can be computed without additional solves, simply auxkernels.
const unsigned int _num_reactions
Number of reactions involved in the network.
const std::vector< VariableName > & _solver_species
Name of the species variables to solve for in the reaction network.