Added test for handling of explicit reverse rate constants in Chemkin input files
This commit is contained in:
parent
eb9441182d
commit
7a327abb16
3 changed files with 155 additions and 0 deletions
15
test/data/explicit-reverse-rate.inp
Normal file
15
test/data/explicit-reverse-rate.inp
Normal file
|
|
@ -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
|
||||
120
test/data/explicit-reverse-rate.xml
Normal file
120
test/data/explicit-reverse-rate.xml
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0"?>
|
||||
<ctml>
|
||||
<validate reactions="yes" species="yes"/>
|
||||
|
||||
<!-- phase gas -->
|
||||
<phase dim="3" id="gas">
|
||||
<elementArray datasrc="elements.xml">H C</elementArray>
|
||||
<speciesArray datasrc="#species_data">H R1A R1B P1</speciesArray>
|
||||
<reactionArray datasrc="#reaction_data"/>
|
||||
<state>
|
||||
<temperature units="K">300.0</temperature>
|
||||
<pressure units="Pa">101325.0</pressure>
|
||||
</state>
|
||||
<thermo model="IdealGas"/>
|
||||
<kinetics model="GasKinetics"/>
|
||||
<transport model="None"/>
|
||||
</phase>
|
||||
|
||||
<!-- species definitions -->
|
||||
<speciesData id="species_data">
|
||||
|
||||
<!-- species H -->
|
||||
<species name="H">
|
||||
<atomArray>H:1 </atomArray>
|
||||
<thermo>
|
||||
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18,
|
||||
-9.277323320E-22, 2.547365990E+04, -4.466828530E-01</floatArray>
|
||||
</NASA>
|
||||
<NASA Tmax="3500.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
2.500000010E+00, -2.308429730E-11, 1.615619480E-14, -4.735152350E-18,
|
||||
4.981973570E-22, 2.547365990E+04, -4.466829140E-01</floatArray>
|
||||
</NASA>
|
||||
</thermo>
|
||||
</species>
|
||||
|
||||
<!-- species R1A -->
|
||||
<species name="R1A">
|
||||
<atomArray>H:4 C:1 </atomArray>
|
||||
<thermo>
|
||||
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08,
|
||||
1.666939560E-11, -1.024664760E+04, -4.641303760E+00</floatArray>
|
||||
</NASA>
|
||||
<NASA Tmax="3500.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09,
|
||||
-1.018152300E-13, -9.468344590E+03, 1.843731800E+01</floatArray>
|
||||
</NASA>
|
||||
</thermo>
|
||||
</species>
|
||||
|
||||
<!-- species R1B -->
|
||||
<species name="R1B">
|
||||
<atomArray>H:4 C:1 </atomArray>
|
||||
<thermo>
|
||||
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08,
|
||||
1.666939560E-11, -1.024664760E+04, -4.641303760E+00</floatArray>
|
||||
</NASA>
|
||||
<NASA Tmax="3500.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09,
|
||||
-1.018152300E-13, -9.468344590E+03, 1.843731800E+01</floatArray>
|
||||
</NASA>
|
||||
</thermo>
|
||||
</species>
|
||||
|
||||
<!-- species P1 -->
|
||||
<species name="P1">
|
||||
<atomArray>H:7 C:2 </atomArray>
|
||||
<thermo>
|
||||
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08,
|
||||
1.666939560E-11, -1.024664760E+04, -4.641303760E+00</floatArray>
|
||||
</NASA>
|
||||
<NASA Tmax="3500.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="7">
|
||||
7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09,
|
||||
-1.018152300E-13, -9.468344590E+03, 1.843731800E+01</floatArray>
|
||||
</NASA>
|
||||
</thermo>
|
||||
</species>
|
||||
</speciesData>
|
||||
<reactionData id="reaction_data">
|
||||
|
||||
<!-- reaction 0001 -->
|
||||
<reaction reversible="no" id="0001">
|
||||
<equation>R1A + R1B =] P1 + H</equation>
|
||||
<rateCoeff>
|
||||
<Arrhenius>
|
||||
<A>1.000000E+16</A>
|
||||
<b>0.0</b>
|
||||
<E units="cal/mol">5000.000000</E>
|
||||
</Arrhenius>
|
||||
</rateCoeff>
|
||||
<reactants>R1B:1 R1A:1.0</reactants>
|
||||
<products>H:1 P1:1.0</products>
|
||||
</reaction>
|
||||
|
||||
<!-- reaction 0002 -->
|
||||
<reaction reversible="no" id="0002">
|
||||
<equation>P1 + H =] R1A + R1B</equation>
|
||||
<rateCoeff>
|
||||
<Arrhenius>
|
||||
<A>3.900000E+09</A>
|
||||
<b>1.0</b>
|
||||
<E units="cal/mol">6500.000000</E>
|
||||
</Arrhenius>
|
||||
</rateCoeff>
|
||||
<reactants>H:1 P1:1.0</reactants>
|
||||
<products>R1B:1 R1A:1.0</products>
|
||||
</reaction>
|
||||
</reactionData>
|
||||
</ctml>
|
||||
|
|
@ -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]))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue