25 virtual void update(
double T)
override;
27 virtual void update(
double T,
double P)
override {
44 virtual void restore()
override;
84 explicit PlogRate(
const std::multimap<double, ArrheniusRate>&
rates);
87 explicit PlogRate(
const std::multimap<double, Arrhenius2>&
rates);
98 const std::string
type()
const {
return "pressure-dependent-Arrhenius"; }
107 void getParameters(
AnyMap& rateNode,
const Units& rate_units)
const;
109 return getParameters(rateNode,
Units(0));
134 void setup(
const std::multimap<double, Arrhenius2>&
rates);
137 void setRates(
const std::multimap<double, ArrheniusRate>&
rates);
151 "Pressure out of range: {}",
logP_);
153 "Pressure out of range: {}",
logP_);
157 ihigh1_ = iter->second.first;
158 ihigh2_ = iter->second.second;
161 logP1_ = (--iter)->first;
162 ilow1_ = iter->second.first;
163 ilow2_ = iter->second.second;
175 double updateRC(
double logT,
double recipT)
const {
176 double log_k1, log_k2;
178 log_k1 = rates_[
ilow1_].evalLog(logT, recipT);
181 for (
size_t i =
ilow1_; i < ilow2_; i++) {
182 k += rates_[i].evalRate(logT, recipT);
184 log_k1 = std::log(k);
187 if (ihigh1_ == ihigh2_) {
188 log_k2 = rates_[ihigh1_].evalLog(logT, recipT);
191 for (
size_t i = ihigh1_; i < ihigh2_; i++) {
192 k += rates_[i].evalRate(logT, recipT);
194 log_k2 = std::log(k);
197 return std::exp(log_k1 + (log_k2-log_k1) * (
logP_-logP1_) *
rDeltaP_);
208 void validate(
const std::string& equation);
216 std::vector<std::pair<double, Arrhenius2>>
rates()
const;
220 std::multimap<double, ArrheniusRate>
getRates()
const;
227 std::vector<ArrheniusRate> rates_;
Header for reaction rates that involve Arrhenius-type kinetics.
A map of string keys to values whose type can vary at runtime.
Public interface for kinetics managers.
A class template handling ReactionRate specializations.
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
void setParameters(const AnyMap &node, const UnitStack &units)
Perform object setup based on AnyMap node information.
void updateFromStruct(const PlogData &shared_data)
Update information specific to reaction.
std::multimap< double, ArrheniusRate > getRates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
unique_ptr< MultiRateBase > newMultiRate() const
Create a rate evaluator for reactions of a particular derived type.
std::vector< std::pair< double, Arrhenius2 > > rates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
void getParameters(AnyMap &rateNode) const
Get parameters.
void setRates(const std::multimap< double, ArrheniusRate > &rates)
Set up Plog object.
double evalFromStruct(const PlogData &shared_data)
Evaluate reaction rate.
PlogRate()
Default constructor.
double rDeltaP_
reciprocal of (logP2 - logP1)
double updateRC(double logT, double recipT) const
Update the value the rate constant.
std::map< double, std::pair< size_t, size_t > > pressures_
log(p) to (index range) in the rates_ vector
const std::string type() const
Identifier of reaction rate type.
double logP_
log(p) at the current state
void update_C(const double *c)
Update concentration-dependent parts of the rate coefficient.
void setup(const std::multimap< double, Arrhenius2 > &rates)
Set up Plog object.
void validate(const std::string &equation, const Kinetics &kin)
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 ...
double logP2_
log(p) at the lower / upper pressure reference
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Base class for a phase with thermodynamic properties.
A representation of the units associated with a dimensional quantity.
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
Namespace for the Cantera kernel.
Data container holding shared data specific to PlogRate.
void perturbPressure(double deltaP)
Perturb pressure of data container.
double m_pressure_buf
buffered pressure
virtual void update(double T, double P) override
Update data container based on temperature T and an extra parameter.
virtual void update(double T) override
Update data container based on temperature T
double logP
logarithm of pressure
virtual void invalidateCache() override
Force shared data and reaction rates to be updated next time.
virtual void restore() override
Restore data container after a perturbation.
Data container holding shared data used for ReactionRate calculation.
double recipT
inverse of temperature
virtual void update(double T)
Update data container based on temperature T
double logT
logarithm of temperature
virtual void invalidateCache()
Force shared data and reaction rates to be updated next time.
Unit aggregation utility.