#Calculate the efficiency of a pump
# variables
Q=50. #gal/min
P1=30. #psia 0r lbf/in**2
P2=100. #psia 0r lbf/in**2
dP=P2-P1 #psia 0r lbf/in**2
power=2.8 #hp
# calculation
#1 ft = 12 in
#1 hp.min = 33000 lbf.ft
#1 gal = 231 in**3
eta=(Q*dP/power)*(1/33000.0)*231*(1/12.0) #dimentionless
# result
print "The efficiency of the pump is %f"%eta
#Calculate the maximum elevation above the lowest water level in sump at which pump inlet can be placed
# variables
P1=3.72 #psia 0r lbf/in**2
P2=14.5 #psia 0r lbf/in**2
dP=P2-P1 #psia 0r lbf/in**2
rho=61.3 #lbm/ft**3
g=32.2 #ft/s**2
# calculation
#1 ft = 12 in
#1 lbf.s**2 = 32.2 lbm.ft
h_loss=4 #ft
v=10 #ft/s
h_max=(dP/rho/g)*144*32.2-(v**2/2.0/g)-h_loss #ft
# result
print "the maximum elevation above the lowest water level in sump at which pump inlet can be placed is %f ft"%h_max
#Calculate the work requird per pound mole for a 100% efficient isothermal and adiabatic compressor
import math
# variables
R=1.987 #Btu/lbmol/R (universal gas constant)
T=528. #R (Rankine temperature scale)
ratio_P=10. #dimentionless
# calculations and results
#for isothermal compressor
W1=R*T*math.log(ratio_P) #Btu/lbmol
print "The work required per pound mole for a 100 percent efficient isothermal compressor is %f "%W1,"Btu/lbmol\n"
#for adiabatic compressor
gama=1.4#dimentionless
W2=(gama/(gama-1))*R*T*(ratio_P**((gama-1)/gama)-1)#Btu/lbmol
print "The work required per pound mole for a 100 percent efficient adiabatic compressor is %f "%W2,"Btu/lbmol\n"
#Calculate the work requird per pound mole for a 100% efficient 2 stage adiabatic compressor
# variables
R=1.987 #Btu/lbmol/R (universal gas constant)
T=528.0 #R (Rankine temperature scale)
ratio_P1=3 #dimentionless
ratio_P2=10/3.0 #dimentionless
gama=1.4 #dimentionless
# calculation
W=(gama/(gama-1))*R*T*((ratio_P1**((gama-1)/gama)-1)+(ratio_P2**((gama-1)/gama)-1)) #Btu/lbmol
# result
print "The work required per pound mole for a 100 percent efficient adiabatic compressor is %f "%W,
print "Btu/lbmol"
#Calculate the pump head
import math
# variables
N=1750. #rev/min
#1 min 60 sec
omega=2*(math.pi)*N/60 #radians/sec
Q=100. #gal/min
#1 gallon = 231 in**3
#1 ft =12 in
#1 min = 60 sec
d_inlet = 2.067 #ft
# calculations
A_inlet=(math.pi)/4.*(d_inlet**2) #ft**2
V1=(Q/A_inlet)*231/60.0/12.0 #ft/s
d_outlet = 1.61 #ft
A_outlet=(math.pi)/4*(d_outlet**2) #ft**2
V2=(Q/A_outlet)*231/60.0/12.0 #ft/s
g=32.2 #ft/s**2
d_inner=0.086 #ft
d_outer=0.336 #ft
h=(omega)**2/g*((d_outer**2)-(d_inner)**2)+(V2**2-V1**2)/2./g #ft
#result
print "The pump head is %f ft"%h
#Calculate the pump head
# variables
rho=62.3 #lbm/ft**3
g=32.2 #ft/s**2
v=18.46 #ft/s
# calculation
#1 lbf/s**2 = 32.2 lbm.ft
h=1/(rho*g) * (v**2/2)*32.2 #ft
# result
print "The pump head is %f ft"%h
#Calculate the estimated pressure rise in the first stage of mutisatge centrifugal compressor
# variables
rho=0.075 #lbm/ft**3
omega=1047. #rad/sec
d=2. #ft
# calculation
dP=(1/2.0)*(rho)*(omega*d/2.0)**2/32.2/144.0 #psia
#1 lbf.s**2 = 32.2 lbm into feed
#1 ft = 144 in**2
# result
print "the estimated pressure rise in the first stage of mutisatge centrifugal compressor is %f psia"%dP
#Calculate the efficiency of a compressor and the change respective change in temperature
# variables
m=100.0 #Kg/hr
M=29. #gm/mol
gama=1.4 #dimentionless
R=8.314 #J/mol/K
T=293.15 #K
ratio_P=4. #dimentionless
# calculations
Po=(m/M)*R*T*(gama/(gama-1))*((ratio_P)**((gama-1)/gama)-1)/3600.0 #kW
P_real=5.3 #kW
eta=Po/P_real #dimentionless
# result
print "The efficiency of the compressor is %f"%eta
Cp=29.1 #J/mol/K
dT_real=P_real*(M/m)*3600/Cp #K
print "dT_real = %d K"%dT_real
dT_isentropic=Po*(M/m)*3600/Cp #K
print "dT_isentropic = %d K"%dT_isentropic