Week 3 - Adiabatic Flame Temperature calculation
Aim-1)Adiabatic flame temperature variation with equivalence ration (constant volume)
2)Adiabatic flame temperature variation with equivalence ration (constant pressure)
3)Adiabatic flame temperature variation with alkane,alkene,alkyne.
Introduction
Adiabatic Flame Temperature:
- For a combustion process that takes place adiabatically with no shaft work, the temperature of products is referred to as adiabatic flame temperature can be achieved for given reactants.
- Heat transfer, incomplete combustion, and dissociation all result in lower temperatures.
- The maximum adiabatic flame temperature for given reactants occurs for stoichiometric combustion.
Stochiometric combustion:
- stoichiometric combustion is the theoretical combustion where the reactants burn completely.
- During the stoichiometric combustion maximum possible heat is generated for given reactants.
- The fuel:air or fuel:oxidiser ratio is for the stoichiometric combustion is called stoichiometric ratio.
Equivalence Ratio:
- The equivalence ratio of fuel is the ratio of [fuel:oxidiser] to [stoichiometric fuel/oxidiser].
- if phi=1 stoichiometric combustion
- phi<1 lean combustion
- phi>1 rich combustion
#Adiabatic flame temperature variation with equivalence
#ratio for CH4(constant volume)
from enum import auto
import matplotlib.pyplot as plt
import cantera as ct
import numpy as np
#defining the coefficients of reactants
CH4_coeff_r=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
O2_coeff_r =[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
N2_coeff_r =[0.03298677E+02, 0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
CO2_coeff_p=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
H2O_coeff_p=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
N2_coeff_p =[0.02926640E+02, 0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
O2_coeff_p =[3.28253784E+00, 1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
CO_coeff_p=[2.71518561E+00 ,2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04 ,7.81868772E+00]
#function to calculate enthalpy with arguments temperature and coefficient
def h(T,coeff):
#universal gas constant J/mol K
R=8.314
# extracting the coefficient for enthalpy
a1=coeff[0]
a2=coeff[1]
a3=coeff[2]
a4=coeff[3]
a5=coeff[4]
a6=coeff[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
def f(T,phi):
#calculating the enthalpy of reactant
T_r=298.15
#universal gas constant J/mol K
R=8.314
h_ch4_r=h(T_r,CH4_coeff_r)
h_O2_r=h(T_r,O2_coeff_r)
h_N2_r=h(T_r,N2_coeff_r)
h_r=h_ch4_r+h_N2_r+h_O2_r
#calculating the enthalpy of products
h_O2_p=h(T,O2_coeff_p)
h_N2_p=h(T,N2_coeff_p)
h_CO2_p=h(T,CO2_coeff_p)
h_H2O_p=h(T,H2O_coeff_p)
h_CO_p=h(T,CO_coeff_p)
h_p=h_CO2_p+h_N2_p+h_O2_p
if (phi<1):
# combustion equation for lean mixture that means for the equivalence
# ratio less than one
# combustion equation for lean mixture,extra O2 is formed on product side
# ""CH4 + (2/phi)*[O2+3.76N2]---->CO2 +2*H2O +(7.52/phi)*N2+(2/phi -2)*O2"
h_r=h_ch4_r+(7.52/phi)*h_N2_r+(2/phi)*h_O2_r
h_p=h_CO2_p+(7.52/phi)*h_N2_p+(2/phi -2)*h_O2_p+2*h_H2O_p
n_p=(1+(7.52/phi)+(2/phi -2)+2)
n_r=1+(7.52/phi)+(2/phi)
elif(phi>1):
# combustion equation for rich mixture that means for the equivalence
# ratio greater than one
# combustion equation for rich mixture,extra O2 is formed on product side
# ""CH4 + (2/phi)*[O2+3.76N2]---->(4/phi -3)CO2 +2*H2O +(7.52/phi)*N2+(4 -4/phi)*CO""
h_r=h_ch4_r+(7.52/phi)*h_N2_r+(2/phi)*h_O2_r
h_p=(4/phi -3)*h_CO2_p+(7.52/phi)*h_N2_p+(4-4/phi)*h_CO_p+2*h_H2O_p
n_r=1+(7.52/phi)+(2/phi)
n_p=(4/phi -3)+(7.52/phi)+(4-4/phi)+2
else:
# stoichiometric combustion equation for the CH4
# "" CH4 + 2*[O2+3.76N2]---->CO2 + 2*H2O + 7.52*N2 ""
h_r=h_ch4_r+(7.52)*h_N2_r+(2)*h_O2_r
h_p=h_CO2_p+(7.52)*h_N2_p+2*h_H2O_p
n_r=1+(7.52/phi)+(2/phi)
#for the reaction
#enthalpy of product and the enthalpy of reactants is same
#so h_r = h_p
return (h_r-h_p)-R*((n_r*T_r)-(n_p*T))
# defining the derivative of the function for NR method of root finding
def fprime(T,phi):
return((f(T+1e-6,phi)-f(T,phi))/1e-6)
T_guess=2000
tol=1e-6
ct=0
alpha=0.5
T=[]
phi=np.linspace(0.1,1.8,80)
for i in phi:
while(abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*((f(T_guess,i))/(fprime(T_guess,i)))
ct=ct+1
T.append(T_guess)
plt.plot(phi,T,color="red",label="NR method")
# program using the cantera
import cantera as ct
import numpy as np
T=[]
for j in phi:
n_CH4=1
n_O2=2/j
n_N2=7.52/j
n_t=n_CH4+n_N2+n_O2
gas=ct.Solution('gri30.yaml')
gas.TPX=298.15,101325,{'CH4':n_CH4/n_t,'O2':n_O2/n_t,'N2':n_N2/n_t} #X for the mole fraction
gas.equilibrate('UV','auto') # equilibrium with internal energy and specific volume fixed
T.append(gas.T)
plt.plot(phi,T,color="blue",label="cantera")
plt.xlabel("Equivalence Ratio")
plt.ylabel("Adiabatic flame temperature")
plt.legend()
plt.show()

From the plot we can see that adiabatic flame temperature for the cantera is lower than the NR method.
#Adiabatic flame temperature variation with heat loss factor
# for CH4(constant pressure)
import matplotlib.pyplot as plt
import cantera as ct
import numpy as np
#defining the coefficients of reactants
CH4_coeff_r=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
O2_coeff_r =[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
N2_coeff_r =[0.03298677E+02, 0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
CO2_coeff_p=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
H2O_coeff_p=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
N2_coeff_p =[0.02926640E+02, 0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
O2_coeff_p =[3.28253784E+00, 1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
CO_coeff_p=[2.71518561E+00 ,2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04 ,7.81868772E+00]
#function to calculate enthalpy with arguments temperature and coefficient
def h(T,coeff):
#universal gas constant J/mol K
R=8.314
# extracting the coefficient for enthalpy
a1=coeff[0]
a2=coeff[1]
a3=coeff[2]
a4=coeff[3]
a5=coeff[4]
a6=coeff[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
def f(T,HLF):
#calculating the enthalpy of reactant
T_r=298.15
h_ch4_r=h(T_r,CH4_coeff_r)
h_O2_r=h(T_r,O2_coeff_r)
h_N2_r=h(T_r,N2_coeff_r)
#calculating the enthalpy of products
h_O2_p=h(T,O2_coeff_p)
h_N2_p=h(T,N2_coeff_p)
h_CO2_p=h(T,CO2_coeff_p)
h_H2O_p=h(T,H2O_coeff_p)
# stoichiometric combustion equation for the CH4
# "" CH4 + 2*[O2+3.76N2]---->CO2 + 2*H2O + 7.52*N2 ""
h_r=h_ch4_r+(7.52)*h_N2_r+(2)*h_O2_r
h_p=h_CO2_p+(7.52)*h_N2_p+2*h_H2O_p
# calculating maximum heat loss
n_CH4=1
n_N2=7.52
n_O2=2
n_H2O=2
n_CO2=1
Qmax=n_CH4*h(T_r,CH4_coeff_r)+n_O2*h(T_r,O2_coeff_r)+n_N2*h(T_r,N2_coeff_r)-n_CO2*h(T_r,CO2_coeff_p)-n_H2O*h(T_r,H2O_coeff_p)-n_N2*h(T_r,N2_coeff_p)
Heat_loss=Qmax*HLF
return h_p-h_r+Heat_loss
def fprime(T,HLF):
return((f(T+1e-6,HLF)-f(T,HLF))/1e-6)
T_guess=5000
tol=1e-6
ct=0
alpha=0.5
T=[]
HLF=np.linspace(0.05,1,100)
for i in HLF:
while(abs(f(T_guess,i))>tol):
T_guess=T_guess-alpha*((f(T_guess,i))/(fprime(T_guess,i)))
ct=ct+1
T.append(T_guess)
print(ct)
plt.plot(HLF,T,color="red",label="NR method")
plt.show()

AFT VARIATION FOR ALKANE,ALKINE,ALKYNE
# AFT variation for the alkane,alkine,alkyne
# for 2 carbon
from turtle import color
import matplotlib.pyplot as plt
import numpy as np
CH4_coeff_r=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
O2_coeff_r =[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
N2_coeff_r =[0.03298677E+02, 0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
CO2_coeff_p=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
H2O_coeff_p=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
N2_coeff_p =[0.02926640E+02, 0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
O2_coeff_p =[3.28253784E+00, 1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
CO_coeff_p=[2.71518561E+00 ,2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04 ,7.81868772E+00]
C2H6_coeff_r=[4.29142492E+00,-5.50154270E-03 ,5.99438288E-05,-7.08466285E-08, 2.68685771E-11,-1.15222055E+04 ,2.66682316E+00]
C2H4_coeff_r=[3.95920148E+00,-7.57052247E-03 ,5.70990292E-05,-6.91588753E-08, 2.69884373E-11, 5.08977593E+03 ,4.09733096E+00]
C2H2_coeff_r=[8.08681094E-01 ,2.33615629E-02,-3.55171815E-05,2.80152437E-08,-8.50072974E-12, 2.64289807E+04,1.39397051E+01]
#function to calculate enthalpy with arguments temperature and coefficient
def h(T,coeff):
#universal gas constant J/mol K
R=8.314
# extracting the coefficient for enthalpy
a1=coeff[0]
a2=coeff[1]
a3=coeff[2]
a4=coeff[3]
a5=coeff[4]
a6=coeff[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
# general combustion equation for the combustion
# C2Hy+(2+y/4))(O2+3.76N2)------>2CO2+yH2O+(2+y/4)(3.76N2)
# calculating the enthalpy of rectants
def H(T,y):
T_r=298.15
h_C2H2_r=h(T_r,C2H2_coeff_r)
h_C2H6_r=h(T_r,C2H6_coeff_r)
h_C2H4_r=h(T_r,C2H4_coeff_r)
h_N2_r=h(T_r,N2_coeff_r)
h_O2_r=h(T_r,O2_coeff_r)
h_O2_r=h(T,O2_coeff_p)
h_N2_p=h(T,N2_coeff_p)
h_CO2_p=h(T,CO2_coeff_p)
h_H2O_p=h(T,H2O_coeff_p)
if y==2:
n_C2H2_r=1
n_C2H4_r=0
n_C2H6_r=0
n_O2_r=(2+y/4)
n_N2_r=(2+y/4)*3.76
n_H2O_p=y
n_N2_p=(2+y/4)*3.76
elif y==4:
n_C2H2_r=0
n_C2H4_r=1
n_C2H6_r=0
n_O2_r=(2+y/4)
n_N2_r=(2+y/4)*3.76
n_H2O_p=y
n_N2_p=(2+y/4)*3.76
else:
n_C2H2_r=0
n_C2H4_r=0
n_C2H6_r=1
n_O2_r=(2+y/4)
n_N2_r=(2+y/4)*3.76
n_H2O_p=y
n_N2_p=(2+y/4)*3.76
h_r=n_C2H2_r*h_C2H2_r+n_C2H4_r*h_C2H4_r+n_C2H6_r*h_C2H6_r+n_O2_r*(h_O2_r)+n_N2_r*h_N2_r
h_p=2*h_CO2_p+n_H2O_p*h_H2O_p+n_N2_p*h_N2_p
Qmax=n_C2H4_r*h(T_r,C2H4_coeff_r)+n_C2H2_r*h(T_r,C2H2_coeff_r)+n_C2H6_r*h(T_r,C2H6_coeff_r)+n_O2_r*h(T_r,O2_coeff_r)+n_N2_r*h(T_r,N2_coeff_r)-2*h(T_r,CO2_coeff_p)-n_H2O_p*h(T_r,H2O_coeff_p)-n_N2_p*h(T_r,N2_coeff_p)
Heat_loss=Qmax*0.35 # heat loss factor is 35%
return h_p-h_r+Heat_loss
def Hprime(T,y):
return (H(T+1e-6,y)-H(T,y))/1e-6
T_guess=1500
T=[]
tol=1e-6
y=[2,4,6]
for i in y:
while((abs(H(T_guess,i))>tol)):
T_guess=T_guess-H(T_guess,i)/Hprime(T_guess,i)
T.append(T_guess)
print(T)
fuel=['Ethene','ethyne','ethane']
fig,ax=plt.subplots()
bars=ax.bar(fuel,T,width=0.5,color='red')
plt.show()

AFT VARIATION FOR ALKANE OF CARBON CHAIN 1,2,3
# AFT variation for the alkane,METHANE,ETHANE,PROPANE
# for 2 carbon
from turtle import color
import matplotlib.pyplot as plt
import numpy as np
CH4_coeff_r=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
O2_coeff_r =[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
N2_coeff_r =[0.03298677E+02, 0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
CO2_coeff_p=[3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
H2O_coeff_p=[3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
N2_coeff_p =[0.02926640E+02, 0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
O2_coeff_p =[3.28253784E+00, 1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03, 5.45323129E+00]
CO_coeff_p=[2.71518561E+00 ,2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14,-1.41518724E+04 ,7.81868772E+00]
C2H6_coeff_r=[4.29142492E+00,-5.50154270E-03 ,5.99438288E-05,-7.08466285E-08, 2.68685771E-11,-1.15222055E+04 ,2.66682316E+00]
C3H8_coeff_r=[0.93355381E+00 ,0.26424579E-01, 0.61059727E-05,-0.21977499E-07 ,0.95149253E-11,-0.13958520E+05, 0.19201691E+02 ]
#function to calculate enthalpy with arguments temperature and coefficient
def h(T,coeff):
#universal gas constant J/mol K
R=8.314
# extracting the coefficient for enthalpy
a1=coeff[0]
a2=coeff[1]
a3=coeff[2]
a4=coeff[3]
a5=coeff[4]
a6=coeff[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
# general combustion equation for the combustion
# C2Hy+(2+y/4))(O2+3.76N2)------>xCO2+yH2O+(2+y/4)(3.76N2)
# calculating the enthalpy of rectants
def H(T,x):
T_r=298.15
h_CH4_r=h(T_r,CH4_coeff_r)
h_C2H6_r=h(T_r,C2H6_coeff_r)
h_C3H8_r=h(T_r,C3H8_coeff_r)
h_N2_r=h(T_r,N2_coeff_r)
h_O2_r=h(T_r,O2_coeff_r)
h_O2_r=h(T,O2_coeff_p)
h_N2_p=h(T,N2_coeff_p)
h_CO2_p=h(T,CO2_coeff_p)
h_H2O_p=h(T,H2O_coeff_p)
n_CH4_r=1
n_C3H8_r=0
n_C2H6_r=0
n_O2_r=(5+x)/2
n_N2_r=((5+x)/2)*3.76
n_H2O_p=2*x+2
n_N2_p=((5+x)/2)*3.76
n_CO2_p=x
h_r=n_CH4_r*h_CH4_r+n_C3H8_r*h_C3H8_r+n_C2H6_r*h_C2H6_r+n_O2_r*(h_O2_r)+n_N2_r*h_N2_r
h_p=n_CO2_p*h_CO2_p+n_H2O_p*h_H2O_p+n_N2_p*h_N2_p
Qmax=n_C3H8_r*h(T_r,C3H8_coeff_r)+n_CH4_r*h(T_r,CH4_coeff_r)+n_C2H6_r*h(T_r,C2H6_coeff_r)+n_O2_r*h(T_r,O2_coeff_r)+n_N2_r*h(T_r,N2_coeff_r)-n_CO2_p*h(T_r,CO2_coeff_p)-n_H2O_p*h(T_r,H2O_coeff_p)-n_N2_p*h(T_r,N2_coeff_p)
Heat_loss=Qmax*0.35 # heat loss factor is 35%
return h_p-h_r
def Hprime(T,x):
return (H(T+1e-6,x)-H(T,x))/1e-6
T_guess=1500
T=[]
tol=1e-6
x=[1,2,3]
for j in x:
while((abs(H(T_guess,j))>tol)):
T_guess=T_guess-H(T_guess,j)/Hprime(T_guess,j)
T.append(T_guess)
print(T)
fuel=['METHANE','ETHANE','PROPANE']
fig,ax=plt.subplots()
bars=ax.bar(fuel,T,width=0.5,color='red')
plt.show()
