Week 3 - Adiabatic Flame Temperature calculation
AIM: Adiabatic Flame Temperature calculation
Case-1: To write a program in Python to plot the effect of equivalence ratio on the final adiabatic flame temperature by assuming that methane is contained in a constant volume chamber.
Case-2: Adiabatic flame temperature by assuming that methane is contained in a constant pressure chamber by considering heat loss.
Case-3: By considering the fuel type a general hydrocarbon of the form CxHy. Phi and lambda = 1.0. To find the AFT of CH4 with H_loss = 0.35
Case-4: To find AFT for -ane, -ene and -yne variants of 2 Carbon atom chain.
Introduction:
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.
The constant volume adiabatic flame temperature is the temperature that results from a complete combustion process that occurs without any work, heat transfer or changes in kinetic or potential energy.
Its temperature is higher than the constant pressure process because no energy is utilized to change the volume of the system (i.e., generate work).
The enthalphy of products and reactants are calculated by using Nasa polynomial function
H/RT = a1 + a2 T /2 + a3 T^2 /3 + a4 T^3 /4 + a5 T^4 /5 + a6/T
where a1, a2, a3, a4, a5, a6, and a7 are the numerical coefficients supplied in NASA thermodynamic files
The Newton Rhapson Method is an iterative method used to find the root of a function f(x) by starting a guess value for x and iterating till the value of the function reaches below tolerence.
x_new = x_guess - α*((f(x_guess)/f'(x_guess))
Case-1:
Equivalence Ratio:
The equivalence ratio is defined as the ratio of the actual fuel/air ratio to the stoichiometric fuel/air ratio. Stoichiometric combustion occurs when all the oxygen is consumed in the reaction, and there is no molecular oxygen(O2) in the products.
If the equivalence ratio is equal to one, the combustion is stoichiometric. If it is < 1, the combustion is lean with excess air, and if it is >1, the combustion is rich with incomplete combustion.
Air–fuel equivalence ratio (λ):
Air–fuel equivalence ratio, λ (lambda), is the ratio of actual AFR to stoichiometry for a given mixture. λ = 1.0 is at stoichiometry, rich mixtures λ < 1.0, and lean mixtures λ > 1.0.
There is a direct relationship between λ and AFR. To calculate AFR from a given λ, multiply the measured λ by the stoichiometric AFR for that fuel. Alternatively, to recover λ from an AFR, divide AFR by the stoichiometric AFR for that fuel. This last equation is often used as the definition of λ:

Because the composition of common fuels varies seasonally, and because many modern vehicles can handle different fuels, when tuning, it makes more sense to talk about λ values rather than AFR.
Most practical AFR devices actually measure the amount of residual oxygen (for lean mixes) or unburnt hydrocarbons (for rich mixtures) in the exhaust gas.
Fuel–air 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. Mathematically,
where, m represents the mass, n represents number of moles, subscript st stands for stoichiometric conditions.
The advantage of using equivalence ratio over fuel–oxidizer ratio is that it takes into account (and is therefore independent of) both mass and molar values for the fuel and the oxidizer. Consider, for example, a mixture of one mole of ethane (C2H6) and one mole of oxygen (O2). The fuel–oxidizer ratio of this mixture based on the mass of fuel and air is

and the fuel-oxidizer ratio of this mixture based on the number of moles of fuel and air is
Clearly the two values are not equal. To compare it with the equivalence ratio, we need to determine the fuel–oxidizer ratio of ethane and oxygen mixture. For this we need to consider the stoichiometric reaction of ethane and oxygen,
C2H6 + 7⁄2 O2 → 2 CO2 + 3 H2O
This gives

Thus we can determine the equivalence ratio of the given mixture as

-
or, equivalently, as
The Code for calculating AFT by using Python and Cantera:
"""
AFT calculation of Methane at different equivalent ratio assuming constant volume
CH4 + 2*(O2 + 3.76*N2) = CO2 + 2*H2O + 7.52*N2
Program by: Sai Kalyan
"""
import matplotlib.pyplot as plt
import math
# Function to calculate enthalphy
def h(T,coeff):
R = 8.314 # J/mol-K
a1 = coeff[0]
a2 = coeff[1]
a3 = coeff[2]
a4 = coeff[3]
a5 = coeff[4]
a6 = coeff[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
# Low temperature coefficients (reactants) at STP condition
ch4_coeff_l = [5.14987613E+00,-1.36709788E-02,4.91800599E-05, -4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
o2_coeff_l = [3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
n2_coeff_l = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
# High temperature coefficients (products) at STP condition
n2_coeff_h = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+02]
co2_coeff_h = [3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
h2o_coeff_h = [3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
co_coeff_h = [2.71518561E+00,2.06252743E-03,-9.98825771E-07,2.30053008E-10,-2.03647716E-14,-1.41518724E+04,7.81868772E+00]
o2_coeff_h = [3.28253784E+00,1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03,5.45323129E+00]
# Function for solving of root by Newton Rhapson Method
def f(T,phi):
"""
Fuction represents the root finding problem
"""
Tstp = 298.15 # Temperature in Kelvin
R = 8.314 # Jol/mol-K
h_co2_p = h(T,co2_coeff_h)
h_n2_p = h(T,n2_coeff_h)
h_h2o_p = h(T,h2o_coeff_h)
h_co_p = h(T,co_coeff_h)
h_o2_p = h(T,o2_coeff_h)
if phi >= 1:
H_products = (4/phi-3)*h_co2_p + 2*h_h2o_p + 2*h_h2o_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)*R*T)
elif phi < 1:
H_products = h_co2_p + 2*h_h2o_p + (7.52/phi)*h_n2_p + (2/phi-2)*h_o2_p
N_products = (1 + 2 + (7.52/phi) + (2/phi-2))*R*T
#print(H_products)
h_ch4_r = h(Tstp,ch4_coeff_l)
h_o2_r = h(Tstp,o2_coeff_l)
h_n2_r = h(Tstp,n2_coeff_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))*R*Tstp
#print(H_reactants)
return (H_products - H_reactants) - (N_products - N_reactants)
def fprime(T, phi):
return (f(T+1e-6, phi) - f(T, phi))/(1e-6)
phi = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2]
T_aft_py =[]
tol = 1e-3
alpha = 0.9
for i in range(0, len(phi)):
T_guess =1500
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)
print(T_aft_py)
print()
"""
Solution Cantera
"""
import cantera as ct
gas = ct.Solution('gri30.xml')
T_aft_ct = []
for j in range(0,len(phi)):
# Mole fraction of each reactant
n_tot = 1 + (2/phi[j]) + (7.52/phi[j])
n_ch4 = 1/n_tot
n_o2 = (2/phi[j])/n_tot
n_n2 = (7.52/phi[j])/n_tot
# Gas Mixture
gas.TPX = 298.15,101325, {'CH4':n_ch4, 'O2':n_o2, 'N2':n_n2}
# Equilibrium Conditions
gas.equilibrate('UV','auto')
T_aft_ct.append(gas.T)
print(T_aft_ct)
print()
#Plotting
plt.plot(phi,T_aft_py,'-o',color='blue',label= 'Python')
plt.plot(phi,T_aft_ct, '-o',color='red',label= 'Cantera')
plt.xlabel('Equivalent Ratio (phi)')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('Equivalece Ratio vs Adiabatic Flame Temperature @CH4')
plt.grid('on')
plt.legend()
plt.show()
AFT of python and cantera for phi value:
[681.6845835964691, 1009.5528270217897, 1301.8703697972755, 1567.8621970218105, 1812.8759517498652, 2040.416137466407, 2252.9810805648267, 2452.459890664049, 2640.3409846801796, 2796.7632224562567, 2772.6555192966816, 2749.7387066853044, 2727.9244049328254, 2707.132902077932, 2687.292107117434, 2668.336652261316, 2650.2071199046263, 2632.8493744648868, 2616.2139827833666]
[679.6185875635057, 1009.4396888958651, 1300.7490342979956, 1563.555590153711, 1802.0887899096158, 2018.3725835490886, 2211.7139850824283, 2377.513792657946, 2506.6728691638295, 2600.53916655021, 2556.491324238801, 2484.0651369969014, 2403.256251308024, 2321.028550943681, 2239.5504491856213, 2159.51535304297, 2081.1419124469744, 2004.4839526412186, 1929.5327242242863]
The increase in AFT is achieved from 0.1 to 1 of equivalent ratio. From 1 it started decreasing.
Case-2:
The AFT variation w.r.t Heat loss.
Due to the heat loss the AFT is considered as Flame Temperature.
Code:
"""
To calculate effect of heat loss on AFT of Methane(CH4) for constant pressure reactor.
Stoichiometric Equation
CH4 + 2*(O2 + 3.76*N2) = CO2 + 2*H2O + 7.52*N2
Program by: Sai Kalyan
"""
import matplotlib.pyplot as plt
import math
import numpy
"""
Heat loss
Q = mass of fuel * LHV
Q = mf * LHV where mf - (g/mol)
mf = 16.04 g/mol
LHV = 50 MJ/kg
HHV = 55 MJ/kg
Q = 16.04e-3 * 50e+6
Q = 80200
"""
Q_max = 80200 # maximun heat
phi = 1 # Equivalent ratio
# Function to calculate enthalphy
def h(T,coeff):
R = 8.314 # J/mol-K
a1 = coeff[0]
a2 = coeff[1]
a3 = coeff[2]
a4 = coeff[3]
a5 = coeff[4]
a6 = coeff[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
# Low temperature coefficients (reactants) at STP condition
ch4_coeff_l = [5.14987613E+00,-1.36709788E-02,4.91800599E-05, -4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
o2_coeff_l = [3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
n2_coeff_l = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
co2_coeff_l = [2.35677352E+00,8.98459677E-03,-7.12356269E-06,2.45919022E-09,-1.43699548E-13,-4.83719697E+04,9.90105222E+00]
h2o_coeff_l = [4.19864056E+00,-2.03643410E-03,6.52040211E-06,-5.48797062E-09,1.77197817E-12,-3.02937267E+04,-8.49032208E-01]
# High temperature coefficients (products) at STP condition
n2_coeff_h = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+02]
co2_coeff_h = [3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
h2o_coeff_h = [3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
co_coeff_h = [2.71518561E+00,2.06252743E-03,-9.98825771E-07,2.30053008E-10,-2.03647716E-14,-1.41518724E+04,7.81868772E+00]
o2_coeff_h = [3.28253784E+00,1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03,5.45323129E+00]
# Standard Temperature condition
Tstp = 298.15
LHV = h(Tstp,ch4_coeff_l) + 2*h(Tstp,o2_coeff_l) - h(Tstp,co2_coeff_l) - (2*h(Tstp,h2o_coeff_l))
# Function for solving of root by Newton Rhapson Method
def f(T,H_loss):
Tstp = 298.15 # Temperature in Kelvin
R = 8.314 # Jol/mol-K
h_co2_p = h(T,co2_coeff_h)
h_n2_p = h(T,n2_coeff_h)
h_h2o_p = h(T,h2o_coeff_h)
h_co_p = h(T,co_coeff_h)
h_o2_p = h(T,o2_coeff_h)
if T>1000:
H_products = ((4/phi)-3)*h_co2_p + 2*h_h2o_p + 2*h_h2o_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)*R*T)
else:
H_products = h_co2_p + 2*h_h2o_p + (7.52/phi)*h_n2_p + ((2/phi)-2)*h_o2_p
N_products = (1 + 2 + (7.52/phi) + (2/phi-2))*R*T
Tstp = 298.15
h_ch4_r = h(Tstp,ch4_coeff_l)
h_o2_r = h(Tstp,o2_coeff_l)
h_n2_r = h(Tstp,n2_coeff_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))*R*Tstp
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)
tol = 1e-3
alpha = 0.9
H_loss = numpy.linspace(0,1,20)
T_aft_py =[]
for i in range (0,len(H_loss)):
T_guess =1500
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)
# AFT of CH4 with Heat loss of 0.35
h_l = numpy.searchsorted(H_loss, 0.35)
print('Index value is:',h_l)
t = T_aft_py[h_l]
print('The AFT of CH4 with 0.35 Heat loss is:',t)
# Plottng
plt.plot(H_loss,T_aft_py,'-o',color='magenta')
plt.plot(H_loss[h_l], T_aft_py[h_l],'o',color='black',label='H_loss = 0.35')
plt.xlabel('Heat_Loss')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('Heat Loss vs Adiabatic Flame Temperature')
plt.grid('on')
plt.legend()
plt.show()

heat_loss at 0, AFT = FT = 2875.K
heat_loss at 0.35, AFT = FT = 23339.15K
Case-3:
Test of AFT on the type of Hydrocarbon (n=2)
we will study for Ethane, Ethene and Ethyne
General Hydrocarbon:
CxHy + [x+(y/4)](O2 + 3.76N2) = xCO2 + (y/2)H2O + 3.76[x+(y/4)]N2
Ethane: C2H6 + 3.5(O2 + 3.76N2) = 2CO2 + 3H2O + 13.16N2
Ethene: C2H4 + 3(O2 + 3.76N2) = 2CO2 + 2H2O +11.28N2
Ethyne: C2H2 + 2.5(O2 + 3.76N2) = 2CO2 + H2O + 9.4N2
Code:
import matplotlib.pyplot as plt
import cantera as ct
"""
Test of AFT on the type of Hydrocarbon (n=2)
General Hydrocarbon:
CxHy + [x+(y/4)](O2 + 3.76N2) = xCO2 + (y/2)H2O + 3.76[x+(y/4)]N2
Ethane: C2H6 + 3.5(O2 + 3.76N2) = 2CO2 + 3H2O + 13.16N2
Ethene: C2H4 + 3(O2 + 3.76N2) = 2CO2 + 2H2O +11.28N2
Ethyne: C2H2 + 2.5(O2 + 3.76N2) = 2CO2 + H2O + 9.4N2
Program by: Sai Kalyan
"""
# Function to calculate enthalphy
def h(T,coeff):
R = 8.314 # J/mol-K
a1 = coeff[0]
a2 = coeff[1]
a3 = coeff[2]
a4 = coeff[3]
a5 = coeff[4]
a6 = coeff[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
# Low temperature coefficients (reactants) at STP condition
o2_coeff_l = [3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
n2_coeff_l = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
c2h6_coeff_l = [4.29142492E+00,-5.50154270E-03,5.99438288E-05,-7.08466285E-08,2.68685771E-11,-1.15222055E+04,2.66682316E+00]
c2h4_coeff_l = [3.95920148E+00,-7.57052247E-03,5.70990292E-05,-6.91588753E-08,2.69884373E-11,5.08977593E+03,4.09733096E+00]
c2h2_coeff_l = [8.08681094E-01,2.33615629E-02,-3.55171815E-05,2.80152437E-08,-8.50072974E-12,2.64289807E+04,1.39397051E+01]
# High temperature coefficients (products) at STP condition
n2_coeff_h = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+02]
co2_coeff_h = [3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
h2o_coeff_h = [3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
# Function for solving of root by Newton Rhapson Method
def f(T,ntype):
Tstp = 298.15 # Temperature in Kelvin
R = 8.314 # Jol/mol-K
h_co2_p = h(T,co2_coeff_h)
h_n2_p = h(T,n2_coeff_h)
h_h2o_p = h(T,h2o_coeff_h)
h_c2h6_r = h(Tstp, c2h6_coeff_l)
h_c2h4_r = h(Tstp, c2h4_coeff_l)
h_c2h2_r = h(Tstp, c2h2_coeff_l)
h_o2_r = h(Tstp,o2_coeff_l)
h_n2_r = h(Tstp,n2_coeff_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 = 1
tol = 1e-03
ntype = [1, 2, 3]
T_aft_py = []
for i in range (0, len(ntype)):
T_guess = 1500
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)
plt.bar(['Ethane(C2H6)','Ethene(C2H4)','Ethyne(C2H2)'], T_aft_py, color='red')
plt.xlabel('Hydrocarbon')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('Hydrocarbon vs Adiabatic Flame Temperature(Python)')
plt.show()
"""
Cantera
"""
gas = ct.Solution('gri30.xml')
T_aft_ct = []
for i in range (0, len(ntype)):
if ntype[i]==1:
x=2
y=6
fuel = 'c2h6'
elif ntype[i]==2:
x=2
y=4
fuel = 'c2h4'
elif ntype[i]==3:
x=2
y=2
fuel = 'c2h2'
n_tot = 1 + (x+y/4) + 3.76*(x+y/4)
n_fuel = 1/n_tot
n_o2 = (x+y/4)/n_tot
n_n2 = (3.76*(x+y/4))/n_tot
# gas mixture
gas.TPX = 298.15, 101325, {fuel:n_fuel, 'O2':n_o2, 'N2':n_n2}
# Equilibrium conditions
gas.equilibrate('HP','auto')
T_aft_ct.append(gas.T)
print(T_aft_ct)
plt.bar(['Ethane(C2H6)','Ethene(C2H4)','Ethyne(C2H2)'], T_aft_ct, color='blue')
plt.xlabel('Hydrocarbon')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('Hydrocarbon vs Adiabatic Flame Temperature(Cantera)')
plt.show()


AFT
| Fuel | Python | Cantera |
| Ethane | 2379.84945911852 | 2258.7377026883905 |
| Ethene | 2564.5336892931387 | 2368.6402100532155 |
| Ethyne | 2909.3545675688806 | 2539.6720371204783 |
Ethene and Ethyne has more AFT due to the presence of more amount of Carbon.
Case-4:
Test of AFT on the type of Hydrocarbon (n=2)
we observe AFT for Methane, Ethane, Propane
Methane: CH4 + 2(O2 + 3.76N2) = CO2 + 2H2O + 7.52N2
Ethane: C2H6 + 3.5(O2 + 3.76N2) = 2Co2 + 3H2O + 13.16N2
Propane: C3H8 + 5(O2 + 3.76N2) = 3CO2 + 4H2O + 18.8N2
import matplotlib.pyplot as plt
import cantera as ct
"""
Test of AFT on the type of Hydrocarbon (n=2)
General Hydrocarbon:
CxHy + [x+(y/4)](O2 + 3.76N2) = xCO2 + (y/2)H2O + 3.76[x+(y/4)]N2
Methane: CH4 + 2(O2 + 3.76N2) = CO2 + 2H2O + 7.52N2
Ethane: C2H6 + 3.5(O2 + 3.76N2) = 2Co2 + 3H2O + 13.16N2
Propane: C3H8 + 5(O2 + 3.76N2) = 3CO2 + 4H2O + 18.8N2
Program by: Sai Kalyan
"""
# Function to calculate enthalphy
def h(T,coeff):
R = 8.314 # J/mol-K
a1 = coeff[0]
a2 = coeff[1]
a3 = coeff[2]
a4 = coeff[3]
a5 = coeff[4]
a6 = coeff[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
# Low temperature coefficients (reactants) at STP condition
o2_coeff_l = [3.78245636E+00,-2.99673416E-03,9.84730201E-06,-9.68129509E-09,3.24372837E-12,-1.06394356E+03,3.65767573E+00]
n2_coeff_l = [0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]
c2h6_coeff_l = [4.29142492E+00,-5.50154270E-03,5.99438288E-05,-7.08466285E-08,2.68685771E-11,-1.15222055E+04,2.66682316E+00]
ch4_coeff_l = [5.14987613E+00,-1.36709788E-02,4.91800599E-05,-4.84743026E-08,1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
c3h8_coeff_l = [0.93355381E+00,0.26424579E-01,0.61059727E-05,-0.21977499E-07,0.95149253E-11,-0.13958520E+05,0.19201691E+02]
# High temperature coefficients (products) at STP condition
n2_coeff_h = [0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+02]
co2_coeff_h = [3.85746029E+00,4.41437026E-03,-2.21481404E-06,5.23490188E-10,-4.72084164E-14,-4.87591660E+04,2.27163806E+00]
h2o_coeff_h = [3.03399249E+00,2.17691804E-03,-1.64072518E-07,-9.70419870E-11,1.68200992E-14,-3.00042971E+04,4.96677010E+00]
# Function for solving of root by Newton Rhapson Method
def f(T, n):
Tstp = 298.15 # Temperature in Kelvin
R = 8.314 # Jol/mol-K
h_co2_p = h(T,co2_coeff_h)
h_n2_p = h(T,n2_coeff_h)
h_h2o_p = h(T,h2o_coeff_h)
h_ch4_r = h(Tstp, ch4_coeff_l)
h_c2h6_r = h(Tstp, c2h6_coeff_l)
h_c3h8_r = h(Tstp, c3h8_coeff_l)
h_o2_r = h(Tstp,o2_coeff_l)
h_n2_r = h(Tstp,n2_coeff_l)
if n==1:
x=2
y=6
h_fuel = h_c2h6_r
elif n==2:
x=1
y=4
h_fuel = h_ch4_r
elif n==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, n):
return (f(T+1e-6, n) - f(T,n))/(1e-6)
alpha = 1
tol = 1e-03
n = [1, 2, 3]
T_aft_py = []
for i in range(0,len(n)):
T_guess = 1500
while (abs(f(T_guess, n[i])) > tol):
T_guess = T_guess - alpha*((f(T_guess, n[i]))/(fprime(T_guess, n[i])))
T_aft_py.append(T_guess)
print(T_aft_py)
plt.bar(['Methane(C2H6)','Ethane(C2H4)','Propane(C2H2)'], T_aft_py, color='blue')
plt.xlabel('Carbon atoms')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('No. of C atoms vs Adiabatic Flame Temperature(Python)')
plt.show()
"""
Cantera
"""
gas = ct.Solution('gri30.xml')
T_aft_ct = []
for i in range (0, len(n)):
if n[i]==1:
x=1
y=4
fuel = 'ch4'
elif n[i]==2:
x=2
y=6
fuel = 'c2h6'
elif n[i]==3:
x=2
y=8
fuel = 'c3h8'
n_tot = 1 + (x+y/4) + 3.76*(x+y/4)
n_fuel = 1/n_tot
n_o2 = (x+y/4)/n_tot
n_n2 = (3.76*(x+y/4))/n_tot
# gas mixture
gas.TPX = 298.15, 101325, {fuel:n_fuel, 'O2':n_o2, 'N2':n_n2}
# Equilibrium conditions
gas.equilibrate('HP','auto')
T_aft_ct.append(gas.T)
print(T_aft_ct)
plt.bar(['Methane(C2H6)','Ethane(C2H4)','Propane(C2H2)'], T_aft_ct, color='red')
plt.xlabel('Carbon atoms')
plt.ylabel('Adiabatic Flame Temperature (K)')
plt.title('No. of C atoms vs Adiabatic Flame Temperature(Cantera)')
plt.show()


| Fuel | Python | Cantera |
| Methane | 2379.84945911852 | 2224.6173595315654 |
| Ethane | 2325.5981297721946 | 2258.737702688394 |
| Propane | 2392.097596062176 | 2161.5391398080365 |
Due to same amount of Carbon atoms, the AFT for 3 alkanes are almost same.
The difference between the Python and Cantera results are almost same.


