IdealGasPhase.h

Go to the documentation of this file.
00001 /**
00002  *  @file IdealGasPhase.h 
00003  *   ThermoPhase object for the ideal gas equation of
00004  * state - workhorse for %Cantera (see \ref thermoprops 
00005  * and class \link Cantera::IdealGasPhase IdealGasPhase\endlink).
00006  * 
00007  */
00008 
00009 /*  $Author: hkmoffa $
00010  *  $Date: 2009-12-10 20:32:26 -0500 (Thu, 10 Dec 2009) $
00011  *  $Revision: 311 $
00012  *
00013  *  Copyright 2001 California Institute of Technology
00014  *
00015  */
00016 
00017 
00018 #ifndef CT_IDEALGASPHASE_H
00019 #define CT_IDEALGASPHASE_H
00020 
00021 //#include "ct_defs.h"
00022 #include "mix_defs.h"
00023 #include "ThermoPhase.h"
00024 #include "SpeciesThermo.h"
00025 #include "utilities.h"
00026 
00027 namespace Cantera {
00028 
00029     
00030   //!  Class %IdealGasPhase represents low-density gases that obey the
00031   //!  ideal gas equation of state. 
00032   /*!
00033    *
00034    * %IdealGasPhase derives from class ThermoPhase,
00035    * and overloads the virtual methods defined there with ones that
00036    * use expressions appropriate for ideal gas mixtures.
00037    * 
00038    * The independent unknowns are density, mass fraction, and temperature.
00039    * the #setPressure() function will calculate the density consistent with
00040    * the current mass fraction vector and temperature and the desired pressure,
00041    * and then set the density in the derived State object.
00042    *
00043    * <HR>
00044    * <H2> Specification of Species Standard %State Properties </H2>
00045    * <HR>
00046    *
00047    *  It is assumed that the reference state thermodynamics may be
00048    *  obtained by a pointer to a populated species thermodynamic property
00049    *  manager class in the base class, ThermoPhase::m_spthermo 
00050    *  (see the base class \link Cantera#SpeciesThermo SpeciesThermo \endlink for a 
00051    *  description of the specification of reference state species thermodynamics functions).
00052    *  The reference state,
00053    *  where the pressure is fixed at a single pressure,
00054    *  is a key species property calculation for the Ideal Gas Equation
00055    *  of state. 
00056    *
00057    *  This class is optimized for speed of execution. All calls to thermodynamic functions
00058    *  first call internal routines (aka #enthalpy_RT_ref()) which return references
00059    *  the reference state thermodynamics functions. Within these internal reference
00060    *  state functions, the function #_updateThermo() is called, that first checks to see
00061    *  whether the temperature has changed. If it has, it updates the internal reference
00062    *  state thermo functions by calling the SpeciesThermo object. 
00063    *
00064    *  Functions for the calculation of standard state properties for species
00065    *  at arbitray pressure are provided in %IdealGasPhase. However, they
00066    *  are all derived from their reference state conterparts.
00067    *  
00068    *  The standard state enthalpy is independent of pressure:
00069    *
00070    *       \f[
00071    *            h^o_k(T,P) = h^{ref}_k(T)  
00072    *       \f]
00073    *
00074    *  The standard state constant-pressure heat capacity is independent of pressure:
00075    *
00076    *       \f[
00077    *            Cp^o_k(T,P) = Cp^{ref}_k(T)  
00078    *       \f]
00079    *
00080    *  The standard state entropy depends in the following fashion on pressure:
00081    *
00082    *       \f[
00083    *            S^o_k(T,P) = S^{ref}_k(T) -  R \ln(\frac{P}{P_{ref}}) 
00084    *       \f]
00085    *  The standard state gibbs free energy is obtained from the enthalpy and entropy
00086    *  functions:
00087    * 
00088    *       \f[
00089    *            \mu^o_k(T,P) =  h^o_k(T,P) - S^o_k(T,P) T 
00090    *       \f]
00091    *
00092    *       \f[
00093    *            \mu^o_k(T,P) =  \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}})
00094    *       \f]
00095    *
00096    * where
00097    *       \f[
00098    *            \mu^{ref}_k(T) =   h^{ref}_k(T)   - T S^{ref}_k(T)
00099    *       \f]
00100    *
00101    *  The standard state internal energy is obtained from the enthalpy function also
00102    *  
00103    *       \f[
00104    *            u^o_k(T,P) = h^o_k(T) - R T 
00105    *       \f]
00106    *
00107    *  The molar volume of a species is given by the ideal gas law
00108    * 
00109    *       \f[
00110    *            V^o_k(T,P) = \frac{R T}{P} \mbox{\quad where}  
00111    *       \f]
00112    *
00113    *  R = 8314.47215 Joules kmol<SUP>-1</SUP> K<SUP>-1</SUP>, from the 1999 CODATA convention.
00114    *  For a complete list of physical constants used within %Cantera, see \ref physConstants .
00115    *  
00116    * <HR>
00117    * <H2> Specification of Solution Thermodynamic Properties </H2>
00118    * <HR>
00119    *  
00120    * The activity of a species defined in the phase is given by the ideal gas law:
00121    *       \f[
00122    *            a_k = X_k      
00123    *       \f]
00124    * where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
00125    * The chemical potential for species <I>k</I> is equal to 
00126    *
00127    *       \f[
00128    *            \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)     
00129    *       \f]
00130    *
00131    * In terms of the reference state, the above can be rewritten
00132    *
00133    * 
00134    *       \f[
00135    *            \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}})     
00136    *       \f]
00137    *
00138    * The partial molar entropy for species <I>k</I> is given by the following relation,
00139    *
00140    *       \f[
00141    *            \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}})  
00142    *       \f]
00143    *
00144    * The partial molar enthalpy for species <I>k</I> is 
00145    *
00146    *       \f[
00147    *            \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) 
00148    *       \f]
00149    *
00150    * The partial molar Internal Energy for species <I>k</I> is 
00151    *
00152    *       \f[
00153    *            \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) 
00154    *       \f]
00155    *
00156    * The partial molar Heat Capacity for species <I>k</I> is 
00157    *
00158    *       \f[
00159    *            \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) 
00160    *       \f]
00161    *
00162    *
00163    * <HR>
00164    * <H2> %Application within %Kinetics Managers </H2>
00165    * <HR>
00166    *
00167    *   \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
00168    *   C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
00169    *   defined below and \f$ a_k \f$ are activities used in the
00170    *   thermodynamic functions.  These activity (or generalized)
00171    *   concentrations are used
00172    *   by kinetics manager classes to compute the forward and
00173    *   reverse rates of elementary reactions.
00174    *   The activity concentration,\f$  C^a_k \f$,is given by the following expression.
00175    *
00176    *       \f[
00177    *            C^a_k = C^s_k  X_k  = \frac{P}{R T} X_k 
00178    *       \f]
00179    *
00180    * The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to 
00181    *
00182    *        \f[
00183    *            C^s_k =  C^s = \frac{P}{R T}
00184    *        \f]
00185    *
00186    * For example, a bulk-phase binary gas reaction between species j and k, producing
00187    * a new gas species l would have the
00188    * following equation for its rate of progress variable, \f$ R^1 \f$, which has
00189    * units of kmol m-3 s-1.
00190    *
00191    *   \f[
00192    *    R^1 = k^1 C_j^a C_k^a =  k^1 (C^s a_j) (C^s a_k)
00193    *   \f]
00194    *  where
00195    *   \f[
00196    *      C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
00197    *   \f]
00198    *
00199    *  \f$ C_j^a \f$ is the activity concentration of species j, and
00200    *  \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
00201    *  is the standard concentration. \f$ a_j \f$ is
00202    *  the activity of species j which is equal to the mole fraction of j.
00203    *
00204    *  The reverse rate constant can then be obtained from the law of microscopic reversibility
00205    *  and the equilibrium expression for the system.
00206    *
00207    *   \f[
00208    *         \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
00209    *   \f]
00210    *
00211    *  \f$  K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
00212    *  the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
00213    *  \f$ a_l \f$, repeated here:
00214    * 
00215    *       \f[
00216    *            \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)     
00217    *       \f]
00218    *
00219    *  We can switch over to expressing the equilibrium constant in terms of the reference
00220    *  state chemical potentials
00221    *
00222    *   \f[
00223    *       K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
00224    *   \f]
00225    *
00226    *   The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
00227    *   to activity concentrations. When this is done:
00228    *
00229    *   \f[
00230    *         \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
00231    *             \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
00232    *   \f]
00233    *
00234    *    %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
00235    *    using the second and third part of the above expression as a definition for the concentration
00236    *    equilibrium constant.
00237    *
00238    *    For completeness, the pressure equilibrium constant may be obtained as well
00239    *
00240    *   \f[
00241    *         \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
00242    *   \f]
00243    *
00244    *   \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't 
00245    *   necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
00246    *   used instead because it is completely general.
00247    *   
00248    *   The reverse rate of progress may be written down as
00249    *   \f[
00250    *    R^{-1} = k^{-1} C_l^a =  k^{-1} (C^o a_l)
00251    *   \f]
00252    *
00253    *  where we can use the concept of microscopic reversibility to
00254    *  write the reverse rate constant in terms of the
00255    *  forward rate constant and the concentration equilibrium
00256    *   constant, \f$ K_c \f$.
00257    *
00258    *    \f[
00259    *       k^{-1} =  k^1 K^1_c
00260    *    \f]
00261    *
00262    *  \f$k^{-1} \f$ has units of s-1.
00263    *
00264    * <HR>
00265    * <H2> Instantiation of the Class </H2>
00266    * <HR>
00267    *
00268    *  
00269    * The constructor for this phase is located in the default ThermoFactory
00270    * for %Cantera. A new %IdealGasPhase may be created by the following code
00271    * snippet:
00272    *
00273    * @code
00274    *    XML_Node *xc = get_XML_File("silane.xml"); 
00275    *    XML_Node * const xs = xc->findNameID("phase", "silane");
00276    *    ThermoPhase *silane_tp = newPhase(*xs);
00277    *    IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
00278    * @endcode
00279    *
00280    * or by the following constructor:
00281    *
00282    * @code
00283    *    XML_Node *xc = get_XML_File("silane.xml"); 
00284    *    XML_Node * const xs = xc->findNameID("phase", "silane");
00285    *    IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
00286    * @endcode
00287    *
00288    * <HR>
00289    * <H2> XML Example </H2>
00290    * <HR>
00291    *   An example of an XML Element named phase setting up a IdealGasPhase
00292    *   object named silane is given below.
00293    *
00294    * @verbatim
00295      <!--     phase silane      -->
00296      <phase dim="3" id="silane">
00297         <elementArray datasrc="elements.xml"> Si  H  He </elementArray>
00298         <speciesArray datasrc="#species_data">
00299                 H2  H  HE  SIH4  SI  SIH  SIH2  SIH3  H3SISIH  SI2H6
00300                        H2SISIH2  SI3H8  SI2  SI3
00301         </speciesArray>
00302         <reactionArray datasrc="#reaction_data"/>
00303         <thermo model="IdealGas"/>
00304         <kinetics model="GasKinetics"/>
00305         <transport model="None"/>
00306       </phase>  
00307       @endverbatim
00308    *
00309    *   The model attribute "IdealGas" of the thermo XML element identifies the phase as
00310    *   being of the type handled by the IdealGasPhase object. 
00311    *
00312    *    @ingroup thermoprops
00313    *
00314    */
00315   class IdealGasPhase : public ThermoPhase  {
00316 
00317   public:
00318 
00319     //! Default empty Constructor
00320     IdealGasPhase();
00321 
00322     //! Copy Constructor
00323     /*!
00324      * Copy constructor for the object. Constructed
00325      * object will be a clone of this object, but will
00326      * also own all of its data.
00327      * This is a wrapper around the assignment operator
00328      *
00329      * @param right Object to be copied.
00330      */
00331     IdealGasPhase(const IdealGasPhase &right);
00332 
00333     //! Asignment operator
00334     /*!
00335      * Assignment operator for the object. Constructed
00336      * object will be a clone of this object, but will
00337      * also own all of its data.
00338      *
00339      * @param right Object to be copied.
00340      */
00341     IdealGasPhase& operator=(const  IdealGasPhase& right);
00342 
00343     //! Destructor
00344     virtual ~IdealGasPhase() {}
00345 
00346     //! Duplicator from the %ThermoPhase parent class
00347     /*!
00348      * Given a pointer to a %ThermoPhase object, this function will
00349      * duplicate the %ThermoPhase object and all underlying structures.
00350      * This is basically a wrapper around the inherited copy constructor.
00351      *
00352      * @return returns a pointer to a %ThermoPhase object, containing
00353      *      a copy of the current object
00354      */
00355     ThermoPhase *duplMyselfAsThermoPhase() const;
00356 
00357     //! Equation of state flag.
00358     /*!
00359      *  Returns the value cIdealGas, defined  in mix_defs.h.
00360      */
00361     virtual int eosType() const { return cIdealGas; }
00362 
00363     /**
00364      * @name Molar Thermodynamic Properties of the Solution ------------------------------
00365      * @{
00366      */
00367 
00368     
00369     //! Return the Molar enthalpy. Units: J/kmol.
00370     /*!
00371      * For an ideal gas mixture,
00372      * \f[
00373      * \hat h(T) = \sum_k X_k \hat h^0_k(T),
00374      * \f]
00375      * and is a function only of temperature.
00376      * The standard-state pure-species enthalpies 
00377      * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic 
00378      * property manager.
00379      *
00380      * \see SpeciesThermo
00381      */
00382     virtual doublereal enthalpy_mole() const {
00383       return GasConstant * temperature() * 
00384         mean_X(&enthalpy_RT_ref()[0]);
00385     }
00386 
00387     /**
00388      * Molar internal energy. J/kmol. For an ideal gas mixture,
00389      * \f[
00390      * \hat u(T) = \sum_k X_k \hat h^0_k(T) - \hat R T,
00391      * \f]
00392      * and is a function only of temperature.
00393      * The reference-state pure-species enthalpies 
00394      * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic 
00395      * property manager.
00396      * @see SpeciesThermo
00397      */
00398     virtual doublereal intEnergy_mole() const;
00399 
00400     /**
00401      * Molar entropy. Units: J/kmol/K.
00402      * For an ideal gas mixture,
00403      * \f[
00404      * \hat s(T, P) = \sum_k X_k \hat s^0_k(T) - \hat R \log (P/P^0).
00405      * \f]
00406      * The reference-state pure-species entropies 
00407      * \f$ \hat s^0_k(T) \f$ are computed by the species thermodynamic 
00408      * property manager.
00409      * @see SpeciesThermo
00410      */
00411     virtual doublereal entropy_mole() const;
00412 
00413     /**
00414      * Molar Gibbs free Energy for an ideal gas.
00415      * Units =  J/kmol.
00416      */
00417     virtual doublereal gibbs_mole() const;
00418 
00419     /**
00420      * Molar heat capacity at constant pressure. Units: J/kmol/K.
00421      * For an ideal gas mixture, 
00422      * \f[
00423      * \hat c_p(t) = \sum_k \hat c^0_{p,k}(T).
00424      * \f]
00425      * The reference-state pure-species heat capacities  
00426      * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic 
00427      * property manager.
00428      * @see SpeciesThermo
00429      */
00430     virtual doublereal cp_mole() const;
00431 
00432     /**
00433      * Molar heat capacity at constant volume. Units: J/kmol/K.
00434      * For an ideal gas mixture,
00435      * \f[ \hat c_v = \hat c_p - \hat R. \f]
00436      */
00437     virtual doublereal cv_mole() const;
00438 
00439     //@}
00440 
00441     /**
00442      * @name Mechanical Equation of State ------------------------------------------------
00443      * @{
00444      */
00445 
00446     /**
00447      * Pressure. Units: Pa.
00448      * For an ideal gas mixture, 
00449      * \f[ P = n \hat R T. \f]
00450      */ 
00451     virtual doublereal pressure() const {
00452       return GasConstant * molarDensity() * temperature();
00453     }
00454 
00455     
00456     //! Set the pressure at constant temperature and composition.
00457     /*!
00458      *  Units: Pa.
00459      *   This method is implemented by setting the mass density to
00460      * \f[
00461      * \rho = \frac{P \overline W}{\hat R T }.
00462      * \f]
00463      *
00464      * @param p Pressure (Pa) 
00465      */
00466     virtual void setPressure(doublereal p) {
00467       setDensity(p * meanMolecularWeight()
00468                  /(GasConstant * temperature()));
00469     }
00470 
00471     //! Returns  the isothermal compressibility. Units: 1/Pa.
00472     /**
00473      * The isothermal compressibility is defined as
00474      * \f[
00475      * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
00476      * \f]
00477      *  For ideal gases it's equal to the negative of the inverse of the pressure
00478      */
00479     virtual doublereal isothermalCompressibility() const {
00480       return -1.0/pressure();
00481     }
00482 
00483     //! Return the volumetric thermal expansion coefficient. Units: 1/K.
00484     /*!
00485      * The thermal expansion coefficient is defined as
00486      * \f[
00487      * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
00488      * \f]
00489      * For ideal gases, it's equal to the inverse of the temperature.
00490      */
00491     virtual doublereal thermalExpansionCoeff() const {
00492       return 1.0/temperature();
00493     }
00494 
00495     //@}
00496 
00497     /**
00498      * @name Chemical Potentials and Activities ------------------------------------------
00499      *     
00500      *
00501      * The activity \f$a_k\f$ of a species in solution is
00502      * related to the chemical potential by 
00503      * \f[
00504      *  \mu_k(T,P,X_k) = \mu_k^0(T,P)
00505      * + \hat R T \log a_k.
00506      *  \f] 
00507      * The quantity \f$\mu_k^0(T,P)\f$ is
00508      * the standard state chemical potential at unit activity.
00509      * It may depend on the pressure and the temperature. However,
00510      * it may not depend on the mole fractions of the species 
00511      * in the solution.
00512      *
00513      * The activities are related to the generalized 
00514      * concentrations, \f$\tilde C_k\f$, and standard 
00515      * concentrations, \f$C^0_k\f$, by the following formula:
00516      *
00517      *  \f[
00518      *  a_k = \frac{\tilde C_k}{C^0_k} 
00519      *  \f] 
00520      * The generalized concentrations are used in the kinetics classes
00521      * to describe the rates of progress of reactions involving the
00522      * species. Their formulation depends upons the specification
00523      * of the rate constants for reaction, especially the units used
00524      * in specifying the rate constants. The bridge between the
00525      * thermodynamic equilibrium expressions that use a_k and the
00526      * kinetics expressions which use the generalized concentrations
00527      * is provided by the multiplicative factor of the 
00528      * standard concentrations. 
00529      * @{
00530      */
00531 
00532     //! This method returns the array of generalized concentrations. 
00533     /*!
00534      *  For an ideal gas mixture, these are simply the actual concentrations.
00535      *
00536      * @param c Output array of generalized concentrations. The 
00537      *           units depend upon the implementation of the
00538      *           reaction rate expressions within the phase.
00539      */
00540     virtual void getActivityConcentrations(doublereal* c) const {
00541       getConcentrations(c);
00542     }
00543     
00544     //! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
00545     //! the generalized concentration.
00546     /*!
00547      * This is defined as the concentration  by which the generalized
00548      * concentration is normalized to produce the activity.
00549      * In many cases, this quantity will be the same for all species in a phase.
00550      * Since the activity for an ideal gas mixture is 
00551      * simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$.
00552      *
00553      * @param k Optional parameter indicating the species. The default
00554      *          is to assume this refers to species 0.
00555      * @return 
00556      *   Returns the standard Concentration in units of m3 kmol-1.
00557      */
00558     virtual doublereal standardConcentration(int k=0) const;
00559 
00560     //! Returns the natural logarithm of the standard 
00561     //! concentration of the kth species
00562     /*!
00563      * @param k    index of the species. (defaults to zero)
00564      */
00565     virtual doublereal logStandardConc(int k=0) const;
00566 
00567     //! Get the array of non-dimensional activity coefficients at
00568     //! the current solution temperature, pressure, and solution concentration. 
00569     /*!
00570      *  For ideal gases, the activity coefficients are all equal to one.
00571      *
00572      * @param ac Output vector of activity coefficients. Length: m_kk.
00573      */
00574     virtual void getActivityCoefficients(doublereal* ac) const;
00575 
00576 
00577     //@}
00578     /// @name Partial Molar Properties of the Solution ----------------------------------
00579     //@{
00580 
00581     
00582     //! Get the species chemical potentials. Units: J/kmol.
00583     /*!
00584      * This function returns a vector of chemical potentials of the 
00585      * species in solution at the current temperature, pressure
00586      * and mole fraction of the solution.
00587      *
00588      * @param mu  Output vector of species chemical 
00589      *            potentials. Length: m_kk. Units: J/kmol
00590      */
00591     virtual void getChemPotentials(doublereal* mu) const;
00592  
00593     //!  Get the species partial molar enthalpies. Units: J/kmol.
00594     /*!
00595      * @param hbar    Output vector of species partial molar enthalpies.
00596      *                Length: m_kk. units are J/kmol.
00597      */
00598     virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
00599 
00600     //! Get the species partial molar entropies. Units: J/kmol/K.
00601     /*!
00602      * @param sbar    Output vector of species partial molar entropies.
00603      *                Length = m_kk. units are J/kmol/K.
00604      */
00605     virtual void getPartialMolarEntropies(doublereal* sbar) const;
00606 
00607     //! Get the species partial molar enthalpies. Units: J/kmol.
00608     /*!
00609      * @param ubar    Output vector of speciar partial molar internal energies.
00610      *                Length = m_kk. units are J/kmol.
00611      */
00612     virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
00613 
00614     //! Get the partial molar heat capacities Units: J/kmol/K
00615     /*!
00616      * @param cpbar   Output vector of species partial molar heat capacities at constant pressure.
00617      *                Length = m_kk. units are J/kmol/K.
00618      */
00619     virtual void getPartialMolarCp(doublereal* cpbar) const;
00620 
00621     //! Get the species partial molar volumes. Units: m^3/kmol.
00622     /*!
00623      *  @param vbar   Output vector of speciar partial molar volumes.
00624      *                Length = m_kk. units are m^3/kmol.
00625      */
00626     virtual void getPartialMolarVolumes(doublereal* vbar) const;
00627 
00628     //@}
00629     /// @name  Properties of the Standard State of the Species in the Solution ----------
00630     //@{
00631 
00632     //! Get the array of chemical potentials at unit activity for the
00633     //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
00634     /*!
00635      * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
00636      * \f$. The values are evaluated at the current
00637      * temperature and pressure of the solution
00638      *
00639      * @param mu  Output vector of chemical potentials. 
00640      *            Length: m_kk.
00641      */
00642     virtual void getStandardChemPotentials(doublereal* mu) const;
00643 
00644     //! Get the nondimensional Enthalpy functions for the species standard states
00645     //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
00646     /*!
00647      * @param hrt      Output vector of  nondimensional standard state enthalpies.
00648      *                 Length: m_kk.
00649      */
00650     virtual void getEnthalpy_RT(doublereal* hrt) const;
00651 
00652     //! Get the array of nondimensional Entropy functions for the
00653     //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
00654     /*!
00655      * @param sr   Output vector of  nondimensional standard state entropies.
00656      *             Length: m_kk.
00657      */
00658     virtual void getEntropy_R(doublereal* sr) const;
00659 
00660     //! Get the nondimensional Gibbs functions for the species
00661     //! standard states at the current <I>T</I> and <I>P</I> of the solution.
00662     /*!
00663      * @param grt  Output vector of nondimensional standard state gibbs free energies
00664      *             Length: m_kk.
00665      */
00666     virtual void getGibbs_RT(doublereal* grt) const;
00667 
00668     //! Get the Gibbs functions for the standard
00669     //! state of the species at the current <I>T</I> and <I>P</I> of the solution
00670     /*!
00671      * Units are Joules/kmol
00672      * @param gpure  Output vector of  standard state gibbs free energies
00673      *               Length: m_kk.
00674      */
00675     virtual void getPureGibbs(doublereal* gpure) const;
00676 
00677     //!  Returns the vector of nondimensional Internal Energies  of the standard
00678     //!  state species at the current <I>T</I> and <I>P</I> of the solution
00679     /*!
00680      * @param urt  output vector of nondimensional standard state internal energies
00681      *             of the species. Length: m_kk. 
00682      */
00683     virtual void getIntEnergy_RT(doublereal *urt) const;
00684 
00685     //! Get the nondimensional Heat Capacities at constant
00686     //! pressure for the species standard states
00687     //! at the current <I>T</I> and <I>P</I> of the solution
00688     /*!
00689      * @param cpr   Output vector of nondimensional standard state heat capacities
00690      *              Length: m_kk.
00691      */
00692     virtual void getCp_R(doublereal* cpr) const;
00693 
00694     //!  Get the molar volumes of the species standard states at the current
00695     //!  <I>T</I> and <I>P</I> of the solution.
00696     /*!
00697      * units = m^3 / kmol
00698      *
00699      * @param vol     Output vector containing the standard state volumes.
00700      *                Length: m_kk.
00701      */
00702     virtual void getStandardVolumes(doublereal *vol) const;
00703 
00704     //@}
00705     /// @name Thermodynamic Values for the Species Reference States ---------------------
00706     //@{
00707 
00708 
00709     //!  Returns the vector of nondimensional
00710     //!  enthalpies of the reference state at the current temperature
00711     //!  of the solution and the reference pressure for the species.
00712     /*!
00713      * @param hrt     Output vector containing the nondimensional reference state 
00714      *                enthalpies.  Length: m_kk.
00715      */
00716     virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
00717 
00718 #ifdef H298MODIFY_CAPABILITY
00719   
00720     virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
00721        m_spthermo->modifyOneHf298(k, Hf298New);
00722        m_tlast += 0.0001234;
00723     }
00724 #endif
00725     //!  Returns the vector of nondimensional
00726     //!  Gibbs Free Energies of the reference state at the current temperature
00727     //!  of the solution and the reference pressure for the species.
00728     /*!
00729      * @param grt     Output vector containing the nondimensional reference state 
00730      *                Gibbs Free energies.  Length: m_kk.
00731      */
00732     virtual void getGibbs_RT_ref(doublereal *grt) const;
00733 
00734     //!  Returns the vector of the
00735     //!  gibbs function of the reference state at the current temperature
00736     //!  of the solution and the reference pressure for the species.
00737     /*!
00738      *  units = J/kmol
00739      *
00740      * @param g       Output vector containing the  reference state 
00741      *                Gibbs Free energies.  Length: m_kk. Units: J/kmol.
00742      */
00743     virtual void getGibbs_ref(doublereal *g) const;
00744 
00745     //!  Returns the vector of nondimensional
00746     //!  entropies of the reference state at the current temperature
00747     //!  of the solution and the reference pressure for each species.
00748     /*!
00749      * @param er      Output vector containing the nondimensional reference state 
00750      *                entropies.  Length: m_kk.
00751      */
00752     virtual void getEntropy_R_ref(doublereal *er) const;
00753 
00754     //! Returns the vector of nondimensional
00755     //!  internal Energies of the reference state at the current temperature
00756     //!  of the solution and the reference pressure for each species.
00757     /*!
00758      * @param urt    Output vector of nondimensional reference state
00759      *               internal energies of the species.
00760      *               Length: m_kk
00761      */
00762     virtual void getIntEnergy_RT_ref(doublereal *urt) const;
00763     
00764     //!  Returns the vector of nondimensional
00765     //!  constant pressure heat capacities of the reference state
00766     //!  at the current temperature of the solution
00767     //!  and reference pressure for each species.
00768     /*!
00769      * @param cprt   Output vector of nondimensional reference state
00770      *               heat capacities at constant pressure for the species.
00771      *               Length: m_kk
00772      */
00773     virtual void  getCp_R_ref(doublereal *cprt) const;
00774 
00775     //!  Get the molar volumes of the species standard states at the current
00776     //!  <I>T</I> and <I>P_ref</I> of the solution.
00777     /*!
00778      * units = m^3 / kmol
00779      *
00780      * @param vol     Output vector containing the standard state volumes.
00781      *                Length: m_kk.
00782      */
00783     virtual void getStandardVolumes_ref(doublereal *vol) const;
00784 
00785     //@}
00786     /// @name NonVirtual Internal methods to Return References to Reference State Thermo
00787     //@{
00788 
00789     //! Returns a reference to the dimensionless reference state enthalpy vector.
00790     /*!
00791      * This function is part of the layer that checks/recalculates the reference
00792      * state thermo functions.
00793      */
00794     const array_fp& enthalpy_RT_ref() const {
00795       _updateThermo();
00796       return m_h0_RT;
00797     }
00798 
00799     //! Returns a reference to the dimensionless reference state Gibbs free energy vector.
00800     /*!
00801      * This function is part of the layer that checks/recalculates the reference
00802      * state thermo functions.
00803      */
00804     const array_fp& gibbs_RT_ref() const {
00805       _updateThermo();
00806       return m_g0_RT;
00807     }
00808 
00809     //! Returns a reference to the exponent of the dimensionless reference state Gibbs Free energy vector.
00810     /*!
00811      * This function is part of the layer that checks/recalculates the reference
00812      * state thermo functions.
00813      */
00814     const array_fp& expGibbs_RT_ref() const {
00815       _updateThermo();
00816       int k;
00817       for (k = 0; k != m_kk; k++) m_expg0_RT[k] = std::exp(m_g0_RT[k]);
00818       return m_expg0_RT;
00819     }
00820 
00821     //! Returns a reference to the dimensionless reference state Entropy vector.
00822     /*!
00823      * This function is part of the layer that checks/recalculates the reference
00824      * state thermo functions.
00825      */
00826     const array_fp& entropy_R_ref() const {
00827       _updateThermo();
00828       return m_s0_R;
00829     }
00830 
00831     //! Returns a reference to the dimensionless reference state Heat Capacity vector.
00832     /*!
00833      * This function is part of the layer that checks/recalculates the reference
00834      * state thermo functions.
00835      */
00836     const array_fp& cp_R_ref() const {
00837       _updateThermo();
00838       return m_cp0_R;
00839     }
00840 
00841     //@}
00842 
00843     //! Initialize the ThermoPhase object after all species have been set up
00844     /*!
00845      * @internal Initialize.
00846      *
00847      * This method performs any initialization required after all
00848      * species have been added. For example, it is used to
00849      * resize internal work arrays that must have an entry for
00850      * each species. 
00851      * This method is called from ThermoPhase::initThermoXML(),
00852      * which is called from importPhase(),
00853      * just prior to returning from the function, importPhase().
00854      *
00855      * @see importCTML.cpp
00856      */
00857     virtual void initThermo();
00858 
00859     //!This method is used by the ChemEquil equilibrium solver.
00860     /*!
00861      * @internal
00862      * @name Chemical Equilibrium
00863      * @{
00864      * 
00865      * Set mixture to an equilibrium state consistent with specified 
00866      * element potentials and temperature.
00867      * It sets the state such that the chemical potentials satisfy
00868      * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
00869      * \left(\frac{\lambda_m} {\hat R T}\right) \f] where 
00870      * \f$ \lambda_m \f$ is the element potential of element m. The
00871      * temperature is unchanged.  Any phase (ideal or not) that
00872      * implements this method can be equilibrated by ChemEquil.
00873      *
00874      * @param lambda_RT vector of non-dimensional element potentials
00875      *                  \f[ \lambda_m/RT \f].
00876      */
00877     virtual void setToEquilState(const doublereal* lambda_RT);
00878 
00879     //@}
00880 
00881   protected:
00882 
00883     //! Number of Elements in the phase
00884     /*!
00885      * This member is defined here, from a call to the Elements ojbect, for speed.
00886      */
00887     int m_mm;
00888 
00889     //! Minimum temperature for valid species standard state thermo props
00890     /*!
00891      * This is the minimum temperature at which all species have valid standard
00892      * state thermo props defined.
00893      */
00894     doublereal m_tmin;
00895 
00896     //! Maximum temperature for valid species standard state thermo props
00897     /*!
00898      * This is the maximum temperature at which all species have valid standard
00899      * state thermo props defined.
00900      */
00901     doublereal m_tmax;
00902 
00903     //! Reference state pressure
00904     /*!
00905      *  Value of the reference state pressure in Pascals. 
00906      *  All species must have the same reference state pressure.
00907      */
00908     doublereal m_p0;
00909 
00910     //! last value of the temperature processed by reference state 
00911     mutable doublereal    m_tlast;
00912 
00913     //! Temporary storage for log of p/rt
00914     mutable doublereal    m_logc0;
00915 
00916    //! Temporary storage for dimensionless reference state enthalpies
00917     mutable array_fp      m_h0_RT;
00918 
00919    //! Temporary storage for dimensionless reference state heat capacities
00920     mutable array_fp      m_cp0_R;
00921 
00922    //! Temporary storage for dimensionless reference state gibbs energies
00923     mutable array_fp      m_g0_RT;
00924 
00925     //! Temporary storage for dimensionless reference state entropies
00926     mutable array_fp      m_s0_R;
00927 
00928     //! currently unsed
00929     /*!
00930      * @deprecated
00931      */
00932     mutable array_fp      m_expg0_RT;
00933 
00934     //! Currently unused
00935     /*
00936      * @deprecated
00937      */
00938     mutable array_fp      m_pe;
00939 
00940     //! Temporary array containing internally calculated partial pressures
00941     mutable array_fp      m_pp;
00942 
00943   private:
00944 
00945     //! Update the species reference state thermodynamic functions
00946     /*!
00947      * The polynomials for the standard state functions are only
00948      * reevalulated if the temperature has changed.
00949      *
00950      */
00951     void _updateThermo() const;
00952 
00953   };
00954 }
00955         
00956 #endif
Generated by  doxygen 1.6.3