From 2a6f9647e71270bffcfdebda3a0099d0dea8f300 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 13 Mar 2007 00:58:04 +0000 Subject: [PATCH] doxygen update Started writing header info for IdealGasPhase --- Cantera/src/IdealGasPhase.cpp | 98 +++++++-------- Cantera/src/IdealGasPhase.h | 217 +++++++++++++++++++++++++++++++++- Cantera/src/SpeciesThermo.h | 3 +- Cantera/src/ThermoPhase.h | 25 ++++ Cantera/src/equil.h | 21 ++++ tools/doc/Cantera.cfg.in | 3 +- 6 files changed, 314 insertions(+), 53 deletions(-) diff --git a/Cantera/src/IdealGasPhase.cpp b/Cantera/src/IdealGasPhase.cpp index 77545804f..1a66bfa6a 100644 --- a/Cantera/src/IdealGasPhase.cpp +++ b/Cantera/src/IdealGasPhase.cpp @@ -34,7 +34,7 @@ namespace Cantera { // Chemical Potentials and Activities ---------------------- /* - * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize + * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize * the generalized concentration. */ doublereal IdealGasPhase::standardConcentration(int k) const { @@ -239,60 +239,60 @@ namespace Cantera { // Thermodynamic Values for the Species Reference States --------- - /** - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * and reference presssure. - */ - void IdealGasPhase::getEnthalpy_RT_ref(doublereal *hrt) const { - const array_fp& _h = enthalpy_RT_ref(); - copy(_h.begin(), _h.end(), hrt); - } + /* + * Returns the vector of nondimensional + * enthalpies of the reference state at the current temperature + * and reference presssure. + */ + void IdealGasPhase::getEnthalpy_RT_ref(doublereal *hrt) const { + const array_fp& _h = enthalpy_RT_ref(); + copy(_h.begin(), _h.end(), hrt); + } - /** - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * and reference pressure. - */ - void IdealGasPhase::getGibbs_RT_ref(doublereal *grt) const { - const array_fp& gibbsrt = gibbs_RT_ref(); - copy(gibbsrt.begin(), gibbsrt.end(), grt); - } + /* + * Returns the vector of nondimensional + * enthalpies of the reference state at the current temperature + * and reference pressure. + */ + void IdealGasPhase::getGibbs_RT_ref(doublereal *grt) const { + const array_fp& gibbsrt = gibbs_RT_ref(); + copy(gibbsrt.begin(), gibbsrt.end(), grt); + } - /** - * Returns the vector of the - * gibbs function of the reference state at the current temperature - * and reference pressure. - * units = J/kmol - */ - void IdealGasPhase::getGibbs_ref(doublereal *g) const { - const array_fp& gibbsrt = gibbs_RT_ref(); - scale(gibbsrt.begin(), gibbsrt.end(), g, _RT()); - } + /* + * Returns the vector of the + * gibbs function of the reference state at the current temperature + * and reference pressure. + * units = J/kmol + */ + void IdealGasPhase::getGibbs_ref(doublereal *g) const { + const array_fp& gibbsrt = gibbs_RT_ref(); + scale(gibbsrt.begin(), gibbsrt.end(), g, _RT()); + } - /** - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * and reference pressure. - */ - void IdealGasPhase::getEntropy_R_ref(doublereal *er) const { - const array_fp& _s = entropy_R_ref(); - copy(_s.begin(), _s.end(), er); - } + /* + * Returns the vector of nondimensional + * entropies of the reference state at the current temperature + * and reference pressure. + */ + void IdealGasPhase::getEntropy_R_ref(doublereal *er) const { + const array_fp& _s = entropy_R_ref(); + copy(_s.begin(), _s.end(), er); + } - /** - * Returns the vector of nondimensional - * internal Energies of the reference state at the current temperature - * of the solution and the reference pressure for each species. - */ - void IdealGasPhase::getIntEnergy_RT_ref(doublereal *urt) const { - const array_fp& _h = enthalpy_RT_ref(); - for (int k = 0; k < m_kk; k++) { - urt[k] = _h[k] - 1.0; - } + /* + * Returns the vector of nondimensional + * internal Energies of the reference state at the current temperature + * of the solution and the reference pressure for each species. + */ + void IdealGasPhase::getIntEnergy_RT_ref(doublereal *urt) const { + const array_fp& _h = enthalpy_RT_ref(); + for (int k = 0; k < m_kk; k++) { + urt[k] = _h[k] - 1.0; } + } - /** + /* * Returns the vector of nondimensional * constant pressure heat capacities of the reference state * at the current temperature and reference pressure. diff --git a/Cantera/src/IdealGasPhase.h b/Cantera/src/IdealGasPhase.h index 7738655ff..0b63a0d51 100644 --- a/Cantera/src/IdealGasPhase.h +++ b/Cantera/src/IdealGasPhase.h @@ -26,7 +26,7 @@ namespace Cantera { - //!Class IdealGasPhase represents low-density gases that obey the + //!Class %IdealGasPhase represents low-density gases that obey the //! ideal gas equation of state. /*! * @@ -36,6 +36,221 @@ namespace Cantera { * * This class is optimized for speed of execution. * + *
+ *

Specification of Species Standard %State Properties

+ *
+ * + * It is assumed that the reference state thermodynamics may be + * obtained by a pointer to a populated species thermodynamic property + * manager class in the base class, ThermoPhase::m_spthermo + * (see the base class \link Cantera#SpeciesThermo SpeciesThermo \endlink for a + * description of the specification of reference state species thermodynamics functions). + * The reference state, + * where the pressure is fixed at a single pressure, + * is key species property calculation for the Ideal Gas Equation + * of state. + * + * Functions for the calculation of standard state properties for species + * at arbitray pressure are provided in %IdealGasPhase. However, they + * are all derived from their reference state conterparts. + * + * The standard state enthalpy is independent of pressure: + * + * \f[ + * h^o_k(T,P) = h^{ref}_k(T) + * \f] + * + * The standard state constant-pressure heat capacity is independent of pressure: + * + * \f[ + * Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] + * + * The standard state entropy depends in the following fashion on pressure: + * + * \f[ + * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}}) + * \f] + * The standard state gibbs free energy is obtained from the enthalpy and entropy + * functions: + * + * \f[ + * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T + * \f] + * + * \f[ + * \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}}) + * \f] + * + * where + * \f[ + * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T) + * \f] + * + * The standard state internal energy is obtained from the enthalpy function too + * + * \f[ + * u^o_k(T,P) = h^o_k(T) - R T + * \f] + * + * The molar volume of a species is given by the ideal gas law + * + * \f[ + * V^o_k(T,P) = \frac{R T}{P} \mbox{\quad where} + * \f] + * + * R = 8314.47215 Joules kmol-1 K-1, from the 1999 CODATA convention. + * For a complete list of physical constants used within %Cantera, see \ref physConstants . + * + *
+ *

Specification of Solution Thermodynamic Properties

+ *
+ * + * The activity of a species defined in the phase is given by the ideal gas law: + * \f[ + * a_k = X_k + * \f] + * where \f$ X_k \f$ is the mole fraction of species k. + * The chemical potential for species k is equal to + * + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) + * \f] + * + * In terms of the reference state, the above can be rewritten + * + * + * \f[ + * \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}}) + * \f] + * + * The partial molar entropy for species k is given by the following relation, + * + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}}) + * \f] + * + * The partial molar enthalpy for species k is + * + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + * \f] + * + * The partial molar heat capacity for species k is + * + * \f[ + * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] + * + * + *
+ *

%Application within %Kinetics Managers

+ *
+ + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / + * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration + * defined below and \f$ a_k \f$ are activities used in the + * thermodynamic functions. These activity (or generalized) + * concentrations are used + * by kinetics manager classes to compute the forward and + * reverse rates of elementary reactions. + * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] + * + * The standard concentration for species k is independent of k and equal to + * + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] + * + * For example, a bulk-phase binary gas reaction between species j and k, producing + * a new gas species l would have the + * following equation for its rate of progress variable, \f$ R^1 \f$, which has + * units of kmol m-3 s-1. + * + * \f[ + * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) + * \f] + * where + * \f[ + * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k + * \f] + * + * \f$ C_j^a \f$ is the activity concentration of species j, and + * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ + * is the standard concentration. \f$ a_j \f$ is + * the activity of species j which is equal to the mole fraction of j. + * + * The reverse rate constant can then be obtained from the law of microscopic reversibility + * and the equilibrium expression for the system. + * + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] + * + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with + * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, + * \f$ a_l \f$, repeated here: + * + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] + * + * We can switch over to expressing the equilibrium constant in terms of the reference + * state chemical potentials + * + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] + * + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over + * to activity concentrations. When this is done: + * + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] + * + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, + * using the second and third part of the above expression as a definition for the concentration + * equilibrium constant. + * + * For completeness, the pressure equilibrium constant may be obtained as well + * + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) + * \f] + * + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't + * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is + * used instead because it is completely general. + * + * The reverse rate of progress may be written down as + * \f[ + * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) + * \f] + * + * where we can use the concept of microscopic reversibility to write the reverse rate constant in terms of the + * forward reate constant and the concentration equilibrium constant, \f$ K_c \f$. + * + * \f[ + * k^{-1} = k^1 K^1_c + * \f] + * + * \f$k^{-1} \f$ has units of s-1. + * + *
+ *

Instantiation of the Class

+ *
+ * + * + *
+ *

XML Example

+ *
+ * * @ingroup thermoprops */ class IdealGasPhase : public ThermoPhase { diff --git a/Cantera/src/SpeciesThermo.h b/Cantera/src/SpeciesThermo.h index aac2e8ce1..889ae7662 100755 --- a/Cantera/src/SpeciesThermo.h +++ b/Cantera/src/SpeciesThermo.h @@ -1,11 +1,10 @@ /** * @file SpeciesThermo.h - * * Species thermodynamic property managers. In this file we describe * the base class for the calculation of species thermodynamic * property managers. * - * We also describe the doxygen module spthermo + * We also describe the doxygen module spthermo (see \ref spthermo ) */ /* diff --git a/Cantera/src/ThermoPhase.h b/Cantera/src/ThermoPhase.h index cb3a8c4a7..f7e1d41d4 100755 --- a/Cantera/src/ThermoPhase.h +++ b/Cantera/src/ThermoPhase.h @@ -156,6 +156,31 @@ namespace Cantera { * unimplimented, which will cause an exception to be thrown if it * is called. * + * Relationship with the kinetics operator: + * + * Describe activity coefficients. + * + * Describe K_a, K_p, and K_c, These are three different equilibrium + * constants. + * + * K_a is the calculation of the equilibrium constant from the + * standard state Gibbs free energy values. It is by definition + * dimensionless. + * + * K_p is the calculation of the equilibrium constant from the + * reference state gibbs free energy values. It is by definition + * dimensionless. The pressure dependence is handled entirely + * on the rhs of the equilibrium expression. + * + * K_c is the equilibrium constant calculated from the + * activity concentrations. The dimensions depend on the number + * of products and reactants. + * + * + * The kinetics manager requires the calculation of K_c for the + * calculation of the reverse rate constant + * + * * @ingroup thermoprops * @ingroup phases */ diff --git a/Cantera/src/equil.h b/Cantera/src/equil.h index 049c8f59c..45ee613af 100644 --- a/Cantera/src/equil.h +++ b/Cantera/src/equil.h @@ -1,3 +1,19 @@ +/*********************************************************************** + * $RCSfile$ + * $Author$ + * $Date$ + * $Revision$ + ***********************************************************************/ +// Copyright 2001 California Institute of Technology + + /** + * @file equil.h + * This file contains the definition of some high level general equilibration + * routines and the text for the module \ref equilfunctions. + * + * It also contains the Module doxygen text for the Equilibration Solver + * capability within %Cantera. see \ref equilfunctions + */ #ifndef CT_KERNEL_EQUIL_H #define CT_KERNEL_EQUIL_H @@ -6,6 +22,11 @@ namespace Cantera { + /*! + * @defgroup equilfunctions Equilibrium Solver Capability + * + * Cantera has several different equilibrium routines. + */ //----------------------------------------------------------- // convenience functions //----------------------------------------------------------- diff --git a/tools/doc/Cantera.cfg.in b/tools/doc/Cantera.cfg.in index 268bdf5c1..509bd2726 100755 --- a/tools/doc/Cantera.cfg.in +++ b/tools/doc/Cantera.cfg.in @@ -121,7 +121,8 @@ FILE_PATTERNS = Kinetics.h Kinetics.cpp \ WaterPropsIAPWSphi.h WaterPropsIAPWSphi.cpp \ WaterPropsIAPWS.h WaterPropsIAPWS.cpp \ WaterTP.h WaterTP.cpp \ - PureFluidPhase.h PureFluidPhase.cpp + PureFluidPhase.h PureFluidPhase.cpp \ + equil.h RECURSIVE = NO EXCLUDE = CVS examples converters zeroD EXCLUDE_SYMLINKS = NO