cantera/Cantera/src/thermo/PDSS_ConstVol.h
Harry Moffat e46b6f2b2d PDSS refactor - Addition of VPSSMgr Basically, this makes the specification
of standard states and the specification of activities independent of
each other.


  PDSS Behavior
-------------------------
PDSS is an object that carries out and reports on the evaluation
of the pressure dependent standard state of a single species in a mixture.

VPSSMgr Point of View
--------------------------------------


This is the calculator for the standard states.



From The Point of View of the ThermoPhase Function
---------------------------------------------------------
At the VPStandardStateTP object, the ThermoPhase object is enriched to
include a new object called VPSSMgr. VPSSMgr is
a base class that is responsible for calculating the standard states
of all of the species in the mixture. It is analogous to the
SpeciesThermo virtual base class, which handles all of the reference
state calculations for a class. The VPSSMgr class
usurps all calculations.

There are PDSS objects for each species.
VPStandardStateTP contains a vector of pointers to PDSS, of length
nSpecies in the phase. It owns the list.
VPSSMgr also contains the same vector of pointers to PDSS, of length
nSpecies in the phase. VPSSMgr is a methods class. It
organizes how to calculate the SS values efficiently. It may also have
specific rules for how to handle the pressure dependence (i.e., there
will be a specific class for ideal gases).
The VPSSMgr organizes when to update the internal states of
the PDSS objects.
The determination of which VPSSMgr virtual class to use with
which phase is determined by the phase itself. It know which method to
use.

setState Treatment with Temperature and Pressure
------------------------------------------------------

The VPStandardStateTP object always has the current value of T and P
held within it. It determines when T and P have changed. If it determines
that T or P has changed, it calls VPSSMgr so that VPSSMgr
may update its internal states.
VPSSMgr contains the current T and P, also, separately.
If it determines that T or P has changed, it recalculates its own internal state.


PDSS Object point of View
-----------------------------------------

During the evaluation of the phase thermodynamics, the PDSS object
may be called to evaluate the (T,P) Standard State and RefState information.

The PDSS object may or may not own the reference state calculation. If
it doesn't own the calculation, the ThermoPhase object owns the
calculation through its m_spthermo object.  Then the PDSS objects
uses pointers into the m_spthermo object to satisfy its requirement
to supply (T,P) ss information. It may own or surplant the reference
state calculation. For example, for waterPDSS, there is no specific reference
state calculation, since the regular temperature polynomial process
is ignored (except to set the basis state). The reference state functions
are evaluated the same as other standard state functions.

If PDSS owns the calculation of the reference state thermo, then the
m_spthermo pointer within the PDSS object is zero. It does it's own
reference state calculation.

If PDSS uses the SpeciesThermo object to calculate the reference
state, it needs to know whether the SpeciesThermo object calculations
are current. It checks this. If it is, then it retrieves the result from
storage in VPSSMgr object. If it isn't, then it recalculates the results.

PDSS has its own storage for the current state of T and P.
2008-08-23 00:53:54 +00:00

408 lines
12 KiB
C++

/**
* @file PDSS_ConstVol.h
* Declarations for the class PDSS_ConstVol (pressure dependent standard state)
* which handles calculations for a single species with a constant molar volume in a phase
* (see class \link Cantera::PDSS_ConstVol PDSS_ConstVol\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$
*/
#ifndef CT_PDSS_CONSTVOL_H
#define CT_PDSS_CONSTVOL_H
#include "PDSS.h"
namespace Cantera {
class XML_Node;
class VPStandardStateTP;
/**
* Class for pressure dependent standard states.
* This class is for a single Ideal Gas species.
*
*/
class PDSS_ConstVol : 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_ConstVol(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_ConstVol(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_ConstVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode,
const XML_Node& phaseRef, bool spInstalled);
//! Copy Constructur
/*!
* @param b Object to be copied
*/
PDSS_ConstVol(const PDSS_ConstVol &b);
//! Assignment operator
/*!
* @param b Object to be copeid
*/
PDSS_ConstVol& operator=(const PDSS_ConstVol&b);
//! Destructor
virtual ~PDSS_ConstVol();
//! Duplicator
virtual PDSS *duplMyselfAsPDSS() const;
/**
* @}
* @name Utilities
* @{
*/
virtual int pdssType() const { return -1; }
/**
* @}
* @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;
/**
* @}
* @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;
/**
* @}
* @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(double temp);
//! Set the internal temperature and pressure
/*!
* @param temp Temperature (Kelvin)
* @param pres pressure (Pascals)
*/
virtual void setState_TP(double temp, double pres);
/**
* @}
* @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:
//! Value of the constant molar volume for the species
doublereal m_constMolarVolume;
};
}
#endif