From 6667d793193b18008c7e558ea96f0ee4e6bece03 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Fri, 25 Apr 2008 02:38:38 +0000 Subject: [PATCH] Changed variable names. Fixed an error with the print out of the pressure units. --- Cantera/src/equil/vcs_Gibbs.cpp | 12 ++++++++++-- Cantera/src/equil/vcs_TP.cpp | 4 ++-- Cantera/src/equil/vcs_prep.cpp | 4 ++-- Cantera/src/equil/vcs_report.cpp | 8 ++++++-- Cantera/src/equil/vcs_solve.cpp | 12 ++++++------ Cantera/src/equil/vcs_solve.h | 12 ++++++++++-- Cantera/src/equil/vcs_solve_TP.cpp | 10 +++++++--- 7 files changed, 43 insertions(+), 19 deletions(-) diff --git a/Cantera/src/equil/vcs_Gibbs.cpp b/Cantera/src/equil/vcs_Gibbs.cpp index 521f15e41..3b0b00b52 100644 --- a/Cantera/src/equil/vcs_Gibbs.cpp +++ b/Cantera/src/equil/vcs_Gibbs.cpp @@ -45,7 +45,11 @@ namespace VCSnonideal { g += TPhInertMoles[iph] * log(TPhInertMoles[iph] / tPhMoles[iph]); if (Vphase->GasPhase) { - g += TPhInertMoles[iph] * log(Pres); + if (m_VCS_UnitsFormat == 3) { + g += TPhInertMoles[iph] * log(m_pressure/(Cantera::OneAtm)); + } else { + g += TPhInertMoles[iph] * log(m_pressure); + } } } } @@ -82,7 +86,11 @@ namespace VCSnonideal { g += TPhInertMoles[iphase] * log(TPhInertMoles[iphase] / phaseMols); vcs_VolPhase *Vphase = VPhaseList[iphase]; if (Vphase->GasPhase == iphase) { - g += TPhInertMoles[iphase] * log(Pres); + if (m_VCS_UnitsFormat == 3) { + g += TPhInertMoles[iphase] * log(m_pressure/(Cantera::OneAtm)); + } else { + g += TPhInertMoles[iphase] * log(m_pressure); + } } } diff --git a/Cantera/src/equil/vcs_TP.cpp b/Cantera/src/equil/vcs_TP.cpp index b2202b8a1..772a4f726 100644 --- a/Cantera/src/equil/vcs_TP.cpp +++ b/Cantera/src/equil/vcs_TP.cpp @@ -55,7 +55,7 @@ namespace VCSnonideal { * Store the temperature and pressure in the private global variables */ m_temperature = T_arg; - Pres = pres_arg; + m_pressure = pres_arg; /* * Evaluate the standard state free energies * at the current temperatures and pressures. @@ -154,7 +154,7 @@ namespace VCSnonideal { for (int iph = 0; iph < NPhase; iph++) { vcs_VolPhase* vph = VPhaseList[iph]; - vph->setState_TP(m_temperature, Pres); + vph->setState_TP(m_temperature, m_pressure); vph->sendToVCSGStar(VCS_DATA_PTR(m_SSfeSpecies)); } diff --git a/Cantera/src/equil/vcs_prep.cpp b/Cantera/src/equil/vcs_prep.cpp index 34840af98..5f6c28cec 100644 --- a/Cantera/src/equil/vcs_prep.cpp +++ b/Cantera/src/equil/vcs_prep.cpp @@ -191,8 +191,8 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl) } if (fabs(sum) < 1.0E-6) { modifiedSoln = true; - if (Pres <= 0.0) pres = 1.0; - else pres = Pres; + if (m_pressure <= 0.0) pres = 1.0; + else pres = m_pressure; retn = vcs_evalSS_TP(0, 0, m_temperature, pres); for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) { if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) { diff --git a/Cantera/src/equil/vcs_report.cpp b/Cantera/src/equil/vcs_report.cpp index 3f865277e..2341b20a2 100644 --- a/Cantera/src/equil/vcs_report.cpp +++ b/Cantera/src/equil/vcs_report.cpp @@ -105,11 +105,15 @@ int VCS_SOLVE::vcs_report(int iconv) * Calculate some quantities that may need updating */ vcs_tmoles(); - Vol = vcs_VolTotal(m_temperature, Pres, + Vol = vcs_VolTotal(m_temperature, m_pressure, VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(VolPM)); plogf("\t\tTemperature = %15.2g Kelvin\n", m_temperature); - plogf("\t\tPressure = %15.5g Atmos\n", Pres); + std::string punits = "Atm"; + if (m_VCS_UnitsFormat == 3) { + punits = "Pa "; + } + plogf("\t\tPressure = %15.5g %3s\n", m_pressure, punits.c_str()); plogf("\t\tVolume = %15.5g cm**3\n", Vol); /* diff --git a/Cantera/src/equil/vcs_solve.cpp b/Cantera/src/equil/vcs_solve.cpp index 47c9842e5..0168c5f4c 100644 --- a/Cantera/src/equil/vcs_solve.cpp +++ b/Cantera/src/equil/vcs_solve.cpp @@ -44,7 +44,7 @@ namespace VCSnonideal { iest(0), TMoles(0.0), m_temperature(0.0), - Pres(0.0), + m_pressure(0.0), tolmaj(0.0), tolmin(0.0), tolmaj2(0.0), @@ -582,8 +582,8 @@ namespace VCSnonideal { */ if (pub->T > 0.0) m_temperature = pub->T; else m_temperature = 293.15; - if (pub->Pres > 0.0) Pres = pub->Pres; - else Pres = 1.0; + if (pub->Pres > 0.0) m_pressure = pub->Pres; + else m_pressure = 1.0; /* * TPhInertMoles[] -> must be copied over here */ @@ -773,7 +773,7 @@ namespace VCSnonideal { bool status_change = false; m_temperature = pub->T; - Pres = pub->Pres; + m_pressure = pub->Pres; m_VCS_UnitsFormat = pub->m_VCS_UnitsFormat; iest = pub->iest; @@ -902,7 +902,7 @@ namespace VCSnonideal { int k1 = 0; vcs_tmoles(); - Vol = vcs_VolTotal(m_temperature, Pres, + Vol = vcs_VolTotal(m_temperature, m_pressure, VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(VolPM)); for (i = 0; i < m_numSpeciesTot; ++i) { @@ -930,7 +930,7 @@ namespace VCSnonideal { } pub->T = m_temperature; - pub->Pres = Pres; + pub->Pres = m_pressure; pub->Vol = Vol; int kT = 0; for (int iph = 0; iph < pub->NPhase; iph++) { diff --git a/Cantera/src/equil/vcs_solve.h b/Cantera/src/equil/vcs_solve.h index d55f10014..d27595476 100644 --- a/Cantera/src/equil/vcs_solve.h +++ b/Cantera/src/equil/vcs_solve.h @@ -673,8 +673,16 @@ public: //! Temperature (Kelvin) double m_temperature; - //! Pressure (units are Pascals) - double Pres; + //! Pressure (units are determined by m_VCS_UnitsFormat + /*! + * Values units + * -1: atm + * 0: atm + * 1: atm + * 2: atm + * 3: Pa + */ + double m_pressure; //! Total kmoles of inert to add to each phase /*! diff --git a/Cantera/src/equil/vcs_solve_TP.cpp b/Cantera/src/equil/vcs_solve_TP.cpp index bf412b4f3..4332f5dc9 100644 --- a/Cantera/src/equil/vcs_solve_TP.cpp +++ b/Cantera/src/equil/vcs_solve_TP.cpp @@ -236,9 +236,13 @@ namespace VCSnonideal { ((VPhaseList[0])->NVolSpecies)); plogf("%10d PHASE2 SPECIES%8d SINGLE SPECIES PHASES\n\n", numSpecliquid, - m_numSpeciesTot - (VPhaseList[0])->NVolSpecies - numSpecliquid); - plogf(" PRESSURE%22.3f ATM\n TEMPERATURE%19.3f K\n", - Pres, m_temperature); + m_numSpeciesTot - (VPhaseList[0])->NVolSpecies - numSpecliquid); + string punits = "atm"; + if (m_VCS_UnitsFormat == 3) { + punits = "Pa "; + } + plogf(" PRESSURE%22.8g %3s\n", m_pressure, punits.c_str()); + plogf(" TEMPERATURE%19.3f K\n", m_temperature); Vphase = VPhaseList[0]; if (Vphase->NVolSpecies > 0) { plogf(" PHASE1 INERTS%17.3f\n", TPhInertMoles[0]);