Cantera 2.6.0
RxnRates.cpp
Go to the documentation of this file.
1//! @file RxnRates.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
8
9namespace Cantera
10{
13{
14 m_b = 0.0;
15 m_A = 0.0;
16 m_logA = -1.0E300;
17}
18
19Arrhenius2::Arrhenius2(doublereal A, doublereal b, doublereal E)
20 : ArrheniusRate(A, b, E * GasConstant)
21{
22 if (m_A <= 0.0) {
23 m_logA = -1.0E300;
24 }
25}
26
28 const UnitSystem& units, const Units& rate_units)
29{
30 setRateParameters(rate, units, rate_units);
31}
32
34 : ArrheniusRate(other.preExponentialFactor(),
35 other.temperatureExponent(),
36 other.activationEnergy())
37{
38}
39
40void Arrhenius2::setRateParameters(const AnyValue& rate,
41 const UnitSystem& units, const Units& rate_units)
42{
43 UnitStack units_stack(rate_units);
44 ArrheniusRate::setRateParameters(rate, units, units_stack);
45 if (m_A <= 0.0) {
46 m_logA = -1.0E300;
47 }
48}
49
50void Arrhenius2::getParameters(AnyMap& node, const Units& rate_units) const
51{
52 if (rate_units.factor() != 0.0) {
53 node["A"].setQuantity(m_A, rate_units);
54 } else {
55 node["A"] = preExponentialFactor();
56 // This can't be converted to a different unit system because the dimensions of
57 // the rate constant were not set. Can occur if the reaction was created outside
58 // the context of a Kinetics object and never added to a Kinetics object.
59 node["__unconvertible__"] = true;
60 }
61 node["b"] = m_b;
62 node["Ea"].setQuantity(m_Ea_R, "K", true);
63 node.setFlowStyle();
64}
65
66SurfaceArrhenius::SurfaceArrhenius()
67 : m_b(0.0)
68 , m_E(0.0)
69 , m_A(0.0)
70 , m_acov(0.0)
71 , m_ecov(0.0)
72 , m_mcov(0.0)
73{
74}
75
76SurfaceArrhenius::SurfaceArrhenius(double A, double b, double Ta)
77 : m_b(b)
78 , m_E(Ta)
79 , m_A(A)
80 , m_acov(0.0)
81 , m_ecov(0.0)
82 , m_mcov(0.0)
83{
84}
85
86void SurfaceArrhenius::addCoverageDependence(size_t k, doublereal a,
87 doublereal m, doublereal e)
88{
89 m_sp.push_back(k);
90 m_ac.push_back(a);
91 m_ec.push_back(e);
92 if (m != 0.0) {
93 m_msp.push_back(k);
94 m_mc.push_back(m);
95 }
96}
97
98}
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
void setFlowStyle(bool flow=true)
Use "flow" style when outputting this AnyMap to YAML.
Definition: AnyMap.cpp:1698
A wrapper for a variable whose type is determined at runtime.
Definition: AnyMap.h:84
void getParameters(AnyMap &node, const Units &rate_units) const
Return parameters - two-parameter version.
Definition: RxnRates.cpp:50
Arrhenius2()
Default constructor.
Definition: RxnRates.cpp:11
double m_A
Pre-exponential factor.
Definition: Arrhenius.h:164
void setRateParameters(const AnyValue &rate, const UnitSystem &units, const UnitStack &rate_units)
Perform object setup based on AnyValue node information.
Definition: Arrhenius.cpp:38
double m_b
Temperature exponent.
Definition: Arrhenius.h:165
virtual double preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order)
Definition: Arrhenius.h:108
double m_logA
Logarithm of pre-exponential factor.
Definition: Arrhenius.h:168
double m_Ea_R
Activation energy (in temperature units)
Definition: Arrhenius.h:166
Arrhenius reaction rate type depends only on temperature.
Definition: Arrhenius.h:192
void addCoverageDependence(size_t k, doublereal a, doublereal m, doublereal e)
Add a coverage dependency for species k, with exponential dependence a, power-law exponent m,...
Definition: RxnRates.cpp:86
Unit conversion utility.
Definition: Units.h:161
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
double factor() const
Return the factor for converting from this unit to Cantera's base units.
Definition: Units.h:48
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113
Unit aggregation utility.
Definition: Units.h:99