jcaiuwyo / cantera

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

ck2cti for LLNL mechanism for c8-c16_n-alkanes #238

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I want to convert the c8-c16_n-alkanes rection kinetics (reaction 
mechanism,thermodynamic data) into cantera format(.cti) which are currently in 
chemkin format(downloaded from the LLNL site).
The .txt files are attached

2.I converted: 
c8-c16_n-alkanes_mech.txt --> c8-c16_n-alkanes_mech.inp
c8-c16_n-alkanes_therm.txt --> c8-c16_n-alkanes_therm.dat

3. After that I used matlab ck to cti files convert utility program
f = ck2cti('c8-c16_n-alkanes_mech.inp', 'c8-c16_n-alkanes_therm.dat')

What is the expected output? What do you see instead?
Expected output is a .cti file for use in cantera but I am getting an error as 
'Error converting input file "chem.inp" to CTI' in the ck2cti log.

What version of the product are you using? On what operating system?
Cantera-2.1.1-x64
Matlab R2013b
Operating System-Windows 7 64bit
Python 3.3

Please provide any additional information below.
Error using ctmethods

************************************************
                Cantera Error!
************************************************

Procedure: ck2cti
Error:   Error converting input file "c8-c16_n-alkanes_mech.inp" to CTI.
Python command was: 'C:\Python33\python.exe'
The exit code was: 7
-------------- start of converter log --------------
Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
  File "C:\Python33\lib\site-packages\cantera\ck2cti.py", line 1828, in convertMech
    self.writeCTI(name=phaseName, outName=outName)
  File "C:\Python33\lib\site-packages\cantera\ck2cti.py", line 1707, in writeCTI
    raise InputParseError('No thermo data found for species: {0!r}'.format(s.label))
cantera.ck2cti.InputParseError: No thermo data found for species: 'h'
--------------- end of converter log ---------------

Error in ck2cti (line 35)
iok = ctmethods(0,1, infile, thermo, transport, idtag, 0, 0);

Original issue reported on code.google.com by christia...@gmail.com on 24 Sep 2014 at 3:07

Attachments:

GoogleCodeExporter commented 9 years ago
The c8-c16_n-alkanes_therm.txt file starts with non-ASCII characters 
(specifically, a UTF-8 BOM) which interferes with parsing. Removing these 
characters with a suitable editor will allow the file to be parsed.

The current development version of Cantera automatically strips non-ASCII 
characters (see r2717), and works with the provided input files as-is, but this 
change is not planned to be backported to the maintenance branch.

Original comment by yarmond on 24 Sep 2014 at 9:04

GoogleCodeExporter commented 9 years ago
The conversion of the Therm file actually works.

The conversion of the Mech file doese not work.

Original comment by christia...@gmail.com on 25 Sep 2014 at 10:20

GoogleCodeExporter commented 9 years ago
You can't convert the pieces to CTI separately, so I'm not sure what it means 
to say that converting one file works and the other doesn't. The problem is in 
the thermo file.

Running this command:
    python -c 'print repr(open("c8-c16_n-alkanes_therm.txt").readline())'
Gives the output:
'\xef\xbb\xbfthermo\r\n'

Thus, when the converter looks for a line that starts with 'thermo' to indicate 
the beginning of the thermo data, this line doesn't qualify, so it decides that 
the file doesn't contain any thermo data.

Original comment by yarmond on 25 Sep 2014 at 2:12

GoogleCodeExporter commented 9 years ago
Dear Yarmond, 

thanks for your help so far.

But since I am an absolute newbie in that field, could you please be more 
specific?
How do I need to convert the Thermo file in a way that the conversion works?

You say, that the therm file starts with non-ASCII characters.
When I look into the first line of the file, I see: thermo, which looks to me 
like ASCII characters.
So, which characters do I have to modifiy/remove and how?

Thanks a lot for your help again.

Original comment by christia...@gmail.com on 25 Sep 2014 at 5:17

GoogleCodeExporter commented 9 years ago
They are by definition non-printable characters, and your editor is hiding them.

Since this is no longer a matter of reporting a Cantera bug, you would be 
better served by asking your question on the Cantera Users Group 
(https://groups.google.com/forum/?fromgroups#!forum/cantera-users). If you ask 
there, I would suggest including information about your operating system and 
what editor you are trying to use to fix the file.

Original comment by yarmond on 25 Sep 2014 at 11:17

GoogleCodeExporter commented 9 years ago
Issue 239 has been merged into this issue.

Original comment by yarmond on 25 Sep 2014 at 11:19