Challenge

Week 3 - Adiabatic Flame Temperature calculation

Aim

  • To study the effect of equivalence ratio on Adiabatic Flame Temperature using the Newton Raphson method and Cantera.
  • To calculate the Adiabatic Flame Temperature for the constant pressure with heat loss.
  • To calculate the Adiabatic Flame Temperature for various fuel types such as alkanes, alkenes, and alkynes.
  • To calculate Adiabatic flame temperature by varying the number of carbon atoms.

A. Introduction

The transformation reactants to products involves heat transfer in the system. For an adiabatic system, there is no heat transfer into the environment and temperature of the system is the Adiabatic Flame Temperature. AFT is an ideal case temperature and the actual flame temperature observed for a particular fuel is always less than AFT.

B. Theory

B.1 Newton Rhapson

It is one of the approximation method to find roots of a real-valued function f(x) =0. The method is based on finding the minima and maximum values by approximating using a tangent to a continuous and differentiable function. Using x_guess as the initial guess solution approximation, the new value is calculated as follows:

X_new = x_guess –( f(x) / f’(x_guess))

=> f’(x_guess) is the differential value of f(x) at point x_guess. The derivative is calculated using finite difference method (Taylor series approximation).

B.2 Enthalpy equation for constant volume combustion

Using the enthalpy definition and first law of thermodynamics, we can write the equations as:

h = U + pV

Applying differentials on both sides, we get

dh = dU + Vdp (dV=0 for constant volume process)

For a constant volume process, there is no work done by the system due to no change in the volume. Hence, the heat generated q is completely used in increasing the internal energy U of the system. That is,

dU = q

Therefore, dh = q +Vdp

For an adiabatic process, q=0. Also, by substituting pV=nRT, we get the equation as,

dh = Rd(nT)

That is, hproduct – hreactant = R (nproduct x Tproduct – nreactant x Treactant)

B.3 Enthalpy equation for constant pressure combustion

For the constant pressure combustion, the enthalpy change is zero. This can be explained by the work done by the system to expand the volume of the system. Consider the system to have a heat loss factor, we can write the equation as

dh = 0

hproduct +hloss – hreactant = 0

Where, hloss = loss factor x Lower Heating Value of fuel

B.4 Effect of equivalence ratio on AFT in constant volume system

In this section, the AFT calculation for combustion of methane fuel with varying equivalence ration is studied. For a rich mixture, we consider only CO as intermediary product and for a lean mixture, formation of O2. The equations are balanced in terms of equivalence ratio and the algorithm is generated to calculate AFT for a range of equivalence ratio from 0.1 to 2.

C. Adiabatic Flame Temperature Calculation:

Theoretically, AFT can be obtained by equalizing the enthalpies of products and reactants. We are going to use a polynomial function from the database of NASA at a particular temperature.

h(T)=(a1+a2⋅(T2)+a3⋅(T23)+a4⋅(T34)+a5⋅(T45)+a6⋅(T6))⋅R⋅T">h(T) = (a1+a2*(T/2)+a3*((T^2)/3)+a4*((T^3)/4)+a5*((T^4)/5)+a6*(T/6)) *R*T

where

h = enthalpy

ai">ai = coefficient of each species

T = Temperature

R = Gas Constant.

The coefficients values can be extracted from the website of the GRI Mech 30 thermostat file. For the reactants, we take low temperatures i.e. STP conditions and for the products usually, temperatures are high. The AFT is calculated using Newton Raphson iterative technique where an initial guess value for the temperature is assumed and it iterates until it reaches the prescribed tolerance value.

TNew=Tguess-α[f(Tguess)f′(Tguess)]">TNew=Tguess - α*[f(Tguess) / f′(Tguess)]

where,

TNew">TNew = New value of the temperature after the successive iterative.

Tguess">Tguess= Initial Guess Temperature.

α">α = Relaxation Factor (<1 under relaxed , >1 over relaxed)

D. Combustion Stoichiometry:

Stoichiometric Mixture contains the exact amount of fuel and oxidizer such that complete combustion takes place, where all the fuel and oxidizer are consumed to form the products. This mixture ideally yields the maximum flame temperature as all the energy released from the combustion is used to heat the products.

The Stoichiometric Combustion equation for methane-air is:

CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2">CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2

In General, for the class of Hydrocarbons, we can express the stoichiometric equation as follows:

CxHy+(x+y4)(O2+3.76N2)→xCO2+(y2)H2O+(x+y4)N2">CxHy+(x+(y/4))(O2+3.76N2)→xCO2+(y/2)H2O+(x+(y/4))N2

When the fuel is not getting burned completely, we obtain products such as O2, H2, CO, OH, etc. In practice, it is hard to find a combustion process equal to stoichiometry condition. If less air is used the mixture is defined as the fuel-rich mixture and a common notation to represent this ratio is the equivalence ratio (ϕ">ϕ).

The equivalence ratio is the ratio of the actual fuel-air ratio to the stoichiometric ratio. Hence if ϕ<1">ϕ<1 the mixture is lean and if ϕ>1">ϕ>1 the mixture is rich.

For Lean Mixture:

CH4+2ϕ(O2+3.76N2)→CO2+2H2O+(2ϕ-2)O2+7.52ϕN2">CH4+ (2/ϕ) (O2+3.76N2)→CO2+2H2O+ ((2/ϕ)-2) O2 +(7.52/ϕ) N2

For Rich Mixture:

CH4+2ϕ(O2+3.76N2)→(4ϕ-3)CO2+2H2O+(4-4ϕ)CO2+7.52ϕN2">CH4+ (2/ϕ) (O2+3.76N2)→((4/ϕ)-3) CO2+2H2O+(4-(4/ϕ)) CO2 +(7.52/ϕ) N2

'''
Program to calculate ADT for different equivalence ratio

Stoichiometric Reaction
CH4 + 2(O2+ 3.76 N2) <=> CO2 + 2H2O + 7.52 N2+ 0O2+ 0CO

Lean mixture
CH4 + (2/phi)(O2+ 3.76 N2) <=> CO2 + 2H2O + (7.52/phi) N2 + (2*(1-phi)/phi)O2+ 0CO

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

'''

import matplotlib.pyplot as plt
import math

#Function to evaluate enthalpy

R=8.314 #J/kmol-K

def h(T, coeff):

	
	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

#Species coefficient from NASA website

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

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

N2react_coeff=[0.03298677E+02,0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04,0.03950372E+02]

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

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

N2product_coeff=[0.02926640E+02,0.14879768E-02,-0.05684760E-05,0.10097038E-09,-0.06753351E-13,-0.09227977E+04,0.05980528E+02]

O2product_coeff=[3.28253784E+00,1.48308754E-03,-7.57966669E-07,2.09470555E-10,-2.16717794E-14,-1.08845772E+03,5.45323129E+00]

CO_coeff=[2.71518561E+00,2.06252743E-03,-9.98825771E-07,2.30053008E-10,-2.03647716E-14,-1.41518724E+04,7.81868772E+00]


#Function to define the root finding problem

def f(T,mol_react,mol_product):
	
	T_std= 298.15
	h_CH4= h(T_std,CH4_coeff)
	h_O2_react= h(T_std,O2react_coeff)
	h_N2react= h(T_std,N2react_coeff)
	h_CO2= h(T,CO2_coeff)
	h_H2O= h(T,H2O_coeff)
	h_N2product= h(T,N2product_coeff)	
	h_O2_product= h(T,O2product_coeff)
	h_CO= h(T,CO_coeff)
	N_react= mol_react[0]+mol_react[1]+mol_react[2]
	N_product= mol_product[0]+mol_product[1]+mol_product[2]+mol_product[3]+mol_product[4] 

	h_reactant= mol_react[0]*h_CH4 + mol_react[1]*h_O2_react+ mol_react[2]*h_N2react
	h_product= mol_product[0]*h_CO2+ mol_product[1]*h_H2O+ mol_product[2]*h_N2product+mol_product[3]*h_O2_product+mol_product[4]*h_CO

	return h_product-h_reactant - R*(N_product*T-N_react*T_std)

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

T_guess=1400
tol=1e-3
x=0

#loop for phi from 0 to 2 

import numpy
phi = numpy.zeros(50)
for x in range (0,50): 
	phi[x]=(2/50)*(x+1)
	x=x+1

#loop for ADT for different phi
AFT = numpy.zeros(50)

i=0
for i in range (0,50):

#define moles for species based on equivalence ratio
	if phi[i]==1:
		mol_reactant=[1,2,7.52]
		mol_products=[1,2,7.52,0,0]
	elif phi[i]<1:	
		mol_reactant=[1,2/phi[i],7.52/phi[i]]
		mol_products=[1,2,7.52/phi[i],((2/phi[i])-2),0]
	elif  phi[i]>1:	
		mol_reactant=[1,2/phi[i],7.52/phi[i]]
		mol_products=[(4/phi[i])-3,2,7.52/phi[i],0,4-(4/phi[i])]

#Newton Rhapson method
	while (abs(f(T_guess,mol_reactant,mol_products))>tol):
		T_guess=T_guess-(f(T_guess,mol_reactant,mol_products)/fprime(T_guess,mol_reactant,mol_products))
		
	AFT[i]= T_guess	
	i=i+1

'''
Code for AFT calculation using Cantera
'''
AFT_Cantera = numpy.zeros(50)

import cantera as ct
gas = ct.Solution('gri30.xml')

i=0

for i in range (0,50):

#define moles for species based on equivalence ratio
	if phi[i]==1:
		mol_reactant=[1,2,7.52]
		mol_products=[1,2,7.52,0,0]
	elif phi[i]<1:	
		mol_reactant=[1,2/phi[i],7.52/phi[i]]
		mol_products=[1,2,7.52/phi[i],((2/phi[i])-2),0]
	elif  phi[i]>1:	
		mol_reactant=[1,2/phi[i],7.52/phi[i]]
		mol_products=[(4/phi[i])-3,2,7.52/phi[i],0,4-(4/phi[i])]

	gas.TPX = 298.15, 101325,{'CH4':mol_reactant[0],'O2':mol_reactant[1],'N2':mol_reactant[2]}
	gas.equilibrate('UV','auto')
	AFT_Cantera[i]=gas.T	

	i=i+1


plt.plot(phi,AFT,'*',color='blue',label='Python')
plt.plot(phi,AFT_Cantera,'.',color='red',label='Cantera')

plt.xlabel('Equivalence ratio')
plt.ylabel('Adiabatic flame temperature (in K)')
plt.title('Effect of equivalence ratio on AFT')
plt.legend()	
plt.show()
Results

  1. It can be observed from the plot at lower equivalence ratio, the results obtained from Python and Cantera are very similar. However, at higher equivalence ratio, the results diverge.
  2. At rich mixtures, the Python program underestimates the AFT as compared to Cantera. The complex nature of combustion which involves several hundred intermediary species is accurately estimated in Cantera.

2. Constant pressure reactor with heat loss

Case1: AFT of CH4, Phi and lambda = 1.0. Find the AFT of CH4 with H_loss = 0.35

Case 2: Comparison of Heat Loss and AFT for ethane, ethene and ethyne.

Case 3: Comparison of the effect of number of carbon atoms (from 1 to 3) on the final temperature. Assumed H_loss = 0

Case 1 :

Effect of loss of heat on Adiabatic Flame Temperature in a Constant Pressure Reactor.

In this case, we are considering the heat loss phenomenon in a constant pressure chamber. The reaction is not adiabatic hence there will be a loss of heat from the system to the outside world. The reaction we will be considering is the stoichiometric combustion of Methane-Air.

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

The maximum possible heat loss is going to be calculated using the Lower Heating Value (LHV). The heat loss factor is varied from no heat loss to 100% heat loss as a multiplier of LHV. Heat loss is an additive to the difference between the enthalpies of products and reactants.

HProducts-HReactants+(Heatloss⋅Qs)=0

Case 2 :

Effect of Fuel Types (Alkanes, Alkenes, Alkynes) on Adiabatic Flame Temperature with 35% Heat loss.

In this case, we will be examining the AFT of Alkane (Ethane), Alkene(Ethene), and Alkyne(Ethyne). We will be writing a code considering a heat loss of 35%.

Ethane:

C2H6+3.5(O2+3.76N2)→2CO2+3H2O+3.5(3.76N2)

Ethene:

C2H4+3(O2+3.76N2)→2CO2+2H2O+3(3.76N2)

Ethyne:

C2H2+2.5(O2+3.76N2)→2CO2+H2O+2.5(3.76N2)

Case 3 :

Effect of Number of Carbon Atoms (Methane, Ethane, Propane) on Adiabatic Flame Temperature.

In the above case, the carbon atom of an alkane is varied from 1 to 3 and the effect on AFT is studied. The combustion equation for the above class of hydrocarbons is given below:

Methane:

CH4+2(O2+3.76N2)→CO2+2H2O+2(3.762N2)

Ethane:

C2H6+3.5(O2+3.76N2)→2CO2+3H2O+3.5(3.76N2)

Propane:

C3H8+5(O2+3.76N2)→3CO2+4H2O+5(3.76N2)

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

def h(T,coeff):
	R = 8.314
	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


#reactant coeffs
CH4_l_coeff = [5.14987613E+00,-1.36709788E-02, 4.91800599E-05,-4.84743026E-08, 1.66693956E-11,-1.02466476E+04,-4.64130376E+00]
C2H6_l_coeff = [4.29142492E+00,-5.50154270E-03, 5.99438288E-05,-7.08466285E-08, 2.68685771E-11,-1.15222055E+04, 2.66682316E+00]
C3H8_l_coeff = [0.93355381E+00, 0.26424579E-01, 0.61059727E-05,-0.21977499E-07, 0.95149253E-11,-0.13958520E+05, 0.19201691E+02]

C2H4_l_coeff = [3.95920148E+00,-7.57052247E-03, 5.70990292E-05,-6.91588753E-08, 2.69884373E-11, 5.08977593E+03, 4.09733096E+00]
C2H2_l_coeff = [8.08681094E-01, 2.33615629E-02,-3.55171815E-05,2.80152437E-08,-8.50072974E-12, 2.64289807E+04, 1.39397051E+01]
O2_l_coeff = [3.78245636E+00,-2.99673416E-03, 9.84730201E-06,-9.68129509E-09, 3.24372837E-12,-1.06394356E+03, 3.65767573E+00]
N2_l_coeff = [0.03298677E+02, 0.14082404E-02,-0.03963222E-04,0.05641515E-07,-0.02444854E-10,-0.10208999E+04, 0.03950372E+02]
#product coeffs
CO2_h_coeff = [3.85746029E+00, 4.41437026E-03,-2.21481404E-06, 5.23490188E-10,-4.72084164E-14,-4.87591660E+04, 2.27163806E+00]
H20_h_coeff = [3.03399249E+00, 2.17691804E-03,-1.64072518E-07,-9.70419870E-11, 1.68200992E-14,-3.00042971E+04, 4.96677010E+00]
N2_h_coeff = [0.02926640E+02, 0.14879768E-02,-0.05684760E-05, 0.10097038E-09,-0.06753351E-13,-0.09227977E+04, 0.05980528E+02]

U = 500
R = 8.314
Tstd = 298.15
A = 1

#Case I: AFT of methane with heat loss of 0.35.

H_loss = 0.35
print('For Methane:')
def func_ch4(T):

	h_CH4_R = h(Tstd,CH4_l_coeff)
	h_O2_R = h(Tstd,O2_l_coeff)
	h_N2_R = h(Tstd,N2_l_coeff)
	#enthalpy reactants:
	H_reactants_CH4 = h_CH4_R+ (2*h_O2_R) + (7.52*h_N2_R)

	h_CO2_P = h(T,CO2_h_coeff)
	h_H20_P = h(T,H20_h_coeff)
	h_N2_P = h(T,N2_h_coeff)	
	#enthalpy products:
	H_products_CH4 = (h_CO2_P + 2*h_H20_P + 7.52*h_N2_P)

	max_heat_loss = U*A*(T - Tstd)

	return (H_reactants_CH4 - H_products_CH4) - H_loss*(max_heat_loss) 

def nd_ch4(T):
	return (func_ch4(T+1e-6) - func_ch4(T))/(1e-6) 

T_guess_ch4 = 1500
tol = 1e-6
alpha = 1
iteration = 0
while(abs(func_ch4(T_guess_ch4))>tol):
	T_guess_ch4 = T_guess_ch4 - alpha*(func_ch4(T_guess_ch4))/nd_ch4(T_guess_ch4)
	iteration = iteration + 1

print('AFT of Methane with heat loss of 0.35(of total heat loss) = ', T_guess_ch4,'K')

#CASE_2 = Comparison of heat loss and adiabatic flame temperature for Ethane,Ethene and Ethyne

#arrays used to compile AFTs and heat loss values:
t_ane=t_ene=t_yne=h_loss_comp=np.array([])
print('CASE_2:')
for H_loss in np.linspace(0,1,num=11):
	h_loss_comp = np.append(h_loss_comp,H_loss)
	def func_c2h6(T):

		h_C2H6_R = h(Tstd,C2H6_l_coeff)
		h_O2_R = h(Tstd,O2_l_coeff)
		h_N2_R = h(Tstd,N2_l_coeff)

		h_CO2_P = h(T,CO2_h_coeff)
		h_H20_P = h(T,H20_h_coeff)
		h_N2_P = h(T,N2_h_coeff)	

		#enthalpy reactants:
		H_reactants_C2H6 = h_C2H6_R+ (3.5*h_O2_R) + (13.16*h_N2_R)

		#enthalpy products:
		H_products_C2H6= (2*h_CO2_P + 3*h_H20_P + 13.16*h_N2_P)

		max_heat_loss = U*A*(T - Tstd)

		return (H_reactants_C2H6 - H_products_C2H6) - H_loss*(max_heat_loss)

	def func_c2h4(T):

		h_C2H4_R = h(Tstd,C2H4_l_coeff)
		h_O2_R = h(Tstd,O2_l_coeff)
		h_N2_R = h(Tstd,N2_l_coeff)

		h_CO2_P = h(T,CO2_h_coeff)
		h_H20_P = h(T,H20_h_coeff)
		h_N2_P = h(T,N2_h_coeff)

		#enthalpy reactants:	
		H_reactants_C2H4 = h_C2H4_R + (3*h_O2_R) + (11.28*h_N2_R)

		#enthalpy products:
		H_products_C2H4= (2*h_CO2_P + 2*h_H20_P + 11.28*h_N2_P)


		max_heat_loss = U*A*(T - Tstd)

		return (H_reactants_C2H4 - H_products_C2H4) - H_loss*(max_heat_loss)


	def func_c2h2(T):

		h_C2H2_R = h(Tstd,C2H2_l_coeff)
		h_O2_R = h(Tstd,O2_l_coeff)
		h_N2_R = h(Tstd,N2_l_coeff)

		h_CO2_P = h(T,CO2_h_coeff)
		h_H20_P = h(T,H20_h_coeff)
		h_N2_P = h(T,N2_h_coeff)


		#enthalpy reactants:
		H_reactants_C2H2 = h_C2H2_R + (2.5*h_O2_R) + (9.3*h_N2_R)

		#enthalpy products:
		H_products_C2H2= (2*h_CO2_P + 1*h_H20_P + 9.3*h_N2_P)

		max_heat_loss = U*A*(T - Tstd)

		return (H_reactants_C2H2 - H_products_C2H2) - H_loss*(max_heat_loss)


	#Numerical derivative of temperature:
	def nd_c2h6(T):
		return (func_c2h6(T+1e-6) - func_c2h6(T))/(1e-6) 

	def nd_c2h4(T):
		return (func_c2h4(T+1e-6) - func_c2h4(T))/(1e-6) 

	def nd_c2h2(T):
		return (func_c2h2(T+1e-6) - func_c2h2(T))/(1e-6) 


	#Initial guess:
	T_guess_c2h6 = T_guess_c2h4 = T_guess_c2h2 = 1500 

	tol = 1e-6
	iteration = 0
	alpha = 1


	while(abs(func_c2h6(T_guess_c2h6))>tol):
		T_guess_c2h6 = T_guess_c2h6 - alpha*(func_c2h6(T_guess_c2h6))/nd_c2h6(T_guess_c2h6)
		iteration = iteration + 1

	t_ane = np.append(t_ane,T_guess_c2h6)

	while(abs(func_c2h4(T_guess_c2h4))>tol):
		T_guess_c2h4 = T_guess_c2h4 - alpha*(func_c2h4(T_guess_c2h4))/nd_c2h4(T_guess_c2h4)
		iteration = iteration + 1
	t_ene = np.append(t_ene,T_guess_c2h4)

	while(abs(func_c2h2(T_guess_c2h2))>tol):
		T_guess_c2h2 = T_guess_c2h2 - alpha*(func_c2h2(T_guess_c2h2))/nd_c2h2(T_guess_c2h2)
		iteration = iteration + 1
	t_yne = np.append(t_yne,T_guess_c2h2)

	print('AFT for ethane(K):',T_guess_c2h6)
	print('AFT for ethene(K):',T_guess_c2h4)
	print('AFT for ethyne(K):',T_guess_c2h2)
	print('-----------------------------------------')

#CASE_3 :COMPARISON BETWEEN CARBON ATOMS(1 to 3):
H_loss = 0
print('CASE_3:')
def func_ch4(T):

	h_CH4_R = h(Tstd,CH4_l_coeff)
	h_O2_R = h(Tstd,O2_l_coeff)
	h_N2_R = h(Tstd,N2_l_coeff)
	#enthalpy reactants:
	H_reactants_CH4 = h_CH4_R+ (2*h_O2_R) + (7.52*h_N2_R)

	h_CO2_P = h(T,CO2_h_coeff)
	h_H20_P = h(T,H20_h_coeff)
	h_N2_P = h(T,N2_h_coeff)	
	#enthalpy products:
	H_products_CH4 = (h_CO2_P + 2*h_H20_P + 7.52*h_N2_P)

	max_heat_loss = U*A*(T - Tstd)

	return (H_reactants_CH4 - H_products_CH4) - H_loss*(max_heat_loss) 

def func_c2h6(T):

	h_C2H6_R = h(Tstd,C2H6_l_coeff)
	h_O2_R = h(Tstd,O2_l_coeff)
	h_N2_R = h(Tstd,N2_l_coeff)

	h_CO2_P = h(T,CO2_h_coeff)
	h_H20_P = h(T,H20_h_coeff)
	h_N2_P = h(T,N2_h_coeff)	

	#enthalpy reactants:
	H_reactants_C2H6 = h_C2H6_R+ (3.5*h_O2_R) + (13.16*h_N2_R)

	#enthalpy products:
	H_products_C2H6= (2*h_CO2_P + 3*h_H20_P + 13.16*h_N2_P)

	max_heat_loss = U*A*(T - Tstd)

	return (H_reactants_C2H6 - H_products_C2H6) - H_loss*(max_heat_loss)

def func_c3h8(T):

	h_C3H8_R = h(Tstd,C3H8_l_coeff)
	h_O2_R = h(Tstd,O2_l_coeff)
	h_N2_R = h(Tstd,N2_l_coeff)
	#enthalpy reactants:
	H_reactants_C3H8 = h_C3H8_R+ (5*h_O2_R) + (18.8*h_N2_R)

	h_CO2_P = h(T,CO2_h_coeff)
	h_H20_P = h(T,H20_h_coeff)
	h_N2_P = h(T,N2_h_coeff)	
	#enthalpy products:
	H_products_C3H8 = (3*h_CO2_P + 4*h_H20_P + 18.8*h_N2_P)
	max_heat_loss = U*A*(T - Tstd)

	return (H_reactants_C3H8 - H_products_C3H8) - H_loss*(max_heat_loss) 

def nd_ch4(T):
	return (func_ch4(T+1e-6) - func_ch4(T))/(1e-6) 

def nd_c2h6(T):
	return (func_c2h6(T+1e-6) - func_c2h6(T))/(1e-6) 

def nd_c3h8(T):
	return (func_c3h8(T+1e-6) - func_c3h8(T))/(1e-6) 

T_guess_ch4 = T_guess_c3h8 = 1500 
tol = 1e-6
iteration = 0
alpha = 1

while(abs(func_ch4(T_guess_ch4))>tol):
	T_guess_ch4 = T_guess_ch4 - alpha*(func_ch4(T_guess_ch4))/nd_ch4(T_guess_ch4)
	iteration = iteration + 1

while(abs(func_c2h6(T_guess_c2h6))>tol):
	T_guess_c2h6 = T_guess_c2h6 - alpha*(func_c2h6(T_guess_c2h6))/nd_c2h6(T_guess_c2h6)
	iteration = iteration + 1

while(abs(func_c3h8(T_guess_c3h8))>tol):
	T_guess_c3h8 = T_guess_c3h8 - alpha*(func_c3h8(T_guess_c3h8))/nd_c3h8(T_guess_c3h8)
	iteration = iteration + 1



print('AFT for methane:',T_guess_ch4)
print('AFT for ethane:',T_guess_c2h6)
print('AFT for propane:',T_guess_c3h8)
plt.figure(1)
plt.xlabel('Heat loss')
plt.ylabel('Adiabatic Flame Temperature(K)')
plt.title('Heat loss vs Adiabatic Flame Temperature(K)')
plt.plot(h_loss_comp,t_ane,label='Ethane',color ='r')
plt.plot(h_loss_comp,t_ene,label='Ethene',color='b')
plt.plot(h_loss_comp,t_yne,label='Ethyne',color='g')
plt.legend()



temp = (T_guess_ch4,T_guess_c2h6,T_guess_c3h8)

temp = np.array(temp)
print(temp)
plt.figure(2)
plt.bar(['CH4=1', 'C2H6=2', 'C3H8=3'], temp)
plt.ylabel('Adaiabatic Flame Temperature')
plt.xlabel('According to number of atoms')
plt.title('AFT vs Fuel type)')
plt.show()
plt.show()

Results

AFT for various fuel types such as alkanes, alkenes, and alkynes

Observations

  1. Heat loss and AFT are inversely proportional.
  2. As the value of heat loss increase for Ethyne, the AFT reduces far more aggressively compared to Ethane and Ethene.

AFT wrt varying the number of carbon atoms

  1. AFT increases => increase in C atoms

The AFT for the constant pressure with heat loss for CH4

AFT of CH4 with 35% heat loss = 1744 K

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.