[Thermo] Refactor construction of PDSS objects
Introduce a default constructor for PDSS objects, and avoid passing in unnecesary arguments to initialization functions.
This commit is contained in:
parent
ff46dc93b5
commit
04cac2b277
17 changed files with 149 additions and 650 deletions
|
|
@ -128,6 +128,7 @@ namespace Cantera
|
|||
|
||||
class XML_Node;
|
||||
class MultiSpeciesThermo;
|
||||
class SpeciesThermoInterpType;
|
||||
class VPStandardStateTP;
|
||||
|
||||
//! Virtual base class for a species with a pressure dependent standard state
|
||||
|
|
@ -168,19 +169,9 @@ public:
|
|||
//! @name Constructors
|
||||
//! @{
|
||||
|
||||
//! Empty Constructor
|
||||
//! Default Constructor
|
||||
PDSS();
|
||||
|
||||
//! Constructor that initializes the object by examining the XML entries
|
||||
//! from the ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSS member function.
|
||||
*
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS(VPStandardStateTP* tp, size_t spindex);
|
||||
|
||||
// PDSS objects are not copyable or assignable
|
||||
PDSS(const PDSS& b) = delete;
|
||||
PDSS& operator=(const PDSS& b) = delete;
|
||||
|
|
@ -433,35 +424,45 @@ public:
|
|||
//! @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();
|
||||
//! Set the SpeciesThermoInterpType object used to calculate reference
|
||||
//! state properties
|
||||
void setReferenceThermo(shared_ptr<SpeciesThermoInterpType> stit) {
|
||||
m_spthermo = stit;
|
||||
}
|
||||
|
||||
//! Initialization routine for the PDSS object based on the phaseNode
|
||||
//! Returns 'true' if this object should be used in an STITbyPDSS object
|
||||
//! in the phase's reference thermo manager, or 'false' if a separate
|
||||
//! SpeciesThermoInterpType should be constructed
|
||||
virtual bool useSTITbyPDSS() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Set the parent VPStandardStateTP object of this PDSS object
|
||||
/*!
|
||||
* This information is only used by certain PDSS subclasses
|
||||
* @param phase Pointer to the parent phase
|
||||
* @param k Index of this species in the phase
|
||||
*/
|
||||
virtual void setParent(VPStandardStateTP* phase, size_t k) {}
|
||||
|
||||
//! Initialization routine
|
||||
/*!
|
||||
* 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, const std::string& id);
|
||||
virtual void initThermo() {}
|
||||
|
||||
//! Initialization routine for the PDSS object based on the speciesNode
|
||||
/*!
|
||||
* This is a cascading call, where each level should call the the parent
|
||||
* level. This function is called before initThermo()
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& speciesNode) {}
|
||||
|
||||
//! This utility function reports back the type of parameterization and
|
||||
//! all of the parameters for the species, index.
|
||||
/*!
|
||||
* @param kindex Species index
|
||||
* @param kindex Species index (unused)
|
||||
* @param type Integer type of the standard type (unused)
|
||||
* @param c Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
|
|
@ -491,28 +492,12 @@ protected:
|
|||
//! Maximum temperature
|
||||
doublereal m_maxTemp;
|
||||
|
||||
//! ThermoPhase which this species belongs to.
|
||||
/*!
|
||||
* Note, in some applications (i.e., mostly testing applications, this may
|
||||
* be a null value. Applications should test whether this is null before
|
||||
* usage.
|
||||
*/
|
||||
VPStandardStateTP* m_tp;
|
||||
|
||||
//! Molecular Weight of the species
|
||||
doublereal m_mw;
|
||||
|
||||
//! Species index in the ThermoPhase corresponding to this species.
|
||||
size_t m_spindex;
|
||||
|
||||
//! 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 MultiSpeciesThermo object
|
||||
* doesn't know or doesn't control the calculation, this will be set to
|
||||
* zero.
|
||||
*/
|
||||
MultiSpeciesThermo* m_spthermo;
|
||||
//! Pointer to the species thermodynamic property manager. Not used in all
|
||||
//! PDSS models.
|
||||
shared_ptr<SpeciesThermoInterpType> m_spthermo;
|
||||
};
|
||||
|
||||
//! Base class for PDSS classes which compute molar properties directly
|
||||
|
|
|
|||
|
|
@ -22,32 +22,9 @@ namespace Cantera
|
|||
class PDSS_ConstVol : public PDSS_Nondimensional
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
//! Default Constructor
|
||||
PDSS_ConstVol();
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex);
|
||||
|
||||
//! 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_ConstVol(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Species Standard State in
|
||||
//! the Solution
|
||||
//! @{
|
||||
|
|
@ -76,29 +53,7 @@ public:
|
|||
//! @{
|
||||
|
||||
virtual void initThermo();
|
||||
|
||||
//! 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
|
||||
* @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, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled);
|
||||
|
||||
virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id);
|
||||
virtual void setParametersFromXML(const XML_Node& speciesNode);
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,37 +27,9 @@ class WaterProps;
|
|||
class PDSS_HKFT : public PDSS_Molar
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
//! Default Constructor
|
||||
PDSS_HKFT();
|
||||
|
||||
//! Constructor that initializes the object by examining the XML entries
|
||||
//! from the ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSS member function.
|
||||
*
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_HKFT(VPStandardStateTP* tp, size_t spindex);
|
||||
|
||||
//! 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_HKFT(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
virtual ~PDSS_HKFT();
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Solution
|
||||
//! @{
|
||||
|
||||
|
|
@ -107,28 +79,15 @@ public:
|
|||
//! @name Initialization of the Object
|
||||
//! @{
|
||||
|
||||
void setParent(VPStandardStateTP* phase, size_t k) {
|
||||
m_tp = phase;
|
||||
m_spindex = k;
|
||||
}
|
||||
|
||||
virtual bool useSTITbyPDSS() const { return true; }
|
||||
virtual void initThermo();
|
||||
|
||||
//! 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
|
||||
* @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, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled);
|
||||
void setParametersFromXML(const XML_Node& speciesNode);
|
||||
|
||||
//! This utility function reports back the type of parameterization and
|
||||
//! all of the parameters for the species, index.
|
||||
|
|
@ -162,6 +121,9 @@ public:
|
|||
//@}
|
||||
|
||||
private:
|
||||
VPStandardStateTP* m_tp; //!< Parent VPStandardStateTP (ThermoPhase) object
|
||||
size_t m_spindex; //!< Index of this species within the parent phase
|
||||
|
||||
//! Main routine that actually calculates the Gibbs free energy difference
|
||||
//! between the reference state at Tr, Pr and T,P
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -24,32 +24,9 @@ namespace Cantera
|
|||
class PDSS_IdealGas : public PDSS_Nondimensional
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
//! Default Constructor
|
||||
PDSS_IdealGas();
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_IdealGas(VPStandardStateTP* tp, int spindex);
|
||||
|
||||
//! 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_IdealGas(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
|
||||
//! @{
|
||||
|
||||
|
|
@ -72,26 +49,6 @@ public:
|
|||
//! @name Initialization of the Object
|
||||
//! @{
|
||||
|
||||
//!Initialization of a PDSS object using an XML tree
|
||||
/*!
|
||||
* This routine is a driver for the initialization of the object.
|
||||
*
|
||||
* basic logic:
|
||||
* - initThermo() (cascade)
|
||||
* - get stuff from species part of XML file
|
||||
* - initThermoXML(phaseNode) (cascade)
|
||||
*
|
||||
* @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
|
||||
* @param spindex Species index within the phase
|
||||
* @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.
|
||||
*/
|
||||
void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
|
||||
const XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
virtual void initThermo();
|
||||
//@}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,32 +35,9 @@ class ThermoPhase;
|
|||
class PDSS_IonsFromNeutral : public PDSS_Nondimensional
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
//! Default constructor
|
||||
PDSS_IonsFromNeutral();
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex);
|
||||
|
||||
//! 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_IonsFromNeutral(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
|
||||
//! @{
|
||||
|
||||
|
|
@ -109,29 +86,11 @@ public:
|
|||
//! @name Initialization of the Object
|
||||
//! @{
|
||||
|
||||
//! 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
|
||||
* @param spindex Species index within the phase
|
||||
* @param speciesNode Reference to the phase Information for the species
|
||||
* that this standard state refers to
|
||||
* @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.
|
||||
*/
|
||||
void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, const std::string& id);
|
||||
void setParent(VPStandardStateTP* phase, size_t k);
|
||||
|
||||
virtual bool useSTITbyPDSS() const { return true; }
|
||||
|
||||
void setParametersFromXML(const XML_Node& speciesNode);
|
||||
virtual void initThermo();
|
||||
//@}
|
||||
|
||||
|
|
@ -142,6 +101,8 @@ protected:
|
|||
*/
|
||||
const ThermoPhase* neutralMoleculePhase_;
|
||||
|
||||
std::map<std::string, double> neutralSpeciesMultipliers_;
|
||||
|
||||
public:
|
||||
//! Number of neutral molecule species that make up the stoichiometric
|
||||
//! vector for this species, in terms of calculating thermodynamic functions
|
||||
|
|
|
|||
|
|
@ -163,32 +163,9 @@ namespace Cantera
|
|||
class PDSS_SSVol : public PDSS_Nondimensional
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
//! Default Constructor
|
||||
PDSS_SSVol();
|
||||
|
||||
//! 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, size_t spindex);
|
||||
|
||||
//! 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, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
|
||||
//! @{
|
||||
|
||||
|
|
@ -222,29 +199,7 @@ private:
|
|||
//! @{
|
||||
|
||||
virtual void initThermo();
|
||||
|
||||
//! 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
|
||||
* @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, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled);
|
||||
|
||||
virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id);
|
||||
virtual void setParametersFromXML(const XML_Node& speciesNode);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -49,40 +49,9 @@ namespace Cantera
|
|||
class PDSS_Water : public PDSS_Molar
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
|
||||
//! Bare constructor
|
||||
/*!
|
||||
* eliminate?
|
||||
*/
|
||||
//! Default constructor
|
||||
PDSS_Water();
|
||||
|
||||
//! Constructor that initializes the object by examining the XML entries
|
||||
//! from the ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSS member function.
|
||||
*
|
||||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS_Water(VPStandardStateTP* tp, int spindex);
|
||||
|
||||
//! Constructor that initializes the object by examining the input file
|
||||
//! of the variable pressure ThermoPhase object
|
||||
/*!
|
||||
* This function calls the constructPDSSXML member function.
|
||||
*
|
||||
* @param tp 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 Is the species already installed.
|
||||
*/
|
||||
PDSS_Water(VPStandardStateTP* tp, int spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRef, bool spInstalled);
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
|
||||
//! @{
|
||||
|
||||
|
|
@ -180,33 +149,8 @@ public:
|
|||
}
|
||||
|
||||
//! @}
|
||||
//! @name Initialization of the Object
|
||||
//! @{
|
||||
|
||||
//! Internal routine that initializes the underlying water model
|
||||
void constructSet();
|
||||
|
||||
//!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
|
||||
* @param spindex Species index within the phase
|
||||
* @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.
|
||||
*/
|
||||
void constructPDSSXML(VPStandardStateTP* vptp_ptr, int spindex,
|
||||
const XML_Node& phaseNode, const std::string& id);
|
||||
//@}
|
||||
virtual bool useSTITbyPDSS() const { return true; }
|
||||
|
||||
private:
|
||||
//! Pointer to the WaterPropsIAPWS object, which does the actual calculations
|
||||
|
|
@ -259,9 +203,6 @@ private:
|
|||
*/
|
||||
doublereal SW_Offset;
|
||||
|
||||
//! Verbose flag - used?
|
||||
bool m_verbose;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Since this phase represents a liquid phase, it's an error to
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ public:
|
|||
//@{
|
||||
|
||||
virtual void initThermo();
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
using Phase::addSpecies;
|
||||
virtual bool addSpecies(shared_ptr<Species> spec);
|
||||
|
|
|
|||
|
|
@ -20,40 +20,10 @@ PDSS::PDSS() :
|
|||
m_p0(-1.0),
|
||||
m_minTemp(-1.0),
|
||||
m_maxTemp(10000.0),
|
||||
m_tp(0),
|
||||
m_mw(0.0),
|
||||
m_spindex(npos),
|
||||
m_spthermo(0)
|
||||
m_mw(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
PDSS::PDSS(VPStandardStateTP* tp, size_t spindex) :
|
||||
m_temp(-1.0),
|
||||
m_pres(-1.0),
|
||||
m_p0(-1.0),
|
||||
m_minTemp(-1.0),
|
||||
m_maxTemp(10000.0),
|
||||
m_tp(tp),
|
||||
m_mw(0.0),
|
||||
m_spindex(spindex),
|
||||
m_spthermo(0)
|
||||
{
|
||||
if (tp) {
|
||||
m_spthermo = &tp->speciesThermo();
|
||||
}
|
||||
}
|
||||
|
||||
void PDSS::initThermoXML(const XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
AssertThrow(m_tp != 0, "PDSS::initThermoXML()");
|
||||
}
|
||||
|
||||
void PDSS::initThermo()
|
||||
{
|
||||
AssertThrow(m_tp != 0, "PDSS::initThermo()");
|
||||
m_mw = m_tp->molecularWeight(m_spindex);
|
||||
}
|
||||
|
||||
doublereal PDSS::enthalpy_mole() const
|
||||
{
|
||||
throw NotImplementedError("PDSS::enthalpy_mole()");
|
||||
|
|
@ -229,7 +199,7 @@ void PDSS::reportParams(size_t& kindex, int& type,
|
|||
doublereal& maxTemp_,
|
||||
doublereal& refPressure_) const
|
||||
{
|
||||
kindex = m_spindex;
|
||||
kindex = npos;
|
||||
type = 0;
|
||||
minTemp_ = m_minTemp;
|
||||
maxTemp_ = m_maxTemp;
|
||||
|
|
|
|||
|
|
@ -15,30 +15,14 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex) :
|
||||
PDSS(tp, spindex)
|
||||
|
||||
PDSS_ConstVol::PDSS_ConstVol()
|
||||
{
|
||||
}
|
||||
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot,
|
||||
bool spInstalled) :
|
||||
PDSS(tp, spindex)
|
||||
void PDSS_ConstVol::setParametersFromXML(const XML_Node& speciesNode)
|
||||
{
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
||||
}
|
||||
|
||||
void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled)
|
||||
{
|
||||
PDSS::initThermo();
|
||||
m_p0 = m_tp->speciesThermo().refPressure(m_spindex);
|
||||
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_ConstVol::constructPDSSXML", "spInstalled false not handled");
|
||||
}
|
||||
PDSS::setParametersFromXML(speciesNode);
|
||||
|
||||
const XML_Node* ss = speciesNode.findByName("standardState");
|
||||
if (!ss) {
|
||||
|
|
@ -53,19 +37,12 @@ void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
|||
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
|
||||
}
|
||||
|
||||
void PDSS_ConstVol::initThermoXML(const XML_Node& phaseNode, const 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_ConstVol::initThermo()
|
||||
{
|
||||
PDSS::initThermo();
|
||||
m_p0 = m_tp->speciesThermo().refPressure(m_spindex);
|
||||
m_minTemp = m_spthermo->minTemp();
|
||||
m_maxTemp = m_spthermo->maxTemp();
|
||||
m_p0 = m_spthermo->refPressure();
|
||||
m_V0 = m_constMolarVolume;
|
||||
m_Vss = m_constMolarVolume;
|
||||
}
|
||||
|
|
@ -92,7 +69,7 @@ void PDSS_ConstVol::setPressure(doublereal p)
|
|||
void PDSS_ConstVol::setTemperature(doublereal temp)
|
||||
{
|
||||
m_temp = temp;
|
||||
m_spthermo->update_single(m_spindex, temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
m_g0_RT = m_h0_RT - m_s0_R;
|
||||
|
||||
doublereal del_pRT = (m_pres - m_p0) / (GasConstant * m_temp);
|
||||
|
|
|
|||
|
|
@ -22,69 +22,33 @@ namespace Cantera
|
|||
// Set the default to error exit if there is an input file inconsistency
|
||||
int PDSS_HKFT::s_InputInconsistencyErrorExit = 1;
|
||||
|
||||
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) :
|
||||
PDSS(tp, spindex),
|
||||
m_waterSS(0),
|
||||
m_densWaterSS(-1.0),
|
||||
m_born_coeff_j(-1.0),
|
||||
m_r_e_j(-1.0),
|
||||
m_deltaG_formation_tr_pr(0.0),
|
||||
m_deltaH_formation_tr_pr(0.0),
|
||||
m_Mu0_tr_pr(0.0),
|
||||
m_Entrop_tr_pr(0.0),
|
||||
m_a1(0.0),
|
||||
m_a2(0.0),
|
||||
m_a3(0.0),
|
||||
m_a4(0.0),
|
||||
m_c1(0.0),
|
||||
m_c2(0.0),
|
||||
m_omega_pr_tr(0.0),
|
||||
m_Y_pr_tr(0.0),
|
||||
m_Z_pr_tr(0.0),
|
||||
m_presR_bar(0.0),
|
||||
m_domega_jdT_prtr(0.0),
|
||||
m_charge_j(0.0)
|
||||
PDSS_HKFT::PDSS_HKFT()
|
||||
: m_waterSS(0)
|
||||
, m_densWaterSS(-1.0)
|
||||
, m_born_coeff_j(-1.0)
|
||||
, m_r_e_j(-1.0)
|
||||
, m_deltaG_formation_tr_pr(0.0)
|
||||
, m_deltaH_formation_tr_pr(0.0)
|
||||
, m_Mu0_tr_pr(0.0)
|
||||
, m_Entrop_tr_pr(0.0)
|
||||
, m_a1(0.0)
|
||||
, m_a2(0.0)
|
||||
, m_a3(0.0)
|
||||
, m_a4(0.0)
|
||||
, m_c1(0.0)
|
||||
, m_c2(0.0)
|
||||
, m_omega_pr_tr(0.0)
|
||||
, m_Y_pr_tr(0.0)
|
||||
, m_Z_pr_tr(0.0)
|
||||
, m_presR_bar(0.0)
|
||||
, m_domega_jdT_prtr(0.0)
|
||||
, m_charge_j(0.0)
|
||||
{
|
||||
m_pres = OneAtm;
|
||||
m_presR_bar = OneAtm * 1.0E-5;
|
||||
m_presR_bar = 1.0;
|
||||
}
|
||||
|
||||
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot, bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
m_waterSS(0),
|
||||
m_densWaterSS(-1.0),
|
||||
m_born_coeff_j(-1.0),
|
||||
m_r_e_j(-1.0),
|
||||
m_deltaG_formation_tr_pr(0.0),
|
||||
m_deltaH_formation_tr_pr(0.0),
|
||||
m_Mu0_tr_pr(0.0),
|
||||
m_Entrop_tr_pr(0.0),
|
||||
m_a1(0.0),
|
||||
m_a2(0.0),
|
||||
m_a3(0.0),
|
||||
m_a4(0.0),
|
||||
m_c1(0.0),
|
||||
m_c2(0.0),
|
||||
m_omega_pr_tr(0.0),
|
||||
m_Y_pr_tr(0.0),
|
||||
m_Z_pr_tr(0.0),
|
||||
m_presR_bar(0.0),
|
||||
m_domega_jdT_prtr(0.0),
|
||||
m_charge_j(0.0)
|
||||
{
|
||||
m_pres = OneAtm;
|
||||
m_presR_bar = OneAtm * 1.0E-5;
|
||||
m_presR_bar = 1.0;
|
||||
// We have to read the info from here
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
||||
}
|
||||
|
||||
PDSS_HKFT::~PDSS_HKFT()
|
||||
{
|
||||
}
|
||||
|
||||
doublereal PDSS_HKFT::enthalpy_mole() const
|
||||
{
|
||||
// Ok we may change this evaluation method in the future.
|
||||
|
|
@ -333,18 +297,13 @@ void PDSS_HKFT::initThermo()
|
|||
}
|
||||
}
|
||||
|
||||
void PDSS_HKFT::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled)
|
||||
void PDSS_HKFT::setParametersFromXML(const XML_Node& speciesNode)
|
||||
{
|
||||
PDSS::setParametersFromXML(speciesNode);
|
||||
int hasDGO = 0;
|
||||
int hasSO = 0;
|
||||
int hasDHO = 0;
|
||||
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_HKFT::constructPDSSXML", "spInstalled false not handled");
|
||||
}
|
||||
|
||||
const XML_Node* tn = speciesNode.findByName("thermo");
|
||||
if (!tn) {
|
||||
throw CanteraError("PDSS_HKFT::constructPDSSXML",
|
||||
|
|
|
|||
|
|
@ -15,32 +15,17 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
PDSS_IdealGas::PDSS_IdealGas(VPStandardStateTP* tp, int spindex) :
|
||||
PDSS(tp, spindex)
|
||||
{
|
||||
}
|
||||
|
||||
PDSS_IdealGas::PDSS_IdealGas(VPStandardStateTP* tp, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot, bool spInstalled) :
|
||||
PDSS(tp, spindex)
|
||||
{
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_IdealGas", "sp installing not done yet");
|
||||
}
|
||||
constructPDSSXML(tp, spindex, phaseRoot, "");
|
||||
}
|
||||
|
||||
void PDSS_IdealGas::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& phaseNode, const std::string& id)
|
||||
PDSS_IdealGas::PDSS_IdealGas()
|
||||
{
|
||||
}
|
||||
|
||||
void PDSS_IdealGas::initThermo()
|
||||
{
|
||||
PDSS::initThermo();
|
||||
m_p0 = m_tp->speciesThermo().refPressure(m_spindex);
|
||||
m_minTemp = m_spthermo->minTemp(m_spindex);
|
||||
m_maxTemp = m_spthermo->maxTemp(m_spindex);
|
||||
m_p0 = m_spthermo->refPressure();
|
||||
m_minTemp = m_spthermo->minTemp();
|
||||
m_maxTemp = m_spthermo->maxTemp();
|
||||
}
|
||||
|
||||
doublereal PDSS_IdealGas::intEnergy_mole() const
|
||||
|
|
@ -68,7 +53,7 @@ void PDSS_IdealGas::setPressure(doublereal p)
|
|||
void PDSS_IdealGas::setTemperature(doublereal temp)
|
||||
{
|
||||
m_temp = temp;
|
||||
m_spthermo->update_single(m_spindex, temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
m_g0_RT = m_h0_RT - m_s0_R;
|
||||
m_V0 = GasConstant * m_temp / m_p0;
|
||||
m_hss_RT = m_h0_RT;
|
||||
|
|
|
|||
|
|
@ -16,34 +16,23 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex) :
|
||||
PDSS(tp, spindex),
|
||||
neutralMoleculePhase_(0),
|
||||
numMult_(0),
|
||||
add2RTln2_(true),
|
||||
specialSpecies_(0)
|
||||
|
||||
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral()
|
||||
: neutralMoleculePhase_(0)
|
||||
, numMult_(0)
|
||||
, add2RTln2_(true)
|
||||
, specialSpecies_(0)
|
||||
{
|
||||
}
|
||||
|
||||
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex, const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot, bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
neutralMoleculePhase_(0),
|
||||
numMult_(0),
|
||||
add2RTln2_(true),
|
||||
specialSpecies_(0)
|
||||
void PDSS_IonsFromNeutral::setParent(VPStandardStateTP* phase, size_t k)
|
||||
{
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_IonsFromNeutral", "sp installing not done yet");
|
||||
}
|
||||
std::string id = "";
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, id);
|
||||
neutralMoleculePhase_ = dynamic_cast<IonsFromNeutralVPSSTP&>(*phase).neutralMoleculePhase_;
|
||||
}
|
||||
|
||||
void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, const std::string& id)
|
||||
void PDSS_IonsFromNeutral::setParametersFromXML(const XML_Node& speciesNode)
|
||||
{
|
||||
PDSS::setParametersFromXML(speciesNode);
|
||||
const XML_Node* tn = speciesNode.findByName("thermo");
|
||||
if (!tn) {
|
||||
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML",
|
||||
|
|
@ -60,22 +49,9 @@ void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spinde
|
|||
"no Thermo::neutralSpeciesMultipliers Node for species " + speciesNode.name());
|
||||
}
|
||||
|
||||
IonsFromNeutralVPSSTP* ionPhase = dynamic_cast<IonsFromNeutralVPSSTP*>(tp);
|
||||
if (!ionPhase) {
|
||||
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML", "Dynamic cast failed");
|
||||
}
|
||||
neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_;
|
||||
neutralSpeciesMultipliers_ = parseCompString(nsm->value());
|
||||
numMult_ = neutralSpeciesMultipliers_.size();
|
||||
|
||||
std::vector<std::string> key;
|
||||
std::vector<std::string> val;
|
||||
numMult_ = getPairs(*nsm, key, val);
|
||||
idNeutralMoleculeVec.resize(numMult_);
|
||||
factorVec.resize(numMult_);
|
||||
tmpNM.resize(neutralMoleculePhase_->nSpecies());
|
||||
for (size_t i = 0; i < numMult_; i++) {
|
||||
idNeutralMoleculeVec[i] = neutralMoleculePhase_->speciesIndex(key[i]);
|
||||
factorVec[i] = fpValueCheck(val[i]);
|
||||
}
|
||||
specialSpecies_ = 0;
|
||||
const XML_Node* ss = tn->findByName("specialSpecies");
|
||||
if (ss) {
|
||||
|
|
@ -97,6 +73,11 @@ void PDSS_IonsFromNeutral::initThermo()
|
|||
m_p0 = neutralMoleculePhase_->refPressure();
|
||||
m_minTemp = neutralMoleculePhase_->minTemp();
|
||||
m_maxTemp = neutralMoleculePhase_->maxTemp();
|
||||
tmpNM.resize(neutralMoleculePhase_->nSpecies());
|
||||
for (auto multiplier : neutralSpeciesMultipliers_) {
|
||||
idNeutralMoleculeVec.push_back( neutralMoleculePhase_->speciesIndex(multiplier.first));
|
||||
factorVec.push_back(multiplier.second);
|
||||
}
|
||||
}
|
||||
|
||||
doublereal PDSS_IonsFromNeutral::enthalpy_RT() const
|
||||
|
|
|
|||
|
|
@ -15,37 +15,19 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex) :
|
||||
PDSS(tp, spindex),
|
||||
volumeModel_(SSVolume_Model::constant),
|
||||
m_constMolarVolume(-1.0)
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol()
|
||||
: volumeModel_(SSVolume_Model::constant)
|
||||
, m_constMolarVolume(-1.0)
|
||||
{
|
||||
TCoeff_[0] = 0.0;
|
||||
TCoeff_[1] = 0.0;
|
||||
TCoeff_[2] = 0.0;
|
||||
}
|
||||
|
||||
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot,
|
||||
bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
volumeModel_(SSVolume_Model::constant),
|
||||
m_constMolarVolume(-1.0)
|
||||
void PDSS_SSVol::setParametersFromXML(const XML_Node& speciesNode)
|
||||
{
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
||||
}
|
||||
|
||||
void PDSS_SSVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled)
|
||||
{
|
||||
PDSS::initThermo();
|
||||
m_p0 = m_tp->speciesThermo().refPressure(m_spindex);
|
||||
|
||||
if (!spInstalled) {
|
||||
throw CanteraError("PDSS_SSVol::constructPDSSXML", "spInstalled false not handled");
|
||||
}
|
||||
PDSS::setParametersFromXML(speciesNode);
|
||||
|
||||
const XML_Node* ss = speciesNode.findByName("standardState");
|
||||
if (!ss) {
|
||||
|
|
@ -76,19 +58,12 @@ void PDSS_SSVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
|||
}
|
||||
}
|
||||
|
||||
void PDSS_SSVol::initThermoXML(const XML_Node& phaseNode, const 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();
|
||||
m_p0 = m_tp->speciesThermo().refPressure(m_spindex);
|
||||
m_minTemp = m_spthermo->minTemp();
|
||||
m_maxTemp = m_spthermo->maxTemp();
|
||||
m_p0 = m_spthermo->refPressure();
|
||||
m_V0 = m_constMolarVolume;
|
||||
m_Vss = m_constMolarVolume;
|
||||
}
|
||||
|
|
@ -147,7 +122,7 @@ void PDSS_SSVol::setPressure(doublereal p)
|
|||
void PDSS_SSVol::setTemperature(doublereal temp)
|
||||
{
|
||||
m_temp = temp;
|
||||
m_spthermo->update_single(m_spindex, temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
|
||||
calcMolarVolume();
|
||||
m_g0_RT = m_h0_RT - m_s0_R;
|
||||
doublereal deltaP = m_pres - m_p0;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "cantera/thermo/PDSS_Water.h"
|
||||
#include "cantera/thermo/WaterPropsIAPWS.h"
|
||||
#include "cantera/base/stringUtils.h"
|
||||
#include "cantera/thermo/Elements.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
|
|
@ -18,62 +19,11 @@ PDSS_Water::PDSS_Water() :
|
|||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
m_spthermo = 0;
|
||||
constructSet();
|
||||
m_minTemp = 200.;
|
||||
m_maxTemp = 10000.;
|
||||
}
|
||||
|
||||
PDSS_Water::PDSS_Water(VPStandardStateTP* tp, int spindex) :
|
||||
PDSS(tp, spindex),
|
||||
m_waterProps(&m_sub),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
m_spthermo = 0;
|
||||
constructSet();
|
||||
m_minTemp = 200.;
|
||||
m_maxTemp = 10000.;
|
||||
}
|
||||
|
||||
PDSS_Water::PDSS_Water(VPStandardStateTP* tp, int spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot, bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
m_waterProps(&m_sub),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
std::string id= "";
|
||||
constructPDSSXML(tp, spindex, phaseRoot, id);
|
||||
initThermo();
|
||||
m_spthermo = 0;
|
||||
m_minTemp = 200.;
|
||||
m_maxTemp = 10000.;
|
||||
}
|
||||
|
||||
void PDSS_Water::constructPDSSXML(VPStandardStateTP* tp, int spindex,
|
||||
const XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
constructSet();
|
||||
}
|
||||
|
||||
void PDSS_Water::constructSet()
|
||||
{
|
||||
// Calculate the molecular weight. hard coded to Cantera's elements and
|
||||
// Water.
|
||||
m_mw = 2 * 1.00794 + 15.9994;
|
||||
m_mw = 2*getElementWeight("H") + getElementWeight("O");
|
||||
|
||||
// Set the baseline
|
||||
doublereal T = 298.15;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "cantera/thermo/PDSS_SSVol.h"
|
||||
#include "cantera/thermo/PDSS_HKFT.h"
|
||||
#include "cantera/thermo/PDSS_IonsFromNeutral.h"
|
||||
#include "cantera/thermo/IonsFromNeutralVPSSTP.h"
|
||||
#include "cantera/thermo/SpeciesThermoFactory.h"
|
||||
#include "cantera/base/utilities.h"
|
||||
#include "cantera/base/ctml.h"
|
||||
|
|
@ -188,9 +189,11 @@ void VPStandardStateTP::initThermo()
|
|||
ThermoPhase::initThermo();
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
PDSS* kPDSS = m_PDSS_storage[k].get();
|
||||
if (kPDSS) {
|
||||
kPDSS->initThermo();
|
||||
if (kPDSS == 0) {
|
||||
throw CanteraError("VPStandardStateTP::initThermo",
|
||||
"No PDSS object for species {}", k);
|
||||
}
|
||||
kPDSS->initThermo();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -260,43 +263,40 @@ void VPStandardStateTP::createInstallPDSS(size_t k, const XML_Node& s,
|
|||
m_PDSS_storage.resize(k+1);
|
||||
}
|
||||
PDSS* kPDSS = nullptr;
|
||||
bool use_STITbyPDSS;
|
||||
|
||||
const XML_Node* const ss = s.findByName("standardState");
|
||||
if (!ss) {
|
||||
use_STITbyPDSS = false;
|
||||
kPDSS = new PDSS_IdealGas(this, k, s, *phaseNode, true);
|
||||
kPDSS = new PDSS_IdealGas();
|
||||
} else {
|
||||
std::string model = ss->attrib("model");
|
||||
if (model == "constant_incompressible") {
|
||||
kPDSS = new PDSS_ConstVol(this, k, s, *phaseNode, true);
|
||||
use_STITbyPDSS = false;
|
||||
kPDSS = new PDSS_ConstVol();
|
||||
} else if (model == "waterIAPWS" || model == "waterPDSS") {
|
||||
kPDSS = new PDSS_Water(this, 0);
|
||||
use_STITbyPDSS = true;
|
||||
kPDSS = new PDSS_Water();
|
||||
m_useTmpRefStateStorage = false;
|
||||
} else if (model == "HKFT") {
|
||||
kPDSS = new PDSS_HKFT(this, k, s, *phaseNode, true);
|
||||
use_STITbyPDSS = true;
|
||||
kPDSS = new PDSS_HKFT();
|
||||
} else if (model == "IonFromNeutral") {
|
||||
kPDSS = new PDSS_IonsFromNeutral(this, k, s, *phaseNode, true);
|
||||
use_STITbyPDSS = true;
|
||||
kPDSS = new PDSS_IonsFromNeutral();
|
||||
} else if (model == "constant" || model == "temperature_polynomial" || model == "density_temperature_polynomial") {
|
||||
kPDSS = new PDSS_SSVol(this, k, s, *phaseNode, true);
|
||||
use_STITbyPDSS = false;
|
||||
kPDSS = new PDSS_SSVol();
|
||||
} else {
|
||||
throw CanteraError("VPStandardStateTP::createInstallPDSS",
|
||||
"unknown standard state formulation: " + model);
|
||||
}
|
||||
}
|
||||
kPDSS->setParent(this, k);
|
||||
kPDSS->setMolecularWeight(molecularWeight(k));
|
||||
kPDSS->setParametersFromXML(s);
|
||||
|
||||
if (use_STITbyPDSS) {
|
||||
if (kPDSS->useSTITbyPDSS()) {
|
||||
auto stit = make_shared<STITbyPDSS>(kPDSS);
|
||||
m_spthermo.install_STIT(k, stit);
|
||||
} else {
|
||||
shared_ptr<SpeciesThermoInterpType> stit(
|
||||
newSpeciesThermoInterpType(s.child("thermo")));
|
||||
stit->validate(s["name"]);
|
||||
kPDSS->setReferenceThermo(stit);
|
||||
m_spthermo.install_STIT(k, stit);
|
||||
}
|
||||
|
||||
|
|
@ -319,18 +319,6 @@ void VPStandardStateTP::invalidateCache()
|
|||
m_Tlast_ss += 0.0001234;
|
||||
}
|
||||
|
||||
void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
PDSS* kPDSS = m_PDSS_storage[k].get();
|
||||
AssertTrace(kPDSS != 0);
|
||||
if (kPDSS) {
|
||||
kPDSS->initThermoXML(phaseNode, id);
|
||||
}
|
||||
}
|
||||
ThermoPhase::initThermoXML(phaseNode, id);
|
||||
}
|
||||
|
||||
void VPStandardStateTP::_updateStandardStateThermo() const
|
||||
{
|
||||
double Tnow = temperature();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ int main()
|
|||
#endif
|
||||
double pres;
|
||||
try {
|
||||
Cantera::VPStandardStateTP* nnn = 0;
|
||||
Cantera::PDSS_Water* w = new Cantera::PDSS_Water(nnn, 0);
|
||||
Cantera::PDSS_Water* w = new PDSS_Water();
|
||||
|
||||
/*
|
||||
* Print out the triple point conditions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue