27 m_logA = std::log(m_A);
31 SurfaceArrhenius::SurfaceArrhenius()
41 SurfaceArrhenius::SurfaceArrhenius(
double A,
double b,
double Ta)
52 doublereal m, doublereal e)
63 Plog::Plog(
const std::multimap<double, Arrhenius>& rates)
70 rates_.reserve(
rates.size());
72 for (
const auto& rate :
rates) {
73 double logp = std::log(rate.first);
83 rates_.push_back(rate.second);
93 fmt::memory_buffer err_reactions;
94 double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
96 for (
auto iter = ++
pressures_.begin(); iter->first < 1000; iter++) {
98 for (
size_t i=0; i < 6; i++) {
100 for (
size_t p =
ilow1_; p < ilow2_; p++) {
101 k += rates_[p].updateRC(log(T[i]), 1.0/T[i]);
104 format_to(err_reactions,
105 "\nInvalid rate coefficient for reaction '{}'\n"
106 "at P = {:.5g}, T = {:.1f}\n",
107 equation, std::exp(iter->first), T[i]);
111 if (err_reactions.size()) {
112 throw CanteraError(
"Plog::validate", to_string(err_reactions));
118 std::vector<std::pair<double, Arrhenius> > R;
123 for (
size_t i = iter->second.first;
124 i < iter->second.second;
126 R.emplace_back(std::exp(iter->first), rates_[i]);
139 , nP_(coeffs.nColumns())
140 , nT_(coeffs.nRows())
141 , chebCoeffs_(coeffs.nColumns() * coeffs.nRows(), 0.0)
142 , dotProd_(coeffs.nRows())
144 double logPmin = std::log10(
Pmin);
145 double logPmax = std::log10(
Pmax);
146 double TminInv = 1.0 /
Tmin;
147 double TmaxInv = 1.0 /
Tmax;
149 TrNum_ = - TminInv - TmaxInv;
150 TrDen_ = 1.0 / (TmaxInv - TminInv);
151 PrNum_ = - logPmin - logPmax;
152 PrDen_ = 1.0 / (logPmax - logPmin);
154 for (
size_t t = 0; t <
nT_; t++) {
155 for (
size_t p = 0; p <
nP_; p++) {
Header file for class Cantera::Array2D.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Arrhenius()
Default constructor.
Base class for exceptions thrown by Cantera classes.
ChebyshevRate()
Default constructor.
double TrDen_
terms appearing in the reduced temperature
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.
size_t nT_
number of points in the temperature direction
double Pmax() const
Maximum valid pressure [Pa].
double PrDen_
terms appearing in the reduced pressure
vector_fp chebCoeffs_
Chebyshev coefficients, length nP * nT.
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
std::vector< std::pair< double, Arrhenius > > rates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
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...
size_t ilow1_
Indices to the ranges within rates_ for the lower / upper pressure, such that rates_[ilow1_] through ...
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,...
Namespace for the Cantera kernel.