0

I followed the Matlab Interface User’s Guide on website http://www.cantera.org/docs/sphinx/html/matlab/code-docs/utilities.html to convert a CHEMKIN input file to Cantera format,the steps are

  1. adddir('the directory of chem.inp,therm.dat and tran.dat')

  2. f = ck2cti('chem.inp', 'therm.dat', 'tran.dat')

but an error occurred.

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


Procedure: ck2cti
Error:   Error converting input file "chem.inp" to CTI.
Python command was: 'C:\Python34\python.exe'
The exit code was: 7
-------------- start of converter log --------------
Traceback (most recent call last):
  File "<stdin>", line 9, in <module>
  File "C:\Python34\lib\site-packages\cantera\ck2cti.py", line 1899, in convertMech
    raise IOError('Missing input file: {0!r}'.format(inputFile))
OSError: Missing input file: 'chem.inp'
--------------- end of converter log ---------------

error ck2cti (line 47)
iok = ctmethods(0, 1, infile, thermo, transport, idtag, 0, 0);

Is there a solution for the problem? any reply will be appreciated!!

Ray
  • 4,531
  • 1
  • 23
  • 32

1 Answers1

0

Adddir is not a built-in matlab function, you should use addpath instead.

So it become:

addpath('the directory of chem.inp,therm.dat and tran.dat')
f = ck2cti('chem.inp', 'therm.dat', 'tran.dat')

Check also that your file 'chem.inp' exist and is placed in the right folder.

obchardon
  • 10,614
  • 1
  • 17
  • 33
  • Thank you for your reply! I have tried the method: addpath('C:\Python34\lib\site-packages\cantera'), f = ck2cti('chem.inp', 'therm.dat', 'tran.dat'). And chem.inp, therm.dat and tran.dat are placed in the folder 'C:\Python34\lib\site-packages\cantera', but the same error was occurred all the same. I do not know why. – hongbinLi Peter May 24 '16 at 12:33
  • So it's probably a problem concerning your library. So just try to move your file in the working directory of matlab. It seem's that ck2cti.py can't open your new path. – obchardon May 24 '16 at 14:28