#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
#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
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
#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
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
#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
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
#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
#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
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.
#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
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