Published by Rodolfo Rodrigues on March 20th, 2012 at 2:20 pm in Didactic application, General, HOW-TO, Math package, Process simulation, Softwares with 1 comment
Tagged with Cantera, chemical equilibrium, combustion, object-oriented tool, python
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:
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.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()
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.