Chapter 4 : First law of thermodynamics and its applications

Example 4.1 Page No : 94

In [1]:
# Variables
Q1 = 50.;			 #Energy added as heat in kJ when the system undergoes a process 1-2
W1 = 30.;			 #Work done by the system in kJ during the process 1-2
Q2 = -40.;			 #Energy rejected as heat in kJ during the process 2-3
W2 = -50.;			 #Work done on the system in kJ during the process 2-3
Q3 = 0.	    		 #System undergoes an adiabatic process to return to initial state

# Calculations
U2_1 = Q1-W1
U3_2 = Q2-W2
U1_3 = (-U2_1)-(U3_2)
W3 = Q3-U1_3
net_work = W1+W2+W3

# Results
print ' The net work done by the system =  %d kJ'%(net_work);
 The net work done by the system =  10 kJ

Example 4.3 Page No : 96

In [2]:
# Variables
V = 1.  			 #volume of tank in m**3;
N = 200.;			 #number of moles of carbon dioxide in tank in mol
T1 = 25.;			 #ambient temperature in degree celsius
I = 5.; 			 #current in amperes passed through the resistor place in the tank
Voltage = 440.		 #voltage in volts existing across the resistor
t = 10.;			 #time in minutes for which the current is passed
a = 363.077*10**-3			 #van der waals constant in Pa (m**3/mol)**2
b = 0.043*10**-3			 #van der waals constant in m**3/mol
Cv = 32.34			 #molar heat capacity at constant volume in J/molK
R = 8.314			 #universal gas constant in J/molK

# Calculations
MV = V/N;			 # Calculations of molar volume in m**3/mol
Q = 0.  			 #energy transfer as heat during the process
W_Pdv = 0.;			 #mechanical work done by the system
W_elec = -(Voltage*I*t*60)*(10**-6)
U2_1 = Q-(W_Pdv+W_elec);			
T2 = ((U2_1*10**6)/(N*Cv))+(T1+273.15)
P = (((R*T2)/(MV-b))-(a/(MV**2)))*10**-3

# Results
print ' The final pressure =  %0.3f kPa '%(P);
print ' The final temperature =  %0.2f K'%(T2);
 The final pressure =  827.832 kPa 
 The final temperature =  502.23 K

Example 4.4 Page No : 97

In [3]:
# Variables
V = 0.1;			 #volume of tank in m**3
T1 = 200.;			 #initial temperature of saturated steam inside the tank in degree celsius
T2 = 150.;			 #temperature in degree celsius that the tank attains after some time due to poor insulation
P1 = 15.549;			 #pressure in bar obtained from steam tables corresponding to T1
vg1 = 0.1272;			 #specific volume of saturated vapour in m**3/kg obtained from steam tables corresponding to T1
hg1 = 2790.9;			 #specific enthalpy of saturated vapour in kJ/kg obtained from steam tables corresponding to T1
P2 = 4.76;			 #pressure in bar obtained from steam tables corresponding to T2
vf = 0.0010908;			 #specific volume of saturated liquid in m**3/kg obtained from steam tables corresponding to T2
vg2 = 0.3924;			 #specific volume of saturated vapour in m**3/kg obtained from steam tables corresponding to T2
hf = 632.15;			 #specific enthalpy of saturated liquid in kJ/kg obtained from steam tables corresponding to T1
hg2 = 2745.4;			 #specific enthalpy of saturated vapour in kJ/kg obtained from steam tables corresponding to T1

# Calculations
ug1 = ((hg1*10**3)-(P1*10**5*vg1))*10**-3
uf = ((hf*10**3)-(P2*10**5*vf))*10**-3
ug2 = ((hg2*10**3)-(P2*10**5*vg2))*10**-3
v2 = vg1
X2 = (v2-vf)/(vg2-vf)
u2 = (X2*ug2)+((1-X2)*uf)
m = V/vg1
Q = m*(u2-ug1)
mf = m*(1-X2)
mg = m*X2

# Results
print ' The energy transferred as heat =  %f kJ'%(Q);
print ' The mass of liquid in the tank in the final state =  %0.3f kg'%(mf)
print ' The mass of vapour in the tank in the final state =  %0.3f kg'%(mg)
 The energy transferred as heat =  -1053.825572 kJ
 The mass of liquid in the tank in the final state =  0.533 kg
 The mass of vapour in the tank in the final state =  0.253 kg

Example 4.5 Page No : 102

In [5]:
# Variables
W = 1.;	    		 #weight of steam in kg in the piston cylinder assembly
X = 0.8;			 #quality of steam (no unit)
T1 = 150.;			 #initial temperature of steam in degree celsius
T2 = 200.;			 #final temperature of steam in degree celsius
P1 = 476.;			 #pressure in kPa obatined from steam tables (corresponding to T1)
vf = 0.0010908;			 #specific volume of saturated liquid in m**3/kg obatined from steam tables (corresponding to T1)
vg = 0.3924;			 #specific volume of satuarted vapour in m**3/kg obatined from steam tables (corresponding to T1)
hf = 632.15;			 #specific enthalpy of saturated liquid in kJ/kg obtained from steam tables (corresponding to T1)
hg = 2745.4;			 #specific enthalpy of saturated vapour in kJ/kg obtained from steam tables (corresponding to T1)

# Calculations
V1 = (X*vg)+((1-X)*vf)
h1 = (X*hg)+((1-X)*hf)
P2 = 0.476;			 
P_int1 = 0.4;		
P_int2 = 0.5;		
V_int1 = 0.5343;	
V_int2 = 0.4250;	
h_int1 = 2860.4;	
h_int2 = 2855.1;	
V2 = (((P2-P_int1)/(P_int2-P_int1))*(V_int2-V_int1))+V_int1
h2 = (((P2-P_int1)/(P_int2-P_int1))*(h_int2-h_int1))+h_int1
Q = (h2-h1)*W
W = P1*(V2-V1)*W

# Results
print ' The work done by steam =  %0.2f kJ '%(W);
print ' The net energy transferred as heat  =  %0.2f kJ'%(Q);
print ' The final state of superheated steam,Pressure = %0.3f MPa '%(P2);
print ' The final state of superheated steam,Temperature = %d degree celsius '%(T2);
 The work done by steam =  65.26 kJ 
 The net energy transferred as heat  =  533.62 kJ
 The final state of superheated steam,Pressure = 0.476 MPa 
 The final state of superheated steam,Temperature = 200 degree celsius 

Example 4.6 Page No : 103

In [6]:
# Variables
W = 1.  			 #weight of steam in kg in the piston cylinder assembly
X = 0.8;			 #quality of steam (no unit)
T1 = 150.			 #initial temperature  of steam in degree celsius
I = 5.  			 #current passed in Amperes
V = 220.			 #voltage in volts across the resistor
t = 10. 			 #time for which the current is passed in minutes
P1 = 476.			 #pressure in kPa obatined from steam tables (corresponding to T1)
vf = 0.0010908;			 #specific volume of saturated liquid in m**3/kg obatined from steam tables (corresponding to T1)
vg = 0.3924;			 #specific volume of satuarted vapour in m**3/kg obatined from steam tables (corresponding to T1)
hf = 632.15;			 #specific enthalpy of saturated liquid in kJ/kg obtained from steam tables (corresponding to T1)
hg = 2745.4;			 #specific enthalpy of saturated vapour in kJ/kg obtained from steam tables (corresponding to T1)

# Calculations
V1 = (X*vg)+((1-X)*vf);	
h1 = (X*hg)+((1-X)*hf);	
Ws = -V*I*t*60*10**-3;	
h2 = h1-Ws;			 
P2 = 0.476;			 
T_int1 = 200;		
T_int2 = 300;		
V_int1 = 0.4512;	
V_int2 = 0.5544;	
h_int1 = 2856.37;	
h_int2 = 3065.38;	
V2 = (((h2-h_int1)/(h_int2-h_int1))*(V_int2-V_int1))+V_int1;
T2 = (((h2-h_int1)/(h_int2-h_int1))*(T_int2-T_int1))+T_int1;
W = (P1*10**3*(V2-V1)*W)*10**-3

# Results
print ' The work done by steam =  %0.2f kJ '%(W);
print ' The final temperature =  %0.2f degree celsius'%(T2);
 The work done by steam =  94.94 kJ 
 The final temperature =  260.47 degree celsius

Example 4.7 Page No : 104

In [7]:
# Variables
N = 1.			     #number of moles of carbon dioxide in kmol
T1 = 298.			 #initial temperature in K
T2 = 600.			 #final raised temperature in K
a = 45.369			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
b = 8.688*10**-3			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
e = -9.619*10**5			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2

# Calculations
Q = N*10**3*((a*(T2-T1)+((b/2)*(T2**2-T1**2))-(e*((1./T2)-(1./T1)))))*10**-6

# Results
print ' The amount of energy to be transferred as heat =  %0.3f MJ'%(Q);
 The amount of energy to be transferred as heat =  13.255 MJ

Example 4.8 Page No : 104

In [8]:
# Variables
T1 = 298.   			 #initial temperature in K
T2 = 600.	    		 #final raised temperature in K
a = 45.369;		    	 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
b = 8.688*10**-3;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
e = -9.619*10**5;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2

# Calculations
Cpm = ((a*(T2-T1))+((b/2)*(T2**2-T1**2))-(e*((1./T2)-(1./T1))))/(T2-T1)

# Results
print ' The isobaric molar heat capacity =  %0.2f J/molK'%(Cpm);
 The isobaric molar heat capacity =  43.89 J/molK

Example 4.9 Page No : 105

In [9]:
# Variables
N = 1.	    		 #number of moles of carbon dioxide in kmol
T1 = 298.			 #initial temperature in K
T2 = 600.			 #final raised temperature in K
a = 45.369;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
b = 8.688*10**-3;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
e = -9.619*10**5;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2

# Calculations
Cpm = ((a*(T2-T1))+((b/2)*(T2**2-T1**2))-(e*((1./T2)-(1./T1))))/(T2-T1)
Q = N*10**3*Cpm*(T2-T1)*10**-6

# Results
print ' The amount of energy to be transferred as heat =  %0.3f MJ '%(Q);
 The amount of energy to be transferred as heat =  13.255 MJ 

Example 4.10 Page No : 105

In [10]:
# Variables
N = 100.			 #number of moles of carbon dioxide in mol
T1 = 298.			 #initial temperature in K
Q = 1.  			 #energy added as heat in MJ
a = 45.369;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
b = 8.688*10**-3;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2
e = -9.619*10**5;			 #coefficient in the specific heat capacity expression where Cp = a+bT+eT**-2

# Calculations
delh = Q*10**6/N
Tguess = 520.	
Cpm_guess = a+(b*((T1+Tguess)/2))+(e/(T1*Tguess))
T2_guess = T1+(delh/Cpm_guess)
tolerance = 1e-6;			
while abs(T2_guess-Tguess)>tolerance:
    Tguess = T2_guess;
    Cpm_guess = a+(b*((T1+Tguess)/2))+(e/(T1*Tguess));
    T2_guess = T1+(delh/Cpm_guess)

T2 = T2_guess

# Results
print ' The final temperature =  %0.1f K'%(T2)
 The final temperature =  531.1 K

Example 4.11 Page No : 107

In [11]:
# Variables
volume_ratio = 1./15	 #final volume to the initial volume of air at the end of compression stroke (no unit)
gaamma = 1.4			 #ratio of the molar heat capacities at constant pressure and constant volume for air (no unit)
T1 = 300.			     #initial temperature of air in K
P1 = 0.1;			    #initial pressure of air in MPa
R = 8.314;			    #universal gas constant in J/molK

# Calculations
T2 = T1*((1./volume_ratio)**(gaamma-1))
P2 = P1*((1./volume_ratio)**(gaamma))
W = (R*(T1-T2)*10**-3)/(gaamma-1)

# Results
print ' The final temperature =  %0.2f K'%(T2);
print ' The final pressure =  %0.4f MPa'%(P2);
print ' Work done per mole of air =  %0.3f kJ/mol'%(W);
 The final temperature =  886.25 K
 The final pressure =  4.4313 MPa
 Work done per mole of air =  -12.185 kJ/mol

Example 4.12 Page No : 110

In [12]:
# Variables
volume_ratio = 1./15;			 #final volume to the initial volume of ideal gas at the end of compression (no unit)
T1 = 300.   			 #initial temperature of ideal gas in K
P1 = 0.1;	    		 #initial pressure of ideal gas in MPa
R = 8.314;		    	 #universal gas constant in J/molK
n = 1.2;			     #index of expansion (no unit)
gaamma = 1.4;			 #ratio of the molar heat capacities at constant pressure and constant volume for ideal gas (no unit)

# Calculations
P2 = P1*((1./volume_ratio)**n)
T2 = T1*(P2/P1)*(volume_ratio)
W = (R*(T1-T2)*10**-3)/(n-1)
del_u = (R*(T2-T1)*10**-3)/(gaamma-1)
q = del_u+W

# Results
print ' The final pressure =  %0.3f MPa'%(P2);
print ' The final temperature =  %0.1f K'%(T2);
print ' Work done on the gas =  %f kJ/mol'%(W);
print ' Heat interaction during the process =  %f kJ/mol'%(q)
 The final pressure =  2.578 MPa
 The final temperature =  515.6 K
 Work done on the gas =  -8.963805 kJ/mol
 Heat interaction during the process =  -4.481902 kJ/mol

Example 4.13 Page No : 112

In [13]:
# Variables
V = 1.;	    		 #volume of tank in m**3
T0 = 300.			 #initial temperature of ideal gas in K
P0 = 0.1			 #initial pressure of ideal gas in MPa
T = 500.			 #temperature of ideal gas in the pipeline in K
P = 3.		    	 #pressure of ideal gas in the pipeline in MPa
R = 8.314;			 #universal gas constant in J/molK
gaamma = 1.4;			 #ratio of the molar heat capacities at constant pressure and constant volume for ideal gas (no unit)

# Calculations
Pf = 3.
Tf = (Pf*10**6)/((((Pf*10**6)-(P0*10**6))/(gaamma*T))+((P0*10**6)/T0));
N = (V/R)*(((Pf*10**6)/Tf)-((P0*10**6)/T0));

# Results
print ' The final temperature =  %0.1f K'%(Tf);
print ' The amount of gas that has entered the tank =  %0.2f mol'%(N);
 The final temperature =  670.2 K
 The amount of gas that has entered the tank =  498.30 mol

Example 4.14 Page No : 113

In [15]:
from scipy.optimize import fsolve

# Variables
V = 3.  			 #volume of tank in m**3
T0 = 100.;			 #initial temperature of steam in degree celsius
T = 300.;			 #temperature of superheated steam in the pipeline in degree celsius
P = 3.;			     #pressure of superheated steam in the pipeline in MPa
R = 8.314;			 #universal gas constant in J/molK

# Calculations
Ps = 101.33
vg = 1.673
hg = 2676.0
h = 2995.1
u0 = ((hg*10**3)-(Ps*10**3*vg))*10**-3
m0 = V/vg;			

Tf = 418.
vf = 0.102329
uf = 2965.78

mf_guess = V/vf

def solver_func(ui):
    return (mf_guess*ui)-(m0*u0)-((mf_guess-m0)*h);

uf_solved = fsolve(solver_func,mf_guess)
mf = mf_guess
mass = mf-m0

# Results
print " The final state of steamsuperheated, Pressure = %d MPa"%(P);
print " The final state of steamsuperheated, Temperature = %d degree celsius"%(Tf);
print " The mass of steam that entered the tank = %0.3f kg"%(mass);
 The final state of steamsuperheated, Pressure = 3 MPa
 The final state of steamsuperheated, Temperature = 418 degree celsius
 The mass of steam that entered the tank = 27.524 kg

Example 4.15 Page No : 115

In [16]:
# Variables
V = 0.1;			 #volume of cylinder in m**3
T0 = 300.			 #initial temperature of nitrogen in K
P0 = 14.			 #initial pressure of nitrogen in MPa
P = 0.1;			 #ambient pressure in MPa
Pf = 2. 			 #final pressure of nitrogen in MPa
R = 8.314;			 #universal gas constant in J/molK
gaamma = 1.4;		 #ratio of the molar heat capacities at constant pressure and constant volume for nitrogen (no unit)

# Calculations
def solver_func(Ti):
    return ((P0*10**6)-(Pf*10**6))-((gaamma/2)*(T0+Ti)*(((P0*10**6)/T0)-((Pf*10**6)/Ti)));

Tguess = 300.
Tf = fsolve(solver_func,Tguess)

N = (V/R)*(((P0*10**6)/T0)-((Pf*10**6)/Tf));

# Results
print ' The final temperature =  %0.1f K'%(Tf);
print ' The amount of gas that has escaped from the cylinder =  %0.2f mol'%(N);
 The final temperature =  181.2 K
 The amount of gas that has escaped from the cylinder =  428.52 mol

Example 4.16 Page No : 118

In [17]:
# Variables
T0 = 300.;			 #initial temperature of superheated steam in degree celsius
P0 = 3.;			 #initial pressure of superheated steam in MPa
Xe = 0.85;			 #quality of steam leaving the turbine (no unit)
Tf = 45.;			 #final temperature of steam leaving the turbine in degree celsius
Vi = 10.;			 #velocity of steam at the entrance in m/s
Ve = 40.;			 #exit velocity of steam in m/s
Zi = 10.;			 #elevation at the entrance in m
Ze = 4.;			 #elevation at the exit in m
m = 1.;			 #mass flow rate of steam through turbine in kg/s
g = 9.81;			 #accleration due to gravity in m/s**2

# Calculations
hi = 2995.1
hf = 188.35
hg = 2583.3
he = ((1-Xe)*hf)+(Xe*hg)
Q = 0.			 
enthalpy_change = (he*10**3)-(hi*10**3)
KE_change = ((Ve**2)-(Vi**2))/2
PE_change = g*(Ze-Zi);			
Ws = Q-(m*(enthalpy_change+KE_change+PE_change)*10**-3)
err_KE = ((KE_change)/(Ws*10**3))*100;	
err_PE = ((abs (PE_change)/(Ws*10**3)))*100
err = err_KE+err_PE

# Results
print ' The percentage error when Kinetic energy change is ignored =  %0.3f '%(err_KE);
print ' The percentage error when Potential energy change is ignored =  %0.4f '%(err_PE);
print ' The percentage error when both Kinetic and Potential energy changes are ignored =  %f '%(err);
 The percentage error when Kinetic energy change is ignored =  0.097 
 The percentage error when Potential energy change is ignored =  0.0076 
 The percentage error when both Kinetic and Potential energy changes are ignored =  0.104999 

Example 4.17 Page No : 119

In [19]:
import math

# Variables
Pi = 5.;			 #pressure of dry saturated steam at the entrance in bar
Pe = 2.;			 #pressure of dry saturated steam at the exit in bar
Vi = 3.;			 #velocity of dry saturated steam at the entrance in m/s
m = 1.; 			 #flow rate of steam through the nozzle in kg/s
g = 9.81;			 #acceleration due to gravity in m/s**2

# Calculations
hi = 2747.5
he = 2706.3
ve = 0.8854
Zi = 0;		
Ze = 0;		
Q = 0;		
Ws = 0;		
Ve = math.sqrt (2*(((Q-Ws)/m)-(g*(Zi-Ze))-((he*10**3)-(hi*10**3)))+(Vi**2))
A = (m*ve)/Ve

# Results
print ' The velocity of dry saturated steam at the exit =  %0.2f m/s'%(Ve);
print ' The cross sectional area of the nozzle at the exit =  %0.3e m**2'%(A);
 The velocity of dry saturated steam at the exit =  287.07 m/s
 The cross sectional area of the nozzle at the exit =  3.084e-03 m**2

Example 4.18 Page No : 123

In [20]:
# Variables
T1 = 270.			 #temperature of wet steam in degree celsius
T2 = 120.			 #final temperature of superheated steam in degree celsius
P = 0.1;			 #pressure of superheated steam in MPa

# Calculations
hf = 1185.2 			
hg = 2789.9	    		
he = 2716.04			
Xi = (he-hf)/(hg-hf);	

# Results
print ' The quality of wet steam =  %0.3f '%(Xi);
 The quality of wet steam =  0.954 

Example 4.20 Page No : 128

In [21]:
# Variables
del_H = -90.135;			 #standard enthalpy change for the reaction CO(g)+2H2(g)--->CH3OH(g) at 298.15K in kJ

# Calculations
del_H1 = 2*del_H
del_H2 = (1./2)*del_H

# Results
print ' The standard enthalpy change for the reaction 2COg)+4H2g)---->2CH3OHg \
) at 298.15K =  %0.2f kJ'%(del_H1);
print ' The standard enthalpy change for the reaction 1./2)COg)+H2g)---->1./2\
)CH3OHg) at 298.15K =  %0.4f kJ'%(del_H2 );
 The standard enthalpy change for the reaction 2COg)+4H2g)---->2CH3OHg ) at 298.15K =  -180.27 kJ
 The standard enthalpy change for the reaction 1./2)COg)+H2g)---->1./2)CH3OHg) at 298.15K =  -45.0675 kJ

Example 4.22 Page No : 130

In [22]:
# Variables
del_Hf_C4H10 = -74.943;			 #smath.tan(math.radiansard enthalpy of formation of C4H10(g) at 298.15K in kJ
del_Hf_CO2 = -393.978;			 #smath.tan(math.radiansard enthalpy of formation of CO2(g) at 298.15K in kJ
del_Hf_H2O = -241.997;			 #smath.tan(math.radiansard enthalpy of formation of H2O(g) at 298.15K in kJ

# Calculations

del_Hr = (5*del_Hf_H2O)+(4*del_Hf_CO2)-(del_Hf_C4H10);

# Results
print ' The standard enthalpy change for the reaction C4H10g)+13\
/2)O2g)---->4CO2g)+5H2Og) at 298.15K =  %0.3f kJ'%(del_Hr);
 The standard enthalpy change for the reaction C4H10g)+13/2)O2g)---->4CO2g)+5H2Og) at 298.15K =  -2710.954 kJ

Example 4.23 Page No : 131

In [23]:
# Variables
del_Hf_C4H10 = -74.943;			 #smath.tan(math.radiansard enthalpy of formation of C4H10(g) at 298.15K in kJ
del_Hf_CO2 = -393.978;			 #smath.tan(math.radiansard enthalpy of formation of CO2(g) at 298.15K in kJ
del_Hf_H2O = -241.997;			 #smath.tan(math.radiansard enthalpy of formation of H2O(g) at 298.15K in kJ
del_H_vap = 43.966;			 #enthalpy of vaporization of H2O at 298.15K in kJ/mol

# Calculations

del_H1 = 0.
del_H2 = 5*(-del_H_vap)
del_H3 = 0.

del_H = (5*del_Hf_H2O)+(4*del_Hf_CO2)-(del_Hf_C4H10);
del_net_H = (del_H)+(del_H1)+(del_H2)+(del_H3)

# Results
print ' The standard enthalpy change for the reaction C4H10g)+13/2)O2g)---->4CO2g\
)+5H2Ol) at 298.15K =  %0.3f kJ'%(del_net_H);
 The standard enthalpy change for the reaction C4H10g)+13/2)O2g)---->4CO2g)+5H2Ol) at 298.15K =  -2930.784 kJ

Example 4.24 Page No : 132

In [24]:
# Variables
del_H_comb = 2880.44;			 #gross heating value of n-buatne gas at 298.15K in kJ/mol
del_Hf_CO2 = -393.978;			 #standard enthalpy of formation of CO2(g) at 298.15K in kJ
del_Hf_H2O = -285.958;			 #standard enthalpy of formation of H2O(l) at 298.15K in kJ
del_Hf_O2 = 0.;		        	 #standard enthalpy of formation of O2(g) at 298.15K in kJ
			 
# Calculations
n_CO2 = 4.
n_H2O = 5.
n_O2 = -13./2
n_C4H10 = -1.
			 
del_Hf_C4H10 = (n_CO2*del_Hf_CO2)+(n_H2O*del_Hf_H2O)+(n_O2*del_Hf_O2)-(-del_H_comb);


# Results
print ' The standard enthalpy of formation of n-butane gas at 298.15K =  %0.3f kJ'%(del_Hf_C4H10);
 The standard enthalpy of formation of n-butane gas at 298.15K =  -125.262 kJ

Example 4.25 Page No : 133

In [25]:
# Variables
del_Hc_A = -890.94;			 #enthalpy change accompanying reaction A in kJ
del_Hc_B = -283.18;			 #enthalpy change accompanying reaction B in kJ
del_Hc_C = -286.03;			 #enthalpy change accompanying reaction C in kJ
del_H_vap = -43.966;			 #enthalpy change of vaporization of H2O at 298.15K in kJ/mol

# Calculations
del_H0 = (del_Hc_A)-(del_Hc_B)-(3*del_Hc_C)+(del_H_vap)

# Results
print ' The standard enthalpy change at 298.15K for the reaction \
CH4g)+H2Og)--->COg)+3H2g) =  %0.3f kJ'%(del_H0);
 The standard enthalpy change at 298.15K for the reaction CH4g)+H2Og)--->COg)+3H2g) =  206.364 kJ

Example 4.26 Page No : 135

In [1]:
# Variables
#The reaction is : C2H4(g)+H2O(g)--->C2H5OH(g)
del_H_vap = 43.82

del_Hf = [52.335,-241.997,0,-277.819]
a = [4.196,28.850,20.691,0]	
b = [154.565*10**-3,12.055*10**-3,205.346*10**-3,0]
c = [-81.076*10**-6,0,-99.793*10**-6,0]
d = [16.813*10**-9,0,18.825*10**-9,0]	
e = [0,1.006*10**5,0,0];		

T1 = 298.15		
T2 = 400.			
n_C2H4 = -1.
n_H2O = -1.
n_C2H5OH = 1.

# Calculations

del_Hf_C2H5OH_g = del_Hf[3]+del_H_vap;
del_Hr = (n_C2H5OH*del_Hf_C2H5OH_g)+(n_C2H4*del_Hf[0])+(n_H2O*del_Hf[1])
del_a = (n_C2H4*a[0])+(n_H2O*a[1])+(n_C2H5OH*a[2])			 
del_b = (n_C2H4*b[0])+(n_H2O*b[1])+(n_C2H5OH*b[2])			 
del_c = (n_C2H4*c[0])+(n_H2O*c[1])+(n_C2H5OH*c[2])			 
del_d = (n_C2H4*d[0])+(n_H2O*d[1])+(n_C2H5OH*d[2])			 
del_e = (n_C2H4*e[0])+(n_H2O*e[1])+(n_C2H5OH*e[2])			 
del_H0 = (del_Hr*10**3)-((del_a*T1)+((del_b/2)*T1**2)+((del_c/3)*T1**3)+((del_d/4)*T1**4)-(del_e/T1))
del_Hr_T2 = (del_H0+((del_a*T2)+((del_b/2)*T2**2)+((del_c/3)*T2**3)+((del_d/4)*T2**4)-(del_e/T2)))*10**-3;

# Results
print ' The standard enthalpy change at 400K for the reaction\
 C2H4g)+H2Og)--->C2H5OHg) =  %f kJ'%(del_Hr_T2);
 The standard enthalpy change at 400K for the reaction C2H4g)+H2Og)--->C2H5OHg) =  -44.529472 kJ

Example 4.28 Page No : 137

In [29]:
from scipy.optimize import fsolve 
import math 

# Variables
 
#The combustion reaction of methane is given by:
# CH4(g)+2O2(g)--->CO2(g)+2H2O(g)

n_O2 = 2.			 # stoichiometric amount of oxygen required for combustion
n_CH4 = 1.			 #number of moles of CH4(g) in moles
n_CO2 = 1.			 #number of moles of CO2(g) formed in the combustion reaction in moles
n_H2O = 2.			 #number of moles of H2O(g) formed in the combustion reaction in moles
del_Hf = [-74.943,0,-393.978,-241.997];			 # standard enthalpies of formation of CH4(g),O2(g),CO2(g),H2O(g) at 298.15K in kJ
a = [45.369,28.850,30.255,27.270];			     #coefficients to compute isobaric molar heat capacity of CO2(g),H2O(g),O2(g),N2(g) in J/molK
b = [8.688*10**-3,12.055*10**-3,4.207*10**-3,4.930*10**-3];			 #coefficients to compute isobaric molar heat capacity of CO2(g),H2O(g),O2(g),N2(g) in J/molK
c = [0,0,0,0];  	    		 #coefficients to compute isobaric molar heat capacity of CO2(g),H2O(g),O2(g),N2(g) in J/molK
d = [0,0,0,0];	    	    	 #coefficients to compute isobaric molar heat capacity of CO2(g),H2O(g),O2(g),N2(g) in J/molK
e = [-9.619*10**5,1.006*10**5,-1.887*10**5,0.333*10**5];			 #coefficients to compute isobaric molar heat capacity of CO2(g),H2O(g),O2(g),N2(g) in J/molK
per_excess_air = 50. 			 #percentage excess of air supplied to the adiabatic burner
T_amb = 298.15			 # temperature at which air and methane enter the burner in K
per_N2 = 79.			 #percentage of N2 in the air supplied
per_O2 = 21.			 #percentage of O2 in the air supplied

# Calculations
n_O2_actual = (1+(per_excess_air/100))*n_O2
n_N2 = n_O2_actual*(per_N2/per_O2);			
n_O2_residual = n_O2_actual-n_O2;			

del_Hr = (n_CO2*del_Hf[2])+(n_H2O*del_Hf[3])-(n_O2*del_Hf[1])-(n_CH4*del_Hf[0])

del_a = (n_CO2*a[0])+(n_H2O*a[1])+(n_O2_residual*a[2])+(n_N2*a[3])
del_b = (n_CO2*b[0])+(n_H2O*b[1])+(n_O2_residual*b[2])+(n_N2*b[3])
del_c = (n_CO2*c[0])+(n_H2O*c[1])+(n_O2_residual*c[2])+(n_N2*c[3])
del_d = (n_CO2*d[0])+(n_H2O*d[1])+(n_O2_residual*d[2])+(n_N2*d[3])
del_e = (n_CO2*e[0])+(n_H2O*e[1])+(n_O2_residual*e[2])+(n_N2*e[3]);	
tguess = 500.

def solver_func(ti):
    return (-(del_Hr*10**3))-((del_a*(ti-T_amb))+((del_b/2)*((ti**2)-(T_amb**2)))+((del_c/3)*((ti**3)-(T_amb**3)))+((del_d/4)*((ti**4)-(T_amb**4)))+(del_e*((1./T_amb)-(1./ti))));

T = fsolve(solver_func,tguess)

# Results
print ' The flame temperature when methane is burned with 50 percent excess air \
in an adiabatic burner =  %f K'%(T);
 The flame temperature when methane is burned with 50 percent excess air in an adiabatic burner =  1793.784965 K

Example 4.29 Page No : 139

In [31]:
# Variables
T_exit = 550.			 #temperature in K at which the combustion products leave the boiler
percent_molar_comp_prdct = [6.28,3.14,7.85,82.73];			 # percentage molar composition of the combustion products CO2(g),CO(g),O2(g),N2(g) on dry basis
T_ent = 298.15;			 #temperature in K at which Propane and air enter the combustion chamber
del_Hf = [-393.978,-110.532,-241.997,0,0,-103.833];			 #smath.tan(math.radiansard enthalpies of formation of CO2(g),CO(g),H2O(g),O2(g),N2(g),C3H8(g) at 298.15K in kJ
a = [45.369,28.068,30.255,27.270,28.850];			 #coefficients to compute isobaric molar heat capacity of CO2(g),CO(g),O2(g),N2(g),H2O(g) in J/molK

#coefficients to compute isobaric molar heat capacity of CO2(g),CO(g),O2(g),N2(g),H2O(g) in J/molK
b = [8.688*10**-3,4.631*10**-3,4.207*10**-3,4.930*10**-3,12.055*10**-3];
c = [0,0,0,0,0];			 #coefficients to compute isobaric molar heat capacity of CO2(g),CO(g),O2(g),N2(g),H2O(g) in J/molK
d = [0,0,0,0,0];			 #coefficients to compute isobaric molar heat capacity of CO2(g),CO(g),O2(g),N2(g),H2O(g) in J/molK
e = [-9.619*10**5,-0.258*10**5,-1.887*10**5,0.333*10**5,1.006*10**5];			 #coefficients to compute isobaric molar heat capacity of CO2(g),CO(g),O2(g),N2(g),H2O(g) in J/molK
per_N2 = 79.			 #percentage of nitrogen in air
per_O2 = 21.			 #percentage of oxygen in air
molar_mass_propane = 44.*10**-3;			 #molar mass of propane in kg/mole

# Calculations
# TAKE BASIS AS 100 mol OF  DRY COMBUSTION PRODUCTS
n_CO2 = percent_molar_comp_prdct[0]			 #number of moles of CO2(g) in the product stream
n_CO = percent_molar_comp_prdct[1]			 #number of moles of CO(g) in the product stream
n_O2 = percent_molar_comp_prdct[2]			 #number of moles of O2(g) in the product stream
n_N2 = percent_molar_comp_prdct[3]			 #number of moles of N2(g) in the product stream

x = (n_CO2+n_CO)/3;

y = (2*n_N2)/(2*(per_N2/per_O2));

z = (2*y)-(2*n_CO2)-(n_CO)-(2*n_O2);

n_H2O = z
n_C3H8 = x

del_Hr = (n_CO2*del_Hf[0])+(n_CO*del_Hf[1])+(n_H2O*del_Hf[2])-(n_C3H8*del_Hf[5]);

del_a = (n_CO2*a[0])+(n_CO*a[1])+(n_O2*a[2])+(n_N2*a[3])+(n_H2O*a[4])	
del_b = (n_CO2*b[0])+(n_CO*b[1])+(n_O2*b[2])+(n_N2*b[3])+(n_H2O*b[4])	
del_c = (n_CO2*c[0])+(n_CO*c[1])+(n_O2*c[2])+(n_N2*c[3])+(n_H2O*c[4])	
del_d = (n_CO2*d[0])+(n_CO*d[1])+(n_O2*d[2])+(n_N2*d[3])+(n_H2O*d[4])	
del_e = (n_CO2*e[0])+(n_CO*e[1])+(n_O2*e[2])+(n_N2*e[3])+(n_H2O*e[4])	

#calulation of del_Hp J
del_Hp = (del_a*(T_exit-T_ent))+((del_b/2)*((T_exit**2)-(T_ent**2)))+((del_c/3)*((T_exit**3)-(T_ent**3)))+((del_d/4)*((T_exit**4)-(T_ent**4)))-(del_e*((1./T_exit)-(1./T_ent)));
del_H = ((del_Hr*10**3)+(del_Hp))*10**-3;			 
mass_propane = n_C3H8*molar_mass_propane;			 
energy = (-(del_H*10**3)/mass_propane)*10**-6;		
       
# Results
print ' The energy transferred as heat per kg propane =  %f MJ'%(energy);     
 The energy transferred as heat per kg propane =  33.741510 MJ