Week 3 - Adiabatic Flame Temperature calculation
Aim:To Program for Adiabatic Flame temperature inside a combustion chamber in various conditions using python and cantera.
Conditions:
1. Adiabatic flame temperature variation with Equivalence ratio (In constant volume-chamber)
2. Adiabatic flame temperature variation with Heat loss (In constant pressure-chamber)
3. Adiabatic flame temperature variation with respect to Alkane, Alkene, Alkyne
4. Adiabatic flame temperature variation with respect to a number of Carbon atom chains
Introduction:
Combustion is a process burning of fuel in a chamber to release energy.There is a need for the study of combustion in order to improve the efficiency of combustion.To study combustion first Adiabatic Flame Temperature is found. AFT is the temperature inside a combustion chamber with no heat loss when combustion takes place.So this temperature is called adiabatic Flame temperature.It is the maximum temperature that can be attained in the combustion chamber.But in the actual combustion the flame temperature is lower than the Adiabatic Flame Temperature.This is because in the actual case some heat is lost in many ways for example(through walls,through exhaust etc).AFT is one of the design criterions for the selection of material for the components and perform various simulations and make assertions.
To write a program for Finding AFT thermo30.dat file is used to get the values for the chemical component coefficients.This is provided by combustion.berkeley.edu.
Expressions used in the program
This expression is used to find the enthalpy of each gas.this expression is provided by nasa
`Enthalpy=[a1+a2.(T/2)+a3.(T^2/3)+a4.(T^3/4)+a5.(T^4/5)+a6.(T/6)).R.T`
the a1,a2..... are the coefficients of the chemical components
Newton Raphson method is used to find the roots of a polynomial.As the enthalpy expression is a polynomial newton raphson method is used.
`T= T_(guess)−alpha.[fracf(T_(guess))(f'(T_(guess)))]`
General expression for combustion equation:
`CxHy + [x + (y/4)](O2 + 3.76N2) => xCO2 + (y/2)H2O + 3.76[x+(y/4)]N2`
Case 1:Adiabatic flame temperature variation with Equivalence ratio (In constant volume-chamber)
Equivalence ratio is the ratio of amount of fuel to the amount of the oxygen it is denoted by '`phi`' .Stoichiometric combustion is a laboratory combustion in which there is optimal amount of oxygen and fuel which in turn produces the most heat possible, and highest possible combustion efficiency is achieved. There are no unburnt combustibles and no excess air at the end of the combustion.
`CH4 + 2(O2 + 3.76N2) = CO2 + 2H2O + 7.52N2`
Lean mixture(`phi<1`)
`CH4 + (2/phi)(O2 + 3.76N2) = CO2 + 2H2O + (2/phi-2)O2 + (7.52/phi)N2`
Rich mixture(`phi>1`)
`CH4 + (2/phi)(O2 + 3.76N2) = (4/phi-3)CO2 + 2H2O + (4-4/phi)CO + (7.52/phi)N2`
Depending on the equivalence ratio the Air Fuel mixture is considered as two rich fuel mixture and lean fuel mixture
- Import the require modules from the sublime text
- Assign the coefficients of the chemical components to the Vatiables a1,a2...
- Reactants are considered to be at the STP condition.
- If else condition is used to find the enthalpy of different phi values.
- The enthalpy of the components are found and the difference of enthalpies of the products and reactants are found.
- for loop is used to find the AFT of every phi value.
- while loop is used to run the loop until the tolerance value is reached.
- Newton Rahpson method is used to find AFT.
- Append command is used to save the values of the AFT to the require variable.
Cantera
- To compare the values with the newton Raphson method Cantera is used.
- The data for the gas is assigned to the gas.
- The moles of the components are defined.
- The equilibrate is set to constant volume.
- The temperature data is append to a variable.
- plotting is done using plt command.
Plot showing difference between the cantera and newton raphson plot

Max AFT is observed at the stochiometric condition`phi=1`.Max temperature seen in the newton raphson method .The max temperature in the cantera plot is less than the newton raphson plot.This is because in the cantera all the possible reactions and the components are considered so the heat is distributed to them but in the newton rapson method only few components are considered.The cantera program gives accurate results.
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.With Equivalence ratio `phi = 1`
- Import the require modules from the sublime text
- Assign the coefficients of the chemical components to the Vatiables a1,a2,...
- The procedure is same as follwed in the above case except cantera.
- Then the heat loss calculations are performed.
- Difference of enthalpies of products and reactants are added with the Heat lost.
"""Heat loss calculation"""
import matplotlib.pyplot as plt
import math
import numpy as np
R = 8.314
def h(T,co_effs):
#Assigning coefficients
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_coeffs_l = [5.14987613E+00,-1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
o2_coeffs_l = [3.78245636E+00,-2.99673416E-03, 9.84730201E-06, -9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeffs_h = [0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
n2_coeffs_l = [0.03298677E+02, 0.14082404E-02,-0.03963222E-04, 0.05641515E-07,-0.02444854E-10,-0.10208999E+04, 0.03950372E+02]
co2_coeffs_h = [3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeffs_h = [3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
def f(T,heat_loss):
Tstd = 298.15
#heat loss calculation
m = 16.04e-3
LHV = 50e6
Q = m*LHV
#reactants
h_ch4_r = h(Tstd,ch4_coeffs_l)
h_o2_r = h(Tstd,o2_coeffs_l)
h_n2_r = h(Tstd,n2_coeffs_l)
#products
h_co2_p = h(T,co2_coeffs_h)
h_n2_p = h(T,n2_coeffs_h)
h_h2o_p = h(T,h2o_coeffs_h)
H_reactants = h_ch4_r + 2*h_o2_r +7.52*h_n2_r
H_products = h_co2_p + 2*h_h2o_p +7.52*h_n2_p
loss = heat_loss*Q
return H_products - H_reactants+(loss)
def fprime(T,heat_loss):
return (f(T+1e-6,heat_loss)-f(T,heat_loss))/1e-6
T_guess =1500
tol = 1e-03
alpha=0.9
heat_loss =np.linspace(0,1,20)
print(heat_loss)
T = []
for i in range (0,len(heat_loss)):
#Newton Rahpson Method
while(abs(f(T_guess,heat_loss[i])) > tol):
T_guess = T_guess -alpha*(f(T_guess,heat_loss[i])/fprime(T_guess,heat_loss[i]))
T.append(T_guess)
print(T)
plt.plot(heat_loss,T,color='blue')
plt.plot(heat_loss[7],T[7],'*',color='red',label='Heat loss=0.35')
plt.xlabel('Heat loss factor')
plt.ylabel('Flame Temperature')
plt.title('Effect of Heat loss on AFT')
plt.grid('on')
plt.show()
Plot:

From the plot it can be seen that with the increase in the heat loss factor the flame temperature is decreasing.The heat loss increase with the increasing heat loss factor.The red star marker is the location where the heat loss factor is 0.35.The temperature of the combustion chamber increase if the heat loss is small.
Case 3: Adiabatic flame temperature variation with respect to Alkane, Alkene, Alkyne :
- In this case Alkane and alkene and alkyne are used for simulation.The only difference among them is the number of carbon atoms and hydrogen atoms.
- This will change the combustion equation,so if,elif,elif commands are used to change the equation accordingly.The enthalpy equations are written with variables as coefficients,which are given fron the condition statements.
Equations used
`C_2H_2 + 2.5(O_2+3.76N_2) => 2CO_2 + H_2O +9.4N_2` ( Ethane:`C_2H_2` )
`C_2H_4 + 3(O_2 + 3.76N_2) => 2CO_2 + 2H_2O + 11.28N_2 ( `Ethene:`C_2H_4` )
`C_2H_6 + 3.5(O_2 +3.76N_2) => 2CO_2 + 3H_2O + 13.16N_2 ( `Ethyne: `C_2H_6` )
"""Adiabatic flame temperature variation with respect to Alkane, Alkene, Alkyne"""
import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
#Assigning Variables to the coefficients
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
c2h2_coeffs_l =[8.08681094E-01,2.33615629E-02,-3.55171815E-05,2.80152437E-08,-8.50072974E-12,2.64289807E+04,1.39397051E+01]
c2h4_coeffs_l =[3.95920148E+00,-7.57052247E-03,5.70990292E-05,-6.91588753E-08,2.69884373E-11,5.08977593E+03,4.09733096E+00]
c2h6_coeffs_l =[4.29142492E+00,-5.50154270E-03,5.99438288E-05,-7.08466285E-08,2.68685771E-11,-1.15222055E+04,2.66682316E+00]
o2_coeffs_l = [3.78245636E+00,-2.99673416E-03, 9.84730201E-06, -9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeffs_l = [0.03298677E+02, 0.14082404E-02,-0.03963222E-04, 0.05641515E-07,-0.02444854E-10,-0.10208999E+04, 0.03950372E+02]
co2_coeffs_h = [3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeffs_h = [3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
n2_coeffs_h = [0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
R = 8.314
def f(T,Fuel):
Tstd = 298.15
#reactants
h_o2_r = h(Tstd,o2_coeffs_l)
h_n2_r = h(Tstd,n2_coeffs_l)
h_c2h2_r = h(Tstd,c2h2_coeffs_l)
h_c2h4_r = h(Tstd,c2h4_coeffs_l)
h_c2h6_r = h(Tstd,c2h6_coeffs_l)
#products
h_co2_p = h(T,co2_coeffs_h)
h_n2_p = h(T,n2_coeffs_h)
h_h2o_p = h(T,h2o_coeffs_h)
#Condition for varying the formula for different fuels(Akenes,Alkynes and Alkanes)
if Fuel == 1:
x = 2
y = 2
h_Fuel =h_c2h2_r
elif Fuel == 2:
x = 2
y = 4
h_Fuel =h_c2h4_r
elif Fuel == 3:
x = 2
y = 6
h_Fuel =h_c2h6_r
H_products = x*h_co2_p+(y/2)*h_h2o_p+3.76*(x+y/4)*h_n2_p
H_reactants = h_Fuel+(x+y/4)*h_o2_r+3.76*(x+y/4)*h_n2_r
return (H_products - H_reactants)
def fprime(T,Fuel):
return (f(T+1e-6,Fuel)-f(T,Fuel))/(1e-6)
T_guess = 1500
tol = 1e-3
ct=0
alpha=0.9
Fuel = [1,2,3]
Temp = []
#Newton Raphson Method
for i in range(0,len(Fuel)):
while (abs(f(T_guess,Fuel[i])) > tol):
T_guess = T_guess -alpha*(f(T_guess,Fuel[i])/fprime(T_guess,Fuel[i]))
Temp.append(T_guess)
#Bar chart
plt.bar(['Ethyne($C_2H_6$)','Ethene($C_2H_4$)','Ethane($C_2H_2$)'],Temp)
plt.ylabel('Adiabatic Flame Temperature')
plt.title('Effect of Alkenes,Alkanes,Alkyne on the AFT')
plt.show()
Plot:

Adiabatic flame temperature varies with the type of hydocarbons present. Alkanes have only single bonds between carbon atoms. Alkenes have at least one carbon-carbon double bond. Alkynes have one or more carbon-carbon triple bonds.Ethyne has achieved the highest adiabatic flame temperature.Ethane is the lowest among the three.Ethene achieve AFT which is in the between the ethane and ethyne.
Case 4: Adiabatic flame temperature variation with respect to a number of Carbon atom chains :
- In this case the number of carbon atoms are varied to see the change in the AFT. This change brings change in the other chemical comonents moles.
- This will change the combustion equation,so if,elif,elif commands are used to change the equation accordingly.The enthalpy equations are written with variables as coefficients,which are given fron the condition statements.
Equations used
`CH_4 + 2(O_2 + 3.76N_2) = CO_2 + 2H_2O + 7.52N_2`Methane:`CH_4`
`C_2H_4 + 3(O_2 + 3.76N_2) => 2CO_2 + 2H_2O + 11.28N_2`Ethene:`C_2H_4`
`C_3H_4 + 4.75(O_2 + 3.76N_2) => 3CO_2 + 3.5H_2O + 17.86N_2`I-propyl:`C_3H_7`
"""AFT variation with number of carbon atoms"""
import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
#Assigning Variables to the coefficients
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_coeffs_l = [5.14987613E+00,-1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
c2h4_coeffs_l =[3.95920148E+00,-7.57052247E-03,5.70990292E-05,-6.91588753E-08,2.69884373E-11,5.08977593E+03,4.09733096E+00]
c3h7_coeffs_l =[0.10515518E+01,0.25991980E-01,0.23800540E-05,-0.19609569E-07,0.93732470E-11,0.10631863E+05,0.21122559E+02]
o2_coeffs_l = [3.78245636E+00,-2.99673416E-03, 9.84730201E-06, -9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
n2_coeffs_l = [0.03298677E+02, 0.14082404E-02,-0.03963222E-04, 0.05641515E-07,-0.02444854E-10,-0.10208999E+04, 0.03950372E+02]
co2_coeffs_h = [3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
h2o_coeffs_h = [3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
n2_coeffs_h = [0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]
R = 8.314
def f(T,Fuel):
Tstd = 298.15
#reactants
h_o2_r = h(Tstd,o2_coeffs_l)
h_n2_r = h(Tstd,n2_coeffs_l)
h_ch4_r = h(Tstd,ch4_coeffs_l)
h_c2h4_r = h(Tstd,c2h4_coeffs_l)
h_c3h7_r = h(Tstd,c3h7_coeffs_l)
#products
h_co2_p = h(T,co2_coeffs_h)
h_n2_p = h(T,n2_coeffs_h)
h_h2o_p = h(T,h2o_coeffs_h)
#Condition for varying the formula for different number of carbon atoms
if Fuel == 1:
x = 1
y = 4
h_Fuel =h_ch4_r
elif Fuel == 2:
x = 2
y = 4
h_Fuel =h_c2h4_r
elif Fuel == 3:
x = 3
y = 7
h_Fuel =h_c3h7_r
H_products = x*h_co2_p+(y/2)*h_h2o_p+3.76*(x+y/4)*h_n2_p
H_reactants = h_Fuel+(x+y/4)*h_o2_r+3.76*(x+y/4)*h_n2_r
return (H_products - H_reactants)
def fprime(T,Fuel):
return (f(T+1e-6,Fuel)-f(T,Fuel))/(1e-6)
T_guess = 1500
tol = 1e-3
alpha=0.9
Fuel = [1,2,3]
Temp = []
#Newton Raphson Method
for i in range(0,len(Fuel)):
while (abs(f(T_guess,Fuel[i])) > tol):
T_guess = T_guess -alpha*(f(T_guess,Fuel[i])/fprime(T_guess,Fuel[i]))
Temp.append(T_guess)
#Bar chart
plt.bar(['Methane','Ethene','propyl'],Temp)
plt.ylabel('Adiabatic Flame Temperature')
plt.title('Effect of Number of Carbon atoms on the AFT')
plt.show()
Plot:
Methane:CH_4
Ethene : C_2H_4
I-propyl:C_3_H_7

There is a significant increase in the the Adiabatic Flame Temperature from 1 carbon atom to 2 carbon atoms.The increase in the Adiabatic flame temperature from ethene to I-propyl is very less.
Conclusion:
- AFT increases with the increase in the equivalence ratio until it reaches 1, after 1 the AFT drops as there will not be any oxygen left for the combustion.The heat is utilized in increasing the temperature of the fuel.
- With the increase in the heat loss the Adiabatic Flame Temperature is decreased.
- Among the alkenes,alkanes and alkynes, Alkanes have the lowest Adiabatic Flame Temperature and Alkynes have the highest flame temperature and the alkenes have the moderate temperature between the Alkanes and alkynes.
- Adiabatic Flame Temperature is significantly increased from methane(1C) to ethene but from ethene(2C) to I-propyl(3C) there is no visible increase in the AFT.