Go to the documentation of this file.
18 InputParameters params = validParams<TimeDerivative>();
19 params.addParam<Real>(
20 "weight", 1.0,
"The weight of the equilibrium species in total concentration");
21 params.addCoupledVar(
"log_k", 0.0,
"The equilibrium constant of this equilibrium species");
22 params.addParam<Real>(
25 "The stoichiometric coefficient of the primary species this kernel operates on");
27 "gamma_u", 1.0,
"Activity coefficient of primary species that this kernel operates on");
28 params.addParam<std::vector<Real>>(
"sto_v",
29 "The stoichiometric coefficients of coupled primary species");
30 params.addCoupledVar(
"gamma_v", 1.0,
"Activity coefficients of coupled primary species");
31 params.addCoupledVar(
"gamma_eq", 1.0,
"Activity coefficient of this equilibrium species");
32 params.addCoupledVar(
"v",
"Coupled primary species constituting the equilibrium species");
33 params.addClassDescription(
"Derivative of equilibrium species concentration wrt time");
38 : TimeDerivative(parameters),
39 _weight(getParam<Real>(
"weight")),
40 _log_k(coupledValue(
"log_k")),
41 _sto_u(getParam<Real>(
"sto_u")),
42 _sto_v(getParam<std::vector<Real>>(
"sto_v")),
43 _gamma_u(coupledValue(
"gamma_u")),
44 _gamma_u_old(coupledValueOld(
"gamma_u")),
45 _gamma_eq(coupledValue(
"gamma_eq")),
46 _gamma_eq_old(coupledValueOld(
"gamma_eq")),
47 _porosity(getMaterialProperty<Real>(
"porosity")),
50 const unsigned int n = coupledComponents(
"v");
54 mooseError(
"The number of stoichiometric coefficients in sto_v is not equal to the number of "
55 "coupled species in ",
58 if (isCoupled(
"gamma_v"))
59 if (coupledComponents(
"gamma_v") != n)
60 mooseError(
"The number of activity coefficients in gamma_v is not equal to the number of "
61 "coupled species in ",
70 for (
unsigned int i = 0; i <
_vars.size(); ++i)
72 _vars[i] = coupled(
"v", i);
73 _v_vals[i] = &coupledValue(
"v", i);
76 _gamma_v[i] = (isCoupled(
"gamma_v") ? &coupledValue(
"gamma_v", i) : &coupledValue(
"gamma_v"));
78 (isCoupled(
"gamma_v") ? &coupledValueOld(
"gamma_v", i) : &coupledValue(
"gamma_v"));
85 mooseAssert(
_gamma_eq[_qp] > 0.0,
"Activity coefficient must be greater than zero");
94 for (
unsigned int i = 0; i <
_vars.size(); ++i)
100 return _porosity[_qp] *
_weight * _test[_i][_qp] * (val_new - val_old) / _dt;
109 for (
unsigned int i = 0; i <
_vars.size(); ++i)
129 for (
unsigned int i = 0; i <
_vars.size(); ++i)
131 if (jvar ==
_vars[i])
const std::vector< Real > _sto_v
Stoichiometric coefficients of the coupled primary species in the equilibrium species.
std::vector< const VariableValue * > _v_vals_old
Old values of coupled primary species concentrations.
const VariableValue & _gamma_eq_old
Old activity coefficient of equilibrium species.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
registerMooseObject("ChemicalReactionsApp", CoupledBEEquilibriumSub)
virtual Real computeQpJacobian() override
InputParameters validParams< CoupledBEEquilibriumSub >()
const Real _weight
Weight of the equilibrium species in the total primary species.
std::vector< const VariableValue * > _gamma_v_old
Old activity coefficients of coupled primary species in the equilibrium species.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
std::vector< const VariableValue * > _v_vals
Coupled primary species concentrations.
std::vector< unsigned int > _vars
Coupled primary species variable numbers.
Time derivative of primary species in given equilibrium species.
const Real _sto_u
Stoichiometric coefficient of the primary species in the equilibrium species.
const VariableValue & _gamma_eq
Activity coefficient of equilibrium species.
const VariableValue & _gamma_u
Activity coefficient of primary species in the equilibrium species.
virtual Real computeQpResidual() override
const VariableValue & _u_old
Old value of the primary species concentration.
const VariableValue & _gamma_u_old
Old activity coefficient of primary species in the equilibrium species.
const VariableValue & _log_k
Equilibrium constant for the equilibrium species.
std::vector< const VariableValue * > _gamma_v
Activity coefficients of coupled primary species in the equilibrium species.
const MaterialProperty< Real > & _porosity
Porosity.
CoupledBEEquilibriumSub(const InputParameters ¶meters)