2011/03/31

How to install Cantera?

 

Note: remember to change the file access permission if you have a problem like:

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


Procedure: ct2ctml
Error:   could not convert input file to CTML.

 

=== repost from http://web.mit.edu/2.62/www/cantera/install.html ===

Installing Cantera for Windows

  1. Install Python
    • Go to python.org.
    • 32-bit: Download the most recent "Windows installer" for Python 2.6.
    • 64-bit: Download the most recent "Windows X86-64 installer" for Python 2.6.
    • Run the installer. The default installation options should be fine.
  2. Install NumPy
  3. Install Cantera
  4. Configure Matlab (optional)
    • Launch Matlab
    • Go to File-<Set Path...
    • Select Add with Subfolders
    • Browse to the folder c:\Program Files\Cantera\MATLAB\toolbox\cantera
    • Select Save, then Close.
  5. Set the environment variable PYTHON_CMD
    • This step is not necessary if you are using only the Python module.
    • Right-click My Computer, select Properties
    • Go to the Advanced tab.
    • Select Environment Variables.
    • Add a New variable with PYTHON_CMD as the name and the full path to the Python executable (e.g. c:\python26\python.exe) as the value.
  6. Create the nasa_gas.xml file
    • Option 0: At a Python prompt, type:
      import Cantera, os
      os.chdir('c:/Program Files/cantera/data')
      Cantera.Solution('nasa_gas.cti')



    • Option 1: At the Matlab prompt, type:
      cd 'c:\Program Files\cantera\data'
      Solution('nasa_gas.cti')



    • This will give an error (Procedure: xml_findByName; Error: name phase not found), but it should produce the file nasa_gas.xml in the current directory.


    • This allows you to use any of the species specified in nasa_gas.cti in any of your .cti files.




  7. Test the installation

    • Python:
      import Cantera
      gas = Cantera.IdealGasMix('gri30.cti')
      h2o = Cantera.importPhase('liquidvapor.cti','water')



    • Matlab:
      gas = IdealGasMix('gri30.cti')
      h2o = importPhase('liquidvapor.cti','water')





  8. Install Sundials (optional)

    • This step is necessary only to build and link C/C++ programs that use the Sundials integrators CVODE and IDA.


    • 32-bit Download sundials-2.4.0-x86.zip


    • 64-bit Download sundials-2.4.0-amd64.zip


    • Extract the contents of the ZIP file to the Cantera installation directory, e.g. C:\Program Files\Cantera, merging the contents of the lib and include subdirectories.