ck2cti - USC Mechanism conversion - Stuck in the process

752 views
Skip to first unread message

Johannes Franz

unread,
Nov 7, 2014, 7:43:43 AM11/7/14
to canter...@googlegroups.com
Dear all,

I am trying to convert the USC mechanism for use with cantera.
However, I am stuck and could need your help.

The cantera version in use is 2.1.1.  I attached the origninal and altered mechanism files.

At first try I got this message, when trying to convert the input files.


WARNING:root:"SPECIES" section implicitly ended by start of next section on line
 155.
ERROR:root:Error reading reaction entry starting on line 1655:
WARNING:root:
ERROR: Unable to parse 'USC_Mech_ver_II.txt' near line 1783:

Traceback (most recent call last):
  File "ck2cti.py", line 5, in <module>
    ck2cti.main(sys.argv[1:])
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 188
2, in main
    outName, permissive=permissive)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 180
1, in convertMech
    self.loadChemkinFile(inputFile)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 159
4, in loadChemkinFile
    reaction,revReaction = self.readKineticsEntry(kinetics)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 122
5, in readKineticsEntry
    alpha = float(tokens[0].strip())
ValueError: could not convert string to float: '0.902,'



I then did altered the following lines in the mechanism file in order to avoid the error messages of the parser:
1657: Removed "," after 0.902 etc....
1784: to end: removed references...

Next time I got the following message:

WARNING:root:"SPECIES" section implicitly ended by start of next section on line
 155.
WARNING:root:Ignoring duplicate transport data for species "CH3CHOCH2".
Traceback (most recent call last):
  File "ck2cti.py", line 5, in <module>
    ck2cti.main(sys.argv[1:])
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 188
2, in main
    outName, permissive=permissive)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 181
7, in convertMech
    self.parseTransportData(lines)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 168
6, in parseTransportData
    raise InputParseError('Unable to parse transport data: not enough parameters
')
cantera.ck2cti.InputParseError: Unable to parse transport data: not enough param
eters

So I found some lines in the transport file which bothered me and possibly the parser. These were the following lines:

Line 94 through 97: Commented out (Line starts with "The Lennard-Jones parameters....")

Line 163: commented out (Line starts with ""halene")

Line 167 throuh 176: Commented out (Lines stars with " 1-15: Species name....")

After this I get the following error message, which I am stuck with. I don't know what to to next.
I already read the following thread but I think I've got another problem: https://groups.google.com/forum/#!topic/cantera-users/89gmIEd58Ho

WARNING:root:"SPECIES" section implicitly ended by start of next section on line
 155.
WARNING:root:Ignoring duplicate transport data for species "CH3CHOCH2".
WARNING:root:Ignoring duplicate transport data for species "C4H6".
WARNING:root:Ignoring duplicate transport data for species "C4H2".
WARNING:root:Ignoring duplicate transport data for species "iC4H5".
WARNING:root:Ignoring duplicate transport data for species "C4H6".
WARNING:root:Ignoring duplicate transport data for species "C5H4OH".
Traceback (most recent call last):
  File "ck2cti.py", line 5, in <module>
    ck2cti.main(sys.argv[1:])
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 188
2, in main
    outName, permissive=permissive)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 182
8, in convertMech
    self.writeCTI(name=phaseName, outName=outName)
  File "C:\Program Files\Python33\lib\site-packages\cantera\ck2cti.py", line 170
7, in writeCTI
    raise InputParseError('No thermo data found for species: {0!r}'.format(s.lab
el))
cantera.ck2cti.InputParseError: No thermo data found for species: 'AR'


As always, your help will be appreciated.
Best regards,
Johannes.

thermdat.txt
thermdat_alt.txt
trandat.txt
trandat_alt.txt
USC_Mech_ver_II.txt
USC_Mech_ver_II_alt.txt

Bryan W. Weber

unread,
Nov 7, 2014, 8:10:22 AM11/7/14
to canter...@googlegroups.com
Dear Johannes,

With the newest version of ck2cti (the developer version, available here: https://code.google.com/p/cantera/source/browse/cantera/trunk/interfaces/cython/cantera/ck2cti.py), I'm able to convert this mechanism after I add the "END" keyword just before the "REACTIONS" keyword in the USC_Mech_ver_II_alt.txt file, so long as I use the --permissive option. Without that option, the only errors I get are due to duplicated species thermo/transport. You may want to consider replacing your ck2cti with the developer version (or at least using the developer version separately).

Bryan
USC_Mech_ver_II_alt.cti

Johannes Franz

unread,
Nov 7, 2014, 8:27:29 AM11/7/14
to canter...@googlegroups.com
Bryan,
thx a lot.
With the ck2cti.py script you reffered to I am also able to create a cti file.

Johannes.

Ray Speth

unread,
Nov 7, 2014, 9:48:29 AM11/7/14
to canter...@googlegroups.com
Johannes,

This issue is caused by the fact that the thermdat.txt file begins with a UTF-8 BOM (byte order marker) even though it is just ASCII text. If you're using Windows, you can remove the BOM by opening the file in Notepad (which is probably the editor which introduced the unnecessary BOM in the first place), selecting "Save As", and setting the "Encoding" to "ANSI". The current development version of Cantera does not have this problem because ck2cti now automatically strips all non-ASCII values when reading the file.

Regards,
Ray


On Friday, November 7, 2014 7:43:43 AM UTC-5, Johannes Franz wrote:

Johannes Franz

unread,
Nov 8, 2014, 12:04:22 PM11/8/14
to canter...@googlegroups.com
Thank you Ray.
Reply all
Reply to author
Forward
0 new messages