From f7d87724aea4b697c3ffcbabce7ed06d42b5134c Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 23 Jul 2011 19:39:08 +0000 Subject: [PATCH] Changed the definition of the reference state of pure fluids. The reference state for pure fluids is defined as an ideal gas at the current temperature of the fluid at the reference pressure. It was defined as the real fluid properties at the current temperature and the reference pressure. However, this definition doesn't allow for the easy calculation of fugacities. Added some documentation, also, concerning the standard state definition. --- Cantera/src/thermo/PureFluidPhase.cpp | 11 ++++++++--- Cantera/src/thermo/PureFluidPhase.h | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Cantera/src/thermo/PureFluidPhase.cpp b/Cantera/src/thermo/PureFluidPhase.cpp index 9c07788a7..7f1266f9e 100644 --- a/Cantera/src/thermo/PureFluidPhase.cpp +++ b/Cantera/src/thermo/PureFluidPhase.cpp @@ -355,7 +355,8 @@ namespace Cantera { double psave = pressure(); double t = temperature(); double pref = m_spthermo->refPressure(); - Set(tpx::TP, t, pref); + double plow = 1.0E-8; + Set(tpx::TP, t, plow); getEnthalpy_RT(hrt); Set(tpx::TP, t, psave); @@ -371,8 +372,10 @@ namespace Cantera { double psave = pressure(); double t = temperature(); double pref = m_spthermo->refPressure(); - Set(tpx::TP, t, pref); + double plow = 1.0E-8; + Set(tpx::TP, t, plow); getGibbs_RT(grt); + grt[0] += log(pref/plow); Set(tpx::TP, t, psave); } //==================================================================================================================== @@ -399,8 +402,10 @@ namespace Cantera { double psave = pressure(); double t = temperature(); double pref = m_spthermo->refPressure(); - Set(tpx::TP, t, pref); + double plow = 1.0E-8; + Set(tpx::TP, t, plow); getEntropy_R(er); + er[0] -= log(pref/plow); Set(tpx::TP, t, psave); } //==================================================================================================================== diff --git a/Cantera/src/thermo/PureFluidPhase.h b/Cantera/src/thermo/PureFluidPhase.h index f692bad1d..d548fc6f4 100644 --- a/Cantera/src/thermo/PureFluidPhase.h +++ b/Cantera/src/thermo/PureFluidPhase.h @@ -304,6 +304,12 @@ namespace Cantera { //@} /// @name Properties of the Standard State of the Species in the Solution + /*! + * The standard state of the pure fluid is defined as the real properties + * of the pure fluid at the most stable state of the fluid at the current + * temperature and pressure of the solution. With this definition, the + * activity of the fluid is always then defined to be equal to one. + */ //@{ //! Get the array of chemical potentials at unit activity for the species @@ -342,15 +348,19 @@ namespace Cantera { */ virtual void getGibbs_RT(doublereal* grt) const; - //@} + /// @name Thermodynamic Values for the Species Reference States + /*! + * The species reference state for pure fluids is defined as an ideal gas at the + * reference pressure and current temperature of the fluid. + */ //@{ //! Returns the vector of nondimensional enthalpies of the reference state at the current temperature //! of the solution and the reference pressure for the species. /*! - * This base function will throw a CanteraException unless + * This base function will throw a Cantera exception unless * it is overwritten in a derived class. * * @param hrt Output vector containing the nondimensional reference state enthalpies @@ -358,8 +368,7 @@ namespace Cantera { */ virtual void getEnthalpy_RT_ref(doublereal *hrt) const; - //! Returns the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature + //! Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temperature //! of the solution and the reference pressure for the species. /*! * @param grt Output vector containing the nondimensional reference state @@ -372,15 +381,14 @@ namespace Cantera { /*! * units = J/kmol * - * @param g Output vector containing the reference state + * @param g Output vector containing the reference state * Gibbs Free energies. Length: m_kk. Units: J/kmol. */ virtual void getGibbs_ref(doublereal *g) const; - //! Returns the vector of nondimensional - //! entropies of the reference state at the current temperature + //! Returns the vector of nondimensional entropies of the reference state at the current temperature //! of the solution and the reference pressure for each species. /*! * @param er Output vector containing the nondimensional reference state @@ -388,7 +396,6 @@ namespace Cantera { */ virtual void getEntropy_R_ref(doublereal *er) const; - /** * @name Setting the State * @@ -396,7 +403,6 @@ namespace Cantera { * @{ */ - //! Set the internally storred specific enthalpy (J/kg) and pressure (Pa) of the phase. /*! * @param h Specific enthalpy (J/kg)