import math
#initialisation of variables
l= 5000. #ft long
l1= 2000. #ft
d= 12. #in diameter
f= 0.005 # coefficient
d1= 24 #in diameter
f1= 0.0045
l2= 3000. #ft
Q= 1800. #gal/min flow
w= 6.24 #lb/ft**3
g=32.2 #ft/s**2
#CALCULATIONS
F= Q/(60*w)
v1= F*4/(math.pi*(d/12)**2)
v2= v1/(d1/d)**2
H= (f*l1*F**2/(10*(d/12)**5))+(f1*l2*F**2/(10*(d1/12)**5))+(v1**2/(4*g))+((v1-v2)**2/(2*g))+(v2**2/(2*g))
#RESULTS
print 'Available Head = %.2f ft'%(H)
import math
#initialisation of variables
g= 32.2 #ft/sec**2
f= 0.01
h= 42. #ft
l= 3200. #ft length
d= 14. #in diameter
h1= 8. #ft
l1= 1800. #ft point
w= 6.24 #lb/ft**3
#CALCULATIONS
v= math.sqrt(2*g*h/(1+0.5+(4*f*l/(d/12.))))
h2= h-h1-(v**2/(2*g))-h1-(0.5*v**2/(2*g))-(4*f*l1*v**2/(2*g*(d/12)))
Q= math.pi*(d/12)**2*v*w*60/4
#RESULTS
print 'Height of siphon above A = %.2f ft'%(h2)
print ' Total Discharge = %.f gal/min'%(Q)
# rounding off error
import math
#initialisation of variables
H= 950. #lb/in**2
l= 5. #miles distance
d= 4. #in
f= 0.0075 # friction
p= 92. #per cent
hp= 200. #h.p power
g= 32.2 #ft/sec62
w= 62.4 #lb/ft**3
#CALCULATIONS
H1= H*2.3
H2= H1*100/p
Hf= H2-H1
v= math.sqrt(2*g*(d/12)*Hf/(4*f*l*5280))
n= hp/(w*v*(H1/550)*math.pi*(d/12)**2/4)
#RESULTS
print 'number of pipes required = %.2f'%(n)
import math
#initialisation of variables
l= 1.5 #miles length
d= 18. #in diameter
Q= 12.4 #/cusecs
h= 130. #ft
r= 169.
r1= 338.
w= 62.4 #lb/ft**3
g= 32.2 #ft/sec**2
#CALCULATIONS
f= h*10*l**5/(l*5280*Q**2)
R= math.sqrt(1.5*r1-r)
d= math.sqrt(l**2/R*144)
v= math.sqrt(h*g*2/(r/R**2+1))
HP= w*0.25*math.pi*(d/12)**2*v**3/(550*2*g)
#RESULTS
print 'f = %.3f '%(f)
print ' Diameter of jet d = %.2f in'%(d)
print ' Water h.p = %.1f h.p'%(HP)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
l= 5000. #ft long
d= 24. #in diameter
Q= 18. #cuses
t= 10. #sec
P= 275000. #lb/in**2
g= 32.2 #ft/sec**2
w=62.4
#CALCULATIONS
v= Q/(math.pi*(d/24)**2)
C= v/(t**2/2)
Pr= ((l*C*t/g)+(v**2/(2*g)))/2.3
Pr1= v*12*math.sqrt(w*P/(386.4*1728))
#RESULTS
print 'Pressure Rise = %.1f lb/in**2'%(Pr)
print ' Pressure Rise = %d lb/in**2'%(Pr1)
import math
#initialisation of variables
g= 32.2 #ft/sec**2
v= 4. #ft/sec velocity
K= 300000. #lb/in**2 water
d= 6. #in
t= 0.25 #in
E= 30*10**6 #lb/in**2
w= 62.4 #lb/ft**3
#CALCULATIONS
P= math.sqrt((w*v**2/g)/((d/(E*144*t))+(1/(K*144))))/144
Sm= P*d/(2*t)
#RESULTS
print 'Hoop stress = %.f lb/in**2'%(Sm)
# rounding off error
import math
#initialisation of variables
l1= 19. #ft
l2= 1. #ft
r1= 0.298
r2= 0.238
r3= 0.359
r4= 0.242
r5= 0.121
d= 6 #in diameter
#CALCULATIONS
m= -(-r4-math.sqrt(r4**2-4*(3*r1-r5)*(-(d/2)*r2-r3)))/(2*(3*r1-r5))
v2= math.sqrt((l1+l2)/(r1*m**2-r2))
v3= m*v2
Q2= math.pi*v2/d**2
Q3= math.pi*v3/d**2
Q= Q2+Q3
#RESULTS
print 'Q2 = %.3f cusec'%(Q2)
print ' Q3 = %.2f cusec'%(Q3)
print ' Total Quantity = %.3f cusecs'%(Q)
import math
#initialisation of variables
h= 80. #ft levels
f= 0.008 # friction coefficient
l= 3000. #ft long
r1= 6.07
r2= 377.5
r3= 4733.
r4= 0.0466
r5= 3220.
r6= 51.5
#CALCULATIONS
Q= math.sqrt(h*10/(f*l))
Q1= math.sqrt(r2+math.sqrt(r2**2-4*r1*r3)/(2*r1))/3
Q2= Q1-r4*math.sqrt(r5-r6*Q1**2)
#RESULTS
print 'rate discharge when valve B is closed= %.2f cusecs'%(Q)
print ' Flow in reservoir= %.2f cusecs'%(Q2)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
Q= 450. #gal/min
w= 6.24 #lb/ft**3
f= 0.005
l1= 1000. #ft from reservoir A
l2= 2000. #ft from reservoir D
r1= 1.6
r2= 4.4
r3= 0.8
r4 = 12.85
h1= 59.1 #ft
h2= 40.19 #ft
v= 1.2 #ft/sec
f= 0.0056
l= 10 #ft below reservoir A
#CALCULATIONS
Q1= Q/(w*60)
Q2= (r1+math.sqrt(r1**2+4*r2))/2
Q3= Q2-Q1
Q4= (-r3+math.sqrt(r3**2+4*r4))/2
Q5= Q4+Q1
d= (f*5500*v**2/(l*(h1-h2)))**0.2*12
#RESULTS
print 'flow in to reservoir B= %.2f cusecs'%(Q3)
print ' flow in to reservoir D= %.1f cusecs'%(Q5)
print ' diameter of MN= %.f in'%(d)
import math
#initialisation of variables
d= 2.5 #ft
a= 45. #degrees
Q= 69. #cuses
l= 30. #ft
w= 62.4 #lb/ft**3
g= 32.2 #ft/sec**2
#CALCULATIONS
Ps= 0.25*math.pi*d**2*w*l/2240
Rs= Ps*math.sqrt((1-math.cos(math.radians(a)))*2)
W= Q*w/2240
v= Q*4/(math.pi*d**2)
Rd= W*v*math.sqrt(2*(1-math.cos(math.radians(a))))/g
Rt= Rs+Rd
#RESULTS
print 'total resultant thrust = %.3f tons'%(Rt)
import math
#initialisation of variables
r1= 1./3
r2= 7./12
l= 5000. #ft
l1= 10000. #ft
d= 27. #in
d1= 18. #in
Q= 10. #cuses
f= 0.006
#CALCULATIONS
Q2= Q/(math.sqrt(r2/r1)+1)
Q1= Q-Q2
H= (f*l*Q**2/(10*(d/12)**5))+(f*l1*Q1**2/(3*10**(d1/12)**5))
#RESULTS
print 'total difference in head = %.2f ft'%(H)
#ANSWER GIVEN IN THE TEXTBOOK IS WRONG
import math
#initialisation of variables
V= 4. #ft/sec
L= 1225. #ft
l= 1200. #ft
H= 50. #ft
d= 1./3 #ft
f= 0.008
g= 32.2 #ft/sec**2
#CALCULATIONS
a= 2*g*H
b= (4*f*L/d)+1.5
c= math.sqrt(a/b)
d= math.sqrt(a*b)
T= math.log(math.sqrt((c+V)/(c-V)))*l*2/d
#RESULTS
print 'time interval for elapse = %.2f sec'%(T)
import math
#initialisation of variables
L= 8000. #ft
d= 5. #ft
g= 32.2 #ft/sec**2
d= 5. #ft
l= 250. #ft
b= 100.
#CALCULATIONS
A= math.pi*0.25*d**2*l-0.5*d**2*b
V= A*g/L
#RESULTS
print 'Velocity = %.2f ft/sec'%(V)
import math
#initialisation of variables
B= 3. #ft
Cd= 0.6
g= 32.2 #ft/sec**2
d1= 6. #in
d2= 4. #in
#CALCULATIONS
Q2= 0.428 #cuses
r= math.sqrt((((d1/12)**5)/((d2/12)**5)))
Q1= r*Q2
Q= Q1+Q2
#RESULTS
print 'Total inflow = %.3f cuses'%(Q)
import math
#initialisation of variables
f= 0.007
l= 30. #miles
Q1= 5.*10**6 #gal/day
w= 6.24 #lb/ft**3
H= 500. #ft
Q2= 7*10**6 #gal/day
#CALCULATIONS
Qi= Q1/(w*24*3600)
d= (f*l*5280*Qi**2/(10*H))**0.2
Qe = Q2*Qi/Q1
x= (30-(H*10*d**5/(f*Qe**2*5280)))*(4./3)
#RESULTS
print 'diameter of pipes = %.1f ft'%d
print 'length of new pipe required = %.1f miles'%(x)