00001 /** 00002 * @file VPSSMgr.h 00003 * Declaration file for a virtual base class that manages 00004 * the calculation of standard state properties for all of the 00005 * species in a single phase, assuming a variable P and T standard state 00006 * (see \ref mgrpdssthermocalc and 00007 * class \link Cantera::VPSSMgr VPSSMgr\endlink). 00008 */ 00009 00010 /* 00011 * $Author: hkmoffa $ 00012 * $Revision: 279 $ 00013 * $Date: 2009-12-05 14:08:43 -0500 (Sat, 05 Dec 2009) $ 00014 */ 00015 /* 00016 * Copywrite (2005) 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_H 00022 #define CT_VPSSMGR_H 00023 00024 #include "ct_defs.h" 00025 #include "mix_defs.h" 00026 00027 namespace Cantera { 00028 00029 class SpeciesThermoInterpType; 00030 class VPStandardStateTP; 00031 class XML_Node; 00032 class SpeciesThermo; 00033 class PDSS; 00034 /** 00035 * @defgroup mgrpdssthermocalc Managers for Calculating Standard-State Thermodynamics 00036 * 00037 * To compute the thermodynamic properties of multicomponent 00038 * solutions, it is necessary to know something about the 00039 * thermodynamic properties of the individual species present in 00040 * the solution. Exactly what sort of species properties are 00041 * required depends on the thermodynamic model for the 00042 * solution. For a gaseous solution (i.e., a gas mixture), the 00043 * species properties required are usually ideal gas properties at 00044 * the mixture temperature and at a reference pressure (almost always at 00045 * 1 bar). For other types of solutions, however, it may 00046 * not be possible to isolate the species in a "pure" state. For 00047 * example, the thermodynamic properties of, say, Na+ and Cl- in 00048 * saltwater are not easily determined from data on the properties 00049 * of solid NaCl, or solid Na metal, or chlorine gas. In this 00050 * case, the solvation in water is fundamental to the identity of 00051 * the species, and some other reference state must be used. One 00052 * common convention for liquid solutions is to use thermodynamic 00053 * data for the solutes in the limit of infinite dilution within the 00054 * pure solvent; another convention is to reference all properties 00055 * to unit molality. 00056 * 00057 * In defining these standard states for species in a phase, we make 00058 * the following definition. A reference state is a standard state 00059 * of a species in a phase limited to one particular pressure, the reference 00060 * pressure. The reference state specifies the dependence of all 00061 * thermodynamic functions as a function of the temperature, in 00062 * between a minimum temperature and a maximum temperature. The 00063 * reference state also specifies the molar volume of the species 00064 * as a function of temperature. The molar volume is a thermodynamic 00065 * function. 00066 * A full standard state does the same thing as a reference state, 00067 * but specifies the thermodynamics functions at all pressures. 00068 * 00069 * Class VPSSMgr is the base class 00070 * for a family of classes that compute properties of all 00071 * species in a phase in their standard states, for a range of temperatures 00072 * and pressures. 00073 * 00074 * Phases which use the VPSSMGr class must have their respective 00075 * ThermoPhase objects actually be derivatives of the VPStandardState 00076 * class. These classes assume that there exists a standard state 00077 * for each species in the phase, where the Thermodynamic functions are specified 00078 * as a function of temperature and pressure. Standard state thermo objects for each 00079 * species in the phase are all derived from the PDSS virtual base class. 00080 * Calculators for these 00081 * standard state thermo , which coordinate the calculation for all of the species 00082 * in a phase, are all derived from VPSSMgr. 00083 * In turn, these standard states may employ reference state calculation to 00084 * aid in their calculations. And the VPSSMgr calculators may also employ 00085 * SimpleThermo calculators to help in calculating the properties for all of the 00086 * species in a phase. However, there are some PDSS objects which do not employ 00087 * reference state calculations. An example of this is a real equation of state for 00088 * liquid water used within the calculation of brine thermodynamcis. 00089 * 00090 * Typically calls to calculate standard state thermo properties are virtual calls 00091 * at the ThermoPhase level. It is left to the child classes of ThermoPhase to 00092 * specify how these are carried out. Usually, this will involve calling the 00093 * m_spthermo pointer to a SpeciesThermo object to calculate the reference state 00094 * thermodynamic properties. Then, the pressure dependence is added in within the 00095 * child ThermoPhase object to complete the specification of the standard state. 00096 * The VPStandardStateTP class, however, redefines the calls to the calculation of 00097 * standard state properties to use VPSSMgr class calls. A listing of 00098 * these classes and important pointers are supplied below. 00099 * 00100 * 00101 * - ThermoPhase 00102 * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink 00103 * This is a pointer to a %SpeciesThermo manager class that 00104 * handles the reference %state Thermodynamic calculations. 00105 * . 00106 * - VPStandardStateTP (inherits from %ThermoPhase) 00107 * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink 00108 * %SpeciesThermo manager handling reference %state Thermodynamic calculations. 00109 * may or may not be used by the VPSSMgr class. For species 00110 * which don't have a reference state class defined, a default 00111 * class, called STITbyPDSS which is installed into the SpeciesThermo 00112 * class, actually calculates reference state 00113 * thermo by calling a PDSS object. 00114 * - \link Cantera::VPStandardStateTP::m_VPSS_ptr m_VPSS_ptr\endlink 00115 * This is a pointer to a %VPSSMgr class which handles the 00116 * standard %state thermo calculations. It may 00117 * or may not use the pointer, m_spthermo, in its calculations. 00118 * . 00119 * . 00120 * 00121 * The following classes inherit from VPSSMgr. Each of these classes 00122 * handle multiple species and by definition all of the species in a phase. 00123 * It is a requirement that a VPSSMgr object handles all of the 00124 * species in a phase. 00125 * 00126 * 00127 * - VPSSMgr_IdealGas 00128 * - standardState model = "IdealGas" 00129 * - This model assumes that all species in the phase obey the 00130 * ideal gas law for their pressure dependence. The manager 00131 * uses a SpeciesThermo object to handle the calculation of the 00132 * reference state. 00133 * . 00134 * 00135 * - VPSSMgr_ConstVol 00136 * - standardState model = "ConstVol" 00137 * - This model assumes that all species in the phase obey the 00138 * constant partial molar volume pressure dependence. 00139 * The manager uses a SpeciesThermo object to handle the 00140 * calculation of the reference state. 00141 * . 00142 * 00143 * - VPSSMgr_Water_ConstVol 00144 * - standardState model = "Water_ConstVol" 00145 * - This model assumes that all species but one in the phase obey the 00146 * constant partial molar volume pressure dependence. 00147 * The manager uses a SpeciesThermo object to handle the 00148 * calculation of the reference state for those species. 00149 * Species 0 is assumed to be water, and a real equation 00150 * of state is used to model the T, P behavior. 00151 * . 00152 * 00153 * - VPSSMgr_Water_HKFT 00154 * - standardState model = "Water_HKFT" 00155 * - This model assumes that all species but one in the phase obey the 00156 * HKFT equation of state. 00157 * Species 0 is assumed to be water, and a real equation 00158 * of state is used to model the T, P behavior. 00159 * . 00160 * 00161 * - VPSSMgr_General 00162 * - standardState model = "General" 00163 * - This model is completely general. Nothing is assumed at this 00164 * level. Calls consist of loops to PDSS property evalulations. 00165 * . 00166 * . 00167 * 00168 * The choice of which VPSSMgr object to be used is implicitly made by 00169 * %Cantera by querying the XML data file for compatibility. 00170 * However, each of these VPSSMgr objects may be explicitly requested in the XML file 00171 * by adding in the following XML node into the thermo section of the 00172 * phase XML Node. For example, the code example listed below 00173 * explicitly requests that the VPSSMgr_IdealGas 00174 * object be used to handle the standard state thermodynamics calculations. 00175 * 00176 * @verbatim 00177 <phase id="Silane_Pyrolysis" dim="3"> 00178 . . . 00179 <thermo model="VPIdealGas"> 00180 <standardState model="IdealGas"> 00181 <\thermo> 00182 . . . 00183 <\phase> 00184 @endverbatim 00185 * 00186 * If it turns out that the VPSSMgr_IdealGas class can not handle the standard 00187 * state calculation, then %Cantera will fail during the instantiation phase 00188 * printing out an informative error message. 00189 * 00190 * In the source code listing above, the thermo model, VPIdealGas ,was requested. The 00191 * thermo model specifies the type of ThermoPhase object to use. In this case 00192 * the object IdealSolnGasVPSS (with the ideal gas suboption) is used. %IdealSolnGasVPSS 00193 * inherits from VPStandardStateTP, so that it actually has a VPSSMgr pointer 00194 * to be specified. Note, in addition to the IdealGas entry to the model 00195 * parameter in standardState node, we could have also specified the "General" 00196 * option. The general option will always work. An example of this 00197 * usage is listed below. 00198 * 00199 * @verbatim 00200 <phase id="Silane_Pyrolysis" dim="3"> 00201 . . . 00202 <thermo model="VPIdealGas"> 00203 <standardState model="General"> 00204 <\thermo> 00205 . . . 00206 <\phase> 00207 @endverbatim 00208 * 00209 * The "General" option will cause the VPSSMgr_General %VPSSMgr class to be used. 00210 * In this manager, the calculations are all handled at the PDSS object 00211 * level. This is completely general, but, may be significantly 00212 * slower. 00213 * 00214 * 00215 * @ingroup thermoprops 00216 */ 00217 00218 //! Virtual base class for the classes that manage the calculation 00219 //! of standard state properties for all the species in a phase. 00220 /*! 00221 * This class defines the interface which all subclasses must implement. 00222 * 00223 * Class %VPSSMgr is the base class 00224 * for a family of classes that compute properties of a set of 00225 * species in their standard state at a range of temperatures 00226 * and pressures. 00227 * 00228 * and pressure are unchanged. 00229 * 00230 * If #m_useTmpRefStateStorage is set to true, then the following internal 00231 * arrays, containing information about the reference arrays, 00232 * are calculated and kept up to date at every call. 00233 * 00234 * - #m_h0_RT 00235 * - #m_g0_RT 00236 * - #m_s0_R 00237 * - #m_cp0_R 00238 * 00239 * The virtual function #_updateRefStateThermo() is supplied to do this 00240 * and may be reimplemented in child routines. A default implementation 00241 * based on the speciesThermo class is supplied in this base class. 00242 * #_updateStandardStateThermo() is called whenever a reference state 00243 * property is needed. 00244 * 00245 * When #m_useTmpStandardStateStorage is true, then the following 00246 * internal arrays, containing information on the standard state properties 00247 * are calculated and kept up to date. 00248 * 00249 * - #m_hss_RT; 00250 * - #m_cpss_R; 00251 * - #m_gss_RT; 00252 * - #m_sss_R; 00253 * - #m_Vss 00254 * 00255 * The virtual function #_updateStandardStateThermo() is supplied to do this 00256 * and must be reimplemented in child routines, 00257 * when #m_useTmpStandardStateStorage is true. 00258 * It may be optionally reimplemented in child routines if 00259 * #m_useTmpStandardStateStorage is false. 00260 * #_updateStandardStateThermo() is called whenever a standard state property is needed. 00261 * 00262 * This class is usually used for nearly incompressible phases. For those phases, it 00263 * makes sense to change the equation of state independent variable from 00264 * density to pressure. 00265 * 00266 */ 00267 class VPSSMgr { 00268 00269 public: 00270 00271 //! Constructor 00272 /*! 00273 * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object 00274 * This object must have already been malloced. 00275 * 00276 * @param spth Pointer to the optional SpeciesThermo object 00277 * that will handle the calculation of the reference 00278 * state thermodynamic coefficients. 00279 */ 00280 VPSSMgr(VPStandardStateTP *vptp_ptr, SpeciesThermo *spth = 0); 00281 00282 //! Destructor 00283 virtual ~VPSSMgr(); 00284 00285 //! Copy Constructor for the %SpeciesThermo object. 00286 /*! 00287 * @param right Reference to %SpeciesThermo object to be copied into the 00288 * current one. 00289 */ 00290 VPSSMgr(const VPSSMgr &right); 00291 00292 //! Assignment operator for the %SpeciesThermo object 00293 /*! 00294 * This is NOT a virtual function. 00295 * 00296 * @param right Reference to %SpeciesThermo object to be copied into the 00297 * current one. 00298 */ 00299 VPSSMgr& operator=(const VPSSMgr &right); 00300 00301 //! Duplication routine for objects which inherit from 00302 //! %VPSSMgr 00303 /*! 00304 * This virtual routine can be used to duplicate %VPSSMgr objects 00305 * inherited from %VPSSMgr even if the application only has 00306 * a pointer to %VPSSMgr to work with. 00307 */ 00308 virtual VPSSMgr *duplMyselfAsVPSSMgr() const; 00309 00310 00311 /*! 00312 * @name Properties of the Standard State of the Species in the Solution 00313 * 00314 */ 00315 //@{ 00316 00317 //!Get the array of chemical potentials at unit activity. 00318 /*! 00319 * These are the standard state chemical potentials \f$ \mu^0_k(T,P) 00320 * \f$. The values are evaluated at the current temperature and pressure. 00321 * 00322 * @param mu Output vector of standard state chemical potentials. 00323 * length = m_kk. units are J / kmol. 00324 */ 00325 virtual void getStandardChemPotentials(doublereal* mu) const; 00326 00327 /** 00328 * Get the nondimensional Gibbs functions for the species 00329 * at their standard states of solution at the current T and P 00330 * of the solution. 00331 * 00332 * @param grt Output vector of nondimensional standard state 00333 * Gibbs free energies. length = m_kk. 00334 */ 00335 virtual void getGibbs_RT(doublereal* grt) const; 00336 00337 /** 00338 * Get the nondimensional Enthalpy functions for the species 00339 * at their standard states at the current 00340 * <I>T</I> and <I>P</I> of the solution. 00341 * 00342 * @param hrt Output vector of standard state enthalpies. 00343 * length = m_kk. units are unitless. 00344 */ 00345 virtual void getEnthalpy_RT(doublereal* hrt) const; 00346 00347 //! Return a reference to a vector of the molar enthalpies of the 00348 //! species in their standard states 00349 const vector_fp& enthalpy_RT() const { 00350 return m_hss_RT; 00351 } 00352 00353 /** 00354 * Get the array of nondimensional Enthalpy functions for the 00355 * standard state species 00356 * at the current <I>T</I> and <I>P</I> of the solution. 00357 * 00358 * @param sr Output vector of nondimensional standard state 00359 * entropies. length = m_kk. 00360 */ 00361 virtual void getEntropy_R(doublereal* sr) const; 00362 00363 //! Return a reference to a vector of the entropies of the 00364 //! species 00365 const vector_fp& entropy_R() const { 00366 return m_sss_R; 00367 } 00368 00369 //! Returns the vector of nondimensional 00370 //! internal Energies of the standard state at the current temperature 00371 //! and pressure of the solution for each species. 00372 /*! 00373 * The internal energy is calculated from the enthalpy from the 00374 * following formula: 00375 * 00376 * \f[ 00377 * u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k 00378 * \f] 00379 * 00380 * @param urt Output vector of nondimensional standard state 00381 * internal energies. length = m_kk. 00382 */ 00383 virtual void getIntEnergy_RT(doublereal *urt) const; 00384 00385 //! Get the nondimensional Heat Capacities at constant 00386 //! pressure for the standard state of the species 00387 //! at the current T and P. 00388 /*! 00389 * 00390 * This is redefined here to call the internal function, _updateStandardStateThermo(), 00391 * which calculates all standard state properties at the same time. 00392 * 00393 * @param cpr Output vector containing the 00394 * the nondimensional Heat Capacities at constant 00395 * pressure for the standard state of the species. 00396 * Length: m_kk. 00397 */ 00398 virtual void getCp_R(doublereal* cpr) const; 00399 00400 //! Return a reference to a vector of the constant pressure 00401 //! heat capacities of the species 00402 const vector_fp& cp_R() const { 00403 return m_cpss_R; 00404 } 00405 00406 //! Get the molar volumes of each species in their standard 00407 //! states at the current 00408 //! <I>T</I> and <I>P</I> of the solution. 00409 /*! 00410 * units = m^3 / kmol 00411 * 00412 * This is redefined here to call the internal function, 00413 * _updateStandardStateThermo(), 00414 * which calculates all standard state properties at the same time. 00415 * 00416 * @param vol Output vector of species volumes. length = m_kk. 00417 * units = m^3 / kmol 00418 */ 00419 virtual void getStandardVolumes(doublereal *vol) const; 00420 00421 //! Return a reference to a vector of the species standard molar volumes 00422 const vector_fp& standardVolumes() const { 00423 return m_Vss; 00424 } 00425 00426 public: 00427 00428 //@} 00429 /// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP) 00430 /*! 00431 * There are also temporary 00432 * variables for holding the species reference-state values of Cp, H, S, and V at the 00433 * last temperature and reference pressure called. These functions 00434 * are not recalculated 00435 * if a new call is made using the previous temperature. 00436 * All calculations are done within the routine _updateRefStateThermo(). 00437 */ 00438 //@{ 00439 00440 /*! 00441 * Returns the vector of nondimensional 00442 * enthalpies of the reference state at the current temperature 00443 * of the solution and the reference pressure for the species. 00444 * 00445 * @param hrt Output vector contains the nondimensional enthalpies 00446 * of the reference state of the species 00447 * length = m_kk, units = dimensionless. 00448 */ 00449 virtual void getEnthalpy_RT_ref(doublereal *hrt) const; 00450 00451 /*! 00452 * Returns the vector of nondimensional 00453 * Gibbs free energies of the reference state at the current temperature 00454 * of the solution and the reference pressure for the species. 00455 * 00456 * @param grt Output vector contains the nondimensional Gibbs free energies 00457 * of the reference state of the species 00458 * length = m_kk, units = dimensionless. 00459 */ 00460 virtual void getGibbs_RT_ref(doublereal *grt) const ; 00461 00462 00463 //! Return a reference to the vector of Gibbs free energies of the species 00464 const vector_fp & Gibbs_RT_ref() const { 00465 return m_g0_RT; 00466 } 00467 00468 /*! 00469 * Returns the vector of the 00470 * gibbs function of the reference state at the current temperature 00471 * of the solution and the reference pressure for the species. 00472 * units = J/kmol 00473 * 00474 * @param g Output vector contain the Gibbs free energies 00475 * of the reference state of the species 00476 * length = m_kk, units = J/kmol. 00477 */ 00478 virtual void getGibbs_ref(doublereal *g) const ; 00479 00480 /*! 00481 * Returns the vector of nondimensional 00482 * entropies of the reference state at the current temperature 00483 * of the solution and the reference pressure for the species. 00484 * 00485 * @param er Output vector contain the nondimensional entropies 00486 * of the species in their reference states 00487 * length: m_kk, units: dimensionless. 00488 */ 00489 virtual void getEntropy_R_ref(doublereal *er) const ; 00490 00491 /*! 00492 * Returns the vector of nondimensional 00493 * constant pressure heat capacities of the reference state 00494 * at the current temperature of the solution 00495 * and reference pressure for the species. 00496 * 00497 * @param cpr Output vector contains the nondimensional heat capacities 00498 * of the species in their reference states 00499 * length: m_kk, units: dimensionless. 00500 */ 00501 virtual void getCp_R_ref(doublereal *cpr) const ; 00502 00503 //! Get the molar volumes of the species reference states at the current 00504 //! <I>T</I> and <I>P_ref</I> of the solution. 00505 /*! 00506 * units = m^3 / kmol 00507 * 00508 * @param vol Output vector containing the standard state volumes. 00509 * Length: m_kk. 00510 */ 00511 virtual void getStandardVolumes_ref(doublereal *vol) const ; 00512 00513 //@} 00514 /// @name Setting the Internal State of the System 00515 /*! 00516 * All calls to change the internal state of the system's T and P 00517 * are done through these routines 00518 * - setState_TP() 00519 * - setState_T() 00520 * - setState_P() 00521 * 00522 * These routine in turn call the following underlying virtual functions 00523 * 00524 * - _updateRefStateThermo() 00525 * - _updateStandardStateThermo() 00526 * 00527 * An important point to note is that inbetween calls the assumption 00528 * that the underlying PDSS objects will retain their set Temperatures 00529 * and Pressure CAN NOT BE MADE. For efficiency reasons, we may twiddle 00530 * these to get derivatives. 00531 */ 00532 //@{ 00533 00534 //! Set the temperature (K) and pressure (Pa) 00535 /*! 00536 * This sets the temperature and pressure and triggers 00537 * calculation of underlying quantities 00538 * 00539 * @param T Temperature (K) 00540 * @param P Pressure (Pa) 00541 */ 00542 virtual void setState_TP(doublereal T, doublereal P); 00543 00544 //! Set the temperature (K) 00545 /*! 00546 * @param T Temperature (K) 00547 */ 00548 virtual void setState_T(doublereal T); 00549 00550 //! Set the pressure (Pa) 00551 /*! 00552 * @param P Pressure (Pa) 00553 */ 00554 virtual void setState_P(doublereal P); 00555 00556 //! Return the temperatue storred in the object 00557 doublereal temperature() const { 00558 return m_tlast; 00559 } 00560 00561 //! Return the pressure storred in the object 00562 doublereal pressure() const { 00563 return m_plast; 00564 } 00565 00566 //! Return the pointer to the reference-state Thermo calculator 00567 //! SpeciesThermo object. 00568 SpeciesThermo *SpeciesThermoMgr() { 00569 return m_spthermo; 00570 } 00571 00572 //! Updates the internal standard state thermodynamic vectors at the 00573 //! current T and P of the solution. 00574 /*! 00575 * If you are to peak internally inside the object, you need to 00576 * call these functions after setState functions in order to be sure 00577 * that the vectors are current. 00578 */ 00579 virtual void updateStandardStateThermo(); 00580 00581 //! Updates the internal reference state thermodynamic vectors at the 00582 //! current T of the solution and the reference pressure. 00583 /*! 00584 * If you are to peak internally inside the object, you need to 00585 * call these functions after setState functions in order to be sure 00586 * that the vectors are current. 00587 */ 00588 virtual void updateRefStateThermo() const; 00589 00590 protected: 00591 00592 //! Updates the standard state thermodynamic functions at the 00593 //! current T and P of the solution. 00594 /*! 00595 * @internal 00596 * 00597 * If m_useTmpStandardStateStorage is true, 00598 * this function must be called for every call to functions in this 00599 * class. It checks to see whether the temperature or pressure has changed and 00600 * thus the ss thermodynamics functions for all of the species 00601 * must be recalculated. 00602 * 00603 * This function is responsible for updating the following internal members, 00604 * when m_useTmpStandardStateStorage is true. 00605 * 00606 * - m_hss_RT; 00607 * - m_cpss_R; 00608 * - m_gss_RT; 00609 * - m_sss_R; 00610 * - m_Vss 00611 * 00612 * If m_useTmpStandardStateStorage is not true, this function may be 00613 * required to be called by child classes to update internal member data. 00614 * 00615 * Note, this will throw an error. It must be reimplemented in derived classes. 00616 * 00617 * Underscore updates never check for the state of the system 00618 * They just do the calculation. 00619 */ 00620 virtual void _updateStandardStateThermo(); 00621 00622 //! Updates the reference state thermodynamic functions at the 00623 //! current T of the solution and the reference pressure 00624 /*! 00625 * Underscore updates never check for the state of the system 00626 * They just do the calculation. 00627 */ 00628 virtual void _updateRefStateThermo () const; 00629 00630 public: 00631 //@} 00632 //! @name Utility Methods - Reports on various quantities 00633 /*! 00634 * The following methods are used in the process of reporting 00635 * various states and attributes 00636 */ 00637 //@{ 00638 00639 //! This utility function reports the type of parameterization 00640 //! used for the species with index number index. 00641 /*! 00642 * 00643 * @param index Species index 00644 */ 00645 virtual PDSS_enumType reportPDSSType(int index = -1) const ; 00646 00647 00648 //! This utility function reports the type of manager 00649 //! for the calculation of ss properties 00650 /*! 00651 * @return Returns an enum type called VPSSMgr_enumType, which is a list 00652 * of the known VPSSMgr objects 00653 */ 00654 virtual VPSSMgr_enumType reportVPSSMgrType() const ; 00655 00656 //! Minimum temperature. 00657 /*! 00658 * If no argument is supplied, this 00659 * method returns the minimum temperature for which \e all 00660 * parameterizations are valid. If an integer index k is 00661 * supplied, then the value returned is the minimum 00662 * temperature for species k in the phase. 00663 * 00664 * @param k Species index 00665 */ 00666 virtual doublereal minTemp(int k=-1) const ; 00667 00668 //! Maximum temperature. 00669 /*! 00670 * If no argument is supplied, this 00671 * method returns the maximum temperature for which \e all 00672 * parameterizations are valid. If an integer index k is 00673 * supplied, then the value returned is the maximum 00674 * temperature for parameterization k. 00675 * 00676 * @param k Species Index 00677 */ 00678 virtual doublereal maxTemp(int k=-1) const; 00679 00680 //! The reference-state pressure for the standard state 00681 /*! 00682 * 00683 * returns the reference state pressure in Pascals for 00684 * species k. If k is left out of the argument list, 00685 * it returns the reference state pressure for the first 00686 * species. 00687 * Note that some SpeciesThermo implementations, such 00688 * as those for ideal gases, require that all species 00689 * in the same phase have the same reference state pressures. 00690 * 00691 * @param k Species index. Default is -1, which returns 00692 * the generic answer. 00693 */ 00694 virtual doublereal refPressure(int k = -1) const ; 00695 00696 00697 //@} 00698 //! @name Initialization Methods - For Internal use (VPStandardState) 00699 /*! 00700 * The following methods are used in the process of constructing 00701 * the phase and setting its parameters from a specification in an 00702 * input file. They are not normally used in application programs. 00703 * To see how they are used, see files importCTML.cpp and 00704 * ThermoFactory.cpp. 00705 */ 00706 //@{ 00707 00708 //! @internal Initialize the object 00709 /*! 00710 * This method is provided to allow 00711 * subclasses to perform any initialization required after all 00712 * species have been added. For example, it might be used to 00713 * resize internal work arrays that must have an entry for 00714 * each species. The base class implementation does nothing, 00715 * and subclasses that do not require initialization do not 00716 * need to overload this method. When importing a CTML phase 00717 * description, this method is called just prior to returning 00718 * from function importPhase(). 00719 * 00720 * @see importCTML.cpp 00721 */ 00722 virtual void initThermo(); 00723 00724 //! Initialize the lengths within the object 00725 /*! 00726 * Note this function is not virtual 00727 */ 00728 void initLengths(); 00729 00730 //! Finalize the thermo after all species have been entered 00731 /*! 00732 * This function is the LAST initialization routine to be 00733 * called. It's called after createInstallPDSS() has been 00734 * called for each species in the phase, and after initThermo() 00735 * has been called. 00736 * It's called via an inner-to-outer onion shell like manner. 00737 * 00738 * In this routine, we currently calculate the reference pressure, 00739 * the minimum and maximum temperature for the applicability 00740 * of the thermo formulation. 00741 * 00742 * @param phaseNode Reference to the phaseNode XML node. 00743 * @param id ID of the phase. 00744 */ 00745 virtual void initThermoXML(XML_Node& phaseNode, std::string id); 00746 00747 //! Install specific content for species k in the reference-state 00748 //! thermodynamic SpeciesManager object 00749 /*! 00750 * This occurs before matrices are sized appropriately. 00751 * 00752 * @param k Species index in the phase 00753 * @param speciesNode XML Node corresponding to the species 00754 * @param phaseNode_ptr Pointer to the XML Node corresponding 00755 * to the phase which owns the species 00756 */ 00757 void installSTSpecies(int k, const XML_Node& speciesNode, 00758 const XML_Node *phaseNode_ptr); 00759 00760 //! Install specific content for species k in the standard-state 00761 //! thermodynamic calculator and also create/return a PDSS object 00762 //! for that species. 00763 /*! 00764 * This occurs before matrices are sized appropriately. 00765 * 00766 * @param k Species index in the phase 00767 * @param speciesNode XML Node corresponding to the species 00768 * @param phaseNode_ptr Pointer to the XML Node corresponding 00769 * to the phase which owns the species 00770 */ 00771 virtual PDSS * createInstallPDSS(int k, const XML_Node& speciesNode, 00772 const XML_Node * const phaseNode_ptr); 00773 00774 00775 //! Initialize the internal shallow pointers in this object 00776 /*! 00777 * There are a bunch of internal shallow pointers that point to the owning 00778 * VPStandardStateTP and SpeciesThermo objects. This function reinitializes 00779 * them. This function is called like an onion. 00780 * 00781 * @param vp_ptr Pointer to the VPStandardStateTP standard state 00782 * @param sp_ptr Poitner to the SpeciesThermo standard state 00783 */ 00784 virtual void initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr); 00785 00786 protected: 00787 00788 //! Number of species in the phase 00789 int m_kk; 00790 00791 //! Variable pressure ThermoPhase object 00792 VPStandardStateTP *m_vptp_ptr; 00793 00794 //! Pointer to reference state thermo calculator 00795 /*! 00796 * Note, this can have a value of 0 00797 */ 00798 SpeciesThermo *m_spthermo; 00799 00800 //! The last temperature at which the standard state thermodynamic 00801 //! properties were calculated at. 00802 mutable doublereal m_tlast; 00803 00804 //! The last pressure at which the Standard State thermodynamic 00805 //! properties were calculated at. 00806 mutable doublereal m_plast; 00807 00808 /*! 00809 * Reference pressure (Pa) must be the same for all species 00810 * - defaults to 1 atm. 00811 */ 00812 mutable doublereal m_p0; 00813 00814 //! minimum temperature for the standard state calculations 00815 doublereal m_minTemp; 00816 00817 //! maximum temperature for the standard state calculations 00818 doublereal m_maxTemp; 00819 00820 /*! 00821 * boolean indicating whether temporary reference state storage is used 00822 * -> default is false 00823 */ 00824 bool m_useTmpRefStateStorage; 00825 00826 /*! 00827 * Vector containing the species reference enthalpies at T = m_tlast 00828 * and P = p_ref. 00829 */ 00830 mutable vector_fp m_h0_RT; 00831 00832 /** 00833 * Vector containing the species reference constant pressure 00834 * heat capacities at T = m_tlast and P = p_ref. 00835 */ 00836 mutable vector_fp m_cp0_R; 00837 00838 /** 00839 * Vector containing the species reference Gibbs functions 00840 * at T = m_tlast and P = p_ref. 00841 */ 00842 mutable vector_fp m_g0_RT; 00843 00844 /** 00845 * Vector containing the species reference entropies 00846 * at T = m_tlast and P = p_ref. 00847 */ 00848 mutable vector_fp m_s0_R; 00849 00850 //! Vector containing the species referenc molar volumes 00851 mutable vector_fp m_V0; 00852 00853 /*! 00854 * boolean indicating whether temporary standard state storage is used 00855 * -> default is false 00856 */ 00857 bool m_useTmpStandardStateStorage; 00858 00859 /** 00860 * Vector containing the species Standard State enthalpies at T = m_tlast 00861 * and P = m_plast. 00862 */ 00863 mutable vector_fp m_hss_RT; 00864 00865 /** 00866 * Vector containing the species Standard State constant pressure 00867 * heat capacities at T = m_tlast and P = m_plast. 00868 */ 00869 mutable vector_fp m_cpss_R; 00870 00871 /** 00872 * Vector containing the species Standard State Gibbs functions 00873 * at T = m_tlast and P = m_plast. 00874 */ 00875 mutable vector_fp m_gss_RT; 00876 00877 /** 00878 * Vector containing the species Standard State entropies 00879 * at T = m_tlast and P = m_plast. 00880 */ 00881 mutable vector_fp m_sss_R; 00882 00883 /** 00884 * Vector containing the species standard state volumes 00885 * at T = m_tlast and P = m_plast 00886 */ 00887 mutable vector_fp m_Vss; 00888 00889 00890 //! species reference enthalpies - used by individual PDSS objects 00891 /*! 00892 * Vector containing the species reference enthalpies at T = m_tlast 00893 * and P = p_ref. 00894 */ 00895 mutable vector_fp mPDSS_h0_RT; 00896 00897 //! species reference heat capacities - used by individual PDSS objects 00898 /** 00899 * Vector containing the species reference constant pressure 00900 * heat capacities at T = m_tlast and P = p_ref. 00901 */ 00902 mutable vector_fp mPDSS_cp0_R; 00903 00904 //! species reference gibbs free energies - used by individual PDSS objects 00905 /** 00906 * Vector containing the species reference Gibbs functions 00907 * at T = m_tlast and P = p_ref. 00908 */ 00909 mutable vector_fp mPDSS_g0_RT; 00910 00911 //! species reference entropies - used by individual PDSS objects 00912 /** 00913 * Vector containing the species reference entropies 00914 * at T = m_tlast and P = p_ref. 00915 */ 00916 mutable vector_fp mPDSS_s0_R; 00917 00918 00919 //! species reference state molar Volumes - used by individual PDSS objects 00920 /** 00921 * Vector containing the rf molar volumes 00922 * at T = m_tlast and P = p_ref. 00923 */ 00924 mutable vector_fp mPDSS_V0; 00925 00926 //! species standard state enthalpies - used by individual PDSS objects 00927 /*! 00928 * Vector containing the species standard state enthalpies at T = m_tlast 00929 * and P = p_ref. 00930 */ 00931 mutable vector_fp mPDSS_hss_RT; 00932 00933 //! species standard state heat capacities - used by individual PDSS objects 00934 /** 00935 * Vector containing the species standard state constant pressure 00936 * heat capacities at T = m_tlast and P = p_ref. 00937 */ 00938 mutable vector_fp mPDSS_cpss_R; 00939 00940 //! species standard state gibbs free energies - used by individual PDSS objects 00941 /** 00942 * Vector containing the species standard state Gibbs functions 00943 * at T = m_tlast and P = p_ref. 00944 */ 00945 mutable vector_fp mPDSS_gss_RT; 00946 00947 //! species standard state entropies - used by individual PDSS objects 00948 /** 00949 * Vector containing the species standard state entropies 00950 * at T = m_tlast and P = p_ref. 00951 */ 00952 mutable vector_fp mPDSS_sss_R; 00953 00954 //! species standard state molar Volumes - used by individual PDSS objects 00955 /** 00956 * Vector containing the ss molar volumes 00957 * at T = m_tlast and P = p_ref. 00958 */ 00959 mutable vector_fp mPDSS_Vss; 00960 00961 00962 friend class PDSS; 00963 private: 00964 00965 //! Error message to indicate an unimplemented feature 00966 /*! 00967 * @param msg Error message string 00968 */ 00969 void err(std::string msg) const; 00970 00971 }; 00972 //@} 00973 } 00974 00975 #endif