18 InputParameters params = validParams<Kernel>();
19 params.addParam<Real>(
"weight", 1.0,
"Weight of the equilibrium species");
20 params.addCoupledVar(
"log_k", 0.0,
"Equilibrium constant of dissociation equilibrium reaction");
21 params.addParam<Real>(
"sto_u",
23 "Stoichiometric coef of the primary species the kernel "
24 "operates on in the equilibrium reaction");
26 "gamma_u", 1.0,
"Activity coefficient of primary species that this kernel operates on");
27 params.addParam<std::vector<Real>>(
29 "The stoichiometric coefficients of coupled primary species in equilibrium reaction");
30 params.addRequiredCoupledVar(
"p",
"Pressure");
31 params.addCoupledVar(
"v",
"List of coupled primary species");
32 params.addCoupledVar(
"gamma_v", 1.0,
"Activity coefficients of coupled primary species");
33 params.addCoupledVar(
"gamma_eq", 1.0,
"Activity coefficient of this equilibrium species");
34 RealVectorValue g(0, 0, 0);
35 params.addParam<RealVectorValue>(
"gravity", g,
"Gravity vector (default is (0, 0, 0))");
36 params.addClassDescription(
"Convection of equilibrium species");
41 : DerivativeMaterialInterface<Kernel>(parameters),
42 _weight(getParam<Real>(
"weight")),
43 _log_k(coupledValue(
"log_k")),
44 _sto_u(getParam<Real>(
"sto_u")),
45 _sto_v(getParam<std::vector<Real>>(
"sto_v")),
46 _cond(getMaterialProperty<Real>(
"conductivity")),
47 _gravity(getParam<RealVectorValue>(
"gravity")),
48 _density(getDefaultMaterialProperty<Real>(
"density")),
49 _grad_p(coupledGradient(
"p")),
51 _gamma_u(coupledValue(
"gamma_u")),
52 _gamma_eq(coupledValue(
"gamma_eq"))
54 const unsigned int n = coupledComponents(
"v");
58 mooseError(
"The number of stoichiometric coefficients in sto_v is not equal to the number of "
59 "coupled species in ",
62 if (isCoupled(
"gamma_v"))
63 if (coupledComponents(
"gamma_v") != n)
64 mooseError(
"The number of activity coefficients in gamma_v is not equal to the number of "
65 "coupled species in ",
72 for (
unsigned int i = 0; i < n; ++i)
74 _vars[i] = coupled(
"v", i);
75 _vals[i] = &coupledValue(
"v", i);
78 _gamma_v[i] = (isCoupled(
"gamma_v") ? &coupledValue(
"gamma_v", i) : &coupledValue(
"gamma_v"));
91 for (
unsigned int i = 0; i <
_vals.size(); ++i)
99 for (
unsigned int j = 0; j <
_vals.size(); ++j)
106 mooseAssert(
_gamma_eq[_qp] > 0.0,
"Activity coefficient must be greater than zero");
125 for (
unsigned int i = 0; i <
_vals.size(); ++i)
133 for (
unsigned int j = 0; j <
_vals.size(); ++j)
150 RealVectorValue ddarcy_vel_dp = -
_cond[_qp] * _grad_phi[_j][_qp];
157 for (
unsigned int i = 0; i <
_vals.size(); ++i)
164 for (
unsigned int j = 0; j <
_vals.size(); ++j)
174 if (
_vals.size() == 0)
180 for (
unsigned int i = 0; i <
_vals.size(); ++i)
182 if (jvar ==
_vars[i])
192 for (
unsigned int i = 0; i <
_vals.size(); ++i)
193 if (jvar ==
_vars[i])
204 for (
unsigned int i = 0; i <
_vals.size(); ++i)
205 if (jvar !=
_vars[i])
213 unsigned int var = 0;
215 for (
unsigned int i = 0; i <
_vals.size(); ++i)
216 if (jvar ==
_vars[i])
223 for (
unsigned int i = 0; i <
_vals.size(); ++i)
230 for (
unsigned int j = 0; j <
_vals.size(); ++j)
231 if (j != var && j != i)
238 (diff1 + diff2 + diff3_sum) /
_gamma_eq[_qp];