[Thermo] Make SSVolume_Model_enumType local to class PDSS_SSVol

This commit is contained in:
Ray Speth 2016-07-06 17:20:54 -04:00
parent 0f71bbcec5
commit 3b0cf9f832
3 changed files with 30 additions and 29 deletions

View file

@ -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
/*!

View file

@ -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 {

View file

@ -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;