Cantera

From ScientificComputing
Jump to: navigation, search

Please note that this application page is referring to the old CentOS software stack which is obsolete and does not work any more with the new Ubuntu setup. You can find an overview on the Ubuntu software stack on this wiki page.

Category

Chemistry, chemical kinetics, thermodynamics

Description

Cantera is a suite of object-oriented software tools for problems involving chemical kinetics, thermodynamics, and/or transport processes. Cantera provides types (or classes) of objects representing phases of matter, interfaces between these phases, reaction managers, time-dependent reactor networks, and steady one-dimensional reacting flows. Cantera is currently used for applications including combustion, detonations, electrochemical energy conversion and storage, fuel cells, batteries, aqueous electrolyte solutions, plasmas, and thin film deposition.

Available versions (Euler, old software stack)

Legacy versions Supported versions New versions
2.1.2, 2.3.0

Please note that this page refers to installations from the old software stack. There are two software stacks on Euler. Newer versions of software are found in the new software stack.

Environment modules (Euler, old software stack)

Version Module load command Additional modules loaded automatically
2.1.2 module load legacy gcc/4.8.2 open_mpi/1.6.5 python/2.7.6 boost/1.55.0 matlab/8.2 cantera/2.1.2 openblas/0.2.13_seq
2.3.0 module load new gcc/4.8.2 boost/1.59.0 matlab/9.1 cantera/2.3.0 openblas/0.2.13_seq python/2.7.12

Please note that this page refers to installations from the old software stack. There are two software stacks on Euler. Newer versions of software are found in the new software stack.

Interactive session

You can use the Python interface of cantera interactively on a login node. For this, you first need to load all the required modules. After starting the Python interpreter with the command python, you can import the cantera package:
[leonhard@euler02 ~]$ module load legacy gcc/4.8.2 open_mpi/1.6.5 python/2.7.6 boost/1.55.0 matlab/8.2 cantera/2.1.2
Autoloading openblas/0.2.13_seq
[leonhard@euler02 ~]$ python
Python 2.7.6 (default, Jan 20 2014, 14:02:29) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cantera
>>> cantera.__version__
'2.1.2'
Please note that can only use interactive cantera session for small pre- and post-processing steps. All other computations need to be submitted as jobs through the batch system.

How to submit a job

You can submit a Cantera Python script (test.py) in batch mode with the following command:
sbatch [Slurm options] --wrap="python test.py"
Here you need to replace [Slurm options] with Slurm parameters for the resource requirements of the job. Please find a documentation about the parameters of sbatch on the wiki page about the batch system.

Example

As an example for using Cantera, we are creating an object that represents a phase of matter and print out its properties. For this, we are using the Python interface of Cantera and run the script test.py.
[leonhard@euler02 ~]$ cat test.py
#!/usr/bin/env python

import cantera as ct

gas1 = ct.Solution('gri30.xml')
gas1()
[leonhard@euler02 ~]$ module load legacy gcc/4.8.2 open_mpi/1.6.5 python/2.7.6 boost/1.55.0 matlab/8.2 cantera/2.1.2
Autoloading openblas/0.2.13_seq
[leonhard@euler02 ~]$ bsub -n 1 -W 0:10 -R "rusage[mem=100]" "python test.py"
Generic job.
Job <35413388> is submitted to queue <normal.4h>.
[leonhard@euler02 ~]$ bjobs
JOBID      USER       STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
35413388   leonhard   PEND  normal.4h  euler02                 *n test.py Jan 10 14:16
[leonhard@euler02 ~]$ bjobs
JOBID      USER       STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
35413388   leonhard   RUN   normal.4h  euler02     e1348       *n test.py Jan 10 14:16
[leonhard@euler02 ~]$ bjobs
No unfinished job found
[leonhard@euler02 ~]$ grep -A 14 gri30 lsf.o35413388 
  gri30:
 
       temperature             300  K
          pressure          101325  Pa
           density       0.0818891  kg/m^3
  mean mol. weight         2.01588  amu
 
                          1 kg            1 kmol
                       -----------      ------------
          enthalpy         26470.1        5.336e+04     J
   internal energy    -1.21087e+06       -2.441e+06     J
           entropy         64913.9        1.309e+05     J/K
    Gibbs function    -1.94477e+07        -3.92e+07     J
 heat capacity c_p         14311.8        2.885e+04     J/K
 heat capacity c_v         10187.3        2.054e+04     J/K
The resource usage summary of the job can be found in the LSF log file.

License information

Cantera license

Links

http://www.cantera.org/docs/sphinx/html/index.html

https://en.wikipedia.org/wiki/Cantera_(software)
https://github.com/Cantera/cantera
https://sourceforge.net/projects/cantera