SpeciesThermo.h

Go to the documentation of this file.
00001 /**
00002  *  @file SpeciesThermo.h
00003  *  Virtual base class for the calculation of multiple-species thermodynamic
00004  *  reference-state property managers and text for the mgrsrefcalc module (see \ref mgrsrefcalc 
00005  *  and class \link Cantera::SpeciesThermo SpeciesThermo\endlink).
00006  */
00007 
00008 /*
00009  * $Author: hkmoffa $
00010  * $Revision: 385 $
00011  * $Date: 2010-01-17 12:05:46 -0500 (Sun, 17 Jan 2010) $
00012  */
00013 
00014 // Copyright 2001  California Institute of Technology
00015 
00016 
00017 #ifndef CT_SPECIESTHERMO_H
00018 #define CT_SPECIESTHERMO_H
00019 
00020 #include "ct_defs.h"
00021 
00022 namespace Cantera {
00023 
00024   class SpeciesThermoInterpType;
00025 
00026   /**
00027    * @defgroup mgrsrefcalc Managers for Calculating Reference-State Thermodynamics
00028    *
00029    *  The ThermoPhase object relies on a set of manager classes to calculate 
00030    *  the thermodynamic properties of the reference state for all
00031    *  of the species in the phase. This may be a computationally
00032    *  significant cost, so efficiency is important. 
00033    *  This group describes how this is done efficiently within Cantera.
00034    *  
00035    *
00036    * To compute the thermodynamic properties of multicomponent
00037    * solutions, it is necessary to know something about the
00038    * thermodynamic properties of the individual species present in
00039    * the solution. Exactly what sort of species properties are
00040    * required depends on the thermodynamic model for the
00041    * solution. For a gaseous solution (i.e., a gas mixture), the
00042    * species properties required are usually ideal gas properties at
00043    * the mixture temperature and at a reference pressure (almost always at
00044    * 1 bar).
00045    *
00046    *
00047    * In defining these standard states for species in a phase, we make
00048    * the following definition. A reference state is a standard state
00049    * of a species in a phase limited to one particular pressure, the reference
00050    * pressure. The reference state specifies the dependence of all
00051    * thermodynamic functions as a function of the temperature, in
00052    * between a minimum temperature and a maximum temperature. The
00053    * reference state also specifies the molar volume of the species
00054    * as a function of temperature. The molar volume is a thermodynamic
00055    * function. By constrast, a full standard state does the same thing
00056    * as a reference state, but specifies the thermodynamics functions
00057    * at all pressures.
00058    *
00059    *  Whatever the conventions used by a particular solution model,
00060    *  means need to be provided to compute the species properties in 
00061    *  the reference state. Class SpeciesThermo is the base class
00062    *  for a family of classes that compute properties of all
00063    *  species in a phase in their reference states, for a range of temperatures.
00064    *  Note, the pressure dependence of the species thermodynamic functions is not
00065    *  handled by this particular species thermodynamic model. %SpeciesThermo
00066    *  calculates the reference-state thermodynamic values of all species in a single
00067    *  phase during each call. The vector nature of the operation leads to
00068    *  a lower operation count and better efficiency, especially if the
00069    *  individual reference state classes are known to the reference-state
00070    *  manager class so that common operations may be grouped together.
00071    *
00072    *  The most important member function for the %SpeciesThermo class
00073    *  is the member function \link SpeciesThermo::update() update()\endlink.
00074    *  The function calculates the values of Cp, H, and S for all of the
00075    *  species at once at the specified temperature.
00076    *
00077    *  Usually, all of the species in a phase are installed into a %SpeciesThermo
00078    *  class. However, there is no requirement that a %SpeciesThermo 
00079    *  object handles all of the species in a phase. There are
00080    *  two member functions that are called to install each species into
00081    *  the %SpeciesThermo.
00082    *  One routine is called \link SpeciesThermo::install() install()\endlink.
00083    *  It is called with the index of the species in the phase,
00084    *  an integer type delineating
00085    *  the SpeciesThermoInterpType object, and a listing of the 
00086    *  parameters for that parameterization. A factory routine is called based
00087    *  on the integer type.  The other routine is called 
00088    *  \link SpeciesThermo::install_STIT() install_STIT()\endlink.
00089    *  It accepts as an argument a pointer to an already formed
00090    *  SpeciesThermoInterpType object.
00091    *
00092    *
00093    *  The following classes inherit from %SpeciesThermo. Each of these classes
00094    *  handle multiple species, usually all of the species in a phase. However,
00095    *  there is no requirement that a %SpeciesThermo object handles all of the
00096    *  species in a phase.
00097    *
00098    *   - NasaThermo          in file NasaThermo.h
00099    *      - This is a two zone model, with each zone consisting of a 7 
00100    *        coefficient Nasa Polynomial format.
00101    *      .
00102    *   - ShomateThermo       in file ShomateThermo.h
00103    *      - This is a two zone model, with each zone consisting of a 7 
00104    *        coefficient Shomate Polynomial format.
00105    *      .
00106    *   - SimpleThermo        in file SimpleThermo.h
00107    *      - This is a one-zone constant heat capacity model.
00108    *      .
00109    *   - GeneralSpeciesThermo in file GeneralSpeciesThermo.h
00110    *      - This is a general model. Each species is handled separately
00111    *        via a vector over SpeciesThermoInterpType classes.
00112    *      . 
00113    *   - SpeciesThermo1        in file SpeciesThermoMgr.h
00114    *   - SpeciesThermoDuo      in file SpeciesThermoMgr.h
00115    *      - This is a combination of two SpeciesThermo types.
00116    *      .
00117    *   .
00118    *
00119    * The class SpeciesThermoInterpType is a pure virtual base class for
00120    * calculation of thermodynamic functions for a single species
00121    * in its reference state.
00122    * The following classes inherit from %SpeciesThermoInterpType.
00123    *
00124    *   - NasaPoly1          in file NasaPoly1.h
00125    *      - This is a one zone model,  consisting of a 7 
00126    *        coefficient Nasa Polynomial format.
00127    *      .
00128    *   - NasaPoly2          in file NasaPoly2.h
00129    *      - This is a two zone model, with each zone consisting of a 7 
00130    *        coefficient Nasa Polynomial format.
00131    *      .
00132    *   - ShomatePoly        in file ShomatePoly.h
00133    *      - This is a one zone model, consisting of a 7 
00134    *        coefficient Shomate Polynomial format.
00135    *      .
00136    *   - ShomatePoly2       in file ShomatePoly.h
00137    *      - This is a two zone model, with each zone consisting of a 7 
00138    *        coefficient Shomate Polynomial format.
00139    *      .
00140    *   - ConstCpPoly        in file ConstCpPoly.h
00141    *      - This is a one-zone constant heat capacity model.
00142    *      .
00143    *   - Mu0Poly            in file Mu0Poly.h
00144    *      - This is a multizoned model. The chemical potential is given
00145    *        at a set number of temperatures. Between each temperature
00146    *        the heat capacity is treated as a constant.
00147    *      .
00148    *   - Nasa9Poly1          in file Nasa9Poly1.h
00149    *      - This is a one zone model,  consisting of the 9
00150    *        coefficient Nasa Polynomial format.
00151    *      .
00152    *   - Nasa9PolyMultiTempRegion       in file Nasa9PolyMultiTempRegion.h
00153    *      - This is a multiple zone model, consisting of the 9
00154    *        coefficient Nasa Polynomial format in each zone.
00155    *      .
00156    *   .In particular the NasaThermo %SpeciesThermo-derived model has
00157    *    been optimized for execution speed. It's the main-stay of
00158    *    gas phase computations involving large numbers of species in 
00159    *    a phase. It combines the calculation of each species, which
00160    *    individually have NasaPoly2 representations, to 
00161    *    minimize the computational time.
00162    *  
00163    *    The GeneralSpeciesThermo %SpeciesThermo object is completely
00164    *    general. It does not try to coordinate the individual species
00165    *    calculations at all and therefore is the slowest but
00166    *    most general implementation.
00167    *
00168    * @ingroup thermoprops   
00169    */
00170   //@{
00171 
00172   
00173   //! Pure Virtual base class for the species thermo manager classes.
00174   /*!
00175    *  This class defines the interface which all subclasses must implement. 
00176    *
00177    * Class %SpeciesThermo is the base class
00178    * for a family of classes that compute properties of a set of 
00179    * species in their reference state at a range of temperatures.
00180    * Note, the pressure dependence of the reference state is not
00181    * handled by this particular species standard state model.
00182    */
00183   class SpeciesThermo {
00184     
00185   public:
00186 
00187     //! Constructor
00188     SpeciesThermo() {}
00189 
00190     //! Destructor
00191     virtual ~SpeciesThermo() {}
00192 
00193     //! Copy Constructor for the %SpeciesThermo object. 
00194     /*!
00195      * @param right    Reference to %SpeciesThermo object to be copied into the
00196      *                 current one. 
00197      */
00198     SpeciesThermo(const SpeciesThermo &right) {}
00199         
00200     //! Assignment operator for the %SpeciesThermo object
00201     /*!
00202      *  This is NOT a virtual function.
00203      *
00204      * @param right    Reference to %SpeciesThermo object to be copied into the
00205      *                 current one. 
00206      */
00207     SpeciesThermo& operator=(const SpeciesThermo &right) {
00208       return *this;
00209     }
00210    
00211     //! Duplication routine for objects which inherit from 
00212     //! %SpeciesThermo
00213     /*!
00214      *  This virtual routine can be used to duplicate %SpeciesThermo  objects
00215      *  inherited from %SpeciesThermo even if the application only has
00216      *  a pointer to %SpeciesThermo to work with.
00217      *  ->commented out because we first need to add copy constructors
00218      *   and assignment operators to all of the derived classes.
00219      */
00220     virtual SpeciesThermo *duplMyselfAsSpeciesThermo() const = 0;
00221     
00222     //! Install a new species thermodynamic property
00223     //! parameterization for one species.  
00224     /*!
00225      *
00226      * @param name      Name of the species
00227      * @param index     The 'update' method will update the property 
00228      *                  values for this species 
00229      *                  at position i index in the property arrays.  
00230      * @param type      int flag specifying the type of parameterization to be
00231      *                 installed. 
00232      * @param c        vector of coefficients for the parameterization. 
00233      *                 This vector is simply passed through to the
00234      *                 parameterization constructor.
00235      * @param minTemp  minimum temperature for which this parameterization
00236      *                 is valid.
00237      * @param maxTemp  maximum temperature for which this parameterization
00238      *                 is valid.
00239      * @param refPressure standard-state pressure for this 
00240      *                    parameterization. 
00241      * @see speciesThermoTypes.h 
00242      */
00243     virtual void install(std::string name, int index, int type, 
00244                          const doublereal* c, 
00245                          doublereal minTemp, doublereal maxTemp,
00246                          doublereal refPressure)=0;
00247 
00248     //! Install a new species thermodynamic property
00249     //! parameterization for one species.
00250     /*!
00251      * @param stit_ptr Pointer to the SpeciesThermoInterpType object
00252      *          This will set up the thermo for one species
00253      */
00254     virtual void install_STIT(SpeciesThermoInterpType *stit_ptr) = 0;
00255 
00256     
00257     //! Compute the reference-state properties for all species.
00258     /*!
00259      * Given temperature T in K, this method updates the values of
00260      * the non-dimensional heat capacity at constant pressure,
00261      * enthalpy, and entropy, at the reference pressure, Pref
00262      * of each of the standard states.
00263      *
00264      * @param T       Temperature (Kelvin)
00265      * @param cp_R    Vector of Dimensionless heat capacities.
00266      *                (length m_kk).
00267      * @param h_RT    Vector of Dimensionless enthalpies.
00268      *                (length m_kk).
00269      * @param s_R     Vector of Dimensionless entropies.
00270      *                (length m_kk).
00271      */
00272     virtual void update(doublereal T, doublereal* cp_R, 
00273                         doublereal* h_RT, doublereal* s_R) const=0;
00274 
00275     
00276     //! Like update(), but only updates the single species k.
00277     /*!
00278      *  The default treatment is to just call update() which
00279      *  means that potentially the operation takes a m_kk*m_kk
00280      *  hit. 
00281      * 
00282      * @param k       species index
00283      * @param T       Temperature (Kelvin)
00284      * @param cp_R    Vector of Dimensionless heat capacities.
00285      *                (length m_kk).
00286      * @param h_RT    Vector of Dimensionless enthalpies.
00287      *                (length m_kk).
00288      * @param s_R     Vector of Dimensionless entropies.
00289      *                (length m_kk).
00290      */
00291     virtual void update_one(int k, doublereal T, 
00292                             doublereal* cp_R, 
00293                             doublereal* h_RT, 
00294                             doublereal* s_R) const {
00295       update(T, cp_R, h_RT, s_R);
00296     }
00297 
00298     //! Minimum temperature.
00299     /*!
00300      * If no argument is supplied, this
00301      * method returns the minimum temperature for which \e all
00302      * parameterizations are valid. If an integer index k is
00303      * supplied, then the value returned is the minimum
00304      * temperature for species k in the phase.
00305      *
00306      * @param k    Species index
00307      */ 
00308     virtual doublereal minTemp(int k=-1) const =0;
00309 
00310     //! Maximum temperature.
00311     /*!
00312      * If no argument is supplied, this
00313      * method returns the maximum temperature for which \e all
00314      * parameterizations are valid. If an integer index k is
00315      * supplied, then the value returned is the maximum
00316      * temperature for parameterization k.
00317      *
00318      * @param k  Species Index
00319      */
00320     virtual doublereal maxTemp(int k=-1) const =0;
00321     
00322     //! The reference-state pressure for species k.
00323     /*!
00324      *
00325      * returns the reference state pressure in Pascals for
00326      * species k. If k is left out of the argument list,
00327      * it returns the reference state pressure for the first
00328      * species.
00329      * Note that some SpeciesThermo implementations, such
00330      * as those for ideal gases, require that all species
00331      * in the same phase have the same reference state pressures.
00332      *
00333      * @param k Species Index
00334      */
00335     virtual doublereal refPressure(int k=-1) const =0;
00336 
00337     //! This utility function reports the type of parameterization
00338     //! used for the species with index number index.
00339     /*!
00340      *
00341      * @param index  Species index
00342      */
00343     virtual int reportType(int index = -1) const = 0;
00344 
00345     
00346     //! This utility function reports back the type of 
00347     //! parameterization and all of the parameters for the species, index.
00348     /*!
00349      * @param index     Species index
00350      * @param type      Integer type of the standard type
00351      * @param c         Vector of coefficients used to set the
00352      *                  parameters for the standard state.
00353      * @param minTemp   output - Minimum temperature
00354      * @param maxTemp   output - Maximum temperature
00355      * @param refPressure output - reference pressure (Pa).
00356      */
00357     virtual void reportParams(int index, int &type, 
00358                               doublereal * const c, 
00359                               doublereal &minTemp, 
00360                               doublereal &maxTemp, 
00361                               doublereal &refPressure) const =0;
00362 
00363     //! Modify parameters for the standard state
00364     /*!
00365      * @param index Species index
00366      * @param c     Vector of coefficients used to set the
00367      *              parameters for the standard state.
00368      */
00369     virtual void modifyParams(int index, doublereal *c) = 0;
00370   
00371 #ifdef H298MODIFY_CAPABILITY
00372     //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
00373     /*!
00374      *   The 298K Heat of Formation is defined as the enthalpy change to create the standard state
00375      *   of the species from its constituent elements in their standard states at 298 K and 1 bar.
00376      *
00377      *   @param k    species index
00378      *   @return     Returns the current value of the Heat of Formation at 298K and 1 bar
00379      */
00380     virtual doublereal reportOneHf298(int k) const = 0;
00381 
00382     //!  Modify the value of the 298 K Heat of Formation of the standard state of
00383     //!  one species in the phase (J kmol-1)
00384     /*!
00385      *   The 298K heat of formation is defined as the enthalpy change to create the standard state
00386      *   of the species from its constituent elements in their standard states at 298 K and 1 bar.
00387      *
00388      *   @param  k           Index of the species
00389      *   @param  Hf298New    Specify the new value of the Heat of Formation at 298K and 1 bar.
00390      *                       units = J/kmol.
00391      */
00392     virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
00393 #endif
00394   };
00395   //@}
00396 }
00397 
00398 #endif
00399 
Generated by  doxygen 1.6.3