Chapter 5 : Second law of thermodynamics and its applications

Example 5.2 Page No : 161

In [6]:
import math 

# Variables
Q = 1000.;		    	 #amount of energy absorbed by the heat engine in kJ/s
W = 650.;			     #work delivered by the heat engine in kW
T_source = 500. 		 #temperature of the source in degree celsius
T_sink = 25.			 #temperature of the sink in degree celsius

# Calculations
n_claimed = W/Q
T1 = T_source+273.15
T2 = T_sink+273.15
n_carnot = 1-(T2/T1)

# Results
print " The efficiency of the Carnot engine = %0.3f "%(n_carnot);
print " The efficiency of the engine claimed by the inventor = %0.2f "%(n_claimed);
if n_claimed<n_carnot:
    print " The claimed heat engine is theoretically feasible as the efficiency of the engine is lesser than that of a Carnot engine";
else:
    print " The claimed heat engine is not theoretically feasible as the efficiency of the engine is greater than that of a Carnot engine";
 The efficiency of the Carnot engine = 0.614 
 The efficiency of the engine claimed by the inventor = 0.65 
 The claimed heat engine is not theoretically feasible as the efficiency of the engine is greater than that of a Carnot engine

Example 5.3 Page No : 165

In [5]:
# Variables
T_source_summer = 42; #temperature in the summer months in degree celsius
T_sink_winter = 0;	  #temperature in the winter months in degree celius
T_amb = 25;			  #temperature at which the house is to be maintained during both the months in degree celsius
energy_loss = 0.5;

# Calculations
T_H_summer = T_source_summer+273.15
T_L_summer = T_amb+273.15
T_H_winter = T_amb+273.15
T_L_winter = T_sink_winter+273.15
W_summer = (energy_loss*((T_H_summer-T_L_summer)**2))/(T_L_summer)
W_winter = (energy_loss*((T_H_winter-T_L_winter)**2))/(T_H_winter)

# Results
print " The minimum power required to operate the device in summer = %.4f kW "%(W_summer);
print " The minimum power required to operate the device in winter = %f kW "%(W_winter);

# Note: Answer in book is wrong. Please calculated manually.
 The minimum power required to operate the device in summer = 0.4847 kW 
 The minimum power required to operate the device in winter = 1.048130 kW 

Example 5.4 Page No : 166

In [3]:
# Variables
T_L = 4.25 			 #normal boiling point of helium in K
Q_L = 0.083			 #latent heat of vaporization of helium in kJ/mol
n = 1.  			 #amount of liquid helium to be produced in kmol
T_amb = 42.			 #ambient temperature in summer in degree celsius

# Calculations
T_H = T_amb+273.15
COP = (T_L)/(T_H-T_L)
W = (Q_L)/COP;		

# Results
print " The maximum possible COP of the unit = %0.4f "%(COP);
print " The minimum amount of work to be done on the refrigerating unit = %f kJ "%(W);
 The maximum possible COP of the unit = 0.0137 
 The minimum amount of work to be done on the refrigerating unit = 6.071694 kJ 

Example 5.5 Page No : 166

In [4]:
# Variables
T_ice = 0.;		        	 #temperature of the ice to be produced in degree celsius
m = 5000.;			         #rate at which ice is to be produced in kg/hour
T_water = 0.;	    		 #temperature of water used to produce ice in degree celsius
T_amb = 40.;		    	 #ambient temperature in degree celsius
T_source = 100.;			 #temperature of the source for operating heat engine in degree celsius
lambda_fusion = 6.002;			 #latent heat of fusion of water in kJ/mol at 0 degree celsius
molar_mass = 18*10**-3;			 #molar mass of water in kg/mol

# Calculations
T_L = T_water+273.15
T_H = T_amb+273.15
COP = (T_L)/(T_H-T_L)
Q_L = ((m/3600)/molar_mass)*(lambda_fusion)
W = (Q_L)/(COP);			 
T1 = T_source+273.15;		
T2 = T_amb+273.15
n_heatengine = (T1-T2)/T1
Q1 = W/n_heatengine;	
energy_ratio = (Q1+Q_L)/Q_L;

# Results
print " The minimum power required to operate the refrigerator = %0.2f kW"%(W);
print " The maximum possible efficiency of the heat engine = %0.4f "%(n_heatengine);
print " Ratio of the energy rejected to the ambient atmosphere to the\
 energy absorbed from the water = %0.4f "%(energy_ratio);
 The minimum power required to operate the refrigerator = 67.82 kW
 The maximum possible efficiency of the heat engine = 0.1608 
 Ratio of the energy rejected to the ambient atmosphere to the energy absorbed from the water = 1.9107 

Example 5.6 Page No : 169

In [6]:
# Variables
T1 = 800.			 #temperature of reservoir 1 in K
T2 = 400.			 #temperature of reservoir 2 in K
Q1 = 1000.			 #energy absorbed from reservoir maintained at T1 in kJ
Q2 = 400.			 #energy absorbed from reservoir maintained at T2 in kJ
W = 1000.			 #work delivered by the heat engine in kJ
T3 = 300.			 #temperature of the sink in K

# Calculations
Q3 = (Q1+Q2)-W
clausius_inequality = (Q1/T1)+(Q2/T2)-(Q3/T3)

# Results
print " The LHS of the Clausius inequality = %0.4f "%(clausius_inequality);
if clausius_inequality<0 or clausius_inequality == 0:
    print " The given process does not violate the second law of thermodynamics, therefore the claim is correct"
else:
    print " This is a violation of the second law of thermodynamics, and hence the claim cannot be justified"
 The LHS of the Clausius inequality = 0.9167 
 This is a violation of the second law of thermodynamics, and hence the claim cannot be justified

Example 5.7 Page No : 172

In [7]:
# Variables
T_system = 200.;			 #temperature of the contents of reactor in degree celsius
t = 15.         			 #operation time of agitator in minutes
P = 750.    	    		 #power of the operating motor in W

# Calculations
dQ = P*t*60*10**-3
T = T_system+273.15
del_S = dQ/T;		

# Results
print " The change in the entropy of the reactor contents = %0.4f kJ/K "%(del_S);
 The change in the entropy of the reactor contents = 1.4266 kJ/K 

Example 5.8 Page No : 172

In [11]:
import math


# Variables
P = 0.101325;			 #pressure in the piston cylinder assembly in MPa
T1 = 300.;			 #temperature of the piston cylinder assembly in K
T2 = 400;			 #final temperature of the piston cylinder assembly in K
a = 45.369;			 #coefficients to compute isobaric molar heat capacity of CO2(g) in J/molK
b = 8.688*10**-3;			 #coefficients to compute isobaric molar heat capacity of CO2(g) in J/molK
e = 9.619*10**5;			 #coefficients to compute isobaric molar heat capacity of CO2(g) in J/molK

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

# Results
print " The change in entropy of CO2 = %.4f J/molK"%(del_S);
 The change in entropy of CO2 = 9.2447 J/molK

Example 5.9 Page No : 173

In [9]:
# Variables
m = 1.      			 #amount of saturated liquid water in kg
T_initial = 100.		 #initial temperature of water in degree celsius
T_body = 500.			 #temperature of body which is brought into contact with the cylinder in degree celsius
hfg = 2256.94			 #enthalpy of vaporization taken from steam tables corresponding to T1 in kJ/kg

# Calculations
T = T_initial+273.15
del_S = hfg/T;		

# Results
print " The change in entropy of water = %0.4f kJ/kgK"%(del_S);
 The change in entropy of water = 6.0483 kJ/kgK

Example 5.10 Page No : 173

In [10]:
# Variables
m_steel = 10.   			 #mass of steel casting in kg
T_steel = 800.	    		 #temperature of steel casting in degree celsius
m_water = 100.		    	 #mass of water used for quenching in kg
T_water = 30.			     #temperature of water used for quenching in degree celsius
Cp_steel = 0.461;			 #heat capacity of steel in kJ/kgK
Cp_water = 4.23;			 #heat capacity of water in kJ/kgK

# Calculations
Ti_steel = T_steel+273.15
Ti_water = T_water+273.15
T_final = ((m_steel*Cp_steel*Ti_steel)+(m_water*Cp_water*Ti_water))/((m_steel*Cp_steel)+(m_water*Cp_water));
del_S_steel = m_steel*Cp_steel*math.log(T_final/Ti_steel)
del_S_water = m_water*Cp_water*math.log(T_final/Ti_water)

# Results
print " The change in entropy of steel  =  %0.4f kJ/K"%(del_S_steel);
print " The change in entropy of water  =  %f kJ/K"%(del_S_water);
 The change in entropy of steel  =  -5.7031 kJ/K
 The change in entropy of water  =  11.427392 kJ/K

Example 5.11 Page No : 175

In [11]:
# Variables
V = 2.	    		 #volume of insulated tank in m**3
Ta = 400.			 #temperature of gas in compartment (a) in K
Pa = 3.		    	 #pressure of gas in compartment (a) in MPa
Tb = 600.			 #temperature of gas in compartment (b) in K
Pb = 1.			     #pressure of gas in compartment (b) in MPa
R = 8.314;			 #universal gas constant in J/molK

# Calculations
Va = V/2
Vb = V/2
Na = (Pa*10**6*Va)/(R*Ta)
Nb = (Pb*10**6*Vb)/(R*Tb)
T = ((Na*Ta)+(Nb*Tb))/(Na+Nb)
N = Na+Nb;			 
P = ((N*R*T)/V)*10**-6
Cp = (5./2)*R;			
del_S = ((Na*((Cp*math.log(T/Ta))-(R*math.log(P/Pa))))+(Nb*((Cp*math.log(T/Tb))-(R*math.log(P/Pb)))))*10**-3; # Calculations of the change in entropy using Eq.(5.43) in kJ/K

# Results
print " Entropy change of the gas = %0.2f kJ/K"%(del_S);
 Entropy change of the gas = 2.19 kJ/K

Example 5.12 Page No : 177

In [15]:
import math
# Variables
N = 1.	    		 #amount of air to be separated into its components in kmol
P = 0.1		    	 #pressure of air in MPa
T = 300.			 #temperature of air in K
per_oxygen = 21.			 #percentage of oxygen in air
per_nitrogen = 79.			 #percentage of nitrogen in air
R = 8.314;			         #universal gas constant in J/molK

# Calculations

x1 = per_nitrogen/100
x2 = per_oxygen/100;
W = (T*N*10**3*R*((x1*math.log (x1))+(x2*math.log (x2))))*10**-3

# Results
print " Minimum work to be done to separate 1kmol of air at 0.1MPa and 300K into pure oxygen\
 and nitrogen at the same temperature and pressure = %0.2f kJ"%(abs(W));
 Minimum work to be done to separate 1kmol of air at 0.1MPa and 300K into pure oxygen and nitrogen at the same temperature and pressure = 1281.91 kJ

Example 5.13 Page No : 179

In [16]:
import math
# Variables
m_ice = 10.	    		 #mass of the block of ice in kg
T_ice = 0.		    	 #temperature of the ice in degree celsius
m_water = 100.			 #mass of watre in the tank in kg
T_water = 30.			 #temperature of the water in the tank in degree celsius
Cp = 4.23;			     #heat capacity of water in kJ/kgK
lambda_melting = 333.44			 #latent heat of melting of ice in kJ/kg

# Calculations
Ti_ice = T_ice+273.15
Ti_water = T_water+273.15
T_final = ((m_water*Cp*Ti_water)+(m_ice*Cp*Ti_ice)-(m_ice*lambda_melting))/((m_ice*Cp)+(m_water*Cp))
del_S_ice = ((m_ice*lambda_melting)/(Ti_ice))+(m_ice*Cp*math.log (T_final/Ti_ice));			 
del_S_water = m_water*Cp*math.log (T_final/Ti_water)
del_S_G = del_S_ice+del_S_water;			 

# Results
print " The change in entropy of ice  =  %f kJ/K"%(del_S_ice);
print " The change in entropy of water  =  %f kJ/K"%(del_S_water);
print " The entropy generated =  %f kJ/K"%(del_S_G);
 The change in entropy of ice  =  15.211650 kJ/K
 The change in entropy of water  =  -14.035033 kJ/K
 The entropy generated =  1.176617 kJ/K

Example 5.14 Page No : 182

In [17]:
# Variables
P = 3.			         #pressure of superheated steam in MPa
T_enter = 300.			 #entrance temperature of superheated steam in degree celsius
T_exit = 45.			 #final temperature at which the steam leaves in degree celsisus
m = 1.      			 #mass flow rate of steam in kg/s

# Calculations

si = 6.5422
hi = 2995.1
sf = 0.6383
hf = 188.35
sg = 8.1661;			 #entropy of saturated vapour in kJ/kgK
hg = 2583.3;			 #entahlpy of saturayed vapour in kJ/kg

Xe = (si-sf)/(sg-sf)
he = ((1-Xe)*hf)+(Xe*hg)
Ws = -m*(he-hi);		

# Results
print " The power  Results from the turbine = %0.1f kW"%(Ws);
 The power  Results from the turbine = 928.4 kW

Example 5.15 Page No : 183

In [18]:
import math
# Variables
Pi = 3.			 #pressure of dry saturated steam when it enters the nozzle in bar
Pe = 2.			 #pressure of dry saturated steam at the exit in bar

# Calculations
#From steam tables corresponding to Pi
si = 6.9909;			 #entropy of steam at the entrance in kJ/kgK
hi = 2724.7;			 #entahlpy of steam at the entrance in kJ/kg

#From steam tables corresponding to Pe
sf = 1.5301;			 #entropy of saturated liquid in kJ/kgK
hf = 504.70;			 #enthalpy of saturated liquid in kJ/kg
sg = 7.1268;			 #entropy of saturated vapour in kJ/kgK
hg = 2706.3;			 #entahlpy of saturayed vapour in kJ/kg

se = 6.9909
Xe = (se-sf)/(sg-sf)
he = ((1-Xe)*hf)+(Xe*hg)
Ve = math.sqrt (2*(hi-he)*10**3)

# Results
print " The exit velocity of steam = %f m/s"%(Ve);
 The exit velocity of steam = 379.103198 m/s

Example 5.16 Page No : 183

In [19]:
import math
# Variables
N_glycerol = 100.			 #molar flow rate of glycerol in mol/s
Ti_gly = 227.			 #inlet temperature of glycerol in degree celsius
Te_gly = 40.			 #outlet temperature of glycerol in degree celsius
Ti_water = 25.			 #inlet temperature of cooling water in degree celsius
Te_water = 50.			 #outlet temperature of cooling water in degree celsius
Cp_gly = 280.			 #heat capacity of glycerol in J/molK
Cp_water = 77.			 #heat capacity of water in J/molK

# Calculations
Ti_gly = Ti_gly+273.15
Te_gly = Te_gly+273.15
Ti_water = Ti_water+273.15
Te_water = Te_water+273.15

N_water = -(N_glycerol*Cp_gly*(Te_gly-Ti_gly))/(Cp_water*(Te_water-Ti_water));
del_S_gly = N_glycerol*Cp_gly*math.log (Te_gly/Ti_gly)*10**-3
del_S_water = N_water*Cp_water*math.log (Te_water/Ti_water)*10**-3
S_G = del_S_gly+del_S_water

# Results
print " The rate at which entropy is generated in the heat exchanger = %0.3f kJ/K s"%(S_G);
 The rate at which entropy is generated in the heat exchanger = 3.754 kJ/K s

Example 5.17 Page No : 183

In [21]:
# Variables
T_i = 150.			 #temperature of saturated steam taken up by the device in degree celsius
T_e = 200.			 #temperature of superheated steam delivered by the device in degree celsius
P_e = 0.2			 #pressure of superheated steam delivered by the device in MPa
me2 = 0.949			 #mass of superheated steam leaving the device in kg
me1 = 0.051			 #mass of saturated liquid leaving the device in kg
T_liq = 100.		 #temperature of saturated liquid leaving the device in degree celsius
mi = 1.     		 #mass of saturated steam fed to the device in kg

# Calculations
#From steam tables corresponding to T_i
hi = 2745.4 			 #enthalpy of saturated vapour in kJ/kg
si = 6.8358;			 #entropy of saturated vapour in kJ/kgK

#For saturated liquid at T_liq
he1 = 419.06;			 #enthalpy of saturated liquid in kJ/kg
se1 = 1.3069;			 #entropy of saturated vapour in kJ/kgK

#For superheated steam at P_e and T_e
he2 = 2870.5;			 #enthalpy of superheated steam in kJ/kg
se2 = 7.5072;			 #entropy of superheated steam in kJ/kgK

LHS = mi*hi;
RHS = (me1*he1)+(me2*he2);

S_G = (me1*se1)+(me2*se2)-(mi*si);

# Results
print " The LHS of the equation applied to the flow device to check if the first law of thermodynamics is satisfied =  %0.1f kJ"%(LHS);
print " The RHS of the equation applied to the flow device to check if the first law of thermodynamics is satisfied = %0.1f kJ"%(RHS);
print " The entropy generated by applying the second law of thermodynamics to the flow device = %0.4f kJ/kgK"%(S_G);
if int(LHS) ==  int(RHS) and S_G>0 or S_G == 0 :
    print " As the first and second law of thermodynamics are satisfied, the device is theoretically feasible "
else:
    print " As both the first and second law or either the first or second law of thermodynamics \
     are not satisfied, the device is not feasible "
 The LHS of the equation applied to the flow device to check if the first law of thermodynamics is satisfied =  2745.4 kJ
 The RHS of the equation applied to the flow device to check if the first law of thermodynamics is satisfied = 2745.5 kJ
 The entropy generated by applying the second law of thermodynamics to the flow device = 0.3552 kJ/kgK
 As the first and second law of thermodynamics are satisfied, the device is theoretically feasible 

Example 5.18 Page No : 185

In [22]:
# Variables
Pi = 30.			 #pressure of superheated steam entering the turbine in bar
Ti = 300.			 #temperature of superheated steam entering the turbine in degree celsius
Pe = 0.1			 #pressure at which steam exits the turbine in bar
Xe = 0.9			 #quality of steam at the exit (no unit)(for the actual turbine)

# Calculations
#For superheated steam at Pi and Ti
hi = 2995.1;			 #enthalpy of superheated steam at the entrance in kJ/kg
si = 6.5422;			 #entropy of superheated steam at the entrance in kJ/kgK

#For steam at Pe
hf = 191.83;			 #enthalpy of saturated liquid in kJ/kg
hg = 2584.8;			 #enthalpy of saturated vapour in kJ/kg
sf = 0.6493;			 #entropy of saturated liquid in kJ/kgK
sg = 8.1511;			 #entropy of saturated vapour in kJ/kgK

X2 = (si-sf)/(sg-sf)
h2 = (hf*(1-X2))+(X2*hg)
he = (hf*(1-Xe))+(Xe*hg)
n_T = (hi-he)/(hi-h2)

# Results
print " The isentropic efficiency of the turbine = %f "%(n_T);
 The isentropic efficiency of the turbine = 0.703395 

Example 5.19 Page No : 186

In [23]:
# Variables
Ti = 25.			 #temperature of air taken in by the adiabatic air compressor in degree celsius
Pi = 0.1			 #pressure of air taken in by the adiabatic air compressor in MPa
Pe = 1.	    		 #discharge pressure of air in MPa
n_c = 0.8			 #isentropic efficiency of the compressor (no unit)
gaamma = 1.4		 #ratio of molar specific heat capacities (no unit)
R = 8.314			 #universal gas constant in J/molK

# Calculations
Ti = Ti+273.15
Te = Ti*(((Pe*10**6)/(Pi*10**6))**((gaamma-1)/gaamma))
W_s = (((R*gaamma)/(gaamma-1))*(Te-Ti))*10**-3;			
Ws = W_s/n_c
Te_actual = ((Ws*10**3*(gaamma-1))/(R*gaamma))+Ti

# Results
print " The exit temperature of air = %0.2f K"%(Te_actual);
print " The power consumed by the compressor  = %f kW/mol"%(Ws);
 The exit temperature of air = 645.01 K
 The power consumed by the compressor  = 10.093262 kW/mol

Example 5.20 Page No : 187

In [24]:
# Variables
Ti = 30.			 #temperature of saturated liquid water in degree celsius
m = 500.			 #mass flow rate of water being pumped in kg/s
P2 = 3. 			 #preesure maintained in the boiler in MPa
n_p = 0.75;			 #isentropic efficiency of the pump (no unit)

# Calculations
#For saturated liquid water at Ti
vf = 0.0010043
P1 = 4.241;		

Ws_m = (vf*((P2*10**6)-(P1*10**3)))*10**-3
Ws_act_m = Ws_m/n_p;			 
P = ((Ws_act_m*10**3)*m)*10**-6;

# Results
print " The power consumed by the pump  =  %d MW"%(P);
 The power consumed by the pump  =  2 MW

Example 5.21 Page No : 188

In [25]:
# Variables
Pi = 3.			 #pressure of dry saturated steam entering the nozzle in bar
Xe = 0.98		 #quality of steam exiting the nozzle (no unit)
Pe = 2.			 #pressure of steam exiting the nozzle in bar

# Calculations
#For steam at Pi
hi = 2724.7
he = 2652.8
V2_2_s = hi-he

#For steam at Pe
hf = 504.70
hg = 2706.3
he_act = ((1-Xe)*hf)+(Xe*hg)
V2_2 = hi-he_act;			
n_N = (V2_2)/(V2_2_s)		

# Results
print " The isentropic efficiency of the nozzle = %0.3f "%(n_N);
 The isentropic efficiency of the nozzle = 0.868