Chapter 4 : The Second Law of Thermodynamics

Example 4.1 Page No : 148

In [2]:
#given data
t1 = 1000.;  			#(unit:fahrenheit) 			#Source temperature
t2 = 80.;   			#(unit:fahrenheit) 			#Sink temperature
#solution
#converting temperatures to absolute temperatures;
T1 = t1+460; 			#Source temperature 			#Unit:R
T2 = t2+460; 			#Sink temperature 			#Unit:R

print "Solution for a";
ans = ((T1-T2)/T1)*100;			#(ans in %)  			#Efficiency of the engine
print "Efficiency of the engine is %.2f percentage"%(ans);

print "Solution for b";
T1 = 2000+460; 			#Source temperature 			#Unit:R
T2 = t2+460;  			#Sink temperature 			#Unit:R
ans = ((T1-T2)/T1)*100;			#(ans in %) 			#Efficiency of the engine
print "When the upper tempretrature is increased upto certain ,Efficiency of the engine is %.2f percentage "%(ans);

print "Solution for c";
T1 = t1+460; 			#Source temperature 			#Unit:R
T2 = 160+460;  			#Sink temperature 			#Unit:R
ans = ((T1-T2)/T1)*100;			#(ans in %) 			#Efficiency of the engine
print "When the lower tempretrature is increased upto certain ,Efficiency of the engine is %.2f percentage "%(ans);
Solution for a
Efficiency of the engine is 63.01 percentage
Solution for b
When the upper tempretrature is increased upto certain ,Efficiency of the engine is 78.05 percentage 
Solution for c
When the lower tempretrature is increased upto certain ,Efficiency of the engine is 57.53 percentage 

Example 4.2 Page No : 149

In [4]:
#given data
Qin = 100.; 			#heat added to the cycle 

print "In problem 4.1"
#given data
t1 = 1000.;  			#(unit:fahrenheit) 			#Source temperature
t2 = 80.;   			#(unit:fahrenheit)  			#Sink temperature
#solution
#converting temperatures to absolute temperatures;
T1 = t1+460; 			#Source temperature 			#Unit:R
T2 = t2+460;  			#Sink temperature 			#Unit:R
print "Solution for a";
print "Efficiency of the engine is %.2f percentage"%(((T1-T2)/T1)*100);

print "Now in problem 4.2"
W = 0.63*Qin; 			#W = W/J; 			#Efficiency in problem 4.1 
W = Qin*(W/Qin); 			#amount of work
Qr = Qin-W; 			#Qin-Qr = W/J  			#Qr = heat rejected by the cycle
print "The heat removed from the reservoir %.2f units"%(Qr);
In problem 4.1
Solution for a
Efficiency of the engine is 63.01 percentage
Now in problem 4.2
The heat removed from the reservoir 37.00 units

Example 4.3 Page No : 149

In [5]:
#given data
t1 = 70.; 			#(unit:fahrenheit) 			#Source temperature
t2 = 15.; 			#(unit:fahrenheit)  			#Sink temperature
Qin = 125000.; 			#(unit = Btu/hr) 			#Qin = heat added to the cycle

# Calculations and Results
#converting temperatures to absolute temperatures;
T1 = t1+460; 			#Source temperature 			#Unit:R
T2 = t2+460; 			#Sink temperature 			#Unit:R
Qr = Qin*(T2/T1); 			#Qr = heat rejected by the cycle
print "Qr is %.2f in Btu/hr"%(Qr);
work = Qin-Qr; 			#reversed cycle requires atleast input 			#work 			#btu/hr
print "Work is %.2f in Btu/hr"%(work);
# 1 hp  =  33000 ft*LBf/min 
# 1 Btu  =  778 ft*LBf 			#1 hr  =  60 min
print "Minimum horsepower input required is %.2f hp"%((work*778/60*33000));
Qr is 112028.30 in Btu/hr
Work is 12971.70 in Btu/hr
Minimum horsepower input required is 5550589622.64 hp

Example 4.4 Page No : 150

In [6]:
W = (50.*33000)/778;			#output 			#W = W/J
# 1 hp  =  33000 ft*LBf/min 
# 1 Btu  =  778 ft*LBf
print "Output is %.2f in Btu/min"%(W);
t1 = 1000.; 			#Source temperature 			#(unit:fahrenheit)
t2 = 100.;  			#Sink temperature 			#(unit:fahrenheit)
#converting temperatures to absolute temperatures;
T1 = t1+460; 			#Source temperature 			#Unit:R
T2 = t2+460; 			#Sink temperature 			#Unit:R
n = (1-(T2/T1))*100; 			#efficiency
print "Efficiency is %.2f percentage"%(n);			#in %)
#n = (W/J)/Qin
Qin = W/(n/100);			#(unit Btu/hr) 			#Qin = heat added to the cycle
print "Heat added to the cycle is %.2f in  Btu/min"%(Qin);
Qr = Qin*(1-(n/100));			#(unit Btu/hr) 			#Qr = heat rejected by the cycle
print "Heat rejected by the cycle is %.2f in  Btu/min "%(Qr);
Output is 2120.82 in Btu/min
Efficiency is 61.64 percentage
Heat added to the cycle is 3440.45 in  Btu/min
Heat rejected by the cycle is 1319.62 in  Btu/min 

Example 4.5 Page No : 151

In [7]:
t1 = 700.; 			#Source temperature 			#Unit:Celcius
t2 = 20.;  			#Sink temperature 			#Unit:Celcius
#converting in F
T1 = t1+273;  			#Source temperature 			#Unit:R
T2 = t2+273; 			#Sink temperature 			#Unit:R
n = (T1-T2)/T1*100; 			#Efficiency
print "Efficiency is %.2f percentage"%(n);			#in %)
output = 65;			#in hp 			#Given
work = output*0.746;			#(unit kJ/s) 			# 1 hp  =  746 W
print "Work is %.2f kJ/s"%(work);
Qin = work/(n/100);			#(unit kJ/s) 			#Qin = heat added to the cycle
print "Heat added to the cycle is %.2f kJ/s "%(Qin);
Qr = Qin*(1-(n/100));			#(unit kJ/s) 			#Qr = heat rejected by the cycle
print "Heat rejected by the cycle is %.2f  kJ/s "%(Qr);
Efficiency is 69.89 percentage
Work is 48.49 kJ/s
Heat added to the cycle is 69.38 kJ/s 
Heat rejected by the cycle is 20.89  kJ/s 

Example 4.7 Page No : 152

In [8]:
import math

# given data
t1 = 700.; 			#(unit:fahrenheit) 			#Source temperature
t2 = 200.; 			#(unit:fahrenheit)  			#Sink temperature
#converting temperatures to absolute temperatures;
T1 = t1+460;  			#Source temperature 			#Unit:R
T2 = t2+460; 			#Sink temperature 			#Unit:R
#n1 = (T1-Ti)/T1 and n2 = (Ti-T2)/Ti 			#n1 & n2 are efficiency
#(T1-Ti)/T1 = (Ti-T2)/Ti;
Ti = math.sqrt(T1*T2); 			#Exhaust temperature  			#Unit:R
print "Exhaust temperature of first engine is %.2f in R"%(Ti);
#converting absolute temperature to normal F temperature
#Ti(fahrenheit) = Ti(R)-460;
print "Exhaust temperature of first engine is %.2f fahrenheit"%(Ti-460);
Exhaust temperature of first engine is 874.99 in R
Exhaust temperature of first engine is 414.99 fahrenheit

Example 4.8 Page No : 157

In [9]:
#For reversible isothermal process,
q = 843.7; 			#Heat 			#Unit:Btu 			#at 200 psia
t = 381.86; 			#(unit:fahrenheit) 			#temperature
#			#converting temperatures to absolute temperatures;
T = t+460; 			#temperature 			#unit:R
deltaS = (q/T); 			#Change in entropy  			#Unit:Btu/lbm*R

# Results
print "Change in entropy is %.2f  Btu/lbm*R"%(deltaS); 			#1 LBm of saturated water
Change in entropy is 1.00  Btu/lbm*R

Example 4.9 Page No : 158

In [11]:
#For reversible isothermal process,
#In problem 4.8,
q = 843.7; 			#Heat 			#Unit:Btu 			#at 200 psia
t = 381.86; 			#(unit:fahrenheit) 
#converting temperatures to absolute temperatures;
T = t+460; 			#Unit:R"
deltaS = (q/T);  			#Change in entropy 			#Btu/lbm
print "Change in entropy is %.2f  Btu/lbm*R"%(deltaS); 			#1 LBm of saturated water

#In problem 4.9
t1 = 381.86; 			#(unit:fahrenheit) 			#Source temperature
t2 = 50.; 			#(unit:fahrenheit)  			#Sink temperature
#converting temperatures to absolute temperatures;
T1 = t1+460;  			#Source temperature 			#Unit:R
T2 = t2+460; 			#Sink temperature 			#Unit:R
qin = q;			#heat added to the cycle 
n = (1-(T2/T1))*100; 			#Efficiency
print "Efficiency is %.2f percentage"%(n);
wbyJ = qin*n*0.01;			#work output
print "Work output is %.2f Btu/lbm"%(wbyJ);
Qr = qin-wbyJ; 			#heat rejected
print "Heat rejected is %.2f Btu/lbm"%(Qr);
print "As an alternative solution and refering to figure 4.12"
qin = T1*deltaS; 			#heat added 			#btu/lbm
Qr = T2*deltaS; 			#Heat rejected 			#btu/lbm
print "Heat rejected is %.2f Btu/lbm"%(Qr);
wbyJ = qin-Qr; 			#Work output 			#Btu/lbm
print "Work output is %.2f Btu/lbm"%(wbyJ);
n = (wbyJ/qin)*100; 			#Efficiency
print "Efficiency is %.2f percentage"%(n);
Change in entropy is 1.00  Btu/lbm*R
Efficiency is 39.42 percentage
Work output is 332.59 Btu/lbm
Heat rejected is 511.11 Btu/lbm
As an alternative solution and refering to figure 4.12
Heat rejected is 511.11 Btu/lbm
Work output is 332.59 Btu/lbm
Efficiency is 39.42 percentage

Example 4.10 Page No : 159

In [12]:
# Given value
hfg = 1959.7; 			#Unit:kJ/kg 			#Evaporative enthalpy
T = 195.07+273; 			#Converted into Kelvin 			#Temperature

# Calculations
deltaS = hfg/T; 			#Change in entropy 			#kJ/kg*K

# Results
print "Change in entropy at 1.4MPa for the vaporization of 1 kg is %.2f kJ/kg*K"%(deltaS); 			#Values compares very closely to the Steam Tables value
Change in entropy at 1.4MPa for the vaporization of 1 kg is 4.19 kJ/kg*K

Example 4.11 Page No : 159

In [13]:
#Let is assume that a Carnot engine cycle operates between two temperatures in each case.
t = 1000.; 			#(unit:fahrenheit) 
#converting temperatures to absolute temperatures;
T1 = t+460;
#T1*deltaS = Qin;
Qin = 100.; 			#Unit:Btu 			#heat added to the cycle 
deltaS = Qin/T1; 			#Change in entropy 			#Btu/R
T2 = 50.+460; 			#converting 50 F temperature to absolute temperature;
Qr = T2*deltaS; 			#Heat rejected 			#Unit:Btu
print "%.2f Btu energy is unavailable with respect to a receiver at 50 fahrenheit "%(Qr);
T2 = 0+460; 			#converting 0 F temperature to absolute temperature;
Qr = T2*deltaS; 			#Heat rejected 			#unit:Btu
print "%.2f Btu energy is unavailable with respect to a receiver at 0 fahrenheit "%(Qr);
34.93 Btu energy is unavailable with respect to a receiver at 50 fahrenheit 
31.51 Btu energy is unavailable with respect to a receiver at 0 fahrenheit 

Example 4.12 Page No : 160

In [14]:
Qin = 1000; 			#Unit:Joule 			#heat entered to the system
t = 500; 			#(unit:Celcius)  			#temperature
			#converting temperature
T1 = t+273; 			#Unit:Kelvin
deltaS = Qin/T1; 			#Change in entropy 			#Unit:J/K
print "Solution for a"
T2 = 20+273; 			#converted 20 Celcius temperature to Kelvin;
Qr = T2*deltaS; 			#Heat rejected at 20 celcius 			#Joule
print "%.2f Joule energy is unavailable with respect to a receiver at 20 Celcius"%(Qr);

print "Solution for b"
T2 = 0+273; 			#converted 0 Celcius temperature to Kelvin
Qr = T2*deltaS; 			#heat rejected at 0 celcius 			#Joule
print "%.2f Joule energy is unavailable with respect to a receiver at 0 Celcius"%(Qr);
Solution for a
293.00 Joule energy is unavailable with respect to a receiver at 20 Celcius
Solution for b
273.00 Joule energy is unavailable with respect to a receiver at 0 Celcius

Example 4.13 Page No : 161

In [15]:
#deltas = Cp*ln(T2/T1)
#Multiplying both the sides of equation by the mass m,
#DeltaS = m*Cp*ln(T2/T1)
m = 6.; 			#mass 			#Unit:lbm
Cp = 0.361; 			#Btu/lbm*R 			#Specific heat constant
DeltaS = -0.7062; 			#Unit:Btu/R 			#change in entropy
t = 1440.; 			#(unit:fahrenheit) 
#converting temperatures to absolute temperatures;
T1 = t+460; 			#Unit:R
#Rearranging the equation,
T2 = T1*math.exp(DeltaS/(m*Cp)); 			#final temperature 			#Unit:R

# Results
print "Final temperature is %.2f R"%(T2);
print "or %.2f fahrenheit"%(T2-460);
Final temperature is 1371.38 R
or 911.38 fahrenheit

Example 4.14 Page No : 162

In [16]:
#1 lbm of water at 500F is mixed with 1 lbm of water at 100F
m1 = 1.; 			#Unit:lbm 			#mass
m2 = 1.; 			#Unit:lbm 			#mass
c1 = 1.; 			#Specific heat constant
c2 = 1.; 			#Specific heat constant
t1 = 500.; 			#(unit:fahrenheit) 
t2 = 100.; 			#(unit:fahrenheit)
cmix = 1.; 			#Specific heat constant of mixture
#now, m1*c1*t1 +m2*c2*t2  =  (m1+m2)*cmix*t
#So,
t = ((m1*c1*t1)+(m2*c2*t2))/((m1+m2)*cmix) 			#resulting temperature of the mixture
print "The resulting temperature of the mixture is %.2f fahrenheit"%(t);
#For this problem,the hot steam is cooled
deltas = cmix*math.log((t+460)/(t1+460)); 			#temperatures converted to absolute temperatures; 			#deltas = change in entropy 			#Unit:Btu/(lbm*R)
#The cold steam is heated
deltaS = cmix*math.log((t+460)/(t2+460)); 			#temperatures converted to absolute temperatures; 			#deltaS = change in entropy 			#Unit:Btu/(lbm*R)
print "The net change in entropy is %.2f Btu/lbm*R)"%(deltaS+deltas);
The resulting temperature of the mixture is 300.00 fahrenheit
The net change in entropy is 0.07 Btu/lbm*R)

Example 4.15 Page No : 163

In [17]:
#In problem 4.15,
#1 lbm of water at 500F is mixed with 1 lbm of water at 100F
m1 = 1; 			#Unit:lbm 			#mass
m2 = 1; 			#Unit:lbm 			#mass
c1 = 1; 			#Specific heat constant
c2 = 1; 			#Specific heat constant
t1 = 500; 			#(unit:fahrenheit)
t2 = 100; 			#(unit:fahrenheit)
cmix = 1; 			#Specific heat constant of mixture
#now, m1*c1*t1 +m2*c2*t2  =  (m1+m2)*cmix*t  			#So,
t = ((m1*c1*t1)+(m2*c2*t2))/((m1+m2)*cmix) 			#resulting temperature of the mixture
print "In problem 4.14, The resulting temperature of the mixture is %.2f fahrenheit"%(t);

#Now,in problem 4.15,taking 0F as a reference temperature,
#For hot fluid,
deltas = cmix*math.log((t1+460)/(0+460)); 			#temperatures converted to absolute temperatures; 			#deltas = change in entropy 			#Unit:Btu/(lbm*R)
#For cold fluid,
s = cmix*math.log((t2+460)/(0+460)); 			#temperatures converted to absolute temperatures; 			#s = change in entropy 			#Unit:Btu/(lbm*R)
#At final mixture temperature of t F,the entropy of each system above 0F is,for the hot fluid 
s1 = cmix*math.log((t+460)/(0+460)); 			#temperatures converted to absolute temperatures; 			#s1 = change in entropy 			#Unit:Btu/(lbm*R)
#and for the cold fluid,
s2 = cmix*math.log((t+460)/(0+460)); 			#temperatures converted to absolute temperatures; 			#s2 = change in entropy 			#Unit:Btu/(lbm*R)
print "The change in the entropy for hot fluid is %.2f Btu/lbm*R)"%(s1-deltas);
print "The change in the entropy for cold fluid is %.2f Btu/lbm*R)"%(s2-s);
print "The total change in entropy if %.2f Btu/lbm*R"%(s1-deltas+s2-s);
In problem 4.14, The resulting temperature of the mixture is 300.00 fahrenheit
The change in the entropy for hot fluid is -0.69 Btu/lbm*R)
The change in the entropy for cold fluid is 0.00 Btu/lbm*R)
The total change in entropy if -0.69 Btu/lbm*R