Cantera Open-Source

Adiabatic Flame Temperature Calculation using Cantera Open-Source

Obejective-To Calculate the Adiabatic Flame Temperature.

Case-1:Determine the effect of equivalence ratio on AFT in a constant volume chamber for methane. Write a program in Python to plot the effect of equivalence ratio on the final adiabatic flame temperature. Compare the results with Cantera.

Case-2:(i)To calculate the AFT for methane combustion with heat loss in a constant pressure chamber.The heat loss should be an input in your program and must be a fraction of the “maximum possible heat loss”. You will control heat loss using a variable called H_loss. Example, H_loss = 0.5 would mean a heat loss that is equal to 50% of the maximum possible heat loss.

(ii)Test it only for -ane, -ene and -yne variants of 2 Carbon atom chain and plot a trend.

(iii)For a general alkane, plot the effect of the number of carbon atoms (from 1 to 3) on the final temperature.H_loss = 0

Theory:

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.”

There are two types of adiabatic flame temperature depending on how the process is completed i.e 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.

Significance:

1. It is used to characterize the quality of fuel.

2. It is used to determine suitability of fuel for an application.

3. The is adiabatic flame temperature is very important in design and scale-up procedures wherever      heat transfer is a significant consideration.

The concept of Air-Fuel Mixture:

Stoichiometric combustion:The air fuel ratio for complete combustion is called stoichiometric air fuel ratio.

Lean combustion:If the amount of air is more than that required for complete combustion,there will be excess air after combustion. This is called lean combustion.In a lean combustion, the air fuel ratio is greater than the stoichiometric
air fuel ratio.

Rich combustion:If the amount of air is less than that required for complete combustion,part of the fuel would not be fully oxidized such that either there will be excess fuel left after combustion or there will be incomplete combustion products, such as carbon monoxide or unburned hydrocarbon.

Equivalence ratio:The fuel–air equivalence ratio, ϕ(phi), of a system is defined as the ratio of the fuel-to-oxidizer ratio to the stoichiometric fuel-to-oxidizer ratio.

ϕ=(mfuelmair)actual(mfuelmair)soich

ϕ<1=lean combustion

ϕ=1=stoichiometric combustion

ϕ>1=rich combustion

General equation for any hydrocarbon combustion:

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

Chemical reactions for Combustion of Methane:

Stoichometric combustion

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

Lean combustion

CH4 + (2/phi)(O2 +3.76N2) = CO2 + 2H2O +(2/phi-2)O2+7.52/phiN2 Lean mixture

Rich combustion

CH4 + (2/phi)(O2 +3.76N2) = (4/phi-3)CO2 + 2H2O +(4-4/phi)CO+7.52/phiN2 Rich mixture

Effect of Equivalence ratio on adiabatic flame temperature for combustion of methane under constant volume combustion process.

Constant volume process:

For a constant volume process internal energy is equated for reactants and products to get the AFT, i.e.

Ur-Up=0

so using newton raphson method the final temperature is obtained.The below term is equated to 0.

(Hproducts-n_prod*R*T) – (Hreactants-n_react*R*Tstd)

Coding approach:

Code using NS method:

1. Enthalpy of reactants and products were calculated from the formula i.e Nasa polynomials

H=(a1 + a2*T/2 + a3*pow(T,2)/3 + a4*pow(T,3)/4 + a5*pow(T,4)/5 + a6/T)*R*T

The coefficients a1 to a7 was obtained from berkeley website

2. For a constant volume process internal energy is equated for reactants and products to get the AFT, i.e.

Ur-Up=0

3. So using newton raphson method the final temperature is obtained.The below term is equated to 0.

(Hproducts-n_prod*R*T) – (Hreactants-n_react*R*Tstd)

n_prod=n_react=Number of moles in reactant & product side

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

4. The equivalence ratio (phi) was varied from 0.1 to 2

Code using cantera:

1. For getting the results from cantera, the solution class of cantera is used.A gas object is created from solution class containing methane and air.

2. The gas species were obtained from gri30.cti

3. The equilibriate solver was used with constant volume and internal energy to obtain AFT.

# Adiabatic flame temperature
# CH4 + 2(O2 +3.76N2) = CO2 + 2H2O + 7.52N2    Stoichometric mixture 
# CH4 + (2/phi)(O2 +3.76N2) = CO2 + 2H2O +(2/phi-2)O2+7.52/phiN2    Lean mixture
# CH4 + (2/phi)(O2 +3.76N2) = (4/phi-3)CO2 + 2H2O +(4-4/phi)CO+7.52/phiN2    Rich mixture

import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
	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_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 ] 
o2_coeffs_h = [3.28253784E+00, 1.48308754E-03,-7.57966669E-07, 2.09470555E-10,-2.16717794E-14, -1.08845772E+03, 5.45323129E+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]
CO_coeffs_h  =[2.71518561E+00, 2.06252743E-03,-9.98825771E-07, 2.30053008E-10,-2.03647716E-14, -1.41518724E+04, 7.81868772E+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):
	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_o2_p= h(T,o2_coeffs_h)
	h_CO_p= h(T,CO_coeffs_h)
	R=8.314
	if phi<1:
		Hproducts=h_co2_p+(7.52/phi)*h_n2_p+2*h_h2o_p+(2/phi-2)*h_o2_p
		n_prod=1+(7.52/phi)+2+(2/phi-2)
	if phi==1:
		Hproducts=h_co2_p+7.52*h_n2_p+2*h_h2o_p
		n_prod=1+7.52+2
	if phi>1:
		Hproducts=(4/phi-3)*h_co2_p+(7.52/phi)*h_n2_p+2*h_h2o_p+(4-4/phi)*h_CO_p
		n_prod=(4/phi-3)+(7.52/phi)+2+(4-4/phi)
	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)
	Hreactants=h_ch4_r+(2/phi)*h_o2_r+(7.52/phi)*h_n2_r
	n_react=1+(2/phi)+(7.52/phi)
	return (Hproducts-n_prod*R*T) - (Hreactants-n_react*R*Tstd)

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

T_guess= 1500
tol =1e-3
ct=0
alpha=0.2
X=np.arange(0.1,2,0.05)
T_ad=[]
for phi in np.arange(0.1,2,0.05):
	while (abs(f(T_guess))>tol):
		T_guess=T_guess - alpha*(f(T_guess)/fprime(T_guess))
	
	#print(T_guess)
	T_ad.append(T_guess)
plt.plot(X,T_ad,color='red',label="Using Newton Raphson")
plt.grid()


import cantera as ct
T_adc=[]
for phi in np.arange(0.1,2,0.05):
	gas =ct.Solution('gri30.xml')
	gas.TPX= 298.15,101325,{'CH4':1, 'O2':2/phi,'N2':7.52/phi}
	gas.equilibrate('UV','auto')
	T_adc.append(gas.T)
plt.plot(X,T_adc,color='blue',label="using cantera")
plt.xlabel('Equivalence Ratio')
plt.ylabel('Adiabatic flame temperature')
plt.title('Effect of equivalence ratio on AFT of Methane')
plt.legend()
plt.show()

Results:

Variation of AFT with change in Equivalence ratio:

From the below graph we can see that at stoichiometric condition i.e at phi=1 the AFT is highest and as we move away from stoichiometric condition the AFT starts decreasing.This is because at stoichiometric condition all the fuel gets burned thus producing more energy.

We can see that the results got from cantera shows lower AFT than the code we wrote using newton raphson.The reason for this is cantera considered all the procucts of combustion which would occur in the actual case.So more energy is used up to produce those products.

Hence lower AFT is obtained through cantera which is actual solution.

 

Effect of Heat loss factor on AFT for Methane combustion:

Coding approach:

Constant pressure chamber:

The combustion is considered at constant pressure chamber.The Heat loss factor in taken as 0.35.For constant enthalpy process the equation obtained is,

Hproducts – Hreactants +Heat loss=0

The maximum possible heat loss is basically the heat content or lower heating value (LHV) of fuel.

So Heat loss=Heat loss factor*(LHV)

Heat loss factor was varied from 0 to 1

# Adiabatic flame temperature
# CH4 + 2(O2 +3.76N2) = CO2 + 2H2O + 7.52N2

import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
	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_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]
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):
	h_co2_p=h(T,co2_coeffs_h)
	h_n2_p=h(T,n2_coeffs_h)
	h_h2o_p=h(T,h2o_coeffs_h)

	Hproducts=h_co2_p+7.52*h_n2_p+2*h_h2o_p
	Tstd=298.15
	LHV=800000
	h_ch4_r=h(Tstd,ch4_coeffs_l)
	h_o2_r=h(Tstd,o2_coeffs_l)
	h_n2_r=h(Tstd,n2_coeffs_l)
	Hreactants=h_ch4_r+2*h_o2_r+7.52*h_n2_r
	return Hproducts - Hreactants+L*LHV

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

T_guess= 1500
tol =1e-3
ct=0
alpha=0.2

for L in np.arange(0,1,0.1):
	while (abs(f(T_guess))>tol):
		T_guess=T_guess - alpha*(f(T_guess)/fprime(T_guess))
		ct=ct+1
	plt.plot(L,T_guess,'o',color='blue')		
plt.xlabel('Heat Loss factor')
plt.ylabel('Adiabatic flame temperature')
plt.title('Effect of heat loss factor on AFT')
plt.show()

Results:

Effect of Heat loss factor on AFT for Methane combustion:

From the below graph the results are obvious, i.e as the heat loss increases the AFT keeps decreasing beacuse less energy is contained in the chamber thereby reducing the temperature.

Effect of types of Hydrocarbon on AFT with heat loss factor 0.35:

The same above approach was performed and tested  for -ane, -ene and -yne variants of 2 Carbon atom chain.The hydrocarbons are ethane, ethene and ethyne.

Code:

 Adiabatic flame temperature
# CxHy + (x+y/4)(O2 +3.76N2) = xCO2 + y/2H2O + (x+y/4)3.76N2

import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
	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_l = [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]
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]
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):
	h_co2_p=h(T,co2_coeffs_h)
	h_n2_p=h(T,n2_coeffs_h)
	h_h2o_p=h(T,h2o_coeffs_h)

	Hproducts=x*h_co2_p+(x+y/4)*3.76*h_n2_p+(y/2)*h_h2o_p
	Tstd=298.15
	h_c2h6_r=h(Tstd,c2h6_coeffs_l)
	h_c2h4_r=h(Tstd,c2h4_coeffs_l)
	h_c2h2_r=h(Tstd,c2h2_coeffs_l)
	h_o2_r=h(Tstd,o2_coeffs_l)
	h_n2_r=h(Tstd,n2_coeffs_l)

	if y==y_ane:
		lhv=1428600
		Hreactants=h_c2h6_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	
	if y==y_ene:	
		lhv=1227070
		Hreactants=h_c2h4_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	if y==y_yne:
		lhv=1157784
		Hreactants=h_c2h2_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	
	return Hproducts - Hreactants+0.35*lhv

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

T_guess= 1500
tol =1e-3
ct=0
alpha=0.5

x=2

y_ane=2*x+2
y_ene=2*x
y_yne=2*x-2
y1=[y_ane,y_ene,y_yne]
fuel=['ethane','ethene','ethyne']
T_adiabatic=[]
for y in y1:
	while (abs(f(T_guess))>tol):
		T_guess=T_guess - alpha*(f(T_guess)/fprime(T_guess))
		ct=ct+1
	T_adiabatic.append(T_guess)		
	print(ct)
	print(T_guess)
		
plt.bar(fuel,T_adiabatic)
plt.xlabel('Hydrocarbon Type')
plt.ylabel('Adiabatic flame temperature')
plt.title('Effect of types of Hydrocarbon on AFT with heat loss factor 0.35')
plt.show()

Effect of types of Hydrocarbon on AFT with heat loss factor 0.35:

Results:

The AFT for ethane=1714 K, ethene=1890 K, ethyne=2133 K was obtained.

From the results it is seen that the highest final temperature is obtained in case of ethyne and lowest is obtane from ethane.So it can be concluded that high amount of energy is released in case of ethyne which is due the involvement of triple C bond,which requires more energy to break.

Effect of carbon atoms of alkane on AFT:

The carbon atoms are varied from 1 to 3 for the alkane group and the AFT is compared between them.The hydrocarbons are Methane, ethane and propane.Heat loss factor taken is 0.

Code:

# Adiabatic flame temperature
# CxHy + (x+y/4)(O2 +3.76N2) = xCO2 + y/2H2O + (x+y/4)3.76N2

import matplotlib.pyplot as plt
import math
import numpy as np
def h(T,co_effs):
	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_l = [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):
	h_co2_p=h(T,co2_coeffs_h)
	h_n2_p=h(T,n2_coeffs_h)
	h_h2o_p=h(T,h2o_coeffs_h)

	Hproducts=x*h_co2_p+(x+y/4)*3.76*h_n2_p+(y/2)*h_h2o_p
	Tstd=298.15
	h_ch4_r=h(Tstd,ch4_coeffs_l)
	h_c2h6_r=h(Tstd,c2h6_coeffs_l)
	h_c3h8_r=h(Tstd,c3h8_coeffs_l)
	h_o2_r=h(Tstd,o2_coeffs_l)
	h_n2_r=h(Tstd,n2_coeffs_l)
	if x==1:
		Hreactants=h_ch4_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	if x==2:	
		Hreactants=h_c2h6_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	if x==3:
		Hreactants=h_c3h8_r+(x+y/4)*h_o2_r+(x+y/4)*3.76*h_n2_r
	return Hproducts - Hreactants

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

T_guess= 1500
tol =1e-3
ct=0
alpha=0.2
T_adiabatic=[]
fuel=['Methane','Ethane','Propane']
for x in range(1,4):
	y=2*x+2
	while (abs(f(T_guess))>tol):
		T_guess=T_guess - alpha*(f(T_guess)/fprime(T_guess))
		ct=ct+1
	T_adiabatic.append(T_guess)	
	print(ct)
	print(T_guess)	

plt.bar(fuel,T_adiabatic)
plt.xlabel('Hydrocarbon Type')
plt.ylabel('Adiabatic flame temperature')
plt.title('Effect of carbon atoms of alkane on AFT')
plt.show()

Results:

Effect of carbon atoms of alkane on AFT:

From the comparision it is found that the AFT for methane, ethane and propane doesn’t have significane difference but propane has the highest AFT and methane has the lowest.So it can be concluded that the AFT increases with increase in no of crabon atom and hydrogen atoms for alkane group of hydrocarbons.

AFT for Methane=2325.6 K, Ethane=2379.8 K,Propane=2392 K

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *