# Chapter 7 The second law¶

## Ex:7.2 Pg:192¶

In [1]:
from math import log
#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*log(T2/T1)
sac=cp*log(T2/T1)
dqab=cv*(T2-T1)
dqca=cp*(T1-T2)
dqrev=T2*(sac-sab)
eta=(dqab+dqrev+dqca)/(dqab+dqrev)
#results
print "Entropy in ab part = %.4f Btu/lbm R"%(sab)
print "\n Entropy in ac part = %.4f Btu/lbm R"%(sac)
print "\n Efficiency = %.2f percent"%(eta*100)
print "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


## Ex:7.3 Pg:193¶

In [3]:
from __future__ import division
from math import log
#Initialization of variables
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*log((460+t)/(460+tc))
dsice=ds1+ds2
dswater=mw*cp*log((t+460)/(460+th))
ds=dsice+dswater
#results
print "Change in entropy of the process = %.4f Btu/R"%(ds)
print "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


## Ex:7.4 Pg:194¶

In [4]:
from __future__ import division
from math import log

#Initialization of variables
cp=1
T2=60 #F
T1=100 #F
ta=32 #F
#calculations
dq=cp*(T2-T1)
ds=cp*log((460+T2)/(460+T1))
dE=dq-ds*(ta+460)
dec=dq-dE
#results
print "Change in available energy = %.1f Btu/lbm"%(dE)
print "\n The available energy of the isolated system decreased in the amount of  %.1f Btu/lbm"%(dec)
print "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