40 "To be removed after Cantera 2.5.");
41 return ARRHENIUS_REACTION_RATECOEFF_TYPE;
53 Arrhenius(doublereal A, doublereal b, doublereal E);
66 doublereal
updateLog(doublereal logT, doublereal recipT)
const {
67 return m_logA + m_b*logT - m_E*recipT;
76 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
77 return m_A * std::exp(m_b*logT - m_E*recipT);
98 doublereal m_logA, m_b, m_E, m_A;
133 "To be removed after Cantera 2.5.");
134 return SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
144 doublereal m, doublereal e);
146 void update_C(
const doublereal* theta) {
152 for (
size_t n = 0; n < m_ac.size(); n++) {
154 m_acov += m_ac[n] * theta[k];
155 m_ecov += m_ec[n] * theta[k];
157 for (
size_t n = 0; n < m_mc.size(); n++) {
159 th = std::max(theta[k],
Tiny);
160 m_mcov += m_mc[n]*std::log(th);
170 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
171 return m_A * std::exp(std::log(10.0)*m_acov + m_b*logT -
172 (m_E + m_ecov)*recipT + m_mcov);
181 return m_A * std::exp(std::log(10.0)*m_acov + m_mcov);
196 doublereal m_b, m_E, m_A;
197 doublereal m_acov, m_ecov, m_mcov;
198 std::vector<size_t> m_sp, m_msp;
230 "To be removed after Cantera 2.5.");
231 return PLOG_REACTION_RATECOEFF_TYPE;
238 explicit Plog(
const std::multimap<double, Arrhenius>&
rates);
250 "Pressure out of range: {}",
logP_);
252 "Pressure out of range: {}",
logP_);
256 ihigh1_ = iter->second.first;
257 ihigh2_ = iter->second.second;
260 logP1_ = (--iter)->first;
261 ilow1_ = iter->second.first;
262 ilow2_ = iter->second.second;
272 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
273 double log_k1, log_k2;
275 log_k1 = rates_[
ilow1_].updateLog(logT, recipT);
278 for (
size_t i =
ilow1_; i < ilow2_; i++) {
279 k += rates_[i].updateRC(logT, recipT);
281 log_k1 = std::log(k);
284 if (ihigh1_ == ihigh2_) {
285 log_k2 = rates_[ihigh1_].updateLog(logT, recipT);
288 for (
size_t i = ihigh1_; i < ihigh2_; i++) {
289 k += rates_[i].updateRC(logT, recipT);
291 log_k2 = std::log(k);
294 return std::exp(log_k1 + (log_k2-log_k1) * (
logP_-logP1_) *
rDeltaP_);
301 void validate(
const std::string& equation);
305 std::vector<std::pair<double, Arrhenius> >
rates()
const;
312 std::vector<Arrhenius> rates_;
364 "To be removed after Cantera 2.5.");
365 return CHEBYSHEV_REACTION_RATECOEFF_TYPE;
387 double Pr = (2 * c[0] + PrNum_) *
PrDen_;
391 for (
size_t j = 0; j <
nT_; j++) {
394 for (
size_t i = 1; i <
nP_; i++) {
395 Cnp1 = 2 * Pr * Cn - Cnm1;
396 for (
size_t j = 0; j <
nT_; j++) {
409 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
410 double Tr = (2 * recipT + TrNum_) *
TrDen_;
415 for (
size_t i = 1; i <
nT_; i++) {
416 Cnp1 = 2 * Tr * Cn - Cnm1;
421 return std::pow(10, logk);
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Arrhenius reaction rate type depends only on temperature.
static int type()
return the rate coefficient type.
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
doublereal updateLog(doublereal logT, doublereal recipT) const
Update the value of the natural logarithm of the rate constant.
double temperatureExponent() const
Return the temperature exponent b
doublereal activationEnergy_R() const
Return the activation energy divided by the gas constant (i.e.
Arrhenius()
Default constructor.
double preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order)
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
double Tmax_
valid temperature range
ChebyshevRate()
Default constructor.
static int type()
return the rate coefficient type.
double TrDen_
terms appearing in the reduced temperature
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
double Pmin() const
Minimum valid pressure [Pa].
double Tmin() const
Minimum valid temperature [K].
double Tmax() const
Maximum valid temperature [K].
size_t nP_
number of points in the pressure direction
const vector_fp & coeffs() const
Access the Chebyshev coefficients.
double Pmax_
valid pressure range
size_t nT_
number of points in the temperature direction
vector_fp dotProd_
dot product of chebCoeffs with the reduced pressure polynomial
size_t nPressure() const
Number of points in the pressure direction.
double Pmax() const
Maximum valid pressure [Pa].
double PrDen_
terms appearing in the reduced pressure
vector_fp chebCoeffs_
Chebyshev coefficients, length nP * nT.
size_t nTemperature() const
Number of points in the temperature direction.
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
static int type()
return the rate coefficient type.
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
std::vector< std::pair< double, Arrhenius > > rates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
double rDeltaP_
reciprocal of (logP2 - logP1)
std::map< double, std::pair< size_t, size_t > > pressures_
log(p) to (index range) in the rates_ vector
Plog()
Default constructor.
void validate(const std::string &equation)
Check to make sure that the rate expression is finite over a range of temperatures at each interpolat...
double logP_
log(p) at the current state
size_t ilow1_
Indices to the ranges within rates_ for the lower / upper pressure, such that rates_[ilow1_] through ...
double logP2_
log(p) at the lower / upper pressure reference
An Arrhenius rate with coverage-dependent terms.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value of the rate constant.
doublereal temperatureExponent() const
Return effective temperature exponent.
doublereal activationEnergy_R() const
Return the activation energy divided by the gas constant (i.e.
doublereal preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order) account...
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,...
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
This file contains definitions for utility functions and text for modules, inputfiles,...
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
const double Tiny
Small number to compare differences of mole fractions against.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Namespace for the Cantera kernel.
This file defines some constants used to specify reaction types.
Contains declarations for string manipulation functions within Cantera.