Cantera
Loading...
Searching...
No Matches
VibrationalRelaxationRate.h
Go to the documentation of this file.
1//! @file VibrationalRelaxationRate.h
2//! Header for vibrational relaxation reaction rates in plasma kinetics.
3//! @since New in %Cantera 4.0
4//!
5//! This file is part of Cantera. See License.txt in the top-level directory or
6//! at https://cantera.org/license.txt for license and copyright information.
7
8#ifndef CT_VIBRATIONALRELAXATIONRATE_H
9#define CT_VIBRATIONALRELAXATIONRATE_H
10
13#include "cantera/base/global.h"
17#include "cantera/base/Units.h"
18
19namespace Cantera
20{
21//! Shared temperature data for vibrational relaxation rates.
22struct VibrationalRelaxationData : public ReactionData
23{
24 //! Update cached temperature-dependent data directly from temperature.
25 void update(double T) override;
26
27 //! Update cached temperature-dependent data.
28 /**
29 * @param phase Thermodynamic phase used to retrieve the gas temperature.
30 * @param kin Kinetics object. Not used here, but required by the
31 * ReactionData interface.
32 * @return `true` if the temperature has changed and rates need to be
33 * recomputed; `false` otherwise.
34 */
35 bool update(const ThermoPhase& phase, const Kinetics& kin) override;
36
38
39 double recipT13 = 1.0; //!< @f$T^(-1/3)@f$
40};
41
42//! Common implementation for vibrational relaxation reaction rates.
43/**
44 * This intermediate class provides the common data storage and evaluation
45 * used by the concrete vibrational relaxation rate implementations.
46 *
47 * Internally, the supported parameterizations are mapped to
48 *
49 * @f[
50 * k_f =
51 * A T^b \exp\left(
52 * C_0
53 * + C_{1/3} T^{-1/3}
54 * + C_m T^{-m}
55 * + C_n T^{-n}
56 * \right).
57 * @f]
58 *
59 * Concrete derived classes are responsible for mapping their user-facing
60 * parameters onto this internal representation.
61 *
62 * Vibrational relaxation rates are restricted to irreversible reactions.
63 *
64 * @ingroup otherRateGroup
65 */
66
67class VibrationalRelaxationRate : public ReactionRate
68{
69public:
70 void setParameters(const AnyMap& node, const UnitStack& rate_units) override;
71
72 //! Set context of reaction rate evaluation.
73 /**
74 * Vibrational relaxation rates are intended for irreversible
75 * non-equilibrium plasma reactions. Reversible reactions are rejected
76 * because the reverse rate cannot be obtained from conventional
77 * thermochemistry for these models.
78 */
79 void setContext(const Reaction& rxn, const Kinetics& kin) override;
80
81 double evalFromStruct(const VibrationalRelaxationData& shared_data) const {
82
83 return m_A * std::exp(
84 m_b * shared_data.logT
85 + m_C0
86 + m_C13 * shared_data.recipT13
87 + m_Cm * std::pow(shared_data.recipT, m_m)
88 + m_Cn * std::pow(shared_data.recipT, m_n)
89 );
90 }
91
92 //! Evaluate the scaled temperature derivative.
93 /**
94 * This returns:
95 *
96 * @f[
97 * \frac{1}{k_f} \frac{d k_f}{dT}
98 * =
99 * \frac{d \ln k_f}{dT}
100 * @f]
101 *
102 * For the internal generic expression, this is:
103 *
104 * @f[
105 * \frac{b}{T}
106 * - \frac{C_{1/3}}{3} T^{-4/3}
107 * - m C_m T^{-m-1}
108 * - n C_n T^{-n-1}
109 * @f]
110 */
111 double ddTScaledFromStruct(const VibrationalRelaxationData& shared_data) const;
112
113 void check(const string& equation) override;
114
115 void validate(
116 const string& equation, const Kinetics& kin) override;
117
118protected:
119 //! Default constructor.
121
122 //! Construct from the common internal representation.
123 /**
124 * @param A Pre-exponential factor.
125 * @param b Temperature exponent.
126 * @param C0 Constant exponential coefficient.
127 * @param C13 Coefficient multiplying T^(-1/3).
128 * @param Cm Coefficient multiplying T^(-m).
129 * @param m Exponent associated with Cm.
130 * @param Cn Coefficient multiplying T^(-n).
131 * @param n Exponent associated with Cn.
132 */
134 double A, double b, double C0, double C13,
135 double Cm, double m, double Cn, double n);
136
137 static void requireKeys(
138 const AnyMap& node,
139 const string& rateType,
140 const string& where,
141 std::initializer_list<string> keys);
142
143 static void forbidKeys(
144 const AnyMap& node,
145 const string& rateType,
146 const string& where,
147 std::initializer_list<string> keys);
148
149 //! Write the fields shared by all vibrational relaxation rates, then delegate
150 //! the model-specific `rate-constant` entries to getRateParameters().
151 void getParameters(AnyMap& node) const override;
152
153 //! Store the model-specific coefficients in the `rate-constant` node.
154 virtual void getRateParameters(AnyMap& rateNode) const = 0;
155
156 void getPreExponentialFactor(AnyMap& rateNode) const;
157
158 //! Pre-exponential constant for the reaction rate
159 double m_A = NAN;
160
161 //! Temperature exponent for the reaction rate.
162 double m_b = NAN;
163
164 //! Dimensionless constant in the exponential.
165 double m_C0 = 0.0;
166
167 //! Coefficient multiplying @f$ T^{-1/3} @f$.
168 double m_C13 = 0.0;
169
170 //! Coefficient multiplying @f$ T^{-m} @f$.
171 double m_Cm = 0.0;
172
173 //! Temperature exponent used by the Cm term.
174 double m_m = 1.0;
175
176 //! Coefficient multiplying @f$ T^{-n} @f$.
177 double m_Cn = 0.0;
178
179 //! Temperature exponent used by the Cn term.
180 double m_n = 1.0;
181
182private:
183
184 //! Whether a negative leading coefficient is explicitly allowed.
185 bool m_negativeA_ok = false;
186
187};
188
189} // namespace Cantera
190
191#endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Header for unit conversion utilities, which are used to translate user input from input files (See In...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
Public interface for kinetics managers.
Definition Kinetics.h:124
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition Reaction.h:25
Base class for a phase with thermodynamic properties.
void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
virtual void getRateParameters(AnyMap &rateNode) const =0
Store the model-specific coefficients in the rate-constant node.
double m_n
Temperature exponent used by the Cn term.
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
void validate(const string &equation, const Kinetics &kin) override
Validate the reaction rate expression.
void getParameters(AnyMap &node) const override
Write the fields shared by all vibrational relaxation rates, then delegate the model-specific rate-co...
double m_A
Pre-exponential constant for the reaction rate.
VibrationalRelaxationRate()
Default constructor.
double ddTScaledFromStruct(const VibrationalRelaxationData &shared_data) const
Evaluate the scaled temperature derivative.
bool m_negativeA_ok
Whether a negative leading coefficient is explicitly allowed.
double m_C13
Coefficient multiplying .
double m_b
Temperature exponent for the reaction rate.
void check(const string &equation) override
Check basic syntax and settings of reaction rate expression.
double m_m
Temperature exponent used by the Cm term.
double m_C0
Dimensionless constant in the exponential.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
double recipT
inverse of temperature
virtual void update(double T)
Update data container based on temperature T.
double logT
logarithm of temperature
Unit aggregation utility.
Definition Units.h:105
Shared temperature data for vibrational relaxation rates.
void update(double T) override
Update cached temperature-dependent data directly from temperature.