## Using Cantera for combustion problems

A previous post presented Cantera, a package for thermodynamics, kinetic and transport calculations. Cantera is a function library with object-oriented features that can be use in C++, Fortran, Matlab, and Python applications. One of its main strength may be the functions for combustion problems. In this sense it is possible to do equilibrium and kinetic calculations.

Let us talk about an easy sample which you wish to calculate the adiabatic flame temperature for stoichiometric combustion of methane using air:

$\rm{CH_4} + 2(\rm{O_2} + 3.76\rm{N_2}) \rightarrow \rm{CO_2} + 2\rm{H_2O} + 7.52\rm{N_2}$

The piece of PYTHON code below shows a short script to solve the problem. GRI30() is an object includes the GRI-Mech 3.0, a well-known optimized mechanism for natural gas combustion. This mechanism includes 53 chemical species and 325 related chemical reactions. The initial state is defined in the line 3. The function equilibrate(‘HP’) (line 4) computes the equilibrium state of object gas by minimizing the Gibbs free energy holding enthalpy and pressure constant.

1 2 3 4 5 from Cantera import * gas = GRI30() gas.set(T=300, P=OneAtm, X='CH4:1, O2:2, N2:7.52') gas.equilibrate('HP') print gas.temperature()

The line 5 returns the adiabatic flame temperature as 2225.52K (1952.37°C) that is consistent with values find on the Wikipedia and WolframAlpha.

Another usefull Cantera resource for combustion problems is the utilization of reaction mechanisms in CHEMKIN format. This a popular format to provide mechanisms in the literature. Caltech has available a list of mechanisms in CHEMKIN format here. The conversion of CK file (CHEMKIN format) to CTI file (Cantera Input) can be done with the executable called ck2cti. In addition to mechanism files you also need to have thermodynamic properties for each relating chemical species so that a sample of use would be:

ck2cti -i mech.text -t thermo.txt

That returns a single CTI file with reaction mechanisms and thermodynamic properties for all species. The thermodynamic properties file must have in NASA polynomial format such as used by CHEMKIN where an excellent reference is the Burcat’s database.