From 3b0cf9f83232a74952d6f359bb770d778f1ea9a6 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 6 Jul 2016 17:20:54 -0400 Subject: [PATCH] [Thermo] Make SSVolume_Model_enumType local to class PDSS_SSVol --- include/cantera/thermo/PDSS_SSVol.h | 21 ++++++++++++++++++++- include/cantera/thermo/mix_defs.h | 18 ------------------ src/thermo/PDSS_SSVol.cpp | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/include/cantera/thermo/PDSS_SSVol.h b/include/cantera/thermo/PDSS_SSVol.h index 09c5d71ed..c01703475 100644 --- a/include/cantera/thermo/PDSS_SSVol.h +++ b/include/cantera/thermo/PDSS_SSVol.h @@ -292,9 +292,28 @@ private: //@} private: + //! Types of general formulations for the specification of the standard + //! state volume + enum class SSVolume_Model { + //! This approximation is for a constant volume + constant = 0, + //! This approximation is for a species with a quadratic polynomial in + //! temperature + /*! + * V^ss_i = ai + bi T + ci T2 + */ + tpoly, + //! This approximation is for a species where the density is expressed + //! as a quadratic polynomial in temperature + /*! + * V^ss_i = M_i / (ai + bi T + ci T2) + */ + density_tpoly + }; + //! Enumerated data type describing the type of volume model //! used to calculate the standard state volume of the species - SSVolume_Model_enumType volumeModel_; + SSVolume_Model volumeModel_; //! Value of the constant molar volume for the species /*! diff --git a/include/cantera/thermo/mix_defs.h b/include/cantera/thermo/mix_defs.h index f4a9a1b56..d52df6ed6 100644 --- a/include/cantera/thermo/mix_defs.h +++ b/include/cantera/thermo/mix_defs.h @@ -98,24 +98,6 @@ const int cVPSS_HMW = 1040; const int cVPSS_DebyeHuckel = 1050; const int cVPSS_MolalSoln = 1060; -//! Types of general formulations for the specification of the standard state volume -enum SSVolume_Model_enumType { - //! This approximation is for a constant volume - cSSVOLUME_CONSTANT = 0, - //! This approximation is for a species with a quadratic polynomial in - //! temperature - /*! - * V^ss_i = ai + bi T + ci T2 - */ - cSSVOLUME_TPOLY, - //! This approximation is for a species where the density is expressed as a - //! quadratic polynomial in temperature - /*! - * V^ss_i = M_i / (ai + bi T + ci T2) - */ - cSSVOLUME_DENSITY_TPOLY -}; - //! Types of PDSS's //! @deprecated Unused. To be removed after Cantera 2.3. enum PDSS_enumType { diff --git a/src/thermo/PDSS_SSVol.cpp b/src/thermo/PDSS_SSVol.cpp index 5c00cc864..4d4f35bc4 100644 --- a/src/thermo/PDSS_SSVol.cpp +++ b/src/thermo/PDSS_SSVol.cpp @@ -18,7 +18,7 @@ namespace Cantera { PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex) : PDSS(tp, spindex), - volumeModel_(cSSVOLUME_CONSTANT), + volumeModel_(SSVolume_Model::constant), m_constMolarVolume(-1.0) { m_pdssType = cPDSS_SSVOL; @@ -30,7 +30,7 @@ PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex) : PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex, const std::string& inputFile, const std::string& id) : PDSS(tp, spindex), - volumeModel_(cSSVOLUME_CONSTANT), + volumeModel_(SSVolume_Model::constant), m_constMolarVolume(-1.0) { warn_deprecated("PDSS_SSVol constructor from XML input file", @@ -44,7 +44,7 @@ PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex, const XML_Node& phaseRoot, bool spInstalled) : PDSS(tp, spindex), - volumeModel_(cSSVOLUME_CONSTANT), + volumeModel_(SSVolume_Model::constant), m_constMolarVolume(-1.0) { m_pdssType = cPDSS_SSVOL; @@ -53,7 +53,7 @@ PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex, PDSS_SSVol::PDSS_SSVol(const PDSS_SSVol& b) : PDSS(b), - volumeModel_(cSSVOLUME_CONSTANT), + volumeModel_(SSVolume_Model::constant), m_constMolarVolume(-1.0) { // Use the assignment operator to do the brunt of the work for the copy @@ -96,17 +96,17 @@ void PDSS_SSVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, } std::string model = ss->attrib("model"); if (model == "constant_incompressible" || model == "constant") { - volumeModel_ = cSSVOLUME_CONSTANT; + volumeModel_ = SSVolume_Model::constant; m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI"); } else if (model == "temperature_polynomial") { - volumeModel_ = cSSVOLUME_TPOLY; + volumeModel_ = SSVolume_Model::tpoly; size_t num = getFloatArray(*ss, TCoeff_, true, "toSI", "volumeTemperaturePolynomial"); if (num != 4) { throw CanteraError("PDSS_SSVol::constructPDSSXML", " Didn't get 4 density polynomial numbers for species " + speciesNode.name()); } } else if (model == "density_temperature_polynomial") { - volumeModel_ = cSSVOLUME_DENSITY_TPOLY; + volumeModel_ = SSVolume_Model::density_tpoly; size_t num = getFloatArray(*ss, TCoeff_, true, "toSI", "densityTemperaturePolynomial"); if (num != 4) { throw CanteraError("PDSS_SSVol::constructPDSSXML", @@ -231,13 +231,13 @@ doublereal PDSS_SSVol::molarVolume_ref() const void PDSS_SSVol::calcMolarVolume() const { - if (volumeModel_ == cSSVOLUME_CONSTANT) { + if (volumeModel_ == SSVolume_Model::constant) { m_Vss_ptr[m_spindex] = m_constMolarVolume; - } else if (volumeModel_ == cSSVOLUME_TPOLY) { + } else if (volumeModel_ == SSVolume_Model::tpoly) { m_Vss_ptr[m_spindex] = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3])); dVdT_ = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3]; d2VdT2_ = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3]; - } else if (volumeModel_ == cSSVOLUME_DENSITY_TPOLY) { + } else if (volumeModel_ == SSVolume_Model::density_tpoly) { doublereal dens = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3])); m_Vss_ptr[m_spindex] = m_mw / dens; doublereal dens2 = dens * dens;