Installing Cantera 1.5.5 for Windows
Download
Report
Transcript Installing Cantera 1.5.5 for Windows
Installing Cantera 1.7 for
Windows
S. Browne and J. E. Shepherd
Caltech
Revised March 24, 2007
1
System Requirements
A PC running MS Windows XP with SP2
Python 2.5
Download the Windows installer from
http://www.python.org/ftp/python/2.5/python-2.5.msi
and run it
Cantera uses Python to process input files, so it is required even if
you will use Cantera from Matlab or another environment
numarray site-package for Python
Only needed if you plan to use Cantera from Python
Adds fast array operations to Python
Download the Windows installer (“Old numarray”) from
http://sourceforge.net/projects/numpy/numarray-1.5.2.win32-py2.5.exe
and run it
Optional
Matlab R2006b (See next slide if you are using Matlab 7.1)
Graphviz (Needed to use reaction networks in MixMaster) –
http://www.graphviz.org/
2
Matlab Version
Matlab R2006b Users – GO TO Slide 4
Matlab 7.1 Users – Do One of the Following
Upgrade to Matlab R2006b
Or Install Cantera 1.6
To Install Cantera 1.6
Read Cantera 1.6 Installation Instructions
http://www.galcit.caltech.edu/EDL/public/sdt/Papers/Install_Cantera1.6.pdf
If you plan to install Cantera 1.6 – do NOT
proceed with this document
3
Cantera 1.7 Installation
Download the Cantera installer
get Cantera1.7.0.msi and run it.
http://sourceforge.net/projects/cantera/
This will create a folder that
looks like the one shown here
Run Cantera-1.7.0.win32-py2.5.exe
This creates the interface between
Cantera and Python
4
Add New Environment Variables
Cantera needs to know where to find
the Python interpreter, since it uses
Python to process ‘.cti’ input files and
Matlab if you choose to use Matlab
To edit the system search path, select
“System” on the Control Panel to pull
up this dialogue box
Press the ‘Environment Variables’
button
5
Add New Environment Variables
• Add 2 New (user) Environment
Variables
• PYTHON_CMD
C:\Python25\python.exe
• MATLAB_CMD
C:\Program Files\MATLAB\R2006b\bin\win32\MATLAB.exe
Note: Check your paths
• Environment Variables are Case Sensitive
• Some installation locations may be different
depending on the user’s choices.
6
Put the Cantera Toolbox on the
Matlab path
Add ‘Cantera’ folder
to the Matlab path
Use the “Add with
Subfolders” option.
More details on next
slide
7
Setting the Path in Matlab
choose ‘Set Path…’ on the File menu
• Cantera Toolbox
• Cantera Demos
• Cantera Tutorials
NOTE: There will be many more
directories than those shown in this
screen-shot (to the right), but only
those shown are necessary for
Cantera.
8
Cantera Thermo/Reaction Data
.cti Format Files – Thermo/Reaction Input Files for Cantera
Contain
Description of the Mixture
Thermodynamic Data
Reaction Mechanism (optional)
Transport Data (optional)
Files included with Cantera Distribution
Limited to Low Temperatures (< 3000 K)
Includes GRI3.0 and files used in demos.
High Temperature (up to 6000 K) Files Available at
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/Windows/cti.html
Creating New/Converting CHEMKIN Style Files Documented at
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/Windows/cti.html
Put Thermo/Reaction Data Files (.cti) in one of two places
C:\Program Files\Common Files\Cantera\data NOTE: There is a link ('data‘) to this
directory in your Cantera base directory.
Your current working directory (set this in Matlab)
9
Mixmaster 1.7 Bug
Mixmaster is a GUI written in Python that can be
used to carry out equilibrium computations, evaluate
thermodynamic properties and post-process reaction
rate files.
The Cantera 1.7 Distribution Mixmaster has a bug
To Fix: Replace
C:\Python25\Lib\site-packages\MixMaster\ThermoFrame.py
with
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/Windows/ThermoFrame.py
10
Matlab Cantera 1.7 Toolbox Bug
The Cantera 1.7 Matlab Toolbox has a bug as well
To Fix: Replace
Cantera\MATLAB\toolbox\cantera\@ThermoPhase\gibbs_RT.m
with
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/Windows/gibbs_RT.m
11
Testing Installation
Make sure to restart your computer for the environment
variables to take effect.
Two Options to Test Installation
1. Open Matlab and try starting the first tutorial ‘tut1.m’
2. Go to:
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/Windows/cantera_test.html
and follow instructions
Notes
You must ‘set the current directory’ or ‘add the path’ of any m-file
that you want to execute
If you added the Cantera directory with the "Add with Subfolders"
option (Slide 8) – the demos and tutorials will be in the Matlab
path
If you have difficulties – READ ON
12
Tips and hints
1. Version Compatibility –
Check that Matlab and Cantera
Versions are Compatible (i.e. Use Cantera 1.7 with Matlab
R2006b ONLY)
2. numarray –
Numeric
Be sure to install numarray NOT numpy or
3. Python Version –
numarray 2.5
Make sure you have Python 2.5 and
4. Environment Variables
a)
b)
c)
Case Sensitivity – Make sure that all paths specified truly exist.
USER Environment Variables NOT SYSTEM Environment Variables
Cantera 1.7.0 – TWO New Variables
– Check that MATLAB_CMD & PYTHON_CMD exist are properly
defined
– This is DIFFERENT than the method used for Cantera 1.6
13
Tips and hints
5. Test Cantera/Python Interface
Run tut1.py (python tutorial file)
Located in Cantera\tutorials\Python
To Run:
Right click on ‘tut1.py’ and left click on ‘Edit with Idle’
In the tut1.py window enter "F5" (shortcut for Run > RunModule)
Results
Correct – the comments of the tutorial print in the Python Shell
window
If NOT – Python or Cantera install is incorrect. This must be fixed
before even trying Matlab.
14
Tips and hints
6. Persistent Matlab Trouble
Check Matlab Path – Be sure that BOTH Cantera Toolbox &
Program you are Running are in the Matlab Path
Check Slide 8 – Does Your Path Match the Blue Box? You should
see
Cantera
Cantera\MATLAB
Cantera\MATLAB\toolbox
Cantera\MATLAB\toolbox\cantera
Cantera\MATLAB\toolbox\cantera\1D
Cantera\demos\MATLAB
Cantera\tutorials\MATLAB
at the top of the path list if you did this properly
7. Data Directory – Are the .cti or .xml files in the common data
directory or your current working directory? (see Slide 9)
15
Tips and Hints
7. (cont) If you are having trouble with .cti data files in Matlab, make sure that you do
the following:
a.
There must be 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.
b.
Specify not only the cti file but also the specific gas object with the importPhase
command.
c.
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. (Deleting the old .xml files is probably a good idea too.)
d.
Make sure that the current directory set in Matlab is one that the program can write into
and the xml file is being created.
16
Tips and hints –
External Documentation
8. Cantera Documentation
Cantera Web Site
(Currently No Windows Documentation)
http://www.cantera.org/ref/index.html
SourceForge Web Site in particular Cantera17-vcf17.pdf
http://downloads.sourceforge.net/cantera/
(NOTE: Page/Slide 9 of Cantera17-vcf17.pdf NOT Necessary for basic
user)
Shock & Detonation Toolbox Site
http://www.galcit.caltech.edu/EDL/public/sdt/SD_Toolbox/
9. Yahoo Cantera User Forum
http://groups.yahoo.com/group/cantera/
17