From 01987b44387c198384ae8374020328c1412ba04a Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 16 Jun 2014 22:00:25 +0000 Subject: [PATCH] [Thermo] Implement missing SurfPhase functions Adding the entropy_mole, cp_mole, and cv_mole functions fixes the silent failure of the report() function for surface phases. --- include/cantera/thermo/SurfPhase.h | 12 ++++++++++++ src/thermo/SurfPhase.cpp | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 96e6b176b..a599983eb 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -228,6 +228,18 @@ public: */ virtual doublereal intEnergy_mole() const; + //! Return the Molar Entropy. Units: J/kmol-K + /** + * \f[ + * \hat s(T,P) = \sum_k X_k (\hat s^0_k(T) - R \log(\theta_k)) + * \f] + */ + virtual doublereal entropy_mole() const; + + virtual doublereal cp_mole() const; + + virtual doublereal cv_mole() const; + //! Get the species chemical potentials. Units: J/kmol. /*! * This function returns a vector of chemical potentials of the diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index 67f7bceba..b5133de50 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -113,6 +113,28 @@ doublereal SurfPhase::intEnergy_mole() const return enthalpy_mole(); } +doublereal SurfPhase::entropy_mole() const +{ + _updateThermo(); + doublereal s = 0.0; + for (size_t k = 0; k < m_kk; k++) { + s += moleFraction(k) * (m_s0[k] - + GasConstant * log(std::max(concentration(k) * size(k)/m_n0, SmallNumber))); + } + return s; +} + +doublereal SurfPhase::cp_mole() const +{ + _updateThermo(); + return mean_X(&m_cp0[0]); +} + +doublereal SurfPhase::cv_mole() const +{ + return cp_mole(); +} + void SurfPhase::getPartialMolarEnthalpies(doublereal* hbar) const { getEnthalpy_RT(hbar);