[Thermo] Make WaterSSTP constructible using newPhase

This makes it possible to create a WaterSSTP phase using an XML input file, and
use this model from Python and Matlab.
This commit is contained in:
Ray Speth 2018-08-28 19:23:30 -04:00
parent ef40d4418d
commit f46df83841
4 changed files with 14 additions and 7 deletions

View file

@ -65,9 +65,14 @@ class WaterProps;
*
* ## Instantiation of the Class
*
* The constructor for this phase is NOT located in the default ThermoFactory
* for %Cantera. However, a new WaterSSTP object may be created by the following
* code snippets, combined with an XML file given in the XML example section.
* A new WaterSSTP object may be created by the following code snippets,
* combined with an XML file given in the XML example section.
*
* @code
* ThermoPhase* w = newPhase("waterSSTPphase.xml");
* @endcode
*
* or
*
* @code
* WaterSSTP *w = new WaterSSTP("waterSSTPphase.xml","");

View file

@ -39,6 +39,7 @@
#include "cantera/thermo/IdealMolalSoln.h"
#include "cantera/thermo/MolarityIonicVPSSTP.h"
#include "cantera/thermo/IdealSolnGasVPSS.h"
#include "cantera/thermo/WaterSSTP.h"
#include "cantera/base/stringUtils.h"
using namespace std;
@ -77,6 +78,7 @@ ThermoFactory::ThermoFactory()
reg("RedlichKwong", []() { return new RedlichKwongMFTP(); });
m_synonyms["RedlichKwongMFTP"] = "RedlichKwong";
reg("MaskellSolidSolnPhase", []() { return new MaskellSolidSolnPhase(); });
reg("PureLiquidWater", []() { return new WaterSSTP(); });
}
ThermoPhase* ThermoFactory::newThermoPhase(const std::string& model)

View file

@ -1,4 +1,4 @@
#include "cantera/thermo/WaterSSTP.h"
#include "cantera/thermo/ThermoFactory.h"
#include <iostream>
using namespace std;
@ -20,7 +20,7 @@ int main()
#endif
double pres;
try {
WaterSSTP* w = new WaterSSTP("waterTPphase.xml", "water");
ThermoPhase* w = newPhase("waterTPphase.xml");
/*
* Print out the triple point conditions

View file

@ -1,5 +1,5 @@
#include "cantera/thermo/WaterSSTP.h"
#include "cantera/thermo/ThermoFactory.h"
#include "cantera/transport/WaterTransport.h"
#include <cstdio>
@ -20,7 +20,7 @@ int main()
{
try {
double lambda;
WaterSSTP* w = new WaterSSTP("waterTPphase.xml", "");
ThermoPhase* w = newPhase("waterTPphase.xml");
WaterTransport* wtTran = new WaterTransport(w, 3);
printf("------------------------------------------------------------------------------------\n");