Added the object PDSS_SSVol. This has more functionality than PDSS_ConstVol in that there are a range of models for fitting the standard state volume.
Removed executable flags. removed the function pdssType.
This commit is contained in:
parent
c9ff753168
commit
48261703d4
25 changed files with 907 additions and 6 deletions
0
Cantera/src/thermo/ConstDensityThermo.cpp
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.cpp
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.h
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.h
Executable file → Normal file
0
Cantera/src/thermo/Constituents.cpp
Executable file → Normal file
0
Cantera/src/thermo/Constituents.cpp
Executable file → Normal file
0
Cantera/src/thermo/Constituents.h
Executable file → Normal file
0
Cantera/src/thermo/Constituents.h
Executable file → Normal file
0
Cantera/src/thermo/NasaPoly1.h
Executable file → Normal file
0
Cantera/src/thermo/NasaPoly1.h
Executable file → Normal file
0
Cantera/src/thermo/NasaThermo.h
Executable file → Normal file
0
Cantera/src/thermo/NasaThermo.h
Executable file → Normal file
|
|
@ -99,7 +99,6 @@ namespace Cantera {
|
|||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
virtual int pdssType() const { return -1; }
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ namespace Cantera {
|
|||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
virtual int pdssType() const { return -1; }
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ namespace Cantera {
|
|||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
virtual int pdssType() const { return -1; }
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ namespace Cantera {
|
|||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
virtual int pdssType() const { return -1; }
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
|||
427
Cantera/src/thermo/PDSS_SSVol.cpp
Normal file
427
Cantera/src/thermo/PDSS_SSVol.cpp
Normal file
|
|
@ -0,0 +1,427 @@
|
|||
/**
|
||||
* @file PDSS_SSVol.cpp
|
||||
* Implementation of a pressure dependent standard state
|
||||
* virtual function.
|
||||
*/
|
||||
/*
|
||||
* Copywrite (2006) Sandia Corporation. Under the terms of
|
||||
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
|
||||
* U.S. Government retains certain rights in this software.
|
||||
*/
|
||||
/*
|
||||
* $Id: PDSS_SSVol.cpp,v 1.10 2009/01/04 06:34:20 hkmoffa Exp $
|
||||
*/
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "xml.h"
|
||||
#include "ctml.h"
|
||||
#include "PDSS_SSVol.h"
|
||||
#include "ThermoFactory.h"
|
||||
|
||||
#include "VPStandardStateTP.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
/**
|
||||
* Basic list of constructors and duplicators
|
||||
*/
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex) :
|
||||
PDSS(tp, spindex),
|
||||
volumeModel_(cSSVOLUME_CONSTANT),
|
||||
m_constMolarVolume(-1.0)
|
||||
{
|
||||
m_pdssType = cPDSS_SSVOL;
|
||||
TCoeff_[0] = 0.0;
|
||||
TCoeff_[1] = 0.0;
|
||||
TCoeff_[2] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex, std::string inputFile, std::string id) :
|
||||
PDSS(tp, spindex),
|
||||
volumeModel_(cSSVOLUME_CONSTANT),
|
||||
m_constMolarVolume(-1.0)
|
||||
{
|
||||
|
||||
m_pdssType = cPDSS_SSVOL;
|
||||
constructPDSSFile(tp, spindex, inputFile, id);
|
||||
}
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot,
|
||||
bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
volumeModel_(cSSVOLUME_CONSTANT),
|
||||
m_constMolarVolume(-1.0)
|
||||
{
|
||||
m_pdssType = cPDSS_SSVOL;
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled) ;
|
||||
}
|
||||
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol(const PDSS_SSVol &b) :
|
||||
PDSS(b),
|
||||
volumeModel_(cSSVOLUME_CONSTANT),
|
||||
m_constMolarVolume(-1.0)
|
||||
{
|
||||
/*
|
||||
* Use the assignment operator to do the brunt
|
||||
* of the work for the copy construtor.
|
||||
*/
|
||||
*this = b;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assignment operator
|
||||
*/
|
||||
PDSS_SSVol& PDSS_SSVol::operator=(const PDSS_SSVol&b) {
|
||||
if (&b == this) return *this;
|
||||
PDSS::operator=(b);
|
||||
volumeModel_ = b.volumeModel_;
|
||||
m_constMolarVolume = b.m_constMolarVolume;
|
||||
TCoeff_ = b.TCoeff_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
PDSS_SSVol::~PDSS_SSVol() {
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
PDSS* PDSS_SSVol::duplMyselfAsPDSS() const {
|
||||
PDSS_SSVol * idg = new PDSS_SSVol(*this);
|
||||
return (PDSS *) idg;
|
||||
}
|
||||
|
||||
/**
|
||||
* constructPDSSXML:
|
||||
*
|
||||
* Initialization of a PDSS_SSVol object using an
|
||||
* xml file.
|
||||
*
|
||||
* This routine is a precursor to initThermo(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
* @param infile XML file containing the description of the
|
||||
* phase
|
||||
*
|
||||
* @param id Optional parameter identifying the name of the
|
||||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_SSVol::constructPDSSXML(VPStandardStateTP *tp, int spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled) {
|
||||
PDSS::initThermo();
|
||||
SpeciesThermo &sp = m_tp->speciesThermo();
|
||||
m_p0 = sp.refPressure(m_spindex);
|
||||
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_SSVol::constructPDSSXML", "spInstalled false not handled");
|
||||
}
|
||||
|
||||
const XML_Node *ss = speciesNode.findByName("standardState");
|
||||
if (!ss) {
|
||||
throw CanteraError("PDSS_SSVol::constructPDSSXML",
|
||||
"no standardState Node for species " + speciesNode.name());
|
||||
}
|
||||
std::string model = (*ss)["model"];
|
||||
if (model == "constant_incompressible" || model == "constant") {
|
||||
volumeModel_ = cSSVOLUME_CONSTANT;
|
||||
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
|
||||
} else if (model == "temperature_polynomial") {
|
||||
volumeModel_ = cSSVOLUME_TPOLY;
|
||||
getFloatArray(*ss, TCoeff_, true, "", "floatArray");
|
||||
} else if (model == "density_temperature_polynomial") {
|
||||
volumeModel_ = cSSVOLUME_DENSITY_TPOLY;
|
||||
getFloatArray(*ss, TCoeff_, true, "", "floatArray");
|
||||
} else {
|
||||
throw CanteraError("PDSS_SSVol::initThermoXML",
|
||||
"standardState model for species isn't constant_incompressible: " + speciesNode.name());
|
||||
}
|
||||
std::string id = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* constructPDSSFile():
|
||||
*
|
||||
* Initialization of a PDSS_SSVol object using an
|
||||
* xml file.
|
||||
*
|
||||
* This routine is a precursor to initThermo(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
* @param infile XML file containing the description of the
|
||||
* phase
|
||||
*
|
||||
* @param id Optional parameter identifying the name of the
|
||||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_SSVol::constructPDSSFile(VPStandardStateTP *tp, int spindex,
|
||||
std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("PDSS_SSVol::initThermo",
|
||||
"input file is null");
|
||||
}
|
||||
std::string path = findInputFile(inputFile);
|
||||
ifstream fin(path.c_str());
|
||||
if (!fin) {
|
||||
throw CanteraError("PDSS_SSVol::initThermo","could not open "
|
||||
+path+" for reading.");
|
||||
}
|
||||
/*
|
||||
* The phase object automatically constructs an XML object.
|
||||
* Use this object to store information.
|
||||
*/
|
||||
|
||||
XML_Node *fxml = new XML_Node();
|
||||
fxml->build(fin);
|
||||
XML_Node *fxml_phase = findXMLPhase(fxml, id);
|
||||
if (!fxml_phase) {
|
||||
throw CanteraError("PDSS_SSVol::initThermo",
|
||||
"ERROR: Can not find phase named " +
|
||||
id + " in file named " + inputFile);
|
||||
}
|
||||
|
||||
XML_Node& speciesList = fxml_phase->child("speciesArray");
|
||||
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
|
||||
&(fxml_phase->root()));
|
||||
const vector<string>&sss = tp->speciesNames();
|
||||
const XML_Node* s = speciesDB->findByAttr("name", sss[spindex]);
|
||||
|
||||
constructPDSSXML(tp, spindex, *s, *fxml_phase, true);
|
||||
delete fxml;
|
||||
}
|
||||
|
||||
void PDSS_SSVol::initThermoXML(const XML_Node& phaseNode, std::string& id) {
|
||||
PDSS::initThermoXML(phaseNode, id);
|
||||
m_minTemp = m_spthermo->minTemp(m_spindex);
|
||||
m_maxTemp = m_spthermo->maxTemp(m_spindex);
|
||||
m_p0 = m_spthermo->refPressure(m_spindex);
|
||||
m_mw = m_tp->molecularWeight(m_spindex);
|
||||
}
|
||||
|
||||
void PDSS_SSVol::initThermo() {
|
||||
PDSS::initThermo();
|
||||
SpeciesThermo &sp = m_tp->speciesThermo();
|
||||
m_p0 = sp.refPressure(m_spindex);
|
||||
m_V0_ptr[m_spindex] = m_constMolarVolume;
|
||||
m_Vss_ptr[m_spindex] = m_constMolarVolume;
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::enthalpy_mole() const {
|
||||
doublereal val = enthalpy_RT();
|
||||
doublereal RT = GasConstant * m_temp;
|
||||
return (val * RT);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::enthalpy_RT() const {
|
||||
doublereal val = m_hss_RT_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::intEnergy_mole() const {
|
||||
doublereal pVRT = (m_pres * m_Vss_ptr[m_spindex]) / (GasConstant * m_temp);
|
||||
doublereal val = m_h0_RT_ptr[m_spindex] - pVRT;
|
||||
doublereal RT = GasConstant * m_temp;
|
||||
return (val * RT);
|
||||
}
|
||||
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::entropy_mole() const {
|
||||
doublereal val = entropy_R();
|
||||
return (val * GasConstant);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::entropy_R() const {
|
||||
doublereal val = m_sss_R_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the Gibbs free energy in mks units of
|
||||
* J kmol-1 K-1.
|
||||
*/
|
||||
doublereal
|
||||
PDSS_SSVol::gibbs_mole() const {
|
||||
doublereal val = gibbs_RT();
|
||||
doublereal RT = GasConstant * m_temp;
|
||||
return (val * RT);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::gibbs_RT() const {
|
||||
doublereal val = m_gss_RT_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::cp_mole() const {
|
||||
doublereal val = m_cpss_R_ptr[m_spindex];
|
||||
return (val * GasConstant);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::cp_R() const {
|
||||
doublereal val = m_cpss_R_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::cv_mole() const {
|
||||
doublereal val = (cp_mole() - m_V0_ptr[m_spindex]);
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::molarVolume() const {
|
||||
doublereal val = m_Vss_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::density() const {
|
||||
doublereal val = m_Vss_ptr[m_spindex];
|
||||
return (m_mw/val);
|
||||
}
|
||||
|
||||
doublereal
|
||||
PDSS_SSVol::gibbs_RT_ref() const {
|
||||
doublereal val = m_g0_RT_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::enthalpy_RT_ref() const {
|
||||
doublereal val = m_h0_RT_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::entropy_R_ref() const {
|
||||
doublereal val = m_s0_R_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::cp_R_ref() const {
|
||||
doublereal val = m_cp0_R_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
doublereal PDSS_SSVol::molarVolume_ref() const {
|
||||
doublereal val = m_V0_ptr[m_spindex];
|
||||
return (val);
|
||||
}
|
||||
|
||||
void PDSS_SSVol::calcMolarVolume() const {
|
||||
if (volumeModel_ == cSSVOLUME_CONSTANT ) {
|
||||
m_Vss_ptr[m_spindex] = m_constMolarVolume;
|
||||
} else if (volumeModel_ == cSSVOLUME_TPOLY) {
|
||||
m_Vss_ptr[m_spindex] = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * TCoeff_[2]);
|
||||
dVdT_ = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2];
|
||||
d2VdT2_ = 2.0 * TCoeff_[2];
|
||||
} else if (volumeModel_ == cSSVOLUME_DENSITY_TPOLY) {
|
||||
doublereal dens = (TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * TCoeff_[2]));
|
||||
m_Vss_ptr[m_spindex] = m_mw / dens;
|
||||
doublereal dens2 = dens * dens;
|
||||
doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2];
|
||||
doublereal d2densdT2 = 2.0 * TCoeff_[2];
|
||||
dVdT_ = - m_mw / (dens2) * (ddensdT);
|
||||
d2VdT2_ = 2.0 * m_mw / (dens2 * dens) * ddensdT * ddensdT - m_mw / dens2 * d2densdT2;
|
||||
} else {
|
||||
throw CanteraError("PDSS_SSVol::calcMolarVolume", "unimplemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// critical temperature
|
||||
doublereal PDSS_SSVol::critTemperature() const {
|
||||
throw CanteraError("PDSS_SSVol::critTemperature()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical pressure
|
||||
doublereal PDSS_SSVol::critPressure() const {
|
||||
throw CanteraError("PDSS_SSVol::critPressure()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical density
|
||||
doublereal PDSS_SSVol::critDensity() const {
|
||||
throw CanteraError("PDSS_SSVol::critDensity()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PDSS_SSVol::setPressure(doublereal p) {
|
||||
m_pres = p;
|
||||
doublereal deltaP = m_pres - m_p0;
|
||||
if (fabs(deltaP) < 1.0E-10) {
|
||||
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex];
|
||||
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex];
|
||||
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
|
||||
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
|
||||
} else {
|
||||
doublereal del_pRT = deltaP / (GasConstant * m_temp);
|
||||
doublereal sV_term = - deltaP / (GasConstant) * dVdT_;
|
||||
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]);
|
||||
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
|
||||
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
|
||||
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;
|
||||
}
|
||||
}
|
||||
|
||||
void PDSS_SSVol::setTemperature(doublereal temp) {
|
||||
m_temp = temp;
|
||||
m_spthermo->update_one(m_spindex, temp, m_cp0_R_ptr, m_h0_RT_ptr, m_s0_R_ptr);
|
||||
calcMolarVolume();
|
||||
m_g0_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] - m_s0_R_ptr[m_spindex];
|
||||
doublereal deltaP = m_pres - m_p0;
|
||||
if (fabs(deltaP) < 1.0E-10) {
|
||||
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex];
|
||||
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex];
|
||||
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
|
||||
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
|
||||
} else {
|
||||
doublereal del_pRT = deltaP / (GasConstant * m_temp);
|
||||
doublereal sV_term = - deltaP / (GasConstant) * dVdT_;
|
||||
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]);
|
||||
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
|
||||
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
|
||||
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDSS_SSVol::setState_TP(doublereal temp, doublereal pres) {
|
||||
m_pres = pres;
|
||||
setTemperature(temp);
|
||||
}
|
||||
|
||||
|
||||
void PDSS_SSVol::setState_TR(doublereal temp, doublereal rho) {
|
||||
doublereal rhoStored = m_mw / m_constMolarVolume;
|
||||
if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) {
|
||||
throw CanteraError("PDSS_SSVol::setState_TR",
|
||||
"Inconsistent supplied rho");
|
||||
}
|
||||
setTemperature(temp);
|
||||
}
|
||||
|
||||
/// saturation pressure
|
||||
doublereal PDSS_SSVol::satPressure(doublereal t){
|
||||
return (1.0E-200);
|
||||
}
|
||||
|
||||
}
|
||||
452
Cantera/src/thermo/PDSS_SSVol.h
Normal file
452
Cantera/src/thermo/PDSS_SSVol.h
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
/**
|
||||
* @file PDSS_SSVol.h
|
||||
* Declarations for the class PDSS_SSVol (pressure dependent standard state)
|
||||
* which handles calculations for a single species with an expression for the molar volume in a phase
|
||||
* given by an enumerated data type
|
||||
* (see class \ref pdssthermo and \link Cantera::PDSS_SSVol PDSS_SSVol\endlink).
|
||||
*/
|
||||
/*
|
||||
* Copywrite (2006) Sandia Corporation. Under the terms of
|
||||
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
|
||||
* U.S. Government retains certain rights in this software.
|
||||
*/
|
||||
/*
|
||||
* $Id: PDSS_SSVol.h,v 1.6 2008/10/13 21:01:48 hkmoffa Exp $
|
||||
*/
|
||||
|
||||
#ifndef CT_PDSS_SSVOL_H
|
||||
#define CT_PDSS_SSVOL_H
|
||||
|
||||
#include "PDSS.h"
|
||||
|
||||
namespace Cantera {
|
||||
class XML_Node;
|
||||
class VPStandardStateTP;
|
||||
|
||||
//! Class for pressure dependent standard states that use a constant volume model
|
||||
/*!
|
||||
* Class for pressure dependent standard states that use a constant volume model.
|
||||
*
|
||||
*
|
||||
* @ingroup pdssthermo
|
||||
*/
|
||||
class PDSS_SSVol : public PDSS {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @name Constructors
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_SSVol(VPStandardStateTP *tp, int spindex);
|
||||
|
||||
|
||||
//! Constructor that initializes the object by examining the input file
|
||||
//! of the ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSSFile member function.
|
||||
*
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
* @param inputFile String name of the input file
|
||||
* @param id String name of the phase in the input file. The default
|
||||
* is the empty string, in which case the first phase in the
|
||||
* file is used.
|
||||
*/
|
||||
PDSS_SSVol(VPStandardStateTP *tp, int spindex,
|
||||
std::string inputFile, std::string id = "");
|
||||
|
||||
//! Constructor that initializes the object by examining the input file
|
||||
//! of the ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSSXML member function.
|
||||
*
|
||||
* @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
* @param speciesNode Reference to the species XML tree.
|
||||
* @param phaseRef Reference to the XML tree containing the phase information.
|
||||
* @param spInstalled Boolean indicating whether the species is installed yet
|
||||
* or not.
|
||||
*/
|
||||
PDSS_SSVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! Copy Constructur
|
||||
/*!
|
||||
* @param b Object to be copied
|
||||
*/
|
||||
PDSS_SSVol(const PDSS_SSVol &b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b Object to be copeid
|
||||
*/
|
||||
PDSS_SSVol& operator=(const PDSS_SSVol&b);
|
||||
|
||||
//! Destructor
|
||||
virtual ~PDSS_SSVol();
|
||||
|
||||
//! Duplicator
|
||||
virtual PDSS *duplMyselfAsPDSS() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Species Standard State
|
||||
* in the Solution
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Return the molar enthalpy in units of J kmol-1
|
||||
/*!
|
||||
* Returns the species standard state enthalpy in J kmol-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state enthalpy in J kmol-1
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
//! Return the standard state molar enthalpy divided by RT
|
||||
/*!
|
||||
* Returns the species standard state enthalpy divided by RT at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state enthalpy in unitless form
|
||||
*/
|
||||
virtual doublereal enthalpy_RT() const;
|
||||
|
||||
//! Return the molar internal Energy in units of J kmol-1
|
||||
/*!
|
||||
* Returns the species standard state internal Energy in J kmol-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state internal Energy in J kmol-1
|
||||
*/
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
//! Return the molar entropy in units of J kmol-1 K-1
|
||||
/*!
|
||||
* Returns the species standard state entropy in J kmol-1 K-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state entropy in J kmol-1 K-1
|
||||
*/
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
//! Return the standard state entropy divided by RT
|
||||
/*!
|
||||
* Returns the species standard state entropy divided by RT at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state entropy divided by RT
|
||||
*/
|
||||
virtual doublereal entropy_R() const;
|
||||
|
||||
//! Return the molar gibbs free energy in units of J kmol-1
|
||||
/*!
|
||||
* Returns the species standard state gibbs free energy in J kmol-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state gibbs free energy in J kmol-1
|
||||
*/
|
||||
virtual doublereal gibbs_mole() const;
|
||||
|
||||
//! Return the molar gibbs free energy divided by RT
|
||||
/*!
|
||||
* Returns the species standard state gibbs free energy divided by RT at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state gibbs free energy divided by RT
|
||||
*/
|
||||
virtual doublereal gibbs_RT() const;
|
||||
|
||||
//! Return the molar const pressure heat capacity in units of J kmol-1 K-1
|
||||
/*!
|
||||
* Returns the species standard state Cp in J kmol-1 K-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state Cp in J kmol-1 K-1
|
||||
*/
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
//! Return the molar const pressure heat capacity divided by RT
|
||||
/*!
|
||||
* Returns the species standard state Cp divided by RT at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state Cp divided by RT
|
||||
*/
|
||||
virtual doublereal cp_R() const;
|
||||
|
||||
//! Return the molar const volume heat capacity in units of J kmol-1 K-1
|
||||
/*!
|
||||
* Returns the species standard state Cv in J kmol-1 K-1 at the
|
||||
* current temperature and pressure.
|
||||
*
|
||||
* @return returns the species standard state Cv in J kmol-1 K-1
|
||||
*/
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//! Return the molar volume at standard state
|
||||
/*!
|
||||
* Returns the species standard state molar volume at the
|
||||
* current temperature and pressure
|
||||
*
|
||||
* @return returns the standard state molar volume divided by R
|
||||
* units are m**3 kmol-1.
|
||||
*/
|
||||
virtual doublereal molarVolume() const;
|
||||
|
||||
//! Return the standard state density at standard state
|
||||
/*!
|
||||
* Returns the species standard state density at the
|
||||
* current temperature and pressure
|
||||
*
|
||||
* @return returns the standard state density
|
||||
* units are kg m-3
|
||||
*/
|
||||
virtual doublereal density() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Properties of the Reference State of the Species
|
||||
* in the Solution
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Return the molar gibbs free energy divided by RT at reference pressure
|
||||
/*!
|
||||
* Returns the species reference state gibbs free energy divided by RT at the
|
||||
* current temperature.
|
||||
*
|
||||
* @return returns the reference state gibbs free energy divided by RT
|
||||
*/
|
||||
virtual doublereal gibbs_RT_ref() const;
|
||||
|
||||
//! Return the molar enthalpy divided by RT at reference pressure
|
||||
/*!
|
||||
* Returns the species reference state enthalpy divided by RT at the
|
||||
* current temperature.
|
||||
*
|
||||
* @return returns the reference state enthalpy divided by RT
|
||||
*/
|
||||
virtual doublereal enthalpy_RT_ref() const;
|
||||
|
||||
//! Return the molar entropy divided by R at reference pressure
|
||||
/*!
|
||||
* Returns the species reference state entropy divided by R at the
|
||||
* current temperature.
|
||||
*
|
||||
* @return returns the reference state entropy divided by R
|
||||
*/
|
||||
virtual doublereal entropy_R_ref() const;
|
||||
|
||||
//! Return the molar heat capacity divided by R at reference pressure
|
||||
/*!
|
||||
* Returns the species reference state heat capacity divided by R at the
|
||||
* current temperature.
|
||||
*
|
||||
* @return returns the reference state heat capacity divided by R
|
||||
*/
|
||||
virtual doublereal cp_R_ref() const;
|
||||
|
||||
//! Return the molar volume at reference pressure
|
||||
/*!
|
||||
* Returns the species reference state molar volume at the
|
||||
* current temperature.
|
||||
*
|
||||
* @return returns the reference state molar volume divided by R
|
||||
* units are m**3 kmol-1.
|
||||
*/
|
||||
virtual doublereal molarVolume_ref() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Does the internal calculation of the volume
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
void calcMolarVolume() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Equation of State Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Sets the pressure in the object
|
||||
/*!
|
||||
* Currently, this sets the pressure in the PDSS object.
|
||||
* It is indeterminant what happens to the owning VPStandardStateTP
|
||||
* object and to the VPSSMgr object.
|
||||
*
|
||||
* @param pres Pressure to be set (Pascal)
|
||||
*/
|
||||
virtual void setPressure(doublereal pres);
|
||||
|
||||
//! Set the internal temperature
|
||||
/*!
|
||||
* @param temp Temperature (Kelvin)
|
||||
*/
|
||||
virtual void setTemperature(doublereal temp);
|
||||
|
||||
//! Set the internal temperature and pressure
|
||||
/*!
|
||||
* @param temp Temperature (Kelvin)
|
||||
* @param pres pressure (Pascals)
|
||||
*/
|
||||
virtual void setState_TP(doublereal temp, doublereal pres);
|
||||
|
||||
|
||||
//! Set the internal temperature and density
|
||||
/*!
|
||||
* @param temp Temperature (Kelvin)
|
||||
* @param rho Density (kg m-3)
|
||||
*/
|
||||
virtual void setState_TR(doublereal temp, doublereal rho);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Miscellaneous properties of the standard state
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// critical temperature
|
||||
virtual doublereal critTemperature() const;
|
||||
|
||||
/// critical pressure
|
||||
virtual doublereal critPressure() const;
|
||||
|
||||
/// critical density
|
||||
virtual doublereal critDensity() const;
|
||||
|
||||
/// saturation pressure
|
||||
/*!
|
||||
* @param t Temperature (kelvin)
|
||||
*/
|
||||
virtual doublereal satPressure(doublereal t);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Initialization of the Object
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Initialization routine for all of the shallow pointers
|
||||
/*!
|
||||
* This is a cascading call, where each level should call the
|
||||
* the parent level.
|
||||
*
|
||||
* The initThermo() routines get called before the initThermoXML() routines
|
||||
* from the constructPDSSXML() routine.
|
||||
*
|
||||
*
|
||||
* Calls initPtrs();
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Initialization of a PDSS object using an
|
||||
//! input XML file.
|
||||
/*!
|
||||
*
|
||||
* This routine is a precursor to constructPDSSXML(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
* @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
|
||||
* This object must have already been malloced.
|
||||
*
|
||||
* @param spindex Species index within the phase
|
||||
*
|
||||
* @param inputFile XML file containing the description of the
|
||||
* phase
|
||||
*
|
||||
* @param id Optional parameter identifying the name of the
|
||||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex,
|
||||
std::string inputFile, std::string id);
|
||||
|
||||
//! Initialization of a PDSS object using an xml tree
|
||||
/*!
|
||||
* This routine is a driver for the initialization of the
|
||||
* object.
|
||||
*
|
||||
* basic logic:
|
||||
* initThermo() (cascade)
|
||||
* getStuff from species Part of XML file
|
||||
* initThermoXML(phaseNode) (cascade)
|
||||
*
|
||||
* @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
|
||||
* This object must have already been malloced.
|
||||
*
|
||||
* @param spindex Species index within the phase
|
||||
*
|
||||
* @param speciesNode XML Node containing the species information
|
||||
*
|
||||
* @param phaseNode Reference to the phase Information for the phase
|
||||
* that owns this species.
|
||||
*
|
||||
* @param spInstalled Boolean indicating whether the species is
|
||||
* already installed.
|
||||
*/
|
||||
void constructPDSSXML(VPStandardStateTP *vptp_ptr, int spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled);
|
||||
|
||||
//! Initialization routine for the PDSS object based on the phaseNode
|
||||
/*!
|
||||
* This is a cascading call, where each level should call the
|
||||
* the parent level.
|
||||
*
|
||||
* @param phaseNode Reference to the phase Information for the phase
|
||||
* that owns this species.
|
||||
*
|
||||
* @param id Optional parameter identifying the name of the
|
||||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
//! Enumerated data type describing the type of volume model
|
||||
//! used to calculate the standard state volume of the species
|
||||
SSVolume_Model_enumType volumeModel_;
|
||||
|
||||
//! Value of the constant molar volume for the species
|
||||
/*!
|
||||
* m3 / kmol
|
||||
*/
|
||||
doublereal m_constMolarVolume;
|
||||
|
||||
//! coefficients for the temperature representation
|
||||
vector_fp TCoeff_;
|
||||
|
||||
//! Derivative of the volume wrt temperature
|
||||
mutable doublereal dVdT_;
|
||||
|
||||
//! 2nd derivative of the volume wrt temperature
|
||||
mutable doublereal d2VdT2_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
0
Cantera/src/thermo/Phase.cpp
Executable file → Normal file
0
Cantera/src/thermo/Phase.cpp
Executable file → Normal file
0
Cantera/src/thermo/Phase.h
Executable file → Normal file
0
Cantera/src/thermo/Phase.h
Executable file → Normal file
0
Cantera/src/thermo/ShomatePoly.h
Executable file → Normal file
0
Cantera/src/thermo/ShomatePoly.h
Executable file → Normal file
0
Cantera/src/thermo/ShomateThermo.h
Executable file → Normal file
0
Cantera/src/thermo/ShomateThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.cpp
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.cpp
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoMgr.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoMgr.h
Executable file → Normal file
0
Cantera/src/thermo/State.h
Executable file → Normal file
0
Cantera/src/thermo/State.h
Executable file → Normal file
0
Cantera/src/thermo/ThermoPhase.h
Executable file → Normal file
0
Cantera/src/thermo/ThermoPhase.h
Executable file → Normal file
|
|
@ -30,6 +30,7 @@
|
|||
#include "PDSS_IdealGas.h"
|
||||
#include "PDSS_Water.h"
|
||||
#include "PDSS_ConstVol.h"
|
||||
#include "PDSS_SSVol.h"
|
||||
#include "PDSS_HKFT.h"
|
||||
#include "PDSS_IonsFromNeutral.h"
|
||||
#include "GeneralSpeciesThermo.h"
|
||||
|
|
@ -159,6 +160,9 @@ namespace Cantera {
|
|||
if (model == "constant_incompressible") {
|
||||
VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr);
|
||||
kPDSS = new PDSS_ConstVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true);
|
||||
if (!kPDSS) {
|
||||
throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "new PDSS_ConstVol failed");
|
||||
}
|
||||
} else if (model == "waterIAPWS" || model == "waterPDSS") {
|
||||
// VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr);
|
||||
kPDSS = new PDSS_Water(m_vptp_ptr, 0);
|
||||
|
|
@ -190,6 +194,12 @@ namespace Cantera {
|
|||
}
|
||||
genSpthermo->installPDSShandler(k, kPDSS, this);
|
||||
|
||||
} else if (model == "constant" || model == "temperature_polynomial" || model == "density_temperature_polynomial") {
|
||||
VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr);
|
||||
kPDSS = new PDSS_SSVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true);
|
||||
if (!kPDSS) {
|
||||
throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "new PDSS_SSVol failed");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("VPSSMgr_General::returnPDSS_ptr",
|
||||
"unknown standard state formulation: " + model);
|
||||
|
|
|
|||
18
Cantera/src/thermo/mix_defs.h
Executable file → Normal file
18
Cantera/src/thermo/mix_defs.h
Executable file → Normal file
|
|
@ -83,11 +83,29 @@ namespace Cantera {
|
|||
const int cVPSS_DebyeHuckel = 1050;
|
||||
const int cVPSS_MolalSoln = 1060;
|
||||
|
||||
//! Types of general formulations for the specification of the standard state volume
|
||||
enum SSVolume_Model_enumType {
|
||||
//! This approximation is for a constant volume
|
||||
cSSVOLUME_CONSTANT = 0,
|
||||
//! This approximation is for a species with a quadratic polynomial in temperature
|
||||
/*!
|
||||
* V^ss_i = ai + bi T + ci T2
|
||||
*/
|
||||
cSSVOLUME_TPOLY,
|
||||
//! This approximation is for a species where the density is expressed as a
|
||||
//! quadratic polynomial in temperature
|
||||
/*!
|
||||
* V^ss_i = M_i / (ai + bi T + ci T2)
|
||||
*/
|
||||
cSSVOLUME_DENSITY_TPOLY
|
||||
};
|
||||
|
||||
//! Types of PDSS's
|
||||
enum PDSS_enumType {
|
||||
cPDSS_UNDEF = 100,
|
||||
cPDSS_IDEALGAS,
|
||||
cPDSS_CONSTVOL,
|
||||
cPDSS_SSVOL,
|
||||
cPDSS_MOLAL_CONSTVOL,
|
||||
cPDSS_WATER,
|
||||
cPDSS_MOLAL_HKFT,
|
||||
|
|
|
|||
0
Cantera/src/thermo/speciesThermoTypes.h
Executable file → Normal file
0
Cantera/src/thermo/speciesThermoTypes.h
Executable file → Normal file
Loading…
Add table
Reference in a new issue