Uupdaetd the structure of the namespaces so that it would compile.
This commit is contained in:
parent
fef034f8a8
commit
72a6de13a4
20 changed files with 1651 additions and 1520 deletions
|
|
@ -19,6 +19,8 @@
|
|||
#include "WaterProps.h"
|
||||
#include "WaterPDSS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +55,7 @@ namespace Cantera {
|
|||
* the routine initThermo(), with a reference to the
|
||||
* XML database to get the info for the phase.
|
||||
*/
|
||||
DebyeHuckel::DebyeHuckel(string inputFile, string id) :
|
||||
DebyeHuckel::DebyeHuckel(std::string inputFile, std::string id) :
|
||||
MolalityVPSSTP(),
|
||||
m_formDH(DHFORM_DILUTE_LIMIT),
|
||||
m_formGC(2),
|
||||
|
|
@ -76,7 +78,7 @@ namespace Cantera {
|
|||
constructPhaseFile(inputFile, id);
|
||||
}
|
||||
|
||||
DebyeHuckel::DebyeHuckel(XML_Node& phaseRoot, string id) :
|
||||
DebyeHuckel::DebyeHuckel(XML_Node& phaseRoot, std::string id) :
|
||||
MolalityVPSSTP(),
|
||||
m_formDH(DHFORM_DILUTE_LIMIT),
|
||||
m_formGC(2),
|
||||
|
|
@ -1036,13 +1038,13 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void DebyeHuckel::constructPhaseFile(string inputFile, string id) {
|
||||
void DebyeHuckel::constructPhaseFile(std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("DebyeHuckel::initThermo",
|
||||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
std::string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("DebyeHuckel::initThermo","could not open "
|
||||
|
|
@ -1072,7 +1074,7 @@ namespace Cantera {
|
|||
* utility function to assign an integer value from a string
|
||||
* for the ElectrolyteSpeciesType field.
|
||||
*/
|
||||
static int interp_est(string estString) {
|
||||
static int interp_est(std::string estString) {
|
||||
const char *cc = estString.c_str();
|
||||
if (!strcasecmp(cc, "solvent")) {
|
||||
return cEST_solvent;
|
||||
|
|
@ -1118,10 +1120,10 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void DebyeHuckel::constructPhaseXML(XML_Node& phaseNode, string id) {
|
||||
void DebyeHuckel::constructPhaseXML(XML_Node& phaseNode, std::string id) {
|
||||
|
||||
if (id.size() > 0) {
|
||||
string idp = phaseNode.id();
|
||||
std::string idp = phaseNode.id();
|
||||
if (idp != id) {
|
||||
throw CanteraError("DebyeHuckel::constructPhaseXML",
|
||||
"phasenode and Id are incompatible");
|
||||
|
|
@ -1143,7 +1145,7 @@ namespace Cantera {
|
|||
if (thermoNode.hasChild("standardConc")) {
|
||||
XML_Node& scNode = thermoNode.child("standardConc");
|
||||
m_formGC = 2;
|
||||
string formString = scNode.attrib("model");
|
||||
std::string formString = scNode.attrib("model");
|
||||
if (formString != "") {
|
||||
if (formString == "unity") {
|
||||
m_formGC = 0;
|
||||
|
|
@ -1165,10 +1167,10 @@ namespace Cantera {
|
|||
* Get the Name of the Solvent:
|
||||
* <solvent> solventName </solvent>
|
||||
*/
|
||||
string solventName = "";
|
||||
std::string solventName = "";
|
||||
if (thermoNode.hasChild("solvent")) {
|
||||
XML_Node& scNode = thermoNode.child("solvent");
|
||||
vector<string> nameSolventa;
|
||||
vector<std::string> nameSolventa;
|
||||
getStringArray(scNode, nameSolventa);
|
||||
int nsp = static_cast<int>(nameSolventa.size());
|
||||
if (nsp != 1) {
|
||||
|
|
@ -1185,7 +1187,7 @@ namespace Cantera {
|
|||
if (thermoNode.hasChild("activityCoefficients")) {
|
||||
XML_Node& scNode = thermoNode.child("activityCoefficients");
|
||||
m_formDH = DHFORM_DILUTE_LIMIT;
|
||||
string formString = scNode.attrib("model");
|
||||
std::string formString = scNode.attrib("model");
|
||||
if (formString != "") {
|
||||
if (formString == "Dilute_limit") {
|
||||
m_formDH = DHFORM_DILUTE_LIMIT;
|
||||
|
|
@ -1242,9 +1244,9 @@ namespace Cantera {
|
|||
* with the correct id.
|
||||
*/
|
||||
void DebyeHuckel::
|
||||
initThermoXML(XML_Node& phaseNode, string id) {
|
||||
initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
int k;
|
||||
string stemp;
|
||||
std::string stemp;
|
||||
/*
|
||||
* Find the Thermo XML node
|
||||
*/
|
||||
|
|
@ -1267,10 +1269,10 @@ namespace Cantera {
|
|||
* Get the Name of the Solvent:
|
||||
* <solvent> solventName </solvent>
|
||||
*/
|
||||
string solventName = "";
|
||||
std::string solventName = "";
|
||||
if (thermoNode.hasChild("solvent")) {
|
||||
XML_Node& scNode = thermoNode.child("solvent");
|
||||
vector<string> nameSolventa;
|
||||
vector<std::string> nameSolventa;
|
||||
getStringArray(scNode, nameSolventa);
|
||||
int nsp = static_cast<int>(nameSolventa.size());
|
||||
if (nsp != 1) {
|
||||
|
|
@ -1280,7 +1282,7 @@ namespace Cantera {
|
|||
solventName = nameSolventa[0];
|
||||
}
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
string sname = speciesName(k);
|
||||
std::string sname = speciesName(k);
|
||||
if (solventName == sname) {
|
||||
m_indexSolvent = k;
|
||||
break;
|
||||
|
|
@ -1321,13 +1323,13 @@ namespace Cantera {
|
|||
"Species " + sss[k] +
|
||||
" standardState XML block not found");
|
||||
}
|
||||
string modelStringa = ss->attrib("model");
|
||||
std::string modelStringa = ss->attrib("model");
|
||||
if (modelStringa == "") {
|
||||
throw CanteraError("DebyeHuckel::initThermoXML",
|
||||
"Species " + sss[k] +
|
||||
" standardState XML block model attribute not found");
|
||||
}
|
||||
string modelString = lowercase(modelStringa);
|
||||
std::string modelString = lowercase(modelStringa);
|
||||
|
||||
if (k == 0) {
|
||||
if (modelString == "wateriapws" || modelString == "real_water" ||
|
||||
|
|
@ -1479,15 +1481,15 @@ namespace Cantera {
|
|||
if (acNode.hasChild("ionicRadius")) {
|
||||
XML_Node& irNode = acNode.child("ionicRadius");
|
||||
|
||||
string Aunits = "";
|
||||
std::string Aunits = "";
|
||||
double Afactor = 1.0;
|
||||
if (irNode.hasAttrib("units")) {
|
||||
string Aunits = irNode.attrib("units");
|
||||
std::string Aunits = irNode.attrib("units");
|
||||
Afactor = toSI(Aunits);
|
||||
}
|
||||
|
||||
if (irNode.hasAttrib("default")) {
|
||||
string ads = irNode.attrib("default");
|
||||
std::string ads = irNode.attrib("default");
|
||||
double ad = fpValue(ads);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
m_Aionic[k] = ad * Afactor;
|
||||
|
|
@ -1521,7 +1523,7 @@ namespace Cantera {
|
|||
* lack of agreement (HKM -> may be changed in the
|
||||
* future).
|
||||
*/
|
||||
map<string,string>::const_iterator _b = m.begin();
|
||||
map<std::string,std::string>::const_iterator _b = m.begin();
|
||||
for (; _b != m.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
|
|
@ -1571,7 +1573,7 @@ namespace Cantera {
|
|||
*/
|
||||
const XML_Node *phaseSpecies = speciesData();
|
||||
if (phaseSpecies) {
|
||||
string kname, jname;
|
||||
std::string kname, jname;
|
||||
vector<XML_Node*> xspecies;
|
||||
phaseSpecies->getChildren("species",xspecies);
|
||||
int jj = xspecies.size();
|
||||
|
|
@ -1602,9 +1604,9 @@ namespace Cantera {
|
|||
if (acNodePtr->hasChild("stoichIsMods")) {
|
||||
XML_Node& sIsNode = acNodePtr->child("stoichIsMods");
|
||||
|
||||
map<string, string> msIs;
|
||||
map<std::string, std::string> msIs;
|
||||
getMap(sIsNode, msIs);
|
||||
map<string,string>::const_iterator _b = msIs.begin();
|
||||
map<std::string,std::string>::const_iterator _b = msIs.begin();
|
||||
for (; _b != msIs.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
|
|
@ -1650,13 +1652,13 @@ namespace Cantera {
|
|||
const XML_Node *phaseSpecies = speciesData();
|
||||
const XML_Node *spPtr = 0;
|
||||
if (phaseSpecies) {
|
||||
string kname;
|
||||
std::string kname;
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
kname = speciesName(k);
|
||||
spPtr = speciesXML_Node(kname, phaseSpecies);
|
||||
if (!spPtr) {
|
||||
if (spPtr->hasChild("electrolyteSpeciesType")) {
|
||||
string est = getString(*spPtr, "electrolyteSpeciesType");
|
||||
std::string est = getString(*spPtr, "electrolyteSpeciesType");
|
||||
if ((m_electrolyteSpeciesType[k] = interp_est(est)) == -1) {
|
||||
throw CanteraError("DebyeHuckel:initThermoXML",
|
||||
"Bad electrolyte type: " + est);
|
||||
|
|
@ -1671,14 +1673,14 @@ namespace Cantera {
|
|||
if (acNodePtr) {
|
||||
if (acNodePtr->hasChild("electrolyteSpeciesType")) {
|
||||
XML_Node& ESTNode = acNodePtr->child("electrolyteSpeciesType");
|
||||
map<string, string> msEST;
|
||||
map<std::string, std::string> msEST;
|
||||
getMap(ESTNode, msEST);
|
||||
map<string,string>::const_iterator _b = msEST.begin();
|
||||
map<std::string,std::string>::const_iterator _b = msEST.begin();
|
||||
for (; _b != msEST.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
} else {
|
||||
string est = _b->second;
|
||||
std::string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("DebyeHuckel:initThermoXML",
|
||||
"Bad electrolyte type: " + est);
|
||||
|
|
@ -1895,7 +1897,7 @@ namespace Cantera {
|
|||
* Bail out of functions with an error exit if they are not
|
||||
* implemented.
|
||||
*/
|
||||
doublereal DebyeHuckel::err(string msg) const {
|
||||
doublereal DebyeHuckel::err(std::string msg) const {
|
||||
throw CanteraError("DebyeHuckel",
|
||||
"Unfinished func called: " + msg );
|
||||
return 0.0;
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ namespace Cantera {
|
|||
DebyeHuckel(const DebyeHuckel &);
|
||||
DebyeHuckel& operator=(const DebyeHuckel&);
|
||||
|
||||
DebyeHuckel(string inputFile, string id = "");
|
||||
DebyeHuckel(XML_Node& phaseRef, string id = "");
|
||||
DebyeHuckel(std::string inputFile, std::string id = "");
|
||||
DebyeHuckel(XML_Node& phaseRef, std::string id = "");
|
||||
|
||||
/// Destructor.
|
||||
virtual ~DebyeHuckel();
|
||||
|
|
@ -816,7 +816,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
virtual void constructPhaseFile(string infile, string id="");
|
||||
virtual void constructPhaseFile(std::string infile, std::string id="");
|
||||
|
||||
/*
|
||||
* Import and initialize a DebyeHuckel phase
|
||||
|
|
@ -842,10 +842,10 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, string id="");
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, std::string id="");
|
||||
|
||||
|
||||
virtual void initThermoXML(XML_Node& phaseNode, string id);
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/**
|
||||
* Report the molar volume of species k
|
||||
|
|
@ -1187,7 +1187,7 @@ namespace Cantera {
|
|||
mutable array_fp m_dlnActCoeffMolaldP;
|
||||
|
||||
private:
|
||||
doublereal err(string msg) const;
|
||||
doublereal err(std::string msg) const;
|
||||
|
||||
|
||||
void initLengths();
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Cantera {
|
|||
* the routine initThermo(), with a reference to the
|
||||
* XML database to get the info for the phase.
|
||||
*/
|
||||
HMWSoln::HMWSoln(string inputFile, string id) :
|
||||
HMWSoln::HMWSoln(std::string inputFile, std::string id) :
|
||||
MolalityVPSSTP(),
|
||||
m_formPitzer(PITZERFORM_BASE),
|
||||
m_formPitzerTemp(PITZER_TEMP_CONSTANT),
|
||||
|
|
@ -80,7 +80,7 @@ namespace Cantera {
|
|||
constructPhaseFile(inputFile, id);
|
||||
}
|
||||
|
||||
HMWSoln::HMWSoln(XML_Node& phaseRoot, string id) :
|
||||
HMWSoln::HMWSoln(XML_Node& phaseRoot, std::string id) :
|
||||
MolalityVPSSTP(),
|
||||
m_formPitzer(PITZERFORM_BASE),
|
||||
m_formPitzerTemp(PITZER_TEMP_CONSTANT),
|
||||
|
|
@ -423,15 +423,6 @@ namespace Cantera {
|
|||
getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
|
||||
getMoleFractions(DATA_PTR(m_pp));
|
||||
double val = mean_X(DATA_PTR(m_tmpV));
|
||||
#ifdef DEBUG_HKM
|
||||
double val0 = 0.0;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
val0 += m_tmpV[k] * m_pp[k];
|
||||
}
|
||||
//if (val != val0) {
|
||||
// printf("ERROR\n");
|
||||
//}
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
@ -1542,7 +1533,7 @@ namespace Cantera {
|
|||
* Bail out of functions with an error exit if they are not
|
||||
* implemented.
|
||||
*/
|
||||
doublereal HMWSoln::err(string msg) const {
|
||||
doublereal HMWSoln::err(std::string msg) const {
|
||||
throw CanteraError("HMWSoln",
|
||||
"Unfinished func called: " + msg );
|
||||
return 0.0;
|
||||
|
|
@ -1905,7 +1896,7 @@ namespace Cantera {
|
|||
}
|
||||
#endif
|
||||
double wateract;
|
||||
string sni, snj, snk;
|
||||
std::string sni, snj, snk;
|
||||
|
||||
/*
|
||||
* This is the molality of the species in solution.
|
||||
|
|
@ -2730,7 +2721,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
double d_wateract_dT;
|
||||
string sni, snj, snk;
|
||||
std::string sni, snj, snk;
|
||||
|
||||
const double *molality = DATA_PTR(m_molalities);
|
||||
const double *charge = DATA_PTR(m_speciesCharge);
|
||||
|
|
@ -3510,7 +3501,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
double d2_wateract_dT2;
|
||||
string sni, snj, snk;
|
||||
std::string sni, snj, snk;
|
||||
|
||||
const double *molality = DATA_PTR(m_molalities);
|
||||
const double *charge = DATA_PTR(m_speciesCharge);
|
||||
|
|
@ -4317,7 +4308,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
double d_wateract_dP;
|
||||
string sni, snj, snk;
|
||||
std::string sni, snj, snk;
|
||||
|
||||
const double *molality = DATA_PTR(m_molalities);
|
||||
const double *charge = DATA_PTR(m_speciesCharge);
|
||||
|
|
@ -5205,7 +5196,7 @@ namespace Cantera {
|
|||
*/
|
||||
void HMWSoln::printCoeffs() const {
|
||||
int i, j, k;
|
||||
string sni, snj;
|
||||
std::string sni, snj;
|
||||
calcMolalities();
|
||||
const double *charge = DATA_PTR(m_speciesCharge);
|
||||
double *molality = DATA_PTR(m_molalities);
|
||||
|
|
@ -5249,7 +5240,7 @@ namespace Cantera {
|
|||
for (j = 1; j < m_kk; j++) {
|
||||
snj = speciesName(j);
|
||||
for (k = 1; k < m_kk; k++) {
|
||||
string snk = speciesName(k);
|
||||
std::string snk = speciesName(k);
|
||||
int n = k + j * m_kk + i * m_kk * m_kk;
|
||||
if (m_Psi_ijk[n] != 0.0) {
|
||||
printf(" %-16s %-16s %-16s %9.5f \n",
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ namespace Cantera {
|
|||
HMWSoln(const HMWSoln &);
|
||||
HMWSoln& operator=(const HMWSoln&);
|
||||
|
||||
HMWSoln(string inputFile, string id = "");
|
||||
HMWSoln(XML_Node& phaseRef, string id = "");
|
||||
HMWSoln(std::string inputFile, std::string id = "");
|
||||
HMWSoln(XML_Node& phaseRef, std::string id = "");
|
||||
|
||||
/**
|
||||
* This is a special constructor, used to replicate test problems
|
||||
|
|
@ -800,7 +800,7 @@ namespace Cantera {
|
|||
* This routine is a precursor to constructPhaseXML(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*/
|
||||
virtual void constructPhaseFile(string inputFile, string id);
|
||||
virtual void constructPhaseFile(std::string inputFile, std::string id);
|
||||
|
||||
/*
|
||||
* constructPhaseXML (virtual from HMWSoln)
|
||||
|
|
@ -816,7 +816,7 @@ namespace Cantera {
|
|||
* particular to the specification of the activity
|
||||
* coefficient model for the Pitzer parameterization.
|
||||
*/
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, string id);
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/**
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -851,7 +851,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, string id);
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/**
|
||||
* Report the molar volume of species k
|
||||
|
|
@ -1371,7 +1371,7 @@ namespace Cantera {
|
|||
mutable vector_fp m_gamma;
|
||||
|
||||
private:
|
||||
doublereal err(string msg) const;
|
||||
doublereal err(std::string msg) const;
|
||||
|
||||
|
||||
void initLengths();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
#include "WaterProps.h"
|
||||
#include "WaterPDSS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +26,7 @@ namespace Cantera {
|
|||
* utility function to assign an integer value from a string
|
||||
* for the ElectrolyteSpeciesType field.
|
||||
*/
|
||||
static int interp_est(string estString) {
|
||||
static int interp_est(std::string estString) {
|
||||
const char *cc = estString.c_str();
|
||||
if (!strcasecmp(cc, "solvent")) {
|
||||
return cEST_solvent;
|
||||
|
|
@ -581,7 +584,7 @@ namespace Cantera {
|
|||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
std::ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("HMWSoln:constructPhaseFile","could not open "
|
||||
+path+" for reading.");
|
||||
|
|
@ -830,8 +833,8 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
if (m_indexSolvent == -1) {
|
||||
cout << "HMWSoln::initThermo: Solvent Name not found"
|
||||
<< endl;
|
||||
std::cout << "HMWSoln::initThermo: Solvent Name not found"
|
||||
<< std::endl;
|
||||
throw CanteraError("HMWSoln::initThermoXML",
|
||||
"Solvent name not found");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ namespace Cantera {
|
|||
return *this;
|
||||
}
|
||||
|
||||
IdealMolalSoln::IdealMolalSoln(string inputFile, string id) :
|
||||
IdealMolalSoln::IdealMolalSoln(std::string inputFile, std::string id) :
|
||||
MolalityVPSSTP()
|
||||
{
|
||||
constructPhaseFile(inputFile, id);
|
||||
}
|
||||
|
||||
IdealMolalSoln::IdealMolalSoln(XML_Node& root, string id) :
|
||||
IdealMolalSoln::IdealMolalSoln(XML_Node& root, std::string id) :
|
||||
MolalityVPSSTP()
|
||||
{
|
||||
constructPhaseXML(root, id);
|
||||
|
|
@ -802,14 +802,15 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void IdealMolalSoln::constructPhaseFile(string inputFile, string id) {
|
||||
void IdealMolalSoln::constructPhaseFile(std::string inputFile,
|
||||
std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("IdealMolalSoln::constructPhaseFile",
|
||||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
std::string path = findInputFile(inputFile);
|
||||
std::ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("IdealMolalSoln::constructPhaseFile",
|
||||
"could not open "
|
||||
|
|
@ -857,9 +858,10 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void IdealMolalSoln::constructPhaseXML(XML_Node& phaseNode, string id) {
|
||||
void IdealMolalSoln::constructPhaseXML(XML_Node& phaseNode,
|
||||
std::string id) {
|
||||
if (id.size() > 0) {
|
||||
string idp = phaseNode.id();
|
||||
std::string idp = phaseNode.id();
|
||||
if (idp != id) {
|
||||
throw CanteraError("IdealMolalSoln::constructPhaseXML",
|
||||
"phasenode and Id are incompatible");
|
||||
|
|
@ -904,7 +906,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, string id) {
|
||||
void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
|
||||
/*
|
||||
* Initialize the whole thermo object, using a virtual function.
|
||||
|
|
@ -912,7 +914,7 @@ namespace Cantera {
|
|||
initThermo();
|
||||
|
||||
if (id.size() > 0) {
|
||||
string idp = phaseNode.id();
|
||||
std::string idp = phaseNode.id();
|
||||
if (idp != id) {
|
||||
throw CanteraError("IdealMolalSoln::initThermo",
|
||||
"phasenode and Id are incompatible");
|
||||
|
|
@ -934,7 +936,7 @@ namespace Cantera {
|
|||
if (thermoNode.hasChild("standardConc")) {
|
||||
XML_Node& scNode = thermoNode.child("standardConc");
|
||||
m_formGC = 2;
|
||||
string formString = scNode.attrib("model");
|
||||
std::string formString = scNode.attrib("model");
|
||||
if (formString != "") {
|
||||
if (formString == "unity") {
|
||||
m_formGC = 0;
|
||||
|
|
@ -953,10 +955,10 @@ namespace Cantera {
|
|||
* Get the Name of the Solvent:
|
||||
* <solvent> solventName </solvent>
|
||||
*/
|
||||
string solventName = "";
|
||||
std::string solventName = "";
|
||||
if (thermoNode.hasChild("solvent")) {
|
||||
XML_Node& scNode = thermoNode.child("solvent");
|
||||
vector<string> nameSolventa;
|
||||
std::vector<std::string> nameSolventa;
|
||||
getStringArray(scNode, nameSolventa);
|
||||
int nsp = static_cast<int>(nameSolventa.size());
|
||||
if (nsp != 1) {
|
||||
|
|
@ -971,15 +973,15 @@ namespace Cantera {
|
|||
* Reconcile the solvent name and index.
|
||||
*/
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
string sname = speciesName(k);
|
||||
std::string sname = speciesName(k);
|
||||
if (solventName == sname) {
|
||||
m_indexSolvent = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_indexSolvent == -1) {
|
||||
cout << "IdealMolalSoln::initThermo: Solvent Name not found"
|
||||
<< endl;
|
||||
std::cout << "IdealMolalSoln::initThermo: Solvent Name not found"
|
||||
<< std::endl;
|
||||
throw CanteraError("IdealMolalSoln::initThermo",
|
||||
"Solvent name not found");
|
||||
}
|
||||
|
|
@ -996,7 +998,7 @@ namespace Cantera {
|
|||
XML_Node* speciesDB =
|
||||
get_XML_NameID("speciesData", speciesList["datasrc"],
|
||||
&phaseNode.root());
|
||||
const vector<string>&sss = speciesNames();
|
||||
const std::vector<std::string> &sss = speciesNames();
|
||||
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
XML_Node* s = speciesDB->findByAttr("name", sss[k]);
|
||||
|
|
@ -1055,7 +1057,7 @@ namespace Cantera {
|
|||
* Bail out of functions with an error exit if they are not
|
||||
* implemented.
|
||||
*/
|
||||
doublereal IdealMolalSoln::err(string msg) const {
|
||||
doublereal IdealMolalSoln::err(std::string msg) const {
|
||||
throw CanteraError("IdealMolalSoln",
|
||||
"Unfinished func called: " + msg );
|
||||
return 0.0;
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ namespace Cantera {
|
|||
IdealMolalSoln(const IdealMolalSoln &);
|
||||
IdealMolalSoln& operator=(const IdealMolalSoln&);
|
||||
|
||||
IdealMolalSoln(string inputFile, string id = "");
|
||||
IdealMolalSoln(XML_Node& phaseRef, string id = "");
|
||||
IdealMolalSoln(std::string inputFile, std::string id = "");
|
||||
IdealMolalSoln(XML_Node& phaseRef, std::string id = "");
|
||||
|
||||
/// Destructor.
|
||||
virtual ~IdealMolalSoln();
|
||||
|
|
@ -725,7 +725,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
virtual void constructPhaseFile(string infile, string id="");
|
||||
virtual void constructPhaseFile(std::string infile, std::string id="");
|
||||
|
||||
/*
|
||||
* constructPhaseXML (virtual from here)
|
||||
|
|
@ -745,7 +745,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, string id);
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/*
|
||||
* initThermoXML (virtual from ThermoPhase)
|
||||
|
|
@ -766,7 +766,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, string id="");
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id="");
|
||||
|
||||
/*
|
||||
* Report the molar volume of species k
|
||||
|
|
@ -831,7 +831,7 @@ namespace Cantera {
|
|||
mutable vector_fp m_tmpV;
|
||||
|
||||
private:
|
||||
doublereal err(string msg) const;
|
||||
doublereal err(std::string msg) const;
|
||||
|
||||
|
||||
void initLengths();
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Cantera {
|
|||
* @param formCG This parameter initializes the m_formGC variable. The default
|
||||
* is a value of 0.
|
||||
*/
|
||||
IdealSolidSolnPhase(string infile, string id="", int formCG=0);
|
||||
IdealSolidSolnPhase(std::string infile, std::string id="", int formCG=0);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +133,7 @@ namespace Cantera {
|
|||
* @param formCG This parameter initializes the m_formGC variable. The default
|
||||
* is a value of 0.
|
||||
*/
|
||||
IdealSolidSolnPhase(XML_Node& root, string id="", int formCG=0);
|
||||
IdealSolidSolnPhase(XML_Node& root, std::string id="", int formCG=0);
|
||||
|
||||
/*
|
||||
* Copy Constructor
|
||||
|
|
@ -827,7 +827,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
virtual void constructPhaseFile(string infile, string id="");
|
||||
virtual void constructPhaseFile(std::string infile, std::string id="");
|
||||
|
||||
/**
|
||||
* Import and initialize an IdealSolidSolnPhase phase
|
||||
|
|
@ -854,7 +854,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, string id="");
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, std::string id="");
|
||||
|
||||
/**
|
||||
* Initialization of an IdealSolidSolnPhase phase:
|
||||
|
|
@ -889,7 +889,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, string id);
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
#include "MolalityVPSSTP.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Cantera {
|
|||
|
||||
void setMolalities(const doublereal * const molal);
|
||||
void setMolalitiesByName(compositionMap& xMap);
|
||||
void setMolalitiesByName(const string &);
|
||||
void setMolalitiesByName(const std::string &);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
@ -436,7 +436,7 @@ namespace Cantera {
|
|||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, string id);
|
||||
void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/**
|
||||
* Set the temperature (K), pressure (Pa), and molalities
|
||||
|
|
@ -449,7 +449,7 @@ namespace Cantera {
|
|||
void setState_TPM(doublereal t, doublereal p, compositionMap& m);
|
||||
|
||||
/** Set the temperature (K), pressure (Pa), and molalities. */
|
||||
void setState_TPM(doublereal t, doublereal p, const string& m);
|
||||
void setState_TPM(doublereal t, doublereal p, const std::string& m);
|
||||
|
||||
private:
|
||||
void initLengths();
|
||||
|
|
@ -477,7 +477,7 @@ namespace Cantera {
|
|||
|
||||
mutable vector_fp m_molalities;
|
||||
private:
|
||||
doublereal err(string msg) const;
|
||||
doublereal err(std::string msg) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "ctml.h"
|
||||
#include "PDSS.h"
|
||||
#include "importCTML.h"
|
||||
|
||||
#include "SpeciesThermo.h"
|
||||
|
||||
#include "ThermoPhase.h"
|
||||
|
||||
|
|
@ -31,31 +31,55 @@ namespace Cantera {
|
|||
m_temp(-1.0),
|
||||
m_dens(-1.0),
|
||||
m_tp(tp),
|
||||
m_mw(0.0),
|
||||
m_spindex(spindex),
|
||||
m_mw(0.0)
|
||||
m_spthermo(0),
|
||||
m_cp0_R_ptr(0),
|
||||
m_h0_RT_ptr(0),
|
||||
m_s0_R_ptr(0),
|
||||
m_g0_RT_ptr(0)
|
||||
{
|
||||
constructPDSS(tp, spindex);
|
||||
if (tp) {
|
||||
m_spthermo = &(tp->speciesThermo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PDSS::PDSS(ThermoPhase *tp, int spindex, string inputFile, string id) :
|
||||
PDSS::PDSS(ThermoPhase *tp, int spindex, std::string inputFile, std::string id) :
|
||||
m_temp(-1.0),
|
||||
m_dens(-1.0),
|
||||
m_tp(tp),
|
||||
m_spindex(spindex),
|
||||
m_mw(0.0)
|
||||
m_mw(0.0),
|
||||
m_spindex(spindex),
|
||||
m_spthermo(0),
|
||||
m_cp0_R_ptr(0),
|
||||
m_h0_RT_ptr(0),
|
||||
m_s0_R_ptr(0),
|
||||
m_g0_RT_ptr(0)
|
||||
{
|
||||
constructPDSSFile(tp, spindex, inputFile, id);
|
||||
if (tp) {
|
||||
m_spthermo = &(tp->speciesThermo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PDSS::PDSS(ThermoPhase *tp, int spindex, XML_Node& phaseRoot, string id) :
|
||||
PDSS::PDSS(ThermoPhase *tp, int spindex, XML_Node& phaseRoot, std::string id) :
|
||||
m_temp(-1.0),
|
||||
m_dens(-1.0),
|
||||
m_tp(0),
|
||||
m_mw(0.0),
|
||||
m_spindex(0),
|
||||
m_mw(0.0)
|
||||
m_spthermo(0),
|
||||
m_cp0_R_ptr(0),
|
||||
m_h0_RT_ptr(0),
|
||||
m_s0_R_ptr(0),
|
||||
m_g0_RT_ptr(0)
|
||||
{
|
||||
if (tp) {
|
||||
m_spthermo = &(tp->speciesThermo());
|
||||
}
|
||||
constructPDSSXML(tp, spindex, phaseRoot, id) ;
|
||||
}
|
||||
|
||||
|
|
@ -64,8 +88,13 @@ namespace Cantera {
|
|||
m_temp(-1.0),
|
||||
m_dens(-1.0),
|
||||
m_tp(0),
|
||||
m_spindex(0),
|
||||
m_mw(b.m_mw)
|
||||
m_mw(b.m_mw),
|
||||
m_spindex(b.m_spindex),
|
||||
m_spthermo(b.m_spthermo),
|
||||
m_cp0_R_ptr(b.m_cp0_R_ptr),
|
||||
m_h0_RT_ptr(b.m_h0_RT_ptr),
|
||||
m_s0_R_ptr(b.m_s0_R_ptr),
|
||||
m_g0_RT_ptr(b.m_g0_RT_ptr)
|
||||
{
|
||||
/*
|
||||
* Use the assignment operator to do the brunt
|
||||
|
|
@ -81,9 +110,15 @@ namespace Cantera {
|
|||
if (&b == this) return *this;
|
||||
m_tp = b.m_tp;
|
||||
m_spindex = b.m_spindex;
|
||||
m_spthermo = b.m_spthermo;
|
||||
m_temp = b.m_temp;
|
||||
m_dens = b.m_dens;
|
||||
m_mw = b.m_mw;
|
||||
m_spthermo = b.m_spthermo;
|
||||
m_cp0_R_ptr = b.m_cp0_R_ptr;
|
||||
m_h0_RT_ptr = b.m_h0_RT_ptr;
|
||||
m_s0_R_ptr = b.m_s0_R_ptr;
|
||||
m_g0_RT_ptr = b.m_g0_RT_ptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +147,7 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void PDSS::constructPDSSXML(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseNode, string id) {
|
||||
XML_Node& phaseNode, std::string id) {
|
||||
initThermo();
|
||||
}
|
||||
|
||||
|
|
@ -134,14 +169,14 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void PDSS::constructPDSSFile(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id) {
|
||||
std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("PDSS::initThermo",
|
||||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
std::string path = findInputFile(inputFile);
|
||||
std::ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("PDSS::initThermo","could not open "
|
||||
+path+" for reading.");
|
||||
|
|
@ -164,7 +199,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void PDSS::
|
||||
initThermoXML(XML_Node& phaseNode, string id) {
|
||||
initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
initThermo();
|
||||
}
|
||||
|
||||
|
|
@ -177,11 +212,15 @@ namespace Cantera {
|
|||
|
||||
/**
|
||||
* Return the molar enthalpy in units of J kmol-1
|
||||
*
|
||||
* (NOTE: assumes that ThermoPhase Ref Polynomials are up-to-date)
|
||||
*/
|
||||
doublereal PDSS::
|
||||
enthalpy_mole() const {
|
||||
throw CanteraError("PDSS::enthalpy_mole()", "unimplemented");
|
||||
return (0.0);
|
||||
//m_tp->_updateThermo();
|
||||
double m_temp = m_tp->temperature();
|
||||
double RT = GasConstant * m_temp;
|
||||
return m_h0_RT_ptr[m_spindex] * RT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,11 +20,13 @@
|
|||
class XML_Node;
|
||||
class ThermoPhase;
|
||||
|
||||
class WaterPropsIAPWS;
|
||||
class WaterPropsIAPWS;
|
||||
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
||||
class SpeciesThermo;
|
||||
|
||||
/**
|
||||
* Class for pressure dependent standard states.
|
||||
*
|
||||
|
|
@ -40,8 +42,8 @@ namespace Cantera {
|
|||
PDSS(ThermoPhase *tp, int spindex);
|
||||
PDSS(const PDSS &b);
|
||||
PDSS& operator=(const PDSS&b);
|
||||
PDSS(ThermoPhase *tp, int spindex, string inputFile, string id = "");
|
||||
PDSS(ThermoPhase *tp, int spindex, XML_Node& phaseRef, string id = "");
|
||||
PDSS(ThermoPhase *tp, int spindex, std::string inputFile, std::string id = "");
|
||||
PDSS(ThermoPhase *tp, int spindex, XML_Node& phaseRef, std::string id = "");
|
||||
virtual ~PDSS();
|
||||
|
||||
/**
|
||||
|
|
@ -123,10 +125,10 @@ namespace Cantera {
|
|||
|
||||
virtual void constructPDSS(ThermoPhase *tp, int spindex);
|
||||
virtual void constructPDSSFile(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id);
|
||||
std::string inputFile, std::string id);
|
||||
virtual void constructPDSSXML(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseNode, string id);
|
||||
virtual void initThermoXML(XML_Node& eosdata, string id);
|
||||
XML_Node& phaseNode, std::string id);
|
||||
virtual void initThermoXML(XML_Node& eosdata, std::string id);
|
||||
virtual void initThermo();
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
|
|
@ -153,15 +155,32 @@ namespace Cantera {
|
|||
*/
|
||||
ThermoPhase *m_tp;
|
||||
|
||||
|
||||
/**
|
||||
* Molecular Weight of the species
|
||||
*/
|
||||
doublereal m_mw;
|
||||
|
||||
/**
|
||||
* Species index in the thermophase corresponding to this species.
|
||||
*/
|
||||
int m_spindex;
|
||||
|
||||
/**
|
||||
* Molecular Weight of the species
|
||||
* Pointer to the species thermodynamic property manager.
|
||||
* This is a copy of the pointer in the ThermoPhase object.
|
||||
* Note, this object doesn't own the pointer.
|
||||
* If the SpeciesThermo ThermoPhase object doesn't know
|
||||
* or doesn't control the calculation, this will be
|
||||
* set to zero.
|
||||
*/
|
||||
doublereal m_mw;
|
||||
SpeciesThermo* m_spthermo;
|
||||
|
||||
doublereal *m_cp0_R_ptr;
|
||||
doublereal *m_h0_RT_ptr;
|
||||
doublereal *m_s0_R_ptr;
|
||||
doublereal *m_g0_RT_ptr;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "VPStandardStateTP.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
|
@ -29,7 +30,8 @@ namespace Cantera {
|
|||
*/
|
||||
VPStandardStateTP::VPStandardStateTP() :
|
||||
ThermoPhase(),
|
||||
m_tlast(-1.0)
|
||||
m_tlast(-1.0),
|
||||
m_plast(-1.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +46,8 @@ namespace Cantera {
|
|||
*/
|
||||
VPStandardStateTP::VPStandardStateTP(const VPStandardStateTP &b) :
|
||||
ThermoPhase(),
|
||||
m_tlast(-1.0)
|
||||
m_tlast(-1.0),
|
||||
m_plast(-1.0)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
|
@ -67,10 +70,15 @@ namespace Cantera {
|
|||
* However, we have to handle data that we own.
|
||||
*/
|
||||
m_tlast = b.m_tlast;
|
||||
m_plast = b.m_plast;
|
||||
m_h0_RT = b.m_h0_RT;
|
||||
m_cp0_R = b.m_cp0_R;
|
||||
m_g0_RT = b.m_g0_RT;
|
||||
m_s0_R = b.m_s0_R;
|
||||
m_hss_RT = b.m_hss_RT;
|
||||
m_cpss_R = b.m_cpss_R;
|
||||
m_gss_RT = b.m_gss_RT;
|
||||
m_sss_R = b.m_sss_R;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -323,6 +331,21 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* void _updateStandardStateThermo() (private, const)
|
||||
*
|
||||
* This function gets called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the ss thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
*/
|
||||
void VPStandardStateTP::_updateStandardStateThermo() const {
|
||||
doublereal tnow = temperature();
|
||||
if (m_tlast != tnow) {
|
||||
_updateRefStateThermo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,431 +24,473 @@
|
|||
|
||||
namespace Cantera {
|
||||
|
||||
class XML_Node;
|
||||
class XML_Node;
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* This is a filter class for ThermoPhase that implements
|
||||
* a variable pressure standard state for ThermoPhase objects.
|
||||
*
|
||||
* In addition support for the molality unit scale is provided.
|
||||
*
|
||||
* Currently, it really is just a shell. The ThermoPhase object
|
||||
* itself is based around the general concepts of
|
||||
* VPStandardStateTP. Therefore, there really isn't much going
|
||||
* on here. However, this may change. The ThermoPhase object
|
||||
* itself could change. Additionally, this object may revolve
|
||||
* around the molality unit scale in the near future. We will
|
||||
* have to see how things fare.
|
||||
*/
|
||||
|
||||
class VPStandardStateTP : public ThermoPhase {
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor.
|
||||
VPStandardStateTP();
|
||||
|
||||
/// Copy Constructor.
|
||||
VPStandardStateTP(const VPStandardStateTP &);
|
||||
|
||||
/// Assignment operator
|
||||
VPStandardStateTP& operator=(const VPStandardStateTP &);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~VPStandardStateTP();
|
||||
|
||||
/*
|
||||
* Duplication routine
|
||||
*/
|
||||
virtual ThermoPhase *duplMyselfAsThermoPhase();
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* This is a filter class for ThermoPhase that implements
|
||||
* a variable pressure standard state for ThermoPhase objects.
|
||||
*
|
||||
* In addition support for the molality unit scale is provided.
|
||||
*
|
||||
* Currently, it really is just a shell. The ThermoPhase object
|
||||
* itself is based around the general concepts of
|
||||
* VPStandardStateTP. Therefore, there really isn't much going
|
||||
* on here. However, this may change. The ThermoPhase object
|
||||
* itself could change. Additionally, this object may revolve
|
||||
* around the molality unit scale in the near future. We will
|
||||
* have to see how things fare.
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
class VPStandardStateTP : public ThermoPhase {
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor.
|
||||
VPStandardStateTP();
|
||||
|
||||
/// Copy Constructor.
|
||||
VPStandardStateTP(const VPStandardStateTP &);
|
||||
|
||||
/// Assignment operator
|
||||
VPStandardStateTP& operator=(const VPStandardStateTP &);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~VPStandardStateTP();
|
||||
|
||||
/*
|
||||
* Duplication routine
|
||||
*/
|
||||
virtual ThermoPhase *duplMyselfAsThermoPhase();
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const { return 0; }
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const { return 0; }
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Electric Potential
|
||||
*
|
||||
* The phase may be at some non-zero electrical
|
||||
* potential. These methods set or get the value of the
|
||||
* electric potential.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
* @name Electric Potential
|
||||
*
|
||||
* The phase may be at some non-zero electrical
|
||||
* potential. These methods set or get the value of the
|
||||
* electric potential.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
* @name Activities and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
* concentrations Note they have the same units, as their
|
||||
* ratio is defined to be equal to the activity of the kth
|
||||
* species in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
virtual void getUnitsStandardConc(double *uA, int k = 0,
|
||||
int sizeUA = 6);
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
* concentrations Note they have the same units, as their
|
||||
* ratio is defined to be equal to the activity of the kth
|
||||
* species in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
virtual void getUnitsStandardConc(double *uA, int k = 0,
|
||||
int sizeUA = 6);
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional species chemical potentials
|
||||
* These are partial molar Gibbs free energies.
|
||||
* \f$ \mu_k / \hat R T \f$.
|
||||
* Units: unitless
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT.
|
||||
*/
|
||||
virtual void getChemPotentials_RT(doublereal* mu) const;
|
||||
/**
|
||||
* Get the array of non-dimensional species chemical potentials
|
||||
* These are partial molar Gibbs free energies.
|
||||
* \f$ \mu_k / \hat R T \f$.
|
||||
* Units: unitless
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT.
|
||||
*/
|
||||
virtual void getChemPotentials_RT(doublereal* mu) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*
|
||||
* However, we assume these methods exist for inherited objects.
|
||||
* Therefore, we will bring the error routines up to this object
|
||||
*/
|
||||
/*
|
||||
* These are handled by inherited objects. At this level,
|
||||
* this pass-through routine doesn't add anything to the
|
||||
* ThermoPhase description.
|
||||
*
|
||||
* However, we assume these methods exist for inherited objects.
|
||||
* Therefore, we will bring the error routines up to this object
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the array of chemical potentials at unit activity.
|
||||
* These
|
||||
* are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$.. The values are evaluated at the current
|
||||
* temperature and pressure.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const {
|
||||
err("getStandardChemPotentials");
|
||||
}
|
||||
/**
|
||||
* Get the array of chemical potentials at unit activity.
|
||||
* These
|
||||
* are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$.. The values are evaluated at the current
|
||||
* temperature and pressure.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const {
|
||||
err("getStandardChemPotentials");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nondimensional Enthalpy functions for the species
|
||||
* at their standard states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const {
|
||||
err("getEnthalpy_RT");
|
||||
}
|
||||
/**
|
||||
* Get the nondimensional Enthalpy functions for the species
|
||||
* at their standard states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const {
|
||||
err("getEnthalpy_RT");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of nondimensional Enthalpy functions for the
|
||||
* standard state species
|
||||
* at the current <I>T</I> and <I>P</I> of the solution.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const {
|
||||
err("getEntropy_R");
|
||||
}
|
||||
/**
|
||||
* Get the array of nondimensional Enthalpy functions for the
|
||||
* standard state species
|
||||
* at the current <I>T</I> and <I>P</I> of the solution.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const {
|
||||
err("getEntropy_R");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the species
|
||||
* at their standard states of solution at the current T and P
|
||||
* of the solution.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const {
|
||||
err("getGibbs_RT");
|
||||
}
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the species
|
||||
* at their standard states of solution at the current T and P
|
||||
* of the solution.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const {
|
||||
err("getGibbs_RT");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the standard
|
||||
* state of the species at the current T and P.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const {
|
||||
err("getPureGibbs");
|
||||
}
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the standard
|
||||
* state of the species at the current T and P.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const {
|
||||
err("getPureGibbs");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* internal Energies of the standard state at the current temperature
|
||||
* and pressure of the solution for each species.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal *urt) const {
|
||||
err("getIntEnergy_RT");
|
||||
}
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* internal Energies of the standard state at the current temperature
|
||||
* and pressure of the solution for each species.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal *urt) const {
|
||||
err("getIntEnergy_RT");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nondimensional Heat Capacities at constant
|
||||
* pressure for the standard state of the species
|
||||
* at the current T and P.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const {
|
||||
err("getCp_R");
|
||||
}
|
||||
/**
|
||||
* Get the nondimensional Heat Capacities at constant
|
||||
* pressure for the standard state of the species
|
||||
* at the current T and P.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const {
|
||||
err("getCp_R");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the molar volumes of each species in their standard
|
||||
* states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
* units = m^3 / kmol
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal *vol) const {
|
||||
err("getStandardVolumes");
|
||||
}
|
||||
/**
|
||||
* Get the molar volumes of each species in their standard
|
||||
* states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
* units = m^3 / kmol
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal *vol) const {
|
||||
err("getStandardVolumes");
|
||||
}
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States --------------------
|
||||
//@{
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States --------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal *grt) const;
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal *grt) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of the
|
||||
* gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal *g) const;
|
||||
/**
|
||||
* Returns the vector of the
|
||||
* gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal *g) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal *er) const;
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal *er) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for the species.
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal *cprt) const;
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for the species.
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal *cprt) const;
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Chemical equilibrium.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Chemical equilibrium.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
* file importCTML.cpp when processing a phase definition in
|
||||
* an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
||||
/**
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
* file importCTML.cpp when processing a phase definition in
|
||||
* an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical state properties.
|
||||
/// These methods are only implemented by some subclasses.
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical state properties.
|
||||
/// These methods are only implemented by some subclasses.
|
||||
|
||||
//@{
|
||||
//@{
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/// @name Saturation properties.
|
||||
/// These methods are only implemented by subclasses that
|
||||
/// implement full liquid-vapor equations of state.
|
||||
///
|
||||
/// @name Saturation properties.
|
||||
/// These methods are only implemented by subclasses that
|
||||
/// implement full liquid-vapor equations of state.
|
||||
///
|
||||
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
/**
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
/**
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, string id);
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
private:
|
||||
void initLengths();
|
||||
private:
|
||||
void initLengths();
|
||||
|
||||
protected:
|
||||
/*
|
||||
* The last temperature at which the reference thermodynamic
|
||||
* properties were calculated at.
|
||||
*/
|
||||
mutable doublereal m_tlast;
|
||||
/**
|
||||
* Vector containing the species reference enthalpies at T = m_tlast
|
||||
*/
|
||||
mutable vector_fp m_h0_RT;
|
||||
protected:
|
||||
/*
|
||||
* The last temperature at which the reference thermodynamic
|
||||
* properties were calculated at.
|
||||
*/
|
||||
mutable doublereal m_tlast;
|
||||
/*
|
||||
* The last pressure at which the Standard State thermodynamic
|
||||
* properties were calculated at.
|
||||
*/
|
||||
mutable doublereal m_plast;
|
||||
/**
|
||||
* Vector containing the species reference enthalpies at T = m_tlast
|
||||
* and P = p_ref.
|
||||
*/
|
||||
mutable vector_fp m_h0_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference constant pressure
|
||||
* heat capacities at T = m_tlast
|
||||
*/
|
||||
mutable vector_fp m_cp0_R;
|
||||
/**
|
||||
* Vector containing the species reference constant pressure
|
||||
* heat capacities at T = m_tlast and P = p_ref.
|
||||
*/
|
||||
mutable vector_fp m_cp0_R;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference Gibbs functions
|
||||
* at T = m_tlast
|
||||
*/
|
||||
mutable vector_fp m_g0_RT;
|
||||
/**
|
||||
* Vector containing the species reference Gibbs functions
|
||||
* at T = m_tlast and P = p_ref.
|
||||
*/
|
||||
mutable vector_fp m_g0_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference entropies
|
||||
* at T = m_tlast and P = p_ref.
|
||||
*/
|
||||
mutable vector_fp m_s0_R;
|
||||
|
||||
/**
|
||||
* Vector containing the species Standard State enthalpies at T = m_tlast
|
||||
* and P = m_plast.
|
||||
*/
|
||||
mutable vector_fp m_hss_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species Standard State constant pressure
|
||||
* heat capacities at T = m_tlast and P = m_plast.
|
||||
*/
|
||||
mutable vector_fp m_cpss_R;
|
||||
|
||||
/**
|
||||
* Vector containing the species Standard State Gibbs functions
|
||||
* at T = m_tlast and P = m_plast.
|
||||
*/
|
||||
mutable vector_fp m_gss_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species Standard State entropies
|
||||
* at T = m_tlast and P = m_plast.
|
||||
*/
|
||||
mutable vector_fp m_sss_R;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference entropies
|
||||
* at T = m_tlast
|
||||
*/
|
||||
mutable vector_fp m_s0_R;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
/**
|
||||
* VPStandardStateTP has its own err routine
|
||||
*
|
||||
*/
|
||||
doublereal err(string msg) const;
|
||||
/**
|
||||
* VPStandardStateTP has its own err routine
|
||||
*
|
||||
*/
|
||||
doublereal err(std::string msg) const;
|
||||
|
||||
/**
|
||||
* This function gets called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the reference thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
* If the temperature has changed, the species thermo manager is called
|
||||
* to recalculate G, Cp, H, and S at the current temperature.
|
||||
*/
|
||||
void _updateRefStateThermo() const;
|
||||
|
||||
/**
|
||||
* void _updateStandardStateThermo() (private, const)
|
||||
*
|
||||
* This function gets called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the ss thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
*/
|
||||
void _updateStandardStateThermo() const;
|
||||
|
||||
/**
|
||||
* This function gets called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the reference thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
* If the temperature has changed, the species thermo manager is called
|
||||
* to recalculate G, Cp, H, and S at the current temperature.
|
||||
*/
|
||||
void _updateRefStateThermo() const;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -456,3 +498,4 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,12 @@ namespace Cantera {
|
|||
m_allowGasPhase(false)
|
||||
{
|
||||
constructPDSS(tp, spindex);
|
||||
m_spthermo = 0;
|
||||
}
|
||||
|
||||
|
||||
WaterPDSS::WaterPDSS(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id) :
|
||||
std::string inputFile, std::string id) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_iState(-1),
|
||||
|
|
@ -50,10 +51,11 @@ namespace Cantera {
|
|||
m_allowGasPhase(false)
|
||||
{
|
||||
constructPDSSFile(tp, spindex, inputFile, id);
|
||||
m_spthermo = 0;
|
||||
}
|
||||
|
||||
WaterPDSS::WaterPDSS(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseRoot, string id) :
|
||||
XML_Node& phaseRoot, std::string id) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_iState(-1),
|
||||
|
|
@ -64,6 +66,7 @@ namespace Cantera {
|
|||
m_allowGasPhase(false)
|
||||
{
|
||||
constructPDSSXML(tp, spindex, phaseRoot, id) ;
|
||||
m_spthermo = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -91,8 +94,12 @@ namespace Cantera {
|
|||
*/
|
||||
WaterPDSS& WaterPDSS::operator=(const WaterPDSS&b) {
|
||||
if (&b == this) return *this;
|
||||
m_sub->operator=(*(b.m_sub));
|
||||
/*
|
||||
* Call the base class operator
|
||||
*/
|
||||
PDSS::operator=(b);
|
||||
|
||||
m_sub->operator=(*(b.m_sub));
|
||||
m_verbose = b.m_verbose;
|
||||
m_allowGasPhase = b.m_allowGasPhase;
|
||||
return *this;
|
||||
|
|
@ -123,7 +130,7 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void WaterPDSS::constructPDSSXML(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseNode, string id) {
|
||||
XML_Node& phaseNode, std::string id) {
|
||||
initThermo();
|
||||
}
|
||||
|
||||
|
|
@ -144,14 +151,14 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void WaterPDSS::constructPDSSFile(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id) {
|
||||
std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("WaterTp::initThermo",
|
||||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
std::string path = findInputFile(inputFile);
|
||||
std::ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("WaterPDSS::initThermo","could not open "
|
||||
+path+" for reading.");
|
||||
|
|
@ -174,7 +181,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void WaterPDSS::
|
||||
initThermoXML(XML_Node& phaseNode, string id) {
|
||||
initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
initThermo();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ namespace Cantera {
|
|||
WaterPDSS(const WaterPDSS &b);
|
||||
WaterPDSS& operator=(const WaterPDSS&b);
|
||||
WaterPDSS(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id = "");
|
||||
std::string inputFile, std::string id = "");
|
||||
WaterPDSS(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseRef, string id = "");
|
||||
XML_Node& phaseRef, std::string id = "");
|
||||
virtual ~WaterPDSS();
|
||||
|
||||
/**
|
||||
|
|
@ -142,10 +142,10 @@ namespace Cantera {
|
|||
|
||||
virtual void constructPDSS(ThermoPhase *tp, int spindex);
|
||||
virtual void constructPDSSFile(ThermoPhase *tp, int spindex,
|
||||
string inputFile, string id);
|
||||
std::string inputFile, std::string id);
|
||||
virtual void constructPDSSXML(ThermoPhase *tp, int spindex,
|
||||
XML_Node& phaseNode, string id);
|
||||
virtual void initThermoXML(XML_Node& eosdata, string id);
|
||||
XML_Node& phaseNode, std::string id);
|
||||
virtual void initThermoXML(XML_Node& eosdata, std::string id);
|
||||
virtual void initThermo();
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
WaterPropsIAPWS *getWater() const {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
WaterTP::WaterTP(string inputFile, string id) :
|
||||
WaterTP::WaterTP(std::string inputFile, std::string id) :
|
||||
ThermoPhase(),
|
||||
m_sub(0),
|
||||
m_subflag(0),
|
||||
|
|
@ -49,7 +49,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
WaterTP::WaterTP(XML_Node& phaseRoot, string id) :
|
||||
WaterTP::WaterTP(XML_Node& phaseRoot, std::string id) :
|
||||
ThermoPhase(),
|
||||
m_sub(0),
|
||||
m_subflag(0),
|
||||
|
|
@ -129,7 +129,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void WaterTP::constructPhaseXML(XML_Node& phaseNode, string id) {
|
||||
void WaterTP::constructPhaseXML(XML_Node& phaseNode, std::string id) {
|
||||
|
||||
/*
|
||||
* Call the Cantera importPhase() function. This will import
|
||||
|
|
@ -162,14 +162,14 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void WaterTP::constructPhaseFile(string inputFile, string id) {
|
||||
void WaterTP::constructPhaseFile(std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("WaterTp::initThermo",
|
||||
"input file is null");
|
||||
}
|
||||
string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
std::string path = findInputFile(inputFile);
|
||||
std::ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("WaterTP::initThermo","could not open "
|
||||
+path+" for reading.");
|
||||
|
|
@ -202,7 +202,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void WaterTP::
|
||||
initThermoXML(XML_Node& phaseNode, string id) {
|
||||
initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
if (m_sub) delete m_sub;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
if (m_sub == 0) {
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ namespace Cantera {
|
|||
WaterTP();
|
||||
WaterTP(const WaterTP &b);
|
||||
WaterTP& operator=(const WaterTP&b);
|
||||
WaterTP(string inputFile, string id = "");
|
||||
WaterTP(XML_Node& phaseRef, string id = "");
|
||||
WaterTP(std::string inputFile, std::string id = "");
|
||||
WaterTP(XML_Node& phaseRef, std::string id = "");
|
||||
virtual ~WaterTP();
|
||||
ThermoPhase *duplMyselfAsThermoPhase();
|
||||
|
||||
|
|
@ -143,11 +143,11 @@ namespace Cantera {
|
|||
virtual void setTemperature(double temp);
|
||||
|
||||
virtual void constructPhase();
|
||||
virtual void constructPhaseFile(string inputFile, string id);
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, string id);
|
||||
virtual void constructPhaseFile(std::string inputFile, std::string id);
|
||||
virtual void constructPhaseXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
|
||||
virtual void initThermoXML(XML_Node& eosdata, string id);
|
||||
virtual void initThermoXML(XML_Node& eosdata, std::string id);
|
||||
virtual void initThermo();
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue