Challenge

Week 3 - Adiabatic Flame Temperature calculation

Objective:

  • To calculate Adiabatic Flame Temperature for combustion with variation in equivalence ratio, type of fuel, with heat loss using the Newton-Raphson method and Cantera.

Theory:

Adiabatic flame temperature(AFT):

The final temperature of the product, When the combustion takes place heat will be released to the products in Adiabatic condition which increases the temperature.

To determine AFT using Newton raphson technique:

The Newton-Raphson method is one of the most widely used methods for root finding. It can be easily generalized to the problem of finding solutions of a system of non-linear equations, which is referred to as Newton's technique.

`x_(i+1)=x_i-(f(x_i))/(f^' (x_i))`

Equivalence ratio(Φ):

It is the ratio of Fuel air ratio of Actual fuel to Stoichiometric fuel.

rich mixture (Φ>1) - more fuel or less oxygen

lean mixture (Φ<1) - less fuel or more oxygen

Generic equation stoichiometric combustion for methane CH4 + Ar(O2 + 3.76N2) = aCO2 + bH20 + cN2 + dO2

For Stoichiometric fuel,

Number of air mole(Ar) = x+(y/4)

where,

x - number of carbon atom & y - number of hydrogen atom in HC.

'''
Adiabatic flame temperature for methane
CH4 + 2(O2 + 3.76N2) = 0.8CO2 + 1.6H20 + 7.52N2 + O2
for lean mixture
CH4 + 2/ER(O2+3.76N2) -> CO2 + 2H2O + (7.52/ER)N2 + (2/Φ- 2)O2
for rich mixture
CH4 + 2/ER(O2+3.76N2) -> ( 4/ER–3)CO2 + 2H2O + (7.52/ER)N2 + (4- 4/ER)CO
'''
import numpy as np
import matplotlib.pyplot as plt
import cantera as ct


def h(T, coeff): # fuction to determine the enthalpy
	R = 8.314 # jol/mol-k
	a1 = coeff[0]
	a2 = coeff[1]
	a3 = coeff[2]
	a4 = coeff[3]
	a5 = coeff[4]
	a6 = coeff[5]
	a7 = coeff[6]

	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,ER): # fuction to determine total enthalpy of product & reactant

	#enthalpy of reactants
	t_sat   = 298.15
	h_CH4_r = h(t_sat,CH4_coefficient_l)
	h_O2_r  = h(t_sat,O2_coefficient_l)
	h_N2_r  = h(t_sat,N2_coefficient_l)

	H_reactants = h_CH4_r + (2/ER)*(h_O2_r + 3.76*h_N2_r)	

	#enthalpy of produce
	h_CO2_p = h(T,CO2_coefficient_h)
	h_N2_p  = h(T,N2_coefficient_h)
	h_H2O_p = h(T,H2O_coefficient_h)
	#h_CH4_p = h(T,CH4_coefficient_h)
	h_O2_p  = h(T,O2_coefficient_h)
	h_CO_p  = h(T,CO_coefficient_h)

	if ER==1: #Stoichiometric 
		H_product   = h_CO2_p + 7.52*h_N2_p + 2*h_H2O_p + 0.4*h_O2_p
	else:
	 	if ER>1: #rich mixture
	 		H_product   = ((4/ER)-3)*h_CO2_p + (7.52/ER)*h_N2_p + 2*h_H2O_p + (4-(4/ER))*h_CO_p
	 	else: 	 #lean mixture
	 		H_product   = h_CO2_p + (7.52/ER)*h_N2_p + 2*h_H2O_p + ((2/ER)-2)*h_O2_p

	return H_product-H_reactants

def fprime(T,ER): #Numerical differntiation
	return (f(T+1e-6,ER)-f(T,ER))/1e-6

#Methane Coefficient from Nasa polynomials data
CH4_coefficient_l = [ 5.14987613E+00, -1.36709788E-02,  4.91800599E-05, -4.84743026E-08,  1.66693956E-11, -1.02466476E+04, -4.64130376E+00]
#Oxygen 
O2_coefficient_l  = [ 3.78245636E+00, -2.99673416E-03,  9.84730201E-06, -9.68129509E-09,  3.24372837E-12, -1.06394356E+03,  3.65767573E+00]
O2_coefficient_h  = [ 3.28253784E+00,  1.48308754E-03, -7.57966669E-07,  2.09470555E-10, -2.16717794E-14, -1.08845772E+03,  5.45323129E+00]
#Nitrogen
N2_coefficient_h  = [ 0.02926640E+02,  0.14879768E-02, -0.05684760E-05,  0.10097038E-09, -0.06753351E-13, -0.09227977E+04,  0.05980528E+02]
N2_coefficient_l  = [ 0.03298677E+02,  0.14082404E-02, -0.03963222E-04,  0.05641515E-07, -0.02444854E-10, -0.10208999E+04,  0.03950372E+02]
#Carbon-di-oxide
CO2_coefficient_h = [ 3.85746029E+00,  4.41437026E-03, -2.21481404E-06,  5.23490188E-10, -4.72084164E-14, -4.87591660E+04,  2.27163806E+00]
#Carbon-mono-oxide
CO_coefficient_h  = [ 2.71518561E+00,  2.06252743E-03, -9.98825771E-07,  2.30053008E-10, -2.03647716E-14, -1.41518724E+04,  7.81868772E+00]
#Water vapor
H2O_coefficient_h = [ 3.03399249E+00,  2.17691804E-03, -1.64072518E-07, -9.70419870E-11,  1.68200992E-14, -3.00042971E+04,  4.96677010E+00]

ER_x      = np.linspace(0.1,2,100) #Equivalence ratio     
T_guess = 2000
tol     = 1e-5
alpha   = 1
temp = []  # empty array for newton rhapson technique
temp_cantera = [] # empty array for cantera
gas = ct.Solution('gri30.xml') # centera

for ER in ER_x:
	while (abs(f(T_guess,ER))>tol ):
		T_guess = T_guess - alpha*(f(T_guess,ER)/fprime(T_guess,ER)) # newton rhapson technique
	
	gas.TPX = 298.15,101325,{"CH4":1,"O2":2/ER,"N2":(2*3.76/ER)}
	gas.equilibrate("HP","auto")	
	print("Adiabatic Flame temperature From newton rhapson technique is ",+ T_guess)
	print("Adiabatic Flame temperature From Cantera is ",+ gas.T)
	temp.append(T_guess)
	temp_cantera.append(gas.T)
		

plt.plot(ER_x,temp,color="red")
plt.plot(ER_x,temp_cantera,color="blue")
plt.xlabel("Equivalence ratio")
plt.ylabel("Adiabatic flame temperature")
plt.grid("on")
plt.title("Adiabatic flame temperature")
plt.legend(["Newton rhapson technique","cantera"])
plt.show()


Cantera, ER for max temperature is 1.04

Newton raphson technique, ER for max temperature is 1.

Heat loss:

Heat released by one mole of certain fuel can be calculated from calorific value from experimental data.

'''
Adiabatic flame temperature for methane
CH4 + 2(O2 + 3.76N2) = CO2 + 2H20 + 7.52N2 + energy + heat loss 
for 1 mole of methane 
Heat generation =  802.3 kJ/mol of methane
'''

def h(T, coeff):
	R = 8.314 # jol/mol-k
	a1 = coeff[0]
	a2 = coeff[1]
	a3 = coeff[2]
	a4 = coeff[3]
	a5 = coeff[4]
	a6 = coeff[5]
	a7 = coeff[6]

	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,Heat_loss):

	#enthalpy of reactants
	t_sat = 298.15
	h_CH4_r = h(t_sat,CH4_coefficient_l)
	h_O2_r  = h(t_sat,O2_coefficient_l)
	h_N2_r  = h(t_sat,N2_coefficient_l)

	H_reactants = h_CH4_r+2*h_O2_r+2*3.76*h_N2_r

	#enthalpy of produce
	h_CO2_p = h(T,CO2_coefficient_h)
	h_N2_p  = h(T,N2_coefficient_h)
	h_H2O_p = h(T,H2O_coefficient_h)

	H_product = h_CO2_p+7.52*h_N2_p+2*h_H2O_p
	#print(H_product-H_reactants)
	energy_1mole_CH4 = 802300

	return (H_product-H_reactants)+(energy_1mole_CH4*Heat_loss)

def fprime(T,Heat_loss):
	return (f(T+1e-6,Heat_loss)-f(T,Heat_loss))/1e-6


CH4_coefficient_l = [5.14987613E+00, -1.36709788E-02, 4.91800599E-05, -4.84743026E-08, 1.66693956E-11, -1.02466476E+04, -4.64130376E+00]

O2_coefficient_l  = [3.78245636E+00, -2.99673416E-03, 9.84730201E-06, -9.68129509E-09, 3.24372837E-12, -1.06394356E+03, 3.65767573E+00 ]

N2_coefficient_h   = [0.02926640E+02, 0.14879768E-02, -0.05684760E-05, 0.10097038E-09, -0.06753351E-13, -0.09227977E+04, 0.05980528E+02]
N2_coefficient_l   = [0.03298677E+02, 0.14082404E-02, -0.03963222E-04, 0.05641515E-07, -0.02444854E-10, -0.10208999E+04, 0.03950372E+02]

CO2_coefficient_h  = [3.85746029E+00, 4.41437026E-03, -2.21481404E-06, 5.23490188E-10, -4.72084164E-14, -4.87591660E+04, 2.27163806E+00]

H2O_coefficient_h  = [3.03399249E+00, 2.17691804E-03, -1.64072518E-07, -9.70419870E-11, 1.68200992E-14, -3.00042971E+04, 4.96677010E+00]

Heat_loss = 0.35

tolerance  = 1e-5
alpha      = 1
iterations = 0
T_guess    = 1500

while (abs(f(T_guess,Heat_loss))>tolerance):
	T_guess    = T_guess - alpha*(f(T_guess,Heat_loss)/fprime(T_guess,Heat_loss))
	iterations = iterations + 1
	print("temp:  "+str(T_guess))
	
print(iterations)
print("Adiabatic Flame temperature is {}k with heat loss of {}%. ".format(int(T_guess),Heat_loss*100))

Adiabatic flame temperature variation with respect to Alkane, Alkene, Alkyne :

Alkane: `C_n H_(2n+2 )`

Alkene: `C_n H_(2n )`

alkyne:`C_n H_(2n-2 )`

Calculation of AFT with respect to Equivalence ratio for Alkane, Alkene, Alkyne using Cantera:

import cantera as ct
import numpy as np
import matplotlib.pyplot as plt

gas = ct.Solution('gri30.xml')
ER_x = np.linspace(0.1,3,100)
alkane,alkyne,alkene = ([],[],[])

for ER in ER_x:
	gas.TPX = 298.15,101325,{"C2H2":1,"O2":2.5/ER,"N2":(2.5/ER*3.76)}
	gas.equilibrate("HP","auto")
	alkyne.append(gas.T)

	gas.TPX = 298.15,101325,{"C2H4":1,"O2":3/ER,"N2":(3/ER*3.76)}
	gas.equilibrate("HP","auto")	
	alkene.append(gas.T)

	gas.TPX = 298.15,101325,{"C2H6":1,"O2":3.5/ER,"N2":(3.5/ER*3.76)}
	gas.equilibrate("HP","auto")	
	alkane.append(gas.T)


print(len(alkyne))
plt.plot(ER_x,alkyne,color="red")
plt.plot(ER_x,alkene,color="blue")
plt.plot(ER_x,alkane,color="green")
plt.legend(["alkyne","alkene","alkane"])
plt.xlabel("Equivalence ratio")
plt.ylabel("Adiabatic flame temperature")
plt.grid("on")
plt.show()

Calculation of AFT for stoichiometric combustion using Newton raphson technique:

'''
Adiabatic flame temperature for methane
Alkane: C2H6 + 3.5(O2 + 3.76N2) = 2CO2 + 3H20 +  13.16N2 + energy 
Alkene: C2H4 + 3.0(O2 + 3.76N2) = 2CO2 + 2H20 + 11.28N2 + energy 
Alkyne: C2H2 + 2.5(O2 + 3.76N2) = 2CO2 +  H20 +  9.4N2  + energy 
'''
import matplotlib.pyplot as plt


def h(T, coeff):
	R = 8.314 # jol/mol-k
	a1 = coeff[0]
	a2 = coeff[1]
	a3 = coeff[2]
	a4 = coeff[3]
	a5 = coeff[4]
	a6 = coeff[5]
	a7 = coeff[6]

	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,Ar):
	#enthalpy of reactants
	t_sat = 298.15
	h_C2H6_r = h(t_sat,C2H6_coefficient_l)
	h_C2H4_r = h(t_sat,C2H4_coefficient_l)
	h_C2H2_r = h(t_sat,C2H2_coefficient_l)
	h_O2_r   = h(t_sat,O2_coefficient_l)
	h_N2_r   = h(t_sat,N2_coefficient_l)

	#enthalpy of produce
	h_CO2_p = h(T,CO2_coefficient_h)
	h_N2_p  = h(T,N2_coefficient_h)
	h_H2O_p = h(T,H2O_coefficient_h)

	if Ar == 3.5:
		H_reactants = h_C2H6_r + Ar*(h_O2_r + 3.76*h_N2_r)
		H_product   = 2*h_CO2_p + 13.16*h_N2_p + 3*h_H2O_p
	if Ar == 3:
		H_reactants = h_C2H4_r + Ar*(h_O2_r + 3.76*h_N2_r)
		H_product   = 2*h_CO2_p + 11.28*h_N2_p + 2*h_H2O_p
	if Ar == 2.5:
		H_reactants = h_C2H2_r + Ar*(h_O2_r + 3.76*h_N2_r)
		H_product   = 2*h_CO2_p + 9.4*h_N2_p + h_H2O_p
	#print(H_product-H_reactants)

	return H_product-H_reactants

def fprime(T,Ar):
	return (f(T+1e-6,Ar)-f(T,Ar))/1e-6

#Alkane
C2H6_coefficient_l = [ 4.29142492E+00, -5.50154270E-03,  5.99438288E-05, -7.08466285E-08,  2.68685771E-11, -1.15222055E+04,  2.66682316E+00]
#Alkene
C2H4_coefficient_l = [ 3.95920148E+00, -7.57052247E-03,  5.70990292E-05, -6.91588753E-08,  2.69884373E-11,  5.08977593E+03,  4.09733096E+00]
#Alkyne
C2H2_coefficient_l = [ 8.08681094E-01,  2.33615629E-02, -3.55171815E-05,  2.80152437E-08, -8.50072974E-12,  2.64289807E+04,  1.39397051E+01]
#Oxygen 
O2_coefficient_l   = [ 3.78245636E+00, -2.99673416E-03,  9.84730201E-06, -9.68129509E-09,  3.24372837E-12, -1.06394356E+03,  3.65767573E+00]
O2_coefficient_h   = [ 3.28253784E+00,  1.48308754E-03, -7.57966669E-07,  2.09470555E-10, -2.16717794E-14, -1.08845772E+03,  5.45323129E+00]
#Nitrogen
N2_coefficient_h   = [ 0.02926640E+02,  0.14879768E-02, -0.05684760E-05,  0.10097038E-09, -0.06753351E-13, -0.09227977E+04,  0.05980528E+02]
N2_coefficient_l   = [ 0.03298677E+02,  0.14082404E-02, -0.03963222E-04,  0.05641515E-07, -0.02444854E-10, -0.10208999E+04,  0.03950372E+02]
#Carbon-di-oxide
CO2_coefficient_h  = [ 3.85746029E+00,  4.41437026E-03, -2.21481404E-06,  5.23490188E-10, -4.72084164E-14, -4.87591660E+04,  2.27163806E+00]
#Carbon-mono-oxide
CO_coefficient_h   = [ 2.71518561E+00,  2.06252743E-03, -9.98825771E-07,  2.30053008E-10, -2.03647716E-14, -1.41518724E+04,  7.81868772E+00]
#Water vapor
H2O_coefficient_h  = [ 3.03399249E+00,  2.17691804E-03, -1.64072518E-07, -9.70419870E-11,  1.68200992E-14, -3.00042971E+04,  4.96677010E+00]


Ar = 2.5  #for 2 carbon atom Ar =  3.5, 3.0, 2.5 (alkane_C2H6, alkene_C2H4, alkyne_C2H2) 
T_guess    = 2000
tolerance  = 1e-5
alpha      = 1
iterations = 0

while (abs(f(T_guess,Ar))>tolerance):
	T_guess    = T_guess - alpha*(f(T_guess,Ar)/fprime(T_guess,Ar))
	iterations = iterations + 1
	#print(T_guess)

print(iterations)
print(T_guess)

Adiabatic flame temperature variation with respect to a number of Carbon atom chains :

import cantera as ct
import matplotlib.pyplot as plt

gas = ct.Solution('gri30.xml')
alkane = []
n_x= [1,2,3]
for n in n_x:
	x = n
	y = 2*n+2
	if n ==1:
		formula = "CH{}".format(y)
	else:
		formula = "C{}H{}".format(x,y)
	Ar = x+(y/4)
	print(formula)
	gas.TPX = 298.15,101325,{formula:1,"O2":Ar,"N2":(Ar*3.76)}
	gas.equilibrate("HP","auto")
	print(gas.T)
	alkane.append(gas.T)
print(alkane)
plt.plot(n_x,alkane)
plt.xlabel("number of carbon atom")
plt.ylabel("Adiabatic flame temperature")
plt.title("Alkane")
plt.show()

Output of AFT:

CH4
2224.6173595315754
C2H6
2258.737702688394
C3H8
2265.7012690691427

Conclusion:

  • Cantera, equivalence ratio for max temperature is 1.04, thus rich mixture gives maximum temperature. And accuracy of Newton raphson method is lower due to not including various sub-products which are small in mass fraction.
  • Higher heat loss will reduce the Adiabatic Flame Temperature and it is linear with respect to heat loss.
  • From Alkane, Alkene, Alkyne; fuel alkyne gives the high Adiabatic Flame Temperature. which conclude that higher the hydrogen atom in HC fuel will reduce AFT.
  • High carbon fuel produces more energy than low carbon fuel.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.