From af56138e141bbad0b3400505101a360e268cae6a Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 11 Jan 2019 14:34:01 -0500 Subject: [PATCH] [Thermo] Clean up implementation of MaskellSolidSolnPhase Eliminate several member variables which shadow variables of the VPStandardState class, and actually contained the same information calculated a different way. --- .../cantera/thermo/MaskellSolidSolnPhase.h | 19 -------------- src/thermo/MaskellSolidSolnPhase.cpp | 25 ------------------- 2 files changed, 44 deletions(-) diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index 483d3cf8e..83bf9b26a 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -136,25 +136,6 @@ private: */ doublereal m_Pcurrent; - /** - * Function to call through to m_spthermo->update and fill m_h0_RT, - * m_cp0_R, m_g0_RT, m_s0_R. - */ - void _updateThermo() const; - - //! Vector containing the species reference enthalpies at T = m_tlast - mutable vector_fp m_h0_RT; - - //! Vector containing the species reference constant pressure heat - //! capacities at T = m_tlast - mutable vector_fp m_cp0_R; - - //! Vector containing the species reference Gibbs functions at T = m_tlast - mutable vector_fp m_g0_RT; - - //! Vector containing the species reference entropies at T = m_tlast - mutable vector_fp m_s0_R; - //! Value of the enthalpy change on mixing due to protons changing from type //! B to type A configurations. doublereal h_mixing; diff --git a/src/thermo/MaskellSolidSolnPhase.cpp b/src/thermo/MaskellSolidSolnPhase.cpp index 85b8c38c3..cc4bd6245 100644 --- a/src/thermo/MaskellSolidSolnPhase.cpp +++ b/src/thermo/MaskellSolidSolnPhase.cpp @@ -19,10 +19,6 @@ namespace Cantera MaskellSolidSolnPhase::MaskellSolidSolnPhase() : m_Pcurrent(OneAtm), - m_h0_RT(2), - m_cp0_R(2), - m_g0_RT(2), - m_s0_R(2), h_mixing(0.0), product_species_index(-1), reactant_species_index(-1) @@ -41,7 +37,6 @@ void MaskellSolidSolnPhase::getActivityConcentrations(doublereal* c) const doublereal MaskellSolidSolnPhase::enthalpy_mole() const { - _updateThermo(); const doublereal h0 = RT() * mean_X(m_h0_RT); const doublereal r = moleFraction(product_species_index); const doublereal fmval = fm(r); @@ -55,7 +50,6 @@ doublereal xlogx(doublereal x) doublereal MaskellSolidSolnPhase::entropy_mole() const { - _updateThermo(); const doublereal s0 = GasConstant * mean_X(m_s0_R); const doublereal r = moleFraction(product_species_index); const doublereal fmval = fm(r); @@ -105,7 +99,6 @@ void MaskellSolidSolnPhase::setMolarDensity(const doublereal n) void MaskellSolidSolnPhase::getActivityCoefficients(doublereal* ac) const { - _updateThermo(); static const int cacheId = m_cache.getId(); CachedArray cached = m_cache.getArray(cacheId); if (!cached.validate(temperature(), pressure(), stateMFNumber())) { @@ -125,7 +118,6 @@ void MaskellSolidSolnPhase::getActivityCoefficients(doublereal* ac) const void MaskellSolidSolnPhase::getChemPotentials(doublereal* mu) const { - _updateThermo(); const doublereal r = moleFraction(product_species_index); const doublereal pval = p(r); const doublereal rfm = r * fm(r); @@ -169,7 +161,6 @@ void MaskellSolidSolnPhase::getPartialMolarVolumes(doublereal* vbar) const void MaskellSolidSolnPhase::getPureGibbs(doublereal* gpure) const { - _updateThermo(); for (size_t sp=0; sp < m_kk; ++sp) { gpure[sp] = RT() * m_g0_RT[sp]; } @@ -238,22 +229,6 @@ void MaskellSolidSolnPhase::setProductSpecies(const std::string& name) reactant_species_index = (product_species_index == 0) ? 1 : 0; } -void MaskellSolidSolnPhase::_updateThermo() const -{ - assert(m_kk == 2); - static const int cacheId = m_cache.getId(); - CachedScalar cached = m_cache.getScalar(cacheId); - - // Update the thermodynamic functions of the reference state. - doublereal tnow = temperature(); - if (!cached.validate(tnow)) { - m_spthermo.update(tnow, m_cp0_R.data(), m_h0_RT.data(), m_s0_R.data()); - for (size_t k = 0; k < m_kk; k++) { - m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k]; - } - } -} - doublereal MaskellSolidSolnPhase::s() const { return 1 + std::exp(h_mixing / RT());