1D Flame Speed Analysis
Aim : To find the flame speed using cantera for 1D premixed CH4-air and H2-air combustions.
Introduction :
Flame speed is the measured rate of expansion of a flame front in a combustion reaction while the autoignition temperature and ignition delay (0-D analysis) can indicate when the reaction will takes place , the flame speed (1-D analysis) can indicate how the flame propagates.The flame occupies a small portion of a combustile mixture at any one time and it is propagating towards the unburnt gases.The flame speed is the measure of the rate at which the unburnt mixture is entering the flame.Flame speed is used along with adiabatic flame to help determine the engines efficiency.


Assumptions :
- The flame speed is assumed to be laminar and turbulence effects are neglected.
- Analysis is taken in one dimension i.e flame propagation in other two directions is neglected.
- In reality the problem is of transient nature, since the flame is propagating through the domain and changes its position with time. However, it can be converted to a steady state problem by considering the problem in reference frame of the propagating flame.In this reference frame flame is considered to be stationary,while the unburnt mixture moves into the flame and the burnt gases move away from the flame. Some times the solution may not converge in a steady state in such cases cantera will automatically switch to the transient approach temporarily for the first few steps and revert to the steady state approach when a guess value is good enough for steady-state convergence.
Initial data :
The flame speed can be effected by various parameters such as Fuel type, Equivalance ratio, Initial temperature and pressure.
Considering lean mixture (phi=0.9) hence the species_dict which includes the mole fraction of the species in the mixture is modified accordingly.
Methane : `0.9 CH_4 + 2(O_2 + 3.76N_2) rarr 0.9 CO_2 + 1.8H_2O + 7.52N_2 + 0.2O_2`
Hydrogen :`1.8H_2 + O_2 + 3.76N_2 rarr 1.8H_2O + 3.76N_2 + 0.1O_2`
The initial temperature and pressure are set to 300 K and 1 atm.
Python code by considering methane as fuel :( GRI 3.0 mechanism )
'''
program to calculate premixed laminar flame speed for methane air mixture
Author : Harshith Rajamahanti
'''
import sys
import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
gas = ct.Solution('gri30.xml','gri30_mix')
Temp=300
Press=ct.one_atm
gas.TPX=Temp,Press,{'CH4':0.9,'O2':2,'N2':7.52}
width=0.03
f=ct.FreeFlame(gas,width=width)
f.set_refine_criteria(ratio=3,slope=0.07,curve=0.14)
f.solve(loglevel=1,refine_grid=True,auto=False)
plt.subplots()
plt.suptitle('1D premixed laminar flame of CH4 air mixture at 300 K and 1 atm initially')
plt.subplot(2,2,1)
plt.plot(f.grid,f.T)
plt.title('Temperature')
plt.xlabel('Distance from left (m)')
plt.ylabel('Temperature (k)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,2)
plt.plot(f.grid,f.u)
plt.title('Velocity')
plt.xlabel('Distance from left (m)')
plt.ylabel('Velocity (m/s)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,3)
plt.plot(f.grid,f.int_energy)
plt.title('Internal Energy')
plt.xlabel('Distance from left (m)')
plt.ylabel('Internal Energy (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,4)
plt.plot(f.grid,f.heat_release_rate)
plt.title('HRR')
plt.xlabel('Distance from left (m)')
plt.ylabel('Heat Release Rate (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplots()
plt.suptitle('Molefractions of species in 1D premixed laminar flame of CH4 Air Mixture')
plt.subplot(2,4,1)
plt.plot(f.grid,f.X[gas.species_index('CH4'),:])
plt.title('CH4')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,2)
plt.plot(f.grid,f.X[gas.species_index('O2'),:])
plt.title('O2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,3)
plt.plot(f.grid,f.X[gas.species_index('N2'),:])
plt.title('N2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,4)
plt.plot(f.grid,f.X[gas.species_index('CO2'),:])
plt.title('CO2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,5)
plt.plot(f.grid,f.X[gas.species_index('H2O'),:])
plt.title('H2O')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,6)
plt.plot(f.grid,f.X[gas.species_index('CO'),:])
plt.title('CO')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,7)
plt.plot(f.grid,f.X[gas.species_index('NO'),:])
plt.title('NO')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,4,8)
plt.plot(f.grid,f.X[gas.species_index('OH'),:])
plt.title('OH')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.show()
print('mixture average flame speed = %.6f m/s'%(f.u[0]))
Code explanation :
- The solution class is passed to the gas object
- Initial temperature,pressure and species mole fraction are specified.
- The object f is passed to the FreeFlame class.It is a class in cantera which is used to perform analysis of 1D premixed free flowing laminar flame of any fuel-air mixture provided.we can define the width of the grid points in the width of the domain. The governing equations of mass conservation,energy,state equations and species diffusion are solved by cantera itself. It does numerical integration using newton raphson solver to solve coupled Differential Equations.The solver first solves the domain based on coarse grid and then it refines it based on slope and curvature parameters of the solution variables.The refinement is done till the tolerance criteria is met.
- Now gas object and width parameter are passed to FreeFlame.
- The grid refine parameters are set using 'set_refine_criteria' method.Here we set the ratio as 3 and slope as 0.03 and curve as 0.14.
- ratio is the parameter limiting the lengths of 2 adjacent elements
- slope is the parameter limiting the change in values of solution variables for each node pairs
- curve parameter limits the rate of change of slope
- Now cantera solves by using the command f.solve and the results are plotted.
Results :

The graphs denotes the variation of variables(Temperature, velocity, Internal energy, HRR) along the length of the domain 0.03 m. The starting point of the graph (x=0) indicates the flame (since we are solving the equations based on flame reference frame) the unburnt gases enter the flame at the temperature 300 K. As they move into the flame the combustion reaction occurs which increases the temperature and hence the sudden peak in the temperature and velocity.Because of the reference frame, flame speed is the velocity at the starting point which can be accessed as f.u[0]. From internal energy and HRR plots the main reaction releases most of the heat and some minor rections release the remaining heat.

From species mole fraction plot it is observed that reactants(CH4,O2) having a drop in mole fraction at flame point and produces (CO2,H2O).The CO mole fractions first increase and then decreases.The reason for this first oxidation of carbon atoms which gives CO and then CO forms from CO2.The curves N2,NO,OH are explained from the zeldovich mechanism which talks about the formation of NO from OH and N2.

The grid refinement was implemented till there were 155 nodes in the domain.The code stopped till this point because the refinement criteria was fulfilled.
Python code by considering hydrogen as fuel :( H2 mechanism )
'''
program to calculate premixed laminar flame speed for Hydrogen air mixture using Hydrogen mechamism file
Author : Harshith Rajamahanti
'''
import sys
import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
gas = ct.Solution('H2_mech.cti')
Temp=300
Press=ct.one_atm
gas.TPX=Temp,Press,{'H2':1.8,'O2':1,'N2':3.76}
width=0.03
f=ct.FreeFlame(gas,width=width)
f.set_refine_criteria(ratio=3,slope=0.07,curve=0.14)
f.solve(loglevel=1,refine_grid=True,auto=False)
plt.subplots()
plt.suptitle('1D premixed laminar flame of H2 air mixture at 300 K and 1 atm initially')
plt.subplot(2,2,1)
plt.plot(f.grid,f.T)
plt.title('Temperature')
plt.xlabel('Distance from left (m)')
plt.ylabel('Temperature (k)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,2)
plt.plot(f.grid,f.u)
plt.title('Velocity')
plt.xlabel('Distance from left (m)')
plt.ylabel('Velocity (m/s)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,3)
plt.plot(f.grid,f.int_energy)
plt.title('Internal Energy')
plt.xlabel('Distance from left (m)')
plt.ylabel('Internal Energy (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,4)
plt.plot(f.grid,f.heat_release_rate)
plt.title('HRR')
plt.xlabel('Distance from left (m)')
plt.ylabel('Heat Release Rate (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplots()
plt.suptitle('Molefractions of species in 1D premixed laminar flame of H2 Air Mixture')
plt.subplot(2,2,1)
plt.plot(f.grid,f.X[gas.species_index('H2'),:])
plt.title('H2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,2)
plt.plot(f.grid,f.X[gas.species_index('O2'),:])
plt.title('O2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,3)
plt.plot(f.grid,f.X[gas.species_index('N2'),:])
plt.title('N2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,4)
plt.plot(f.grid,f.X[gas.species_index('H2O'),:])
plt.title('H2O')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.figure(3)
plt.plot(f.grid,f.X[gas.species_index('CO2'),:])
plt.title('CO2 variation along the length of domain')
plt.xlabel('Distance from left (m)')
plt.ylabel('Mole fraction of CO2')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.show()
print('mixture average flame speed = %.6f m/s'%(f.u[0]))
Results :

The final temperature of flame is nearly 2275 K. The internal energy plot increases by small amount and then decreases.This must be happening due to some reaction containing O2,because it is observed in the plot below that O2 mole fraction for increases and then decreases.The velocity and HRR are higher when compared to methane


The fuel H2 is seen to enter from left end and its molefraction decreases to approx 0.There is drop in mole fraction of O2 and rise in mole fraction of H2O.There is unexplained increase in molefraction of N2 which can happen due to reduction in total number of moles(of all species) which would mathematically represented as rise in mole fraction of N2.Since H2 and O2 moles forms H2O,there is apparent increase in moles of N2,but in principal N2 didn't increase at all.

The solver refined the points in grid till there were 122 points.
Python code by considering hydrogen as fuel :( GRI 3.0 mechanism )
'''
program to calculate premixed laminar flame speed for Hydrogen air mixture using GRI 3.0 mechamism file
Author : Harshith Rajamahanti
'''
import sys
import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
gas = ct.Solution('gri30.xml','gri30_mix')
Temp=300
Press=ct.one_atm
gas.TPX=Temp,Press,{'H2':1.8,'O2':1,'N2':3.76}
width=0.03
f=ct.FreeFlame(gas,width=width)
f.set_refine_criteria(ratio=3,slope=0.07,curve=0.14)
f.solve(loglevel=1,refine_grid=True,auto=False)
plt.subplots()
plt.suptitle('1D premixed laminar flame of H2 air mixture at 300 K and 1 atm initially')
plt.subplot(2,2,1)
plt.plot(f.grid,f.T)
plt.title('Temperature')
plt.xlabel('Distance from left (m)')
plt.ylabel('Temperature (k)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,2)
plt.plot(f.grid,f.u)
plt.title('Velocity')
plt.xlabel('Distance from left (m)')
plt.ylabel('Velocity (m/s)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,3)
plt.plot(f.grid,f.int_energy)
plt.title('Internal Energy')
plt.xlabel('Distance from left (m)')
plt.ylabel('Internal Energy (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,4)
plt.plot(f.grid,f.heat_release_rate)
plt.title('HRR')
plt.xlabel('Distance from left (m)')
plt.ylabel('Heat Release Rate (j/kmol)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplots()
plt.suptitle('Molefractions of species in 1D premixed laminar flame of H2 Air Mixture')
plt.subplot(2,2,1)
plt.plot(f.grid,f.X[gas.species_index('H2'),:])
plt.title('H2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,2)
plt.plot(f.grid,f.X[gas.species_index('O2'),:])
plt.title('O2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,3)
plt.plot(f.grid,f.X[gas.species_index('N2'),:])
plt.title('N2')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.subplot(2,2,4)
plt.plot(f.grid,f.X[gas.species_index('H2O'),:])
plt.title('H2O')
plt.xlabel('Distance from left (m)')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.figure(3)
plt.plot(f.grid,f.X[gas.species_index('CO2'),:])
plt.title('CO2 variation along the length of domain')
plt.xlabel('Distance from left (m)')
plt.ylabel('Mole fraction of CO2')
plt.grid(which='major')
plt.minorticks_on()
plt.grid(which='minor',alpha=0.2)
plt.show()
print('mixture average flame speed = %.6f m/s'%(f.u[0]))
Results :




The results obtaines using GRI 3.0 mechanism is also similar to the H2 mechanism file.The only visible effect is in velocity of flame. GRI mechanism file gives CO2 as minor species where as in H2 mechanism file CO2 is not present at all as a product.GRI mechanism has been optimised for the combustion of hydro carbons hence a seperate file which includes the optimized hydrogen mechanism is to be used.
Conclusions :
- The flame speed for hydrogen is more than methane which indicates that hydrogen fuel diffuses faster.
- Hydrogen combustion occurs more aggresively than the methane combustion
- In methane mechanism there is an increase in Concentration of CO2 where as in hydrogen mechanism there is no CO2 on the products side.
- The width parameter has an affect on solution. The width is actually the length of domain. If width is increased length of domain also increases and flame will be visible for small part of domain.If width is decreased the length of domain will be smaller and a magnified image of flame is observed.The flame thickness would stay the same in both cases. If width is higher than required more time is need for computing the solution and if the width is small important flow physics cannot be captured.The flame can always be starting from 1/3 of the domain length and ending of flame depends on flame thickness.

H2_mech.cti file :
https://drive.google.com/open?id=19ObDGYD_T2grW1cs17E8Fe6SqaMkl6nO
Download the file and paste in the location you have installed Cantera under Cantera>Data,
Reference :
Fundamentals of combustion process by sara mcalister
- Giovanni FilomenoHi Rajamahanti! Thanks for sharing your code and, in particular, for the explanation of the latter. I was wondering if you can help me with my problem. I am trying to calculate laminar flame speed of a methane-hydrogen-air mixture (20% H2 by volume) for a varying equivalence ratio (and fixed temperature and pressure) in Cantera. My problem is how to define the molar (or mass) fractions of H2 and CH4 accordingly to the given equivalence ratio. Of course I can write the reaction of combustion of (H2+CH4), balance it and find the molar fractions by myself but I was wondering if there is a way to define the fuel as a mixture of (H2+CH4) and to let Cantera calculate the molar fractions. I apologise if the question sounds banal but I'm still learning how to use Cantera. Thank you in advance for yuor kind answer and for the valuable contents. Best regards Giovanni