# Variables
V = 1. #ft**3
m = 30. #lbm
# Calculations
v = V/m
vf1 = 0.01665
vfg1 = 32.38 #ft**3/lbm
x1 = 0.000515
uf1 = 169.92
ufg1 = 904.8
u1 = uf1+x1*ufg1
vfg = 0.0216
vfg2 = 0.4240
v2 = v
x2 = 0.0277
uf2 = 538.4
ufg2 = 571.
u2 = uf2+x2*ufg2
Q = m*(u2-u1)
# Results
print "Heat transfer = %d Btu"%(round(Q,-2))
# Variables
V2 = 2.5 #ft**3
V1 = 0.5 #ft**3
P = 100. #psia
x1 = 0.5
# Calculations
W = -P*144*(V2-V1)
vf1 = 0.01774
vfg1 = 4.414
v1 = vf1+x1*vfg1
m = V1/v1
v2 = V2/m
uf1 = 298.08
ufg1 = 807.1
u1 = uf1+x1*ufg1
h2 = 1747.9
u2 = h2-P*144*v2/778
Q = m*(u2-u1)
# Results
print "Amount of heat = %d Btu"%(Q)
#The answer for u2 is given wrong in the textbook. Please use a calculator to find it
# Variables
V1 = 1.735*10**-4 #ft**3
v1 = 0.016080 #ft**3/lbm
h1 = 70.61 #B/lbm
P1 = 100. #psia
V2 = 1. #ft**3
# Calculations
u1 = h1-P1*v1*144/778.
m = V1/v1
v2 = V2/m
vf2 = 0.01613
vfg2 = 350.3
x2 = (v2-vf2)/vfg2
hf2 = 67.97
hfg2 = 1037.2
h2 = hf2+x2*hfg2
P2 = 0.9492
u2 = h2- P2*144*v2/778.
Q = m*(u2-u1)
# Results
print "Enthalpy change = %.2f Btu"%(Q)
# Variables
P = 20. #psia
V = 1. #ft**3
T = 560. #R
cv = 0.1715
Q = 10. #Btu
# Calculations
m = P*144*V/(53.35*T)
T2 = Q/(m*cv) +T
P2 = m*53.35*T2/V
# Results
print "Fina pressure = %d lbf/ft**2"%(P2)
# note : rounding off error.
from scipy.integrate import quad
# Variables
T1 = 560 #R
T2 = 3460 #R
m = 28.02 #lb
cv = 0.248
# Calculations
def fun(T):
return 9.47 - 3.29*10**3 /T +1.07*10**6 /T**2
Q1 = quad(fun,T1,T2)[0]
Q2 = m*cv*(T2-T1)
Error = (Q1-Q2)/Q1
# Results
print "Percentage error = %.1f percent"%(Error*100)
# Variables
import math
rate = 20. #gal/min
P1 = 20. #psia
P2 = 1000. #psia
T = 100.+460 #R
# Calculations
vf = 0.01613
dv = -5.2*10**-5 #ft**3/lbm
K = -dv/(vf*P2*144)
wt = K*vf*(P2**2 - P1**2)*144*144*10**4 /2
m = rate*8.33
Wt = wt*m
Wthp = Wt/33000
# Results
print "Pump power required = %d hp"%(Wthp)