15 "Missing state information: 'PlogData' requires pressure.");
33 "Cannot apply another perturbation as state is already perturbed.");
65 std::multimap<double, ArrheniusRate> multi_rates;
66 if (node.
hasKey(
"rate-constants")) {
67 auto& rates = node[
"rate-constants"].asVector<
AnyMap>();
68 for (
const auto& rate : rates) {
69 multi_rates.insert({rate.convert(
"P",
"Pa"),
76void PlogRate::getParameters(
AnyMap& rateNode,
const Units& rate_units)
const
78 vector<AnyMap> rateList;
83 for (
const auto& [pressure, rate] :
getRates()) {
85 rateNode_[
"P"].setQuantity(pressure,
"Pa");
86 rate.getRateParameters(rateNode_);
87 rateList.push_back(std::move(rateNode_));
89 rateNode[
"rate-constants"] = std::move(rateList);
98 rates_.reserve(rates.size());
100 for (
const auto& [pressure, rate] : rates) {
101 double logp = std::log(pressure);
111 rates_.push_back(rate);
129 "Rate object for reaction '{}' is not configured.", equation);
132 fmt::memory_buffer err_reactions;
133 double T[] = {300.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
136 for (
auto iter = ++
pressures_.begin(); iter->first < 1000; iter++) {
137 data.
update(T[0], exp(iter->first));
139 for (
size_t i=0; i < 6; i++) {
141 for (
size_t p =
ilow1_; p < ilow2_; p++) {
142 k += rates_.at(p).evalRate(log(T[i]), 1.0 / T[i]);
146 "at P = {:.5g}, T = {:.1f}\n", std::exp(iter->first), T[i]);
150 if (err_reactions.size()) {
152 "\nInvalid rate coefficient for reaction '{}'\n{}\n"
153 "To fix this error, remove this reaction or contact the author of the\n"
154 "reaction/mechanism in question, because the rate expression is\n"
155 "mathematically unsound at the temperatures and pressures noted above.\n",
156 equation, to_string(err_reactions));
162 std::multimap<double, ArrheniusRate> rateMap;
167 for (
size_t i = iter->second.first; i < iter->second.second; i++) {
168 rateMap.insert({std::exp(iter->first), rates_[i]});
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, const std::string &tmpl, 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.
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.