//! iRef is the index of the corresponding reaction in the reference mech void check_rates(int iRef) { ASSERT_EQ((size_t) 1, kin.nReactions()); std::string X = "O:0.02 H2:0.2 O2:0.5 H:0.03 OH:0.05 H2O:0.1 HO2:0.01"; p.setState_TPX(1200, 5*OneAtm, X); p_ref.setState_TPX(1200, 5*OneAtm, X); vector_fp k(1), k_ref(kin_ref.nReactions()); kin.getFwdRateConstants(&k[0]); kin_ref.getFwdRateConstants(&k_ref[0]); EXPECT_DOUBLE_EQ(k_ref[iRef], k[0]); kin.getRevRateConstants(&k[0]); kin_ref.getRevRateConstants(&k_ref[0]); EXPECT_DOUBLE_EQ(k_ref[iRef], k[0]); }
void check_rates(size_t N, const std::string& X) { for (size_t i = 0; i < kin_ref.nReactions(); i++) { if (i >= N) { kin_ref.setMultiplier(i, 0); } else { kin_ref.setMultiplier(i, 1); } } p.setState_TPX(1200, 5*OneAtm, X); p_ref.setState_TPX(1200, 5*OneAtm, X); vector_fp k(kin.nReactions()), k_ref(kin_ref.nReactions()); vector_fp w(kin.nTotalSpecies()), w_ref(kin_ref.nTotalSpecies()); kin.getFwdRateConstants(k.data()); kin_ref.getFwdRateConstants(k_ref.data()); for (size_t i = 0; i < kin.nReactions(); i++) { EXPECT_DOUBLE_EQ(k_ref[i], k[i]) << "i = " << i << "; N = " << N; } kin.getFwdRatesOfProgress(k.data()); kin_ref.getFwdRatesOfProgress(k_ref.data()); for (size_t i = 0; i < kin.nReactions(); i++) { EXPECT_DOUBLE_EQ(k_ref[i], k[i]) << "i = " << i << "; N = " << N; } kin.getRevRateConstants(k.data()); kin_ref.getRevRateConstants(k_ref.data()); for (size_t i = 0; i < kin.nReactions(); i++) { EXPECT_DOUBLE_EQ(k_ref[i], k[i]) << "i = " << i << "; N = " << N; } kin.getRevRatesOfProgress(k.data()); kin_ref.getRevRatesOfProgress(k_ref.data()); for (size_t i = 0; i < kin.nReactions(); i++) { EXPECT_DOUBLE_EQ(k_ref[i], k[i]) << "i = " << i << "; N = " << N; } kin.getCreationRates(w.data()); kin_ref.getCreationRates(w_ref.data()); for (size_t i = 0; i < kin.nTotalSpecies(); i++) { size_t iref = p_ref.speciesIndex(p.speciesName(i)); EXPECT_DOUBLE_EQ(w_ref[iref], w[i]) << "sp = " << p.speciesName(i) << "; N = " << N; } }
//! iRef is the index of the corresponding reaction in the reference mech void check_rates(int iRef) { ASSERT_EQ((size_t) 1, kin.nReactions()); std::string X = "H2:0.2 O2:0.5 H2O:0.1 N2:0.2"; std::string Xs = "H(m):0.1 O(m):0.2 OH(m):0.3 (m):0.4"; gas.setState_TPX(1200, 5*OneAtm, X); gas_ref.setState_TPX(1200, 5*OneAtm, X); surf.setState_TP(1200, 5*OneAtm); surf_ref.setState_TP(1200, 5*OneAtm); surf.setCoveragesByName(Xs); surf_ref.setCoveragesByName(Xs); vector_fp k(1), k_ref(kin_ref.nReactions()); kin.getFwdRateConstants(&k[0]); kin_ref.getFwdRateConstants(&k_ref[0]); EXPECT_DOUBLE_EQ(k_ref[iRef], k[0]); kin.getRevRateConstants(&k[0]); kin_ref.getRevRateConstants(&k_ref[0]); EXPECT_DOUBLE_EQ(k_ref[iRef], k[0]); }