Line data Source code
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 : 14 : InputParameters 15 577 : KineticDisPreRateAux::validParams() 16 : { 17 577 : InputParameters params = AuxKernel::validParams(); 18 1154 : params.addCoupledVar("log_k", 0.0, "The equilibrium constant of the dissolution reaction"); 19 1154 : params.addRequiredParam<std::vector<Real>>("sto_v", 20 : "The stoichiometric coefficients of reactant species"); 21 1154 : params.addParam<Real>("r_area", 0.1, "Specific reactive surface area in m^2/L solution"); 22 1154 : params.addParam<Real>("ref_kconst", 6.456542e-8, "Kinetic rate constant in mol/m^2 s"); 23 1154 : params.addParam<Real>("e_act", 2.91e4, "Activation energy, J/mol"); 24 1154 : params.addParam<Real>("gas_const", 8.31434, "Gas constant, in J/mol K"); 25 1154 : params.addParam<Real>("ref_temp", 298.15, "Reference temperature, K"); 26 1154 : params.addCoupledVar("sys_temp", 298.15, "System temperature, K"); 27 1154 : params.addCoupledVar("v", "The list of reactant species"); 28 577 : params.addClassDescription("Kinetic rate of secondary kinetic species"); 29 577 : return params; 30 0 : } 31 : 32 311 : KineticDisPreRateAux::KineticDisPreRateAux(const InputParameters & parameters) 33 : : AuxKernel(parameters), 34 311 : _log_k(coupledValue("log_k")), 35 622 : _r_area(getParam<Real>("r_area")), 36 622 : _ref_kconst(getParam<Real>("ref_kconst")), 37 622 : _e_act(getParam<Real>("e_act")), 38 622 : _gas_const(getParam<Real>("gas_const")), 39 622 : _ref_temp(getParam<Real>("ref_temp")), 40 311 : _sys_temp(coupledValue("sys_temp")), 41 622 : _sto_v(getParam<std::vector<Real>>("sto_v")), 42 933 : _vals(coupledValues("v")) 43 : { 44 : // Check that the number of stoichiometric coefficients is equal to the number 45 : // of reactant species 46 311 : if (_sto_v.size() != coupledComponents("v")) 47 2 : mooseError( 48 : "The number of stoichiometric coefficients in sto_v is not equal to the number of reactant " 49 : "species in ", 50 2 : _name); 51 309 : } 52 : 53 : Real 54 361648 : KineticDisPreRateAux::computeValue() 55 : { 56 : const Real kconst = 57 361648 : _ref_kconst * std::exp(_e_act * (1.0 / _ref_temp - 1.0 / _sys_temp[_qp]) / _gas_const); 58 : Real omega = 1.0; 59 : 60 361648 : if (_vals.size() > 0) 61 : { 62 1096160 : for (unsigned int i = 0; i < _vals.size(); ++i) 63 : { 64 734512 : if ((*_vals[i])[_qp] < 0.0) 65 11610 : omega *= 0.0; 66 : else 67 722902 : omega *= std::pow((*_vals[i])[_qp], _sto_v[i]); 68 : } 69 : } 70 : 71 361648 : const Real saturation_SI = omega / std::pow(10.0, _log_k[_qp]); 72 723296 : Real kinetic_rate = _r_area * kconst * (1.0 - saturation_SI); 73 : 74 361648 : if (std::abs(kinetic_rate) <= 1.0e-12) 75 : kinetic_rate = 0.0; 76 : 77 361648 : return -kinetic_rate; 78 : }