Chapter 4 : Second Law of Thermodynamics

Example 4.1 Page No : 84

In [1]:
import math 

#Given
Q1 = 250.0;#Heat absorbed in Kcal
T1 = (260+273.0);#Temperature at which engine absorbs heat
T0 = (40+273.0);#Temperature at which engine discards heat
#To Calculate work output, heat rejected, entropy change of system,surronding & total change in entropy and the efficiency of the heat engine

#(i)Calculation of work output
W = (Q1*((T1-T0)/T1));#Work done umath.sing equations 4.7 & 4.9 given on page no 98
print "i)The work output of the heat engine is %f Kcal"%(W);

#(ii)Calculation of heat rejected
Q2 = (Q1*T0)/T1;
print " ii)The heat rejected is %f Kcal"%(Q2);

#(iii)Calculation of entropy
del_S1 = -(Q1/T1);#Change in the entropy of source in Kcal/Kg K
del_S2 = Q2/T0;#Change in the entropy of math.sink in Kcal/Kg K
del_St = del_S1+del_S2;#Total change in entropy in Kcal/Kg K
print " iii)Total change in entropy is %d confirming that the process is reversible"%(del_St);

#(iv)Calculation of efficiency
n = (W/Q1)*100;
print " iv)The efficiency of the heat engine is %f percent"%(n);
#end
i)The work output of the heat engine is 103.189493 Kcal
 ii)The heat rejected is 146.810507 Kcal
 iii)Total change in entropy is 0 confirming that the process is reversible
 iv)The efficiency of the heat engine is 41.275797 percent

Example 4.2 Page No : 89

In [2]:
import math 

#Given
T1 = 373.0;#Temperature of the saturated steam in K
T2 = 298.0;#Temperature of the saturated water in K
#To calculate the total change in entropy and hence determine the reversibility of the process

#del_H = del_Q+(V*del_P)
#del_H =del_Q; math.since it is a consmath.tant pressure process

#From steam table,
#enthalpy of saturated steam at 373K is
H1 = 6348.5;# in Kcal/Kg
#enthalpy of saturated liquid water at 373K is
H2 = 99.15;#in Kcal/Kg
Q = H2-H1;#heat rejected in Kcal/Kg
del_S1 = Q/T1;#change in entropy of the system in Kcal/Kg K
del_S2 = Q/T2;#change in entropy of the surronding in Kcal/Kg K
del_St = del_S1+del_S2;#total change in the entropy in Kcal/Kg K
if(del_St == 0):
    print "Process is reversible";
else:
    print "Process is irreversible";
#end
#end
Process is irreversible

Example 4.3 Page No : 91

In [3]:
import math 

#Given
Cp = 0.09;#specific heat of metal block in Kcal/Kg K
m = 10.0;#mass of metal block in Kg
T1 = 323.0;#initial temperature of the block in K
T2 = 298.0;#final temperature of the block in K
#consmath.tant pressure process
#To find out entropy change of block,air and total entropy change

#(i)To calculate the entropy change of block
del_S1 = m*Cp*math.log(T2/T1);
print "i)Entropy change of block is %f Kcal/Kg K"%(del_S1);

#(ii)To calculate the entropy change of air
Q = m*Cp*(T1-T2);#heat absorbed by air = heat rejected by block in Kcal
del_S2 = (Q/T2);
print " ii)Entropy change of air is %f Kcal/Kg K"%(del_S2);

#(iii)To calculate the total entropy change
del_St = del_S1+del_S2;
print " iii)Total entropy change is %f Kcal/Kg K"%(del_St);
if(del_St == 0):
    print " Process is reversible";
else:
    print " Process is irreversible";
#end
#end 
i)Entropy change of block is -0.072503 Kcal/Kg K
 ii)Entropy change of air is 0.075503 Kcal/Kg K
 iii)Total entropy change is 0.003000 Kcal/Kg K
 Process is irreversible

Example 4.4 Page No : 94

In [8]:
import math 

#Given
m1 = 10 #mass of metal block in Kg
m2 = 50 #mass of water in Kg
Cp1 = 0.09 #Specific heat of metal block in Kcal/Kg K
Cp2 = 1 #Specific heat of water in Kcal/Kg K
T1 = 50 #Initial temperature of block in deg celsius
T2 = 25 #Final temperature of block in deg celsius

#To calculate the total change in entropy
#Heat lost by block = Heat gained by water
Tf = ((m1*Cp1*T1)+(m2*Cp2*T2))/((m1*Cp1)+(m2*Cp2)) #final temperature of water in deg celsius
Tf1 = Tf+273.16 #final temperature in K
del_S1 = m1*Cp1*math.log(Tf1/(T1+273)) #change in entropy of the block in Kcal/K
del_S2 = m2*Cp2*math.log(Tf1/(T2+273)) #change in entropy of the block in Kcal/K
del_St = del_S1+del_S2
print "The total change entropy is ",
print "%.6f" %del_St,
print "Kcal/K"
#end
The total change entropy is  0.030226 Kcal/K

Example 4.5 Page No : 96

In [4]:
import math 

#Given
#Air at 20 deg celsius
#P1 = 250;initial pressure in atm
#P2 = 10;final pressure after throttling in atm

#To calculate the entropy change
#According to the given conditions from figure4.5(page no 103)
S1 = -0.38;#initial entropy in Kcal/Kg K
S2 = -0.15;#final entroy in Kcal/Kg K
del_S = S2-S1;
print "Change in entropy for the throttling process is %f Kcal/Kg K"%(del_S);
#From figure 4.6(page no 104), the final temperature is -10 deg celsius
#end 
Change in entropy for the throttling process is 0.230000 Kcal/Kg K

Example 4.7 Page No : 101

In [5]:
import math 

#Given
#Basis: 1 hour
m = 10.0;#mass of air in Kg
T = 293.0;#Consmath.tant temperature throughout the process in K
#P1 = 1;#Initial pressure in atm
#P2 = 30;#Final pressure in atm
#According to the given data and umath.sing the graph  or figure A.2.7 given in page no 105
S1 = 0.02;#Initial entropy in Kcal/Kg
S2 = -0.23;#Final entropy in Kcal/Kg
H1 = 5.0;#Initial enthalpy in Kcal/Kg
H2 = 3.0;#Final enthalpy in Kcal/Kg

W = -((H2-H1)+T*(S2-S1))*m*(427/(3600*75.0));
print "The horse power of the compressor is %f hp"%(W);
#end
The horse power of the compressor is 1.190065 hp

Example 4.8 Page No : 104

In [6]:
import math 

#Given
#Basis: 1 Kg of steam
#P1 = 30;Intial pressure in Kgf/cm**2
#P2 = 3;Final pressure in Kgf/cm**2
#T = 300;#Operating temperature
#From figure A.2.8, 
H1 = 715.0;#Initial enthalpy of steam in Kcal/Kg
H2 = 625.0;#Final enthalpy of steam in Kcal/Kg
S1 = 1.56;#Initial entropy of steam in Kcal/Kg K
S2 = 1.61;#Final entropy of steam in Kcal/Kg K
Q = -1.0;#heat loss in Kcal/Kg
To = 298;#The lowest surronding temperature in K

#To calculate the effectiveness of the process
W = (-(H2-H1)+Q);#Actual work output by the turbine in Kcal
#The maximum or available work can be calculated from equation 4.14
del_B = -((H2-H1)-(To*(S2-S1)));# Maximum work that can be obtained in Kcal
E = (W/del_B)*100.0;
print "The effectiveness of the process is %f percent"%(E);
#end
The effectiveness of the process is 84.842707 percent

Example 4.9 Page No : 108

In [7]:
import math 

#Given
m = 1.0;#mass of liquid water in Kg
T1 = 1350.0;#initial temperature in deg celsius
T2 = 400.0;#final temperature in deg celsius
Cp = 1.0;#Specific heat of water in Kcal/Kg K
Cpg = 0.2;#Specific heat of combustion gases in Kcal/Kg K
Hv = 468.35;#Heat of vapourisation at 14 Kgf/cm**2 and 194.16 deg celsius in Kcak/Kg
To = 298.0;#Surronding temperature
Tb = 194.16+273;#Boiling point of liquid water

#To Calculate the maximum work obtained and the entropy change
#(i)Calculation of maximum work
#Q = del_H = m*Cp*(T2-T1); gas can be assumed to cool at consmath.tant pressure
#From equation 4.14 (page no 110)
del_B = -((m*Cpg*(T2-T1))-(To*m*Cp*math.log((T2+273)/(T1+273))));
print "i)The maximum work that can be obtained is %f Kcal/Kg of gas"%(del_B);

#(ii)To Calculate the change in entropy
del_S =(m*Cp*math.log(Tb/To))+((m*Hv)/Tb);
print "ii)The entropy change per Kg of water is %f"%(del_S);
#end
i)The maximum work that can be obtained is -72.325299 Kcal/Kg of gas
ii)The entropy change per Kg of water is 1.452126