VPSSMgr_General.h

Go to the documentation of this file.
00001 /**
00002  *  @file VPSSMgr_General.h
00003  *  Declaration file for a derived class that handles the calculation
00004  * of standard state thermo properties for
00005  * a set of species belonging to a single phase in a completely general
00006  * but slow way (see \ref mgrpdssthermocalc and
00007  * class \link Cantera::VPSSMgr_General VPSSMgr_General\endlink).
00008  */
00009 /*
00010  * $Revision: 279 $
00011  * $Date: 2009-12-05 14:08:43 -0500 (Sat, 05 Dec 2009) $
00012  */
00013 /*
00014  * Copywrite (2007) Sandia Corporation. Under the terms of 
00015  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
00016  * U.S. Government retains certain rights in this software.
00017  */
00018 
00019 #ifndef CT_VPSSMGR_GENERAL_H
00020 #define CT_VPSSMGR_GENERAL_H
00021 
00022 #include "ct_defs.h"
00023 #include "VPSSMgr.h"
00024 
00025 namespace Cantera {
00026 
00027   class SpeciesThermoInterpType;
00028   class VPStandardStateTP;
00029   class SpeciesThermo;
00030   class PDSS;
00031   
00032 
00033   //!  Class that handles the calculation of standard state thermo properties for
00034   //!  a set of species belonging to a single phase in a completely general
00035   //!  but slow way.
00036   /*!
00037    *   This class manages the calculation of standard state thermo properties for
00038    *   a set of species belonging to a single phase in a completely general
00039    *   but slow way. 
00040    *   The way this does this is to call the underlying PDSS routines one at a
00041    *   time for every species.
00042    *
00043    * @ingroup mgrpdssthermocalc
00044    */
00045   class VPSSMgr_General : public VPSSMgr {
00046     
00047   public:
00048 
00049     //! Constructor
00050     /*!
00051      *  @param vp_ptr Pointer to the owning VPStandardStateTP  object
00052      *                for the phase. It's a requirement that this be
00053      *                already malloced.
00054      *  @param spth   Pointer to the SpeciesThermo object for the
00055      *                phase. It's a requirement that this be already
00056      *                malloced.
00057      */
00058     VPSSMgr_General(VPStandardStateTP *vp_ptr,
00059                     SpeciesThermo *spth);
00060 
00061     //! Destructor
00062     virtual ~VPSSMgr_General();
00063 
00064     //! Copy Constructor for the %SpeciesThermo object. 
00065     /*!
00066      * @param right    Reference to %SpeciesThermo object to be copied into the
00067      *                 current one.
00068      */
00069     VPSSMgr_General(const VPSSMgr_General &right);
00070         
00071     //! Assignment operator for the %SpeciesThermo object
00072     /*!
00073      *  This is NOT a virtual function.
00074      *
00075      * @param right    Reference to %SpeciesThermo object to be copied into the
00076      *                 current one. 
00077      */
00078     VPSSMgr_General& operator=(const VPSSMgr_General &right);
00079    
00080     //! Duplication routine for objects which inherit from 
00081     //! %VPSSSpeciesThermo
00082     /*!
00083      *  This virtual routine can be used to duplicate %VPSSSpeciesThermo  objects
00084      *  inherited from %VPSSSpeciesThermo even if the application only has
00085      *  a pointer to %VPSSSpeciesThermo to work with.
00086      */
00087     virtual VPSSMgr *duplMyselfAsVPSSMgr() const;
00088 
00089     /*!
00090      * @name  Properties of the Standard State of the Species in the Solution 
00091      *
00092      *  Within VPStandardStateTP, these properties are calculated via a common routine, 
00093      *  _updateStandardStateThermo(),
00094      *  which must be overloaded in inherited objects.
00095      *  The values are cached within this object, and are not recalculated unless
00096      *  the temperature or pressure changes.
00097      */
00098     //@{
00099     
00100   
00101   protected:
00102 
00103     //! Internally updates the standard state thermodynamic functions at the current
00104     //! T and P of the solution.
00105     /*!
00106      * @internal
00107      *
00108      * If m_useTmpStandardStateStorage is true,
00109      * this function must be called whenever the temperature or pressure
00110      * has changed.
00111      *
00112      * This function is responsible for updating the following internal members,
00113      * when m_useTmpStandardStateStorage is true.
00114      *
00115      *  -  m_hss_RT;
00116      *  -  m_cpss_R;
00117      *  -  m_gss_RT;
00118      *  -  m_sss_R;
00119      *  -  m_Vss
00120      *
00121      *  If m_useTmpStandardStateStorage is not true, this function may be
00122      *  required to be called every time information is requested from
00123      *  this object.
00124      *
00125      *  Underscore updates never check for the state of the system
00126      *  They just do the calculation.
00127      */                    
00128     virtual void _updateStandardStateThermo();
00129 
00130     //! Updates the reference state thermodynamic functions at the 
00131     //! current T of the solution and the reference pressure
00132     /*!
00133      *  Underscore updates never check for the state of the system
00134      *  They just do the calculation.
00135      */
00136     virtual void _updateRefStateThermo () const;
00137 
00138    //@}
00139     /// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP)
00140     /*!
00141      *  There are also temporary
00142      *  variables for holding the species reference-state values of Cp, H, S, and V at the
00143      *  last temperature and reference pressure called. These functions are not recalculated
00144      *  if a new call is made using the previous temperature.
00145      *  All calculations are done within the routine  _updateRefStateThermo().
00146      */
00147     //@{
00148 
00149     /*!
00150      *  Returns the vector of the
00151      *  gibbs function of the reference state at the current temperature
00152      *  of the solution and the reference pressure for the species.
00153      *  units = J/kmol
00154      *
00155      * @param g   Output vector contain the Gibbs free energies
00156      *            of the reference state of the species
00157      *            length = m_kk, units = J/kmol.
00158      */
00159     virtual void getGibbs_ref(doublereal *g) const ;
00160 
00161     //! @name Initialization Methods - For Internal use (VPStandardState)
00162     /*!
00163      * The following methods are used in the process of constructing
00164      * the phase and setting its parameters from a specification in an 
00165      * input file. They are not normally used in application programs.
00166      * To see how they are used, see files importCTML.cpp and 
00167      * ThermoFactory.cpp.
00168      */
00169     //@{
00170 
00171  
00172     //! @internal Initialize the object
00173     /*!
00174      * This method is provided to allow
00175      * subclasses to perform any initialization required after all
00176      * species have been added. For example, it might be used to
00177      * resize internal work arrays that must have an entry for
00178      * each species.  The base class implementation does nothing,
00179      * and subclasses that do not require initialization do not
00180      * need to overload this method.  When importing a CTML phase
00181      * description, this method is called just prior to returning
00182      * from function importPhase().
00183      *
00184      * @see importCTML.cpp
00185      */
00186     virtual void initThermo();
00187 
00188     //! Finalize the thermo objects after all species have been entered
00189     /*!
00190      *  This function is the LAST initialization routine to be
00191      *  called. It's called after createInstallPDSS() has been
00192      *  called for each species in the phase, and after initThermo()
00193      *  has been called.
00194      *  It's called via an inner-to-outer onion-shell like manner.
00195      *
00196      *  Currently, this routine passed control to the parent class
00197      *  without doing anything.
00198      *
00199      *  @param phaseNode   Reference to the phaseNode XML node.
00200      *  @param id          ID of the phase.
00201      */
00202     virtual void initThermoXML(XML_Node& phaseNode, std::string id);
00203 
00204   private:
00205     //! Local factory routine for the creation of PDSS objects
00206     /*!
00207      *   This routine is specific to the VPSSMgr_General object.
00208      *   It will create a PDSS object for species k, by searching
00209      *   and querying for the "standardState" XML node in the standard
00210      *   state description of the species. If this XML node doesn't
00211      *   exist, it will assume that the standard state is an ideal
00212      *   gas.
00213      *   It decides on the attribute, "model", what PDSS object
00214      *   to create.
00215      *
00216      *   @param k  Species number
00217      *   @param speciesNode XML node for the standard state of the species
00218      *   @param phaseNode_ptr   pointer to the phase XML node
00219      *   @param doST  output variable indicating whether the
00220      *             instantiation has resulted in a SpeciesThermo object
00221      *             being created and registered with the SpeciesThermo
00222      *             manager class.
00223      *
00224      *   @return  Returns the pointer to a malloced PDSS object
00225      */
00226     PDSS * returnPDSS_ptr(int k, const XML_Node& speciesNode,
00227                           const XML_Node * const phaseNode_ptr, bool &doST);
00228 
00229   public:
00230 
00231     //! Factory routine for the creation of PDSS objects that are
00232     //! then internally registered with this VPSSMgr object
00233     /*!
00234      *  This function sets up the internal data within this object for
00235      *  handling the calculation of the standard state for the species.
00236      *
00237      *   This routine
00238      *   will create a PDSS object for species k, by searching
00239      *   and querying for the "standardState" XML node in the standard
00240      *   state description of the species.
00241      *   It will then store the object's pointer in a vector of pointers,
00242      *   and it will own the object.
00243      *
00244      *   @param k  Species number
00245      *   @param speciesNode XML node for the standard state of the species
00246      *   @param phaseNode_ptr   pointer to the phase XML node
00247      *
00248      *   @return  Returns the pointer to the malloced PDSS object
00249      */
00250     virtual  PDSS* createInstallPDSS(int k, const XML_Node& speciesNode,  
00251                                      const XML_Node * const phaseNode_ptr);
00252 
00253     //! This utility function reports the type of parameterization
00254     //! used for the species with index number index.
00255     /*!
00256      *
00257      * @param index  Species index
00258      */
00259     virtual PDSS_enumType reportPDSSType(int index = -1) const ;
00260 
00261 
00262     //! This utility function reports the type of manager
00263     //! for the calculation of the standard state properties
00264     /*!
00265      *
00266      */
00267     virtual VPSSMgr_enumType reportVPSSMgrType() const ;
00268 
00269     //! Initialize the internal shallow pointers in this object
00270     /*!
00271      * There are a bunch of internal shallow pointers that point to the owning
00272      * VPStandardStateTP and SpeciesThermo objects. This function reinitializes
00273      * them. This function is called like an onion.
00274      * 
00275      *  @param vp_ptr   Pointer to the VPStandardStateTP standard state
00276      *  @param sp_ptr   Poitner to the SpeciesThermo standard state
00277      */
00278     virtual void initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr);
00279   
00280    private:
00281 
00282     //! Shallow pointers containing the PDSS objects for the species
00283     //! in this phase.
00284     /*!
00285      * This object doesn't own these pointers.
00286      */
00287     std::vector<PDSS *> m_PDSS_ptrs;
00288       
00289 
00290     //! VPStandardStateTP has its own err routine
00291     /*!
00292      * @param msg  Error message string
00293      */
00294     doublereal err(std::string msg) const;
00295 
00296 
00297   };
00298   //@}
00299 }
00300 
00301 #endif
00302 
Generated by  doxygen 1.6.3