32 VPSSMgrFactory* VPSSMgrFactory::s_factory = 0;
35 mutex_t VPSSMgrFactory::vpss_species_thermo_mutex;
57 int& has_nasa_idealGas,
58 int& has_nasa_constVol,
59 int& has_shomate_idealGas,
60 int& has_shomate_constVol,
61 int& has_simple_idealGas,
62 int& has_simple_constVol,
69 string ssModel =
"idealGas";
70 for (
size_t n = 0; n < spDataNodeList.size(); n++) {
72 XML_Node* spNode = spDataNodeList[n];
73 if (spNode->
hasChild(
"standardState")) {
74 string mm = spNode->
child(
"standardState")[
"model"];
75 if (mm ==
"waterIAPWS" || mm ==
"waterPDSS") {
87 if (spNode->
hasChild(
"standardState")) {
88 ssModel = spNode->
child(
"standardState")[
"model"];
91 if (ssModel ==
"idealGas") {
93 }
else if (ssModel ==
"constant_incompressible" ||
94 ssModel ==
"constantVolume") {
96 }
else if (ssModel ==
"temperature_polynomial" ||
97 ssModel ==
"density_temperature_polynomial" ||
98 ssModel ==
"constant") {
107 if (ssModel ==
"idealGas") {
108 has_shomate_idealGas++;
109 }
else if (ssModel ==
"constant_incompressible" ||
110 ssModel ==
"constantVolume") {
111 has_shomate_constVol++;
112 }
else if (ssModel ==
"temperature_polynomial" ||
113 ssModel ==
"density_temperature_polynomial" ||
114 ssModel ==
"constant") {
123 if (ssModel ==
"idealGas") {
124 has_simple_idealGas++;
125 }
else if (ssModel ==
"constant_incompressible" ||
126 ssModel ==
"constantVolume") {
127 has_simple_constVol++;
128 }
else if (ssModel ==
"temperature_polynomial" ||
129 ssModel ==
"density_temperature_polynomial" ||
130 ssModel ==
"constant") {
139 if (th.
child(
"poly")[
"order"] ==
"1") {
140 has_simple_constVol = 1;
143 "poly with order > 1 not yet supported");
153 if (th.
hasChild(
"NASA9MULTITEMP")) {
173 void VPSSMgrFactory::deleteFactory()
175 ScopedLock lock(vpss_species_thermo_mutex);
181 VPSSMgrFactory::VPSSMgr_StringConversion(
const std::string& ssModel)
const
183 std::string lssModel =
lowercase(ssModel);
185 if (lssModel ==
"idealgas") {
187 }
else if (lssModel ==
"constvol") {
189 }
else if (lssModel ==
"purefuild") {
190 type = cVPSSMGR_PUREFLUID;
191 }
else if (lssModel ==
"water_constvol") {
193 }
else if (lssModel ==
"water_hkft") {
195 }
else if (lssModel ==
"general") {
198 type = cVPSSMGR_UNDEF;
206 std::vector<XML_Node*> & spDataNodeList)
209 std::string ssManager;
210 std::string vpssManager;
216 if (phaseNode_ptr->
hasChild(
"thermo")) {
218 if (thermoNode.
hasChild(
"standardStateManager")) {
219 const XML_Node& ssNode = thermoNode.
child(
"standardStateManager");
220 ssManager = ssNode[
"model"];
222 if (thermoNode.
hasChild(
"variablePressureStandardStateManager")) {
223 const XML_Node& vpssNode = thermoNode.
child(
"variablePressureStandardStateManager");
224 vpssManager = vpssNode[
"model"];
235 if (vpssManager !=
"") {
243 }
else if (vp_ptr->
eosType() == cVPSS_ConstVol) {
248 int inasaIG = 0, inasaCV = 0, ishomateIG = 0, ishomateCV = 0,
249 isimpleIG = 0, isimpleCV = 0, iwater = 0, itpx = 0, iother = 0;
253 getVPSSMgrTypes(spDataNodeList, inasaIG, inasaCV, ishomateIG, ishomateCV,
254 isimpleIG, isimpleCV, iwater, itpx, ihptx, iother);
262 if (inasaIG || ishomateIG || isimpleIG) {
263 throw CanteraError(
"newVPSSMgr",
"Ideal gas with liquid water");
268 if (inasaIG || ishomateIG || isimpleIG) {
269 throw CanteraError(
"newVPSSMgr",
"Ideal gas with liquid water");
270 }
else if (inasaCV || ishomateCV || isimpleCV) {
277 if (inasaCV || ishomateCV || isimpleCV) {
278 if (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) {
297 case cVPSSMGR_PUREFLUID:
318 f = VPSSMgrFactory::factory();
326 std::vector<XML_Node*> & spDataNodeList,
330 f = VPSSMgrFactory::factory();
332 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...
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.
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...
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.
A species thermodynamic property manager for a phase.
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...
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.
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 ...
virtual int eosType() const
Equation of state type flag.
Declarations for a derived class for the calculation of multiple-species thermodynamic property manag...
Contains declarations for string manipulation functions within Cantera.
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...