Chapter 3:Reactive Sysyem

Example 3.1 Page no 66

In [1]:
#given
E=20.0                           #Methanol burned with excess air in percentage 
p=1.0                            #Pressure of air in bar
t=27.0                           #Temperature of air in degree centigrade
O=32.0                           #The molecular weight of oxygen
N=28.0                           #The molecular weight of nitrogen
R=8314.0                         #Universal gas constant in Nm/kmolK
C=32.0                           #Molecular weight of methanol
CO=44.0                          #Molecular weight of the carbondioxide 
H=18.0                           #Molecular weight of the water

#Calculations
S=((1.8*O)+(6.768*N))/C
A=((1.8*O)+(6.768*N))/C
M=1.8+6.768
V=(M*R*(t+273))/(p*10**5)
T=(1+1.8+6.768)
Cm=(1/T)
Om=(1.8/T)
Nm=(6.768/T)
Mr=(Cm*C)+(Om*O)+(Nm*N)
Tp=(1+2+6.768+0.3)
COm=(1/Tp)
Hp=(2/Tp)
Np=(6.768/Tp)
Op=(0.3/Tp)
Mp=(COm*CO)+(Hp*H)+(Np*N)+(Op*O)
Pp=(Hp*p)
D=60

#Output
print"(a) The volume of air supplied per kmole of fuel = ",round(V,3),"m**3/kmole fuel"
print"(b) The molecular weight of the reactants = ",round(Mr,3)
print"The molecular weight of the products =",round(Mp,3)
print"(c) The dew point of the products = ",D,"degree centigrade" 
(a) The volume of air supplied per kmole of fuel =  213.703 m**3/kmole fuel
(b) The molecular weight of the reactants =  29.171
The molecular weight of the products = 27.722
(c) The dew point of the products =  60 degree centigrade

Example 3.2 Page no 67

In [6]:
#given
C1=40.0                               #The content of C7H16 in the fuel in percentage
C2=60.0                               #The content of C8H18 in the fuel in percentage
d=0.12                              #The diameter of the bore in m
l=0.145                             #The length of the bore in m
r=8.5                               #Compression ratio 
p=1.1                               #Pressure at exhaust stroke in bar
T=720.0                               #The temperature at the exhaust stroke in K
O=32.0                                #The molecular weight of oxygen
N=28.0                                #The molecular weight of nitrogen
C3=100.0                              #Molecular weight of C7H16
C4=114.0                              #The molecular weight of C8H18
R=8314.0                              #Universal gas constant in Nm/kmolK
CO2=44.0                              #Molecular weight of the carbondioxide 
C5=28.0                               #Molecular weight of the carbonmonoxide
H=18.0                                #Molecular weight of the water

#Calculations
import math
N2=100-(12+1.5+2.5)
Y=84/3.76
X=13.5/7.6
Z=(22.34-15.25)*2
Hl=(6.4+10.8)/2.0
Hr=7.98
Hd=Hl-Hr
A=((12.58*(O+(3.76*N)))/(((C1/100.0)*C3)+((C2/100.0)*C4)))
Vs=(math.pi/4.0)*d**2*l
Vc=Vs/(r-1)
M=((6.757*CO2)+(0.8446*C5)+(1.408*O)+(47.3*N)+(8.6*H))/(6.757+0.8446+1.408+47.3+8.6)
R1=R/M
m=((p*10**5)*Vc)/(R1*T)

#Output 
print"(a)The air/fuel ratio = ",round(A,2)
print"(b)The mass of the exhaust gases in the clearance space = ",round(m*1000,3),"*10**-3kg" 
(a)The air/fuel ratio =  15.93
(b)The mass of the exhaust gases in the clearance space =  0.114 *10**-3kg

Example 3.3 Page no 69

In [8]:
#given
C=0.86                        #The amount of carbon content in the 1kg of fuel by weight in kg
H=0.05                        #The amount of hydrogen content in the 1kg of fuel by weight in kg
O=0.02                        #The amount of oxygen content in the 1kg of fuel by weight in kg
S=0.005                       #The amount of sulphur content in the 1kg of fuel by weight in kg
N=0.065                       #The amount of nitrogen content in the 1kg of fuel by weight in kg
E=25.0                          #The amount of excess air supplied in percentage
o=32.0                          #Molecular weight of the oxygen
co=44.0                         #Molecular weight of the carbondioxide 
c=12.0                        #Molecular weight of the carbon
s=32.0                        #Molecular weight of the sulphur
so=64.0                         #Molecular weight of sulphur dioxide
n=28.0                          #Molecular weight of the nitrogen

#Calculations
o1=(o/c)*C
coa=(co/c)*C
o2=(o/4.0)*H
h2=(36/4.0)*H
o3=(o/s)*S
s1=(so/s)*S
To=o1+o2+o3
Tt=To-O
As=(Tt*100)/23.0
as_=As*(1+(E/100.0))
o2a=0.23*(E/100)*As
n2a=0.77*(1+(E/100))*As
n2e=n2a+N
Tw=coa+n2e+o2a
pco=(coa/Tw)*100
pn=(n2e/Tw)*100
po=(o2a/Tw)*100
mco=(coa/co)
mn=(n2e/n)
mo=(o2a/o)
Tm=mco+mn+mo
vco=(mco/Tm)*100
vn=(mn/Tm)*100
vo=(mo/Tm)*100

#Output
print"(a)Stoichiometric air/fuel ratio = ",round(As,2) 
print"(b)The percentage of dry products of combustion by weight :"
print" CO2 = ",round(pco,2),"percent"
print"N2 = ",round(pn,2),"percent"
print"O2 = ",round(po,2),"percent"
print"(c)The percentage of dry products of combustion by volume : "
print"CO2 = ",round(vco,2),"percent"
print"N2 = ",round(vn,2),"percent"
print"O2= ",round(vo,2),"percent" 
(a)Stoichiometric air/fuel ratio =  11.64
(b)The percentage of dry products of combustion by weight :
 CO2 =  20.89 percent
N2 =  74.68 percent
O2 =  4.44 percent
(c)The percentage of dry products of combustion by volume : 
CO2 =  14.47 percent
N2 =  81.3 percent
O2=  4.23 percent

Example 3.4 Page no 71

In [12]:
#given
CO=12.0                    #The composition of carbondioxide of combustion by volume in percentage 
C=0.5                    #The composition of carbonmoxide of combustion by volume in percentage 
O=4.0                      #The composition of oxygen of combustion by volume in percentage 
N=83.5                   #The composition of nitrogen of combustion by volume in percentage 
o=32.0                     #Molecular weight of the oxygen
co=44.0                    #Molecular weight of the carbondioxide 
c=12.0                     #Molecular weight of the carbon
s=32.0                     #Molecular weight of the sulphur
so=64.0                    #Molecular weight of sulphur dioxide
n1=28.0                    #Molecular weight of the nitrogen
h=2.0                      #Molecular weight of the hydrogen

#Calculations
m=12+0.5
x=N/3.76
z=(x-(CO+(C/2)+O))*2
n=z*h
Af=((x*o)+(N*n1))/((m*c)+(n))
As=((18.46*o)+(69.41*n1))/173.84
Ta=(Af/As)*100
mc=((m*c)/173.84)*100
mh=(n/173.84)*100

#Output
print"(a)The air/fuel ratio = ",round(Af,1)
print"(b)The percent theoretical air = ",round(Ta,1),"%"
print"(c)The percentage composition of fuel on a mass basis : " 
print"C = ",round(mc,1),"%"
print"H = ",round(mh,1),"percent" 
(a)The air/fuel ratio =  17.5
(b)The percent theoretical air =  120.3 %
(c)The percentage composition of fuel on a mass basis : 
C =  86.3 %
H =  13.7 percent

Example 3.5 Page no 72

In [14]:
#given
C=86.0                                    #The composition of carbon in the fuel by weight in percentage
H=14.0                                    #The composition of hydrogen in the fuel by weight in percentage
e=1.25                                  #Equivalent ratio
o=32.0                                    #Molecular weight of the oxygen
co=44.0                                   #Molecular weight of the carbondioxide 
c=12.0                                    #Molecular weight of the carbon
s=32.0                                    #Molecular weight of the sulphur
so=64.0                                   #Molecular weight of sulphur dioxide
n=28.0                                    #Molecular weight of the nitrogen
h2=2.0                                    #Molecular weight of the hydrogen
Fc=0.86                                 #Fraction of C

#Calculations
Ra=1/Fc
x=2*(1+(0.9765/2.0)-(1.488*0.8))
Tm=0.5957+0.4043+4.476
vc=(0.5957/Tm)*100
vco=(0.4043/Tm)*100
vn=(4.476/Tm)*100

#Calculations
print"The percentage analysis of dry exhaust gas by volume : "
print"CO = ",round(vc,2),"percent" 
print"CO2 = ",round(vco,2),"percent" 
print"N2 = ",round(vn,2),"percent" 
The percentage analysis of dry exhaust gas by volume : 
CO =  10.88 percent
CO2 =  7.38 percent
N2 =  81.74 percent

Example 3.6 Page no 77

In [15]:
#given
t=25.0                                #The temperature of both reactants and products in degree centigrade
p=1.0                                 #The pressure of both reactants and products in bar

#Calculations 
h=0
hf1=-103.85
hf2=-393.52
hf3=-285.8
hf4=(3*hf2)+(4*hf3)
Q=hf4-hf1

#Output
print" The heat transfer per mole of fuel = ",Q,"kJ/mol fuel"
 The heat transfer per mole of fuel =  -2219.91 kJ/mol fuel

Example 3.7 Page no 77

In [16]:
#given
t=25.0                                 #The temperature of the air entering the diesel engine in degree centigrade 
T=600.0                                #The temperature at which the products are released in K
Ta=200.0                               #Theoretical air used in percentage 
Q=-93.0                                #Heat loss from the engine in MJ/kmol fuel
f=1.0                                  #The fuel rate in kmol/h

#Calculations 
hfr=-290.97
h1=-393.52
h11=12.916
hfc=h1+h11
h2=-241.82
h22=10.498
hfh=h2+h22
h3=0 
h33=9.247
hfo=h3+h33
h4=0
h44=8.891
hfn=h4+h44
hfp=(12*hfc)+(13*hfh)+(18.5*hfo)+(139.12*hfn)
W=Q+hfr-hfp
W1=(f*W*10**3)/3600.0

#Output
print"The work for a fuel rate of 1 kmol/h is ",round(W1,0),"kW"
The work for a fuel rate of 1 kmol/h is  1606.0 kW

Example 3.8 Page no 78

In [17]:
#given
P=600                               #Power of an engine in kW
t=25                                #Temperature at which fuel is used in degree centigrade
Ta=150                              #Theoretical air used in percentage
T1=400                              #The temperature at which air enters in K
T2=700                              #The temperature at which the products of combustion leave in K
Q=-150                              #The heat loss from the engine in kW
C=12                                #Molecular weight of carbon
h=1                                 #Molecular weight of hydrogen

#Calculations
hfc=-259.28
hfo1=3.029
hfn1=2.971
HR=(hfc)+(1.5*12.5*hfo1)+(1.5*12.5*3.76*hfn1)
hfco=-393.52
hfco1=17.761
hfh=-241.82
hfh1=14.184
hfo2=12.502
hfn2=11.937
HP=(8*(hfco+hfco1))+(9*(hfh+hfh1))+(6.25*hfo2)+(70.5*hfn2)
H=HP-HR
nf=((Q-P)*3600)/(H*10.0**3)
M=(8*C)+(18*h)
mf=nf*M

#Output
print" The fuel consumption for complete combustion is ",round(mf,1),"kg/h"
 The fuel consumption for complete combustion is  74.3 kg/h

Example 3.9 Page no 79

In [18]:
#given
t=25                          #Temperature at which fuel is used for combustion in degree centigrade 
p=1                           #The pressure at which fuel is used in bar
T=400                         #The temperature of the products of combustion in K
R=8.314*10**-3                #Universal gas constant
hfco=-393.52                  #The enthalpy of the carbondioxide in MJ/kmol fuel
hfco1=4.008                   #The change in enthalpy of the carbondioxide for the given conditions in MJ/kmol fuel
hfh=-241.82                   #The enthalpy of the water in MJ/kmol fuel
hfh1=3.452                    #The change in enthalpy of the water for the given conditions in MJ/kmol fuel

#Calculations
hfc=-103.85 
HR=(1*(hfc-(R*(t+273))))+(5*(-R*(t+273)))
HP=(3*(hfco+hfco1-(R*T)))+(4*(hfh+hfh1-(R*T)))
Q=HP-HR
Q1=-Q

#Output
print"The heat transfer per mole of propane = ",round(Q1,1),"kJ/mol propane"
The heat transfer per mole of propane =  2026.6 kJ/mol propane

Example 3.10 Page no 82

In [19]:
#given
T=1500                            #The given temperature in K
hfco=-393.52                      #The enthalpy of formation for carbondioxide in MJ/kmol
hf1=61.714                        #The change in enthalpy for actual state and reference state in MJ/kmol
hfc=-110.52                       #The enthalpy of formation for carbonmonoxide in MJ/kmol
hf2=38.848                        #The change in enthalpy of CO for actual and reference state in MJ/kmol
hfo=0                             #The enthalpy of formation for oxygen gas
hf3=40.61                         #The change in enthalpy of oxygen for different states in MJ/kmol

#Calculations
HP=hfco+hf1
HR=(hfc+hf2)+(0.5*(hfo+hf3))
H=HP-HR

#Output
print" The enthalpy of combustion is  ",round(H,1),"MJ/kmol CO"
 The enthalpy of combustion is   -280.4 MJ/kmol CO

Example 3.11 Page no 83

In [25]:
#given
E=30                        #The amount of excess air in percentage
tp=400                      #The temperature at which propane enters in K
ta=300                      #The temperature at which air enters in K
T=900                       #The temperature at which products leave in K
m=83.7                      #The average molar specific heat of propane at consmath.tant pressure in kJ/kmolK
Mp=44                       #The molecular weight of propane
hfc=-393.52                 #The enthalpy of formation for carbondioxide in MJ/kmol
hf1=28.041                  #The change in enthalpy of CO2 for actual and reference state in MJ/kmol
hfh=-241.82                 #The enthalpy of formation for water in MJ/kmol
hf2=21.924                  #The change in enthalpy of water for actual and reference state in MJ/kmol
hfn=0                       #The enthalpy of nitrogen gas 
hf3=18.221                  #The change in enthalpy of nitrgen for actual and reference state in MJ/kmol
hfo=0                       #The enthalpy of oxygen gas 
hf4=19.246                  #The change in enthalpy of oxygen for actual and reference state in MJ/kmol
hfp=-103.85                 #The enthalpy of formation for propane in MJ/kmol
R=0.0837                    #Universal gas constant 
hfo1=0                      #The enthalpy of oxygen gas 
hf11=0.054                  #The change in enthalpy of oxygen gas for actual and reference state in MJ/kmol
hfn1=0                      #The enthalpy of nitrogen gas
hfn22=0.054                 #The change in enthalpy of nitrogen for actual and reference state in MJ/kmol

#Calculations

HP=(3*(hfc+hf1))+(4*(hfh+hf2))+(24.44*(hfn+hf3))+(1.5*(hfo+hf4))
HR=(1*(hfp+(R*(tp-ta))))+(6.5*(hfo1+hf11))+(24.44*(hfn1+hfn22))
Q=HP-HR
Q1=(-Q/Mp)

#Output
print" The amount of heat transfer per kg of fuel is  ",round(Q1,3),"MJ/kg"
 The amount of heat transfer per kg of fuel is   32.0 MJ/kg

Example 3.12 Page no 84

In [27]:
#given
Ta=150                            #The presence of Theoretical air
hfc=-393.52                       #The enthalpy of formation for carbondioxide in MJ/kmol
hfh=-285.8                        #The enthalpy of formation for water in MJ/kmol
hfon=0                            #The enthalpy of formation for oxygen and nitrogen gas 
hfch=-74.87                       #The enthalpy of formation for methane in MJ/kmol
np=2                              #Number of moles of product
nr=4                              #Number of moles of reactant
R=8.314*10**-3                    #Universal gas constant 
t=298                             #The temperature in K
hfh1=-241.82                      #The enthalpy of formation for water in MJ/kmol
np1=4                             #Number of moles of product
nr1=4                             #Number of moles of reactant

#Calculations
HP=(hfc)+(2*hfh)
HR=1*hfch
H=HP-HR
n=np-nr
U1=H-(n*R*t)
HP1=(1*hfc)+(2*hfh1)
H1=HP1-HR
n1=np1-nr1
U2=H1-(n1*R*t)

#Output
print"(a)The water as liquid" 
print"The standard enthalpy of combustion is ",H, "MJ/kmol"
print"The standard internal energy of combustion is ",round(U1,3),"MJ/kmol"
print"(b)The water as a gas "
print"The standard enthalpy of combustion is  ",H1,"MJ/kmol"
print"The standard internal energy of combustion is ",U2,"MJ/kmol" 
(a)The water as liquid
The standard enthalpy of combustion is  -890.25 MJ/kmol
The standard internal energy of combustion is  -885.295 MJ/kmol
(b)The water as a gas 
The standard enthalpy of combustion is   -802.29 MJ/kmol
The standard internal energy of combustion is  -802.29 MJ/kmol

Example 3.13 Page no 85

In [21]:
#given
cv=44000                       #The lower calorific value of liquid fuel in kJ/kg
C=84                           #The carbon content present in the fuel in percentage
H=16                           #The hydrogen content present in the fuel in percentage
t=25                           #The temperature in degree centigrade
hfg=2442                       #The enthalpy of vaporization for water in kJ/kg
c=12.0                         #Molecular weight of carbon 
h=2                            #Molecular weight of hydrogen
co2=44.0                       #Molecular weight of carbondioxide
h2o=18                         #Molecular weight of water 
o2=32.0                        #Molecular weight of oxygen
R=8.314                        #Universal gas constant in J/molK

#Calculations
CO2=(0.84*(co2/c))
H2O=(0.16*(h2o/h))
cvd=H2O*hfg
HHV=cv+cvd
np=3.08/co2
nr=3.52/o2
n=np-nr
HHVv=HHV+(n*R*(t+273))
LHVv=cv+(n*R*(t+273))

#Output
print" The higher calorific value at constant pressure = ",HHV,"kJ/kg fuel" 
print"The higher calorific value at constant volume = ",round(HHVv,0),"kJ/kg fuel"
print"The lower calorific value at constant volume = ",round(LHVv,0),"kJ/kg fuel"
 The higher calorific value at constant pressure =  47516.48 kJ/kg fuel
The higher calorific value at constant volume =  47417.0 kJ/kg fuel
The lower calorific value at constant volume =  43901.0 kJ/kg fuel

Example 3.14 Page no 87

In [22]:
#given
E=100                          #The amount of excess air in percent
T=298                          #The temperature of reactants in K
nc=1                           #Number of moles of propane
hfch=-103.85                   #Enthalpy of formation for propane in MJ/kmol fuel
hfc=-393.52                    #Enthalpy of formation for carbondioxide in MJ/kmol fuel
hfh=-241.82                    #Enthalpy of formation for water in MJ/kmol fuel
hfon=0                         #Enthalpy of formation for both oxygen and nitrogen gas
T1=1500                        #Assuming the products temperature for fist trail in K
hfc1=61.714                    #The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel
hfh1=48.095                    #The change in enthalpy for water for trail temp in MJ/kmol fuel
hfo1=40.61                     #The change in enthalpy for oxygen for trail temp in MJ/kmol fuel
hfn1=38.405                    #The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel
T2=1600                        #Assuming the products temperature for second trail in K
hfc2=67.58                     #The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel
hfh2=52.844                    #The change in enthalpy for water for trail temp in MJ/kmol fuel
hfo2=44.279                    #The change in enthalpy for oxygen for trail temp in MJ/kmol fuel
hfn2=41.903                    #The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel

#Calculations
HR=nc*hfch
x=HR-((3*hfc)+(4*hfh)+(5*hfon)+(37.6*hfon))
hfn=x/37.6
HP1=(HR-x)+(3*hfc1)+(4*hfh1)+(5*hfo1)+(37.6*hfn1)
HP2=(HR-x)+(3*hfc2)+(4*hfh2)+(5*hfo2)+(37.6*hfn2)
Te=(((HR-HP1)/(HP2-HP1))*(T2-T1))+T1

#Output
print" The adiabatic flame temperature for steady-flow process is  ",round(Te,0),"K"
 The adiabatic flame temperature for steady-flow process is   1510.0 K

Example 3.15 Page no 89

In [23]:
#given
T=600                            #The initial temperature of air in K
p=1                              #The initial pressure of air in atm
R=8.314                          #Universal gas constant in J/molK
Tr=298                           #The temperature of reactants in K
a=4.503                          #Given Constants 
b=-8.965*10**-3
c=37.38*10**-6
d=-36.49*10**-9
e=12.22*10**-12
hfc=-393.52                      #Enthalpy of formation for carbondioxide in MJ/kmol fuel
hfh=-241.82                      #Enthalpy of formation for water in MJ/kmol fuel
hfn=0                            #Enthalpy of formation for nitrogen gas
hfc1=-74.87                      #The enthalpy of formation for methane in MJ/kmol fuel 
hfh1=9.247                       #The change in enthalpy of the water in MJ/kmol
hfn1=8.891                       #The change in enthalpy of nitrogen in MJ/kmol
Tc=3700                          #The corresponding temperature for the enthalpy of guess nitrogen in K
T1=2800                          #The temperature assumed for the first trail in K
hco1=140.444                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hh1=115.294                      #The change in enthalpy for the assume temp for water in MJ/kmol
hn1=85.345                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol
T2=2500                          #The temperature assumed for the second trail in K
hco2=121.926                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hh2=98.964                       #The change in enthalpy for the assume temp for water in MJ/kmol
hn2=74.312                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol
T3=2600                          #The temperature fo the third trail in K
hco3=128.085                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hh3=104.37                       #The change in enthalpy for the assume temp for water in MJ/kmol
hn3=77.973                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol
Tc1=3000                         #Assume temperature for first trail in K
hcoa1=146.645                    #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hha1=120.813                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hna1=89.036                      #The change in enthalpy for the assume temp for nitrogen in MJ/kmol
Tc2=3200                         #Assume temperature for the second trail in K
hcoa2=165.331                    #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol
hha2=137.553                     #The change in enthalpy for the assume temp for water in MJ/kmol
hna2=100.161                     #The change in enthalpy for the assume temp for nitrogen in MJ/kmol

#Calculations
HP=(1*hfc)+(2*hfh)+(7.52*hfn)
hch=(R*((a*(T-Tr))+((b/2.0)*(T**2-Tr**2))+((c/3.0)*(T**3-Tr**3))+((d/4.0)*(T**4-Tr**4))+((e/5.0)*(T**5-Tr**5))))/1000.0
HR=((hfc1+hch)+(2*hfh1)+(7.52*hfn1))
x=HR-HP
hfn2=x/7.52
HP1=hco1+(2*hh1)+(7.52*hn1)+(HR-x)
HP2=hco2+(2*hh2)+(7.52*hn2)+(HR-x)
HP3=hco3+(2*hh3)+(7.52*hn3)+(HR-x)
Ta1=(((HR-HP2)/(HP3-HP2))*(T3-T2))+T2
UR1=HR-(10.52*R*10**-3*T)
UP1=hcoa1+(2*hha1)+(7.52*hna1)+(HR-x)-(0.08746*Tc1)
UP2=hcoa2+(2*hha2)+(7.52*hna2)+(HR-x)-(0.08746*Tc2)
Tu=(((UR1-UP1)/(UP2-UP1))*(Tc2-Tc1))+Tc1

#Output
print"The adiabatic flame temperature at  "
print"(a)Constant pressure process is ",round(Ta1,0),"K" 
print"(b)Constant volume process is ",round(Tu,3),"K"
The adiabatic flame temperature at  
(a)Constant pressure process is  2550.0 K
(b)Constant volume process is  3089.34 K

Example 3.16 Page no 91

In [27]:
#given
T=600.0                          #Temperature at constant pressure process in K
p=1.0                            #The pressure in atm
E=50.0                           #The amount of excess air in percent
L=20.0                           #The amount of less air in percent
cp=52.234                        #Specific constant for methane in kJ/kmolK
t=298.0                        #Assume the normal temperature in K
hfch=-74.87                    #The enthalpy of formation for carbondioxide in MJ
ho=9.247                       #The change in enthalpy of oxygen in MJ
hn=8.891                       #The change in enthalpy of nitrogen in MJ
hfc1=-393.52                   #The enthalpy of formation of carbondioxide in MJ
hfh1=-241.82                   #The enthalpy of formation of water in MJ
Tc=2800.0                        #The corresponding temperature in K
T1=2000                        #The temperature for first trail in K
hfc11=91.45                    #The enthalpy for the assume temp for carbondioxide in MJ
hfh11=72.689                   #The change in enthalpy for the assume temp for water in MJ
hfn11=56.141                   #The change in enthalpy for the assume temp for nitrogen in MJ
hfo11=59.199                   #The change in enthalpy for the assume temp for oxygen in MJ
T2=2100                        #The temperature for second trail in K
hfc22=97.5                     #The enthalpy for the assume temp for carbondioxide in MJ
hfh22=77.831                   #The change in enthalpy for the assume temp for water in MJ
hfn22=59.748                   #The change in enthalpy for the assume temp for nitrogen in MJ
hfo22=62.986                   #The change in enthalpy for the assume temp for oxygen in MJ
hfchr=-74.87                   #The enthalpy of formation for methane in MJ
hor=9.247                      #The change in enthalpy for oxygen in MJ
hnr=8.891                      #The change in enthalpy for nitrogen in MJ
hfcop=-110.52                  #The formation of enthalpy for carbonmoxide in MJ
hfcp=-393.52                   #The formation of enthalpy for carbondioxide in MJ
hfhp=-241.82                   #The formation of enthalpy for water in MJ
Tp1=2000.0                       #The temperature for first trail in K
hco11=56.739                   #The change in enthalpy for CO in MJ
hco211=91.45                   #The change in enthalpy for CO2 in MJ
hh11=72.689                    #The change in enthalpy for water in MJ
hn11=56.141                    #The change in enthalpy for nitrogen in MJ
Tp2=2400                       #The temperature for second trail in K
hco22=71.34                    #The change in enthalpy for CO in MJ
hco222=115.788                 #The change in enthalpy for CO2 in MJ
hh22=93.604                    #The change in enthalpy for water in MJ
hn22=70.651                    #The change in enthalpy for nitrogen in MJ
Tp3=2300.0                       #The temperature for first trail in K
hco33=67.676                   #The change in enthalpy for CO in MJ
hco233=109.671                 #The change in enthalpy for CO2 in MJ
hh33=88.295                    #The change in enthalpy for water in MJ
hn33=67.007                    #The change in enthalpy for nitrogen in MJ
hccc=-283.022                  #The only combustible substance is CO in MJ/kmol

#Calculations
hch=cp*(T-t)*10**-3
HR=hfch+hch+(3*ho)+(11.28*hn)
HP=hfc1+(2*hfh1)
x=HR-HP
hn2=x/11.28
HP1=hfc11+(2*hfh11)+(11.28*hfn11)+(hfo11)+(HR-x)
HP2=hfc22+(2*hfh22)+(11.28*hfn22)+(hfo22)+(HR-x)
Ta1=(((HR-HP1)/(HP2-HP1))*(T2-T1))+T1
X=2*(2-1.6)
HRr=hfchr+hch+(1.6*hor)+(6.01*hnr)
HPp=(0.8*hfcop)+(0.2*hfcp)+(2*hfhp)
HPp1=(0.8*hco11)+(0.2*hco211)+(2*hh11)+(6.016*hn11)-HPp
HPp2=(0.8*hco22)+(0.2*hco222)+(2*hh22)+(6.016*hn22)+HPp
HPp3=(0.8*hco33)+(0.2*hco233)+(2*hh33)+(6.016*hn33)+HPp
Ta2=(((HRr-HPp3)/(HPp2-HPp3))*(Tp2-Tp3))+Tp3
Q=-0.8*hccc                                                    #The thermal energy loss in MJ/kmol fuel

#Output
print" The adiabatic flame temperature having "
print"(a)50 percent excess air is ",round(Ta1,1),"K"
print"(b)20 percent less air is ",round(Ta2,2),"K"
print"The loss of thermal energy due to incomplete combustion is ",round(Q,2),"MJ/kmol fuel"
 The adiabatic flame temperature having 
(a)50 percent excess air is  2027.6 K
(b)20 percent less air is  2311.22 K
The loss of thermal energy due to incomplete combustion is  226.42 MJ/kmol fuel

Example 3.18 Page no 98

In [26]:
#given
T1=3000                               #Given temperature in K
T2=4000                               #Given temperature in K
p=1                                   #The pressure in atm
KP1=1.117                             #Natural logarithm of equilibrium constant at 3000 K 
KP2=-1.593                            #Natural logarithm of equilibrium constant at 4000 K
a1=0.4                                #The dissociation of 1 mole of CO2 for the first trail
a2=0.5                                #The dissociation of 1 mole of CO2 for the second trail 
K1=3.674                              #The value of equilibrium constant for the first trail 
K2=2.236                              #The value of equilibrium constant for the second trail
a3=0.9                                #The dissociation of 1 mole of CO2 for the first trail
a4=0.89                               #The dissociation of 1 mole of CO2 for the second trail
K3=0.1995                             #The value of equilibrium constant for the first trail 
K4=0.2227                             #The value of equilibrium constant for the second trail 

#Calculations
import math
Kp1=math.exp(KP1)
Kp2=math.exp(KP2)
a12=(((K1-Kp1)/(K1-K2))*(a2-a1))+a1
A12=a12*100
a23=(((Kp2-K4)/(K3-K4))*(a3-a4))+a4
A23=a23*100

#output
print"The percent dissociation of carbondioxide into carbonmonoxide and oxygen at "
print"(a) at 3000 K and 1 atm pressure = ",round(A12,3),"percent" 
print"(b) at 4000 K and 1 atm pressure = ",round(A23,1),"percent" 
The percent dissociation of carbondioxide into carbonmonoxide and oxygen at 
(a) at 3000 K and 1 atm pressure =  44.3 percent
(b) at 4000 K and 1 atm pressure =  89.8 percent

Example 3.19 Page no 99

In [45]:
#given
p=1                               #Initial pressure in atm
T=300                             #Initial temperature in K
Tc=2400                           #To calculate the molefraction of the products at this temperature in K
KP1=3.866                         #Natural logarithm of equilibrium constant at 2400 K for the equation
a=0.098                           #The dissociation of 1 mole of CO2

#Calculations
import math
K1=math.exp(KP1)
nr=1+0.5
Pp=(p*Tc)/(nr*T)
np=(a+2)/2.0
xco=(2*(1-a))/(2+a)
xc=(2*a)/(2+a)
xo=a/(2.0+a)
PP=5.333*np

#output
print"Mole fraction of the carbondioxide is ",round(xco,3)
print"Mole fraction of the carbonmonoxide is ",round(xc,3)
print"Mole fraction of oxygen is ",round(xo,3)
print"Pressure of the product is ",round(PP,3),"bar"
Mole fraction of the carbondioxide is  0.86
Mole fraction of the carbonmonoxide is  0.093
Mole fraction of oxygen is  0.047
Pressure of the product is  5.594 bar

Example 3.20 Page no 100

In [28]:
#given
t=25.0                              #The temperature of air in degree centigrade
p=1.0                               #The pressure of air in atm
T1=2200.0                           #Given first temperature in K
T2=2400.0                           #Given second temperature in K
h1=59.86                          #The change in enthalpy of hydrogen at 2200 K in MJ/kmol
h2=66.915                         #The change in enthalpy of hydrogen at 2400 K in MJ/kmol
T=298.0                             #The temperature of air in K
HR=0                              #The total enthalpy on the reactants side since all the reactants are elements
Kp1=-6.774                        #Natural logarithm of equilibrium constant at 2200 K for the equation 
a1=0.02                           #By trail and error method the degree of dissociation of H2O
hfh=-241.82                       #The enthalpy of formation of water at both 2200 and 2400 K in MJ/kmol
hfh1=83.036                       #The change in enthalpy of water at 2200 K in MJ/kmol
hfd1=59.86                        #The change in enthalpy of hydrogen at 2200 K in MJ/kmol
hfo1=66.802                       #The change in enthalpy of oxygen at 2200 K in MJ/kmol
hfn1=63.371                       #The change in enthalpy of nitrogen at 2200 K in MJ/kmol
a2=0.04                           #By trail and error method the degree of dissociation of H2O at 2400 K
hfh2=93.604                       #The change in enthalpy of water at 2400 K in MJ/kmol
hfd2=66.915                       #The change in enthalpy of hydrogen at 2400 K in MJ/kmol
hfo2=74.492                       #The change in enthalpy of oxygen at 2400 K in MJ/kmol
hfn2=70.651                       #The change in enthalpy of nitrogen at 2400 K in MJ/kmol

#Calculations
import math
K1=math.exp(Kp1)
HP1=(0.98*(hfh+hfh1))+(0.02*hfd1)+(0.01*hfo1)+(1.88*hfn1) 
HP2=(0.96*(hfh+hfh2))+(0.04*hfd2)+(0.02*hfo2)+(1.88*hfn2) 
H1=HP1-HR
H2=HP2-HR
Tl=(((T2-T1)/(HP2-HP1))*(HR-HP1))+T1

#Output
print"The adiabatic flame temperature taking dissociation into account is ",T1+236,"K"
The adiabatic flame temperature taking dissociation into account is  2436.0 K