From 7a327abb164b93afe2966e5815c541de8853e1ce Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 17 Aug 2012 16:42:53 +0000 Subject: [PATCH] Added test for handling of explicit reverse rate constants in Chemkin input files --- test/data/explicit-reverse-rate.inp | 15 ++++ test/data/explicit-reverse-rate.xml | 120 ++++++++++++++++++++++++++++ test/python/testConvert.py | 20 +++++ 3 files changed, 155 insertions(+) create mode 100644 test/data/explicit-reverse-rate.inp create mode 100644 test/data/explicit-reverse-rate.xml diff --git a/test/data/explicit-reverse-rate.inp b/test/data/explicit-reverse-rate.inp new file mode 100644 index 000000000..820b29a3c --- /dev/null +++ b/test/data/explicit-reverse-rate.inp @@ -0,0 +1,15 @@ +ELEMENTS +H C +END + +SPECIES +H +R1A R1B P1 +END + +REACTIONS + +R1A+R1B <=> P1+H 1.0e19 0.0 5000.0 + REV/3.9000e12 1.0 6500.0/ + +END diff --git a/test/data/explicit-reverse-rate.xml b/test/data/explicit-reverse-rate.xml new file mode 100644 index 000000000..d6928a961 --- /dev/null +++ b/test/data/explicit-reverse-rate.xml @@ -0,0 +1,120 @@ + + + + + + + H C + H R1A R1B P1 + + + 300.0 + 101325.0 + + + + + + + + + + + + H:1 + + + + 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, + 4.981973570E-22, 2.547365990E+04, -4.466829140E-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 + + + + + + + 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 + + + + + + + + + R1A + R1B =] P1 + H + + + 1.000000E+16 + 0.0 + 5000.000000 + + + R1B:1 R1A:1.0 + H:1 P1:1.0 + + + + + P1 + H =] R1A + R1B + + + 3.900000E+09 + 1.0 + 6500.000000 + + + H:1 P1:1.0 + R1B:1 R1A:1.0 + + + diff --git a/test/python/testConvert.py b/test/python/testConvert.py index cee6e5412..1c3486473 100644 --- a/test/python/testConvert.py +++ b/test/python/testConvert.py @@ -123,3 +123,23 @@ class chemkinConverterTest(utilities.CanteraTest): ref, gas = self.checkConversion('../data/sri-falloff.xml', 'sri-falloff.cti') self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6]) + + def test_explicit_reverse_rate(self): + if os.path.exists('explicit-reverse-rate.cti'): + os.remove('explicit-reverse-rate.cti') + ck2cti.convertMech('../data/explicit-reverse-rate.inp', + thermoFile='../data/dummy-thermo.dat', + outName='explicit-reverse-rate.cti', quiet=True) + ref, gas = self.checkConversion('../data/explicit-reverse-rate.xml', + 'explicit-reverse-rate.cti') + 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. + Rr = gas.revRateConstants() + self.assertEqual(Rr[0], 0.0) + self.assertEqual(Rr[1], 0.0) + Rstoich = gas.reactantStoichCoeffs() + Pstoich = gas.productStoichCoeffs() + self.assertEqual(list(Rstoich[:,0]), list(Pstoich[:,1])) + self.assertEqual(list(Rstoich[:,1]), list(Pstoich[:,0]))