Week 3 - Adiabatic Flame Temperature calculation
Abstract:
Adiabatic flame temperature computation using different fuels in Python and Cantera.
Theory:
Adiabatic flame temperature:
In combustion process, the heat that is produced during the exothermic chemical reaction is released to product and the temperature of the products is raised. There is no possibility for dissipation of heat in the surrounding, as there is no heat loss. As a result the temperature of the product increases suddenly and produce a flame. This will heat the product gas in the flame region and temperature rise will be maximum. This highest temperature is called AFT.
The temperature rise depends upon the amount of excess air used as air fuel ratio. The flame temperature has the highest value when using oxygen gas and decrease by using air. So exact stoichiometric air is required to supply for better results. With too large amount of fuel, the flame temperature gets reduced. The flame temperature is determined from energy balance.
Combustion stoichiometry:
A stoichiometry mixture contains the exact amount of fuel and oxidizer, such that after combustion is complete all the fuel and oxidizer are consumed to product.
For a methane air combustion, the balanced stoichiometric equations is:
CH4 + 2(O2+ 3.76N2)= CO2 + 2H2O + 7.52 N2
In general, we can express it as
`C_X H_Y+(x+y/4)(O_2+3.76N_2 )=xCO_2+(y/2) H_2 O+(x+y/4) N_2`
The above formula is for a single component fuel and cannot be applied for a fuel consisting of multiple components.
The equivalence ratio (phi) is defined as the ratio of actual air-fuel ratio to the stoichiometric air-fuel ratio.
For lean mixture phi<1
For rich mixture phi>1
Case1:
1. Adiabatic flame temperature variation with Equivalence ratio (In constant volume-chamber)
Assume that methane is contained in a constant volume chamber. Write a program in Python to plot the effect of equivalence ratio on the final adiabatic flame temperature. Compare the results with Cantera. Assume that N2 is present.
PYTHON CODE:
"""
python program
ADIABATIC FLAME TEMPERATURE COMPUTATION FOR LIQUID FUEL MIXTURE
USE NASA THERMODYNAMIC POLYNOMIAL COEFFICIENTS
methane reaction mechanism
AUTHOR: SOUDIP HAZRA
"""
import matplotlib.pyplot as plt
import math
import numpy as np
import cantera as ct
phi= np.linspace(0.5,1.5,100)
def h(T, co_effs):
"""
function to evaluate enthalpy
"""
R=8.314 # j/mol-k
a1= co_effs[0]
a2= co_effs[1]
a3= co_effs[2]
a4= co_effs[3]
a5= co_effs[4]
a6= co_effs[5]
return (a1+ a2*T/2+a3*pow(T,2)/3+a4*pow(T,3)/4+a5*pow(T,4)/5+a6/T)*R*T
ch4_coeff_l=[5.14987613E+00, -1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11, -1.02466476E+04, -4.64130376E+00]
o2_coeff_l=[3.78245636E+00,-2.99673416E-03, 9.84730201E-06,-9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeff_l=[0.03298677E+02, 0.14082404E-02, -0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04 ,0.03950372E+02]
n2_coeff_h=[ 0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
co2_coeff_h=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeff_h=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
o2_coeff_h= [3.28253784E+00, 1.48308754E-03,-7.57966669E-07, 2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
co_coeff_h= [ 2.71518561E+00, 2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04, 7.81868772E+00]
def f(T, phi):
Tstp =298.15 # Temperature of the reactants in Kelvin
R= 8.314 #Jol/ mol-k
h_ch4_r = h(Tstp, ch4_coeff_l)
h_o2_r = h(Tstp, o2_coeff_l)
h_n2_r = h(Tstp, n2_coeff_l)
H_reactants = h_ch4_r + (2/phi)*h_o2_r + (7.52/phi)*h_n2_r
N_reactants = (1 + (2/phi) + (7.52/phi))*R*Tstp
h_co2_p = h(T, co2_coeff_h)
h_h2o_p = h(T, h2o_coeff_h)
h_n2_p = h(T, n2_coeff_h)
h_co_p = h(T, co_coeff_h)
h_o2_p = h(T, o2_coeff_h)
if phi >= 1:
H_products = (4/phi-3)*h_co2_p + 2*h_h2o_p + (7.52/phi)*h_n2_p + (4-4/phi)*h_co_p
N_products = ((4/phi - 3) + 2 + (7.52/phi) + (4-4/phi))*R*T
elif phi < 1:
H_products = h_co2_p + 2*h_h2o_p + (7.52/phi)*h_n2_p + (2/phi-2)*h_o2_p
N_products = (1 + 2 + (7.52/phi) + (2/phi-2))*R*T
return (H_products - H_reactants) - (N_products - N_reactants)
def fprime(T, phi):
return (f(T+1e-6,phi)-f(T,phi))/1e-6
tol= 1e-3
alpha= 0.2
Temp=[]
"""
NEWTON RAPHSON ITERATIVE TECHNIQUE"""
for i in phi:
T_guess=1500
R= 8.314
while (abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*(f(T_guess,i)/fprime(T_guess,i))
Temp.append(T_guess)
print(max(Temp))
plt.figure()
#####################################################################
"""
CANTERA module
"""
# solution using cantera
gas= ct.Solution('gri30.xml')
npoints=100
phi= np.linspace(0.5,1.5,100)
tad = np.zeros(npoints)
fuel_species='CH4'
for i in range (npoints):
gas.set_equivalence_ratio(phi[i], 'CH4', 'O2:2.0, N2:7.52')
gas.TP= 298.15, 101325
gas.equilibrate('UV','auto')
tad[i]=gas.T
print('at phi={0:10.4g}, tad={1:10.6g},'. format (phi[i], tad[i]))
plt.plot(phi,Temp,color='red',label='PYTHON')
plt.plot(phi, tad,label='CANTERA')
plt.xlabel('equivalence ratio')
plt.ylabel('Temperature')
plt.legend()
plt.grid('on')
plt.show()
Graphical comparison between Python code and cantera module:

- The highest AFT for python s found at phi =1 and for cantera module, the highest temperature lies in the phi range of 1 to 1.5.
- Practically we operate the equivalence ratio within 0.5 to 1.5.
Case 2:
Adiabatic flame temperature variation with Heat loss (In constant pressure-chamber) :
Consider a constant pressure reactor with heat loss. The reactor is initially set at STP conditions.
The heat loss should be input in your program and must be a fraction of the "maximum possible heat loss". You will control heat loss using a variable called H_loss. For example, H_loss = 0.5 would mean a heat loss that is equal to 50% of the maximum possible heat loss.
The fuel type can be a general hydrocarbon of the form CxHy. Phi and lambda = 1.0. Find the AFT of CH4 with H_loss = 0.35
PYTHON CODE:
"""
python program
ADIABATIC FLAME TEMPERATURE COMPUTATION FOR LIQUID FUEL MIXTURE
USE NASA THERMODYNAMIC POLYNOMIAL COEFFICIENTS
methane reaction mechanism
AUTHOR: SOUDIP HAZRA
"""
import matplotlib.pyplot as plt
import math
import numpy as np
import cantera as ct
"""
Reactor at constant pressure condition
HHV= 55.5 LHV=50 MW=16.04 Nfuel=1 mole Mfuel=16.04
phi=1 (stoichiometric condition)
computing the heat supplied Qs=LHV*Mfuel= 50*e6*16.04*e-3=802000
"""
x=1
y=4
R=8.314
Qs=802000
H_loss=np.linspace(0,1,21)
def h(T, co_effs):
"""
function to evaluate enthalpy
"""
R=8.314 # j/mol-k
a1= co_effs[0]
a2= co_effs[1]
a3= co_effs[2]
a4= co_effs[3]
a5= co_effs[4]
a6= co_effs[5]
return (a1+ a2*T/2+a3*pow(T,2)/3+a4*pow(T,3)/4+a5*pow(T,4)/5+a6/T)*R*T
ch4_coeff_l=[5.14987613E+00, -1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11, -1.02466476E+04, -4.64130376E+00]
o2_coeff_l=[3.78245636E+00,-2.99673416E-03, 9.84730201E-06,-9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeff_l=[0.03298677E+02, 0.14082404E-02, -0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04 ,0.03950372E+02]
n2_coeff_h=[ 0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
co2_coeff_h=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeff_h=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
o2_coeff_h= [3.28253784E+00, 1.48308754E-03,-7.57966669E-07, 2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
co_coeff_h= [ 2.71518561E+00, 2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04, 7.81868772E+00]
def f(T,H_loss):
"""
function to solve for heat balance and AFT
"""
h_co2_p = h(T, co2_coeff_h)
h_h2o_p = h(T, h2o_coeff_h)
h_n2_p = h(T, n2_coeff_h)
H_product=h_co2_p+2*h_h2o_p+7.52*h_n2_p
Tstp=298.15
h_ch4_r = h(Tstp, ch4_coeff_l)
h_o2_r = h(Tstp, o2_coeff_l)
h_n2_r = h(Tstp, n2_coeff_l)
H_reactant= h_ch4_r+ 2*h_o2_r+(2*3.76)*h_n2_r
return H_product-H_reactant+(H_loss*Qs)
def fprime(T,H_loss):
return (f(T+1e-6,H_loss)-f(T,H_loss))/1e-6
# NEWTON RAPHSON METHOD to solve for AFT until it satisfies the criteria of tolerance
tol=1e-3
alpha=0.8
Temp=[]
for i in H_loss:
T_guess=1500
R=8.314
while (abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*(f(T_guess,i)/fprime(T_guess,i))
Temp.append(T_guess)
print (Temp)
Temp_loss=Temp[7]
print(Temp_loss)
plt.plot(H_loss,Temp,color='red')
plt.xlabel('Heat loss coefficients')
plt.ylabel('Adiabatic Flame Temperature')
plt.title('Variation of AFT with heat loss')
plt.grid('on')
plt.show()
Graphical plot of varyinf AFT with heat loss coefficient factor

- AFT varies linearly with heat loss coefficient
- AFT value at 0.35 heat loss coefficient is 1678.83k
Case 3:
Adiabatic flame temperature variation with respect to Alkane, Alkene, Alkyne :
Test it only for Alk-ane, -ene and -yne variants of 2 Carbon atom chain and plot a trend. The provided therm.dat might not contain data for other alkanes, alkynes, and alkenes (in that case use Cantera). Assume no heat loss.
PYTHON CODE:
"""
python program
ADIABATIC FLAME TEMPERATURE COMPUTATION FOR LIQUID FUEL MIXTURE
USE NASA THERMODYNAMIC POLYNOMIAL COEFFICIENTS
methane reaction mechanism
AUTHOR: SOUDIP HAZRA
"""
import matplotlib.pyplot as plt
import math
import numpy as np
import cantera as ct
def h(T, co_effs):
"""
function to evaluate enthalpy
"""
R=8.314 # j/mol-k
a1= co_effs[0]
a2= co_effs[1]
a3= co_effs[2]
a4= co_effs[3]
a5= co_effs[4]
a6= co_effs[5]
return (a1+ a2*T/2+a3*pow(T,2)/3+a4*pow(T,3)/4+a5*pow(T,4)/5+a6/T)*R*T
# coefficient for alkynes, alkene and alkanes
c2h2_coeff_l=[4.14756964E+00, 5.96166664E-03,-2.37294852E-06, 4.67412171E-10,-3.61235213E-14,2.59359992E+04,-1.23028121E+00 ]
c2h4_coeff_l=[2.03611116E+00, 1.46454151E-02,-6.71077915E-06 ,1.47222923E-09,-1.25706061E-13 ,4.93988614E+03, 1.03053693E+01]
c2h6_coeff_l=[ 1.07188150E+00, 2.16852677E-02,-1.00256067E-05, 2.21412001E-09,-1.90002890E-13, -1.14263932E+04, 1.51156107E+01]
# coefficients of oxidizer elements: O2 and N2
o2_coeff_l=[3.78245636E+00,-2.99673416E-03, 9.84730201E-06,-9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeff_l=[0.03298677E+02, 0.14082404E-02, -0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04 ,0.03950372E+02]
#coefficient for products at high temperature
n2_coeff_h=[ 0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
co2_coeff_h=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeff_h=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
Tstp=298.15
H1=h(Tstp,c2h2_coeff_l)
H2=h(Tstp, c2h4_coeff_l)
H3=h(Tstp, c2h6_coeff_l)
H=[H1,H2,H3]
def f(T,H):
h_co2_p=h(T,co2_coeff_h)
h_h2o_p=h(T,h2o_coeff_h)
h_n2_p=h(T,n2_coeff_h)
h_o2_r=h(Tstp,o2_coeff_l)
h_n2_r=h(Tstp,n2_coeff_l)
if H==H1:
x=2
y=2
a=x+(y/4)
H_product=2*h_co2_p+h_h2o_p+9.4*h_n2_p
H_reactant=H1+2.5*h_o2_r+(2.5*3.76)*h_n2_r
elif H==H2:
x=2
y=4
a=x+(y/4)
H_product=2*h_co2_p+2*h_h2o_p+11.1*h_n2_p
H_reactant=H2+3*h_o2_r+3*3.76*h_n2_r
elif H==H3:
x=2
y=6
a=x+(y/4)
H_product=2*h_co2_p+3*h_h2o_p+13.16*h_n2_p
H_reactant=H3+(3.5*h_o2_r)+(3.5*3.76*h_n2_r)
return H_product-H_reactant
def fprime(T,H):
return (f(T+1e-6,H)-f(T,H))/1e-6
# NEWTON RAPHSON METHOD to solve for AFT until it satisfies the criteria of tolerance
tol=1e-3
alpha=0.8
Temp=[]
for i in H:
T_guess=1500
R=8.314
while (abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*(f(T_guess,i)/fprime(T_guess,i))
Temp.append(T_guess)
print(Temp)
plt.figure()
plt.bar(['C2H2','C2H4','C2H6'],Temp)
plt.ylabel('Adiabetic Flame Temperatur (AFT) in K')
plt.title('AFT for various hydrocarbon fuels')
plt.show()
#Cantera code
#For alkane
#C2H6 + 3.5(O2 + 3.76N2) <-> 2CO2 + 3H20 + 13.16N2
gas = ct.Solution('gri30.xml')
gas.TPX = 298.15, 101325, {'C2H6':1, 'O2':3.5, 'N2':13.16}
gas.equilibrate('HP','auto')
T_alkane = gas.T
print (T_alkane)
#For alkene
#C2H4 + 3(O2 + 3.76N2) <-> 2CO2 + 2H20 + 11.28N2
gas.TPX = 298.15, 101325, {'C2H4':1, 'O2':3, 'N2':11.28}
gas.equilibrate('HP','auto')
T_alkene = gas.T
print (T_alkene)
#For alkyne
#C2H6 + 2.5(O2 + 3.76N2) <-> 2CO2 + H20 + 9.4N2
gas.TPX = 298.15, 101325, {'C2H2':1, 'O2':2.5, 'N2':9.4}
gas.equilibrate('HP','auto')
T_alkyne = gas.T
print (T_alkyne)
Temp = [T_alkane, T_alkene, T_alkyne]
plt.figure()
plt.bar(['Ethane', 'Ethene', 'Ethyne'],Temp,color='red')
plt.ylabel('Adiabetic Flame Temperatur (AFT) in K')
plt.title('AFT for various hydrocarbon fuels')
plt.show()
Graphical plot of python code

Graphical plot of cantera module

- In cantera for all fuel types, AFT is lower because of increase in species at the product side.
Case 4:
Adiabatic flame temperature variation with respect to a number of Carbon atom chains :
For a general alkane, plot the effect of the number of carbon atoms (from 1 to 3) on the final temperature. Assume no heat loss.
PYTHON CODE:
"""
python program
ADIABATIC FLAME TEMPERATURE COMPUTATION FOR LIQUID FUEL MIXTURE FOR DIFFERENT CARBON ATOMS
USE NASA THERMODYNAMIC POLYNOMIAL COEFFICIENTS
methane reaction mechanism
AUTHOR: SOUDIP HAZRA
"""
import matplotlib.pyplot as plt
import math
import numpy as np
import cantera as ct
def h(T, co_effs):
"""
function to evaluate enthalpy
"""
R=8.314 # j/mol-k
a1= co_effs[0]
a2= co_effs[1]
a3= co_effs[2]
a4= co_effs[3]
a5= co_effs[4]
a6= co_effs[5]
return (a1+ a2*T/2+a3*pow(T,2)/3+a4*pow(T,3)/4+a5*pow(T,4)/5+a6/T)*R*T
# low temperature coefficients of reactants at stp condition
ch4_coeff_l=[5.14987613E+00, -1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11, -1.02466476E+04, -4.64130376E+00]
c2h6_coeff_l=[ 1.07188150E+00, 2.16852677E-02,-1.00256067E-05, 2.21412001E-09,-1.90002890E-13, -1.14263932E+04, 1.51156107E+01]
c3h8_coeff_l=[ 0.75341368E+01, 0.18872239E-01,-0.62718491E-05, 0.91475649E-09,-0.47838069E-13,-0.16467516E+05,-0.17892349E+02]
# oxidiser element for reactants
o2_coeff_l=[3.78245636E+00,-2.99673416E-03, 9.84730201E-06,-9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeff_l=[0.03298677E+02, 0.14082404E-02, -0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04 ,0.03950372E+02]
#coefficient for products at high temperature
n2_coeff_h=[ 0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
co2_coeff_h=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeff_h=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
Tstp=298.15
h_ch4_r=h(Tstp,ch4_coeff_l)
h_c2h6_r=h(Tstp, c2h6_coeff_l)
h_c3h8_r=h(Tstp, c3h8_coeff_l)
c_1=h_ch4_r
c_2=h_c2h6_r
c_3=h_c3h8_r
c=[c_1,c_2,c_3]
def f(T,c):
h_co2_p=h(T,co2_coeff_h)
h_h2o_p=h(T,h2o_coeff_h)
h_n2_p=h(T,n2_coeff_h)
h_o2_r=h(Tstp,o2_coeff_l)
h_n2_r=h(Tstp,n2_coeff_l)
if c==c_1:
x=1
y=2*(x+1)
a=x+(y/4)
b=y/2
H_product=x*h_co2_p+b*h_h2o_p+3.76*a*h_n2_p
H_reactant=c_1+a*h_o2_r+(a*3.76)*h_n2_r
elif c==c_2:
x=2
y=2*(x+1)
a=x+(y/4)
b=y/2
H_product=x*h_co2_p+b*h_h2o_p+3.76*a*h_n2_p
H_reactant=c_2+a*h_o2_r+(a*3.76)*h_n2_r
elif c==c_3:
x=3
y=2*(x+1)
a=x+(y/4)
b=y/2
H_product=x*h_co2_p+b*h_h2o_p+3.76*a*h_n2_p
H_reactant=c_3+a*h_o2_r+(a*3.76)*h_n2_r
return H_product-H_reactant
def fprime(T,c):
return (f(T+1e-6,c)-f(T,c))/1e-6
# NEWTON RAPHSON METHOD to solve for AFT until it satisfies the criteria of tolerance
tol=1e-3
alpha=0.8
Temp=[]
T_guess=1500
for i in c:
T_guess=1500
R=8.314
while (abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*(f(T_guess,i)/fprime(T_guess,i))
Temp.append(T_guess)
print(Temp)
plt.figure()
plt.bar(['CH4','C2H6','C3H8'],Temp)
plt.ylabel('Adiabetic Flame Temperatur (AFT) in K')
plt.title('AFT for various no of carbon atoms')
plt.show()
Graphical plot of various carbon atoms using python

- With more no of carbon atoms, it will produce more heat. Fuel with 3 carbon atoms produces slightly higher AFT values.
Conclusions:
- Python programming for computing AFT of basic methane air mixture reaction is computed and compared with cantera.
- Effect of heat loss is studied, variation of carbon atom and different fuel type is studied effectively.