diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index 10ef0c770..a5953ef44 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -232,14 +232,22 @@ class chemkinConverterTest(utilities.CanteraTest): self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6]) # Reactions with explicit reverse rate constants are transformed into - # two irreversible reactions with reactants and products swapped. + # two irreversible reactions with reactants and products swapped, unless + # the explicit reverse rate is zero so only the forward reaction is used. Rr = gas.reverse_rate_constants self.assertEqual(Rr[0], 0.0) self.assertEqual(Rr[1], 0.0) + self.assertEqual(Rr[2], 0.0) + self.assertEqual(Rr[3], 0.0) + self.assertEqual(Rr[4], 0.0) Rstoich = gas.reactant_stoich_coeffs() Pstoich = gas.product_stoich_coeffs() - self.assertEqual(list(Rstoich[:,0]), list(Pstoich[:,1])) - self.assertEqual(list(Rstoich[:,1]), list(Pstoich[:,0])) + self.assertEqual(list(Rstoich[:, 0]), list(Pstoich[:, 1])) + self.assertEqual(list(Rstoich[:, 1]), list(Pstoich[:, 0])) + self.assertEqual(list(Rstoich[:, 2]), list(Pstoich[:, 3])) + self.assertEqual(list(Rstoich[:, 3]), list(Pstoich[:, 2])) + + self.assertEqual(gas.n_reactions, 5) def test_explicit_forward_order(self): convertMech(pjoin(self.test_data_dir, 'explicit-forward-order.inp'), diff --git a/test/data/explicit-reverse-rate.inp b/test/data/explicit-reverse-rate.inp index 3202b9c93..e4fc22bf3 100644 --- a/test/data/explicit-reverse-rate.inp +++ b/test/data/explicit-reverse-rate.inp @@ -4,7 +4,7 @@ END SPECIES H -R1A R1B P1 +R1A R1B P1 R3 P3A P3B END REACTIONS @@ -15,4 +15,7 @@ R1A+R1B <=> P1+H 1.0e19 0.0 5000.0 R1A+R1B+M <=> P1+H+M 1.0e-2 0.0 5000.0 REV/3.9000e12 1.0 6500.0/ +R3+H <=> P3A+P3B 1.0e19 0.0 5000.0 + REV/0.0000e00 0.0 0.0000/ + END diff --git a/test/data/explicit-reverse-rate.xml b/test/data/explicit-reverse-rate.xml index 3370fdf8c..60f33b1b1 100644 --- a/test/data/explicit-reverse-rate.xml +++ b/test/data/explicit-reverse-rate.xml @@ -5,7 +5,7 @@ H C - H R1A R1B P1 + H R1A R1B P1 R3 P3A P3B 300.0 @@ -25,12 +25,12 @@ - 2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18, + 2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18, -9.277323320E-22, 2.547365990E+04, -4.466828530E-01 - 2.500000010E+00, -2.308429730E-11, 1.615619480E-14, -4.735152350E-18, + 2.500000010E+00, -2.308429730E-11, 1.615619480E-14, -4.735152350E-18, 4.981973570E-22, 2.547365990E+04, -4.466829140E-01 @@ -42,12 +42,12 @@ - 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 - 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 @@ -59,12 +59,12 @@ - 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 - 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 @@ -76,19 +76,70 @@ - 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 - 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 - - + + + H:7 C:2 + + + + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 + + + + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 + + + + + + + H:4 C:1 + + + + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 + + + + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 + + + + + + + H:4 C:1 + + + + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 + + + + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 + + + + + + R1A + R1B =] P1 + H @@ -144,6 +195,20 @@ H:1 P1:1.0 R1B:1 R1A:1.0 - + + + + R3 + H =] P3A + P3B + + + 1.000000E+16 + 0.0 + 5000.000000 + + + R3:1 H:1.0 + P3A:1 P3B:1.0 + +