PDSS_SSVol.h

Go to the documentation of this file.
00001 /**
00002  *  @file PDSS_SSVol.h
00003  *    Declarations for the class PDSS_SSVol (pressure dependent standard state)
00004  *    which handles calculations for a single species with an expression for the standard state molar volume in a phase
00005  *    given by an enumerated data type
00006  *    (see class \ref pdssthermo and \link Cantera::PDSS_SSVol PDSS_SSVol\endlink).
00007  */
00008 /*
00009  * Copywrite (2009) Sandia Corporation. Under the terms of
00010  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
00011  * U.S. Government retains certain rights in this software.
00012  */
00013 /*
00014  *  $Id: PDSS_SSVol.h 279 2009-12-05 19:08:43Z hkmoffa $
00015  */
00016 
00017 #ifndef CT_PDSS_SSVOL_H
00018 #define CT_PDSS_SSVOL_H
00019 
00020 #include "PDSS.h"
00021 
00022 namespace Cantera {
00023   class XML_Node;
00024   class VPStandardStateTP;
00025 
00026   //! Class for pressure dependent standard states that uses a standard state volume 
00027   //! model of some sort.
00028   /*!
00029    *   Class PDSS_SSVol is an implementation class that compute the properties of a single
00030    *   species in a phase at its standard states, for a range of temperatures
00031    *   and pressures. This particular class assumes that the calculation of the
00032    *   thermodynamics functions can be separated into a temperature polynomial representation
00033    *   for thermo functions that can be handled bey a SimpleThermo object and
00034    *   a separate calculation for the standard state volume.
00035    *   The Models include a cubic polynomial in temperature for either
00036    *   the standard state volume or the standard state density.
00037    *   The manager uses a SimpleThermo object to handle the
00038    *   calculation of the reference state. This object then adds the
00039    *   pressure dependencies and the volume terms to these thermo functions
00040    *   to complete the representation.
00041    *
00042    *   The class includes the following models for the representation of the
00043    *   standard state volume:
00044    *
00045    *      - Constant Volume
00046    *        - This standard state model is invoked with the keyword "constant_incompressible" 
00047    *          or "constant". The standard state volume is considered constant.
00048    *          \f[
00049    *            V^o_k(T,P) = a_0
00050    *          \f]
00051    *        .
00052    *
00053    *      - Temperature polynomial for the standard state volume
00054    *        - This standard state model is invoked with the keyword "temperature_polynomial".
00055    *          The standard state volume is considered a function of temperature only.
00056    *          \f[
00057    *            V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
00058    *          \f]
00059    *        .
00060    *
00061    *      - Temperature polynomial for the standard state density
00062    *        - This standard state model is invoked with the keyword "density_temperature_polynomial".
00063    *          The standard state density, which is the inverse of the volume,
00064    *          is considered a function of temperature only.
00065    *         \f[
00066    *            {\rho}^o_k(T,P) = \frac{M_k}{V^o_k(T,P)} = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
00067    *         \f]
00068    *        .
00069    *      .
00070    *
00071    * <b> Specification of Species Standard %State Properties </b>
00072    *
00073    *  The standard molar Gibbs free energy for species <I>k</I> is determined from the enthalpy
00074    *  and entropy expressions
00075    *
00076    *       \f[
00077    *            G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P)
00078    *       \f]
00079    *
00080    *  The enthalpy is calculated mostly from the %SpeciesThermo object's enthalpy evalulator. The
00081    *  dependence on pressure originates from the Maxwell relation
00082    *
00083    *       \f[
00084    *            {\left(\frac{dH^o_k}{dP}\right)}_T = T  {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k
00085    *       \f]
00086    *  which is equal to 
00087    *
00088    *       \f[
00089    *            {\left(\frac{dH^o_k}{dP}\right)}_T =  V^o_k -  T  {\left(\frac{dV^o_k}{dT}\right)}_P 
00090    *       \f]
00091    *
00092    *  The entropy is calculated mostly from the %SpeciesThermo objects entropy evalulator. The
00093    *  dependence on pressure originates from the Maxwell relation:
00094    *
00095    *       \f[
00096    *              {\left(\frac{dS^o_k}{dP}\right)}_T =  - {\left(\frac{dV^o_k}{dT}\right)}_P
00097    *       \f]
00098    *
00099    *  The standard state constant-pressure heat capacity expression is obtained from taking the
00100    *  temperature derivative of the Maxwell relation involving the enthalpy given above
00101    *  to yield an expression for the pressure dependence of the heat capacity.
00102    *
00103    *       \f[
00104    *            {\left(\frac{d{C}^o_{p,k}}{dP}\right)}_T =  - T  {\left(\frac{{d}^2{V}^o_k}{{dT}^2}\right)}_T
00105    *       \f]
00106    * 
00107    *  The standard molar Internal Energy for species <I>k</I> is determined from the following
00108    *  relation.
00109    *
00110    *       \f[
00111    *            U^o_k(T,P) = H^o_k(T,P) - p V^o_k 
00112    *       \f]
00113    *
00114    * <b> XML Example </b>
00115    *
00116    *   An example of the specification of a standard state for the LiCl molten salt
00117    *   which employs a constant molar volume expression.
00118    *
00119     @verbatim
00120     <speciesData id="species_MoltenSalt">
00121     <species name="LiCl(L)">
00122       <atomArray> Li:1 Cl:1 </atomArray>
00123       <standardState  model="constant_incompressible">
00124          <molarVolume> 0.02048004 </molarVolume>
00125       </standardState>
00126       <thermo>
00127         <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
00128           <floatArray size="7">
00129            73.18025, -9.047232, -0.316390,
00130            0.079587, 0.013594, -417.1314,
00131            157.6711
00132           </floatArray>
00133         </Shomate>
00134       </thermo>
00135     </species>  
00136     </speciesData>
00137     @endverbatim
00138    *
00139    *   An example of the specification of a standard state for the LiCl molten salt
00140    *   which has a temperature dependent standard state volume.
00141    *
00142    @verbatim 
00143    <speciesData id="species_MoltenSalt">
00144    <species name="LiCl(L)">
00145       <atomArray> Li:1 Cl:1 </atomArray>
00146       <standardState  model="density_temperature_polynomial">
00147          <densityTemperaturePolynomial units="gm/cm3" >
00148             1.98715, -5.890906E-4, 0.0, 0.0
00149          </densityTemperaturePolynomial>
00150       </standardState>
00151       <thermo>
00152         <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
00153           <floatArray size="7">
00154             73.18025, -9.047232, -0.316390,
00155             0.079587, 0.013594, -417.1314,
00156             157.6711
00157           </floatArray>
00158         </Shomate>
00159       </thermo>
00160     </species>
00161     </speciesData>
00162    @endverbatim
00163    *   
00164    *
00165    * @ingroup pdssthermo
00166    */
00167   class PDSS_SSVol : public PDSS {
00168 
00169   public:
00170   
00171     /**
00172      * @name  Constructors
00173      * @{
00174      */
00175 
00176     //! Constructor
00177     /*!
00178      *  @param tp        Pointer to the ThermoPhase object pertaining to the phase
00179      *  @param spindex   Species index of the species in the phase
00180      */
00181     PDSS_SSVol(VPStandardStateTP *tp, int spindex);
00182 
00183 
00184     //! Constructor that initializes the object by examining the input file
00185     //! of the ThermoPhase object
00186     /*!
00187      *  This function calls the constructPDSSFile member function.
00188      * 
00189      *  @param tp        Pointer to the ThermoPhase object pertaining to the phase
00190      *  @param spindex   Species index of the species in the phase
00191      *  @param inputFile String name of the input file
00192      *  @param id        String name of the phase in the input file. The default
00193      *                   is the empty string, in which case the first phase in the
00194      *                   file is used.
00195      */
00196     PDSS_SSVol(VPStandardStateTP *tp, int spindex,
00197                  std::string inputFile, std::string id = "");
00198 
00199     //! Constructor that initializes the object by examining the input file
00200     //! of the ThermoPhase object
00201     /*!
00202      *  This function calls the constructPDSSXML member function.
00203      * 
00204      *  @param vptp_ptr    Pointer to the ThermoPhase object pertaining to the phase
00205      *  @param spindex     Species index of the species in the phase
00206      *  @param speciesNode Reference to the species XML tree.
00207      *  @param phaseRef    Reference to the XML tree containing the phase information.
00208      *  @param spInstalled Boolean indicating whether the species is installed yet
00209      *                     or not.
00210      */
00211     PDSS_SSVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode, 
00212                   const XML_Node& phaseRef, bool spInstalled);
00213 
00214     //! Copy Constructur
00215     /*!
00216      * @param b Object to be copied
00217      */
00218     PDSS_SSVol(const PDSS_SSVol &b);
00219 
00220     //! Assignment operator
00221     /*!
00222      * @param b Object to be copeid
00223      */
00224     PDSS_SSVol& operator=(const PDSS_SSVol&b);
00225 
00226     //! Destructor
00227     virtual ~PDSS_SSVol();
00228 
00229     //! Duplicator
00230     virtual PDSS *duplMyselfAsPDSS() const;
00231         
00232     /**
00233      * @}
00234      * @name  Utilities  
00235      * @{
00236      */
00237 
00238     /**
00239      * @} 
00240      * @name  Molar Thermodynamic Properties of the Species Standard State
00241      *        in the Solution
00242      * @{
00243      */
00244   
00245     //! Return the molar enthalpy in units of J kmol-1
00246     /*!
00247      * Returns the species standard state enthalpy in J kmol-1 at the
00248      * current temperature and pressure.
00249      *
00250      * @return returns the species standard state enthalpy in  J kmol-1
00251      */
00252     virtual doublereal enthalpy_mole() const;
00253 
00254     //! Return the standard state molar enthalpy divided by RT
00255     /*!
00256      * Returns the species standard state enthalpy divided by RT at the
00257      * current temperature and pressure.
00258      *
00259      * @return returns the species standard state enthalpy in unitless form
00260      */
00261     virtual doublereal enthalpy_RT() const;
00262 
00263     //! Return the molar internal Energy in units of J kmol-1
00264     /*!
00265      * Returns the species standard state internal Energy in J kmol-1 at the
00266      * current temperature and pressure.
00267      *
00268      * @return returns the species standard state internal Energy in  J kmol-1
00269      */
00270     virtual doublereal intEnergy_mole() const;
00271 
00272     //! Return the molar entropy in units of J kmol-1 K-1
00273     /*!
00274      * Returns the species standard state entropy in J kmol-1 K-1 at the
00275      * current temperature and pressure.
00276      *
00277      * @return returns the species standard state entropy in J kmol-1 K-1
00278      */
00279     virtual doublereal entropy_mole() const;
00280 
00281     //! Return the standard state entropy divided by RT
00282     /*!
00283      * Returns the species standard state entropy divided by RT at the
00284      * current temperature and pressure.
00285      *
00286      * @return returns the species standard state entropy divided by RT
00287      */
00288     virtual doublereal entropy_R() const;
00289 
00290     //! Return the molar gibbs free energy in units of J kmol-1
00291     /*!
00292      * Returns the species standard state gibbs free energy in J kmol-1 at the
00293      * current temperature and pressure.
00294      *
00295      * @return returns the species standard state gibbs free energy in  J kmol-1
00296      */
00297     virtual doublereal gibbs_mole() const;
00298 
00299     //! Return the molar gibbs free energy divided by RT
00300     /*!
00301      * Returns the species standard state gibbs free energy divided by RT at the
00302      * current temperature and pressure.
00303      *
00304      * @return returns the species standard state gibbs free energy divided by RT
00305      */
00306     virtual doublereal gibbs_RT() const;
00307 
00308     //! Return the molar const pressure heat capacity in units of J kmol-1 K-1
00309     /*!
00310      * Returns the species standard state Cp in J kmol-1 K-1 at the
00311      * current temperature and pressure.
00312      *
00313      * @return returns the species standard state Cp in J kmol-1 K-1
00314      */
00315     virtual doublereal cp_mole() const;
00316 
00317     //! Return the molar const pressure heat capacity divided by RT
00318     /*!
00319      * Returns the species standard state Cp divided by RT at the
00320      * current temperature and pressure.
00321      *
00322      * @return returns the species standard state Cp divided by RT
00323      */
00324     virtual doublereal cp_R() const;
00325 
00326     //! Return the molar const volume heat capacity in units of J kmol-1 K-1
00327     /*!
00328      * Returns the species standard state Cv in J kmol-1 K-1 at the
00329      * current temperature and pressure.
00330      *
00331      * @return returns the species standard state Cv in J kmol-1 K-1
00332      */
00333     virtual doublereal cv_mole() const;
00334 
00335     //! Return the molar volume at standard state
00336     /*!
00337      * Returns the species standard state molar volume at the
00338      * current temperature and pressure
00339      *
00340      * @return returns the standard state molar volume divided by R
00341      *             units are m**3 kmol-1.
00342      */
00343     virtual doublereal molarVolume() const;
00344 
00345    //! Return the standard state density at standard state
00346     /*!
00347      * Returns the species standard state density at the
00348      * current temperature and pressure
00349      *
00350      * @return returns the standard state density
00351      *             units are kg m-3
00352      */
00353     virtual doublereal density() const;
00354 
00355     /**
00356      * @} 
00357      * @name Properties of the Reference State of the Species
00358      *       in the Solution 
00359      * @{
00360      */
00361 
00362     //! Return the molar gibbs free energy divided by RT at reference pressure
00363     /*!
00364      * Returns the species reference state gibbs free energy divided by RT at the
00365      * current temperature.
00366      *
00367      * @return returns the reference state gibbs free energy divided by RT
00368      */
00369     virtual doublereal gibbs_RT_ref() const;
00370 
00371     //! Return the molar enthalpy divided by RT at reference pressure
00372     /*!
00373      * Returns the species reference state enthalpy divided by RT at the
00374      * current temperature.
00375      *
00376      * @return returns the reference state enthalpy divided by RT
00377      */
00378     virtual doublereal enthalpy_RT_ref() const;
00379 
00380     //! Return the molar entropy divided by R at reference pressure
00381     /*!
00382      * Returns the species reference state entropy divided by R at the
00383      * current temperature.
00384      *
00385      * @return returns the reference state entropy divided by R
00386      */
00387     virtual doublereal entropy_R_ref() const;
00388 
00389     //! Return the molar heat capacity divided by R at reference pressure
00390     /*!
00391      * Returns the species reference state heat capacity divided by R at the
00392      * current temperature.
00393      *
00394      * @return returns the reference state heat capacity divided by R
00395      */
00396     virtual doublereal cp_R_ref() const;
00397 
00398     //! Return the molar volume at reference pressure
00399     /*!
00400      * Returns the species reference state molar volume at the
00401      * current temperature.
00402      *
00403      * @return returns the reference state molar volume divided by R
00404      *             units are m**3 kmol-1.
00405      */
00406     virtual doublereal molarVolume_ref() const;
00407 
00408   private:
00409   
00410     //! Does the internal calculation of the volume
00411     /*!
00412      *
00413      */
00414     void calcMolarVolume() const;
00415 
00416     /**
00417      * @}
00418      *  @name Mechanical Equation of State Properties 
00419      * @{
00420      */
00421 
00422     //! Sets the pressure in the object
00423     /*!
00424      * Currently, this sets the pressure in the PDSS object.
00425      * It is indeterminant what happens to the owning VPStandardStateTP
00426      * object and to the VPSSMgr object.
00427      *
00428      * @param   pres   Pressure to be set (Pascal)
00429      */
00430     virtual void setPressure(doublereal pres);
00431 
00432     //! Set the internal temperature
00433     /*!
00434      * @param temp Temperature (Kelvin)
00435      */
00436     virtual void setTemperature(doublereal temp);
00437 
00438     //! Set the internal temperature and pressure
00439     /*!
00440      * @param  temp     Temperature (Kelvin)
00441      * @param  pres     pressure (Pascals)
00442      */
00443     virtual void setState_TP(doublereal temp, doublereal pres);
00444 
00445 
00446     //! Set the internal temperature and density
00447     /*!
00448      * @param  temp     Temperature (Kelvin)
00449      * @param  rho      Density (kg m-3)
00450      */
00451     virtual void setState_TR(doublereal temp, doublereal rho);
00452 
00453     /**
00454      * @}
00455      *  @name  Miscellaneous properties of the standard state
00456      * @{
00457      */
00458 
00459     /// critical temperature 
00460     virtual doublereal critTemperature() const;
00461  
00462     /// critical pressure
00463     virtual doublereal critPressure() const;
00464         
00465     /// critical density
00466     virtual doublereal critDensity() const;
00467   
00468     /// saturation pressure
00469     /*!
00470      *  @param t  Temperature (kelvin)
00471      */
00472     virtual doublereal satPressure(doublereal t);
00473     
00474     /**
00475      * @}
00476      *  @name  Initialization of the Object
00477      * @{
00478      */
00479     
00480     //! Initialization routine for all of the shallow pointers
00481     /*!
00482      *  This is a cascading call, where each level should call the
00483      *  the parent level.
00484      *
00485      *  The initThermo() routines get called before the initThermoXML() routines
00486      *  from the constructPDSSXML() routine.
00487      *
00488      *
00489      *  Calls initPtrs();
00490      */
00491     virtual void initThermo();
00492 
00493     //! Initialization of a PDSS object using an
00494     //! input XML file.
00495     /*!
00496      *
00497      * This routine is a precursor to constructPDSSXML(XML_Node*)
00498      * routine, which does most of the work.
00499      *
00500      * @param vptp_ptr    Pointer to the Variable pressure %ThermoPhase object
00501      *                    This object must have already been malloced.
00502      *
00503      * @param spindex     Species index within the phase
00504      *
00505      * @param inputFile   XML file containing the description of the
00506      *                    phase
00507      *
00508      * @param id          Optional parameter identifying the name of the
00509      *                    phase. If none is given, the first XML
00510      *                    phase element will be used.
00511      */
00512     void constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex, 
00513                            std::string inputFile, std::string id);
00514 
00515     //!  Initialization of a PDSS object using an xml tree
00516     /*!
00517      * This routine is a driver for the initialization of the
00518      * object.
00519      * 
00520      *   basic logic:
00521      *       initThermo()                 (cascade)
00522      *       getStuff from species Part of XML file
00523      *       initThermoXML(phaseNode)      (cascade)
00524      * 
00525      * @param vptp_ptr   Pointer to the Variable pressure %ThermoPhase object
00526      *                   This object must have already been malloced.
00527      *
00528      * @param spindex    Species index within the phase
00529      *
00530      * @param speciesNode XML Node containing the species information
00531      *
00532      * @param phaseNode  Reference to the phase Information for the phase
00533      *                   that owns this species.
00534      *
00535      * @param spInstalled  Boolean indicating whether the species is 
00536      *                     already installed.
00537      */
00538     void constructPDSSXML(VPStandardStateTP *vptp_ptr, int spindex, 
00539                           const XML_Node& speciesNode,
00540                           const XML_Node& phaseNode, bool spInstalled);
00541 
00542     //! Initialization routine for the PDSS object based on the phaseNode
00543     /*!
00544      *  This is a cascading call, where each level should call the
00545      *  the parent level.
00546      *
00547      * @param phaseNode  Reference to the phase Information for the phase
00548      *                   that owns this species.
00549      *
00550      * @param id         Optional parameter identifying the name of the
00551      *                   phase. If none is given, the first XML
00552      *                   phase element will be used.
00553      */
00554     virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
00555 
00556     //@}
00557 
00558   private:
00559 
00560     //! Enumerated data type describing the type of volume model
00561     //! used to calculate the standard state volume of the species
00562     SSVolume_Model_enumType  volumeModel_;
00563 
00564     //! Value of the constant molar volume for the species
00565     /*!
00566      *    m3 / kmol
00567      */
00568     doublereal m_constMolarVolume;
00569 
00570     //! coefficients for the temperature representation
00571     vector_fp TCoeff_;
00572 
00573     //! Derivative of the volume wrt temperature
00574     mutable doublereal dVdT_;
00575 
00576     //! 2nd derivative of the volume wrt temperature
00577     mutable doublereal d2VdT2_;
00578 
00579   };
00580 
00581 }
00582 
00583 #endif
00584 
00585 
00586 
Generated by  doxygen 1.6.3