dbirch997 / cantera

Automatically exported from code.google.com/p/cantera
1 stars 0 forks source link

ck2cti fails for USC-Mech II #176

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download chemkin files from
http://ignis.usc.edu/Mechanisms/USC-Mech%20II/USC_Mech%20II.htm

2. run ck2cti
ck2cti --input=USC_Mech_ver_II.txt --thermo=thermdat.txt 
--transport=trandat.txt --output=USC_Mech_ver_II.cti

What is the expected output? What do you see instead?
... should produce a *.cti file, but terminates with 
cantera.ck2cti.InputParseError: "SPECIES" section implicitly ended by start of 
next section on line 155.

What version of the product are you using? On what operating system?
cantera from svn-git, branch 2.1 (r2546) ... fedora 19

Please provide any additional information below.
ck2cti worked in earlier versions as long as bottom part of trandat.txt was 
removed.

Original issue reported on code.google.com by ischo...@gmail.com on 26 Sep 2013 at 4:57

GoogleCodeExporter commented 9 years ago
Try running with the "--permissive" flag.

Original comment by yarmond on 26 Sep 2013 at 12:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
still fails with --permissive on. 

The first error is in readKineticsEntry:
    alpha = float(tokens[0].strip())
ValueError: invalid literal for float(): 0.902,

The relevant entry appears to be this one:
 C6H5 (+M) = o-C6H4 + H (+M)                  4.300E+12   0.616    77313.   ! RRKM 00-HAI-FRE   
                                         LOW/ 1.000E+84 -18.866    90064    /
                                         TROE/ 0.902, 696., 358., 3856.     /    
                                   H2/2.0/ H2O/6.0/ CH4/2.0/ CO/1.5/ CO2/2.0/

I located the offending lines in the 'troe' part of readKineticsEntry, where 
replacing lines 1193ff in ck2cti.py with

            elif 'troe' in line.lower():
                # Troe falloff parameters
                tokens = tokens[1].split()
                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

fixes that particular issue. However, there's another error with:
if (self.energy_units != ENERGY_UNITS[energyUnits] or
KeyError: '-'
which arises in a different section (in loadChemkinFile, line 1490)

Original comment by ischo...@gmail.com on 26 Sep 2013 at 2:07

GoogleCodeExporter commented 9 years ago
I've never seen any indication that commas are an allowed separator in the 
Chemkin input file format. I think this should be regarded as an error in the 
input file that just happens to be ignored by the Chemkin interpreter.

The second error is caused by the "comments" at the end of the file (starting 
on line 1784) that are not marked as such. Again, I've never seen any 
indication that the Chemkin file format permits comments unless they are marked 
by the comment character '!'.

I made some additions in r2552 which should identify the line and file where 
the error occurs, which make it easier to determine the source of the error. In 
this case, the parser is picking up on the word 'reactions' on line 1794 as the 
start of a section containing more reactions.

Original comment by yarmond on 30 Sep 2013 at 2:16