Installation of Cantera 1.7 with Matlab R2006b How to install and use Cantera on a PC (Windows XP) with Matlab. These instructions are only for Caltech students in the Ae120 class. Official releases, information, and support of Cantera are described in www.cantera.org 1. Install Matlab from http://software.caltech.edu/ if you don't already have it. This is free to students and staff but takes about 1.8 GB of free space for the R2006b version and unless you have the standalone license key, you will have to be connected to the net to use it. Note, use R2006b and not 7.1, Cantera 1.7 will not work with Matlab 7.1. Note about Matlab 7.1: If you have Matlab 7.1 and don't want to upgrade to R2006b, then you will have to install cantera 1.6. The python and numpy installations are the same but you will need to download and install Cantera160r3.msi (found under the Downloads > File Releases > 1.60 on Cantera SourceForge page). The environment variables are handled differently for 1.6 - the directory for python is added to the PATH variable rather than setting separate variables. 2. Download the distribution files for python, numarray, and Cantera. The links are: http://www.python.org/ftp/python/2.5/python-2.5.msi http://downloads.sourceforge.net/numpy/numarray-1.5.2.win32-py2.5.exe?modtime=1156438276&big_mirror=0 http://downloads.sourceforge.net/cantera/Cantera-1.7.0.msi?modtime=1163522528&big_mirror=0 Copy the files to a temporary location on your PC and/or burn them to a CD in case you have to reinstall. 3. Install the software on your machine in the order given. a. Install Python by executing python-2.5.msi b. Install numarry by executing numarray-1.1.1.win32-py2.5.exe c. Set the user environment variables using the system applet, advanced tab (Start > Settings > COntrol Panel > System > Advanced > Environment Variables > User Variables > New) to add: PYTHON_CMD c:\Python25\python.exe MATLAB_CMD C:\Program Files\MATLAB\R2006b\bin\win32\MATLAB.exe d. Install cantera by executing cantera-1.7.0.msi (DUring the installation process, We suggest that you change the default installation directory to c:\Cantera) e. Install the python-cantera interface by executing Cantera-1.7.0.win32-py2.5.exe (this will be located in the c:\Cantera directory. Just double click to execute.) 4. Start Matlab and set add the path to the Cantera toolbox to the Matlab using File > Set Path > Add with Subfolders. If you installed Cantera to C:\Cantera the Matlab Cantera toolbox is at C:\Cantera\MATLAB\toolbox\. The simplest thing to do is to add the entire Cantera installation directory path C:\Cantera using the File > Set Path > Add with Subfolders commands in Matlab. 5. You should be ready to use Cantera! To see if all is installed correctly, try running one of the tutorials, located in C:\Cantera\tutorials\MATLAB\ Remember you have to set the current directory or add the path so that Matlab knows where to look for these files. If you added the entire Cantera direcory tree with the "Add with Subfolders" option, this should be taken care of. 6. Learning Cantera: a. There are numerous demonstration programs located in C:\Cantera\demos\MATLAB b. There are a number of documentation pdfs located in the Documentation directory of the distribution, including one describing the demos. 7. For writing and compiling your own programs with C, look at the instructions in Cantera17-vc7.pdf under the Documentation on the source forge page. 8. Fix mixmaster by replacing the module C:\Python25\Lib\site-packages\MixMaster\ThermoFrame.py with http://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/Windows/ThermoFrame.py Replace the module C:\Cantera\MATLAB\toolbox\cantera\@ThermoPhase\C:\Cantera\MATLAB\toolbox\cantera\gibbs_RT.m with http://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/Windows/gibbs_RT.m 9. Data files - In order to use Cantera, you need .cti files that contain the description of the mixture, thermodynamic data, reaction mechanism, and transport data. Several files are included with the base Cantera distribution. These files are limited to low temperatures (<3000 K) and for methane and oxygen. Other files useful for high temperature (up to 6000K) are available at http://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/Windows/cti.html Creating your own files or converting from other formats is discussed in the Cantera documentation. You can put the data files in one of two places: a. The common location for the .cti files is C:\Program Files\Common Files\Cantera\data There is a linked directory'data' to this in your Cantera base directory. b. The data files can be in the same directory as your Python (.py files) or MatLab scripts (.m files) 10. Trouble shooting: a. Make sure that the version of Matlab and Cantera are compatible (see step 1 and check the version numbers) b. Make sure that you installed numarray and not numpy (Step 3b) c. Make sure that the versions of numarray and python are both 2.5 (step 3, check the version numbers on the installation packages) d. Make sure that the environment variables are properly set (see step 3c). Open a command window (Start > Run > cmd ) and execute the "set" command. The current variables will be listed in alpha order, check to see if MATLAB_CMD and PYTHON_CMD are properly defined. If you installed Cantera 1.6, check the PATH variable to make sure that the Python interpreter is there. e. Check that the python and the cantera interface are installed properly by trying one of the Python tutorials. First, find the the python cantera tutorial directory (this depends on where you installed Cantera, mine are located at C:\Cantera\tutorials\Python). Right click on tut1.py and left click on Edit with Idle. In the tut1.ps window enter "F5" which is the short cut for Run > RunMOdule. You should see given in the comments of the tutorial in the Python Shell window. If not, your Python or Cantera install is incorrect and this has to be fixed before even trying Matlab. Hint: Did you make sure to carry out step 3e? f. If you still have trouble with Matlab, double check that you have added the path to both the Cantera toolbox and the program that you are running. See Step 4. Make sure that you use the "Add with Subfolders" option! Check this by examining the paths that are located in File > Set Path. You should see C:\Cantera C:\Cantera\MATLAB C:\Cantera\MATLAB\toolbox C:\Cantera\MATLAB\toolbox\cantera C:\Cantera\MATLAB\toolbox\cantera\1D C:\Cantera\bin C:\Cantera\demos C:\Cantera\demos\MATLAB at the top of the path list if you followed my suggestion in Step 4 or 5. g. Are the .cti files in the data or in your local directory (see step 9). If you are having trouble with .cti data files in matlab, make sure that you do the following: i. Make sure that there is at least one object within the cti file that contains all the species. Start with a working .cti file in the common data directory or use ck2cti.exe to create the file from a working Chemkin input file. Don't try to use IdealGasMix command to create the object within Matlab - only use this with existing xml files. ii. Specify not only the cti file but also the specific gas object with the importPhase command. iii. Once you have made an error in trying to load a .cti file with Matlab, there is a bug that prevents the correct file from being loaded even if you correct the error. The symptom is that you repeatedly get the message "Caught std::exception Exception message is: Access violation - no RTTI data!" To fix this, close MatLab, make sure that your .cti file is in the correct place, and try again. If you are not putting the .cti file in the common location,set the current directory to the one containing your .cti file (and if you are using one, the .m file). Load the correct .cti file and gas object using the importPhase command. iv. Make sure that the current directory set in Matlab is one that the program can write into and the xml file is being created. h. Look at the documentation on the Cantera web page (more extensive than on SourceForge) http://www.cantera.org/ref/index.html i. See the Cantera documentation on SourceForge (Download > Cantera Documentation or http://downloads.sourceforge.net/cantera/), in particular Cantera17-vcf17.pdf. j. See if your question has been answered on the Yahoo Cantera user forum http://groups.yahoo.com/group/cantera/ and if not, post a question there. JES Jan 22, 2007. Last revised March 24, 2007.