From eda9fc8f23e23720643806c7d4868706337272d6 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 15 Apr 2016 15:31:23 -0400 Subject: [PATCH] [Equil] Add vcs_VolPhase::eos_name; deprecate string16_EOSType --- include/cantera/equil/vcs_VolPhase.h | 4 ++++ src/equil/vcs_MultiPhaseEquil.cpp | 6 ++---- src/equil/vcs_VolPhase.cpp | 25 +++++++++++++++++++++++++ src/equil/vcs_prob.cpp | 3 +-- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/include/cantera/equil/vcs_VolPhase.h b/include/cantera/equil/vcs_VolPhase.h index a2f4011df..21840dc77 100644 --- a/include/cantera/equil/vcs_VolPhase.h +++ b/include/cantera/equil/vcs_VolPhase.h @@ -492,6 +492,9 @@ public: //! Return the number of species in the phase size_t nSpecies() const; + //! Return the name corresponding to the equation of state + std::string eos_name() const; + private: //! Evaluate the activity coefficients at the current conditions /*! @@ -846,6 +849,7 @@ private: /*! * @param EOSType : integer value of the equation of state * @return a string representing the EOS. The string is no more than 16 characters. + * @deprecated Use vcs_VolPhase::eos_name instead. To be removed after Cantera 2.3. */ std::string string16_EOSType(int EOSType); diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 37ac93422..4a716b68b 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -970,10 +970,9 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) for (size_t iphase = 0; iphase < vprob->NPhase; iphase++) { vcs_VolPhase* VolPhase = vprob->VPhaseList[iphase]; - std::string sEOS = string16_EOSType(VolPhase->m_eqnState); plogf("%16s %5d %5d %8d %16s %8d %16e ", VolPhase->PhaseName.c_str(), VolPhase->VP_ID_, VolPhase->m_singleSpecies, - VolPhase->m_gasPhase, sEOS.c_str(), + VolPhase->m_gasPhase, VolPhase->eos_name(), VolPhase->nSpecies(), VolPhase->totalMolesInert()); plogf("%16e\n", VolPhase->totalMoles()); } @@ -1079,10 +1078,9 @@ int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob) for (size_t iphase = 0; iphase < vprob->NPhase; iphase++) { vcs_VolPhase* VolPhase = vprob->VPhaseList[iphase]; - std::string sEOS = string16_EOSType(VolPhase->m_eqnState); plogf("%16s %5d %5d %8d %16s %8d %16e ", VolPhase->PhaseName.c_str(), VolPhase->VP_ID_, VolPhase->m_singleSpecies, - VolPhase->m_gasPhase, sEOS.c_str(), + VolPhase->m_gasPhase, VolPhase->eos_name(), VolPhase->nSpecies(), VolPhase->totalMolesInert()); plogf("%16e\n", VolPhase->totalMoles()); } diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index 7093c9cfb..e2323d1fb 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -819,6 +819,8 @@ void vcs_VolPhase::setMolesCurrent(int stateCalc) std::string string16_EOSType(int EOSType) { + warn_deprecated("string16_EOSType", "Use vcs_VolPhase::eos_name instead." + " To be removed after Cantera 2.3."); char st[32]; st[16] = '\0'; switch (EOSType) { @@ -1127,4 +1129,27 @@ size_t vcs_VolPhase::nSpecies() const return m_numSpecies; } +std::string vcs_VolPhase::eos_name() const +{ + switch (m_eqnState) { + case VCS_EOS_CONSTANT: + return "Constant"; + case VCS_EOS_IDEAL_GAS: + return "Ideal Gas"; + case VCS_EOS_STOICH_SUB: + return "Stoich Sub"; + case VCS_EOS_IDEAL_SOLN: + return "Ideal Soln"; + case VCS_EOS_DEBEYE_HUCKEL: + return "Debeye Huckel"; + case VCS_EOS_REDLICK_KWONG: + return "Redlick_Kwong"; + case VCS_EOS_REGULAR_SOLN: + return "Regular Soln"; + default: + return fmt::format("UnkType: {:7d}", m_eqnState); + break; + } +} + } diff --git a/src/equil/vcs_prob.cpp b/src/equil/vcs_prob.cpp index 5f66ab3f0..8bbb03711 100644 --- a/src/equil/vcs_prob.cpp +++ b/src/equil/vcs_prob.cpp @@ -212,10 +212,9 @@ void VCS_PROB::prob_report(int print_lvl) for (size_t iphase = 0; iphase < NPhase; iphase++) { vcs_VolPhase* Vphase = VPhaseList[iphase]; - std::string EOS_cstr = string16_EOSType(Vphase->m_eqnState); plogf("%16s %5d %5d %8d ", Vphase->PhaseName, Vphase->VP_ID_, Vphase->m_singleSpecies, Vphase->m_gasPhase); - plogf("%16s %8d %16e ", EOS_cstr, + plogf("%16s %8d %16e ", Vphase->eos_name(), Vphase->nSpecies(), Vphase->totalMolesInert()); if (iest >= 0) { plogf("%16e\n", Vphase->totalMoles());