SingleSpeciesTP.h

Go to the documentation of this file.
00001 /**
00002  *  @file SingleSpeciesTP.h
00003  *  Header for the %SingleSpeciesTP class, which is a filter class for %ThermoPhase,
00004  *  that eases the construction of single species phases 
00005  *  ( see \ref thermoprops and class \link Cantera::SingleSpeciesTP SingleSpeciesTP\endlink).
00006  *
00007  */
00008 /*
00009  * Copywrite (2005) 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 
00015 /*
00016  *  $Author: hkmoffa $
00017  *  $Date: 2010-01-16 13:57:05 -0500 (Sat, 16 Jan 2010) $
00018  *  $Revision: 384 $
00019  *
00020  */
00021 
00022 #ifndef CT_SINGLESPECIESTP_H
00023 #define CT_SINGLESPECIESTP_H
00024 
00025 #include "ThermoPhase.h"
00026 
00027 
00028 namespace Cantera {
00029 
00030   /**
00031    * @ingroup thermoprops
00032    *
00033    *  The %SingleSpeciesTP class is a filter class for %ThermoPhase.
00034    *  What it does is to simplify the construction of %ThermoPhase
00035    *  objects by assuming that the phase consists of one and 
00036    *  only one type of species. In other words, it's a stoichiometric
00037    *  phase. However, no assumptions are made concerning the
00038    *  thermodynamic functions or the equation of state of the
00039    *  phase. Therefore it's an incomplete description of
00040    *  the thermodynamics. The complete description must be
00041    *  made in a derived class of %SingleSpeciesTP.
00042    *
00043    *  Several different groups of thermodynamic functions are resolved
00044    *  at this level by this class. For example, All partial molar property
00045    *  routines call their single species standard state equivalents.
00046    *  All molar solution thermodynamic routines call the single species
00047    *  standard state equivalents.
00048    *  Activities routines are resolved at this level, as there is only
00049    *  one species.
00050    *
00051    *  It is assumed that the reference state thermodynamics may be
00052    *  obtained by a pointer to a populated species thermodynamic property
00053    *  manager class (see ThermoPhase::m_spthermo). How to relate pressure
00054    *  changes to the reference state thermodynamics is again left open
00055    *  to implementation.
00056    *
00057    *  Mole fraction and Mass fraction vectors are assumed to be equal
00058    *  to x[0] = 1 y[0] = 1, respectively. Simplifications to the interface
00059    *  of setState_TPY() and setState_TPX() functions result and are made
00060    *  within the class.
00061    *
00062    *  Note, this class can handle the thermodynamic description of one
00063    *  phase of one species. It can not handle the description of phase
00064    *  equilibrium between two phases of a stoichiometric compound
00065    *  (e.g. water liquid and water vapor, below the critical point).
00066    *  However, it may be used to describe the thermodynamics of one phase
00067    *  of such a compound even past the phase equilibrium point, up to the 
00068    *  point where the phase itself ceases to be a stable phase.
00069    *
00070    *  This class doesn't do much at the initialization level. 
00071    *  It's SingleSpeciesTP::initThermo()
00072    *  member does check that one and only one species has been defined
00073    *  to occupy the phase.
00074    *
00075    *  \nosubgrouping
00076    */
00077   class SingleSpeciesTP : public ThermoPhase {
00078 
00079   public:
00080         
00081     //! Base empty constructor. 
00082     SingleSpeciesTP();
00083 
00084     //! Copy constructor
00085     /*!
00086      * @param right Object to be copied
00087      */
00088     SingleSpeciesTP(const SingleSpeciesTP  &right);
00089     
00090     //! Assignment operator
00091     /*!
00092      * @param right Object to be copied
00093      */
00094     SingleSpeciesTP & operator=(const SingleSpeciesTP & right);
00095 
00096     //! Destructor
00097     virtual ~SingleSpeciesTP();
00098 
00099     //! Duplication function
00100     /*!
00101      * This virtual function is used to create a duplicate of the
00102      * current phase. It's used to duplicate the phase when given
00103      * a ThermoPhase pointer to the phase.
00104      *
00105      * @return It returns a ThermoPhase pointer.
00106      */
00107     ThermoPhase *duplMyselfAsThermoPhase() const;
00108 
00109     /**
00110      *   
00111      * @name  Information Methods  
00112      * @{
00113      */
00114 
00115     /** 
00116      * Returns the equation of state type flag.
00117      * This is a modified base class.
00118      * Therefore, if not overridden in derivied classes,
00119      * this call will throw an exception.
00120      */
00121     virtual int eosType() const;
00122 
00123     /**
00124      * @} 
00125      * @name  Molar Thermodynamic Properties of the Solution
00126      *
00127      *  These functions are resolved at this level, by reference
00128      *  to the partial molar functions and standard state
00129      *  functions for species 0. Derived classes don't need
00130      *  to supply entries for these functions.
00131      * @{
00132      */
00133 
00134     /// Molar enthalpy. Units: J/kmol. 
00135     /*!
00136      * This function is resolved here by calling the standard state
00137      * thermo function.
00138      */
00139     doublereal enthalpy_mole() const;
00140 
00141     /// Molar internal energy. Units: J/kmol. 
00142     /*!
00143      * This function is resolved here by calling the standard state
00144      * thermo function.
00145      */
00146     doublereal intEnergy_mole() const;
00147 
00148     /// Molar entropy. Units: J/kmol/K. 
00149     /*!
00150      * This function is resolved here by calling the standard state
00151      * thermo function.
00152      */
00153     doublereal entropy_mole() const;
00154 
00155     /// Molar Gibbs function. Units: J/kmol.
00156     /*!
00157      * This function is resolved here by calling the standard state
00158      * thermo function.
00159      */ 
00160     doublereal gibbs_mole() const;
00161 
00162     /// Molar heat capacity at constant pressure. Units: J/kmol/K. 
00163     /*!
00164      * This function is resolved here by calling the standard state
00165      * thermo function.
00166      */
00167     doublereal cp_mole() const;
00168 
00169     /// Molar heat capacity at constant volume. Units: J/kmol/K. 
00170     /*!
00171      * This function is resolved here by calling the standard state
00172      * thermo function.
00173      */
00174     doublereal cv_mole() const;
00175 
00176     /**
00177      * @}
00178      * @name Mechanical Properties
00179      * @{
00180      */
00181 
00182     /**
00183      * @} 
00184      * @name Electric Potential
00185      * 
00186      * The phase may be at some non-zero electrical
00187      * potential. These methods set or get the value of the
00188      * electric potential.
00189      */
00190     //@{
00191 
00192     /**
00193      * @} 
00194      * @name Potential Energy
00195      * 
00196      * Species may have an additional potential energy due to the
00197      * presence of external gravitation or electric fields. These
00198      * methods allow specifying a potential energy for individual
00199      * species.
00200      * @{
00201      */
00202 
00203 
00204 
00205     /**
00206      * @}
00207      * @name Activities, Standard State, and Activity Concentrations
00208      *
00209      * The activity \f$a_k\f$ of a species in solution is
00210      * related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
00211      * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
00212      * the chemical potential at unit activity, which depends only
00213      * on temperature.
00214      * @{
00215      */
00216 
00217     /**
00218      * Get the array of non-dimensional activities at
00219      * the current solution temperature, pressure, and
00220      * solution concentration.
00221      *
00222      * We redefine this function to just return 1.0 here.
00223      *
00224      * @param a   Output vector of activities. Length: 1.
00225      */
00226     virtual void getActivities(doublereal* a) const {
00227       a[0] = 1.0;
00228     }
00229 
00230     /**
00231      * Get the array of non-dimensional activity coefficients at
00232      * the current solution temperature, pressure, and
00233      * solution concentration.
00234      *
00235      * @param ac Output vector of activity coefficients. Length: 1.
00236      */
00237     virtual void getActivityCoefficients(doublereal* ac) const {
00238       if (m_kk == 1) {
00239         ac[0] = 1.0;
00240       } else {
00241         err("getActivityCoefficients");
00242       }
00243     }    
00244 
00245     //@}
00246     /// @name  Partial Molar Properties of the Solution
00247     ///
00248     ///  These functions are resolved at this level, by reference
00249     ///  to the partial molar functions and standard state
00250     ///  functions for species 0. Derived classes don't need
00251     ///  to supply entries for these functions.
00252     //@{
00253 
00254     /*
00255      * These functions are all resolved here to point to the
00256      * standard state functions for species 0
00257      */
00258     
00259     //!  Get the array of non-dimensional species chemical potentials
00260     //! These are partial molar Gibbs free energies.
00261     /*!
00262      *  These are the phase, partial molar, and the standard state
00263      *  dimensionless chemical potentials.
00264      *  \f$ \mu_k / \hat R T \f$.
00265      *
00266      * Units: unitless
00267      *
00268      *  @param murt   On return, Contains the chemical potential / RT of the single species
00269      *                and the phase. Units are unitless. Length = 1
00270      */
00271     void getChemPotentials_RT(doublereal* murt) const;
00272 
00273     //! Get the array of chemical potentials
00274     /*!
00275      * These are the phase, partial molar, and the standard state chemical potentials.
00276      *     \f$ \mu(T,P) = \mu^0_k(T,P) \f$.
00277      *
00278      *  @param mu   On return, Contains the chemical potential of the single species
00279      *              and the phase. Units are J / kmol . Length = 1
00280      */
00281     void getChemPotentials(doublereal* mu) const;
00282 
00283     //! Get the species electrochemical potentials. Units: J/kmol.
00284     /*!
00285      * This method adds a term \f$ Fz_k \phi_k \f$ to 
00286      * each chemical potential.
00287      *
00288      * This is resolved here. A single  species phase
00289      * is not allowed to have anything other than a zero charge.
00290      *
00291      *  @param mu   On return, Contains the electrochemical potential of the single species
00292      *                and the phase. Units J/kmol . Length = 1
00293      */
00294     void getElectrochemPotentials(doublereal* mu) const;
00295 
00296     //!  Get the species partial molar enthalpies. Units: J/kmol.
00297     /*!
00298      * These are the phase enthalpies.  \f$ h_k \f$.
00299      *
00300      * This function is resolved here by calling the standard state
00301      * thermo function.
00302      *
00303      * @param hbar    Output vector of species partial molar enthalpies.
00304      *                Length: 1. units are J/kmol.
00305      */
00306     void getPartialMolarEnthalpies(doublereal* hbar) const;
00307  
00308    
00309     //! Get the species partial molar internal energies. Units: J/kmol.
00310     /*!
00311      * These are the phase internal energies.  \f$ u_k \f$.
00312      *
00313      * This  member function is resolved here. A single species phase obtains its
00314      * thermo from the standard state function.
00315      *
00316      *  @param ubar On return, Contains the internal energy of the single species
00317      *              and the phase. Units are J / kmol . Length = 1
00318      */
00319     virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
00320 
00321     //! Get the species partial molar entropy. Units: J/kmol K.
00322     /*!
00323      * This is the phase entropy.  \f$ s(T,P) = s_o(T,P) \f$.
00324      *
00325      * This member function is resolved here. A single species phase obtains its
00326      * thermo from the standard state function.
00327      *
00328      *  @param sbar On return, Contains the entropy of the single species
00329      *              and the phase. Units are J / kmol / K . Length = 1
00330      */
00331     void getPartialMolarEntropies(doublereal* sbar) const;
00332 
00333     //! Get the species partial molar Heat Capacities. Units: J/ kmol /K.
00334     /*!
00335      * This is the phase heat capacity.  \f$ Cp(T,P) = Cp_o(T,P) \f$.
00336      *
00337      * This member function is resolved here. A single species phase obtains its
00338      * thermo from the standard state function.
00339      *
00340      *  @param cpbar On return, Contains the heat capacity of the single species
00341      *              and the phase. Units are J / kmol / K . Length = 1
00342      */
00343     void getPartialMolarCp(doublereal* cpbar) const;
00344 
00345     //! Get the species partial molar volumes. Units: m^3/kmol.
00346     /*!
00347      * This is the phase molar volume.  \f$ V(T,P) = V_o(T,P) \f$.
00348      *
00349      * This member function is resolved here. A single species phase obtains its
00350      * thermo from the standard state function.
00351      *
00352      *  @param vbar On return, Contains the molar volume of the single species
00353      *              and the phase. Units are m^3 / kmol. Length = 1
00354      */
00355     void getPartialMolarVolumes(doublereal* vbar) const;
00356 
00357     //@}
00358     /// @name  Properties of the Standard State of the Species in the Solution
00359     /// These functions are the primary way real properties are
00360     /// supplied to derived thermodynamics classes of SingleSpeciesTP.
00361     /// These functions must be supplied in derived classes. They
00362     /// are not resolved at the SingleSpeciesTP level.
00363     //@{
00364 
00365 
00366     /**
00367      * Get the dimensional Gibbs functions for the standard
00368      * state of the species at the current T and P.
00369      *
00370      * This function is resolved here by referencing getGibbs_RT().
00371      *
00372      * @param gpure returns a vector of size 1, containing the Gibbs function
00373      *              Units: J/kmol.
00374      */
00375     void getPureGibbs(doublereal* gpure) const;
00376 
00377     //! Get the molar volumes of each species in their standard
00378     //! states at the current  <I>T</I> and <I>P</I> of the solution.
00379     /*!
00380      *   units = m^3 / kmol
00381      *
00382      * We resolve this function at this level, by assigning 
00383      * the molecular weight divided by the phase density
00384      *
00385      * @param vbar On output this contains the standard volume of the species
00386      *             and phase (m^3/kmol). Vector of length 1
00387      */
00388     void getStandardVolumes(doublereal *vbar) const;
00389 
00390 
00391     //@}
00392     /// @name Thermodynamic Values for the Species Reference State
00393     ///
00394     /// Almost all functions in this group are resolved by this
00395     /// class. It is assumed that the m_spthermo species thermo
00396     /// pointer is populated and yields the reference state thermodynamics
00397     /// The internal energy function is not given by this
00398     /// class, since it would involve a specification of the
00399     /// equation of state.
00400     //@{
00401 
00402  #ifdef H298MODIFY_CAPABILITY
00403   
00404     //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
00405     /*!
00406      *   The 298K heat of formation is defined as the enthalpy change to create the standard state
00407      *   of the species from its constituent elements in their standard states at 298 K and 1 bar.
00408      *
00409      *   @param  k           Species k
00410      *   @param  Hf298New    Specify the new value of the Heat of Formation at 298K and 1 bar                      
00411      */
00412     virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
00413        m_spthermo->modifyOneHf298(k, Hf298New);
00414        m_tlast += 0.0001234;
00415     }
00416 #endif
00417 
00418     /*!
00419      *  Returns the vector of nondimensional
00420      *  enthalpies of the reference state at the current temperature
00421      *  of the solution and the reference pressure for the species.
00422      *
00423      *  This function is resolved in this class.  It is assumed that the m_spthermo species thermo
00424      *  pointer is populated and yields the reference state.
00425      *
00426      * @param hrt     Output vector containing the nondimensional reference state enthalpies
00427      *                Length: m_kk.
00428      */
00429     virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
00430      
00431     /*!
00432      *  Returns the vector of nondimensional
00433      *  enthalpies of the reference state at the current temperature
00434      *  of the solution and the reference pressure for the species.
00435      *
00436      *  This function is resolved in this class.  It is assumed that the m_spthermo species thermo
00437      *  pointer is populated and yields the reference state.
00438      *
00439      * @param grt     Output vector containing the nondimensional reference state 
00440      *                Gibbs Free energies.  Length: m_kk.
00441      */
00442     virtual void getGibbs_RT_ref(doublereal *grt) const;
00443                    
00444  
00445     /*!
00446      *  Returns the vector of the
00447      *  gibbs function of the reference state at the current temperature
00448      *  of the solution and the reference pressure for the species.
00449      *  units = J/kmol
00450      *
00451      *  This function is resolved in this class.  It is assumed that the m_spthermo species thermo
00452      *  pointer is populated and yields the reference state.
00453      *
00454      * @param g       Output vector containing the  reference state 
00455      *                Gibbs Free energies.  Length: m_kk. Units: J/kmol.
00456      */
00457     virtual void  getGibbs_ref(doublereal *g) const;
00458       
00459     /*!
00460      *  Returns the vector of nondimensional
00461      *  entropies of the reference state at the current temperature
00462      *  of the solution and the reference pressure for each species.
00463      *
00464      *  This function is resolved in this class.  It is assumed that the m_spthermo species thermo
00465      *  pointer is populated and yields the reference state.
00466      *
00467      * @param er      Output vector containing the nondimensional reference state 
00468      *                entropies.  Length: m_kk.
00469        */
00470     virtual void getEntropy_R_ref(doublereal *er) const;
00471     
00472     /*!
00473      *  Returns the vector of nondimensional
00474      *  constant pressure heat capacities of the reference state
00475      *  at the current temperature of the solution
00476      *  and reference pressure for each species.
00477      *
00478      *  This function is resolved in this class.  It is assumed that the m_spthermo species thermo
00479      *  pointer is populated and yields the reference state.
00480      *
00481      * @param cprt   Output vector of nondimensional reference state
00482      *               heat capacities at constant pressure for the species.
00483      *               Length: m_kk
00484      */
00485     virtual void getCp_R_ref(doublereal *cprt) const;
00486 
00487     /**
00488      * @name Setting the State
00489      *
00490      * These methods set all or part of the thermodynamic
00491      * state.
00492      * @{
00493      */
00494   
00495     //! Set the temperature (K), pressure (Pa), and mole fractions.
00496     /*!
00497      * Note, the mole fractions are set to X[0] = 1.0.
00498      * Setting the pressure may involve the solution of a nonlinear equation.
00499      *
00500      * @param t    Temperature (K)
00501      * @param p    Pressure (Pa)
00502      * @param x    Vector of mole fractions.
00503      *             Length is equal to m_kk.
00504      */
00505     void setState_TPX(doublereal t, doublereal p, const doublereal* x);
00506 
00507     //! Set the temperature (K), pressure (Pa), and mole fractions.  
00508     /*!
00509      * Note, the mole fractions are set to X[0] = 1.0.
00510      * Setting the pressure may involve the solution of a nonlinear equation.
00511      *
00512      * @param t    Temperature (K)
00513      * @param p    Pressure (Pa)
00514      * @param x    String containing a composition map of the mole fractions. Species not in
00515      *             the composition map are assumed to have zero mole fraction
00516      */
00517     void setState_TPX(doublereal t, doublereal p, compositionMap& x);
00518     
00519     //! Set the temperature (K), pressure (Pa), and mole fractions.  
00520     /*!
00521      * Note, the mole fractions are set to X[0] = 1.0.
00522      * Setting the pressure may involve the solution of a nonlinear equation.
00523      *
00524      * @param t    Temperature (K)
00525      * @param p    Pressure (Pa)
00526      * @param x    String containing a composition map of the mole fractions. Species not in
00527      *             the composition map are assumed to have zero mole fraction
00528      */
00529     void setState_TPX(doublereal t, doublereal p, const std::string& x);
00530     
00531     //! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase.
00532     /*!
00533      * Note, the mass fractions are set to Y[0] = 1.0.
00534      * Setting the pressure may involve the solution of a nonlinear equation.
00535      *
00536      * @param t    Temperature (K)
00537      * @param p    Pressure (Pa)
00538      * @param y    Vector of mass fractions.
00539      *             Length is equal to m_kk.
00540      */
00541     void setState_TPY(doublereal t, doublereal p, const doublereal* y);
00542 
00543     //! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase
00544     /*!
00545      * Note, the mass fractions are set to Y[0] = 1.0.
00546      * Setting the pressure may involve the solution of a nonlinear equation.
00547      *
00548      * @param t    Temperature (K)
00549      * @param p    Pressure (Pa)
00550      * @param y    Composition map of mass fractions. Species not in
00551      *             the composition map are assumed to have zero mass fraction
00552      */
00553     void setState_TPY(doublereal t, doublereal p, compositionMap& y);
00554         
00555     //! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase
00556     /*!
00557      * Note, the mass fractions are set to Y[0] = 1.0.
00558      * Setting the pressure may involve the solution of a nonlinear equation.
00559      *
00560      * @param t    Temperature (K)
00561      * @param p    Pressure (Pa)
00562      * @param y    String containing a composition map of the mass fractions. Species not in
00563      *             the composition map are assumed to have zero mass fraction
00564      */
00565     void setState_TPY(doublereal t, doublereal p, const std::string& y);
00566 
00567 
00568     //! Set the pressure (Pa) and mole fractions. 
00569     /*!
00570      * Note, the mole fractions are set to X[0] = 1.0.
00571      * Setting the pressure may involve the solution of a nonlinear equation.
00572      *
00573      * @param p    Pressure (Pa)
00574      * @param x    Vector of mole fractions.
00575      *             Length is equal to m_kk.
00576      */
00577     void setState_PX(doublereal p, doublereal* x);
00578 
00579     //! Set the internally storred pressure (Pa) and mass fractions. 
00580     /*!
00581      * Note, the mass fractions are set to Y[0] = 1.0.
00582      * Note, the temperature is held constant during this operation.
00583      * Setting the pressure may involve the solution of a nonlinear equation.
00584      *
00585      * @param p    Pressure (Pa)
00586      * @param y    Vector of mass fractions.
00587      *             Length is equal to m_kk.
00588      */
00589     void setState_PY(doublereal p, doublereal* y);
00590 
00591     //! Set the internally storred specific enthalpy (J/kg) and pressure (Pa) of the phase.
00592     /*!
00593      * @param h     Specific enthalpy (J/kg)
00594      * @param p     Pressure (Pa)
00595      * @param tol  Optional parameter setting the tolerance of the
00596      *             calculation.
00597      */
00598     virtual void setState_HP(doublereal h, doublereal p, 
00599                              doublereal tol = 1.e-8);
00600 
00601     //! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
00602     /*!
00603      * This function fixes the internal state of the phase so that
00604      * the specific internal energy and specific volume have the value of the input parameters.
00605      *
00606      * @param u    specific internal energy (J/kg)
00607      * @param v    specific volume (m^3/kg).
00608      * @param tol  Optional parameter setting the tolerance of the
00609      *             calculation.
00610      */
00611     virtual void setState_UV(doublereal u, doublereal v, 
00612                              doublereal tol = 1.e-8);
00613 
00614     //! Set the specific entropy (J/kg/K) and pressure (Pa).
00615     /*!
00616      * This function fixes the internal state of the phase so that
00617      * the specific entropy and the pressure have the value of the input parameters.
00618      *
00619      * @param s    specific entropy (J/kg/K)
00620      * @param p    specific pressure (Pa).
00621      * @param tol  Optional parameter setting the tolerance of the
00622      *             calculation.
00623      */
00624     virtual void setState_SP(doublereal s, doublereal p, 
00625                              doublereal tol = 1.e-8);
00626 
00627     //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
00628     /*!
00629      * This function fixes the internal state of the phase so that
00630      * the specific entropy and specific volume have the value of the input parameters.
00631      *
00632      * @param s    specific entropy (J/kg/K)
00633      * @param v    specific volume (m^3/kg).
00634      * @param tol  Optional parameter setting the tolerance of the
00635      *             calculation.
00636      */
00637     virtual void setState_SV(doublereal s, doublereal v, 
00638                              doublereal tol = 1.e-8);
00639 
00640     /**
00641      * @internal
00642      * Set equation of state parameters. The number and meaning of
00643      * these depends on the subclass. 
00644      * @param n number of parameters
00645      * @param c array of  n coefficients
00646      * 
00647      */
00648     virtual void setParameters(int n, doublereal* const c) {}
00649 
00650     virtual void getParameters(int &n, doublereal * const c) const {}
00651 
00652     /**
00653      * Set equation of state parameter values from XML
00654      * entries. This method is called by function importPhase in
00655      * file importCTML.cpp when processing a phase definition in
00656      * an input file. It should be overloaded in subclasses to set
00657      * any parameters that are specific to that particular phase
00658      * model. 
00659      *   
00660      * @param eosdata An XML_Node object corresponding to
00661      * the "thermo" entry for this phase in the input file.
00662      */
00663     virtual void setParametersFromXML(const XML_Node& eosdata) {}
00664         
00665     //---------------------------------------------------------
00666     /// @name Critical state properties.
00667     /// These methods are only implemented by some subclasses.
00668         
00669     //@{
00670         
00671 
00672         
00673     //@}
00674         
00675     /// @name Saturation properties.
00676     /// These methods are only implemented by subclasses that 
00677     /// implement full liquid-vapor equations of state.
00678     ///
00679     virtual doublereal satTemperature(doublereal p) const {
00680       err("satTemperature"); return -1.0;
00681     }
00682         
00683     virtual doublereal satPressure(doublereal t) const {
00684       err("satPressure"); return -1.0;
00685     }
00686         
00687     virtual doublereal vaporFraction() const {
00688       err("vaprFraction"); return -1.0;
00689     }
00690         
00691     virtual void setState_Tsat(doublereal t, doublereal x) {
00692       err("setState_sat"); 
00693     }
00694 
00695     virtual void setState_Psat(doublereal p, doublereal x) {
00696       err("setState_sat"); 
00697     }
00698 
00699     //@}
00700   
00701 
00702     /**
00703      * @internal Initialize.
00704      *
00705      * This method is provided to allow
00706      * subclasses to perform any initialization required after all
00707      * species have been added. For example, it might be used to
00708      * resize internal work arrays that must have an entry for
00709      * each species.   When importing a CTML phase
00710      * description, this method is called just prior to returning
00711      * from function importPhase().
00712      *
00713      * Inheriting objects should call this function
00714      *
00715      * This version sets the mole fraction vector to x[0] = 1.0, and then
00716      * calls the ThermoPhase::initThermo() function.
00717      *
00718      * @see importCTML.cpp
00719      */
00720     virtual void initThermo();
00721 
00722 
00723   protected:
00724 
00725     //! Lower value of the temperature for which reference thermo is valid
00726     doublereal m_tmin;
00727     //! Upper value of the temperature for which reference thermo is valid
00728     doublereal m_tmax;
00729 
00730     //! The current pressure of the solution (Pa)
00731     /*!
00732      * It gets initialized to 1 atm.
00733      */
00734     doublereal m_press;
00735 
00736     /*!
00737      * Reference pressure (Pa) must be the same for all species
00738      * - defaults to 1 atm.
00739      */
00740     doublereal m_p0;
00741 
00742     //! Last temperature used to evaluate the thermodynamic polynomial.
00743     mutable doublereal     m_tlast;
00744 
00745     //! Dimensionless enthalpy at the (mtlast, m_p0)
00746     mutable array_fp       m_h0_RT;
00747     //! Dimensionless heat capacity at the (mtlast, m_p0)
00748     mutable array_fp       m_cp0_R;
00749     //! Dimensionless entropy at the (mtlast, m_p0)
00750     mutable array_fp       m_s0_R;
00751 
00752   protected:
00753     /**
00754      * @internal
00755      *        This crucial internal routine calls the species thermo
00756      *        update program to calculate new species Cp0, H0, and
00757      *        S0 whenever the temperature has changed.
00758      */
00759     void _updateThermo() const;
00760 
00761   private:
00762 
00763     //! Error return for unhandled cases
00764     /*!
00765      * @param msg   String message
00766      */
00767     doublereal err(std::string msg) const;
00768   };
00769 
00770 }
00771         
00772 #endif
00773 
00774 
00775 
Generated by  doxygen 1.6.3