VPSSMgr_Water_HKFT.h

Go to the documentation of this file.
00001 /**
00002  *  @file VPSSMgr_Water_HKFT.h
00003  * Declaration file for a derived class that handles the calculation
00004  * of standard state thermo properties for real water and 
00005  *  a set of species which have the HKFT equation of state
00006  * (see \ref mgrpdssthermocalc and
00007  * class \link Cantera::VPSSMgr_Water_HKFT VPSSMgr_Water_HKFT\endlink).
00008  */
00009 
00010 /*
00011  * $Revision: 279 $
00012  * $Date: 2009-12-05 14:08:43 -0500 (Sat, 05 Dec 2009) $
00013  */
00014 
00015 /*
00016  * Copywrite (2006) Sandia Corporation. Under the terms of 
00017  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
00018  * U.S. Government retains certain rights in this software.
00019  */
00020 
00021 #ifndef CT_VPSSMGR_WATER_HKFT_H
00022 #define CT_VPSSMGR_WATER_HKFT_H
00023 
00024 #include "VPSSMgr.h"
00025 
00026 namespace Cantera {
00027 
00028   class SpeciesThermoInterpType;
00029   class VPStandardStateTP;
00030   class SpeciesThermo;
00031   class PDSS;
00032   class PDSS_Water;
00033 
00034   //! Virtual base class for the species thermo manager classes.
00035   /*!
00036    *  This class defines the interface which all subclasses must implement. 
00037    *
00038    * Class %VPSSSpeciesThermo is the base class
00039    * for a family of classes that compute properties of a set of 
00040    * species in their reference state at a range of temperatures.
00041    * Note, the pressure dependence of the reference state is not
00042    * handled by this particular species standard state model.
00043    *
00044    * @ingroup mgrpdssthermocalc
00045    */
00046   class VPSSMgr_Water_HKFT : public VPSSMgr {
00047     
00048   public:
00049 
00050   
00051     //! Constructor
00052     /*!
00053      * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
00054      *                 This object must have already been malloced.
00055      *                 
00056      * @param spth     Pointer to the optional SpeciesThermo object
00057      *                 that will handle the calculation of the reference
00058      *                 state thermodynamic coefficients.
00059      */
00060     VPSSMgr_Water_HKFT(VPStandardStateTP *vptp_ptr,
00061                            SpeciesThermo *spth);
00062 
00063     //! Destructor
00064     virtual ~VPSSMgr_Water_HKFT();
00065 
00066     //! Copy Constructor for the %SpeciesThermo object. 
00067     /*!
00068      * @param right    Reference to %SpeciesThermo object to be copied into the
00069      *                 current one.
00070      */
00071     VPSSMgr_Water_HKFT(const VPSSMgr_Water_HKFT &right);
00072         
00073     //! Assignment operator for the %SpeciesThermo object
00074     /*!
00075      *  This is NOT a virtual function.
00076      *
00077      * @param right    Reference to %SpeciesThermo object to be copied into the
00078      *                 current one. 
00079      */
00080     VPSSMgr_Water_HKFT& operator=(const VPSSMgr_Water_HKFT &right);
00081    
00082     //! Duplication routine for objects which inherit from 
00083     //! %VPSSSpeciesThermo
00084     /*!
00085      *  This virtual routine can be used to duplicate %VPSSSpeciesThermo  objects
00086      *  inherited from %VPSSSpeciesThermo even if the application only has
00087      *  a pointer to %VPSSSpeciesThermo to work with.
00088      */
00089     virtual VPSSMgr *duplMyselfAsVPSSMgr() const;
00090 
00091     /*!
00092      * @name  Properties of the Standard State of the Species in the Solution 
00093      *
00094      *  Within VPStandardStateTP, these properties are calculated via a common routine, 
00095      *  _updateStandardStateThermo(),
00096      *  which must be overloaded in inherited objects.
00097      *  The values are cached within this object, and are not recalculated unless
00098      *  the temperature or pressure changes.
00099      */
00100     //@{
00101     
00102  
00103     //@}
00104     /// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP)
00105     /*!
00106      *  There are also temporary
00107      *  variables for holding the species reference-state values of Cp, H, S, and V at the
00108      *  last temperature and reference pressure called. These functions are not recalculated
00109      *  if a new call is made using the previous temperature.
00110      *  All calculations are done within the routine  _updateRefStateThermo().
00111      */
00112     //@{
00113 
00114     /*!
00115      *  Returns the vector of nondimensional
00116      *  enthalpies of the reference state at the current temperature
00117      *  of the solution and the reference pressure for the species.
00118      *
00119      * @param hrt Output vector contains the nondimensional enthalpies
00120      *            of the reference state of the species
00121      *            length = m_kk, units = dimensionless.
00122      */
00123     virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
00124      
00125     /*!
00126      *  Returns the vector of nondimensional
00127      *  Gibbs free energies of the reference state at the current temperature
00128      *  of the solution and the reference pressure for the species.
00129      *
00130      * @param grt Output vector contains the nondimensional Gibbs free energies
00131      *            of the reference state of the species
00132      *            length = m_kk, units = dimensionless.
00133      */
00134     virtual void getGibbs_RT_ref(doublereal *grt) const ;
00135 
00136    /*!
00137      *  Returns the vector of the
00138      *  gibbs function of the reference state at the current temperature
00139      *  of the solution and the reference pressure for the species.
00140      *  units = J/kmol
00141      *
00142      * @param g   Output vector contain the Gibbs free energies
00143      *            of the reference state of the species
00144      *            length = m_kk, units = J/kmol.
00145      */
00146     virtual void getGibbs_ref(doublereal *g) const ;
00147       
00148   
00149     /*!
00150      *  Returns the vector of nondimensional
00151      *  entropies of the reference state at the current temperature
00152      *  of the solution and the reference pressure for the species.
00153      *
00154      * @param er  Output vector contain the nondimensional entropies
00155      *            of the species in their reference states
00156      *            length: m_kk, units: dimensionless.
00157      */
00158     virtual void getEntropy_R_ref(doublereal *er) const ;
00159                  
00160     /*!
00161      *  Returns the vector of nondimensional
00162      *  constant pressure heat capacities of the reference state
00163      *  at the current temperature of the solution
00164      *  and reference pressure for the species.
00165      *
00166      * @param cpr  Output vector contains the nondimensional heat capacities
00167      *             of the species in their reference states
00168      *             length: m_kk, units: dimensionless.
00169      */
00170     virtual void getCp_R_ref(doublereal *cpr) const ;
00171 
00172     //!  Get the molar volumes of the species reference states at the current
00173     //!  <I>T</I> and <I>P_ref</I> of the solution.
00174     /*!
00175      * units = m^3 / kmol
00176      *
00177      * @param vol     Output vector containing the standard state volumes.
00178      *                Length: m_kk.
00179      */
00180     virtual void getStandardVolumes_ref(doublereal *vol) const ;
00181 
00182     //! Set the temperature (K) and pressure (Pa)
00183     /*!
00184      *  This sets the temperature and pressure and triggers 
00185      *  calculation of underlying quantities
00186      *
00187      * @param T    Temperature (K)
00188      * @param P    Pressure (Pa)
00189      */
00190     virtual void setState_TP(doublereal T, doublereal P);
00191 
00192     //! Set the temperature (K)
00193     /*!
00194      * @param T    Temperature (K)
00195      */
00196     virtual void setState_T(doublereal T);
00197 
00198     //! Set the  pressure (Pa)
00199     /*!
00200      * @param P    Pressure (Pa)
00201      */
00202     virtual void setState_P(doublereal P);
00203 
00204     //@}
00205     /// @name Setting the Internal State of the System
00206     /*!
00207      *  All calls to change the internal state of the system's T and P
00208      *  are done through these routines
00209      *      - setState_TP()
00210      *      - setState_T()
00211      *      - setState_P()
00212      *
00213      *  These routine in turn call the following underlying virtual functions
00214      *
00215      *   - _updateRefStateThermo()
00216      *   - _updateStandardStateThermo()
00217      *
00218      *  An important point to note is that inbetween calls the assumption
00219      *  that the underlying PDSS objects will retain their set Temperatures
00220      *  and Pressure CAN NOT BE MADE. For efficiency reasons, we may twiddle
00221      *  these to get derivatives.
00222      */
00223     //@{
00224 
00225     //! Updates the internal reference state thermodynamic vectors at the 
00226     //! current T of the solution and the reference pressure.
00227     /*!
00228      *  This is called to make sure that the internal thermodynamic members
00229      *  are up-to-date. It checks against an internal value of m_tempRef
00230      *  to see whether the values are current.
00231      */
00232     virtual void updateRefStateThermo() const;
00233 
00234   private:
00235 
00236     //! Updates the reference state thermodynamic functions at the current T
00237     //! and a calculated Pref that is safe.
00238     /*!
00239      *
00240      * This function is responsible for updating the following internal members
00241      *
00242      *  -  m_h0_RT;
00243      *  -  m_cp0_R;
00244      *  -  m_g0_RT;
00245      *  -  m_s0_R;
00246      *  -  m_V0
00247      *
00248      *  It always does the calculation. No checking is ever done to see
00249      *  if the calculation is necessary.
00250      *
00251      *  m_p0 is calculated within this routine given the value of the temperature.
00252      *  This is necessary because we are using a real equation of state for
00253      *  water. 
00254      *
00255      *  The state of the system is left at (m_tlast, m_plast) at the end
00256      *  of the routine.
00257      */                    
00258     virtual void _updateRefStateThermo() const;
00259 
00260     //! Updates the standard state thermodynamic functions at the current T and P of the solution.
00261     /*!
00262      * @internal
00263      *
00264      * If m_useTmpStandardStateStorage is true,
00265      * this function must be called for every call to functions in this
00266      * class. It checks to see whether the temperature or pressure has changed and
00267      * thus the ss thermodynamics functions for all of the species
00268      * must be recalculated.
00269      *
00270      * This function is responsible for updating the following internal members,
00271      * when  m_useTmpStandardStateStorage is true.
00272      *
00273      *  -  m_hss_RT;
00274      *  -  m_cpss_R;
00275      *  -  m_gss_RT;
00276      *  -  m_sss_R;
00277      *  -  m_Vss
00278      *
00279      *  If m_useTmpStandardStateStorage is not true, this function may be
00280      *  required to be called by child classes to update internal member data.
00281      *
00282      *  Note, this will throw an error. It must be reimplemented in derived classes.
00283      *
00284      */                    
00285     virtual void _updateStandardStateThermo();
00286 
00287 
00288   public:
00289 
00290     //@}
00291     //! @name Utility Methods - Reports on various quantities
00292     /*!
00293      * The following methods are used in the process of reporting
00294      * various states and attributes
00295      */
00296     //@{
00297 
00298     //! This utility function reports the type of parameterization
00299     //! used for the species with index number index.
00300     /*!
00301      *
00302      * @param index  Species index
00303      */
00304     virtual PDSS_enumType reportPDSSType(int index = -1) const ;
00305 
00306 
00307     //! This utility function reports the type of manager
00308     //! for the calculation of ss properties
00309     /*!
00310      *
00311      * 
00312      */
00313     virtual VPSSMgr_enumType reportVPSSMgrType() const ;
00314 
00315     //@}
00316     //! @name Initialization Methods - For Internal use (VPStandardState)
00317     /*!
00318      * The following methods are used in the process of constructing
00319      * the phase and setting its parameters from a specification in an 
00320      * input file. They are not normally used in application programs.
00321      * To see how they are used, see files importCTML.cpp and 
00322      * ThermoFactory.cpp.
00323      */
00324     //@{
00325 
00326     //! @internal Initialize the object
00327     /*!
00328      * This method is provided to allow
00329      * subclasses to perform any initialization required after all
00330      * species have been added. For example, it might be used to
00331      * resize internal work arrays that must have an entry for
00332      * each species.  The base class implementation does nothing,
00333      * and subclasses that do not require initialization do not
00334      * need to overload this method.  When importing a CTML phase
00335      * description, this method is called just prior to returning
00336      * from function importPhase().
00337      *
00338      * @see importCTML.cpp
00339      */
00340     virtual void initThermo();
00341 
00342     //! Finalize the thermo after all species have been entered
00343     /*!
00344      *  This function is the LAST initialization routine to be 
00345      *  called. It's called after createInstallPDSS() has been
00346      *  called for each species in the phase, and after initThermo()
00347      *  has been called.
00348      *  It's called via an inner-to-outer onion shell like manner.
00349      *  
00350      *
00351      *  @param phaseNode   Reference to the phaseNode XML node.
00352      *  @param id          ID of the phase.
00353      */
00354     virtual void initThermoXML(XML_Node& phaseNode, std::string id);
00355 
00356     //! Install specific content for species k in the standard-state
00357     //! thermodynamic calculator and also create/return a PDSS object
00358     //! for that species.
00359     /*!
00360      * This occurs before matrices are sized appropriately.
00361      *
00362      * @param k             Species index in the phase
00363      * @param speciesNode   XML Node corresponding to the species
00364      * @param phaseNode_ptr Pointer to the XML Node corresponding
00365      *                      to the phase which owns the species
00366      */
00367     virtual PDSS *createInstallPDSS(int k, const XML_Node& speciesNode,  
00368                                     const XML_Node * const phaseNode_ptr);
00369  
00370     //@}
00371 
00372    private:
00373 
00374     //! Shallow pointer to the water object
00375     PDSS_Water *m_waterSS;
00376 
00377     //! Last reference temperature calculated
00378     /*!
00379      * Reference state calculations are totally separated from
00380      * standard state calculations.
00381      */
00382     mutable doublereal m_tlastRef;
00383   };
00384   //@}
00385 }
00386 
00387 #endif
00388 
Generated by  doxygen 1.6.3