00001 /** 00002 * @file VPSSMgr_Water_ConstVol.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 a constant molar volume pressure 00006 * dependence 00007 * (see \ref mgrpdssthermocalc and 00008 * class \link Cantera::VPSSMgr_ConstVol VPSSMgr_ConstVol\endlink). 00009 */ 00010 00011 /* 00012 * $Revision: 279 $ 00013 * $Date: 2009-12-05 14:08:43 -0500 (Sat, 05 Dec 2009) $ 00014 */ 00015 00016 /* 00017 * Copywrite (2005) Sandia Corporation. Under the terms of 00018 * Contract DE-AC04-94AL85000 with Sandia Corporation, the 00019 * U.S. Government retains certain rights in this software. 00020 */ 00021 00022 #ifndef CT_VPSSMGR_WATER_CONSTVOL_H 00023 #define CT_VPSSMGR_WATER_CONSTVOL_H 00024 00025 #include "VPSSMgr.h" 00026 00027 namespace Cantera { 00028 00029 class SpeciesThermoInterpType; 00030 class VPStandardStateTP; 00031 class SpeciesThermo; 00032 class PDSS; 00033 class PDSS_Water; 00034 00035 //! Virtual base class for the species thermo manager classes. 00036 /*! 00037 * This class defines the interface which all subclasses must implement. 00038 * 00039 * Class %VPSSSpeciesThermo is the base class 00040 * for a family of classes that compute properties of a set of 00041 * species in their reference state at a range of temperatures. 00042 * Note, the pressure dependence of the reference state is not 00043 * handled by this particular species standard state model. 00044 * 00045 * @ingroup mgrpdssthermocalc 00046 */ 00047 class VPSSMgr_Water_ConstVol : public VPSSMgr { 00048 00049 public: 00050 00051 //! Base Constructor 00052 /*! 00053 * Initialize the object. 00054 * 00055 * @param vp_ptr Pointer to the VPStandardStateTP standard state 00056 * @param sp_ptr Poitner to the SpeciesThermo standard state 00057 */ 00058 VPSSMgr_Water_ConstVol(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr); 00059 00060 //! Destructor 00061 virtual ~VPSSMgr_Water_ConstVol(); 00062 00063 //! Copy Constructor for the %SpeciesThermo object. 00064 /*! 00065 * @param right Reference to %SpeciesThermo object to be copied into the 00066 * current one. 00067 */ 00068 VPSSMgr_Water_ConstVol(const VPSSMgr_Water_ConstVol &right); 00069 00070 //! Assignment operator for the %SpeciesThermo object 00071 /*! 00072 * This is NOT a virtual function. 00073 * 00074 * @param right Reference to %SpeciesThermo object to be copied into the 00075 * current one. 00076 */ 00077 VPSSMgr_Water_ConstVol& operator=(const VPSSMgr_Water_ConstVol &right); 00078 00079 //! Duplication routine for objects which inherit from 00080 //! %VPSSSpeciesThermo 00081 /*! 00082 * This virtual routine can be used to duplicate %VPSSSpeciesThermo objects 00083 * inherited from %VPSSSpeciesThermo even if the application only has 00084 * a pointer to %VPSSSpeciesThermo to work with. 00085 */ 00086 virtual VPSSMgr *duplMyselfAsVPSSMgr() const; 00087 00088 /*! 00089 * @name Properties of the Standard State of the Species in the Solution 00090 * 00091 * Within VPStandardStateTP, these properties are calculated via a common routine, 00092 * _updateStandardStateThermo(), 00093 * which must be overloaded in inherited objects. 00094 * The values are cached within this object, and are not recalculated unless 00095 * the temperature or pressure changes. 00096 */ 00097 00098 //@{ 00099 00100 private: 00101 00102 //! Updates the standard state thermodynamic functions at the current T and P of the solution. 00103 /*! 00104 * @internal 00105 * 00106 * If m_useTmpStandardStateStorage is true, 00107 * this function must be called for every call to functions in this 00108 * class. It checks to see whether the temperature or pressure has changed and 00109 * thus the ss thermodynamics functions for all of the species 00110 * must be recalculated. 00111 * 00112 * This function is responsible for updating the following internal members, 00113 * 00114 * - m_hss_RT; 00115 * - m_cpss_R; 00116 * - m_gss_RT; 00117 * - m_sss_R; 00118 * - m_Vss 00119 * 00120 * If m_useTmpStandardStateStorage is not true, this function may be 00121 * required to be called by child classes to update internal member data. 00122 * 00123 * Note, this will throw an error. It must be reimplemented in derived classes. 00124 * 00125 */ 00126 virtual void _updateStandardStateThermo(); 00127 00128 //! Updates the reference state thermodynamic functions at the 00129 //! current T of the solution and the reference pressure 00130 /*! 00131 * Underscore updates never check for the state of the system. 00132 * They just do the calculation. 00133 * 00134 * This function is responsible for updating the following internal members 00135 * 00136 * - m_h0_RT; 00137 * - m_cp0_R; 00138 * - m_g0_RT; 00139 * - m_s0_R; 00140 * - m_V0 00141 * 00142 * This routine also updates all of the thermo to the current temperature 00143 */ 00144 virtual void _updateRefStateThermo () const; 00145 00146 //@} 00147 00148 public: 00149 /// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP) 00150 /*! 00151 * There are also temporary 00152 * variables for holding the species reference-state values of Cp, H, S, and V at the 00153 * last temperature and reference pressure called. These functions are not recalculated 00154 * if a new call is made using the previous temperature. 00155 * All calculations are done within the routine _updateRefStateThermo(). 00156 */ 00157 00158 //@{ 00159 00160 /*! 00161 * Returns the vector of nondimensional 00162 * enthalpies of the reference state at the current temperature 00163 * of the solution and the reference pressure for the species. 00164 * 00165 * @param hrt Output vector contains the nondimensional enthalpies 00166 * of the reference state of the species 00167 * length = m_kk, units = dimensionless. 00168 */ 00169 virtual void getEnthalpy_RT_ref(doublereal *hrt) const; 00170 00171 /*! 00172 * Returns the vector of nondimensional 00173 * Gibbs free energies of the reference state at the current temperature 00174 * of the solution and the reference pressure for the species. 00175 * 00176 * @param grt Output vector contains the nondimensional Gibbs free energies 00177 * of the reference state of the species 00178 * length = m_kk, units = dimensionless. 00179 */ 00180 virtual void getGibbs_RT_ref(doublereal *grt) const ; 00181 00182 /*! 00183 * Returns the vector of the 00184 * gibbs function of the reference state at the current temperature 00185 * of the solution and the reference pressure for the species. 00186 * units = J/kmol 00187 * 00188 * @param g Output vector contain the Gibbs free energies 00189 * of the reference state of the species 00190 * length = m_kk, units = J/kmol. 00191 */ 00192 virtual void getGibbs_ref(doublereal *g) const ; 00193 00194 00195 /*! 00196 * Returns the vector of nondimensional 00197 * entropies of the reference state at the current temperature 00198 * of the solution and the reference pressure for the species. 00199 * 00200 * @param er Output vector contain the nondimensional entropies 00201 * of the species in their reference states 00202 * length: m_kk, units: dimensionless. 00203 */ 00204 virtual void getEntropy_R_ref(doublereal *er) const ; 00205 00206 /*! 00207 * Returns the vector of nondimensional 00208 * constant pressure heat capacities of the reference state 00209 * at the current temperature of the solution 00210 * and reference pressure for the species. 00211 * 00212 * @param cpr Output vector contains the nondimensional heat capacities 00213 * of the species in their reference states 00214 * length: m_kk, units: dimensionless. 00215 */ 00216 virtual void getCp_R_ref(doublereal *cpr) const ; 00217 00218 //! Get the molar volumes of the species reference states at the current 00219 //! <I>T</I> and <I>P_ref</I> of the solution. 00220 /*! 00221 * units = m^3 / kmol 00222 * 00223 * @param vol Output vector containing the standard state volumes. 00224 * Length: m_kk. 00225 */ 00226 virtual void getStandardVolumes_ref(doublereal *vol) const ; 00227 00228 00229 //! @name Initialization Methods - For Internal use (VPStandardState) 00230 /*! 00231 * The following methods are used in the process of constructing 00232 * the phase and setting its parameters from a specification in an 00233 * input file. They are not normally used in application programs. 00234 * To see how they are used, see files importCTML.cpp and 00235 * ThermoFactory.cpp. 00236 */ 00237 00238 //@{ 00239 00240 //! @internal Initialize the object 00241 /*! 00242 * This method is provided to allow 00243 * subclasses to perform any initialization required after all 00244 * species have been added. For example, it might be used to 00245 * resize internal work arrays that must have an entry for 00246 * each species. The base class implementation does nothing, 00247 * and subclasses that do not require initialization do not 00248 * need to overload this method. When importing a CTML phase 00249 * description, this method is called just prior to returning 00250 * from function importPhase(). 00251 * 00252 * @see importCTML.cpp 00253 */ 00254 00255 //! Initialize the thermo, after all species have been entered. 00256 virtual void initThermo(); 00257 00258 //! Finalize the thermo after all species have been entered 00259 /*! 00260 * This function is the LAST initialization routine to be 00261 * called. It's called after createInstallPDSS() has been 00262 * called for each species in the phase, and after initThermo() 00263 * has been called. 00264 * It's called via an inner-to-outer onion shell like manner. 00265 * 00266 * 00267 * @param phaseNode Reference to the phaseNode XML node. 00268 * @param id ID of the phase. 00269 */ 00270 virtual void initThermoXML(XML_Node& phaseNode, std::string id); 00271 00272 //! Install specific content for species k in the standard-state 00273 //! thermodynamic calculator and also create/return a PDSS object 00274 //! for that species. 00275 /*! 00276 * This occurs before matrices are sized appropriately. 00277 * 00278 * @param k Species index in the phase 00279 * @param speciesNode XML Node corresponding to the species 00280 * @param phaseNode_ptr Pointer to the XML Node corresponding 00281 * to the phase which owns the species 00282 */ 00283 virtual PDSS *createInstallPDSS(int k, const XML_Node& speciesNode, 00284 const XML_Node * const phaseNode_ptr); 00285 00286 //! This utility function reports the type of parameterization 00287 //! used for the species with index number index. 00288 /*! 00289 * 00290 * @param index Species index 00291 */ 00292 virtual PDSS_enumType reportPDSSType(int index = -1) const ; 00293 00294 00295 //! This utility function reports the type of manager 00296 //! for the calculation of ss properties 00297 /*! 00298 * @return Returns an enumerated type that is unique. 00299 */ 00300 virtual VPSSMgr_enumType reportVPSSMgrType() const ; 00301 00302 //! Initialize all internal pointers 00303 /*! 00304 * This is a virtual function that fills or updates the values of the 00305 * shallow pointers. 00306 * 00307 * @param vp_ptr Pointer to the Variable Pressure standard state object 00308 * @param sp_ptr Pointer to the reference state thermo calculator object 00309 */ 00310 virtual void initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr); 00311 00312 private: 00313 00314 //! Pointer to the Water PDSS object. 00315 /*! 00316 * This is a shallow copy. The water PDSS object is owned by the VPStandardStateTP 00317 * object. 00318 */ 00319 PDSS_Water *m_waterSS; 00320 00321 }; 00322 //@} 00323 } 00324 00325 #endif 00326