Cantera
Loading...
Searching...
No Matches
StarikovskiyVibrationalRelaxationRate.cpp
Go to the documentation of this file.
1//! @file StarikovskiyVibrationalRelaxationRate.cpp
2//! @since New in %Cantera 4.0
3
4// This file is part of Cantera. See License.txt in the top-level directory or
5// at https://cantera.org/license.txt for license and copyright information.
6
8
9namespace Cantera
10{
11
12namespace
13{
14
15const string WhereSetParameters =
16 "StarikovskiyVibrationalRelaxationRate::setParameters";
17
18} // namespace
19
20StarikovskiyVibrationalRelaxationRate::
21 StarikovskiyVibrationalRelaxationRate(
22 const AnyMap& node, const UnitStack& rate_units)
23{
24 setParameters(node, rate_units);
25}
26
27StarikovskiyVibrationalRelaxationRate::
28 StarikovskiyVibrationalRelaxationRate(
29 double A, double b, double C0, double C13, double Cm, double m,
30 double Cn, double n)
31 : VibrationalRelaxationRate(A, b, C0, C13, Cm, m, Cn, n)
32{
33 if (m <= 0.0 || n <= 0.0) {
34 throw CanteraError(
35 "StarikovskiyVibrationalRelaxationRate",
36 "The exponents 'm' and 'n' must be positive.");
37 }
38}
39
41 const AnyMap& node, const UnitStack& rate_units)
42{
44
45 const auto& rateMap = node["rate-constant"].as<AnyMap>();
46
47 requireKeys(rateMap, type(), WhereSetParameters, {"A"});
48
49 forbidKeys(
50 rateMap, type(), WhereSetParameters,
51 {"C23", "Ea", "a", "reference-pressure"});
52
53 const double m = rateMap.getDouble("m", 1.0);
54
55 const double n = rateMap.getDouble("n", 1.0);
56
57 if (m <= 0.0 || n <= 0.0) {
58 throw InputFileError(
59 WhereSetParameters,
60 node,
61 "The Starikovskiy exponents 'm' and 'n' "
62 "must be positive.");
63 }
64
65 m_A = node.units().convertRateCoeff(
66 rateMap["A"], conversionUnits());
67
68 m_b = rateMap.getDouble("b", 0.0);
69
70 m_C0 = rateMap.getDouble("C0", 0.0);
71 m_C13 = rateMap.getDouble("C13", 0.0);
72 m_Cm = rateMap.getDouble("Cm", 0.0);
73 m_m = m;
74
75 m_Cn = rateMap.getDouble("Cn", 0.0);
76 m_n = n;
77
78 m_valid = true;
79}
80
82{
83 getPreExponentialFactor(rateNode);
84
85 rateNode["b"] = m_b;
86
87 rateNode["C0"] = m_C0;
88 rateNode["C13"] = m_C13;
89
90 rateNode["Cm"] = m_Cm;
91 rateNode["m"] = m_m;
92
93 rateNode["Cn"] = m_Cn;
94 rateNode["n"] = m_n;
95}
96
97} // namespace Cantera
Starikovskiy vibrational relaxation reaction rate.
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
double getDouble(const string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
Definition AnyMap.cpp:1580
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
Definition AnyMap.h:640
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:749
const Units & conversionUnits() const
Get the units for converting the leading term in the reaction rate expression.
bool m_valid
Flag indicating whether reaction rate is set up correctly.
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
void getRateParameters(AnyMap &rateNode) const override
Store the model-specific coefficients in the rate-constant node.
const string type() const override
String identifying reaction rate specialization.
double convertRateCoeff(const AnyValue &val, const Units &dest) const
Convert a generic AnyValue node representing a reaction rate coefficient to the units specified in de...
Definition Units.cpp:634
Common implementation for vibrational relaxation reaction rates.
double m_n
Temperature exponent used by the Cn term.
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
double m_A
Pre-exponential constant for the reaction rate.
double m_C13
Coefficient multiplying .
double m_b
Temperature exponent for the reaction rate.
double m_m
Temperature exponent used by the Cm term.
double m_C0
Dimensionless constant in the exponential.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Unit aggregation utility.
Definition Units.h:105