www.mooseframework.org
KineticDisPreRateAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "KineticDisPreRateAux.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<AuxKernel>();
14  params.addParam<Real>("log_k", 0.0, "The equilibrium constant of the dissolution reaction");
15  params.addRequiredParam<std::vector<Real>>("sto_v",
16  "The stoichiometric coefficients of reactant species");
17  params.addParam<Real>("r_area", 0.1, "Specific reactive surface area in m^2/L solution");
18  params.addParam<Real>("ref_kconst", 6.456542e-8, "Kinetic rate constant in mol/m^2 s");
19  params.addParam<Real>("e_act", 2.91e4, "Activation energy, J/mol");
20  params.addParam<Real>("gas_const", 8.31434, "Gas constant, in J/mol K");
21  params.addParam<Real>("ref_temp", 298.15, "Reference temperature, K");
22  params.addCoupledVar("sys_temp", 298.15, "System temperature, K");
23  params.addCoupledVar("v", "The list of reactant species");
24  params.addClassDescription("Kinetic rate of secondary kinetic species");
25  return params;
26 }
27 
28 KineticDisPreRateAux::KineticDisPreRateAux(const InputParameters & parameters)
29  : AuxKernel(parameters),
30  _log_k(getParam<Real>("log_k")),
31  _r_area(getParam<Real>("r_area")),
32  _ref_kconst(getParam<Real>("ref_kconst")),
33  _e_act(getParam<Real>("e_act")),
34  _gas_const(getParam<Real>("gas_const")),
35  _ref_temp(getParam<Real>("ref_temp")),
36  _sys_temp(coupledValue("sys_temp")),
37  _sto_v(getParam<std::vector<Real>>("sto_v"))
38 {
39  const unsigned int n = coupledComponents("v");
40 
41  // Check that the number of stoichiometric coefficients is equal to the number
42  // of reactant species
43  if (_sto_v.size() != n)
44  mooseError("The number of stoichiometric coefficients is not equal to the number of reactant "
45  "species in ",
46  _name);
47 
48  _vals.resize(n);
49  for (unsigned int i = 0; i < n; ++i)
50  _vals[i] = &coupledValue("v", i);
51 }
52 
53 Real
55 {
56  const Real kconst =
57  _ref_kconst * std::exp(_e_act * (1.0 / _ref_temp - 1.0 / _sys_temp[_qp]) / _gas_const);
58  Real omega = 1.0;
59 
60  if (_vals.size() > 0)
61  {
62  for (unsigned int i = 0; i < _vals.size(); ++i)
63  {
64  if ((*_vals[i])[_qp] < 0.0)
65  omega *= std::pow(0.0, _sto_v[i]);
66  else
67  omega *= std::pow((*_vals[i])[_qp], _sto_v[i]);
68  }
69  }
70 
71  const Real saturation_SI = omega / std::pow(10.0, _log_k);
72  Real kinetic_rate = _r_area * kconst * (1.0 - saturation_SI);
73 
74  if (std::abs(kinetic_rate) <= 1.0e-12)
75  kinetic_rate = 0.0;
76 
77  return -kinetic_rate;
78 }
const Real _ref_temp
Reference temperature.
const Real _ref_kconst
Reference kinetic rate constant.
const std::vector< Real > _sto_v
Stoichiometric coefficients for involved primary species.
const VariableValue & _sys_temp
Actual system temperature.
const Real _log_k
Equilibrium constant at reference temperature.
const Real _r_area
Specific reactive surface area, m^2/L solution.
const Real _gas_const
Gas constant, 8.314 J/mol/K.
KineticDisPreRateAux(const InputParameters &parameters)
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
std::vector< const VariableValue * > _vals
Coupled primary species concentrations.
virtual Real computeValue() override
InputParameters validParams< KineticDisPreRateAux >()
const Real _e_act
Activation energy.