[ck2cti] Detect badly formatted values of 4th Troe coefficient
Fixes #499
This commit is contained in:
parent
70016b97b3
commit
bde6e05452
3 changed files with 20 additions and 4 deletions
|
|
@ -1390,10 +1390,7 @@ class Parser(object):
|
|||
alpha = float(tokens[0].strip())
|
||||
T3 = float(tokens[1].strip())
|
||||
T1 = float(tokens[2].strip())
|
||||
try:
|
||||
T2 = float(tokens[3].strip())
|
||||
except (IndexError, ValueError):
|
||||
T2 = None
|
||||
T2 = float(tokens[3].strip()) if len(tokens) > 3 else None
|
||||
|
||||
falloff = Troe(
|
||||
alpha=(alpha,''),
|
||||
|
|
|
|||
|
|
@ -278,6 +278,12 @@ class chemkinConverterTest(utilities.CanteraTest):
|
|||
'explicit-forward-order.cti')
|
||||
self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6])
|
||||
|
||||
def test_bad_troe_value(self):
|
||||
with self.assertRaises(ValueError):
|
||||
convertMech(pjoin(self.test_data_dir, 'bad-troe.inp'),
|
||||
thermoFile=pjoin(self.test_data_dir, 'dummy-thermo.dat'),
|
||||
outName=pjoin(self.test_work_dir, 'bad-troe.cti'), quiet=True)
|
||||
|
||||
def test_reaction_units(self):
|
||||
convertMech(pjoin(self.test_data_dir, 'units-default.inp'),
|
||||
thermoFile=pjoin(self.test_data_dir, 'dummy-thermo.dat'),
|
||||
|
|
|
|||
13
test/data/bad-troe.inp
Normal file
13
test/data/bad-troe.inp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
ELEMENTS
|
||||
H C
|
||||
END
|
||||
|
||||
SPECIES
|
||||
H R1A R1B P1
|
||||
END
|
||||
|
||||
REACTIONS
|
||||
R1A+R1B(+M) <=> H+P1(+M) 1e12 0.0 20000.0
|
||||
LOW / 1.040E+26 -2.760 1600.00/
|
||||
TROE/ .5620 91.00 5836.00 1.00000+100/
|
||||
END
|
||||
Loading…
Add table
Reference in a new issue