Fixed handling of rate coefficient units in ck2cti.py
Units specified on the REACTIONS line were not being handled correctly, causing the units(...) directive of the resulting .cti file to always have the default units of 'cal/mol' and 'mol', but without correcting the values.
This commit is contained in:
parent
16462628a7
commit
b26f9f4ee2
1 changed files with 11 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ UNIT_OPTIONS = {'CAL/': 'cal/mol',
|
|||
'MOLEC': 'molec',
|
||||
'MOLECULES': 'molec'}
|
||||
|
||||
PROCESSED_UNITS = False
|
||||
ENERGY_UNITS = 'cal/mol'
|
||||
QUANTITY_UNITS = 'mol'
|
||||
|
||||
|
|
@ -1220,8 +1221,16 @@ def loadChemkinFile(path, speciesList=None):
|
|||
except IndexError:
|
||||
pass
|
||||
|
||||
ENERGY_UNITS = UNIT_OPTIONS[energyUnits]
|
||||
QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits]
|
||||
global PROCESSED_UNITS, ENERGY_UNITS, UNIT_OPTIONS
|
||||
if not PROCESSED_UNITS:
|
||||
PROCESSED_UNITS = True
|
||||
ENERGY_UNITS = UNIT_OPTIONS[energyUnits]
|
||||
QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits]
|
||||
else:
|
||||
if (ENERGY_UNITS != UNIT_OPTIONS[energyUnits] or
|
||||
QUANTITY_UNITS != UNIT_OPTIONS[moleculeUnits]):
|
||||
raise InputParseError("Multiple REACTIONS sections with "
|
||||
"different units are not supported.")
|
||||
|
||||
kineticsList = []
|
||||
commentsList = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue