diff --git a/test/kinetics/pdep.cpp b/test/kinetics/pdep.cpp index 22980bf11..83050a645 100644 --- a/test/kinetics/pdep.cpp +++ b/test/kinetics/pdep.cpp @@ -56,7 +56,7 @@ ThermoPhase* PdepTest::thermo_ = NULL; Kinetics* PdepTest::kin_ = NULL; TEST_F(PdepTest, reactionCounts) { - EXPECT_EQ(6, kin_->nReactions()); + EXPECT_EQ((size_t) 6, kin_->nReactions()); } TEST_F(PdepTest, PlogLowPressure) { diff --git a/test/thermo/nasapoly.cpp b/test/thermo/nasapoly.cpp index 267acd2fa..0fc30167d 100644 --- a/test/thermo/nasapoly.cpp +++ b/test/thermo/nasapoly.cpp @@ -49,8 +49,8 @@ protected: EXPECT_DOUBLE_EQ(s_R1, s_R2); } - std::vector tpow_; NasaPoly1 poly; + std::vector tpow_; }; TEST_F(NasaPoly1Test, Initialization) @@ -58,7 +58,7 @@ TEST_F(NasaPoly1Test, Initialization) EXPECT_EQ(poly.minTemp(), 200.0); EXPECT_EQ(poly.maxTemp(), 1000.0); EXPECT_EQ(poly.refPressure(), 101325.0); - EXPECT_EQ(poly.speciesIndex(), 0); + EXPECT_EQ(poly.speciesIndex(), (size_t) 0); } TEST_F(NasaPoly1Test, Copy) diff --git a/test_problems/ChemEquil_gri_matrix/gri_matrix.cpp b/test_problems/ChemEquil_gri_matrix/gri_matrix.cpp index 691340091..5dcc7852d 100644 --- a/test_problems/ChemEquil_gri_matrix/gri_matrix.cpp +++ b/test_problems/ChemEquil_gri_matrix/gri_matrix.cpp @@ -23,11 +23,11 @@ int main(int argc, char** argv) IdealGasMix g("gri30.xml", "gri30_mix"); double pres = OneAtm; - int kk = g.nSpecies(); + size_t kk = g.nSpecies(); vector_fp Xmol(kk, 0.0); - int iCH4 = g.speciesIndex("CH4"); - int iO2 = g.speciesIndex("O2"); - int iN2 = g.speciesIndex("N2"); + size_t iCH4 = g.speciesIndex("CH4"); + size_t iO2 = g.speciesIndex("O2"); + size_t iN2 = g.speciesIndex("N2"); /* * Do an initial calculation that can be debugged diff --git a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp index 1417ff95f..f1a88842b 100644 --- a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp +++ b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp @@ -35,11 +35,11 @@ int main(int argc, char** argv) int nj = 6; int ni = 7; FILE* FF = fopen("table.csv","w"); - int kk = gas->nSpecies(); + size_t kk = gas->nSpecies(); std::vector Xmol(kk, 0.0); const std::vector &snames = gas->speciesNames(); fprintf(FF,"Temperature, Pressure,"); - for (int k = 0; k < kk; k++) { + for (size_t k = 0; k < kk; k++) { fprintf(FF, "%11s", snames[k].c_str()); if (k < kk-1) { fprintf(FF,","); @@ -64,7 +64,7 @@ int main(int argc, char** argv) printf("Final T = %g, pres = %g atm\n", tkelvin, pres/OneAtm); gas->getMoleFractions(DATA_PTR(Xmol)); fprintf(FF,"%10.4g, %10.4g,", tkelvin, pres); - for (int k = 0; k < kk; k++) { + for (size_t k = 0; k < kk; k++) { if (fabs(Xmol[k]) < 1.0E-130) { fprintf(FF," %10.4g", 0.0); } else { diff --git a/test_problems/ChemEquil_red1/basopt_red1.cpp b/test_problems/ChemEquil_red1/basopt_red1.cpp index fc60c8673..6344b2d99 100644 --- a/test_problems/ChemEquil_red1/basopt_red1.cpp +++ b/test_problems/ChemEquil_red1/basopt_red1.cpp @@ -32,10 +32,10 @@ int main(int argc, char** argv) bool doFormMatrix = true; vector_fp formRxnMatrix; - int nc = BasisOptimize(&usedZeroedSpecies, doFormMatrix, - &mphase, orderVectorSpecies, - orderVectorElements, - formRxnMatrix); + size_t nc = BasisOptimize(&usedZeroedSpecies, doFormMatrix, + &mphase, orderVectorSpecies, + orderVectorElements, + formRxnMatrix); cout << "number of components = " << nc << endl; diff --git a/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp b/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp index cfb3488c3..c0303828c 100644 --- a/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp +++ b/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp @@ -90,9 +90,9 @@ int main(int argc, char** argv) // Initialize the individual phases HMWSoln hmw(inputFile, ""); - int kk = hmw.nSpecies(); + size_t kk = hmw.nSpecies(); vector_fp Xmol(kk, 0.0); - int iH2OL = hmw.speciesIndex("H2O(L)"); + size_t iH2OL = hmw.speciesIndex("H2O(L)"); Xmol[iH2OL] = 1.0; hmw.setState_TPX(T, pres, DATA_PTR(Xmol)); @@ -100,10 +100,10 @@ int main(int argc, char** argv) kk = gas->nSpecies(); Xmol.resize(kk, 0.0); - for (int i = 0; i < kk; i++) { + for (size_t i = 0; i < kk; i++) { Xmol[i] = 0.0; } - int iN2 = gas->speciesIndex("N2"); + size_t iN2 = gas->speciesIndex("N2"); Xmol[iN2] = 1.0; gas->setState_TPX(T, pres, DATA_PTR(Xmol)); diff --git a/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp b/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp index 0c873d13c..6d87918c8 100644 --- a/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp +++ b/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp @@ -21,7 +21,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; string fName = "DH_graph_1.log"; fileLog* fl = new fileLog(fName); try { @@ -35,7 +35,7 @@ int main(int argc, char** argv) DebyeHuckel* DH = new DebyeHuckel(iFile, "NaCl_electrolyte"); - int nsp = DH->nSpecies(); + size_t nsp = DH->nSpecies(); double acMol[100]; double mf[100]; double moll[100]; @@ -44,9 +44,9 @@ int main(int argc, char** argv) DH->setState_TP(298.15, 1.01325E5); - int i1 = DH->speciesIndex("Na+"); - int i2 = DH->speciesIndex("Cl-"); - int i3 = DH->speciesIndex("H2O(L)"); + size_t i1 = DH->speciesIndex("Na+"); + size_t i2 = DH->speciesIndex("Cl-"); + size_t i3 = DH->speciesIndex("H2O(L)"); for (i = 1; i < nsp; i++) { moll[i] = 0.0; } @@ -57,7 +57,7 @@ int main(int argc, char** argv) double ISQRTbot = sqrt(Ibot); double ISQRT; double Is = 0.0; - int its = 100; + size_t its = 100; printf(" Is, sqrtIs, meanAc," " log10(meanAC), acMol_Na+," ", acMol_Cl-, ac_Water\n"); diff --git a/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp b/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp index 506e19178..53c34be2e 100644 --- a/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp +++ b/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; try { @@ -42,7 +42,7 @@ int main(int argc, char** argv) Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double mf[100]; double moll[100]; for (i = 0; i < 100; i++) { @@ -57,8 +57,8 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); //int i3 = HMW->speciesIndex("H2O(L)"); for (i = 0; i < nsp; i++) { moll[i] = 0.0; @@ -242,14 +242,12 @@ int main(int argc, char** argv) //double AL = HMW->ADebye_L(T,pres); double AJ = HMW->ADebye_J(T, pres); - - - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { Cp0_R[k] *= GasConstant * 1.0E-6; } molarCp0 = 0.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { molarCp0 += Xmol[k] * Cp0_R[k]; } diff --git a/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp b/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp index 7b24a7f31..c3231db8b 100644 --- a/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp +++ b/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; try { @@ -43,7 +43,7 @@ int main(int argc, char** argv) Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double mf[100]; double moll[100]; for (i = 0; i < 100; i++) { @@ -58,8 +58,8 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); //int i3 = HMW->speciesIndex("H2O(L)"); for (i = 0; i < nsp; i++) { moll[i] = 0.0; @@ -223,14 +223,12 @@ int main(int argc, char** argv) //double AL = HMW->ADebye_L(T,pres); double AJ = HMW->ADebye_J(T, pres); - - - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { Cp0_R[k] *= GasConstant * 1.0E-6; } molarCp0 = 0.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { molarCp0 += Xmol[k] * Cp0_R[k]; } diff --git a/test_problems/cathermo/HMW_graph_GvI/HMW_graph_GvI.cpp b/test_problems/cathermo/HMW_graph_GvI/HMW_graph_GvI.cpp index 7c43adfd2..298cbe055 100644 --- a/test_problems/cathermo/HMW_graph_GvI/HMW_graph_GvI.cpp +++ b/test_problems/cathermo/HMW_graph_GvI/HMW_graph_GvI.cpp @@ -21,7 +21,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; string commandFile; try { @@ -43,7 +43,7 @@ int main(int argc, char** argv) HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double acMol[100]; double act[100]; double mf[100]; @@ -68,9 +68,9 @@ int main(int argc, char** argv) ff = fopen(fname, "w"); HMW->setState_TP(Temp, 1.01325E5); printf(" Temperature = %g K\n", Temp); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); - int i3 = HMW->speciesIndex("H2O(L)"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); + size_t i3 = HMW->speciesIndex("H2O(L)"); for (i = 1; i < nsp; i++) { moll[i] = 0.0; } @@ -81,7 +81,7 @@ int main(int argc, char** argv) double ISQRTbot = sqrt(Ibot); double ISQRT; double Is = 0.0; - int its = 100; + size_t its = 100; bool doneSp = false; fprintf(ff," Is, sqrtIs, meanAc," " log10(meanAC), acMol_Na+," diff --git a/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp b/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp index 00d2fc26d..a576a9b0c 100644 --- a/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp +++ b/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; int extraCols = 1; try { @@ -46,7 +46,7 @@ int main(int argc, char** argv) string id = "NaCl(S)"; Cantera::ThermoPhase* solid = Cantera::newPhase(nacl_s, id); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double acMol[100]; double act[100]; double mf[100]; @@ -65,8 +65,8 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); //int i3 = HMW->speciesIndex("H2O(L)"); for (i = 1; i < nsp; i++) { moll[i] = 0.0; @@ -167,7 +167,7 @@ int main(int argc, char** argv) mu_NaCl = mu[0] * 1.0E-6; HMW->getChemPotentials(mu); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { mu[k] *= 1.0E-6; } mu_Naplus = mu[i1]; @@ -184,16 +184,14 @@ int main(int argc, char** argv) double molecWater = HMW->molecularWeight(0); double Mo = molecWater / 1000.; double Gibbs_kgWater = molarGibbs / (Xmol[0] * Mo); - - double Aphi = HMW->A_Debye_TP() / 3.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { mu0_RT[k] *= RT * 1.0E-6; } molarGibbs0 = 0.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { molarGibbs0 += Xmol[k] * mu0_RT[k]; } double Gibbs0_kgWater = molarGibbs0 / (Xmol[0] * Mo); diff --git a/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp b/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp index 18eb2dbc4..3fd9949c8 100644 --- a/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp +++ b/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; try { @@ -43,7 +43,7 @@ int main(int argc, char** argv) Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double mf[100]; double moll[100]; for (i = 0; i < 100; i++) { @@ -58,8 +58,8 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); //int i3 = HMW->speciesIndex("H2O(L)"); for (i = 1; i < nsp; i++) { moll[i] = 0.0; @@ -206,20 +206,16 @@ int main(int argc, char** argv) * units of kJ/gmolSaltAdded */ double phiL = L / Xmol[i1]; - - double Aphi = HMW->A_Debye_TP() / 3.0; double AL = HMW->ADebye_L(); double LrelMol = HMW->relative_molal_enthalpy() * 1.0E-6; - - - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { Enth0_RT[k] *= RT * 1.0E-6; } molarEnth0 = 0.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { molarEnth0 += Xmol[k] * Enth0_RT[k]; } diff --git a/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp b/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp index 616152a4b..ea9a0273a 100644 --- a/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp +++ b/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp @@ -22,7 +22,7 @@ int main(int argc, char** argv) { int retn = 0; - int i; + size_t i; try { @@ -42,7 +42,7 @@ int main(int argc, char** argv) Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); //double acMol[100]; //double act[100]; double mf[100]; @@ -55,8 +55,8 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); - int i1 = HMW->speciesIndex("Na+"); - int i2 = HMW->speciesIndex("Cl-"); + size_t i1 = HMW->speciesIndex("Na+"); + size_t i2 = HMW->speciesIndex("Cl-"); //int i3 = HMW->speciesIndex("H2O(L)"); for (i = 0; i < nsp; i++) { moll[i] = 0.0; @@ -226,9 +226,8 @@ int main(int argc, char** argv) //double AL = HMW->ADebye_L(T,pres); double Av = HMW->ADebye_V(T, pres) * 1.0E3; - molarV0 = 0.0; - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { molarV0 += Xmol[k] * V0[k]; } diff --git a/test_problems/cathermo/HMW_test_1/HMW_test_1.cpp b/test_problems/cathermo/HMW_test_1/HMW_test_1.cpp index 35520fc94..fd41a5d88 100644 --- a/test_problems/cathermo/HMW_test_1/HMW_test_1.cpp +++ b/test_problems/cathermo/HMW_test_1/HMW_test_1.cpp @@ -15,7 +15,7 @@ void printUsage() void pAtable(HMWSoln* HMW) { - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double acMol[100]; double mf[100]; double activities[100]; @@ -32,7 +32,7 @@ void pAtable(HMWSoln* HMW) string sName; printf(" Name Activity ActCoeffMolal " " MoleFract Molality\n"); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sName = HMW->speciesName(k); printf("%16s %13g %13g %13g %13g\n", sName.c_str(), activities[k], acMol[k], mf[k], moll[k]); @@ -64,7 +64,7 @@ int main(int argc, char** argv) HMW->m_debugCalc = 0; } - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double a1 = HMW->AionicRadius(1); printf("a1 = %g\n", a1); @@ -92,27 +92,22 @@ int main(int argc, char** argv) HMW->setState_TP(298.15, 1.01325E5); HMW->getStandardChemPotentials(mu0); // translate from J/kmol to kJ/gmol - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { mu0[k] *= 1.0E-6; } printf(" Species Standard chemical potentials (kJ/gmol) \n"); printf("------------------------------------------------------------\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sName = HMW->speciesName(k); printf("%16s %16.9g\n", sName.c_str(), mu0[k]); } printf("------------------------------------------------------------\n"); printf(" Some DeltaSS values: Delta(mu_0)\n"); double deltaG; - int i1, i2, j1; + size_t i1, i2, j1; double RT = 8.314472E-3 * 298.15; - - - - i1 = HMW->speciesIndex("Na+"); i2 = HMW->speciesIndex("Cl-"); deltaG = -432.6304 - mu0[i1] - mu0[i2]; @@ -129,7 +124,7 @@ int main(int argc, char** argv) i1 = HMW->speciesIndex("H+"); i2 = HMW->speciesIndex("H2O(L)"); j1 = HMW->speciesIndex("OH-"); - if (i1 < 0 || i2 < 0 || j1 < 0) { + if (i1 == npos || i2 == npos || j1 == npos) { printf("problems\n"); exit(-1); } diff --git a/test_problems/cathermo/HMW_test_3/HMW_test_3.cpp b/test_problems/cathermo/HMW_test_3/HMW_test_3.cpp index f5b592cff..010de4118 100644 --- a/test_problems/cathermo/HMW_test_3/HMW_test_3.cpp +++ b/test_problems/cathermo/HMW_test_3/HMW_test_3.cpp @@ -15,7 +15,7 @@ void printUsage() void pAtable(HMWSoln* HMW) { - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double acMol[100]; double mf[100]; double activities[100]; @@ -28,7 +28,7 @@ void pAtable(HMWSoln* HMW) string sName; printf(" Name Activity ActCoeffMolal " " MoleFract Molality\n"); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sName = HMW->speciesName(k); printf("%16s %13g %13g %13g %13g\n", sName.c_str(), activities[k], acMol[k], mf[k], moll[k]); @@ -47,7 +47,7 @@ int main(int argc, char** argv) HMWSoln* HMW = new HMWSoln("HMW_NaCl_tc.xml"); - int nsp = HMW->nSpecies(); + size_t nsp = HMW->nSpecies(); double a1 = HMW->AionicRadius(1); printf("a1 = %g\n", a1); @@ -91,25 +91,22 @@ int main(int argc, char** argv) HMW->setState_TP(Temp, 1.01325E5); HMW->getStandardChemPotentials(mu0); // translate from J/kmol to kJ/gmol - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { mu0[k] *= 1.0E-6; } printf(" Species Standard chemical potentials (kJ/gmol) \n"); printf("------------------------------------------------------------\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sName = HMW->speciesName(k); printf("%16s %16.9g\n", sName.c_str(), mu0[k]); } printf("------------------------------------------------------------\n"); printf(" Some DeltaSS values: Delta(mu_0)\n"); double deltaG; - int i1, i2, j1; + size_t i1, i2, j1; double RT = 8.314472E-3 * 298.15; - - i1 = HMW->speciesIndex("Na+"); i2 = HMW->speciesIndex("Cl-"); deltaG = -432.6304 - mu0[i1] - mu0[i2]; @@ -123,7 +120,7 @@ int main(int argc, char** argv) i1 = HMW->speciesIndex("H+"); i2 = HMW->speciesIndex("H2O(L)"); j1 = HMW->speciesIndex("OH-"); - if (i1 < 0 || i2 < 0 || j1 < 0) { + if (i1 == npos || i2 == npos || j1 == npos) { printf("problems\n"); exit(-1); } diff --git a/test_problems/cathermo/VPissp/ISSPTester.cpp b/test_problems/cathermo/VPissp/ISSPTester.cpp index e4ce1dcef..34eff2e24 100644 --- a/test_problems/cathermo/VPissp/ISSPTester.cpp +++ b/test_problems/cathermo/VPissp/ISSPTester.cpp @@ -52,8 +52,8 @@ int main(int argc, char** argv) for (int j = 1; j < argc; j++) { tok = string(argv[j]); if (tok[0] == '-') { - int nopt = tok.size(); - for (int n = 1; n < nopt; n++) { + size_t nopt = tok.size(); + for (size_t n = 1; n < nopt; n++) { if (tok[n] == 'h') { printUsage(); exit(0); @@ -101,7 +101,7 @@ int main(int argc, char** argv) double mmw = issp.meanMolecularWeight(); printf("mean molecular weight = %13.5g kg kmol-1\n", mmw); - int n = issp.nSpecies(); + size_t n = issp.nSpecies(); double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20]; double RT = GasConstant * Tkelvin; @@ -112,7 +112,7 @@ int main(int argc, char** argv) issp.getStandardVolumes(VoliSS); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { HiSS[i] *= RT; SiSS[i] *= RT; CpiSS[i] *= GasConstant; @@ -121,7 +121,7 @@ int main(int argc, char** argv) printf(" Printout of standard state properties\n"); printf(" Name mu_i H_i_SS " " S_i_SS Cp_i_SS Vol_i_SS\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = issp.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i], HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]); @@ -139,7 +139,7 @@ int main(int argc, char** argv) printf(" Printout of Partial molar properties\n"); printf(" Name mu_i H_i_PM " " S_i_PM Cp_i_PM Vol_i_PM\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = issp.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i], HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]); diff --git a/test_problems/cathermo/ims/IMSTester.cpp b/test_problems/cathermo/ims/IMSTester.cpp index b4f5c7d9c..671606d29 100644 --- a/test_problems/cathermo/ims/IMSTester.cpp +++ b/test_problems/cathermo/ims/IMSTester.cpp @@ -50,8 +50,8 @@ int main(int argc, char** argv) for (int j = 1; j < argc; j++) { tok = string(argv[j]); if (tok[0] == '-') { - int nopt = tok.size(); - for (int n = 1; n < nopt; n++) { + size_t nopt = tok.size(); + for (size_t n = 1; n < nopt; n++) { if (tok[n] == 'h') { printUsage(); exit(0); @@ -99,7 +99,7 @@ int main(int argc, char** argv) double mmw = ims.meanMolecularWeight(); printf("mean molecular weight = %13.5g kg kmol-1\n", mmw); - int n = ims.nSpecies(); + size_t n = ims.nSpecies(); double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20]; double RT = GasConstant * Tkelvin; @@ -110,7 +110,7 @@ int main(int argc, char** argv) ims.getStandardVolumes(VoliSS); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { HiSS[i] *= RT; SiSS[i] *= RT; CpiSS[i] *= GasConstant; @@ -119,7 +119,7 @@ int main(int argc, char** argv) printf(" Printout of standard state properties\n"); printf(" Name mu_i H_i_SS " " S_i_SS Cp_i_SS Vol_i_SS\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = ims.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i], HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]); @@ -137,7 +137,7 @@ int main(int argc, char** argv) printf(" Printout of Partial molar properties\n"); printf(" Name mu_i H_i_PM " " S_i_PM Cp_i_PM Vol_i_PM\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = ims.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i], HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]); diff --git a/test_problems/cathermo/issp/ISSPTester.cpp b/test_problems/cathermo/issp/ISSPTester.cpp index afae1311a..b02dfbcd2 100644 --- a/test_problems/cathermo/issp/ISSPTester.cpp +++ b/test_problems/cathermo/issp/ISSPTester.cpp @@ -52,8 +52,8 @@ int main(int argc, char** argv) for (int j = 1; j < argc; j++) { tok = string(argv[j]); if (tok[0] == '-') { - int nopt = tok.size(); - for (int n = 1; n < nopt; n++) { + size_t nopt = tok.size(); + for (size_t n = 1; n < nopt; n++) { if (tok[n] == 'h') { printUsage(); exit(0); @@ -101,7 +101,7 @@ int main(int argc, char** argv) double mmw = issp.meanMolecularWeight(); printf("mean molecular weight = %13.5g kg kmol-1\n", mmw); - int n = issp.nSpecies(); + size_t n = issp.nSpecies(); double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20]; double RT = GasConstant * Tkelvin; @@ -112,7 +112,7 @@ int main(int argc, char** argv) issp.getStandardVolumes(VoliSS); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { HiSS[i] *= RT; SiSS[i] *= RT; CpiSS[i] *= GasConstant; @@ -121,7 +121,7 @@ int main(int argc, char** argv) printf(" Printout of standard state properties\n"); printf(" Name mu_i H_i_SS " " S_i_SS Cp_i_SS Vol_i_SS\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = issp.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i], HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]); @@ -139,7 +139,7 @@ int main(int argc, char** argv) printf(" Printout of Partial molar properties\n"); printf(" Name mu_i H_i_PM " " S_i_PM Cp_i_PM Vol_i_PM\n"); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { string sn = issp.speciesName(i); printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i], HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]); diff --git a/test_problems/cathermo/stoichSubSSTP/stoichSubSSTP.cpp b/test_problems/cathermo/stoichSubSSTP/stoichSubSSTP.cpp index adff3a6ae..effad530e 100644 --- a/test_problems/cathermo/stoichSubSSTP/stoichSubSSTP.cpp +++ b/test_problems/cathermo/stoichSubSSTP/stoichSubSSTP.cpp @@ -23,10 +23,6 @@ void printUsage() int main(int argc, char** argv) { - - int retn = 0; - int i; - try { //Cantera::ThermoPhase *tp = 0; char iFile[80], file_ID[80]; @@ -39,7 +35,6 @@ int main(int argc, char** argv) XML_Node* xm = get_XML_NameID("phase", file_ID, 0); StoichSubstanceSSTP* solid = new StoichSubstanceSSTP(*xm); - /* * Load in and initialize the */ @@ -47,8 +42,7 @@ int main(int argc, char** argv) //string id = "NaCl(S)"; //Cantera::ThermoPhase *solid = Cantera::newPhase(nacl_s, id); - - int nsp = solid->nSpecies(); + size_t nsp = solid->nSpecies(); if (nsp != 1) { throw CanteraError("","Should just be one species"); } @@ -83,7 +77,6 @@ int main(int argc, char** argv) printf(" Data from http://webbook.nist.gov\n"); printf("\n"); - printf(" T, Pres, molarGibbs0, Enthalpy, Entropy, Cp ," " -(G-H298)/T, H-H298 "); printf("\n"); @@ -92,15 +85,13 @@ int main(int argc, char** argv) " J/gmolK, J/gmol"); printf("\n"); - for (i = 0; i < TTable.NPoints; i++) { + for (size_t i = 0; i < TTable.NPoints; i++) { T = TTable.T[i]; // GasConstant is in J/kmol RT = GasConstant * T; - pres = OneAtm; - solid->setState_TP(T, pres); /* * Get the Standard State DeltaH @@ -110,7 +101,6 @@ int main(int argc, char** argv) solid->getEnthalpy_RT(enth_RT); enth_NaCl = enth_RT[0] * RT * 1.0E-6; - solid->getChemPotentials(mu); mu_NaCl = mu[0] * 1.0E-6; @@ -122,11 +112,6 @@ int main(int argc, char** argv) solid->getCp_R(cp_r); cp_NaCl = cp_r[0] * GasConstant * 1.0E-3; - /* - * Need the gas constant in kJ/gmolK - */ - // double rgas = 8.314472 * 1.0E-3; - double pbar = pres * 1.0E-5; printf("%10g, %10g, %12g, %12g, %12g, %12g, %12g, %12g", @@ -134,14 +119,9 @@ int main(int argc, char** argv) printf("\n"); } - - delete solid; solid = 0; Cantera::appdelete(); - - return retn; - } catch (CanteraError& err) { std::cout << err.what() << std::endl; Cantera::appdelete(); diff --git a/test_problems/cxx_ex/equil_example1.cpp b/test_problems/cxx_ex/equil_example1.cpp index 0d8d74a25..c754e6098 100644 --- a/test_problems/cxx_ex/equil_example1.cpp +++ b/test_problems/cxx_ex/equil_example1.cpp @@ -18,12 +18,11 @@ using namespace Cantera; template void makeEquilDataLabels(const G& gas, V& names) { - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); names.resize(nsp + 2); names[0] = "Temperature (K)"; names[1] = "Pressure (Pa)"; - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { names[2+k] = gas.speciesName(k); } } @@ -63,7 +62,7 @@ int equil_example1(int job) //IdealGasMix gas("silane.cti", "silane"); IdealGasMix gas("silane.xml", "silane"); - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); int ntemps = 50; // number of temperatures Array2D output(nsp+2, ntemps); diff --git a/test_problems/cxx_ex/example_utils.h b/test_problems/cxx_ex/example_utils.h index 3492b8ac9..8b9f1295e 100644 --- a/test_problems/cxx_ex/example_utils.h +++ b/test_problems/cxx_ex/example_utils.h @@ -26,8 +26,8 @@ void saveSoln(double time, const G& gas, A& soln) soln(1,back) = gas.temperature(); soln(2,back) = gas.density(); soln(3,back) = gas.pressure(); - int nsp = gas.nSpecies(); - for (int k = 0; k < nsp; k++) { + size_t nsp = gas.nSpecies(); + for (size_t k = 0; k < nsp; k++) { soln(4+k,back) = gas.moleFraction(k); } } @@ -35,14 +35,13 @@ void saveSoln(double time, const G& gas, A& soln) template void makeDataLabels(const G& gas, V& names) { - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); names.resize(nsp + 4); names[0] = "time (s)"; names[1] = "Temperature (K)"; names[2] = "Density (kg/m3)"; names[3] = "Pressure (Pa)"; - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { names[4+k] = gas.speciesName(k); } } diff --git a/test_problems/cxx_ex/examples.cpp b/test_problems/cxx_ex/examples.cpp index d078fc0a3..1017d38c1 100644 --- a/test_problems/cxx_ex/examples.cpp +++ b/test_problems/cxx_ex/examples.cpp @@ -64,15 +64,12 @@ int main(int argc, char** argv) } } try { - - int i = 0; if (example_num == 0) { - int j; - for (j = 0; j < NUM_EXAMPLES; j++) { - i = run_example(j, fex[j], 2); + for (int j = 0; j < NUM_EXAMPLES; j++) { + run_example(j, fex[j], 2); } } else if (example_num > 0 && example_num <= NUM_EXAMPLES) { - i = run_example(example_num-1, fex[example_num-1], 2); + run_example(example_num-1, fex[example_num-1], 2); } return 0; diff --git a/test_problems/cxx_ex/kinetics_example1.cpp b/test_problems/cxx_ex/kinetics_example1.cpp index 551cc2f9d..8cd3d13b1 100644 --- a/test_problems/cxx_ex/kinetics_example1.cpp +++ b/test_problems/cxx_ex/kinetics_example1.cpp @@ -48,7 +48,7 @@ int kinetics_example1(int job) // set the state gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0"); - int kk = gas.nSpecies(); + size_t kk = gas.nSpecies(); // create a reactor Reactor r; diff --git a/test_problems/cxx_ex/kinetics_example2.cpp b/test_problems/cxx_ex/kinetics_example2.cpp index 6895447b9..b58a0f717 100644 --- a/test_problems/cxx_ex/kinetics_example2.cpp +++ b/test_problems/cxx_ex/kinetics_example2.cpp @@ -36,7 +36,7 @@ int kinetics_example2(int job) // create a GRI30 object GRI30 gas; gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0"); - int kk = gas.nSpecies(); + size_t kk = gas.nSpecies(); // create a reactor Reactor r; diff --git a/test_problems/cxx_ex/kinetics_example3.cpp b/test_problems/cxx_ex/kinetics_example3.cpp index cf720771e..66a273bf7 100644 --- a/test_problems/cxx_ex/kinetics_example3.cpp +++ b/test_problems/cxx_ex/kinetics_example3.cpp @@ -49,7 +49,7 @@ int kinetics_example3(int job) // set the state gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0"); - int kk = gas.nSpecies(); + size_t kk = gas.nSpecies(); // create a reactor ConstPressureReactor r; diff --git a/test_problems/cxx_ex/transport_example1.cpp b/test_problems/cxx_ex/transport_example1.cpp index fbdc28352..0d5fd2b98 100644 --- a/test_problems/cxx_ex/transport_example1.cpp +++ b/test_problems/cxx_ex/transport_example1.cpp @@ -17,13 +17,12 @@ using std::endl; template void makeTransportDataLabels(const G& gas, V& names) { - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); names.resize(nsp + 3); names[0] = "Temperature (K)"; names[1] = "Viscosity ()"; names[2] = "Thermal Conductivity (W/m-K)"; - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { names[3+k] = gas.speciesName(k); } } @@ -63,7 +62,7 @@ int transport_example1(int job) Transport* tr = newTransportMgr("Mix", &gas); - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); // create a 2D array to hold the outputs diff --git a/test_problems/cxx_ex/transport_example2.cpp b/test_problems/cxx_ex/transport_example2.cpp index 2fb2864dd..a439dd6b5 100644 --- a/test_problems/cxx_ex/transport_example2.cpp +++ b/test_problems/cxx_ex/transport_example2.cpp @@ -18,13 +18,12 @@ using std::endl; template void makeTransportDataLabels(const G& gas, V& names) { - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); names.resize(nsp + 3); names[0] = "Temperature (K)"; names[1] = "Viscosity ()"; names[2] = "Thermal Conductivity (W/m-K)"; - int k; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { names[3+k] = gas.speciesName(k); } } @@ -64,7 +63,7 @@ int transport_example2(int job) // multicomponent transport properties Transport* tr = newTransportMgr("Multi", &gas); - int nsp = gas.nSpecies(); + size_t nsp = gas.nSpecies(); // create a 2D array to hold the outputs int ntemps = 20; diff --git a/test_problems/diamondSurf/runDiamond.cpp b/test_problems/diamondSurf/runDiamond.cpp index c92d069bf..52cec7303 100644 --- a/test_problems/diamondSurf/runDiamond.cpp +++ b/test_problems/diamondSurf/runDiamond.cpp @@ -50,18 +50,18 @@ int main(int argc, char** argv) XML_Node* const xg = xc->findNameID("phase", "gas"); ThermoPhase* gasTP = newPhase(*xg); - int nsp = gasTP->nSpecies(); + size_t nsp = gasTP->nSpecies(); cout << "Number of species = " << nsp << endl; XML_Node* const xd = xc->findNameID("phase", "diamond"); ThermoPhase* diamondTP = newPhase(*xd); - int nsp_diamond = diamondTP->nSpecies(); + size_t nsp_diamond = diamondTP->nSpecies(); cout << "Number of species in diamond = " << nsp_diamond << endl; XML_Node* const xs = xc->findNameID("phase", "diamond_100"); ThermoPhase* diamond100TP = newPhase(*xs); - int nsp_d100 = diamond100TP->nSpecies(); + size_t nsp_d100 = diamond100TP->nSpecies(); cout << "Number of species in diamond_100 = " << nsp_d100 << endl; vector phaseList; @@ -70,7 +70,7 @@ int main(int argc, char** argv) phaseList.push_back(diamond100TP); InterfaceKinetics* iKin_ptr = new InterfaceKinetics(); importKinetics(*xs, phaseList, iKin_ptr); - int nr = iKin_ptr->nReactions(); + size_t nr = iKin_ptr->nReactions(); cout << "Number of reactions = " << nr << endl; double x[20]; @@ -88,9 +88,9 @@ int main(int argc, char** argv) for (i = 0; i < 20; i++) { x[i] = 0.0; } - int i0 = diamond100TP->speciesIndex("c6H*"); + size_t i0 = diamond100TP->speciesIndex("c6H*"); x[i0] = 0.1; - int i1 = diamond100TP->speciesIndex("c6HH"); + size_t i1 = diamond100TP->speciesIndex("c6HH"); x[i1] = 0.9; diamond100TP->setState_TX(1200., x); diff --git a/test_problems/fracCoeff/fracCoeff.cpp b/test_problems/fracCoeff/fracCoeff.cpp index b09895d61..3839d3870 100644 --- a/test_problems/fracCoeff/fracCoeff.cpp +++ b/test_problems/fracCoeff/fracCoeff.cpp @@ -34,7 +34,6 @@ int main(int argc, char** argv) #ifdef _MSC_VER _set_output_format(_TWO_DIGIT_EXPONENT); #endif - int i, k; string infile = "frac.xml"; double x[10], kc[10]; double cdot[10], ddot[10]; @@ -46,26 +45,23 @@ int main(int argc, char** argv) XML_Node* const xg = xc->findNameID("phase", "gas"); ThermoPhase* gasTP = newPhase(*xg); - int nsp = gasTP->nSpecies(); + size_t nsp = gasTP->nSpecies(); cout << "Number of species = " << nsp << endl; - - vector phaseList; phaseList.push_back(gasTP); GasKinetics* iKin_ptr = new GasKinetics(); importKinetics(*xg, phaseList, iKin_ptr); - int nr = iKin_ptr->nReactions(); + size_t nr = iKin_ptr->nReactions(); cout << "Number of reactions = " << nr << endl; - int iH2 = gasTP->speciesIndex("H2"); - int iH = gasTP->speciesIndex("H"); - int iO2 = gasTP->speciesIndex("O2"); - int iOH = gasTP->speciesIndex("OH"); - int iH2O = gasTP->speciesIndex("H2O"); + size_t iH2 = gasTP->speciesIndex("H2"); + size_t iH = gasTP->speciesIndex("H"); + size_t iO2 = gasTP->speciesIndex("O2"); + size_t iOH = gasTP->speciesIndex("OH"); + size_t iH2O = gasTP->speciesIndex("H2O"); - - for (i = 0; i < nsp; i++) { + for (size_t i = 0; i < nsp; i++) { x[i] = 0.0; } x[iH2O] = 1.0/2.0; @@ -80,7 +76,7 @@ int main(int argc, char** argv) double src[20]; - for (i = 0; i < 20; i++) { + for (size_t i = 0; i < 20; i++) { src[i] = 0.0; } iKin_ptr->getNetProductionRates(src); @@ -93,7 +89,7 @@ int main(int argc, char** argv) iKin_ptr->getCreationRates(cdot); iKin_ptr->getDestructionRates(ddot); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = gasTP->speciesName(k); cout << k << " " << sss << " "; printDbl(src[k]); @@ -101,7 +97,7 @@ int main(int argc, char** argv) } printf("Creation Rates: \n"); - for (k = 0; k < nsp - 1; k++) { + for (size_t k = 0; k < nsp - 1; k++) { string sss = gasTP->speciesName(k); cout << k << " " << sss << " "; cout << cdot[k] << " "; @@ -116,7 +112,7 @@ int main(int argc, char** argv) printf("Destruction Rates: \n"); - for (k = 0; k < nsp-1; k++) { + for (size_t k = 0; k < nsp-1; k++) { string sss = gasTP->speciesName(k); cout << k << " " << sss << " "; cout << ddot[k] << " "; @@ -155,7 +151,6 @@ int main(int argc, char** argv) printf("Kc[0] = %g\n", kc[0]); printf("Kc[1] = %g\n", kc[1]); - delete(iKin_ptr); iKin_ptr = 0; delete(gasTP); diff --git a/test_problems/mixGasTransport/mixGasTransport.cpp b/test_problems/mixGasTransport/mixGasTransport.cpp index 04a29b3ba..80aec8b7f 100644 --- a/test_problems/mixGasTransport/mixGasTransport.cpp +++ b/test_problems/mixGasTransport/mixGasTransport.cpp @@ -35,14 +35,11 @@ int main(int argc, char** argv) #ifdef _MSC_VER _set_output_format(_TWO_DIGIT_EXPONENT); #endif - int k; string infile = "diamond.xml"; try { - - IdealGasMix g("gri30.xml", "gri30_mix"); - int nsp = g.nSpecies(); + size_t nsp = g.nSpecies(); double pres = 1.0E5; vector_fp Xset(nsp, 0.0); Xset[0] = 0.269205 ; @@ -101,10 +98,10 @@ int main(int argc, char** argv) double T1 = 1500.; double sum = 0.0; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sum += Xset[k]; } - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { Xset[k] /= sum; } @@ -127,11 +124,9 @@ int main(int argc, char** argv) double T3 = 1400.; vector_fp grad_T(3, 0.0); - Array2D grad_X(nsp, 2, 0.0); - - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { grad_X(k,0) = (X2set[k] - Xset[k])/dist; grad_X(k,1) = (X3set[k] - Xset[k])/dist; } @@ -141,28 +136,23 @@ int main(int argc, char** argv) int log_level = 0; Transport* tran = newTransportMgr("Mix", &g, log_level=0); - MixTransport* tranMix = dynamic_cast(tran); - - g.setState_TPX(1500.0, pres, DATA_PTR(Xset)); - vector_fp mixDiffs(nsp, 0.0); tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs)); printf(" Dump of the mixture Diffusivities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]); } - vector_fp specVisc(nsp, 0.0); tranMix->getSpeciesViscosities(DATA_PTR(specVisc)); printf(" Dump of the species viscosities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]); } @@ -170,13 +160,13 @@ int main(int argc, char** argv) vector_fp thermDiff(nsp, 0.0); tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff)); printf(" Dump of the Thermal Diffusivities :\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), thermDiff[k]); } printf("Viscosity and thermal Cond vs. T\n"); - for (k = 0; k < 10; k++) { + for (size_t k = 0; k < 10; k++) { T1 = 400. + 100. * k; g.setState_TPX(T1, pres, DATA_PTR(Xset)); double visc = tran->viscosity(); @@ -190,7 +180,7 @@ int main(int argc, char** argv) printf("Binary Diffusion Coefficients H2 vs species\n"); tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0)); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0)); } @@ -200,7 +190,7 @@ int main(int argc, char** argv) tranMix->getMobilities(DATA_PTR(specMob)); printf(" Dump of the species mobilities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), specMob[k]); } @@ -214,7 +204,7 @@ int main(int argc, char** argv) double sum2 = 0.0; double max1 = 0.0; double max2 = 0.0; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g %13.5g\n", sss.c_str(), fluxes(k,0), fluxes(k,1)); sum1 += fluxes(k,0); diff --git a/test_problems/multiGasTransport/multiGasTransport.cpp b/test_problems/multiGasTransport/multiGasTransport.cpp index b8388c935..cff3c22a3 100644 --- a/test_problems/multiGasTransport/multiGasTransport.cpp +++ b/test_problems/multiGasTransport/multiGasTransport.cpp @@ -43,14 +43,11 @@ int main(int argc, char** argv) #ifdef _MSC_VER _set_output_format(_TWO_DIGIT_EXPONENT); #endif - int k; string infile = "diamond.xml"; try { - - IdealGasMix g("gri30.xml", "gri30_mix"); - int nsp = g.nSpecies(); + size_t nsp = g.nSpecies(); double pres = 1.0E5; vector_fp Xset(nsp, 0.0); Xset[0] = 0.269205 ; @@ -109,10 +106,10 @@ int main(int argc, char** argv) double T1 = 1500.; double sum = 0.0; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { sum += Xset[k]; } - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { Xset[k] /= sum; } @@ -135,11 +132,9 @@ int main(int argc, char** argv) double T3 = 1400.; vector_fp grad_T(3, 0.0); - Array2D grad_X(nsp, 2, 0.0); - - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { grad_X(k,0) = (X2set[k] - Xset[k])/dist; grad_X(k,1) = (X3set[k] - Xset[k])/dist; } @@ -149,28 +144,21 @@ int main(int argc, char** argv) int log_level = 0; Transport* tran = newTransportMgr("Multi", &g, log_level=0); - MultiTransport* tranMix = dynamic_cast(tran); - - g.setState_TPX(1500.0, pres, DATA_PTR(Xset)); - - vector_fp mixDiffs(nsp, 0.0); tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs)); printf(" Dump of the mixture Diffusivities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]); } - vector_fp specVisc(nsp, 0.0); - tranMix->getSpeciesViscosities(DATA_PTR(specVisc)); printf(" Dump of the species viscosities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]); } @@ -178,14 +166,14 @@ int main(int argc, char** argv) vector_fp thermDiff(nsp, 0.0); tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff)); printf(" Dump of the Thermal Diffusivities :\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); double ddd = cutoff(thermDiff[k]); printf(" %15s %13.5g\n", sss.c_str(), ddd); } printf("Viscosity and thermal Cond vs. T\n"); - for (k = 0; k < 10; k++) { + for (size_t k = 0; k < 10; k++) { T1 = 400. + 100. * k; g.setState_TPX(T1, pres, DATA_PTR(Xset)); double visc = tran->viscosity(); @@ -199,23 +187,21 @@ int main(int argc, char** argv) printf("Binary Diffusion Coefficients H2 vs species\n"); tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0)); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0)); } - vector_fp specMob(nsp, 0.0); //tranMix->getMobilities(DATA_PTR(specMob)); printf(" Dump of the species mobilities:\n"); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" %15s %13.5g\n", sss.c_str(), specMob[k]); } Array2D fluxes(nsp, 2, 0.0); - tranMix->getSpeciesFluxes(2, DATA_PTR(grad_T), nsp, grad_X.ptrColumn(0), nsp, fluxes.ptrColumn(0)); printf(" Dump of the species fluxes:\n"); @@ -223,7 +209,7 @@ int main(int argc, char** argv) double sum2 = 0.0; double max1 = 0.0; double max2 = 0.0; - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); double ddd = cutoff(fluxes(k,0)); double eee = cutoff(fluxes(k,1)); @@ -251,17 +237,15 @@ int main(int argc, char** argv) printf("sum in y direction = 0\n"); } - Array2D MDdiff(nsp, nsp, 0.0); printf("Multicomponent Diffusion Coefficients H2 vs species\n"); tranMix->getMultiDiffCoeffs(nsp, MDdiff.ptrColumn(0)); - for (k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string sss = g.speciesName(k); printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), MDdiff(0,k), MDdiff(k,0)); } - } catch (CanteraError& err) { std::cout << err.what() << std::endl; return -1; diff --git a/test_problems/negATest/negATest.cpp b/test_problems/negATest/negATest.cpp index 203dc6b79..173677788 100644 --- a/test_problems/negATest/negATest.cpp +++ b/test_problems/negATest/negATest.cpp @@ -18,7 +18,7 @@ int main(int argc, char** argv) } std::string infile(argv[1]); - int i; + size_t i; double x[20]; double cdot[20], ddot[20]; @@ -28,7 +28,7 @@ int main(int argc, char** argv) XML_Node* const xg = xc->findNameID("phase", "air"); ThermoPhase* gasTP = newPhase(*xg); - int nsp = gasTP->nSpecies(); + size_t nsp = gasTP->nSpecies(); cout << "Number of species = " << nsp << endl; @@ -36,15 +36,15 @@ int main(int argc, char** argv) phaseList.push_back(gasTP); GasKinetics* iKin_ptr = new GasKinetics(); importKinetics(*xg, phaseList, iKin_ptr); - int nr = iKin_ptr->nReactions(); + size_t nr = iKin_ptr->nReactions(); cout << "Number of reactions = " << nr << endl; - int iH = gasTP->speciesIndex("H"); - int iO2 = gasTP->speciesIndex("O2"); - int iH2O = gasTP->speciesIndex("H2O"); - int iNH = gasTP->speciesIndex("NH"); - int iNO = gasTP->speciesIndex("NO"); - int iN2O = gasTP->speciesIndex("N2O"); + size_t iH = gasTP->speciesIndex("H"); + size_t iO2 = gasTP->speciesIndex("O2"); + size_t iH2O = gasTP->speciesIndex("H2O"); + size_t iNH = gasTP->speciesIndex("NH"); + size_t iNO = gasTP->speciesIndex("NO"); + size_t iN2O = gasTP->speciesIndex("N2O"); for (i = 0; i < nsp; i++) { x[i] = 0.0; @@ -69,10 +69,10 @@ int main(int argc, char** argv) for (i = 0; i < nsp; i++) { string sSt = gasTP->speciesName(i); - printf("rop [ %d:%s ] = %g \n", i, sSt.c_str(), src[i]); + printf("rop [ %d:%s ] = %g \n", (int) i, sSt.c_str(), src[i]); } - int nReactions = iKin_ptr->nReactions(); + size_t nReactions = iKin_ptr->nReactions(); cout << "number of reactions = " << nReactions << endl; double fwd_rop[20]; @@ -80,8 +80,8 @@ int main(int argc, char** argv) iKin_ptr->getFwdRatesOfProgress(fwd_rop); iKin_ptr->getRevRatesOfProgress(rev_rop); for (i = 0; i < nReactions; i++) { - printf("fwd_rop[%3d] = %13g rev_rop[%3d] = %13g\n", i, fwd_rop[i], - i, rev_rop[i]); + printf("fwd_rop[%3d] = %13g rev_rop[%3d] = %13g\n", (int) i, + fwd_rop[i], (int) i, rev_rop[i]); } diff --git a/test_problems/rankine_democxx/rankine.cpp b/test_problems/rankine_democxx/rankine.cpp index c2b4cc19a..2fe707f98 100644 --- a/test_problems/rankine_democxx/rankine.cpp +++ b/test_problems/rankine_democxx/rankine.cpp @@ -28,11 +28,9 @@ void saveState(F& fluid, string name) void printStates() { - string name; - int n; - int nStates = states.size(); - for (n = 0; n < nStates; n++) { - name = states[n]; + size_t nStates = states.size(); + for (size_t n = 0; n < nStates; n++) { + string name = states[n]; printf(" %5s %10.6g %10.6g %12.6g %12.6g %5.2g \n", name.c_str(), T[name], P[name], h[name], s[name], x[name]); } diff --git a/test_problems/shared/TemperatureTable.h b/test_problems/shared/TemperatureTable.h index b2791b542..7799c9a9f 100644 --- a/test_problems/shared/TemperatureTable.h +++ b/test_problems/shared/TemperatureTable.h @@ -23,23 +23,23 @@ class TemperatureTable { public: - int NPoints; + size_t NPoints; bool Include298; double Tlow; //!< Min temperature for thermo data fit double Thigh; //!< Max temperature for thermo table double DeltaT; vector T; - int numAddedTs; + size_t numAddedTs; vector AddedTempVector; public: /* * Default constructor for TemperatureTable() */ - TemperatureTable(const int nPts = 14, + TemperatureTable(const size_t nPts = 14, const bool inc298 = true, const double tlow = 300., const double deltaT = 100., - const int numAdded = 0, + const size_t numAdded = 0, const double* addedTempVector = 0) : NPoints(nPts), Include298(inc298), @@ -48,14 +48,13 @@ public: T(0), numAddedTs(numAdded) { /****************************/ - int i; AddedTempVector.resize(numAdded, 0.0); - for (int i = 0; i < numAdded; i++) { + for (size_t i = 0; i < numAdded; i++) { AddedTempVector[i] = addedTempVector[i]; } T.resize(NPoints, 0.0); double TCurrent = Tlow; - for (i = 0; i < NPoints; i++) { + for (size_t i = 0; i < NPoints; i++) { T[i] = TCurrent; TCurrent += DeltaT; } @@ -65,7 +64,7 @@ public: } if (numAdded > 0) { T.resize(NPoints+numAdded, 0.0); - for (i = 0; i < numAdded; i++) { + for (size_t i = 0; i < numAdded; i++) { T[i+NPoints] = addedTempVector[i]; } NPoints += numAdded; @@ -97,7 +96,7 @@ public: /* * size() */ - int size() { + size_t size() { return NPoints; } /***********************************************************************/ diff --git a/test_problems/surfSolverTest/surfaceSolver.cpp b/test_problems/surfSolverTest/surfaceSolver.cpp index 35b3bee32..189daf054 100644 --- a/test_problems/surfSolverTest/surfaceSolver.cpp +++ b/test_problems/surfSolverTest/surfaceSolver.cpp @@ -55,7 +55,7 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do double p = gasTP->pressure(); oooo << "Gas Temperature = " << Temp << endl; oooo << "Gas Pressure = " << p << endl; - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 0); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 0); oooo << "Gas Phase: " << gasPhaseName << " " << "(" << kstart << ")" << endl; oooo << " Name " @@ -63,11 +63,11 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do oooo << " " << " (kmol/m^3) (kmol/m^2/s) " << endl; double sum = 0.0; - int nspGas = gasTP->nSpecies(); - for (int k = 0; k < nspGas; k++) { + size_t nspGas = gasTP->nSpecies(); + for (size_t k = 0; k < nspGas; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(k, 0); sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n", - k, gasTP->speciesName(k).c_str(), + (int) k, gasTP->speciesName(k).c_str(), C[k], x[k], src[kstart]); oooo << buf; sum += x[k]; @@ -86,7 +86,7 @@ void printBulk(ostream& oooo, string bulkParticlePhaseName = bulkPhaseTP->id(); bulkPhaseTP->getMoleFractions(x); bulkPhaseTP->getConcentrations(C); - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 1); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 1); double dens = bulkPhaseTP->density(); oooo << "Bulk Phase: " << bulkParticlePhaseName << " " << "(" << kstart << ")" << endl; @@ -101,11 +101,11 @@ void printBulk(ostream& oooo, double sum = 0.0; double Wsum = 0.0; const vector_fp& molecW = bulkPhaseTP->molecularWeights(); - int nspBulk = bulkPhaseTP->nSpecies(); - for (int k = 0; k < nspBulk; k++) { + size_t nspBulk = bulkPhaseTP->nSpecies(); + for (size_t k = 0; k < nspBulk; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(k, 1); sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n", - k, bulkPhaseTP->speciesName(k).c_str(), + (int) k, bulkPhaseTP->speciesName(k).c_str(), C[k], x[k], src[kstart]); oooo << buf; sum += x[k]; @@ -131,7 +131,7 @@ void printSurf(ostream& oooo, char buf[256]; string surfParticlePhaseName = surfPhaseTP->id(); surfPhaseTP->getMoleFractions(x); - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); oooo << "Surface Phase: " << surfParticlePhaseName << " (" << kstart << ")" << endl; double Temp = surfPhaseTP->temperature(); @@ -141,15 +141,15 @@ void printSurf(ostream& oooo, oooo << " Name " << " Coverage SrcRate " << endl; double sum = 0.0; - int nspSurf = surfPhaseTP->nSpecies(); - for (int k = 0; k < nspSurf; k++) { + size_t nspSurf = surfPhaseTP->nSpecies(); + for (size_t k = 0; k < nspSurf; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); double srcK = src[kstart]; if (fabs(srcK) < 1.0E-7) { srcK = 0.0; } sprintf(buf, "%4d %24s %14.3g %14.3e\n", - k, surfPhaseTP->speciesName(k).c_str(), + (int) k, surfPhaseTP->speciesName(k).c_str(), x[k], srcK); oooo << buf; sum += x[k]; @@ -236,7 +236,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* gasTP = newPhase(*xg); - int nspGas = gasTP->nSpecies(); + size_t nspGas = gasTP->nSpecies(); cout << "Number of species = " << nspGas << endl; XML_Node* const xd = @@ -247,7 +247,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* bulkPhaseTP = newPhase(*xd); - int nspBulk = bulkPhaseTP->nSpecies(); + size_t nspBulk = bulkPhaseTP->nSpecies(); cout << "Number of species in bulk phase named " << bulkParticlePhaseName << " = " << nspBulk << endl; @@ -260,7 +260,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* surfPhaseTP = newPhase(*xs); - int nsp_d100 = surfPhaseTP->nSpecies(); + size_t nsp_d100 = surfPhaseTP->nSpecies(); cout << "Number of species in surface phase, " << surfParticlePhaseName << " = " << nsp_d100 << endl; @@ -271,7 +271,7 @@ int main(int argc, char** argv) InterfaceKinetics* iKin_ptr = new InterfaceKinetics(); importKinetics(*xs, phaseList, iKin_ptr); - int nr = iKin_ptr->nReactions(); + size_t nr = iKin_ptr->nReactions(); cout << "Number of reactions = " << nr << endl; double x[MSSIZE], p = OneAtm; @@ -301,12 +301,12 @@ int main(int argc, char** argv) x[i] = 0.0; } if (ProblemNumber == 0) { - int i0 = surfPhaseTP->speciesIndex("c6H*"); - if (i0 >= 0) { + size_t i0 = surfPhaseTP->speciesIndex("c6H*"); + if (i0 != npos) { x[i0] = 0.1; } - int i1 = surfPhaseTP->speciesIndex("c6HH"); - if (i1 >= 0) { + size_t i1 = surfPhaseTP->speciesIndex("c6HH"); + if (i1 != npos) { x[i1] = 0.9; } surfPhaseTP->setState_TX(1200., x); diff --git a/test_problems/surfSolverTest/surfaceSolver2.cpp b/test_problems/surfSolverTest/surfaceSolver2.cpp index 82f6c39cf..fea138de9 100644 --- a/test_problems/surfSolverTest/surfaceSolver2.cpp +++ b/test_problems/surfSolverTest/surfaceSolver2.cpp @@ -53,7 +53,7 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do double p = gasTP->pressure(); oooo << "Gas Temperature = " << Temp << endl; oooo << "Gas Pressure = " << p << endl; - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 0); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 0); oooo << "Gas Phase: " << gasPhaseName << " " << "(" << kstart << ")" << endl; oooo << " Name " @@ -61,11 +61,11 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do oooo << " " << " (kmol/m^3) (kmol/m^2/s) " << endl; double sum = 0.0; - int nspGas = gasTP->nSpecies(); - for (int k = 0; k < nspGas; k++) { + size_t nspGas = gasTP->nSpecies(); + for (size_t k = 0; k < nspGas; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(k, 0); sprintf(buf, "%4d %24s %14g %14g %14e\n", - k, gasTP->speciesName(k).c_str(), + (int) k, gasTP->speciesName(k).c_str(), C[k], x[k], src[kstart]); oooo << buf; sum += x[k]; @@ -85,7 +85,7 @@ void printBulk(ostream& oooo,ThermoPhase* bulkPhaseTP, InterfaceKinetics* iKin_p string bulkParticlePhaseName = bulkPhaseTP->id(); bulkPhaseTP->getMoleFractions(x); bulkPhaseTP->getConcentrations(C); - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 1); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 1); double dens = bulkPhaseTP->density(); oooo << "Bulk Phase: " << bulkParticlePhaseName << " " << "(" << kstart << ")" << endl; @@ -100,11 +100,11 @@ void printBulk(ostream& oooo,ThermoPhase* bulkPhaseTP, InterfaceKinetics* iKin_p double sum = 0.0; double Wsum = 0.0; const vector_fp& molecW = bulkPhaseTP->molecularWeights(); - int nspBulk = bulkPhaseTP->nSpecies(); - for (int k = 0; k < nspBulk; k++) { + size_t nspBulk = bulkPhaseTP->nSpecies(); + for (size_t k = 0; k < nspBulk; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(k, 1); sprintf(buf, "%4d %24s %14g %14g %14e\n", - k, bulkPhaseTP->speciesName(k).c_str(), + (int) k, bulkPhaseTP->speciesName(k).c_str(), C[k], x[k], src[kstart]); oooo << buf; sum += x[k]; @@ -130,7 +130,7 @@ void printSurf(ostream& oooo, ThermoPhase* surfPhaseTP, oooo.precision(3); string surfParticlePhaseName = surfPhaseTP->id(); surfPhaseTP->getMoleFractions(x); - int kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); + size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); oooo << "Surface Phase: " << surfParticlePhaseName << " (" << kstart << ")" << endl; double Temp = surfPhaseTP->temperature(); @@ -140,15 +140,15 @@ void printSurf(ostream& oooo, ThermoPhase* surfPhaseTP, oooo << " Name " << " Coverage SrcRate " << endl; double sum = 0.0; - int nspSurf = surfPhaseTP->nSpecies(); - for (int k = 0; k < nspSurf; k++) { + size_t nspSurf = surfPhaseTP->nSpecies(); + for (size_t k = 0; k < nspSurf; k++) { kstart = iKin_ptr->kineticsSpeciesIndex(0, 2); double srcK = src[kstart]; if (fabs(srcK) < 1.0E-8) { srcK = 0.0; } sprintf(buf, "%4d %24s %14g %14e\n", - k, surfPhaseTP->speciesName(k).c_str(), + (int) k, surfPhaseTP->speciesName(k).c_str(), x[k], srcK); oooo << buf; sum += x[k]; @@ -232,7 +232,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* gasTP = newPhase(*xg); - int nspGas = gasTP->nSpecies(); + size_t nspGas = gasTP->nSpecies(); cout << "Number of species = " << nspGas << endl; XML_Node* const xd = @@ -243,7 +243,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* bulkPhaseTP = newPhase(*xd); - int nspBulk = bulkPhaseTP->nSpecies(); + size_t nspBulk = bulkPhaseTP->nSpecies(); cout << "Number of species in bulk phase named " << bulkParticlePhaseName << " = " << nspBulk << endl; @@ -257,7 +257,7 @@ int main(int argc, char** argv) exit(-1); } ThermoPhase* surfPhaseTP = newPhase(*xs); - int nsp_d100 = surfPhaseTP->nSpecies(); + size_t nsp_d100 = surfPhaseTP->nSpecies(); cout << "Number of species in surface phase, " << surfParticlePhaseName << " = " << nsp_d100 << endl; @@ -270,7 +270,7 @@ int main(int argc, char** argv) InterfaceKinetics* iKin_ptr = new InterfaceKinetics(); importKinetics(*xs, phaseList, iKin_ptr); - int nr = iKin_ptr->nReactions(); + size_t nr = iKin_ptr->nReactions(); cout << "Number of reactions = " << nr << endl; ofstream ofile("results2.txt"); @@ -279,7 +279,7 @@ int main(int argc, char** argv) // create a second copy of the same surface phase // (this is a made up problem btw to check the software capability) ThermoPhase* surfPhaseTP2 = newPhase(*xs); - int nsp2 = surfPhaseTP2->nSpecies(); + size_t nsp2 = surfPhaseTP2->nSpecies(); string pname = surfPhaseTP2->id(); cout << "Number of species in 2nd surface phase, " << pname << " = " << nsp2 << endl; @@ -322,12 +322,12 @@ int main(int argc, char** argv) x[i] = 0.0; } if (ProblemNumber == 0) { - int i0 = surfPhaseTP->speciesIndex("c6H*"); - if (i0 >= 0) { + size_t i0 = surfPhaseTP->speciesIndex("c6H*"); + if (i0 != npos) { x[i0] = 0.1; } - int i1 = surfPhaseTP->speciesIndex("c6HH"); - if (i1 >= 0) { + size_t i1 = surfPhaseTP->speciesIndex("c6HH"); + if (i1 != npos) { x[i1] = 0.9; } surfPhaseTP->setState_TX(1200., x);