Project

Adiabatic Flame Temperature

Objective:

This project we were working on calculating Adiabatic Flame Temperature that rises from the combustion process using python and Cantera. Two cases were presented to find Adiabatic Flame Temperature, The first case put a volume of methane (CH4) is constant and try different Equivalent Ratios, and the Second case constant pressure with the heat loss of 35% of Methane and calculate different process -ane, -ene, -yne of Methane. Compare the final temperature between constant volume and constant pressure. These two cases were working on Cantera using the help of gas and compare temperature between them. The second part was presented to calculate the final temperature using general alkane (Cn+H2n+2) with zero heat loss.

Stochiometric condition:CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2.

Introduction:

Adiabatic Flame Temperature:

Adiabatic Flame Temperature is The final temperature is obtained after fuel is completely burned in the combustion process. There there are two types of adiabatic flame temperature depending on how the process is completed.

1)Constant volume

The constant adiabatic flame temperature at the constant volume the final temperature is obtained without any work, heat transfer or kinetic energy and potential energy. The final temperature is higher than the constant pressure process because there is no work utilize and no heat loss.

2)Constant pressure

The constant pressure process finds Adiabatic Flame Temperature with the heat loss of 35%. so Temperature is obtained lower than the Constant volume process. This is because some of the energy released during combustion goes into changing the volume of the control system.

Equivalent Ratio:

Equivalent Ration represented how Air and Fuel Mixture occurs inside the engine. These three cases were presented based on how Air /Fuel Mixture. If equivalent Ratio gets less than one, that represents a lean mixture. The temperature obtains higher, That effects will get white smoke at the exhaust. If the Equivalent Ratio equal to the one that to represent Stochiometric Ratio. If the equivalent ratio is greater than one, which is called by Rich Mixture. The temperature will get lower than the stoichiometric condition. So Adiabatic Flame Temperature depend on how Air/Fuel Mixture occurs in the Combustion process.

Equivalent Ratio < 1 # Lean Mixture

Equivalent Ratio = 1 # Stochimetric Ratio (CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2).

Equivalent Ratio > 1 # Rich Mixture

Python program and Cantera:

By using python to write the code for Adiabatic Flame Temperature In two cases Constant Volume and Constant Pressure using Newton Rapson Method. Cantera is one of the tools to solve computational combustion and chemical kinetics, By using easy to write code for Adiabatic Flame Temperature.

Adiabatic Flame Temperature at different equivalent Ratio

# adiabatic flame temperature
#calculate Enthaply using different equilent ratio values=[0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4]
#CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2
import matplotlib.pyplot as plt
import math
def h(T,coeff):
	#Define real gas constant
	R=8.314
	#Assign values to variables
	a1=coeff[0]
	a2=coeff[1]
	a3=coeff[2]
	a4=coeff[3]
	a5=coeff[4]
	a6=coeff[5]
	#Enthlpy calculated
	return (a1+ a2/2*T+ a3/3*pow(T,2)+ a4/4*pow(T,3)+ a5/5*pow(T,4)+ a6/T)*R*T

#Coefficient of Species
\'\'\' High Temperature T>1000\'\'\'
coeff_co2_h=[3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
coeff_h2o_h=[3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
coeff_n2_h=[0.02926640E+02,0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13, -0.09227977E+04, 0.05980528E+02]
coeff_o2_h=[3.28253784E+00, 1.48308754E-03, -7.57966669E-07, 2.09470555E-10, -2.16717794E-14, -1.08845772E+03, 5.45323129E+00]
coeff_co_h=[2.71518561E+00, 2.06252743E-03, -9.98825771E-07, 2.30053008E-10, -2.03647716E-14, -1.41518724E+04, 7.81868772E+00]

\'\'\'Low temperature T<1000\'\'\'
coeff_ch4_l=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
coeff_n2_l=[0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
coeff_o2_l=[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]

def f(T,phi):


	# Lean Combustion case
	if (phi <= 1):
		co2_p = h(T,coeff_co2_h)
		n2_p = h(T,coeff_n2_h)
		h2o_p = h(T,coeff_h2o_h)
		o2_p = h(T,coeff_o2_h)
		H_products = co2_p + 2*h2o_p + (7.52/phi)*n2_p + (2/phi - 2)*o2_p
		n_prod = 1 + 2 + 3.76*(2/phi) + (2/phi - 2)
	#Rich combution case

	elif (phi > 1):
		co2_p = h(T,coeff_co2_h) 
		h2o_p = h(T,coeff_h2o_h)
		co_p = h(T,coeff_co_h) 
		n2_p = h(T,coeff_n2_h)
		H_products = (4/phi - 3)*co2_p + 2*h2o_p + (4 - 4/phi)*co_p + (7.52/phi)*n2_p 
		n_prod =(4/phi - 3) + 2 + (4 - 4/phi) + (7.52/phi)

	Tstd = 298.15
	R = 8.314 #J/mol-K

	ch4_r = h(Tstd,coeff_ch4_l)
	o2_r = h(Tstd,coeff_o2_l)
	n2_r = h(Tstd,coeff_n2_l)

	H_reactants = ch4_r + (2/phi)*o2_r + (7.52/phi)*n2_r
	n_reac = 1 + (2/phi) + 3.76*(2/phi)

	return (H_products - H_reactants - R*(n_prod*T- n_reac*Tstd))
	
def fprime(T,phi):
	return ((f(T+1e-6,phi) - f(T,phi))/(1e-6))

T_guss=1500
tol=1e-3
alpha=0.2
phi=[0.5,0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4]
itr=0
for i in range(0,10):
	while (abs(f(T_guss,phi[i]))>tol):
		T_guss=T_guss-alpha*(f(T_guss,phi[i])/fprime(T_guss,phi[i]))
		itr+=1
	plt.plot(itr,T_guss,\'*\',color=\'red\')
	plt.xlabel(\'Iteration\')
	plt.ylabel(\'Temperature\')
	plt.title(\'Adiabatic Flame Temperature\',color=\'red\',fontsize=14)
	plt.text(100,2800,\'Temperature=2377.132\',color=\'blue\')
	plt.text(100,2750,\'Iteration=810\',color=\'blue\')

print(T_guss)	
print(itr)
plt.show()

Result:

\"\"

As the above graph represented Temperature obtained the range Equivalent Ratio. We have seen as the Equivalent Ratio increases The Temperature Increases still Equivalent Valve reached to one. There will get a Higher temperature of 2377.13 K, after the Equivalent Ratio increase greater than one the temperature was decreasing. This is called a Lean Mixture.

Adiabatic Flame Temperature Using CANTERA

Cantera is having a Chemical Kinetics library of python. The reason it is used for computational combustion as generall combustion more species are formed. so it\'s very difficult to calculate, here Cantera is used for easy to calculate.

TPX function is used to represent initial temperature, pressure and mole fraction of species.

gas.set_equivalence_ratio is used to initialize equivalence ratio of species.Finally, gas.equilibrate to solve temperature in the combustion chamber.

#Calculate Adiabatic Flame Temperature usine cantra
#CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2
import cantera as ct
import matplotlib.pyplot as plt
#Define gas abject
gas=ct.Solution(\'gri30.xml\')
phi=[0.5,0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4]
for i in range(0,10):
	gas.TPX=298.15,101325,{\'Ch4\':1,\'O2\':2/phi[i],\'N2\':7.52/phi[i]}
	gas.set_equivalence_ratio(phi[i],\'CH4\',\'O2:1, N2:3.76\')
	gas.equilibrate(\'HP\',\'auto\')
	print(gas.T,phi[i])
	plt.plot(phi[i],gas.T,\'*\',color=\'blue\')
	plt.text(1,1700,\'Temperature= 2224 k\')

plt.xlabel(\'Equivalent ratio\')
plt.ylabel(\'Temperature\')
plt.title(\'Adiabatic Flame Temperature Using cantera\',color=\'red\')
plt.show()
	

Result:

\"\"

The above graph represents the Adiabatic Flame Temperature Using Cantera. This Method obtained a final temperature of 2224 K. As compared to the python program had a lower temperature because the products we defined in Cantera CH4 and O2 but in python program formed more species after combustion, which will give more temperature.

Constant pressure contour using different species with Heat loss 0.35

Find Adiabatic Flame Temperature using the Constant pressure process with heta loss. This Method was calculated using different species (C2H2, C2H4, C2H6), where Carbon atoms are constant, then write the program in python and find the temperature of Each species.

# adiabatic flame temperature
#calculate Enthaply using different equilent ratio values=[0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4]
#CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2
import matplotlib.pyplot as plt
import math
def h(T,coeff):
	#Define real gas constant
	R=8.314
	#Assign values to variables
	a1=coeff[0]
	a2=coeff[1]
	a3=coeff[2]
	a4=coeff[3]
	a5=coeff[4]
	a6=coeff[5]
	#Enthlpy calculated
	return (a1+ a2/2*T+ a3/3*pow(T,2)+ a4/4*pow(T,3)+ a5/5*pow(T,4)+ a6/T)*R*T

#Coefficient of Species
\'\'\' High Temperature T>1000\'\'\'
coeff_co2_h=[3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
coeff_h2o_h=[3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
coeff_n2_h=[0.02926640E+02,0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13, -0.09227977E+04, 0.05980528E+02]
coeff_o2_h=[3.28253784E+00, 1.48308754E-03, -7.57966669E-07, 2.09470555E-10, -2.16717794E-14, -1.08845772E+03, 5.45323129E+00]
coeff_co_h=[2.71518561E+00, 2.06252743E-03, -9.98825771E-07, 2.30053008E-10, -2.03647716E-14, -1.41518724E+04, 7.81868772E+00]

\'\'\'Low temperature T<1000\'\'\'
coeff_ch4_l=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
coeff_n2_l=[0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
coeff_o2_l=[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
coeff_c2h2_l=[8.08681094E-01, 2.33615629E-02, -3.55171815E-05, 2.80152437E-08, -8.50072974E-12, 2.64289807E+04, 1.39397051E+01]
coeff_c2h4_l=[3.95920148E+00, -7.57052247E-03, 5.70990292E-05, -6.91588753E-08, 2.69884373E-11, 5.08977593E+03, 4.09733096E+00]
coeff_c2h6_l=[4.29142492E+00, -5.50154270E-03, 5.99438288E-05, -7.08466285E-08, 2.68685771E-11, -1.15222055E+04, 2.66682316E+00]

def f(T,n):
	#Enthalpy of Products
		co2_p = h(T,coeff_co2_h)
		h2o_p = h(T,coeff_h2o_h)
		n2_p = h(T,coeff_n2_h)
		#Alkane C2H6
		if (n==1):
			x=2
			y=6
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p
		#Alkene C2H4
		if (n==2):
			x=2
			y=4
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p
		#Alkyne C2H2
		if (n==3):
			x=2
			y=2
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p

	#Enthaply Reactants
		Tstd = 298.15
		R = 8.314 #J/mol-K
		H_loss=0.35
		

		ch4_r = h(Tstd,coeff_ch4_l)
		o2_r = h(Tstd,coeff_o2_l)
		n2_r = h(Tstd,coeff_n2_l)
		c2h2_r=h(Tstd,coeff_c2h2_l)
		c2h4_r=h(Tstd,coeff_c2h4_l)
		c2h6_r=h(Tstd,coeff_c2h6_l)
		#Alkane C2H6
		if (n==1):
			x=2
			y=6
			LHV=1435*pow(10,3)
			H_reactants=c2h6_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r
		#Alkene C2H4
		if (n==2):
			x=2
			y=4
			LHV=1480*pow(10,3)
			H_reactants=c2h4_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r
		#Alkyne C2H2
		if (n==3):
			x=2
			y=2
			LHV=1250*pow(10,3)
			H_reactants=c2h2_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r


		return (H_products - H_reactants + H_loss * LHV)
	
def fprime(T,n):
	return ((f(T+1e-6,n) - f(T,n))/(1e-6))

T_guss=[1500,1500,1500]
n=[1,2,3]
tol=1e-3
alpha=0.2
itr=0
for i in range(0,3):
	while (abs(f(T_guss[i],n[i]))>tol):
		T_guss[i]=T_guss[i]-alpha*(f(T_guss[i],n[i])/fprime(T_guss[i],n[i]))
		itr+=1
		print(T_guss)
		Species=[\'Alkane\',\'Alkene\',\'Alkyne\']
	if (i==0):
		plt.plot(Species[0],T_guss[i],\'*\',color=\'red\')
		plt.text(Species[0],1950,\'Alkane Temperature= 1710 K\',color=\'red\')	
			
	if (i==1):
		plt.plot(Species[1],T_guss[i],\'*\',color=\'blue\')
		plt.text(Species[0],1910,\'Alkene Temperature= 1748 K\',color=\'blue\')	
			
	if (i==2):
		plt.plot(Species[2],T_guss[2],\'*\',color=\'green\')
		plt.text(Species[0],1870,\'Alkyne Temperature= 2070 K\',color=\'green\')
			
			
		
print(itr)
plt.title(\'Adiabatic Flame Temperature\')
plt.xlabel(\'Species\')
plt.ylabel(\'Temperature\')
plt.show()

Result:

\"\"

As we have seen above the graph, we got, the temperatures of different species, where Alkyne gets a higher temperature than the other two species. Newton Rapson Method used. the main case in the process calculates H_produts-H_Reactents+LHV*H_loss

CxHy+ar(O2+3.75N2)=aCO2+bH2O+CN2

CxHy+(x+y/4)(O2+3.75N2)=xCO2+(y/2)H2O+(x+y/4)N2

Comparing general Alkane equation with heat loss zero:

# adiabatic flame temperature
#CH4 + 2(O2 + 3.76N2) = Co2 + 2H2O + 7.52N2
import matplotlib.pyplot as plt
import math
def h(T,coeff):
	#Define real gas constant
	R=8.314
	#Assign values to variables
	a1=coeff[0]
	a2=coeff[1]
	a3=coeff[2]
	a4=coeff[3]
	a5=coeff[4]
	a6=coeff[5]
	#Enthlpy calculated
	return (a1+ a2/2*T+ a3/3*pow(T,2)+ a4/4*pow(T,3)+ a5/5*pow(T,4)+ a6/T)*R*T

#Coefficient of Species
\'\'\' High Temperature T>1000\'\'\'
coeff_co2_h=[3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
coeff_h2o_h=[3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
coeff_n2_h=[0.02926640E+02,0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13, -0.09227977E+04, 0.05980528E+02]
coeff_o2_h=[3.28253784E+00, 1.48308754E-03, -7.57966669E-07, 2.09470555E-10, -2.16717794E-14, -1.08845772E+03, 5.45323129E+00]
coeff_co_h=[2.71518561E+00, 2.06252743E-03, -9.98825771E-07, 2.30053008E-10, -2.03647716E-14, -1.41518724E+04, 7.81868772E+00]

\'\'\'Low temperature T<1000\'\'\'
coeff_ch4_l=[5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
coeff_n2_l=[0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
coeff_o2_l=[3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
coeff_c3h8_l=[0.93355381E+00, 0.26424579E-01, 0.61059727E-05, -0.21977499E-07, 0.95149253E-11, -0.13958520E+05, 0.19201691E+02]
coeff_c2h4_l=[3.95920148E+00, -7.57052247E-03, 5.70990292E-05, -6.91588753E-08, 2.69884373E-11, 5.08977593E+03, 4.09733096E+00]
coeff_c2h6_l=[4.29142492E+00, -5.50154270E-03, 5.99438288E-05, -7.08466285E-08, 2.68685771E-11, -1.15222055E+04, 2.66682316E+00]

def f(T,n):
	# Enthalphy of Products
		co2_p = h(T,coeff_co2_h)
		h2o_p = h(T,coeff_h2o_h)
		n2_p = h(T,coeff_n2_h)
		# Alkane = CnH2n+2
		#CH4
		if (n==1):
			x=1
			y=4
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p
		#C2H6
		if (n==2):
			x=2
			y=6
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p
		#C3H8
		if (n==3):
			x=3
			y=8
			H_products=x*co2_p+y/2*h2o_p+3.76*(x+y/4)*n2_p

	#Enthalpy of Reactants
		Tstd = 298.15
		R = 8.314 #J/mol-K
		H_loss=0
		

		ch4_r = h(Tstd,coeff_ch4_l)
		o2_r = h(Tstd,coeff_o2_l)
		n2_r = h(Tstd,coeff_n2_l)
		c3h8_r=h(Tstd,coeff_c3h8_l)
		c2h6_r=h(Tstd,coeff_c2h6_l)
		#CH4
		if (n==1):
			x=1
			y=4
			LHV=1435*pow(10,3)
			H_reactants=ch4_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r
		#C2H6
		if (n==2):
			x=2
			y=6
			LHV=1480*pow(10,3)
			H_reactants=c2h6_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r
		#C3H8
		if (n==3):
			x=3
			y=8
			LHV=1250*pow(10,3)
			H_reactants=c3h8_r+(x+y/4)*o2_r+3.72*(x+y/4)*n2_r


		return (H_products - H_reactants + H_loss * LHV)
	
def fprime(T,n):
	return ((f(T+1e-6,n) - f(T,n))/(1e-6))

T_guss=[1500,1500,1500]
n=[1,2,3]
tol=1e-3
alpha=0.2
itr=0

for i in range(0,3):
	while (abs(f(T_guss[i],n[i]))>tol):
		T_guss[i]=T_guss[i]-alpha*(f(T_guss[i],n[i])/fprime(T_guss[i],n[i]))
		itr+=1
		print(T_guss)
		Species=[\'CH4\',\'C2H6\',\'C3H8\']
	if (i==0):
		plt.plot(Species[i],T_guss[i],\'*\',color=\'red\')
		plt.text(Species[1],2370,\'CH4 Temperature= 2325 K\',color=\'red\')
			
	if (i==1):
		plt.plot(Species[i],T_guss[i],\'*\',color=\'blue\')
		plt.text(Species[1],2365,\'C2H6 Temperature= 2379 K\',color=\'blue\')
			
	if (i==2):
		plt.plot(Species[i],T_guss[i],\'*\',color=\'green\')
		plt.text(Species[1],2360,\'C3H8 Temperature= 2392.09 K\',color=\'green\')
			
		
print(itr)
plt.title(\'Adiabatic Flame Temperature\')
plt.xlabel(\'Species\')
plt.ylabel(\'Temperature\')
plt.show()

Result:

\"\"

We were calculated the Adiabatic Flame Temperature of General Alkane (Cn+H2n+2) with Different Carbon atoms(1-3).this method got higher temperatures as compared to the pressure constant process because here zero heat loss.

Comparing Species using Cantera:

#Define different species using Cantara 
import cantera as ct
import matplotlib.pyplot as plt

gas=ct.Solution(\'gri30.xml\')
species=[\'CH4\', \'C2H6\', \'C3H8\']
phi = 1
temp = []

for specie in species:
	gas.TP = 298,101325
	gas.set_equivalence_ratio(phi, specie,\'O2:2, N2:3.76\')
	gas.equilibrate (\'UP\',\'auto\')
	temp.append(gas.T)
	print(phi, gas.T, specie)
	

plt.plot(species,temp,\'*\',color=\'red\')
plt.xlabel(\'Number of carbon atoms\')
plt.ylabel(\'Adiabatic Flame Temperature\')
plt.show()

Result:

\"\"

Conclusion:

  • At a constant volume process, The Adiabatic Flame Temperature Increases while increasing the Equivalent Ratio until Stochimetric Condition, after Stochimetric Condition Temperature will decreases.
  • Comparing temperature between Python and Cantera, The temperature is lower than python because while the generall calculates more species formed after combustion than the temperature was increased, but Cantera got low temperatures.
  • For comparing the temperatures of constant pressure and constant volume, where constant pressure got lower temperature then constant volume because the final temperature will get without any work, heat transfer or kinetic energy at constant volume.
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.