#initialisation of variables
import math
h= 75. #ft
e= 0.75
k= 0.01
Q= 3000. #gal/min
k1= 1.2
N= 1500.
g= 32.2 #ft/sec**2
D= 0.836 #ft
#CALCULATIONS
W= h/e
v1= math.sqrt((W-h)/k)
Q1= Q/374.06
f1= Q1/(k1*D**2)
u1= math.pi*D*N/60
w1= W*g/u1
B= math.degrees(math.atan((f1/(u1-w1))))
#RESULTS
print 'Diameter of impeller = %.3f ft '%(D)
print ' Blade angle at outlet edge of impeller = %.f degrees '%(B)
import math
#initialisation of variables
V= 150. #ft**3/sec
A1= 750. #r.p.m
di= 21. #in
do= 30. #in
v= 50. #ft/sec
A= 70. #degrees
w= 4. #in
p= 30. #per cent
p1= 25. #per cent
sv= 12.8 #ft**3/lb
g= 32.2 #ft/sec**2
#CALCULATIONS
u= A1*2*math.pi*di/(24*60)
u1= A1*2*math.pi*do/(24*60)
f1= V/(math.pi*(do/12)*(1./3))
w1= u1-f1*1/math.tan(math.radians((A)))
v1= math.sqrt(f1**2+w1**2)
P= (u1**2+v**2-(f1**2/(math.sin(math.radians(A)))**2))/(2*g)
h= 30*v1**2/(100*2*g)
Nh= v1**2/(20*2*g)
Prt= P+Nh
W= u1*w1/g
e= Prt*100/W
Power= Prt*V/(sv*550)
#RESULTS
print 'Total pressure rise = %.1f ft of air'%(Prt)
print ' manometric efficiency = %.1f percent'%(e)
print ' Power = %.2f hp '%(Power)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
g= 32.2 #ft/sec**2
u1= 90. #ft/sec
w1= 70. #ft
e= 0.8
h1= 10. #ft
h2= 16. #ft
h3= 5. #ft
k= 2./5
f1= 20. #ft/sec
f= 18. #ft/sec
a= 45. #degrees
x1= 164.4 #ft
#CALCULATIONS
Hm= u1*w1/g
Hm1= e*Hm
lh= Hm-Hm1-h1-h2-h3
vg= k*math.sqrt(f1**2+w1**2)
pr= ((f**2+u1**2-f1**2/(math.sin(math.radians(a)))**2)/(2*g))-h2
pr1= x1-pr
ge= pr1*g*2*100/(vg/k)**2
#RESULTS
print 'manometer Head = %.1f ft '%(Hm1)
print ' outlet velocity from guides = %.1f ft/sec '%(vg)
print ' Pressure rise through impeller only = %.1f ft '%(pr)
print ' Guide balde efficiency = %.f per cent '%(ge)
import math
#initialisation of variables
D1= 7.5 #in
Q1= 850. #gal/min
p1= 62.4 #lb/ft**3
N1= 1800.
D2= 15. #in
Q2= 12000. #gal/min
p2= 64. #lb/ft**3
N1= 1800. #r.p.m
H1= 14. #lb/ft**2
#CALCULATIONS
N2= Q2*N1*(D1)**3/(Q1*D2**3)
P1= p1*H1/144
P2= P1*N2**2*D2**2*p2/(N1**2*p1*D1**2)
#RESULTS
print 'N2 = %.f r.p.m '%(N2+4)
print ' P2 = %.f lb/in**2 '%(P2)
#initialisation of variables
r= 5.
#CALCULATIONS
sr= r**2
sr1= r**2/r
#RESULTS
print 'Corresponding ratio = %.f '%(sr)
print ' Corresponding ratio = %.f '%(sr1)
import math
#initialisation of variables
e= 0.88
w= 1.25 #in
d= 10. #in
q= 630. #gal/min
a= 40. #degrees
g= 32.2 #ft/sec**2
e1= 0.83
#CALCULATIONS
Q= q/(6.24*60)
f1= Q/(e*math.pi*(d/12)*(w/12))
u1= 1000*(w*4/12)*2*math.pi/60
w1= u1-f1*1/math.tan(math.radians(a))
W= u1*w1/g
lr= (f1**2+u1**2-f1**2/(math.sin(math.radians(a)))**2)/(2*g)
mh= e1*W
p= mh-lr
v1= math.sqrt(f1**2+w1**2)
ke= v1**2/(2*g)
pke= p*100/ke
me= 100*lr/W
#RESULTS
print 'Velocity of flow = %.f ft/sec'%(f1)
print ' Work done = %.1f ft-lb/lb'%(W)
print ' manometric efficiency = %.1f ft'%(mh)
print ' Pressure recovered = %.1f ft head'%(p)
print ' Kinetic energy discharge = %.f ft-lb/lb'%(ke)
print ' Percentage of kinetic energy recovered = %.1f per cent'%(pke)
print ' manometric efficiency = %d percent'%(me)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
W1= 7640. #gal/min
W2= 11400. #gal/min
Hm= 63. #ft
Hm1= 80. #ft
ep1= 72. #per cent
ep2= 76. #per cent
#CALCULATIONS
whp1= W1*Hm/(60*550)
whp2= W2*Hm1/(60*550)
bhp1= whp1*100/ep1
bhp2= whp2*100/ep2
w1= W2/10
#RESULTS
print 'For both pumps discharge = %.f gal/min against an 80-ft head'%(W2)
print ' delivery from one pump = %.1f h.p '%(bhp1)
print ' delivery from two pumps = %.1f h.p '%(bhp2)
import math
#initialisation of variables
h= 94. #ft
w= 62.4 #lb/ft**3
e= 0.58
p= 73.5 #per cent
#CALCULATIONS
WHP= h*e*w/550
BHP= WHP/(p/100)
#RESULTS
print 'W.H.P= %.2f h.p'%(WHP)
print ' Brake horse power= %.1f'%(BHP)
import math
#initialisation of variables
sl= 12. #ft
l= 20. #ft
d= 4. #in
dp= 6. #in
lst= 18. #in
k= 0.025
H= 32. #ft
g= 32.2 #ft/sec**2
pf= 6. #ft
a= 33.83
a1= 9.53
#CALCULATIONS
A= math.sqrt((H-sl-d)*g/a)*a1
Q= 2*math.pi*(dp/12)**2*lst/(12*4*60)
v= Q/(math.pi*(d/12)**2/4)
kh= v**2/(2*g)
fh= k*l*v**2*12/(2*g*d)
N= math.sqrt((H-sl-pf)/(kh+fh))
#RESULTS
print 'premissible speed = %.1f r.p.m'%(A)
print ' maximum premissible speed = %.1f r.p.m'%(N)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
b= 6. #in
s= 12. #in
d= 4. #in
a1= 30. #degrees
a2= 90. #degrees
a3= 120. #degrees
N= 120. #r.p.m
n= 4.
#calculations
A= 2*math.pi*N/60
V= math.pi*(b/12)**2*n/4
v= (b/12)**2*A*(b/12)/(d/12)**2
Q1= v*math.pi*(d/12)**2*math.sin(math.radians(a1))/4
Q2= v*math.pi*(d/12)**2*math.sin(math.radians(a2))/4
Q3= v*math.pi*(d/12)**2*math.sin(math.radians(a3))/4
Q4= V-Q1
Q5= Q2-V
Q6= Q3-V
a4= math.degrees(math.asin(V/(v*math.pi*(d/12)**2)))+a1
A= 180-a4
#RESULTS
print 'rate of flow at a1 = %.3f cuses'%(Q4)
print ' rate of flow at a2 = %.3f cuses'%(Q5)
print ' rate of flow at a3 = %.3f cuses'%(Q6)
print ' crak angle = %.1f degrees'%(a4)
print ' crak angle = %.1f degrees'%(A)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
n= 2. #strokes/sec
dp= 6. #in
ds= 18. #in
ds1=4. #in
l= 20. #ft
l1= 20. #ft
f= 0.008
la= 5. #ft
A= 60. #r.p.m
f= 0.008
w= 62.4 #lb/ft**3
g=32.2
#CALCULATIONS
V= math.pi*(ds/12)*n*(dp/12)**2/4
vmp= 2*math.pi*A*(ds/24)/60
vmp1= vmp*(dp**2/ds1**2)
hfmax= 4*f*(l-la)*vmp1**2/(2*g*ds1/12)
H1= round(2*hfmax/3,1)
H2= H1*13
Wls= (H1+H2)*w*math.pi/16*1.5*2
mv= V/(math.pi*(ds1/12)**2/4)
lh= round(4*f*(l-la)*mv**2/(2*g*(ds1/12)),2)
lhf= 12*lh
Wls1= (lh+13.21)*w*math.pi*1.5/16 *2
WS= Wls-Wls1
#RESULTS
print 'Work lost per second= %.f ft lb/sec'%(Wls)
print ' Work saved per second = %.f ft-lb/sec'%(WS)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
d= 7.5 #in
s= 15. #in
l= 36. #ft
h1= 34. #ft
h2= 12. #ft
L= 10. #ft
g= 32.2 #ft/sec**2
f= 0.008
l1= 20. #ft
d1= 4. #in
h3= 110. #ft
w= 62.4 #lb/ft**3
l2= 180. #ft
#CALCULATIONS
Q= (math.pi/4)*(d)**2*(s/12)*2*(l/60)/144
v= Q/((math.pi/4)*(d1/12)**2)
a= (d/4)**2*(d/12)*(l*2*math.pi/60)**2
H= h1-h2-(L*a/g)-(v**2*0.5/g)-(4*f*l1*v**2/(2*g*(d1/12)))
H1= h1+h3+(L*a/g)+(v**2*0.5/g)+(4*f*l2*v**2/(2*g*(d1/12)))
dh= (H1-H)*w/144
NP= dh*(math.pi/4)*d**2
#RESULTS
print 'Head at piston = %.2f ft of water absolute'%(H)
print ' Head at piston = %.2f ft of water absolute'%(H1)
print ' Difference on head of piston = %.f lb/in**2'%(dh)
print ' Net load on piston = %.f lb'%(NP)
#The answer is a bit different due to rounding off error in textbook
import math
from numpy import *
from numpy.linalg import *
#initialisation of variables
f= 0.009
dc= 3.5 #in
ds= 6. #in
r= 0.25
sl= 8. #ft
d= 2.5 #in
l= 14. #ft
el= 8. #ft
ed= 22.5 #in
ph= 4. #ft
g= 32.2 #ft/sec**2
f= 0.009
#CALCULATIONS
BC= el+l
v= math.sqrt(BC*g/(l*(d/2)*(r)*(dc/d)**2))*9.55
vec=roots([2,1/r,-1])
H1= 77
MV= math.sqrt(BC*g/(l*(d/2)*(r)*(dc/d)**2))*r*(math.sin(math.radians(H1))+(math.sin(math.radians(2*H1))/8))
mvp= MV*dc**2/d**2
hf= 4*f*(sl+l)*mvp**2/(2*g*(d/12))
#RESULTS
print 'pump speed = %.1f r.p.m'%(v)
print ' Friction head = %.3f ft'%(hf)