Top Banner
1 Installing Cantera 1.7, Python 2.5, and Python SDToolbox for Windows J. Ziegler, S. Browne, and J. E. Shepherd Caltech Revised August, 2007
14

Installing Cantera 1.7, Python 2.5, and Python SDToolbox for Windows

Jan 02, 2016

Download

Documents

neve-finley

Installing Cantera 1.7, Python 2.5, and Python SDToolbox for Windows. J. Ziegler, S. Browne, and J. E. Shepherd Caltech Revised August, 2007. System Requirements. A PC running MS Windows XP with SP2 Python 2.5 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

1

Installing Cantera 1.7, Python 2.5,

and Python SDToolbox for Windows

J. Ziegler, S. Browne, and J. E. ShepherdCaltech

Revised August, 2007

Page 2: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

2

System RequirementsA PC running MS Windows XP with SP2Python 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 filesnumarray site-package for Python

Download the Windows installer (“Old numarray”) from http://sourceforge.net/projects/numpy/numarray-1.5.2.win32-py2.5.exe and run it

scipy for python 2.5 (windows) http://www.scipy.org/Download

numpy for python 2.5 (windows) (needed by scipy) http://numpy.scipy.org/

(optional download) matplotlib for python 2.5 (windows) http://matplotlib.sourceforge.net/

Page 3: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

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

Page 4: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

4

Add New Environment VariablesCantera needs to know where to find the Python interpreter, since it uses Python to process ‘.cti’ input files

To edit the system search path, select “System” on the Control Panel to pull up this dialogue box

Press the ‘Environment Variables’ button

Page 5: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

5

Add New Environment Variables

•New (user) Environment Variable• PYTHON_CMD C:\Python25\python.exe

Note: Check your paths • Environment Variables are Case Sensitive• Some installation locations may be different depending on the user’s choices.

Page 6: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

6

Cantera Thermo/Reaction Data

Download High Temperature (up to 6000 K) cti Files http://www.galcit.caltech.edu/EDL/public/cantera/mechs/cti/high_T_cti_files.zip

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

.cti Format Files – Thermo/Reaction Input Files for CanteraContain

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.

Creating New/Converting CHEMKIN Style Files Documented athttp://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/Windows/cti.html

Page 7: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

7

Fix the Mixmaster 1.7 BugMixmaster 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 bugTo Fix: Replace C:\Python25\Lib\site-packages\MixMaster\ThermoFrame.py

withhttp://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/Windows/ThermoFrame.py

Page 8: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

8

Testing Cantera/Python Interface

Make sure to restart your computer for the environment variables to take effect.

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)

ResultsCorrect – the comments of the tutorial print in the Python Shell windowIf NOT – Python or Cantera install is incorrect.

Page 9: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

9

Step 1

Step 2

Run Python

Page 10: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

Download SDToolbox Toolbox

http://www.galcit.caltech.edu/EDL/public/cantera/1.7/python/lin/sdt/SDToolbox.zip

Demo Scriptshttp://www.galcit.caltech.edu/EDL/public/cantera/1.7/python/lin/sdt/demos.zip

Copy SDToolbox.zip and scripts-demos.zip into its own working

directory (e.g. Desktop\cantera.shock\SDToolbox.zip and Desktop\

cantera.shock\scripts-demos.zip)

Unzip the files (right click, extract all)

10

Page 11: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

Installing The SDToolboxGo to C:\Python25\Lib\site-packages and create a directory named SDToolboxCopy the unzipped SDToolbox files from above into this newly created SDToolbox directory.

There should appear; __init__.py, CV.py, PostShock.py & Thermo.py….etc

Go up 1 directory to C:\Python25\Lib\site-packages. Use any plaintext editor to create the file SDToolbox.pth (not .txt!) Type inside this file the single line "SDToolbox" (without the quotes).

Note: Using Wordpad or Notepad works for this if you save the file as the all files type (you can also modify the file extension manually after creating the file)

Go up 1 directory to C:\Python\Lib. Go to the file site.py, right click and "Edit with IDLE". In the site.py window, go to Menu->Run->Run

Module.This should initialize the SDToolbox path into Python as shown in the Python Shell output window.

11

Page 12: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

Test with SD Toolbox Demo Scripts

Go to the demo scripts directory that you unzipped the demo files into (Desktop\cantera.shock\demos in our example)

Test the demos by "Edit with IDLE" & Run Module.

Troubleshooting Note : Cantera files are scattered into 3 places: ..\Cantera, ..\Python25\Lib\site-packages\Cantera (Mixmaster &

SDToolbox too), and Program Files\Common Files\Cantera\data (where the mechanisms are put)

12

Page 13: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

13

Tips and hints1. Version Compatibility –Python, Cantera, and

packages must be Compatible

2. numarray – Be sure to install numarray NOT numpy or Numeric

3. Python Version – Make sure you have Python 2.5 and numarray 2.5

4. Environment Variablesa) Case Sensitivity – Make sure that all paths specified truly

exist.b) USER Environment Variables (NOT SYSTEM Environment

Variables)c) Cantera 1.7.0 – TWO New Variables

– Check that PYTHON_CMD exists and is properly defined– This is DIFFERENT than the method used for Cantera 1.6

Page 14: Installing Cantera 1.7, Python 2.5,  and Python SDToolbox  for Windows

14

Tips and hints – External Documentation

5. 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 Sitehttp://www.galcit.caltech.edu/EDL/public/cantera/html/SD_Toolbox/

6. Yahoo Cantera User Forum http://groups.yahoo.com/group/cantera/