Challenge

Week 3 - Adiabatic Flame Temperature calculation

Aim:

1. To observe the effect of equivalence ratio on Adiabatic Flame Temperature in the constant volume chamber in Python and verify it with Cantera results.

2. To check the effect of heat loss on Flame temperature

3. To plot the effect of various hydrocarbon on various hydrocarbon

4. To plot the effect on a number of Carbon atoms of general alkanes on the final temperature assuming heat loss is zero.

Theory

Equivalence Ratio

It is defined as the ratio of fuel to air corresponding to actual condition before combustion to the fuel to air ratio corresponding to the stoichiometric condition of combustion of fuel.The Equivalence Ratio is designated by Φ

Adiabatic Flame Temperature

When a combustion reaction takes place energy is released to the combustion products. If no heat is lost in this process, the temperature of the combustion products is known as the Adiabatic Flame Temperature. In this there are two types of adiabatic flame temperature depending on how the process is completed:

the constant volume and constant pressure; both of which describe temperature that combustion products theoretically can reach if no energy is lost to the outside environment.

To find the AFT we need to calculate the enthalpies of reactants and products. So Newton Raphson iterative solver is used which is a method to find the root of a function tail the function reaches below a tolerance value. The function here is the difference between the enthalpies of products and reactants. The enthalpies are obtained by NASA polynomial functions.

`H/RT = a1 + a2 T /2 + a3 T^2 /3 + a4 T^3 /4 + a5 T^4 /5 + a6/T`

a1 where are the coefficients of each component with high temperature for products and low-temperature for reactants. These coefficients are available at GRI Mech 3.0 thermodynamic file

Newton Raphson method

`x_n = x_(guess) −alpha f(x_(guess))/ (f'(x_guess))`

`alpha` is the relaxation factor

`alpha`<1 solution is under relaxed takes more iteration and also prevent the diversion in the solution

`alpha`>1 solution is rigorous, leads to divergence

Case 1

Φ=1 is Stoichiometric mixture

`CH_4 + 2(O_2+3.76N_2)-->CO_2+ 2H_2O+7.52N_2`

Φ <1 Lean Mixture

`CH_4 + 2/Φ(O_2+N_2)-->(4/Φ-3)CO_2+ 2H_2O+O_2+7.52/ΦN_2+(4-4/Φ)CO`

Φ >1 Rich Mixture

`CH_4 + 2/Φ(O_2+N_2)-->CO_2+ 2H_2O+CO+7.52/ΦN_2+(2/Φ)2O_2`

Since the reaction takes place in constant volume condition in addition to enthalpies balances,the number moles balance is also considered

H_products - H_reactants-(N_products*T-N_reactants*T_stp)

The reactants are sep is STP conditions,So the temperature that is the input is 298.15K, while the output temperature that is products is calculated iteratively using Newton-Rapson method

alpha=0.2

tolerance=1e=3

The code is as follows

"""
Calculate the effect of Equivalence Ratio on AFT

CH4+2(O2+3.76N2) = CO2+2H20+7.52N2

"""
import matplotlib.pyplot as plt 
import math
import numpy as np 

def h(T,co_effs):
	"""
	function to calculate the enthalpy
	"""

	
	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 NASA polynomial of low temperature
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_l  = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02 ]

# Coefficient for NASA polynomial of high temperature
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]
CO_coeffs_h  = [2.71518561E+00,2.06252743E-03,-9.98825771E-07,2.30053008E-10,-2.03647716E-14,-1.41518724E+04,7.81868772E+00]
O2_coeffs_h  = [3.28253784E+00,1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03,5.45323129E+00]

#Universal Gas constan
R=8.314 #J/mol-k

#Defining the function for root solving by Newton Raphson method
def f(T,phi):
	"""
	Function that represent the root problem
	"""
	if (phi<=1):
		h_CO2_p   =h(T,CO2_coeffs_h) 
		h_N2_p    =h(T,N2_coeffs_h)
		h_H20_p   =h(T,H2O_coeffs_h)
		h_O2_P    =h(T,O2_coeffs_h)
		h_products= h_CO2_p + 2*h_H20_p + (7.52/phi)*h_N2_p + (2/phi-2)*h_O2_P
		n_products= 1 + 2 + 3.76*(2/phi) + (2/phi-2)

	elif(phi>1):
		h_CO2_p   =h(T,CO2_coeffs_h) 
		h_N2_p    =h(T,N2_coeffs_h)
		h_H20_p   =h(T,H2O_coeffs_h)
		h_CO_P    =h(T,CO_coeffs_h)
		h_products= (4/phi-3)*h_CO2_p + 2*h_H20_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)

	

	Tstp=298.15

	h_CH4_r = h(Tstp,CH4_coeffs_l)
	h_O2_r  = h(Tstp,O2_coeffs_l)
	H_N2_r  = h(Tstp,N2_coeffs_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)

	

	return (h_products-h_reactants-R*((n_products*T)-(n_reactants*Tstp)))

#Define the derivative of root function
def fprime(T,phi):
	return (f(T+1e-6,phi)-f(T,phi))/1e-6

T_guess =1500

tol = 1e-3
ct=0
alpha=0.2
phi=np.linspace(0.1,2,20)
T_aft_py=[]

for i in range(0,len(phi)):
	while (abs(f(T_guess,phi[i])) > tol):
		T_guess=T_guess - alpha*(f(T_guess,phi[i])/fprime(T_guess,phi[i]))
		
	
	T_aft_py.append(T_guess)


plt.plot(phi,T_aft_py,'-o',color='red')
print(ct)
print(T_aft_py)
print()
plt.xlabel('Equivalence Ratio')
plt.ylabel('Adiabatic Flame Temperature')
plt.title('AFT vs Equivalance Ratio of Methane Air')
plt.grid('ON')
plt.show()

Cantera code

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


gas = ct.Solution('gri30.xml')

T_aft_ct=[]
ct=0

phi=np.linspace(0.1,2,20)

for i in range(0,len(phi)):
	n_total = 1 + (2/phi[i]) + (7.52/phi[i])
	n_ch4 = 1/n_total 
	n_o2    = (2/phi[i])/n_total
	n_n2    = (7.52/phi[i])/n_total
	gas.TPX = 298.15,101325,{'CH4':n_ch4, 'O2':n_o2, 'N2':n_n2}
	gas.equilibrate('UV','auto')
	ct=ct+1
	print(gas.T,end="")
	
	T_aft_ct.append(gas.T)

	
print(T_aft_ct)
print(phi)
plt.plot(phi,T_aft_ct,'-o',color='blue')
plt.xlabel('Equivalance Ratio')
plt.ylabel('Adiabatic Flame Temperature')
plt.title('AFT vs Equivalance Ratio of Methane Air')
plt.grid('ON')
plt.show()

A smooth curve is obtained in from Cantera whereas from Python we got linear curve.

We can see that that from 0.1 to 0.1 AFT is consistently increasing and after that, there is a decreasing trend this because at an equivalence ratio of 1 the combustion is aggressive.

Furthermore, the AFT obtained from Cantera is lower because the Cantera works minimization of Gibbs free energy.

CASE 2.

Here constant pressure reactor is used with heat loss

The solution used here is

`CH_4 + 2(O_2+3.76N_2)-->CO_2+ 2H_2O+7.52N_2+Heat Loss*LHV`

LHV is lowering the heating value

Python Code

"""
In this programm we are going to see the effect of AFT on heat loss

CH4+2(O2+3.76N2) = CO2+2H20+7.52N2
"""
import matplotlib.pyplot as plt
import math
import numpy as np 

def h(T,co_effs):
	"""
	Functionn to evaluate the 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 NASA polynomial of low temperature
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_l  = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02 ]
# Coefficient for NASA polynomial of high temperature
N2_coeffs_h  = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+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]


R=8.314 #J/mol-k

LHV=800256 #j/m
def f(T,H_loss):
	"""
	function that represent the root problem
	"""
	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_products = h_CO2_p + 2*h_H2O_p + 7.52*h_N2_p
	 

	Tstd = 298.15
	h_CH4_r = h(Tstd,CH4_coeffs_l)
	h_O2_r  = h(Tstd,O2_coeffs_l)
	H_N2_r  = h(Tstd,N2_coeffs_l)

	H_reactants = h_CH4_r + 2*h_O2_r + 7.52*H_N2_r
	

	Loss=H_loss*LHV 

	return H_products - H_reactants +Loss


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

T_guess =1500

tol = 1e-3
ct=0
alpha=0.2
H_loss=np.arange(0,1.05, step=0.05)
T_aft_py=[]

for i in range(0,len(H_loss)):
	while (abs(f(T_guess,H_loss[i])) > tol):
		T_guess=T_guess - alpha*(f(T_guess,H_loss[i])/fprime(T_guess,H_loss[i]))
	T_aft_py.append(T_guess)

print(T_aft_py)
print(H_loss)
plt.plot(H_loss,T_aft_py,'-o',color='blue')
plt.plot(H_loss[7],T_aft_py[7],'o',color='red',label='H_loss=0.35')
plt.xlabel('Heat Loss')
plt.ylabel('Adiabatic Flame Temperature')
plt.xticks(np.arange(0, 1.05, step=0.1))
plt.yticks(np.arange(250, 2500, step=250))
plt.title('AFT vs Heat loss for methane combution')
plt.grid('ON')
plt.show()
	

It can be seen from the above figure that the trends is decreasing with increase in heat loss.

The AFT at Heat loss of 0.34 is 1680.27k.

CASE 3.

In this case, different hydrocarbons ie Alkane, Alkene, Alkyne are used to see the effect on AFT

Ethane:`C_2H_6+3.5(O_2+3.76N_2)--> 2CO_2+3H_20+13.16N_2`


Ethene:`C_2H_4+3(O_2+3.76N_2)-->2CO_2+2H_20+11.8N_2`


Ethylene:`C_2H_2+2.5(O_2+3.76N_2)-->2CO_2+H_20+9.4N_2`

The combustion takes place at constant pressure with no heat loss

Equilibrium equation for all the above reactions is

H_products-H_reactants=0

Python Code

"""
Programme for Adiabatic Flame Temperature for different types of hydrocarbon
"""
import matplotlib.pyplot as plt
import cantera as ct

"""
Program to find the Adiabatic Flame Temperature

Ethane:C2H6+3.5(O2+3.76N2) = 2CO2+3H20+13.16N2
Ethene:C2H4+3(O2+3.76N2) = 2CO2+2H20+11.8N2
Ethyene:C2H2+2.5(O2+3.76N2) = 2CO2+H20+9.4N2
"""


def h(T,co_effs):
	"""
	Functionn to evaluate the 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

C2H6_coeffs_l = [4.29142492E+00,-5.50154270E-03,5.99438288E-05,-7.08466285E-08,2.68685771E-11,-1.15222055E+04,2.66682316E+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] 
C2H2_coeffs_l = [8.08681094E-01,2.33615629E-02,-3.55171815E-05,2.80152437E-08,-8.50072974E-12,2.64289807E+04,1.39397051E+01]
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]
N2_coeffs_h  = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+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]

Tstp=298.15
def f(T,ntype):
	"""
	function that represent the root problem
	"""
	h_CO2_p = h(T,CO2_coeffs_h)
	h_N2_p  = h(T,N2_coeffs_h)
	h_H2O_p = h(T,H2O_coeffs_h)

	

	Tstd = 298.15
	h_C2H6_r  = h(Tstp,C2H6_coeffs_l)
	h_C2H4_r  = h(Tstp,C2H4_coeffs_l)
	h_C2H2_r  = h(Tstp,C2H2_coeffs_l)
	h_O2_r  = h(Tstp,O2_coeffs_l)
	h_N2_r  = h(Tstp,N2_coeffs_l)

	if ntype==1:
		x=2
		y=6
		h_fuel = h_C2H6_r
		


	elif ntype==2:
		x=2
		y=4
		h_fuel = h_C2H4_r

	elif ntype==3:
		x=2
		y=2
		h_fuel = h_C2H2_r 

	H_reactants = h_fuel + (x+(y/4))*h_O2_r + 3.76*(x+(y/4))*h_N2_r
	H_products = x*h_CO2_p + (y/2)*h_H2O_p + 3.76*(x+(y/4))*h_N2_p

	return H_products - H_reactants

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

alpha=0.2
T_guess=1500
tol=1e-3 
ntype=[1,2,3]
T_aft_py=[]

for i in range(0,len(ntype)):
	while (abs(f(T_guess,ntype[i])) > tol):
		T_guess=T_guess - alpha*(f(T_guess,ntype[i])/fprime(T_guess,ntype[i]))
		
	
	T_aft_py.append(T_guess)

print(T_aft_py)
print()
plt.bar(['Ethane ($C_2H_6$)','Ethene ($C_2H_4$)','Ethyne ($C_2H_2$)'],T_aft_py)
plt.ylabel('Adiabatic Flame Temperature')
plt.title('AFT vs Type of Hydrocarbon (Python)')
plt.show()

The results that can be inferred from the figure is that with an increase in the number of carbon bonds the higher AFT is obtained.

CASE 4

In this we will study the AFT of methane, ethane, propane, to see how AFT different with different number of carbon atoms

The stoichiometric reaction for three different carbon atoms are

Methane:`CH_4+2(O_2+3.76N_2) = CO_2+2H_2O+7.52N_2`
Ethane:`C_2H_6+3.5(O_2+3.76N_2) = 2CO_2+3H_20+13.16N_2`
Propane:`C_3H_8+5(O_2+3.76N_2) = 3CO_2+4H_2O+18.8N_2`

The combustion takes places as in a similar manner as the above CASE ie constant pressure

Python Code

"""
Programme for Adiabatic Flame Temperature for different types of hydrocarbon
"""
import matplotlib.pyplot as plt
import math

"""
Program to find the Adiabatic Flame Temperature

Methane:CH4+2(O2+3.76N2) = CO2+2H20+7.52N2
Ethane:C2H6+3.5(O2+3.76N2) = 2CO2+3H20+13.16N2
Propane:C3H8+5(O2+3.76N2) = 3CO2+4H20+18.8N2
"""


def h(T,co_effs):
	"""
	Functionn to evaluate the 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_coeffs_1  = [5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+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]
C3H8_coeffs_l = [0.93355381E+00,0.26424579E-01,0.61059727E-05,-0.21977499E-07,0.95149253E-11,-0.13958520E+05,0.19201691E+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]
N2_coeffs_h  = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+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,ntype):
	"""
	function that represent the root problem
	"""
	h_CO2_p = h(T,CO2_coeffs_h)
	h_N2_p  = h(T,N2_coeffs_h)
	h_H2O_p = h(T,H2O_coeffs_h)

	Tstp=298.15

	h_CH4_r  = h(Tstp,CH4_coeffs_1)
	h_C2H6_r  = h(Tstp,C2H6_coeffs_l)
	h_C3H8_r  = h(Tstp,C3H8_coeffs_l)
	h_O2_r  = h(Tstp,O2_coeffs_l)
	h_N2_r  = h(Tstp,N2_coeffs_l)

	if ntype==1:
		x=1
		y=4
		h_fuel = h_CH4_r
		


	elif ntype==2:
		x=2
		y=6
		h_fuel = h_C2H6_r

	elif ntype==3:
		x=3
		y=8
		h_fuel = h_C3H8_r 

	H_reactants = h_fuel + (x+(y/4))*h_O2_r + 3.76*(x+(y/4))*h_N2_r
	H_products = x*h_CO2_p + (y/2)*h_H2O_p + 3.76*(x+(y/4))*h_N2_p

	return H_products - H_reactants

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

alpha=1
T_guess=1500
tol=1e-3 
ntype=[1,2,3]
T_aft_py=[]

for i in range(0,len(ntype)):
	while (abs(f(T_guess,ntype[i])) > tol):
		T_guess=T_guess - alpha*((f(T_guess,ntype[i]))/(fprime(T_guess,ntype[i])))
		
	
	T_aft_py.append(T_guess)

print(T_aft_py)
print()
plt.bar(['Methane ($CH_4$)','Ethane ($C_2H_6$)','Propane ($C_3H_8$)'],T_aft_py)
plt.ylabel('Adiabatic Flame Temperature')
plt.title('AFT vs Type of carbon (Python)')
plt.show()

The variation of AFT with increment in carbon atoms isn't that significant, However the there is an ascending pattern with Propane having higher AFT among the three. The reason behind this is because it has more carbon which requires more enthalpy to breakdown the atoms and hence the Adiabatic flame temperature

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.