36 return ARRHENIUS_REACTION_RATECOEFF_TYPE;
51 Arrhenius(doublereal A, doublereal b, doublereal E);
70 doublereal
update(doublereal logT, doublereal recipT)
const {
71 return m_logA + m_b*logT - m_E*recipT;
77 doublereal
updateLog(doublereal logT, doublereal recipT)
const {
78 return m_logA + m_b*logT - m_E*recipT;
88 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
89 return m_A * std::exp(m_b*logT - m_E*recipT);
94 s <<
" exp(" << m_logA;
96 s <<
" + " << m_b <<
" * tlog";
99 s <<
" - " << m_E <<
" * rt";
101 s <<
");" << std::endl;
127 doublereal m_logA, m_b, m_E, m_A;
150 return SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
162 doublereal m, doublereal e);
164 void update_C(
const doublereal* theta) {
170 for (
size_t n = 0; n < m_ncov; n++) {
172 m_acov += m_ac[n] * theta[k];
173 m_ecov += m_ec[n] * theta[k];
175 for (
size_t n = 0; n < m_nmcov; n++) {
178 th = std::max(theta[k],
Tiny);
180 m_mcov += m_mc[n]*std::log(th);
191 doublereal
update(doublereal logT, doublereal recipT)
const {
192 return m_logA + m_acov + m_b*logT
193 - (m_E + m_ecov)*recipT + m_mcov;
203 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
204 return m_A * std::exp(std::log(10.0)*m_acov + m_b*logT -
205 (m_E + m_ecov)*recipT + m_mcov);
208 doublereal activationEnergy_R()
const {
218 doublereal m_logA, m_b, m_E, m_A;
219 doublereal m_acov, m_ecov, m_mcov;
220 std::vector<size_t> m_sp, m_msp;
222 size_t m_ncov, m_nmcov;
242 return EXCHANGE_CURRENT_REACTION_RATECOEFF_TYPE;
276 doublereal
update(doublereal logT, doublereal recipT)
const {
277 return m_logA + m_b*logT - m_E*recipT;
287 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
288 return m_A * std::exp(m_b*logT - m_E*recipT);
293 s <<
" exp(" << m_logA;
295 s <<
" + " << m_b <<
" * tlog";
298 s <<
" - " << m_E <<
" * rt";
300 s <<
");" << std::endl;
314 doublereal m_logA, m_b, m_E, m_A;
324 return PLOG_REACTION_RATECOEFF_TYPE;
334 explicit Plog(
const std::multimap<double, Arrhenius>&
rates);
344 pressureIter iter =
pressures_.upper_bound(c[0]);
352 ihigh1_ = iter->second.first;
353 ihigh2_ = iter->second.second;
356 logP1_ = (--iter)->first;
357 ilow1_ = iter->second.first;
358 ilow2_ = iter->second.second;
367 doublereal
update(doublereal logT, doublereal recipT)
const {
368 return std::log(
updateRC(logT, recipT));
376 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
377 double log_k1, log_k2;
379 log_k1 = rates_[
ilow1_].updateLog(logT, recipT);
382 for (
size_t i =
ilow1_; i < ilow2_; i++) {
383 k += rates_[i].updateRC(logT, recipT);
385 log_k1 = std::log(k);
388 if (ihigh1_ == ihigh2_) {
389 log_k2 = rates_[ihigh1_].updateLog(logT, recipT);
392 for (
size_t i = ihigh1_; i < ihigh2_; i++) {
393 k += rates_[i].updateRC(logT, recipT);
395 log_k2 = std::log(k);
398 return std::exp(log_k1 + (log_k2-log_k1) * (
logP_-logP1_) *
rDeltaP_);
403 throw CanteraError(
"Plog::activationEnergy_R",
"Not implemented");
415 void validate(
const std::string& equation);
419 std::vector<std::pair<double, Arrhenius> >
rates()
const;
424 typedef std::map<double, std::pair<size_t, size_t> >::iterator pressureIter;
427 std::vector<Arrhenius> rates_;
448 return CHEBYSHEV_REACTION_RATECOEFF_TYPE;
473 double Pr = (2 * c[0] + PrNum_) *
PrDen_;
477 for (
size_t j = 0; j <
nT_; j++) {
480 for (
size_t i = 2; i <
nP_; i++) {
481 Cnp1 = 2 * Pr * Cn - Cnm1;
482 for (
size_t j = 0; j <
nT_; j++) {
494 doublereal
update(doublereal logT, doublereal recipT)
const {
495 return std::log10(
updateRC(logT, recipT));
503 doublereal
updateRC(doublereal logT, doublereal recipT)
const {
504 double Tr = (2 * recipT + TrNum_) *
TrDen_;
509 for (
size_t i = 2; i <
nT_; i++) {
510 Cnp1 = 2 * Tr * Cn - Cnm1;
511 logk += Cnp1 * dotProd_[i];
515 return std::pow(10, logk);
size_t ilow1_
Indices to the ranges within rates_ for the lower / upper pressure, such that rates_[ilow1_] through ...
size_t nPressure() const
Number of points in the pressure direction.
doublereal activationEnergy_R() const
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
Plog()
Default constructor.
doublereal activationEnergy_R() const
const vector_fp & coeffs() const
Access the Chebyshev coefficients.
void addCoverageDependence(size_t k, doublereal a, doublereal m, doublereal e)
Add a coverage dependency for species k, with pre-exponential dependence a, temperature exponent depe...
size_t nP_
number of points in the pressure direction
static int type()
return the rate coefficient type.
doublereal update(doublereal logT, doublereal recipT) const
Update the value of the logarithm of the rate constant.
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
double logP2_
log(p) at the lower / upper pressure reference
doublereal activationEnergy_R() const
Return the activation energy divided by the gas constant (i.e.
double Pmax() const
Maximum valid pressure [Pa].
void writeUpdateRHS(std::ostream &s) const
static bool alwaysComputeRate()
double Pmin() const
Minimum valid pressure [Pa].
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
Arrhenius()
Default constructor.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
#define AssertThrowMsg(expr, procedure, message)
Assertion must be true or an error is thrown.
static int type()
return the rate coefficient type.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
doublereal updateLog(doublereal logT, doublereal recipT) const
Update the value of the natural logarithm of the rate constant.
std::vector< std::pair< double, Arrhenius > > rates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
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::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Arrhenius reaction rate type depends only on temperature.
size_t nTemperature() const
Number of points in the temperature direction.
Intermediate class which stores data about a reaction and its rate parameterization before adding the...
vector_fp dotProd_
dot product of chebCoeffs with the reduced pressure polynomial
double TrDen_
terms appearing in the reduced temperature
double temperatureExponent() const
Return the temperature exponent b
Base class for exceptions thrown by Cantera classes.
static bool alwaysComputeRate()
void validate(const std::string &equation)
Check to make sure that the rate expression is finite over a range of temperatures at each interpolat...
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
double preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order) ...
static bool alwaysComputeRate()
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
Arrhenius reaction rate type depends only on temperature.
doublereal update(doublereal logT, doublereal recipT) const
Update the value of the base-10 logarithm of the rate constant.
doublereal update(doublereal logT, doublereal recipT) const
Update the value of the logarithm of the rate constant.
double Tmax() const
Maximum valid temperature [K].
doublereal update(doublereal logT, doublereal recipT) const
Update the value of the logarithm of the rate constant.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
double Pmax_
valid pressure range
static bool alwaysComputeRate()
size_t nT_
number of points in the temperature direction
std::map< double, std::pair< size_t, size_t > > pressures_
log(p) to (index range) in the rates_ vector
const doublereal Tiny
Small number to compare differences of mole fractions against.
double logP_
log(p) at the current state
void writeUpdateRHS(std::ostream &s) const
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
ChebyshevRate()
Default constructor.
static bool alwaysComputeRate()
Contains declarations for string manipulation functions within Cantera.
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
doublereal activationEnergy_R() const
ExchangeCurrent()
Default constructor.
static int type()
return the rate coefficient type.
double PrDen_
terms appearing in the reduced pressure
double rDeltaP_
reciprocal of (logP2 - logP1)
An Arrhenius rate with coverage-dependent terms.
double Tmax_
valid temperature range
static int type()
return the rate coefficient type.
vector_fp chebCoeffs_
Chebyshev coefficients, length nP * nT.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
doublereal update(doublereal logT, doublereal recipT) const
Update the value of the logarithm of the rate constant.
double Tmin() const
Minimum valid temperature [K].