Problem in converting cti file

243 views
Skip to first unread message

Kyaw Si Thu

unread,
Nov 15, 2021, 8:43:44 AM11/15/21
to Cantera Users' Group
Hello, Everyone.
I'm trying to convert butanol isomers files from the link below:

I downloaded the files and convert them to cti files by using the following command in spyder:

from cantera import ck2cti
chempath = r'C:/Users/***/Desktop/N-Butanol/3.txt'
thermpath = r'C:/Users/***/Desktop/N-Butanol/therm.txt'
tranpath = r'C:/Users/***/Desktop/N-Butanol/tran.txt'
parser = ck2cti.Parser()
parser.convertMech(inputFile=chempath, thermoFile=thermpath,transportFile=tranpath)

Gives the following error:

runfile('C:/Users/***/Desktop/Chemkin to Cti Convert Files/untitled0.py', wdir='C:/Users/***/Desktop/Chemkin to Cti Convert Files')
INFO:root:Error reading reaction starting on line 170:
"""
h2o2(+m)<=>oh+oh(+m) 2.00e+12 0.90 4.8749+04
low/ 3.658e+24 -2.30 4.8749+04 /
troe/ 0.43 1e-30 1e+30/
ar/ 0.68/ o2/ 0.68/ h2/2.5/ co/ 1.9/ co2/ 3.8/ h2o/0.0/ he/0.0/ h2o2/5.2/ ch4/2/ c2h6/3/
"""
WARNING:root:
ERROR: Unable to parse 'C:/Users/***/Desktop/N-Butanol/3.txt' near line 170:
could not convert string to float: '4.8749+04'

Traceback (most recent call last):

  File "C:\Users\***\Desktop\Chemkin to Cti Convert Files\untitled0.py", line 14, in <module>
    parser.convertMech(inputFile=chempath, thermoFile=thermpath,transportFile=tranpath)

  File "C:\Users\***\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2229, in convertMech
    parser.loadChemkinFile(inputFile)

  File "C:\Users\***\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1897, in loadChemkinFile
    reaction, revReaction = self.readKineticsEntry(kinetics, surface)

  File "C:\Users\***\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1202, in readKineticsEntry
    Ea = float(tokens[-1])

ValueError: could not convert string to float: '4.8749+04'

I don't know why the errors are come out.I already used the same command to convert the n-Heptane reduced mechanism file from the following site before and succeeded.


Thanks in advance!
Kyaw




Bryan Weber

unread,
Nov 15, 2021, 8:55:53 AM11/15/21
to Cantera Users' Group
Hi,

You're missing an "E" in the number to indicate it should be exponential format. Please see here: https://cantera.org/tutorials/ck2yaml-tutorial.html#debugging-common-errors-in-ck-files for common debugging tips for Chemkin files, I doubt this will be the only error you find.

Best,
Bryan

Kyaw Si Thu

unread,
Nov 21, 2021, 6:05:08 PM11/21/21
to Cantera Users' Group
Hi Bryan
I'll try it.

Best,
Kyaw

Kyaw Si Thu

unread,
Nov 21, 2021, 9:31:49 PM11/21/21
to Cantera Users' Group
 Hi Bryan
I tried to replace '4.8749+04' with '4.8749E+04'. The files are below and 1 is the  Chemical kinetic mechanism file downloaded from https://combustion.llnl.gov/mechanisms/alcohols/butanol-isomers site and 1E all is the converted file.
Gives the following errors:

runfile('C:/Users/***/Desktop/Chemkin to Cti Convert Files/chemkin to cti file converting.py', wdir='C:/Users/ *** /Desktop/Chemkin to Cti Convert Files')
INFO:root: Error reading reaction starting on line 364:
"""
oh*<=>oh+hv                                  1.450e+06      0.0           0.0
"""
WARNING:root:
ERROR: Unable to parse 'C:/Users/ *** /Desktop/N-Butanol/1/1E all.txt' near line 364:
Found reversible reaction containing a product photon:
oh*<=>oh+hv                                  1.450e+06      0.0           0.0
If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.


Traceback (most recent call last):

  File "C:\Users\ *** \Desktop\Chemkin to Cti Convert Files\chemkin to cti file converting.py", line 7, in <module>

    parser.convertMech(inputFile=chempath, thermoFile=thermpath,transportFile=tranpath)

  File "C:\Users\ *** \.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2229, in convertMech
    parser.loadChemkinFile(inputFile)

  File "C:\Users\ *** \.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1897, in loadChemkinFile
    reaction, revReaction = self.readKineticsEntry(kinetics, surface)

  File "C:\Users\ *** \.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1289, in readKineticsEntry
    self.warn('Found reversible reaction containing a product photon:'

  File "C:\Users\ *** \.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 973, in warn
    raise InputParseError(message)

InputParseError: Found reversible reaction containing a product photon:
oh*<=>oh+hv                                  1.450e+06      0.0           0.0
If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.


Thanks in advance!
Kyaw
tran.txt
1.txt
therm.txt
1E all.txt

Bryan Weber

unread,
Nov 22, 2021, 11:09:25 AM11/22/21
to Cantera Users' Group
Hi Kyaw,

The error message is shown here:

InputParseError: Found reversible reaction containing a product photon:
oh*<=>oh+hv                                  1.450e+06      0.0           0.0
If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.

It is up to you how you want to handle this reaction. Cantera doesn't include photons in the energy equation, so you can either remove the reaction from the file, or you can add "--permissive" and Cantera will remove the photon (hv) from the reaction. Overall, in my experience, this reaction has very limited impact on the simulations, so either path will hardly make a difference.

Best,
Bryan

Kyaw Si Thu

unread,
Dec 5, 2021, 2:03:25 AM12/5/21
to Cantera Users' Group
Hi Bryan
Thanks for your advice.

Best,
Kyaw

Kyaw Si Thu

unread,
Dec 7, 2021, 11:52:04 PM12/7/21
to Cantera Users' Group
Hi Bryan
I used the ' ck2cti --input=1E all.txt --thermo=therm.txt --transport=tran.txt --permissive ' command give the following errors.

ck2cti.py: Error parsing arguments:
Unexpected command-line option: 'all.txt --thermo=therm.txt --transport=tran.txt --permissive'
Run "ck2cti.py --help" to see usage help.

So I try the other way. I change to use   '4.8749E+04' to  '4.8749e+04' (file name 1e)and run.
Gives the following errors:


(ct-env) C:\Users\****\Desktop\Cantera Files\N-Butanol - Original 1>ck2cti --input=1e.txt --thermo=therm.txt --transport=tran.txt --output=succed.yaml --permissive
WARNING:root:Found reversible reaction containing a product photon:

oh*<=>oh+hv                                  1.450e+06      0.0           0.0
If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.
WARNING:root:Found reversible reaction containing a product photon:
ch*<=>ch+hv 1.860e+06 0.0 0.0

If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.
INFO:root:Error reading reaction starting on line 6693:
"""
sc4h7oh-1ooh-3o2<=>sc4ohket2-3+oh         4.680+09 0.000 2.295e+04
"""
WARNING:root:
ERROR: Unable to parse '1e.txt' near line 6693:
could not convert string to float: '4.680+09'


Traceback (most recent call last):
  File "C:\Users\****\.conda\envs\ct-env\Scripts\ck2cti-script.py", line 10, in <module>
    sys.exit(script_entry_point())
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2363, in script_entry_point
    main(sys.argv[1:])
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2334, in main
    surfaces = Parser.convertMech(inputFile, thermoFile, transportFile,
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2229, in convertMech
    parser.loadChemkinFile(inputFile)
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1897, in loadChemkinFile

    reaction, revReaction = self.readKineticsEntry(kinetics, surface)
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1200, in readKineticsEntry
    A = float(tokens[-3])
ValueError: could not convert string to float: '4.680+09'


So I change '4.680+09'  to '4.680e+09' (file name 1ee) and other errors are come out.


WARNING:root:Found reversible reaction containing a product photon:

oh*<=>oh+hv                                  1.450e+06      0.0           0.0
If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.
WARNING:root:Found reversible reaction containing a product photon:
ch*<=>ch+hv 1.860e+06 0.0 0.0

If the "--permissive" option was specified, this will be converted to an irreversible reaction with the photon removed.
INFO:root:Skipping unexpected species "hoco" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ch3cho2h" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ch3coch2o2h" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ch3coch2o" while reading thermodynamics entry.
WARNING:root:Found additional thermo entry for species c2h5co. If --permissive was given, the first entry is used.
INFO:root:Skipping unexpected species "ch3chcho" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c3h2" while reading thermodynamics entry.
WARNING:root:Found additional thermo entry for species iic4h7q2-t. If --permissive was given, the first entry is used.
INFO:root:Skipping unexpected species "c5h11-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h81-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h91-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h91-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h91-5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h92-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h92-5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h9o1-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h9o2-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2h-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2h-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2h-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h11o2-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh3-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh3-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o1-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o1-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o1-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o1-5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o2-3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10o2-4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-2o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-3o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-4o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh1-5o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-1o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-3o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-4o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh2-5o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh3-1o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10ooh3-2o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket12" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket13" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket14" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket15" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket21" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket23" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket24" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket25" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket31" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "nc5ket32" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10oh-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h10oh-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "o2c5h10oh-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "o2c5h10oh-2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h6" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*ccjc*c" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h3" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "l-c6h4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c-c6h4" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h5oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h5o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "p-c6h4o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "p-c6h3o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "o-c6h4o2" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h6" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h5oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h4o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h5o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h4oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h5oo" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h5ooh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c6h4oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "hoc6h4oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "oc6h4oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "p-oc6h5oj" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "o-oc6h5oj" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c#cc*ccj" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h6-l" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "cj*cc*cc*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*cc*ccj*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "cj*cc*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h3o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c5h7" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "oc5h7o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*ccjc*coh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*cc*ccj" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*cc*cc" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*cc*ccoh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c*ccjc*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "oc4h6o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "oc4h5o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "hoc*cc*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "hoc*ccj*o" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "o2cchooj" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c4h6oh1-43" while reading thermodynamics entry.
WARNING:root:Found additional thermo entry for species c2h3oh. If --permissive was given, the first entry is used.
INFO:root:Skipping unexpected species "c4h5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ic3h7oh" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ic3h6oh-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c3h5oh1-1" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "c2h5oc2h5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ch3oc2h5" while reading thermodynamics entry.
INFO:root:Skipping unexpected species "ch2oc2h5" while reading thermodynamics entry.
INFO:root:Error while reading thermo entry starting on line 1769:
"""
hcchoh     8/13/ 7 thermc   2h   3o   1    0g   300.000  5000.000 1411.000     1
 8.08589999e+00 5.40439348e-03 1.55258652e-06 2.13486072e-10 1.14112108e-14    2
 1.16372053e+04 1.65147643e+01 9.99819422e-01 2.70273221e-02 2.66916711e-05    3
 1.32529706e-08 2.53537494e-12 1.35529195e+04 1.96798606e+01
ch2coh     8/13/ 7 thermc   2h   3o   1    0g   300.000  5000.000 1408.000     1
 7.67940243e+00 5.63609321e-03-1.57911872e-06 2.14057857e-10-1.13615509e-14    2
 1.06531188e+04-1.40057705e+01 1.85296033e+00 2.20741770e-02-1.93718642e-05    3
 8.89896145e-09-1.61108469e-12 1.23550086e+04 1.62184602e+01                   4
"""
WARNING:root:
ERROR: Unable to parse 'therm.txt' near line 1776:


Traceback (most recent call last):
  File "C:\Users\****\.conda\envs\ct-env\Scripts\ck2cti-script.py", line 10, in <module>
    sys.exit(script_entry_point())
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2363, in script_entry_point
    main(sys.argv[1:])
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2334, in main
    surfaces = Parser.convertMech(inputFile, thermoFile, transportFile,
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 2252, in convertMech
    parser.loadChemkinFile(thermoFile,
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1779, in loadChemkinFile
    label, thermo, comp, note = self.readThermoEntry(thermo, TintDefault)
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1084, in readThermoEntry
    coeffs_low = [fortFloat(lines[i][j:k])
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 1084, in <listcomp>
    coeffs_low = [fortFloat(lines[i][j:k])
  File "C:\Users\****\.conda\envs\ct-env\lib\site-packages\cantera\ck2cti.py", line 919, in fortFloat
    return float(s)
ValueError: could not convert string to float: 'ch2coh     8/13'

I don' know how to solve it.
I will really appreciate it if you make a cti file for me.

Thanks in advance
Kyaw





























1ee.txt
tran.txt
1e.txt
therm.txt
1 original.txt

Bryan Weber

unread,
Dec 8, 2021, 10:45:46 AM12/8/21
to Cantera Users' Group
Hi Kyaw,

First, the first problem you have was that the file name has a space in it (1E all.txt). You need to put quote marks around that name in the ck2cti command, otherwise the system doesn't know that the whole thing is the file name. In the file syntax, E and e are equivalent. The reason it worked the second time is that your filename no longer had a space, (1e.txt)

Second, the last error message you mention is covered in the debugging tips I linked to earlier. There is a very specific format for the THERMO files, and unfortunately, the CHEMKIN parser does not strictly enforce the standard whereas the Cantera parser does enforce it. Please see that section on the website again, and see how it can solve your problem: https://cantera.org/tutorials/ck2yaml-tutorial.html#debugging-common-errors-in-ck-files In your specific case, it looks like the last line of the hcchoh entry is missing the digit `4` in the last column.

Best,
Bryan

Reply all
Reply to author
Forward
0 new messages