18 "Missing state information: 'PlogData' requires pressure.");
36 "Cannot apply another perturbation as state is already perturbed.");
68 std::multimap<double, ArrheniusRate> multi_rates;
69 if (node.
hasKey(
"rate-constants")) {
70 auto& rates = node[
"rate-constants"].asVector<
AnyMap>();
71 for (
const auto& rate : rates) {
72 multi_rates.insert({rate.convert(
"P",
"Pa"),
79void PlogRate::getParameters(
AnyMap& rateNode,
const Units& rate_units)
const
81 vector<AnyMap> rateList;
86 for (
const auto& [pressure, rate] :
getRates()) {
88 rateNode_[
"P"].setQuantity(pressure,
"Pa");
89 rate.getRateParameters(rateNode_);
90 rateList.push_back(std::move(rateNode_));
92 rateNode[
"rate-constants"] = std::move(rateList);
101 rates_.reserve(rates.size());
103 for (
const auto& [pressure, rate] : rates) {
104 double logp = std::log(pressure);
114 rates_.push_back(rate);
132 "Rate object for reaction '{}' is not configured.", equation);
135 fmt::memory_buffer err_reactions;
136 double T[] = {300.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
139 for (
auto iter = ++
pressures_.begin(); iter->first < 1000; iter++) {
140 data.
update(T[0], exp(iter->first));
142 for (
size_t i=0; i < 6; i++) {
144 for (
size_t p =
ilow1_; p < ilow2_; p++) {
145 k += rates_.at(p).evalRate(log(T[i]), 1.0 / T[i]);
149 "at P = {:.5g}, T = {:.1f}\n", std::exp(iter->first), T[i]);
153 if (err_reactions.size()) {
155 "\nInvalid rate coefficient for reaction '{}'\n{}",
156 equation, to_string(err_reactions));
162 "To be removed after Cantera 3.0; superseded by two-parameter version.");
168 std::multimap<double, ArrheniusRate> rateMap;
173 for (
size_t i = iter->second.first; i < iter->second.second; i++) {
174 rateMap.insert({std::exp(iter->first), rates_[i]});
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
A wrapper for a variable whose type is determined at runtime.
Arrhenius reaction rate type depends only on temperature.
Base class for exceptions thrown by Cantera classes.
Public interface for kinetics managers.
double temperature() const
Temperature (K).
virtual double pressure() const
Return the thermodynamic pressure (Pa).
map< double, pair< size_t, size_t > > pressures_
log(p) to (index range) in the rates_ vector
void updateFromStruct(const PlogData &shared_data)
Update information specific to reaction.
PlogRate()=default
Default constructor.
std::multimap< double, ArrheniusRate > getRates() const
Return the pressures and Arrhenius expressions which comprise this reaction.
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Perform object setup based on AnyMap node information.
void setRates(const std::multimap< double, ArrheniusRate > &rates)
Set up Plog object.
void validate(const string &equation, const Kinetics &kin) override
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 ...
virtual void setParameters(const AnyMap &node, const UnitStack &units)
Set parameters.
bool valid() const
Get flag indicating whether reaction rate is set up correctly.
bool m_valid
Flag indicating whether reaction rate is set up correctly.
AnyMap m_input
Input data used for specific models.
Base class for a phase with thermodynamic properties.
A representation of the units associated with a dimensional quantity.
void fmt_append(fmt::memory_buffer &b, Args... args)
Versions 6.2.0 and 6.2.1 of fmtlib do not include this define before they include windows....
const double OneBar
One bar [Pa].
Namespace for the Cantera kernel.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Data container holding shared data specific to PlogRate.
void perturbPressure(double deltaP)
Perturb pressure of data container.
double m_pressure_buf
buffered pressure
void update(double T) override
Update data container based on temperature T
void restore() override
Restore data container after a perturbation.
double temperature
temperature
virtual void restore()
Restore data container after a perturbation.
Unit aggregation utility.