You are on page 1of 9

1D Laminar Flame

November 5, 2021

[1]: from IPython.display import Image


Image(filename='Cantera.png',width=1000,height=400)
[1]:

1 Cantera Day 7
Author: Nikhil Verma

Research Scholar

Department of Mechanical Enginnering

Indian Institute of Science

Bangalore

2 Content: 1 D Laminar Flame


2.0.1 1) Methane Air Flame
2.0.2 2) Flame Speed
2.0.3 3) Flame Thickness
2.0.4 4) Species variation along the flame
2.0.5 References:
1) https://cantera.org/science/flames.html
2) https://cantera.org/documentation/docs-2.5/sphinx/html/cython/onedim.html#freeflame

1
3) R. J. Kee, M. E. Coltrin, P. Glarborg, and H. Zhu. Chemically Reacting Flow: Theory and
Practice. 2nd Ed. John Wiley and Sons, 2017.

2.1 Laminar FLame Speed Calculation


[120]: ###############################################################
#
# ADIABATIC_FLAME - A freely-propagating, premixed flat flame
#
###############################################################
from IPython.display import display, Markdown
import cantera as ct
import numpy as np
#################################################################
gas = ct.Solution('gri30.xml')
#Parameter values :
#General
p = 1e5 # pressure
tin = 300.0 # unburned gas temperature
#Stoechiometry :
#Set gas state to that of the unburned gas
gas.TP = tin, p
gas.X = {'CH4':0.0950, 'O2':2/10.52, 'N2':2*3.76/10.52}
# - Refined grid at inlet and outlet, 6 points in x-direction :
width=0.05
#Create the free laminar premixed flame
f = ct.FreeFlame(gas, width=width)
f.inlet.T = tin
f.P = p
f.set_refine_criteria(ratio=2, slope=0.2, curve=0.4)
f.solve(loglevel=0, refine_grid=True)
#Save the results
points = f.flame.n_points
Markdown('**mixture-averaged Laminar flamespeed = {0:7f} m/s** '.format(f.
,→velocity[0]))

[120]:
mixture-averaged Laminar flamespeed = 0.390061 m/s

[119]: Markdown('**mixture-averaged flame temperature = {0:7f} K** '.format(f.T[-1]))


[119]:
mixture-averaged flame temperature = 2223.493769 K

2.2 Temperature Profile along the Flame


[73]: ## Ploting Temperature Variation along the flame
import matplotlib.pyplot as plt

plt.plot(f.grid,f.T,'-o')

2
plt.xlabel('Grid Location (m)')
plt.ylabel('Temperature (K)')
plt.show()

2.3 Major Species Variation


[34]: ## Ploting Temperature Variation along the flame
import matplotlib.pyplot as plt

CH4i=gas.species_index('CH4')
O2i=gas.species_index('O2')
N2i=gas.species_index('N2')
CO2i=gas.species_index('CO2')
COi=gas.species_index('CO')

plt.plot(f.grid,f.X[CH4i],label='$CH_4$')
plt.plot(f.grid,f.X[O2i],label='$O_2$')
plt.plot(f.grid,f.X[COi],label='$CO$')
plt.plot(f.grid,f.X[CO2i],label='$CO_2$')

3
plt.xlabel('Grid Location (m)')
plt.ylabel('Temperature (K)')
plt.legend()
plt.show()

2.4 Plotting Minor species


[44]: OHi=gas.species_index('OH')
Oi=gas.species_index('O')
Hi=gas.species_index('H')

plt.plot(f.grid,f.X[OHi],label='$OH$')
plt.plot(f.grid,f.X[Oi],label='$O$')
plt.plot(f.grid,f.X[Hi],label='$H$')

plt.xlabel('Grid Location (m)')


plt.ylabel('Temperature (K)')
plt.legend()
plt.show()

4
2.5 Laminar Flame Thickness
Laminar flame thickness can be calculated as:

2.6
Tb − Tu
δf =
max( dT
dx
)

[105]: def derivative(T,x):


length=len(T);
dTdx=(T[1:-1]-T[0:-2])/(x[1:-1]-x[0:-2])
return dTdx

dTdx=derivative(f.T,f.grid)

fig, ax1 = plt.subplots()

ax2 = ax1.twinx()
ax1.plot(f.grid, f.T, 'g-')
ax2.plot(f.grid[0:-2], dTdx, 'b-')

5
ax1.set_xlabel('Grid Location (m)')
ax1.set_ylabel('Temperature (K)', color='g')
ax2.set_ylabel('Derivative of Temperature (K/m)', color='b')
plt.show()

indMax=np.argmax(dTdx)
deltaf=(f.T[points-1]-tin)/dTdx[indMax]
Markdown('**Laminar Flame Thickness: {}** '.format(deltaf))

[105]:
Laminar Flame Thickness: 0.0004522300385946724

2.7 Variation of Laminar flame velocity with Equivalence Ratio


[70]: ###############################################################
#
# ADIABATIC_FLAME - A freely-propagating, premixed flat flame
#
###############################################################
#import :
import cantera as ct
import numpy as np

6
#################################################################
# Prepare your run
#################################################################
def OneDFlame(phi,fuel,oxidizer):
#Import gas phases with mixture transport model
gas = ct.Solution('gri30.xml')
#Parameter values :
#General
p = 1e5 # pressure
tin = 300.0 # unburned gas temperature
#Stoechiometry :
#Set gas state to that of the unburned gas
gas.TP = tin, p
gas.set_equivalence_ratio(phi, fuel, oxidizer)
#Initial grid, chosen to be 0.02cm long :
# - Refined grid at inlet and outlet, 6 points in x-direction :
initial_grid = np.array([0.0, 0.001,0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.
,→049,0.05],'d')/3

#Create the free laminar premixed flame


f = ct.FreeFlame(gas, initial_grid)
f.inlet.T = tin
f.P = p
f.set_refine_criteria(ratio=2, slope=0.2, curve=0.4)
f.solve(loglevel=0, refine_grid=True)
points = f.flame.n_points
return f.velocity[0],f.T[points-1]

fuel='CH4'
oxidizer="O2:0.21,N2:0.79"
# print('\n **************************************************')
Vel=[]
Temp=[]
for phi in np.linspace(0.7,1.6,20,endpoint=True):
u,t=OneDFlame(phi,fuel,oxidizer)
Vel.append(u)
Temp.append(t)

[70]: phi=np.linspace(0.7,1.6,20,endpoint=True)
plt.plot(phi,Vel,'-^',color="g")
plt.xlabel('Equivalence ratio ($\phi$)')
plt.ylabel('Laminar Flame Speed (K)')
plt.show()

7
2.8 Variation of Laminar flame Temperature with Equivalence Ratio
[66]: plt.plot(phi,Temp,'-o', color="red")
plt.xlabel('Equivalence ratio ($\phi$)')
plt.ylabel('Temperature (K)')
plt.show()

8
9

You might also like