From 86a6070392210cfe64bb9b1de4b92f0b52c551b4 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Thu, 24 May 2007 21:09:52 +0000 Subject: [PATCH] Added missing partial molar functions. --- Cantera/src/thermo/SurfPhase.cpp | 46 ++++++++++++++++++++++++++++-- Cantera/src/thermo/SurfPhase.h | 49 +++++++++++++++++++++++++------- 2 files changed, 82 insertions(+), 13 deletions(-) diff --git a/Cantera/src/thermo/SurfPhase.cpp b/Cantera/src/thermo/SurfPhase.cpp index dd4718d4d..0f9ed4864 100644 --- a/Cantera/src/thermo/SurfPhase.cpp +++ b/Cantera/src/thermo/SurfPhase.cpp @@ -1,8 +1,9 @@ /** * @file SurfPhase.cpp - * Definitions for a simple thermoydnamics model of a surface phase derived from ThermoPhase, - * assuming an ideal solution model - * (see \ref thermoprops and class \link Cantera::SurfPhase SurfPhase\endlink). + * Definitions for a simple thermoydnamics model of a surface phase + * derived from ThermoPhase, assuming an ideal solution model + * (see \ref thermoprops and class + * \link Cantera::SurfPhase SurfPhase\endlink). */ // Copyright 2002 California Institute of Technology @@ -75,6 +76,45 @@ namespace Cantera { doublereal SurfPhase:: intEnergy_mole() const { return enthalpy_mole(); } + /* + * Get the array of partial molar enthalpies of the species + * units = J / kmol + */ + void SurfPhase::getPartialMolarEnthalpies(doublereal* hbar) const { + getEnthalpy_RT(hbar); + doublereal rt = GasConstant * temperature(); + for (int k = 0; k < m_kk; k++) { + hbar[k] *= rt; + } + } + + // Returns an array of partial molar entropies of the species in the + // solution. Units: J/kmol/K. + /* + * @param sbar Output vector of species partial molar entropies. + * Length = m_kk. units are J/kmol/K. + */ + void SurfPhase::getPartialMolarEntropies(doublereal* sbar) const { + getEntropy_R(sbar); + for (int k = 0; k < m_kk; k++) { + sbar[k] *= GasConstant; + } + } + + // Returns an array of partial molar heat capacities of the species in the + // solution. Units: J/kmol/K. + /* + * @param sbar Output vector of species partial molar entropies. + * Length = m_kk. units are J/kmol/K. + */ + void SurfPhase::getPartialMolarCp(doublereal* cpbar) const { + getCp_R(cpbar); + for (int k = 0; k < m_kk; k++) { + cpbar[k] *= GasConstant; + } + } + + void SurfPhase::getPartialMolarVolumes(doublereal* vbar) const { getStandardVolumes(vbar); } diff --git a/Cantera/src/thermo/SurfPhase.h b/Cantera/src/thermo/SurfPhase.h index 7afed2142..d828ffa30 100644 --- a/Cantera/src/thermo/SurfPhase.h +++ b/Cantera/src/thermo/SurfPhase.h @@ -202,6 +202,44 @@ namespace Cantera { */ virtual doublereal intEnergy_mole() const; + //! Get the species chemical potentials. Units: J/kmol. + /*! + * This function returns a vector of chemical potentials of the + * species in solution at the current temperature, pressure + * and mole fraction of the solution. + * + * @param mu Output vector of species chemical + * potentials. Length: m_kk. Units: J/kmol + */ + virtual void getChemPotentials(doublereal* mu) const; + + //! Returns an array of partial molar enthalpies for the species + //! in the mixture. Units (J/kmol) + /*! + * @param hbar Output vector of species partial molar enthalpies. + * Length: m_kk. units are J/kmol. + */ + virtual void getPartialMolarEnthalpies(doublereal* hbar) const; + + //! Returns an array of partial molar entropies of the species in the + //! solution. Units: J/kmol/K. + /*! + * @param sbar Output vector of species partial molar entropies. + * Length = m_kk. units are J/kmol/K. + */ + virtual void getPartialMolarEntropies(doublereal* sbar) const; + + + + //! Return an array of partial molar heat capacities for the + //! species in the mixture. Units: J/kmol/K + /*! + * @param cpbar Output vector of species partial molar heat + * capacities at constant pressure. + * Length = m_kk. units are J/kmol/K. + */ + virtual void getPartialMolarCp(doublereal* cpbar) const; + //! Return an array of partial molar volumes for the //! species in the mixture. Units: m^3/kmol. /*! @@ -222,16 +260,7 @@ namespace Cantera { */ virtual void getStandardChemPotentials(doublereal* mu0) const; - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ - virtual void getChemPotentials(doublereal* mu) const; + //! Return a vector of activity concentrations for each species /*!