Cantera
Loading...
Searching...
No Matches
CastelaVibrationalRelaxationRate.cpp
Go to the documentation of this file.
1//! @file CastelaVibrationalRelaxationRate.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 "CastelaVibrationalRelaxationRate::setParameters";
17
18} // namespace
19
20CastelaVibrationalRelaxationRate::
21 CastelaVibrationalRelaxationRate(
22 const AnyMap& node, const UnitStack& rate_units)
23{
24 setParameters(node, rate_units);
25}
26
27CastelaVibrationalRelaxationRate::
28 CastelaVibrationalRelaxationRate(double a, double b,
29 double referencePressure)
30{
31 if (referencePressure <= 0.0) {
32 throw CanteraError(
33 "CastelaVibrationalRelaxationRate",
34 "Reference pressure must be positive.");
35 }
36
37 m_A = GasConstant / referencePressure;
38 m_b = 1.0;
39 m_C0 = 18.42 + a * b;
40 m_C13 = -a;
41 m_Cm = 0.0;
42 m_m = 2.0 / 3.0;
43 m_Cn = 0.0;
44 m_n = 1.0;
45
46 m_valid = true;
47 m_castela_a = a;
48 m_castela_b = b;
49 m_referencePressure = referencePressure;
50}
51
53 const AnyMap& node, const UnitStack& rate_units)
54{
56
57 const auto& rateMap = node["rate-constant"].as<AnyMap>();
58
59 requireKeys(rateMap, type(), WhereSetParameters,{"a", "b"});
60
61 forbidKeys(rateMap, type(), WhereSetParameters,
62 {"A", "n", "C0", "C13", "C23", "Cn",
63 "m", "Cm", "Ea"});
64
65 m_castela_a = rateMap["a"].asDouble();
66
67 m_castela_b = rateMap["b"].asDouble();
68
69 if (rateMap.hasKey("reference-pressure")) {
71 rateMap.convert(
72 "reference-pressure", "Pa");
73 } else {
75 }
76
77 if (m_referencePressure <= 0.0) {
78 throw InputFileError(
79 WhereSetParameters,
80 node,
81 "Castela reference-pressure must be positive.");
82 }
83
84 // Castela relaxation time:
85 //
86 // tau_k = p0 / p_k
87 // * exp[a_k * (T^(-1/3) - b_k) - 18.42]
88 //
89 // Equivalent rate:
90 //
91 // k_k(T) = R T / p0
92 // * exp[18.42 + a_k b_k
93 // - a_k T^(-1/3)]
94 //
95 // Generic mapping:
96 //
97 // A = R / p0
98 // b = 1
99 // C0 = 18.42 + a_k b_k
100 // C13 = -a_k
101 // Cm = 0
102 // Cn = 0
103
105
106 m_b = 1.0;
107
108 m_C0 = 18.42 + m_castela_a * m_castela_b;
109
111
112 m_Cm = 0.0;
113 m_m = 2.0 / 3.0;
114
115 m_Cn = 0.0;
116 m_n = 1.0;
117
118 m_valid = true;
119}
120
122{
123 rateNode["a"] = m_castela_a;
124
125 rateNode["b"] = m_castela_b;
126
127 rateNode["reference-pressure"].setQuantity(
128 m_referencePressure, "Pa");
129}
130
131} // namespace Cantera
Castela vibrational relaxation reaction rate.
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
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.
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:749
bool m_valid
Flag indicating whether reaction rate is set up correctly.
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.
const double OneAtm
One atmosphere [Pa].
Definition ct_defs.h:99
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:123
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Unit aggregation utility.
Definition Units.h:105