44 VPSSMgrFactory* VPSSMgrFactory::s_factory = 0;
47 mutex_t VPSSMgrFactory::vpss_species_thermo_mutex;
69 int& has_nasa_idealGas,
70 int& has_nasa_constVol,
71 int& has_shomate_idealGas,
72 int& has_shomate_constVol,
73 int& has_simple_idealGas,
74 int& has_simple_constVol,
82 string ssModel =
"idealGas";
83 size_t ns = spDataNodeList.size();
84 for (
size_t n = 0; n < ns; n++) {
86 XML_Node* spNode = spDataNodeList[n];
87 if (spNode->
hasChild(
"standardState")) {
89 string mm = ssN[
"model"];
90 if (mm ==
"waterIAPWS" || mm ==
"waterPDSS") {
102 if (spNode->
hasChild(
"standardState")) {
103 ss_ptr = &(spNode->
child(
"standardState"));
104 ssModel = ss_ptr->
attrib(
"model");
107 if (ssModel ==
"idealGas") {
109 }
else if (ssModel ==
"constant_incompressible" ||
110 ssModel ==
"constantVolume") {
112 }
else if (ssModel ==
"temperature_polynomial" ||
113 ssModel ==
"density_temperature_polynomial" ||
114 ssModel ==
"constant") {
123 if (ssModel ==
"idealGas") {
124 has_shomate_idealGas++;
125 }
else if (ssModel ==
"constant_incompressible" ||
126 ssModel ==
"constantVolume") {
127 has_shomate_constVol++;
128 }
else if (ssModel ==
"temperature_polynomial" ||
129 ssModel ==
"density_temperature_polynomial" ||
130 ssModel ==
"constant") {
139 if (ssModel ==
"idealGas") {
140 has_simple_idealGas++;
141 }
else if (ssModel ==
"constant_incompressible" ||
142 ssModel ==
"constantVolume") {
143 has_simple_constVol++;
144 }
else if (ssModel ==
"temperature_polynomial" ||
145 ssModel ==
"density_temperature_polynomial" ||
146 ssModel ==
"constant") {
155 if (th.
child(
"poly")[
"order"] ==
"1") {
156 has_simple_constVol = 1;
159 "poly with order > 1 not yet supported");
169 if (th.
hasChild(
"NASA9MULTITEMP")) {
189 void VPSSMgrFactory::deleteFactory()
191 ScopedLock lock(vpss_species_thermo_mutex);
199 VPSSMgrFactory::VPSSMgr_StringConversion(
const std::string& ssModel)
const
201 std::string lssModel =
lowercase(ssModel);
203 if (lssModel ==
"idealgas") {
205 }
else if (lssModel ==
"constvol") {
207 }
else if (lssModel ==
"purefuild") {
208 type = cVPSSMGR_PUREFLUID;
209 }
else if (lssModel ==
"water_constvol") {
211 }
else if (lssModel ==
"water_hkft") {
213 }
else if (lssModel ==
"general") {
216 type = cVPSSMGR_UNDEF;
224 std::vector<XML_Node*> & spDataNodeList)
227 std::string ssManager=
"";
228 std::string vpssManager=
"";
234 if (phaseNode_ptr->
hasChild(
"thermo")) {
236 if (thermoNode.
hasChild(
"standardStateManager")) {
237 const XML_Node& ssNode = thermoNode.
child(
"standardStateManager");
238 ssManager = ssNode[
"model"];
240 if (thermoNode.
hasChild(
"variablePressureStandardStateManager")) {
241 const XML_Node& vpssNode = thermoNode.
child(
"variablePressureStandardStateManager");
242 vpssManager = vpssNode[
"model"];
250 if (ssManager !=
"") {
259 if (vpssManager !=
"") {
267 }
else if (vp_ptr->
eosType() == cVPSS_ConstVol) {
272 int inasaIG = 0, inasaCV = 0, ishomateIG = 0, ishomateCV = 0,
273 isimpleIG = 0, isimpleCV = 0,
274 iwater = 0, itpx = 0, iother = 0;
278 getVPSSMgrTypes(spDataNodeList, inasaIG, inasaCV, ishomateIG, ishomateCV,
279 isimpleIG, isimpleCV, iwater, itpx, ihptx, iother);
287 if (inasaIG || ishomateIG || isimpleIG) {
288 throw CanteraError(
"newVPSSMgr",
"Ideal gas with liquid water");
293 if (inasaIG || ishomateIG || isimpleIG) {
294 throw CanteraError(
"newVPSSMgr",
"Ideal gas with liquid water");
295 }
else if (inasaCV || ishomateCV || isimpleCV) {
302 if (inasaCV || ishomateCV || isimpleCV) {
303 if (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) {
322 case cVPSSMGR_PUREFLUID:
343 f = VPSSMgrFactory::factory();
351 std::vector<XML_Node*> & spDataNodeList,
355 f = VPSSMgrFactory::factory();
357 return f->
newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList);
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
void popError()
Discard the last error message.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Declaration file for a virtual base class that manages the calculation of standard state properties f...
Variable pressure SS calculate for phases consisting of real water as the first species and species o...
Declaration file for a derived class that handles the calculation of standard state thermo properties...
static void getVPSSMgrTypes(std::vector< XML_Node * > &spDataNodeList, int &has_nasa_idealGas, int &has_nasa_constVol, int &has_shomate_idealGas, int &has_shomate_constVol, int &has_simple_idealGas, int &has_simple_constVol, int &has_water, int &has_tpx, int &has_hptx, int &has_other)
Examine the types of species thermo parameterizations, and return a flag indicating the type of param...
Variable pressure SS calculate for phases consisting of completing general representations.
virtual int eosType() const
Equation of state type flag.
Declaration file for a derived class that handles the calculation of standard state thermo properties...
Class XML_Node is a tree-based representation of the contents of an XML file.
VPSSMgr * newVPSSMgr(VPStandardStateTP *tp_ptr, XML_Node *phaseNode_ptr, std::vector< XML_Node * > &spDataNodeList, VPSSMgrFactory *f)
Function to return VPSSMgr manager.
Handles the calculation of standard state thermo properties for real water and a set of species which...
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
Variable pressure SS calculate for phases consisting of real water as the first species and species h...
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
Constant Molar Volume e VPSS species thermo manager class.
Pure Virtual base class for the species thermo manager classes.
VPSSMgr_enumType
enum for VPSSMgr types that are responsible for calculating the species standard state and reference-...
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
SpeciesThermo * newSpeciesThermoMgr(int type, SpeciesThermoFactory *f)
Create a new species thermo manager instance, by specifying the type and (optionally) a pointer to th...
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
Declaration file for a derived class that handles the calculation of standard state thermo properties...
Throw a named error for an unknown or missing vpss species thermo model.
Variable pressure SS calculate for phases consisting all species having a constant molar volume prope...
Classes providing support for XML data files.
Factory to build instances of classes that manage the standard-state thermodynamic properties of a se...
Base class for exceptions thrown by Cantera classes.
const int cVPSS_IdealGas
Variable Pressure Standard State ThermoPhase objects.
Manages standard state thermo properties for real water and a set of species which have the HKFT equa...
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Variable pressures SS calculator for ideal gas phases.
This file contains descriptions of templated subclasses of the virtual base class, SpeciesThermo, which includes SpeciesThermoDuo (see Managers for Calculating Reference-State Thermodynamics and class SpeciesThermoDuo)
Throw a named error for an unknown or missing species thermo model.
Header for factory to build instances of classes that manage the standard-state thermodynamic propert...
Headers for a completely general species thermodynamic property manager for a phase (see Managers for...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Declarations for a derived class for the calculation of multiple-species thermodynamic property manag...
A VPSSMgr where all species in the phase obey an ideal gas equation of state.
Header for factory to build instances of classes that manage the standard-state thermodynamic propert...
virtual SpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
void setSpeciesThermo(SpeciesThermo *spthermo)
Install a species thermodynamic property manager.
Class that handles the calculation of standard state thermo properties for a set of species belonging...
virtual VPSSMgr * newVPSSMgr(VPSSMgr_enumType type, VPStandardStateTP *vp_ptr)
Create a new species variable pressure standard state calculator.
Declaration file for a derived class that handles the calculation of standard state thermo properties...