From a02753ae792a71b4eda2028d4ea73d054ad5a4b4 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 20 Feb 2017 19:04:08 -0500 Subject: [PATCH] [Test/ck2cti] Test pdep reactions with custom units --- .../cython/cantera/test/test_convert.py | 2 +- test/data/pdep-test.cti | 14 ++++++------- test/data/pdep-test.inp | 20 ++++++++++--------- test/data/pdep-test.xml | 14 ++++++------- test/kinetics/pdep.cpp | 4 ++-- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index ec2c43097..8c0a4f17e 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -364,7 +364,7 @@ class chemkinConverterTest(utilities.CanteraTest): text = f.read() self.assertIn('Generic mechanism header', text) self.assertIn('Single PLOG reaction', text) - self.assertIn('PLOG with duplicate rates and negative A-factors', text) + self.assertIn('Multiple PLOG expressions at the same pressure', text) def test_reaction_comments2(self): convertMech(pjoin(self.test_data_dir, 'explicit-third-bodies.inp'), diff --git a/test/data/pdep-test.cti b/test/data/pdep-test.cti index 780448f99..0233a9b20 100644 --- a/test/data/pdep-test.cti +++ b/test/data/pdep-test.cti @@ -235,16 +235,16 @@ pdep_arrhenius('H + R2 <=> P2A + P2B', # Reaction 3 pdep_arrhenius('H + R3 <=> P3A + P3B', - [(0.001315789, 'atm'), 2.440000e+10, 1.04, 3980.0], - [(0.039473684, 'atm'), 3.890000e+10, 0.989, 4114.0], - [(1.0, 'atm'), 3.460000e+12, 0.442, 5463.0], - [(10.0, 'atm'), 1.720000e+14, -0.01, 7134.0], - [(100.0, 'atm'), -7.410000e+30, -5.54, 12108.0], - [(100.0, 'atm'), 1.900000e+15, -0.29, 8306.0]) + [(0.001315789, 'atm'), 2.440000e+10, 1.04, (3.98, 'kcal/mol')], + [(0.039473684, 'atm'), 3.890000e+10, 0.989, (4.114, 'kcal/mol')], + [(1.0, 'atm'), 3.460000e+12, 0.442, (5.463, 'kcal/mol')], + [(10.0, 'atm'), 1.720000e+14, -0.01, (7.134, 'kcal/mol')], + [(100.0, 'atm'), -7.410000e+30, -5.54, (12.108, 'kcal/mol')], + [(100.0, 'atm'), 1.900000e+15, -0.29, (8.306, 'kcal/mol')]) # Reaction 4 pdep_arrhenius('H + R4 <=> H + P4', - [(10.0, 'atm'), 1.740000e+07, 1.98, 4521.0]) + [(10.0, 'atm'), (2.889338e-17, 'cm3/molec/s'), 1.98, 4521.0]) # Reaction 5 chebyshev_reaction('R5 + H (+ M) <=> P5A + P5B (+M)', diff --git a/test/data/pdep-test.inp b/test/data/pdep-test.inp index 651d98362..f6d19b0ca 100644 --- a/test/data/pdep-test.inp +++ b/test/data/pdep-test.inp @@ -116,18 +116,20 @@ PLOG / 10 3.31E+08 1.14 8886 / PLOG / 100 1.37e+17 -0.79 17603 / PLOG / 100 1.28E+06 1.71 9774 / -! PLOG with duplicate rates and negative A-factors +! PLOG with duplicate rates, negative A-factors, and custom energy units H+R3=P3A+P3B 1.0 0.0 0.0 -plog / 0.001315789 2.44E+10 1.04 3980 / -plog / 0.039473684 3.89E+10 0.989 4114 / -plog / 1 3.46E+12 0.442 5463 / -plog / 10 1.72E+14 -0.01 7134 / -plog / 100 -7.41E+30 -5.54 12108 / -plog / 100 1.90E+15 -0.29 8306 / +plog / 0.001315789 2.44E+10 1.04 3.980 / +plog / 0.039473684 3.89E+10 0.989 4.114 / +plog / 1 3.46E+12 0.442 5.463 / +plog / 10 1.72E+14 -0.01 7.134 / +plog / 100 -7.41E+30 -5.54 12.108 / +plog / 100 1.90E+15 -0.29 8.306 / +units / kcal/ -! Degenerate PLOG with a single rate expression +! Degenerate PLOG with a single rate expression and custom quantity units H+R4=H+P4 1.0 0.0 0.0 -PLOG / 10 1.74e+07 1.98 4521 / +PLOG / 10 2.889338e-17 1.98 4521 / +units/ molec / ! Bimolecular CHEB R5+H(+m)=P5A+P5B(+m) 1.0E0 0.0 0.0 diff --git a/test/data/pdep-test.xml b/test/data/pdep-test.xml index 62f0827f1..a113993a2 100644 --- a/test/data/pdep-test.xml +++ b/test/data/pdep-test.xml @@ -428,37 +428,37 @@ 2.440000E+07 1.04 - 3980.000000 + 3.980000000

0.0013157889999999999

3.890000E+07 0.98899999999999999 - 4114.000000 + 4.114000000

0.039473684000000002

3.460000E+09 0.442 - 5463.000000 + 5.463000000

1.0

1.720000E+11 -0.01 - 7134.000000 + 7.134000000

10.0

-7.410000E+27 -5.54 - 12108.000000 + 12.108000000

100.0

1.900000E+12 -0.28999999999999998 - 8306.000000 + 8.306000000

100.0

@@ -471,7 +471,7 @@ H + R4 [=] H + P4 - 1.740000E+04 + 2.889338e-17 1.98 4521.000000

10.0

diff --git a/test/kinetics/pdep.cpp b/test/kinetics/pdep.cpp index b14940b9c..c813a1fb9 100644 --- a/test/kinetics/pdep.cpp +++ b/test/kinetics/pdep.cpp @@ -72,7 +72,7 @@ TEST_F(PdepTest, PlogLowPressure) double kf0 = k(1.212400e+13, -0.5779, 10872.7); double kf1 = k(1.230000e+05, 1.53, 4737.0); double kf2 = k(2.440000e+7, 1.04, 3980.0); - double kf3 = k(1.740000e+04, 1.98, 4521.0); + double kf3 = k(2.889338e-17*(Avogadro/1e6), 1.98, 4521.0); EXPECT_NEAR(kf0, kf[0], 1e-9 * kf0); EXPECT_NEAR(kf1, kf[1], 1e-9 * kf1); @@ -90,7 +90,7 @@ TEST_F(PdepTest, PlogHighPressure) // Pre-exponential factor decreases by 10^3 for second-order reaction // when converting from cm + mol to m + kmol double kf0 = k(5.963200e+53, -11.529, 52599.6); - double kf3 = k(1.740000e+04, 1.98, 4521.0); + double kf3 = k(2.889338e-17*(Avogadro/1e6), 1.98, 4521.0); EXPECT_NEAR(kf0, kf[0], 1e-9 * kf0); EXPECT_NEAR(kf3, kf[3], 1e-9 * kf3);