Skip to content

Commit

Permalink
[Test/ck2cti] Test pdep reactions with custom units
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Feb 21, 2017
1 parent 7b7aea2 commit a02753a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def test_reaction_comments1(self):
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'),
Expand Down
14 changes: 7 additions & 7 deletions test/data/pdep-test.cti
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down
20 changes: 11 additions & 9 deletions test/data/pdep-test.inp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/data/pdep-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,37 +428,37 @@
<Arrhenius>
<A>2.440000E+07</A>
<b>1.04</b>
<E units="cal/mol">3980.000000</E>
<E units="kcal/mol">3.980000000</E>
<P units="atm">0.0013157889999999999</P>
</Arrhenius>
<Arrhenius>
<A>3.890000E+07</A>
<b>0.98899999999999999</b>
<E units="cal/mol">4114.000000</E>
<E units="kcal/mol">4.114000000</E>
<P units="atm">0.039473684000000002</P>
</Arrhenius>
<Arrhenius>
<A>3.460000E+09</A>
<b>0.442</b>
<E units="cal/mol">5463.000000</E>
<E units="kcal/mol">5.463000000</E>
<P units="atm">1.0</P>
</Arrhenius>
<Arrhenius>
<A>1.720000E+11</A>
<b>-0.01</b>
<E units="cal/mol">7134.000000</E>
<E units="kcal/mol">7.134000000</E>
<P units="atm">10.0</P>
</Arrhenius>
<Arrhenius>
<A>-7.410000E+27</A>
<b>-5.54</b>
<E units="cal/mol">12108.000000</E>
<E units="kcal/mol">12.108000000</E>
<P units="atm">100.0</P>
</Arrhenius>
<Arrhenius>
<A>1.900000E+12</A>
<b>-0.28999999999999998</b>
<E units="cal/mol">8306.000000</E>
<E units="kcal/mol">8.306000000</E>
<P units="atm">100.0</P>
</Arrhenius>
</rateCoeff>
Expand All @@ -471,7 +471,7 @@
<equation>H + R4 [=] H + P4</equation>
<rateCoeff>
<Arrhenius>
<A>1.740000E+04</A>
<A units="cm3/molec/s">2.889338e-17</A>
<b>1.98</b>
<E units="cal/mol">4521.000000</E>
<P units="atm">10.0</P>
Expand Down
4 changes: 2 additions & 2 deletions test/kinetics/pdep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit a02753a

Please sign in to comment.