Chapter 7 - The second law

Example 2 - Pg 134

In [1]:
#calculate the entropy in each part and efficiency of the cycle
import math
#Initialization of variables
cv=0.175 #Btu/lbm R
R0=1.986
M=29.
T2=1040. #R
T1=520. #R
#calculations
cp=cv+R0/M
sab=cv*math.log(T2/T1)
sac=cp*math.log(T2/T1)
dqab=cv*(T2-T1)
dqca=cp*(T1-T2)
dqrev=T2*(sac-sab)
eta=(dqab+dqrev+dqca)/(dqab+dqrev)*100
#results
print '%s %.4f %s' %("Entropy in ab part =",sab," Btu/lbm R")
print '%s %.4f %s' %("\n Entropy in ac part =",sac,"Btu/lbm R")
print '%s %.2f %s' %("\n Efficiency =",eta," percent")
print '%s' %("The answers are a bit different due to rounding off error in textbook")
Entropy in ab part = 0.1213  Btu/lbm R

 Entropy in ac part = 0.1688 Btu/lbm R

 Efficiency = 9.80  percent
The answers are a bit different due to rounding off error in textbook

Example 3 - Pg 137

In [2]:
#calculate the change in entropy of the process
#Initialization of variables
import math
tc=32. #F
th=80. #F
mw=5 #lbm
mi=1 #lbm
P=14.7 #psia
cp=1
#calculations
t= (-144*mi+tc*mi+th*mw)/(mw+mi)
ds1=144/(tc+460)
ds2=cp*math.log((460+t)/(460+tc))
dsice=ds1+ds2
dswater=mw*cp*math.log((t+460)/(460+th))
ds=dsice+dswater
#results
print '%s %.4f %s' %("Change in entropy of the process =",ds,"Btu/R")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
Change in entropy of the process = 0.0192 Btu/R
The answer is a bit different due to rounding off error in textbook

Example 4 - Pg 140

In [3]:
#Calculate the thermal efficiency of the process
#Initialization of variables
import math
cp=0.25 #Btu/lbm R
T2=520. #R
T1=3460. #R
#calculations
dq=cp*(T2-T1)
ds=cp*math.log(T2/T1)
dG=dq-T2*ds
eff=dG/dq*100
#results
print '%s %.1f %s' %("Thermal efficiency =",eff,"percent")
Thermal efficiency = 66.5 percent

Example 5 - Pg 142

In [4]:
#calculate the change in available energy and also the decrease in energy of isolated system
#Initialization of variables
import math
cp=1
T2=60. #F
T1=100. #F
ta=32. #F
#calculations
dq=cp*(T2-T1)
ds=cp*math.log((460+T2)/(460+T1))
dE=dq-ds*(ta+460)
dec=dq-dE
#results
print '%s %.1f %s' %("Change in available energy =",dE," Btu/lbm")
print '%s %.1f %s' %("\n The available energy of the isolated system decreased in the amount of",dec, "Btu/lbm")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
Change in available energy = -3.5  Btu/lbm

 The available energy of the isolated system decreased in the amount of -36.5 Btu/lbm
The answer is a bit different due to rounding off error in textbook