From 85a55c7c440bc58254276d9baa7befd131a5285d Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 25 Jun 2008 16:40:55 +0000 Subject: [PATCH] vcs_VolPhase: made more member data private, and eliminated some unused member data --- Cantera/src/equil/vcs_MultiPhaseEquil.cpp | 6 ++--- Cantera/src/equil/vcs_VolPhase.cpp | 20 ++++++++++++----- Cantera/src/equil/vcs_VolPhase.h | 27 +++++------------------ Cantera/src/equil/vcs_solve.cpp | 8 +++---- 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp index 94e9f9e66..58db97b01 100644 --- a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp +++ b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp @@ -1056,7 +1056,7 @@ namespace VCSnonideal { if (ns == 1) { if (tPhase->charge(0) != 0.0) { VolPhase->m_speciesUnknownType[0] = VCS_SPECIES_TYPE_INTERFACIALVOLTAGE; - VolPhase->m_phiVarIndex = 0; + VolPhase->setPhiVarIndex(0); } } @@ -1506,8 +1506,8 @@ namespace VCSnonideal { kT++; } - if (volPhase->m_phiVarIndex >= 0) { - int kglob = volPhase->IndSpecies[volPhase->m_phiVarIndex]; + if (volPhase->phiVarIndex() >= 0) { + int kglob = volPhase->IndSpecies[volPhase->phiVarIndex()]; vprob->w[kglob] = tPhase->electricPotential(); } volPhase->setMolesFromVCS(VCS_STATECALC_OLD, VCS_DATA_PTR(vprob->w)); diff --git a/Cantera/src/equil/vcs_VolPhase.cpp b/Cantera/src/equil/vcs_VolPhase.cpp index 0859f671d..2bf5215d5 100644 --- a/Cantera/src/equil/vcs_VolPhase.cpp +++ b/Cantera/src/equil/vcs_VolPhase.cpp @@ -46,10 +46,9 @@ namespace VCSnonideal { m_isIdealSoln(false), Existence(0), m_MFStartIndex(0), - IndexSpecialSpecies(-1), Activity_Coeff_Model(VCS_AC_CONSTANT), IndSpecies(0), - IndSpeciesContig(true), + //IndSpeciesContig(true), m_VCS_UnitsFormat(VCS_UNITS_MKS), m_useCanteraCalls(false), TP_ptr(0), @@ -109,9 +108,8 @@ namespace VCSnonideal { m_isIdealSoln(b.m_isIdealSoln), Existence(b.Existence), m_MFStartIndex(b.m_MFStartIndex), - IndexSpecialSpecies(b.IndexSpecialSpecies), Activity_Coeff_Model(b.Activity_Coeff_Model), - IndSpeciesContig(b.IndSpeciesContig), + //IndSpeciesContig(b.IndSpeciesContig), m_VCS_UnitsFormat(b.m_VCS_UnitsFormat), m_useCanteraCalls(b.m_useCanteraCalls), TP_ptr(b.TP_ptr), @@ -187,14 +185,13 @@ namespace VCSnonideal { m_isIdealSoln = b.m_isIdealSoln; Existence = b.Existence; m_MFStartIndex = b.m_MFStartIndex; - IndexSpecialSpecies = b.IndexSpecialSpecies; Activity_Coeff_Model = b.Activity_Coeff_Model; /* * Do a shallow copy because we haven' figured this out. */ IndSpecies = b.IndSpecies; - IndSpeciesContig = b.IndSpeciesContig; + //IndSpeciesContig = b.IndSpeciesContig; for (k = 0; k < old_num; k++) { if ( ListSpeciesPtr[k]) { @@ -1171,5 +1168,16 @@ namespace VCSnonideal { } /**********************************************************************/ + int vcs_VolPhase::phiVarIndex() const { + return m_phiVarIndex; + } + /**********************************************************************/ + + + void vcs_VolPhase::setPhiVarIndex(int phiVarIndex) { + m_phiVarIndex = phiVarIndex; + } + /**********************************************************************/ + } diff --git a/Cantera/src/equil/vcs_VolPhase.h b/Cantera/src/equil/vcs_VolPhase.h index a2acabdd4..7a81eea5f 100644 --- a/Cantera/src/equil/vcs_VolPhase.h +++ b/Cantera/src/equil/vcs_VolPhase.h @@ -247,8 +247,6 @@ namespace VCSnonideal { */ double GStar_calc_one(int kspec) const; - - //! Gibbs free energy calculation at a temperature for the reference state //! of a species, return a value for one species /*! @@ -404,6 +402,10 @@ namespace VCSnonideal { //! Returns whether the object is using cantera calls. bool usingCanteraCalls() const; + int phiVarIndex() const; + + void setPhiVarIndex(int phiVarIndex); + private: //! Evaluate the activity coefficients at the current conditions @@ -538,7 +540,7 @@ namespace VCSnonideal { */ std::vector ElName; - //! boolean indicating whether element constraint is active + //! boolean indicating whether an element constraint is active //! for the current problem std::vector ElActive; @@ -629,22 +631,12 @@ namespace VCSnonideal { int m_MFStartIndex; public: - //! Index of the species which is special in - //! with respect to the thermo treatment. - /*! - * For water models this index will point to - * the index for water. - * defaults to 0 - */ - int IndexSpecialSpecies; - //! Integer representing the activity coefficient model /*! * The known models are listed at the top of this page */ int Activity_Coeff_Model; - //! Index into the species vectors /*! * Maps the phase species number into the global species number. @@ -652,9 +644,6 @@ namespace VCSnonideal { * vector is changed during the algorithm */ std::vector IndSpecies; - - //! Boolean indicating whether IndSpecies is contiguous - bool IndSpeciesContig; //! Vector of Species structures for the species belonging to this phase /*! @@ -704,8 +693,6 @@ namespace VCSnonideal { //! Vector of the current mole fractions for species //! in the phase std::vector Xmol; - - public: //! If the potential is a solution variable in VCS, it acts as a species. //! This is the species index in the phase for the potential @@ -717,7 +704,6 @@ namespace VCSnonideal { */ mutable double m_totalVol; - private: //! Vector of calculated SS0 chemical potentials for the //! current Temperature. /*! @@ -741,7 +727,6 @@ namespace VCSnonideal { */ mutable std::vector StarChemicalPotential; - public: //! Vector of the Star molar Volumes of the species. /*! * units m3 / kmol @@ -761,7 +746,6 @@ namespace VCSnonideal { */ mutable std::vector ActCoeff; - private: //! Vector of the derivatives of the ln activity coefficient wrt to the //! current mole number /*! @@ -832,7 +816,6 @@ namespace VCSnonideal { //! Current value of the pressure for this object, and underlying objects double Pres; - public: //! Reference pressure for the phase double RefPres; diff --git a/Cantera/src/equil/vcs_solve.cpp b/Cantera/src/equil/vcs_solve.cpp index 758c71979..9b80521b4 100644 --- a/Cantera/src/equil/vcs_solve.cpp +++ b/Cantera/src/equil/vcs_solve.cpp @@ -971,11 +971,11 @@ namespace VCSnonideal { for (int k = 0; k < pubPhase->NVolSpecies; k++) { kT = pubPhase->IndSpecies[k]; //pubPhase->SS0ChemicalPotential[k] = vPhase->SS0ChemicalPotential[k]; - pubPhase->StarMolarVol[k] = vPhase->StarMolarVol[k]; - pubPhase->PartialMolarVol[k] = vPhase->PartialMolarVol[k]; - pubPhase->ActCoeff[k] = vPhase->ActCoeff[k]; + //pubPhase->StarMolarVol[k] = vPhase->StarMolarVol[k]; + //pubPhase->PartialMolarVol[k] = vPhase->PartialMolarVol[k]; + //pubPhase->ActCoeff[k] = vPhase->ActCoeff[k]; - if (pubPhase->m_phiVarIndex == k) { + if (pubPhase->phiVarIndex() == k) { k1 = vPhase->IndSpecies[k]; double tmp = m_molNumSpecies_old[k1]; if (! vcs_doubleEqual( pubPhase->electricPotential() , tmp)) {