15 "Missing state information: 'ChebyshevData' requires pressure.");
33 "Cannot apply another perturbation as state is already perturbed.");
63 const auto& T_range = node[
"temperature-range"].asVector<
AnyValue>(2);
64 const auto& P_range = node[
"pressure-range"].asVector<
AnyValue>(2);
65 auto& vcoeffs = node[
"data"].asVector<
vector_fp>();
67 for (
size_t i = 0; i <
coeffs.nRows(); i++) {
68 if (vcoeffs[i].size() != vcoeffs[0].size()) {
70 "Inconsistent number of coefficients in row {} of matrix", i + 1);
72 for (
size_t j = 0; j <
coeffs.nColumns(); j++) {
73 coeffs(i, j) = vcoeffs[i][j];
80 unit_system.
convert(T_range[0],
"K"),
81 unit_system.
convert(T_range[1],
"K"),
82 unit_system.
convert(P_range[0],
"Pa"),
83 unit_system.
convert(P_range[1],
"Pa")
99 "replaceable with setLimits() and setData().");
106 double logPmin = std::log10(
Pmin);
107 double logPmax = std::log10(
Pmax);
108 double TminInv = 1.0 /
Tmin;
109 double TmaxInv = 1.0 /
Tmax;
111 TrNum_ = - TminInv - TmaxInv;
112 TrDen_ = 1.0 / (TmaxInv - TminInv);
113 PrNum_ = - logPmin - logPmax;
114 PrDen_ = 1.0 / (logPmax - logPmin);
132 for (
size_t i = 0; i < rows; i++) {
133 for (
size_t j = 0; j < cols; j++) {
139void ChebyshevRate::getParameters(
AnyMap& rateNode)
const
141 rateNode[
"type"] =
type();
146 rateNode[
"temperature-range"].setQuantity({
Tmin(),
Tmax()},
"K");
147 rateNode[
"pressure-range"].setQuantity({
Pmin(),
Pmax()},
"Pa");
150 std::vector<vector_fp> coeffs2d(nT,
vector_fp(nP));
151 for (
size_t i = 0; i < nT; i++) {
152 for (
size_t j = 0; j < nP; j++) {
160 if (rate_units2.
factor() != 0.0) {
162 std::log10(units.convertFrom(1.0, rate_units2));
163 }
else if (units.getDelta(
UnitSystem()).size()) {
164 throw CanteraError(
"ChebyshevRate::getParameters lambda",
165 "Cannot convert rate constant with unknown dimensions to a "
166 "non-default unit system");
170 coeffs = std::move(coeffs2d);
171 rateNode[
"data"].setQuantity(
coeffs, converter);
178 "Rate object for reaction '{}' is not configured.", equation);
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.
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
A wrapper for a variable whose type is determined at runtime.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
size_t nRows() const
Number of rows.
size_t nColumns() const
Number of columns.
vector_fp & data()
Return a reference to the data vector.
Base class for exceptions thrown by Cantera classes.
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
void setParameters(const AnyMap &node, const UnitStack &units)
Perform object setup based on AnyMap node information.
double Tmax_
valid temperature range
ChebyshevRate()
Default constructor.
double TrDen_
terms appearing in the reduced temperature
Units m_rate_units
Reaction rate units.
double Pmin() const
Minimum valid pressure [Pa].
double Tmin() const
Minimum valid temperature [K].
void setData(const Array2D &coeffs)
Set the Chebyshev coefficients as 2-dimensional array.
double Tmax() const
Maximum valid temperature [K].
const std::string type() const
String identifying reaction rate specialization.
Array2D m_coeffs
< coefficient array
double Pmax_
valid pressure range
vector_fp dotProd_
dot product of chebCoeffs with the reduced pressure polynomial
void setup(double Tmin, double Tmax, double Pmin, double Pmax, const Array2D &coeffs)
Set up ChebyshevRate object.
double Pmax() const
Maximum valid pressure [Pa].
double PrDen_
terms appearing in the reduced pressure
vector_fp chebCoeffs_
Chebyshev coefficients, length nP * nT.
const vector_fp & coeffs() const
Access the ChebyshevRate coefficients.
void setLimits(double Tmin, double Tmax, double Pmin, double Pmax)
Set limits for ChebyshevRate object.
virtual void validate(const std::string &equation, const Kinetics &kin)
Validate the reaction rate expression.
Public interface for kinetics managers.
doublereal temperature() const
Temperature (K).
virtual double pressure() const
Return the thermodynamic pressure (Pa).
Base class for a phase with thermodynamic properties.
double convert(double value, const std::string &src, const std::string &dest) const
Convert value from the units of src to the units of dest.
double convertTo(double value, const std::string &dest) const
Convert value to the specified dest units from the appropriate units for this unit system (defined by...
A representation of the units associated with a dimensional quantity.
double factor() const
Return the factor for converting from this unit to Cantera's base units.
Namespace for the Cantera kernel.
void warn_deprecated(const std::string &source, const AnyBase &node, const std::string &message)
A deprecation warning for syntax in an input file.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void perturbPressure(double deltaP)
Perturb pressure of data container.
double m_pressure_buf
buffered pressure
virtual void update(double T) override
Update data container based on temperature T
virtual void restore() override
Restore data container after a perturbation.
double temperature
temperature
virtual void restore()
Restore data container after a perturbation.
Unit aggregation utility.
Units product() const
Calculate product of units-exponent stack.