87 hrt[0] += presCorrect /
RT();
128 "stoichiometric substances may only contain one species.");
132 auto& eos =
species(0)->input[
"equation-of-state"].getMapWhere(
133 "model",
"constant-volume");
134 if (eos.hasKey(
"density")) {
136 }
else if (eos.hasKey(
"molar-density")) {
138 eos.convert(
"molar-density",
"kmol/m^3"));
139 }
else if (eos.hasKey(
"molar-volume")) {
141 eos.convert(
"molar-volume",
"m^3/kmol"));
144 "equation-of-state entry for species '{}' is missing 'density',"
145 " 'molar-volume' or 'molar-density' specification",
160 AnyMap& speciesNode)
const
165 auto& eosNode = speciesNode[
"equation-of-state"].getMapWhere(
166 "model",
"constant-volume",
true);
168 if (S->input.hasKey(
"equation-of-state")) {
169 auto& eosIn = S->input[
"equation-of-state"];
170 if (eosIn.hasKey(
"density")) {
171 eosNode[
"density"].setQuantity(
density(),
"kg/m^3");
172 }
else if (eosIn.hasKey(
"molar-density")) {
187 if (!phaseNode.
hasChild(
"thermo")) {
189 "no thermo XML node");
192 std::string model = tnode[
"model"];
193 if (model !=
"StoichSubstance" && model !=
"StoichSubstanceSSTP") {
195 "thermo model attribute must be StoichSubstance");
197 double dens =
getFloat(tnode,
"density",
"toSI");
215 std::string model = eosdata[
"model"];
216 if (model !=
"StoichSubstance" && model !=
"StoichSubstanceSSTP") {
217 throw CanteraError(
"StoichSubstance::setParametersFromXML",
218 "thermo model attribute must be StoichSubstance");
Declaration for class Cantera::Species.
Header file for the StoichSubstance class, which represents a fixed-composition incompressible substa...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
A map of string keys to values whose type can vary at runtime.
double convert(const std::string &key, const std::string &units) const
Convert the item stored by the given key to the units specified in units.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Base class for exceptions thrown by Cantera classes.
double molarDensity() const
Molar density (kmol/m^3).
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
std::string name() const
Return the name of the phase.
size_t m_kk
Number of species in the phase.
std::string speciesName(size_t k) const
Name of the species with index k.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double density() const
Density (kg/m^3).
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
shared_ptr< Species > species(const std::string &name) const
Return the Species object for the named species.
doublereal m_press
The current pressure of the solution (Pa). It gets initialized to 1 atm.
double m_h0_RT
Dimensionless enthalpy at the (mtlast, m_p0)
double m_s0_R
Dimensionless entropy at the (mtlast, m_p0)
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
double m_cp0_R
Dimensionless heat capacity at the (mtlast, m_p0)
void _updateThermo() const
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
virtual doublereal pressure() const
Report the Pressure. Units: Pa.
StoichSubstance(const std::string &infile="", const std::string &id="")
Construct and initialize a StoichSubstance ThermoPhase object directly from an ASCII input file.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual void setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
void initThermoFile(const std::string &inputFile, const std::string &id)
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
AnyMap m_input
Data supplied via setParameters.
const AnyMap & input() const
Access input data associated with the phase description.
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
A representation of the units associated with a dimensional quantity.
Class XML_Node is a tree-based representation of the contents of an XML file.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type="")
Get a floating-point value from a child element.