slepicka-craig / cantera

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

Bug in ck2cti.py when reading Chebyshev coefficients #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I found that ck2cti.py in r2928 has a bug for reading Chebyshev coefficients 
formatted in a particular way; namely, when the coefficients begin on the same 
line as the numbers of temperature and pressure functions.

For example, when a reaction has the line:
CHEB/   8  4      1.2451E+01  7.3554E-01 -1.7244E-02 -8.1648E-04 -3.5023E+00/

running ck2cti gives this error:
Traceback (most recent call last):
  File "./ck2cti.py", line 1905, in <module>
    main(sys.argv[1:])
  File "./ck2cti.py", line 1901, in main
    outName, permissive=permissive)
  File "./ck2cti.py", line 1817, in convertMech
    self.loadChemkinFile(inputFile)
  File "./ck2cti.py", line 1608, in loadChemkinFile
    reaction,revReaction = self.readKineticsEntry(kinetics)
  File "./ck2cti.py", line 1322, in readKineticsEntry
    chebyshev.coeffs[t,p] = chebyshevCoeffs[index]
IndexError: list index out of range

Apparently, the current version of ck2cty.py doesn't read coefficients on the 
same line as the numbers of functions. Adding the following line after line 
1287 fixes the issue (or, see the addition on line 1288 in the attached updated 
file).
chebyshevCoeffs.extend([float(t.strip()) for t in tokens2[2:]])

Original issue reported on code.google.com by kyle.nie...@gmail.com on 6 May 2014 at 6:42

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2937.

Original comment by yarmond on 7 May 2014 at 9:57

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r3024.

Original comment by yarmond on 20 Jun 2014 at 7:41