https://mooseframework.inl.gov
KineticDisPreRateAux.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 
10 #include "KineticDisPreRateAux.h"
11 
12 registerMooseObject("ChemicalReactionsApp", KineticDisPreRateAux);
13 
16 {
18  params.addCoupledVar("log_k", 0.0, "The equilibrium constant of the dissolution reaction");
19  params.addRequiredParam<std::vector<Real>>("sto_v",
20  "The stoichiometric coefficients of reactant species");
21  params.addParam<Real>("r_area", 0.1, "Specific reactive surface area in m^2/L solution");
22  params.addParam<Real>("ref_kconst", 6.456542e-8, "Kinetic rate constant in mol/m^2 s");
23  params.addParam<Real>("e_act", 2.91e4, "Activation energy, J/mol");
24  params.addParam<Real>("gas_const", 8.31434, "Gas constant, in J/mol K");
25  params.addParam<Real>("ref_temp", 298.15, "Reference temperature, K");
26  params.addCoupledVar("sys_temp", 298.15, "System temperature, K");
27  params.addCoupledVar("v", "The list of reactant species");
28  params.addClassDescription("Kinetic rate of secondary kinetic species");
29  return params;
30 }
31 
33  : AuxKernel(parameters),
34  _log_k(coupledValue("log_k")),
35  _r_area(getParam<Real>("r_area")),
36  _ref_kconst(getParam<Real>("ref_kconst")),
37  _e_act(getParam<Real>("e_act")),
38  _gas_const(getParam<Real>("gas_const")),
39  _ref_temp(getParam<Real>("ref_temp")),
40  _sys_temp(coupledValue("sys_temp")),
41  _sto_v(getParam<std::vector<Real>>("sto_v")),
42  _vals(coupledValues("v"))
43 {
44  // Check that the number of stoichiometric coefficients is equal to the number
45  // of reactant species
46  if (_sto_v.size() != coupledComponents("v"))
47  mooseError(
48  "The number of stoichiometric coefficients in sto_v is not equal to the number of reactant "
49  "species in ",
50  _name);
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 *= 0.0;
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[_qp]);
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 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("ChemicalReactionsApp", KineticDisPreRateAux)
const VariableValue & _log_k
Equilibrium constant at reference temperature.
Calculate the kinetic mineral species kinetic rate according to transient state theory rate law...
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.
void addRequiredParam(const std::string &name, const std::string &doc_string)
const VariableValue & _sys_temp
Actual system 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)
const std::string _name
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int coupledComponents(const std::string &var_name) const
virtual Real computeValue() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const std::vector< const VariableValue * > _vals
Coupled primary species concentrations.
static InputParameters validParams()
const Real _e_act
Activation energy.
MooseUnits pow(const MooseUnits &, int)