21 : SpeciesThermoInterpType(0.0, std::numeric_limits<double>::infinity(), 0.0)
27 Mu0Poly::Mu0Poly(
double tlow,
double thigh,
double pref,
const double* coeffs) :
32 std::map<double, double> T_mu;
33 size_t nPoints = (size_t) coeffs[0];
34 for (
size_t i = 0; i < nPoints; i++) {
35 T_mu[coeffs[2*i+2]] = coeffs[2*i+3];
42 size_t nPoints = T_mu.size();
44 throw CanteraError(
"Mu0Poly::setParameters",
"nPoints must be >= 2");
52 for (
const auto& row : T_mu) {
53 double T1 = row.first;
62 "One temperature has to be 298.15");
78 double deltaT = T2 - T1;
79 double cpi = (deltaMu - T1 * s1 + T2 * s1) / (deltaT - T2 * log(T2/T1));
90 for (
size_t i = iT298 - 1; i !=
npos; i--) {
95 double deltaT = T2 - T1;
96 double cpi = (deltaMu - T1 * s2 + T2 * s2) / (deltaT - T1 * log(T2/T1));
108 doublereal* h_RT, doublereal* s_R)
const
129 doublereal* s_R)
const
140 doublereal& tlow, doublereal& thigh,
142 doublereal*
const coeffs)
const
161 bool dimensionlessMu0Values =
false;
163 doublereal h298 = 0.0;
165 h298 =
getFloat(Mu0Node,
"H298",
"actEnergy");
168 size_t numPoints = 1;
169 if (Mu0Node.
hasChild(
"numPoints")) {
176 throw CanteraError(
"newMu0ThermoFromXML",
"missing Mu0Values");
183 if (valNode_ptr->
attrib(
"units") ==
"Dimensionless") {
184 dimensionlessMu0Values =
true;
186 if (cValues.size() != numPoints) {
187 throw CanteraError(
"newMu0ThermoFromXML",
"numPoints inconsistent");
193 throw CanteraError(
"newMu0ThermoFromXML",
"missing Mu0Temperatures");
196 if (cTemperatures.size() != numPoints) {
197 throw CanteraError(
"newMu0ThermoFromXML",
"numPoints inconsistent");
201 if (dimensionlessMu0Values) {
202 for (
size_t i = 0; i < numPoints; i++) {
203 cValues[i] *= cTemperatures[i] / 273.15;
208 c[0] =
static_cast<double>(numPoints);
210 for (
size_t i = 0; i < numPoints; i++) {
211 c[2+i*2] = cTemperatures[i];
212 c[2+i*2+1] = cValues[i];
216 fpValue(Mu0Node[
"Pref"]), &c[0]);
Header for a single-species standard state object derived from SpeciesThermoInterpType based on a pie...
Base class for exceptions thrown by Cantera classes.
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
doublereal m_H298
Value of the enthalpy at T = 298.15.
vector_fp m_mu0_R_int
Mu0's are primary input data.
vector_fp m_cp0_R_int
Heat capacity at the points.
void setParameters(double h0, const std::map< double, double > &T_mu)
Set parameters for .
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
virtual size_t nCoeffs() const
This utility function returns the number of coefficients for a given type of species parameterization...
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function returns the type of parameterization and all of the parameters for the species.
vector_fp m_s0_R_int
Entropy at the points.
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
doublereal m_lowT
lowest valid temperature
doublereal m_highT
Highest valid temperature.
doublereal m_Pref
Reference state pressure.
Class XML_Node is a tree-based representation of the contents of an XML file.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
const size_t npos
index returned by functions to indicate "no position"
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Namespace for the Cantera kernel.
XML_Node * getByTitle(const XML_Node &node, const std::string &title)
Search the child nodes of the current node for an XML Node with a Title attribute of a given name.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
int getInteger(const XML_Node &parent, const std::string &name)
Get an integer value from a child element.
size_t getFloatArray(const XML_Node &node, vector_fp &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name,...
#define MU0_INTERP
piecewise interpolation of mu0.
Contains declarations for string manipulation functions within Cantera.