Chapter 7: Thermodynamics Processes

Example 7.1, page no. 124

In [1]:
#initialization

P1 = 160.0                        #lb/in^2
T1 = 100.0                        #F
P2 = 140.0                        #lb/in^2
T2 = 550.0                        #F

#From steam tables
h1 = 67.97                        #B/lbm
h2 = 1299.3                       #B/lbm
s1 = 0.1295                       #B/lbm R
s2 = 1.6785                       #B/lbm R

#calculation
dh = h2-h1
ds = s2-s1

#result
print "Change in enthalpy = %.1f B/lbm" %dh
print "Change in entropy = %.4f B/lbm R" %ds
Change in enthalpy = 1231.3 B/lbm
Change in entropy = 1.5490 B/lbm R

Example 7.2, page no. 125

In [2]:
#initialization
P1 = 160.0                      #lb/in^2
T1 = 100.0                      #F
P2 = 140.0                      #lb/in^2
T2 = 550.0                      #F

#From steam tables
h1 = 67.97 
s1 = 0.1295
h2 = 1300.9
s2 = 1.6945

#calculation
dh = h2-h1
ds = s2-s1

#result
print "Change in enthalpy = %.1f B/lbm" %dh
print "Change in entropy = %.4f B/lbm R" %ds
Change in enthalpy = 1232.9 B/lbm
Change in entropy = 1.5650 B/lbm R

Example 7.3, page no. 126

In [15]:
import scipy.integrate

#initialization
P1 = 30.0                           #lb/in^2
T1 = 300+460.0                      #R
T2 = 60 +460.0                      #R
cp = 0.25                           #B/lbm F
R = 53.3                            #ft-lb/lbm R

#calculation
Q = cp*(T2-T1)
du = (cp-R/778)*(T2-T1)
W = 778*(Q-du)
def c(T):
    ds = cp/T
    return ds
S = scipy.integrate.quadrature(c, T1, T2)[0]

#result
print "Heat flow", Q, " B/lbm"
print "change in internal energy", round(du, 1), " B/lbm"
print "the work done is ", W, " ft-lb/lbm" #mistake in book for calculation of W
print "Change in entropy = %.3f B/lbm R" %S
Heat flow -60.0  B/lbm
change in internal energy -43.6  B/lbm
the work done is  -12792.0  ft-lb/lbm
Change in entropy = -0.095 B/lbm R

Example 7.4, page no. 129

In [16]:
#initialization

T1 = 300.0                   #F
# From steam tables

h1 = 269.59                 #B/lbm
h2 = 1179.7                 #B/lbm
s1 = 0.4369                 #B/lbm R
s2 = 1.6350                 #B/lbm R

#calculation
dh = h2-h1
ds = s2-s1

#result
print "Change in enthalpy = %.1f B/lbm" %dh
print "Change in entropy = %.4f B/lbm R" %ds
Change in enthalpy = 910.1 B/lbm
Change in entropy = 1.1981 B/lbm R

Example 7.5, page no. 129

In [3]:
import math

#initialization
v = 12.8                        #ft^3
T = 80+460.0                    #R
P = 14.0                        #lb/in^2
Pf = 500.0                      #lb/in^2

#calculation
Q = -53.3*T*math.log(Pf/P)/778.0
v2 = 53.3*T/(144*Pf)
w = v/v2
Qdot = w*Q
Wdot = w*W
ds = Q/T
dsbar = ds*w

#result
print "Work required = %d ft-lb" %Wdot
print "Heat transfer = %d B" %Qdot
print "Change in entropy = %.3f B/lbm " %dsbar
print "Change in internal energy is 0 cause this is a constant temperature process"

#answers will differ due to roundin offs
Work required = -3295227 ft-lb
Heat transfer = -4235 B
Change in entropy = -7.844 B/lbm 
Change in internal energy is 0 cause this is a constant temperature process

Example 7.6, page no. 131

In [19]:
#initialization
P1 = 14.7                       #lb/in^2
P2 = 20.0                       #lb/in^2
w = 1.0                         #lbm

#calculation
# From table 3 of appendix
v1 = 26.8
h1 = 1150.4
s1 = 1.7566
u1 = h1- 144*P1*v1/778
print "Internal energy 1 = %.1f B/lbm" %u1


# For pressure of 20 lb/in^2 , from table 2
v2 = 26.8
h2 = 1260.9
s2 = 1.8637
u2 = h2-144*P2*v2/778
du = u2-u1
ds = s2-s1

#result
print "Change in internal energy = %.1f B/lbm" %du
print "CHange in entropy = %.4f B/lbm R" %ds
Internal energy 1 = 1077.5 B/lbm
Change in internal energy = 84.2 B/lbm
CHange in entropy = 0.1071 B/lbm R

Example 7.7, page no. 133

In [20]:
import scipy.integrate
import math

#initialization
P1 = 100.0                      #lb/in^2
T1 = 240+460.0                  #R
T2 = 740+460.0                  #R
cp = 0.171                      #B?lbm F

#calculation
dq = cp*(T2-T1)
def s(T):
    ds = cp/T
    return ds
ds = scipy.integrate.quadrature(s, T1, T2)[0]
cpm = 0.247
cv = cpm-53.3/778
Q = cv*(T2-T1)
ds2 = cv*math.log(T2/T1)
v1 = 53.3*T1/(144*P1)
P2 = P1*(T2/T1)

# from table 6
h1 = 167.56
phi1 = 0.66321
u1 = h1-144*P1*v1/778.0
h2 = 291.30
phi2 = 0.79628
u2 = h2-144*P2*v1/778.0
Q3 = u2-u1
ds3 = phi2-phi1-53.3*math.log(P2/P1)/778.0

print "Part a"
print "work is zero"
print "Heat = %.1f B/lbm" %dq
print "Change in entropy = %.4f B/lbm R" %ds

print "part b"
print "Heat = %.1f B/lbm" %Q
print "Change in entropy = %.4f B/lbm R" %ds2

print "Part c"
print "Heat low = %.1f B/lbm" %Q3
print "Change in entropy = %.5f B/lbm R" %ds3
Part a
work is zero
Heat = 85.5 B/lbm
Change in entropy = 0.0922 B/lbm R
part b
Heat = 89.2 B/lbm
Change in entropy = 0.0962 B/lbm R
Part c
Heat low = 89.5 B/lbm
Change in entropy = 0.09614 B/lbm R

Example 7.8, page no. 136

In [21]:
#initialization
P1 = 100.0                       #lb/in^2
T1 = 500+460.0                   #R
P2 = 16.0                        #lb/in^2

#calculation
# From table 4 of appendix, initial conditions are
ht1 = 1279.1
st1 = 1.7085
hg = 1152.0
sg = 1.7549
hfg = 969.7
sfg = 1.4415
st1 = 1.7085
Xdash = (sg-st1)/sfg
ht2 = hg-(Xdash)*hfg
hdiff = ht1-ht2
W = hdiff*778

#result
print "Change in entropy is zero"
print "heat trasnfer is zero since adiabatic"
print "Work done = %d ft-lb/lbm" %W
print "Change in enthalpy = %.1f B/lbm" %hdiff
Change in entropy is zero
heat trasnfer is zero since adiabatic
Work done = 123167 ft-lb/lbm
Change in enthalpy = 158.3 B/lbm

Example 7.9, page no. 137

In [24]:
#initialization
g = 1.4
cv = 0.171                  #B/lbm 
P1 = 14.7                   #lb/in^2
P2 = 100                    #lb/in^2
T1 = 60+460                 #R
w = 1                         #lbm

#calculation
Tratio = (P2/P1)**((g-1)/g)
T2 = T1*Tratio
WbyJ = cv*(T1-T2)
W = WbyJ*778.0

#result
print "Work done = %.1f B/lbm" %W
print "CHange in internal energy = %d ft-lb/lbm" %WbyJ

#difference in answers due to rounding offs
Work done = -50463.5 B/lbm
CHange in internal energy = -64 ft-lb/lbm

Example 7.10, page no. 137

In [2]:
import math

#initialization
P1 = 25.0                       #lb/in^2
T1 = 840+460.0                  #R
P2 = 14.7                       #lb/in^2

#calculation
# from table 6 of appendix
ht1 = 316.94
Prt1 = 32.39
Pratio = P1/P2
Pr2 = Prt1/Pratio
h2 = 272.4
V2 = math.sqrt(2*32.2*778.0*(ht1-h2))

#result
print "Nozzle exit velocity = %d ft/sec" %V2

#difference in the answers is due to internal rounding off in Python.
Nozzle exit velocity = 1493 ft/sec

Example 7.11, page no. 139

In [26]:
#initialization
P1 = 100.0                      #lb/in^2
P2 = 16.0                       #lb/in^2
T1 = 500+460.0                  #R
eta = 0.996

#calculation
# from appendix table 4
ht1 = 1279.1
st1 = 1.7085
hg = 1152
sg = 1.7549
hfg = 969.7
sfg = 1.4415
ht2 = hg-(1-eta)*hfg
st2 = sg-(1-eta)*sfg
WbyJ = ht1-ht2
W = WbyJ*778
ds = st2-st1

#result
print "Work done = %d ft-lb/lbm" %W #difference due to rounding off
print "Change in enrtropy = %.4f B/lbm R" %ds
Work done = 101901 ft-lb/lbm
Change in enrtropy = 0.0406 B/lbm R

Example 7.12, page no. 140

In [12]:
import math

#initialization
P1 = 14.7                       #lb/in^2
T1 = 60+460.0                   #R
P2 = 100.0                      #lb/in^2
T2 = 470+460.0                  #R
cv = 0.171                      #B/lbm F
cp = 0.24                       #B/lbm F

#calculation
WbyJ=cv*(T1-T2)
W=778*WbyJ
ds=cp*math.log(T2/T1) - 53.3*math.log(P2/P1)/778.0

#result
print "Work done = %d ft-lb/lbm" %W
print "Change in entropy = %.4f B/lbm R" %ds
Work done = -54545 ft-lb/lbm
Change in entropy = 0.0082 B/lbm R