00001 /** 00002 * @file LatticePhase.h 00003 * Header for a simple thermodynamics model of a bulk phase 00004 * derived from ThermoPhase, 00005 * assuming a lattice of solid atoms 00006 * (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink). 00007 * 00008 */ 00009 /* $Author: hkmoffa $ 00010 * $Date: 2010-01-16 13:57:05 -0500 (Sat, 16 Jan 2010) $ 00011 * $Revision: 384 $ 00012 * 00013 * Copyright 2005 California Institute of Technology 00014 * 00015 */ 00016 00017 #ifndef CT_LATTICE_H 00018 #define CT_LATTICE_H 00019 00020 #include "config.h" 00021 00022 #ifdef WITH_LATTICE_SOLID 00023 00024 #include "ct_defs.h" 00025 #include "mix_defs.h" 00026 #include "ThermoPhase.h" 00027 #include "SpeciesThermo.h" 00028 #include "utilities.h" 00029 00030 namespace Cantera { 00031 00032 //! A simple thermoydnamics model for a bulk phase, 00033 //! assuming a lattice of solid atoms 00034 /*! 00035 * The bulk consists of a matrix of equivalent sites whose molar density 00036 * does not vary with temperature or pressure. The thermodynamics 00037 * obeys the ideal solution laws. The phase and the pure species phases which 00038 * comprise the standard states of the species are assumed to have 00039 * zero volume expansivity and zero isothermal compressibility. 00040 * 00041 * The density of matrix sites is given by the variable \f$ C_o \f$, 00042 * which has SI units of kmol m-3. 00043 * 00044 * 00045 * <b> Specification of Species Standard %State Properties </b> 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 (see ThermoPhase::m_spthermo). However, how to relate pressure 00050 * changes to the reference state thermodynamics is within this class. 00051 * 00052 * Pressure is defined as an independent variable in this phase. However, it has 00053 * no effect on any quantities, as the molar concentration is a constant. 00054 * 00055 * The standard state enthalpy function is given by the following relation, 00056 * which has a weak dependence on the system pressure, \f$P\f$. 00057 * 00058 * \f[ 00059 * \raggedright h^o_k(T,P) = 00060 * h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) 00061 * \f] 00062 * 00063 * For an incompressible substance, the molar internal energy is 00064 * independent of pressure. Since the thermodynamic properties 00065 * are specified by giving the standard-state enthalpy, the 00066 * term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted from the specified reference molar 00067 * enthalpy to compute the standard state molar internal energy: 00068 * 00069 * \f[ 00070 * u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o} 00071 * \f] 00072 * 00073 * The standard state heat capacity, internal energy, and entropy are independent 00074 * of pressure. The standard state gibbs free energy is obtained 00075 * from the enthalpy and entropy functions. 00076 * 00077 * The standard state molar volume is independent of temperature, pressure, 00078 * and species identity: 00079 * 00080 * \f[ 00081 * V^o_k(T,P) = \frac{1.0}{C_o} 00082 * \f] 00083 * 00084 * 00085 * <HR> 00086 * <H2> Specification of Solution Thermodynamic Properties </H2> 00087 * <HR> 00088 * 00089 * The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is 00090 * given by the ideal solution law: 00091 * 00092 * \f[ 00093 * a_k = X_k , 00094 * \f] 00095 * 00096 * where \f$ X_k \f$ is the mole fraction of species <I>k</I>. 00097 * The chemical potential for species <I>k</I> is equal to 00098 * 00099 * \f[ 00100 * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) 00101 * \f] 00102 * 00103 * The partial molar entropy for species <I>k</I> is given by the following relation, 00104 * 00105 * \f[ 00106 * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k) 00107 * \f] 00108 * 00109 * The partial molar enthalpy for species <I>k</I> is 00110 * 00111 * \f[ 00112 * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) 00113 * \f] 00114 * 00115 * The partial molar Internal Energy for species <I>k</I> is 00116 * 00117 * \f[ 00118 * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) 00119 * \f] 00120 * 00121 * The partial molar Heat Capacity for species <I>k</I> is 00122 * 00123 * \f[ 00124 * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) 00125 * \f] 00126 * 00127 * The partial molar volume is independent of temperature, pressure, 00128 * and species identity: 00129 * 00130 * \f[ 00131 * \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o} 00132 * \f] 00133 * 00134 * It is assumed that the reference state thermodynamics may be 00135 * obtained by a pointer to a populated species thermodynamic property 00136 * manager class (see ThermoPhase::m_spthermo). How to relate pressure 00137 * changes to the reference state thermodynamics is resolved at this level. 00138 * 00139 * Pressure is defined as an independent variable in this phase. However, it only 00140 * has a weak dependence on the enthalpy, and doesn't effect the molar 00141 * concentration. 00142 * 00143 * <HR> 00144 * <H2> %Application within %Kinetics Managers </H2> 00145 * <HR> 00146 * 00147 * \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$ 00148 * \f$ C^s_k \f$, the standard concentration, is 00149 * defined to be equal to one. \f$ a_k \f$ are activities used in the 00150 * thermodynamic functions. These activity (or generalized) 00151 * concentrations are used 00152 * by kinetics manager classes to compute the forward and 00153 * reverse rates of elementary reactions. 00154 * The activity concentration,\f$ C^a_k \f$, is given by the following expression. 00155 * 00156 * \f[ 00157 * C^a_k = C^s_k X_k = X_k 00158 * \f] 00159 * 00160 * The standard concentration for species <I>k</I> is identically one 00161 * 00162 * \f[ 00163 * C^s_k = C^s = 1.0 00164 * \f] 00165 * 00166 * For example, a bulk-phase binary gas reaction between species j and k, producing 00167 * a new species l would have the 00168 * following equation for its rate of progress variable, \f$ R^1 \f$, which has 00169 * units of kmol m-3 s-1. 00170 * 00171 * \f[ 00172 * R^1 = k^1 C_j^a C_k^a = k^1 X_j X_k 00173 * \f] 00174 * 00175 * The reverse rate constant can then be obtained from the law of microscopic reversibility 00176 * and the equilibrium expression for the system. 00177 * 00178 * \f[ 00179 * \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) 00180 * \f] 00181 * 00182 * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with 00183 * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, 00184 * \f$ a_l \f$, repeated here: 00185 * 00186 * \f[ 00187 * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) 00188 * \f] 00189 * 00190 * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over 00191 * to activity concentrations. When this is done: 00192 * 00193 * \f[ 00194 * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = 00195 * \exp(\frac{\mu^{o}_l - \mu^{o}_j - \mu^{o}_k}{R T} ) 00196 * \f] 00197 * 00198 * 00199 * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, 00200 * using the second and third part of the above expression as a definition for the concentration 00201 * equilibrium constant. 00202 * 00203 * <HR> 00204 * <H2> Instantiation of the Class </H2> 00205 * <HR> 00206 * 00207 * 00208 * The constructor for this phase is located in the default ThermoFactory 00209 * for %Cantera. A new %LatticePhase object may be created by the following code snippet: 00210 * 00211 * @code 00212 * XML_Node *xc = get_XML_File("O_lattice_SiO2.xml"); 00213 * XML_Node * const xs = xc->findNameID("phase", "O_lattice_SiO2"); 00214 * ThermoPhase *tp = newPhase(*xs); 00215 * LatticePhase *o_lattice = dynamic_cast <LatticPhase *>(tp); 00216 * @endcode 00217 * 00218 * or by the following constructor: 00219 * 00220 * @code 00221 * XML_Node *xc = get_XML_File("O_lattice_SiO2.xml"); 00222 * XML_Node * const xs = xc->findNameID("phase", "O_lattice_SiO2"); 00223 * LatticePhase *o_lattice = new LatticePhase(*xs); 00224 * @endcode 00225 * 00226 * The XML file used in this example is listed in the next section 00227 * 00228 * <HR> 00229 * <H2> XML Example </H2> 00230 * <HR> 00231 * 00232 * An example of an XML Element named phase setting up a LatticePhase object named "O_lattice_SiO2" 00233 * is given below. 00234 * 00235 * @verbatim 00236 <!-- phase O_lattice_SiO2 --> 00237 <phase dim="3" id="O_lattice_SiO2"> 00238 <elementArray datasrc="elements.xml"> Si H He </elementArray> 00239 <speciesArray datasrc="#species_data"> 00240 O_O Vac_O 00241 </speciesArray> 00242 <reactionArray datasrc="#reaction_data"/> 00243 <thermo model="Lattice"> 00244 <site_density> 73.159 </site_density> 00245 <vacancy_species> Vac_O </vacancy_species> 00246 </thermo> 00247 <kinetics model="BulkKinetics"/> 00248 <transport model="None"/> 00249 </phase> 00250 @endverbatim 00251 * 00252 * The model attribute "Lattice" of the thermo XML element identifies the phase as 00253 * being of the type handled by the LatticePhase object. 00254 * 00255 * @ingroup thermoprops 00256 * 00257 */ 00258 class LatticePhase : public ThermoPhase { 00259 00260 public: 00261 00262 //! Base Empty constructor 00263 LatticePhase(); 00264 00265 //! Copy Constructor 00266 /*! 00267 * @param right Object to be copied 00268 */ 00269 LatticePhase(const LatticePhase &right); 00270 00271 //! Assignment operator 00272 /*! 00273 * @param right Object to be copied 00274 */ 00275 LatticePhase& operator=(const LatticePhase& right); 00276 00277 //! Destructor 00278 virtual ~LatticePhase(); 00279 00280 //! Duplication function 00281 /*! 00282 * This virtual function is used to create a duplicate of the 00283 * current phase. It's used to duplicate the phase when given 00284 * a ThermoPhase pointer to the phase. 00285 * 00286 * @return It returns a ThermoPhase pointer. 00287 */ 00288 ThermoPhase *duplMyselfAsThermoPhase() const; 00289 00290 00291 //! Equation of state flag. Returns the value cLattice 00292 virtual int eosType() const { return cLattice; } 00293 00294 /** 00295 * @name Molar Thermodynamic Properties of the Solution ------------------------ 00296 * @{ 00297 */ 00298 00299 //! Return the Molar Enthalpy. Units: J/kmol. 00300 /*! 00301 * For an ideal solution, 00302 * 00303 * \f[ 00304 * \hat h(T,P) = \sum_k X_k \hat h^0_k(T,P), 00305 * \f] 00306 * 00307 * The standard-state pure-species Enthalpies 00308 * \f$ \hat h^0_k(T,P) \f$ are computed first by the species reference 00309 * state thermodynamic property manager and then a small pressure dependent term is 00310 * added in. 00311 * 00312 * \see SpeciesThermo 00313 */ 00314 virtual doublereal enthalpy_mole() const; 00315 00316 //! Molar internal energy of the solution. Units: J/kmol. 00317 /*! 00318 * For an ideal, constant partial molar volume solution mixture with 00319 * pure species phases which exhibit zero volume expansivity and 00320 * zero isothermal compressibility: 00321 * 00322 * \f[ 00323 * \hat u(T,X) = \hat h(T,P,X) - p \hat V 00324 * = \sum_k X_k \hat h^0_k(T) - P_{ref} (\sum_k{X_k \hat V^0_k}) 00325 * \f] 00326 * 00327 * and is a function only of temperature. 00328 * The reference-state pure-species enthalpies 00329 * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic 00330 * property manager. 00331 * @see SpeciesThermo 00332 */ 00333 virtual doublereal intEnergy_mole() const; 00334 00335 //! Molar entropy of the solution. Units: J/kmol/K 00336 /*! 00337 * For an ideal, constant partial molar volume solution mixture with 00338 * pure species phases which exhibit zero volume expansivity: 00339 * \f[ 00340 * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k) 00341 * \f] 00342 * The reference-state pure-species entropies 00343 * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic 00344 * property manager. The pure species entropies are independent of 00345 * pressure since the volume expansivities are equal to zero. 00346 * 00347 * Units: J/kmol/K. 00348 * 00349 * @see SpeciesThermo 00350 */ 00351 virtual doublereal entropy_mole() const; 00352 00353 //! Molar gibbs free energy of the solution. Units: J/kmol. 00354 /*! 00355 * For an ideal, constant partial molar volume solution mixture with 00356 * pure species phases which exhibit zero volume expansivity: 00357 * \f[ 00358 * \hat g(T, P) = \sum_k X_k \hat g^0_k(T,P) + \hat R T \sum_k X_k log(X_k) 00359 * \f] 00360 * The reference-state pure-species gibbs free energies 00361 * \f$ \hat g^0_k(T) \f$ are computed by the species thermodynamic 00362 * property manager, while the standard state gibbs free energies 00363 * \f$ \hat g^0_k(T,P) \f$ are computed by the member function, gibbs_RT(). 00364 * 00365 * @see SpeciesThermo 00366 */ 00367 virtual doublereal gibbs_mole() const; 00368 00369 //! Molar heat capacity at constant pressure of the solution. 00370 //! Units: J/kmol/K. 00371 /*! 00372 * For an ideal, constant partial molar volume solution mixture with 00373 * pure species phases which exhibit zero volume expansivity: 00374 * \f[ 00375 * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) . 00376 * \f] 00377 * The heat capacity is independent of pressure. 00378 * The reference-state pure-species heat capacities 00379 * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic 00380 * property manager. 00381 * 00382 * @see SpeciesThermo 00383 */ 00384 virtual doublereal cp_mole() const; 00385 00386 //! Molar heat capacity at constant volume of the solution. 00387 //! Units: J/kmol/K. 00388 /*! 00389 * For an ideal, constant partial molar volume solution mixture with 00390 * pure species phases which exhibit zero volume expansivity: 00391 * \f[ 00392 * \hat c_v(T,P) = \hat c_p(T,P) 00393 * \f] 00394 * 00395 * The two heat capacities are equal. 00396 */ 00397 virtual doublereal cv_mole() const; 00398 00399 //@} 00400 /// @name Mechanical Equation of State Properties ------------------------------------ 00401 //@{ 00402 /** 00403 * In this equation of state implementation, the density is a 00404 * function only of the mole fractions. Therefore, it can't be 00405 * an independent variable. Instead, the pressure is used as the 00406 * independent variable. Functions which try to set the thermodynamic 00407 * state by calling setDensity() may cause an exception to be 00408 * thrown. 00409 */ 00410 //@{ 00411 00412 00413 //! Pressure. Units: Pa. 00414 /*! 00415 * For this incompressible system, we return the internally storred 00416 * independent value of the pressure. 00417 */ 00418 virtual doublereal pressure() const { 00419 return m_press; 00420 } 00421 00422 //! Set the internally storred pressure (Pa) at constant 00423 //! temperature and composition 00424 /*! 00425 * This method sets the pressure within the object. 00426 * The mass density is not a function of pressure. 00427 * 00428 * @param p Input Pressure (Pa) 00429 */ 00430 virtual void setPressure(doublereal p); 00431 00432 //@} 00433 /// @name Activities, Standard States, and Activity Concentrations 00434 /** 00435 * 00436 * The activity \f$a_k\f$ of a species in solution is 00437 * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) 00438 * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is 00439 * the chemical potential at unit activity, which depends only 00440 * on temperature and the pressure. 00441 * Activity is assumed to be molality-based here. 00442 */ 00443 //@{ 00444 00445 /** 00446 * This method returns an array of generalized concentrations 00447 * \f$ C_k\f$ that are defined such that 00448 * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ 00449 * is a standard concentration 00450 * defined below. These generalized concentrations are used 00451 * by kinetics manager classes to compute the forward and 00452 * reverse rates of elementary reactions. 00453 * 00454 * @param c Array of generalized concentrations. The 00455 * units depend upon the implementation of the 00456 * reaction rate expressions within the phase. 00457 */ 00458 virtual void getActivityConcentrations(doublereal* c) const; 00459 00460 //! Return the standard concentration for the kth species 00461 /*! 00462 * The standard concentration \f$ C^0_k \f$ used to normalize 00463 * the activity (i.e., generalized) concentration for use 00464 * 00465 * For the time being, we will use the concentration of pure 00466 * solvent for the the standard concentration of all species. 00467 * This has the effect of making mass-action reaction rates 00468 * based on the molality of species proportional to the 00469 * molality of the species. 00470 * 00471 * @param k Optional parameter indicating the species. The default 00472 * is to assume this refers to species 0. 00473 * @return 00474 * Returns the standard Concentration in units of 00475 * m<SUP>3</SUP> kmol<SUP>-1</SUP>. 00476 * 00477 * @param k Species index 00478 */ 00479 virtual doublereal standardConcentration(int k=0) const; 00480 00481 //! Returns the natural logarithm of the standard 00482 //! concentration of the kth species 00483 /*! 00484 * @param k Species index 00485 */ 00486 virtual doublereal logStandardConc(int k=0) const; 00487 00488 //! Get the array of non-dimensional activity coefficients at 00489 //! the current solution temperature, pressure, and solution concentration. 00490 /*! 00491 * For this phase, the activity coefficients are all equal to one. 00492 * 00493 * @param ac Output vector of activity coefficients. Length: m_kk. 00494 */ 00495 virtual void getActivityCoefficients(doublereal* ac) const; 00496 00497 //@} 00498 /// @name Partial Molar Properties of the Solution 00499 /// 00500 //@{ 00501 00502 //! Get the species chemical potentials. Units: J/kmol. 00503 /*! 00504 * This function returns a vector of chemical potentials of the 00505 * species in solid solution at the current temperature, pressure 00506 * and mole fraction of the solid solution. 00507 * 00508 * @param mu Output vector of species chemical 00509 * potentials. Length: m_kk. Units: J/kmol 00510 */ 00511 virtual void getChemPotentials(doublereal* mu) const; 00512 00513 //! Get the array of chemical potentials at unit activity for the 00514 //! species standard states at the current <I>T</I> and <I>P</I> of the solution. 00515 /*! 00516 * These are the standard state chemical potentials \f$ \mu^0_k(T,P) 00517 * \f$. The values are evaluated at the current 00518 * temperature and pressure of the solution 00519 * 00520 * @param mu Output vector of chemical potentials. 00521 * Length: m_kk. 00522 */ 00523 virtual void getStandardChemPotentials(doublereal* mu) const; 00524 00525 //! Get the Gibbs functions for the standard 00526 //! state of the species at the current <I>T</I> and <I>P</I> of the solution 00527 /*! 00528 * Units are Joules/kmol 00529 * @param gpure Output vector of standard state gibbs free energies 00530 * Length: m_kk. 00531 */ 00532 virtual void getPureGibbs(doublereal* gpure) const; 00533 00534 //! Return an array of partial molar volumes for the 00535 //! species in the mixture. Units: m^3/kmol. 00536 /*! 00537 * @param vbar Output vector of speciar partial molar volumes. 00538 * Length = m_kk. units are m^3/kmol. 00539 */ 00540 virtual void getPartialMolarVolumes(doublereal* vbar) const; 00541 00542 //@} 00543 /// @name Properties of the Standard State of the Species in the Solution 00544 //@{ 00545 00546 //! Get the nondimensional Enthalpy functions for the species standard states 00547 //! at their standard states at the current <I>T</I> and <I>P</I> of the solution. 00548 /*! 00549 * A small pressure dependent term is added onto the reference state enthalpy 00550 * to get the pressure dependence of this term. 00551 * 00552 * \f[ 00553 * h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) 00554 * \f] 00555 * 00556 * The reference state thermodynamics is 00557 * obtained by a pointer to a populated species thermodynamic property 00558 * manager class (see ThermoPhase::m_spthermo). How to relate pressure 00559 * changes to the reference state thermodynamics is resolved at this level. 00560 * 00561 * @param hrt Output vector of nondimensional standard state enthalpies. 00562 * Length: m_kk. 00563 */ 00564 virtual void getEnthalpy_RT(doublereal* hrt) const; 00565 00566 //! Get the array of nondimensional Entropy functions for the 00567 //! species standard states at the current <I>T</I> and <I>P</I> of the solution. 00568 /*! 00569 * The entropy of the standard state is defined as independent of 00570 * pressure here. 00571 * 00572 * \f[ 00573 * s^o_k(T,P) = s^{ref}_k(T) 00574 * \f] 00575 * 00576 * The reference state thermodynamics is 00577 * obtained by a pointer to a populated species thermodynamic property 00578 * manager class (see ThermoPhase::m_spthermo). How to relate pressure 00579 * changes to the reference state thermodynamics is resolved at this level. 00580 * 00581 * @param sr Output vector of nondimensional standard state entropies. 00582 * Length: m_kk. 00583 */ 00584 virtual void getEntropy_R(doublereal* sr) const; 00585 00586 //! Get the nondimensional Gibbs functions for the species 00587 //! standard states at the current <I>T</I> and <I>P</I> of the solution. 00588 /*! 00589 * The standard gibbs free energies are obtained from the enthalpy 00590 * and entropy formulation. 00591 * 00592 * \f[ 00593 * g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P) 00594 * \f] 00595 * 00596 * @param grt Output vector of nondimensional standard state gibbs free energies 00597 * Length: m_kk. 00598 */ 00599 virtual void getGibbs_RT(doublereal* grt) const; 00600 00601 //! Get the nondimensional Heat Capacities at constant 00602 //! pressure for the species standard states 00603 //! at the current <I>T</I> and <I>P</I> of the solution 00604 /*! 00605 * The heat capacity of the standard state is independent of pressure 00606 * 00607 * \f[ 00608 * Cp^o_k(T,P) = Cp^{ref}_k(T) 00609 * \f] 00610 * 00611 * The reference state thermodynamics is 00612 * obtained by a pointer to a populated species thermodynamic property 00613 * manager class (see ThermoPhase::m_spthermo). How to relate pressure 00614 * changes to the reference state thermodynamics is resolved at this level. 00615 * 00616 * @param cpr Output vector of nondimensional standard state heat capacities 00617 * Length: m_kk. 00618 */ 00619 virtual void getCp_R(doublereal* cpr) const; 00620 00621 //! Get the molar volumes of the species standard states at the current 00622 //! <I>T</I> and <I>P</I> of the solution. 00623 /*! 00624 * units = m^3 / kmol 00625 * 00626 * @param vol Output vector containing the standard state volumes. 00627 * Length: m_kk. 00628 */ 00629 virtual void getStandardVolumes(doublereal *vol) const; 00630 00631 //@} 00632 /// @name Thermodynamic Values for the Species Reference States 00633 //@{ 00634 00635 #ifdef H298MODIFY_CAPABILITY 00636 00637 //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) 00638 /*! 00639 * The 298K heat of formation is defined as the enthalpy change to create the standard state 00640 * of the species from its constituent elements in their standard states at 298 K and 1 bar. 00641 * 00642 * @param k Species k 00643 * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar 00644 */ 00645 virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) { 00646 m_spthermo->modifyOneHf298(k, Hf298New); 00647 m_tlast += 0.0001234; 00648 } 00649 #endif 00650 00651 //! Returns the vector of nondimensional 00652 //! Enthalpies of the reference state at the current temperature 00653 //! of the solution and the reference pressure for the phase. 00654 /*! 00655 * @return Output vector of nondimensional reference state 00656 * Enthalpies of the species. 00657 * Length: m_kk 00658 */ 00659 const array_fp& enthalpy_RT_ref() const { 00660 _updateThermo(); 00661 return m_h0_RT; 00662 } 00663 00664 //! Returns a reference to the dimensionless reference state Gibbs free energy vector. 00665 /*! 00666 * This function is part of the layer that checks/recalculates the reference 00667 * state thermo functions. 00668 */ 00669 const array_fp& gibbs_RT_ref() const { 00670 _updateThermo(); 00671 return m_g0_RT; 00672 } 00673 00674 //! Returns a reference to the dimensionless reference state Entropy vector. 00675 /*! 00676 * This function is part of the layer that checks/recalculates the reference 00677 * state thermo functions. 00678 */ 00679 const array_fp& entropy_R_ref() const { 00680 _updateThermo(); 00681 return m_s0_R; 00682 } 00683 00684 //! Returns a reference to the dimensionless reference state Heat Capacity vector. 00685 /*! 00686 * This function is part of the layer that checks/recalculates the reference 00687 * state thermo functions. 00688 */ 00689 const array_fp& cp_R_ref() const { 00690 _updateThermo(); 00691 return m_cp0_R; 00692 } 00693 00694 //@} 00695 /// @name Utilities for Initialization of the Object 00696 //@{ 00697 00698 //! Initialize the ThermoPhase object after all species have been set up 00699 /*! 00700 * @internal Initialize. 00701 * 00702 * This method performs any initialization required after all 00703 * species have been added. For example, it is used to 00704 * resize internal work arrays that must have an entry for 00705 * each species. 00706 * This method is called from ThermoPhase::initThermoXML(), 00707 * which is called from importPhase(), 00708 * just prior to returning from the function, importPhase(). 00709 * 00710 * @see importCTML.cpp 00711 */ 00712 virtual void initThermo(); 00713 00714 //! Set the equation of state parameters from the argument list 00715 /*! 00716 * @internal 00717 * Set equation of state parameters. 00718 * 00719 * @param n number of parameters. Must be one 00720 * @param c array of \a n coefficients 00721 * c[0] = The bulk lattice density (kmol m-3) 00722 */ 00723 virtual void setParameters(int n, doublereal* const c); 00724 00725 //! Get the equation of state parameters in a vector 00726 /*! 00727 * @internal 00728 * 00729 * @param n number of parameters 00730 * @param c array of \a n coefficients 00731 * 00732 * For this phase: 00733 * - n = 1 00734 * - c[0] = molar density of phase [ kmol/m^3 ] 00735 */ 00736 virtual void getParameters(int &n, doublereal * const c) const; 00737 00738 //! Set equation of state parameter values from XML entries. 00739 /*! 00740 * This method is called by function importPhase() in 00741 * file importCTML.cpp when processing a phase definition in 00742 * an input file. It should be overloaded in subclasses to set 00743 * any parameters that are specific to that particular phase 00744 * model. Note, this method is called before the phase is 00745 * initialzed with elements and/or species. 00746 * 00747 * For this phase, the molar density of the phase is specified in this block, 00748 * and is a required parameter. 00749 * 00750 * @param eosdata An XML_Node object corresponding to 00751 * the "thermo" entry for this phase in the input file. 00752 * 00753 * eosdata points to the thermo block, and looks like this: 00754 * 00755 * @verbatim 00756 <phase id="O_lattice_SiO2" > 00757 <thermo model="Lattice"> 00758 <site_density units="kmol/m^3"> 73.159 </site_density> 00759 <vacancy_species> "O_vacancy" </vacancy_species> 00760 </thermo> 00761 </phase> @endverbatim 00762 * 00763 */ 00764 virtual void setParametersFromXML(const XML_Node& eosdata); 00765 00766 //@} 00767 00768 protected: 00769 00770 //! Number of elements 00771 int m_mm; 00772 00773 //! Minimum temperature for valid species standard state thermo props 00774 /*! 00775 * This is the minimum temperature at which all species have valid standard 00776 * state thermo props defined. 00777 */ 00778 doublereal m_tmin; 00779 00780 //! Maximum temperature for valid species standard state thermo props 00781 /*! 00782 * This is the maximum temperature at which all species have valid standard 00783 * state thermo props defined. 00784 */ 00785 doublereal m_tmax; 00786 00787 //! Reference state pressure 00788 doublereal m_p0; 00789 00790 //! Current value of the temperature (Kelvin) 00791 mutable doublereal m_tlast; 00792 00793 //! Reference state enthalpies / RT 00794 mutable array_fp m_h0_RT; 00795 00796 //! Temporary storage for the reference state heat capacities 00797 mutable array_fp m_cp0_R; 00798 00799 //! Temporary storage for the reference state gibbs energies 00800 mutable array_fp m_g0_RT; 00801 00802 //! Temporary storage for the reference state entropies 00803 mutable array_fp m_s0_R; 00804 00805 //! Current value of the pressure (Pa) 00806 doublereal m_press; 00807 00808 //! String name for the species which represents a vacency 00809 //! in the lattice 00810 /*! 00811 * This string is currently unused 00812 */ 00813 std::string m_vacancy; 00814 00815 //! Molar density of the lattice solid 00816 /*! 00817 * units are kmol m-3 00818 */ 00819 doublereal m_molar_density; 00820 00821 private: 00822 00823 //! Update the species reference state thermodynamic functions 00824 /*! 00825 * The polynomials for the standard state functions are only 00826 * reevalulated if the temperature has changed. 00827 */ 00828 void _updateThermo() const; 00829 }; 00830 } 00831 00832 #endif 00833 #endif