Looking for some help converting San Diego DME mechanism from Chemkin format to Cantera

208 views
Skip to first unread message

Shah Saud Alam

unread,
Feb 13, 2022, 2:47:50 PM2/13/22
to Cantera Users' Group
Hello,

I am trying to convert the DME mechanism (attached) from Chemkin format to Cantera (YAML) format. However, when I run the cantera.ck2yaml command in Windows Command Prompt, I get the following error:

C:\Users\SHAHSAUD\Desktop\DME>python -m cantera.ck2yaml --input=sandiegoDMEreactions.inp --thermo=sandiegoDMEthermo.dat --transport=sandiegoDMEtransport.dat --output=sandiegoDMEcantera.yaml
Error reading reaction starting on line 7:
"""
CH3OCH3(+M)=CH3O+CH3(+M)             2.330E+19   -0.66     84139.0
    LOW     /1.72E+59  -11.40  93295.6/
    TROE   /1.0   1.0E-30   880./
    H2/3.0/ H2O/9.0/ CH4/3.0/ CO/2.25/ CO2/3.0/ C2H6/4.5/ AR/1.0/ N2/1.50/ CH3OCH3/5/
"""

ERROR: Unable to parse 'sandiegoDMEreactions.inp' near line 7:
Unexpected token "CH3O+CH3" in reaction expression "CH3OCH3(+M)=CH3O+CH3(+M)
".
Please check https://cantera.org/tutorials/ck2yaml-tutorial.html#debugging-common-errors-in-ck-files
for the correct Chemkin syntax.

Traceback (most recent call last):
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 1055, in read_kinetics_entry
    locs[j] = int(token), 'coeff'
ValueError: invalid literal for int() with base 10: 'CH3O+CH3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 1058, in read_kinetics_entry
    locs[j] = float(token), 'coeff'
ValueError: could not convert string to float: 'CH3O+CH3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 2226, in <module>
    main(sys.argv[1:])
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 2187, in main
    parser, surfaces = Parser.convert_mech(input_file, thermo_file,
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 2023, in convert_mech
    parser.load_chemkin_file(input_file)
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 1776, in load_chemkin_file
    reaction, revReaction = self.read_kinetics_entry(kinetics, surface)
  File "C:\Users\SHAHSAUD\AppData\Local\Programs\Python\Python38\lib\site-packages\cantera\ck2yaml.py", line 1060, in read_kinetics_entry
    raise InputError('Unexpected token "{}" in reaction expression "{}".',
__main__.InputError: Unexpected token "CH3O+CH3" in reaction expression "CH3OCH3(+M)=CH3O+CH3(+M)
".
Please check https://cantera.org/tutorials/ck2yaml-tutorial.html#debugging-common-errors-in-ck-files
for the correct Chemkin syntax.


All help is appreciated.

Thanks in advance!

-Saud

sandiegoDMEthermo.dat
sandiegoDMEreactions.inp
sandiegoDMEtransport.dat

Shah Saud Alam

unread,
Feb 13, 2022, 4:18:00 PM2/13/22
to Cantera Users' Group
I got it to work. The problem was that Chemkin reaction mechanism files MUST have the ELEMENTS and SPECIES declared before the reactions. However, the San Diego mechanisms available from https://web.eng.ucsd.edu/mae/groups/combustion/mechanism.html have a parent mechanism (which they call "The San Diego Mechanism") whereas the rest are children and are supposed to be appended to the parent before converting to Cantera (or other formats).

Therefore, I prepended the ELEMENTS and SPECIES to the DME mechanism and ck2yaml stopped throwing errors instantly.

I hope this is helpful to others in the future.

Thanks!

Reply all
Reply to author
Forward
0 new messages