# Variables
T1 = 1160. #R
h1 = 281.14 #B/lbm
Pr1 = 21.18
P2 = 30. #psia
P1 = 100. #psia
# Calculations
Pr2 = Pr1*P2/P1
T2 = 833. #R
h2 = 199.45 #B/lbm
dh = h2-h1
# Results
print "Change in enthalpy = %.2f B/lbm"%(dh)
import math
# Variables
T2 = 860. #R
phi1 = 0.78767
phi2 = 0.71323
P2 = 30. #psia
P1 = 100. #psia
# Calculations
dS = phi2-phi1- 53.35/778 *math.log(P2/P1)
# Results
print "Net change of entropy = %.5f B/lbm R"%(dS)
# Variables
T1 = 540. #R
T2 = 960. #R
h2 = 231.06 #B/lbm
h1 = 129.06 #B/lbm
cp = 0.24
# Calculations
W = h2-h1
dh = cp*(T2-T1)
# Results
print "Change in enthalpy = %.1f B/lbm"%(dh)
import math
# Variables
T1 = 420. #R
T2 = 380. #R
hig = 1221.2
P1 = 0.0019
# Calculations
lnp = hig*778*(1/T1 - 1/T2)/85.6
pra = math.exp(lnp)
P2 = pra*P1
# Results
print "Final pressure = %.3e psia"%(P2)
# Variables
pc = 482. #psia
Tc = 227. #R
vc = 1.44 #ft**3/lbm mol
P = 600. #psia
T = 310. #R
# Calculations
Pr = P/pc
Tr = T/Tc
Z = 0.83
v = Z*55.12*T/(P*144)
rho = 1/v
# Results
print "Density = %.1f lbm/ft**3"%(rho)
# Variables
T = -150.+460 #R
v = 0.6 #ft**3/lbm
vc = 1.44
Tc = 227. #R
Pc = 482. #psia
# Calculations
vr = v/vc
Tr = T/Tc
Pr = 1.75
P = Pr*Pc
# Results
print "Final pressure = %d psia"%(P)
# Variables
Tc = 344. #R
Pc = 673. #psia
P1 = 20. #psia
P2 = 500. #psia
M = 16.
T = 560. #R
# Calculations
pr1 = P1/Pc
pr2 = P2/Pc
Tr = T/Tc
dh2 = 0.65*Tc
dsp = 0.35 #B/lbm mol R
dsp2 = 0.018-dsp- 1545/778 *math.log(P2/P1)
W = dh2-dsp2*T
W2 = W/M
# Results
print "Work per pound mass = %d B/lbm"%(W2)
#The answer is a bit different due to rounding off error. check using calculator.
# Variables
P = 1000. #psia
T1 = 100. + 460 #R
T2 = 800. + 460 #R
# Calculations
pc = 1070. #psia
Tc = 548. #R
pr1 = P/pc
Tr1 = T1/Tc
Tr2 = T2/Tc
M = 44.
h1 = 4235.8 #B/lbm mol
h2 = 11661 #B/lbm mol
h2bar = 3.5 #B/lbm mol
h1bar = 0.48 #B/lbm mol
dhbar = Tc*(h2bar-h1bar) + h2-h1
Q = dhbar/M
cp = 0.202 #B/lbm F
Q2 = cp*(T2-T1)
Error = (Q-Q2)/Q
# Results
print "Error in calculation = %d percent"%(Error*100)