import math
import numpy
#initialisation of variables
h = 4. #ft
h1 = 3. #ft
r = 3. #ft
h2 = 1.5 #ft
#CALCULATIONS
m = (h*h1+(h1**2/2))/(h+(h/2)*math.sqrt(h1**2+(h1/2)**2))
a = 2*numpy.degrees(numpy.arccos(h2/r))
P = 2*math.pi*r*a/360.
A = r**2*((2*math.pi/3.)-math.sin(math.radians(a)))/2.
H = A/(2*math.pi)
#RESULTS
print 'Hydraulic mean depth m = %.2f ft'%m
print 'hydraulic mean depth = %.2f ft '%(H)
import math
#initialisation of variables
d = 3. #ft
l = 5280. #ft
v = 3. #ft/sec
f = 0.005
g = 32.2 #ft/sec**2
C = 115.
#CALCULATIONS
hf = 4*f*l*v**2/(2*g*v)
m = d/4
hf1 = (v/C)**2*4*l/3
#RESULTS
print 'hf = %.2f ft '%(hf)
print 'hf = %.1f ft '%(hf1)
import math
#initialisation of variables
d = 6. #in
Q = 2. #cfs
l = 1000. #ft
f = 0.0055
w = 62.4 #lb/ft**3
g = 32.2 #ft/sec**2
h = 70. #ft
#CALCULATIONS
v = Q/(math.pi*(d/12)**2/4)
hf = 4*f*l*w*(Q/(math.pi*(d/12)**2/4))**2/((d/12)*2*144*g)
ft_water = round(hf*144/w + 70)
P = ft_water*w/144
#RESULTS
print 'pressure = %.1f lb/in**2 '%(hf)
print 'presure difference = %.0f lb/in**2 '%(P)
# Answers are slightly different because of rounding error.
import math
#initialisation of variables
d = 6. #in
hf = 7.7 #ft
f = 0.005
l = 1000. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
C = math.sqrt(2*g/f)
Q = math.pi*C*(d/12)**2.5*(hf/1000)**0.5 /8
#RESULTS
print 'Discharge = %.2f cfs '%(Q)
import math
#initialisation of variables
Q = 400000.
d = 4. #miles
h = 50. #ft
q = 40. #gallons of water
t = 8. #hr
f = 0.0075
w = 6.24 #lb/ft**3
g = 32.2 #ft/sec**2
#CALCULATIONS
Q1 = round(Q*q*0.5/(t*60*60*w),1)
d = (4*f*(d*5280)*Q1**2*16/(math.pi**2*h*2*g))**0.2*12
#RESULTS
print 'size of the supply = %.3f in '%(d)
import math
#initialisation of variables
Q = 0.7 #cfs
d = 6. #in
v1 = 1.084*10**-5 #ft**2/sec
v2 = 0.394*10**-5 #ft**2/sec
R = 2320.
#CALCULATIONS
Re = (4*Q)/(math.pi*.5*v2)
v3 = R*v1/(d/12.)
v4 =R*v2/(d/12.)
v = Q*4/(math.pi*(d/12.)**2)
#RESULTS
print 'Re at 80 C %.0f'%Re
print 'crititcal velocity = %.4f ft/sec '%(v4)
print 'actual velocity = %.2f ft/sec '%(v)
# Note : answer is correct. Please calculate it manually.
import math
#initialisation of variables
p = 0.91 #units
u = 0.21 #poise
q = 200. #gallons
h = 40. #ft
l = 200. #ft
w = 62.4 #lb/ft**3
d = 3./4 #in
g =32.2 #ft/s**2
#CALCULATIONS
v = u/(p*(30.5)**2)
Q = q*10/(w*3600*p)
V = Q/(math.pi*(d/12)**2/4)
Re = V*(d/12)/v
F = 64/Re
Hf = F*l*V**2/(2*g*(d/12))
Ht = Hf+h
P = w*p*Ht/144
#RESULTS
print 'Pressure head = %.1f lb/sq in '%(P)
from math import log10
#initialisation of variables
h = 1.5 # H
v = 2. # V
#CALCULATIONS
logh = round(log10(h),4)
logk = -0.415 # from fig.
logv = round(log10(v),4)
n = (logh-logk)/logv
#RESULTS
print 'n = %.3f '%(n)
import math
#initialisation of variables
pb = 20. #lb/in**2
w = 62.4 #lb/ft**3
Q = 1.96 #cfs
d1 = 0.5 #ft
d2 = 1. #ft
f = 0.005
g = 32.2 #ft/sec**2
l1 = 300. #ft
H = 14.015 #ft of water
#CALCULATIONS
v1 = Q/(math.pi*d1**2/4.)
v2 = Q/(math.pi*d2**2./4.)
hf1 = 4*f*l1*v1**2./(2.*g*d1)
hf2 = 4*f*l1*v2**2/(2*g*d2)
h = (v1-v2)**2/(2*g)
h1 = v1**2/(2*g)
h2 = v2**2/(2*g)
P = H*w/144
#RESULTS
print 'Loss of head at C = %.2f ft '%(h1)
print 'Loss of head at C = %.3f ft '%(h2)
print 'Pressure differnece at discharge end = %.2f lb/in**2 '%(P)
import math
#initialisation of variables
d = 8. #in
l = 6000. #ft
H = 100. #ft
H1 = 1000. #ft
f = 0.008
g = 32.2 #ft/sec**2
h1 = 24. #ft
h2 = 34. #ft
h3 = 25. #ft
w = 6.24 #lb/ft**3
#CALCULATIONS
v = math.sqrt(H*d*2*g/(4*f*l*12))
h = -h1+(v**2/(2*g))+h3+(4*f*H1*v**2/(2*g*(d/12)))
Q = round(math.pi*(d/12)**2*v*3600*w/4,-2)
#RESULTS
print 'minimum depth = %.f ft '%(h)
print 'Discharge = %.f gpm'%(Q)
import math
#initialisation of variables
h = 25. #ft
l = 2000. #ft
d = 12. #in
g = 32.2 #ft/sec**2
f = 0.005
dz = 16. #ft
zb = 25. #ft
zc = -16. #ft
#CALCULATIONS
v = math.sqrt(2*g*h/(1.5+(4*f*l/(d/12))))
Q = math.pi*(d/12)**2*v/4
l1 = (34-dz)*l/(zb-zc-dz)
#RESULTS
print 'Discharge = %.1f cfs '%(Q)
print 'length of the inlet = %.f ft of water '%(l1)
import math
#initialisation of variables
d1 = 2 #in
l1 = 25 #ft
d2 = 4 #in
l2 = 140 #ft
v = 4 #ft/sec
g = 32.2 #ft/sec**2
f = 0.0065
#CALCULATIONS
v1 = v*(d2/d1)**2
H = (0.5*v1**2/(2*g))+(4*f*l1*12*v1**2/(d1*2*g))+((v1-v)**2/(2*g))+(4*f*l2*12*v**2/(d2*2*g))+(v**2/(2*g))
#RESULTS
print 'necessaey height of water = %.3f ft '%(H)
# Note : answer is slightly different because of rounding error.
import math
#initialisation of variables
l1 = 3000. #ft
d1 = 18. #in
l2 = 1500. #ft
d2 = 15. #ft
l3 = 1000. #ft
d3 = 12. #in
#CALCULATIONS
d = ((l1+l2+l3)/((l1/d1**5)+(l2/d2**5)+(l3/d3**5)))**(1./5)
#RESULTS
print 'Diameter = %.2f in '%(d)
import math
#initialisation of variables
g = 32.2 #ft/sec**2
D = 9. #in
#CALCULATIONS
d = D/(2**0.4)
#RESULTS
print 'diameter of paralle mains = %.2f in '%(d)
import math
#initialisation of variables
d = 2. #ft
l = 5280. #ft
f = 0.01
H = 100. #ft
g = 32.2 #ft/sec**2
#CALCLATIONS
v = math.sqrt(H*2*d*g/(4*f*l))
Q = math.pi*d**2*v/4.
r = d
v2 = math.sqrt(H/((r**2+1)*(4*f*l/(2*2*2*g))))
Q1 = 2*math.pi*d**2*v2/4.
dQ = Q1-Q
p = dQ*100./Q
#RESULTS
print 'percentage increase in discharge = %.1f %% '%(p)
import math
# Variables
d1 = 2 # ft
d2 = 1.5 # ft
d3 = 1 # ft
l1 = 2000 # ft
l2 = 3000 # ft
l3 = 1500 # ft
za = 100 # ft
zb = 70 # ft
zc = 50 # ft
zd = 80 # ft
f = 0.007 # ft
v3 = 7.93
# Calculations
v1 = round(math.sqrt(111-1.412*(v3**2)),1)
v2 = round(math.sqrt(-23.4+.745*(v3**2)),2)
pd_w = round((za - zd) - ( 29 * v1**2/64.4),2)
Q1 = (math.pi/4)*d1**2*v1
Q2 = (math.pi/4)*d2**2*v2
Q3 = Q1 - Q2
# Results
print "V1 = %.1f ft/sec"%v1
print "V2 = %.2f ft/sec"%v2
print "V3 = %.2f ft/sec"%v3
print "Pressure at the junction point : %.2f ft of water"%pd_w
print "Discharge in section : %.2f cfs"%Q3
# Note : Answers may vary because of rounding error. Please check it manually.
import math
#initialisation of variables
A = 10000. #ft**2
H1 = 50. #ft
H2 = 40. #ft
l = 1500. #ft
d = 6. #in
f = 0.0075
g = 32.2 #f/sec**2
#CALCULATIONS
t = 2.*A*math.sqrt((1.5+(4*f*l/(d/12)))/(2*g))*(math.sqrt(H1)-math.sqrt(H2))/(math.pi*(d/12)**2/4)
#RESULTS
print 'Time taken to lower the level of water = %.f hours '%(t/3600)
import math
#initialisation of variables
l = 24. #ft
b = 12. #ft
f = 0.006
d = 4. #in
l1 = 25. #ft
H1 = 6. #ft
H = 20. #ft
g = 32.2 #ft/sec**2
Cd = 0.6
#CALCULATIONS
a = math.pi*(d/12)**2/4
A = l*b
H2 = H1+H
t = round(2*A*math.sqrt((1.5+(4*f*l1/(d/12)))/(2*g))*(math.sqrt(H2)-math.sqrt(H))/a,-1)
t1 = 2*A*math.sqrt((1.5+(4*f*l1/(d/12)))/(2*g))*math.sqrt(H1)/a
t2 = 2*A*math.sqrt(H1)/(Cd*a*math.sqrt(2*g))
#RESULTS
print 'Time taken to lower the pipe = %.f sec '%(t)
print 'Time taken to lower the pipe = %.f sec '%(t1)
print 'Time taken to lower the pipe = %.f sec '%(t2)
# note : answers may vary becasue of ronding error.
import math
#initialisation of variables
d = 2 #ft
l = 1000 #ft
f = 0.0075
H1 = 20 #ft
A1 = 100000 #ft**2
A2 = 50000 #ft**2
g = 32.2 #ft/sec**2
#CALCULATIONS
h = 2*A1/A2
H2 = H1-h
t = 2*A1*A2*math.sqrt(1.5+(4*f*l/2))*0.47/((A1+A2)*(math.pi*d**2/4)*math.sqrt(2*g))/60
#RESULTS
print 'Time taken to lower the level of water = %.f min '%(t)
import math
#initialisation of variables
H = 1000. #lb/in**2
Hf = 100. #lb/in**2
l = 10. #miles
HP = 100.
g = 32.2 #ft/sec**2
w = 64.4 #lb/ft**3
f = 0.006
#CALCULATIONS
n = (H-Hf)*100/H
v = Hf*550/((math.pi/4)*n*10*144)
r = Hf*144*2*g/(w*4*f*l*5280)
d = (v**2/r)**(1./5)
#RESULTS
print 'Diameter = %.4f ft '%(d)
# answer may vary because of rounding error.
import math
#initialisation of variables
h1 = 1640. #ft
h2 = 40. #ft
d = 8. #in
l = 2. #miles
D = 3. #ft
f = 0.006
Cv = 0.98
g = 32.2 #ft/sec**2
w = 62.4 #lb/ft**3
#CALCULATIONS
r = (d/12)/D
vact = Cv*math.sqrt(2*g*(h1-h2)/(1+(4*f*l*5280*r**4/D)))
HP = round(round(w*vact**3*(math.pi*(d/12)**2/4)/(550*2*g),-2),-3)
#RESULTS
print 'Horse Power of Jet = %.f HP '%(HP)
import math
#initialisation of variables
p = 60. #lb/in**2
l = 300. #ft
D = 2.5 #in
d = 7./8 #in
f = 0.018
g = 32.2 #ft/sec**2
w = 62.4 #lb/ft**3
#CALCULATIONS
r = (D/d)**4
V = math.sqrt(2*g*144*p/(w*(r+0.5+(4*f*l/(D/12)))))
Q = V*(math.pi*(D/12)**2)/4
#RESULTS
print 'Volume of flow = %.3f cu ft/sec '%(Q)
import math
#initialisation of variables
D = 3. #in
l = 800. #ft
H = 120. #ft
f = 0.01
g = 32.2 #ft/sec**2
w = 62.4 #lb/ft**3
#CALCULATIONS
d = ((D/12)**5/(8*f*l))**0.25
hf = H/3
dh = H-hf
v = math.sqrt(hf*(D/12)*2*g/(4*f*l))
HPmax = w*math.pi*((D/48)**2/4)*v*dh/550
#RESULTS
print 'HPmax = %.3f HP '%(HPmax)
import math
#initialisation of variables
l = 2. #miles
Q = 2.*10**6 #gal/day
d = 12. #in
t = 16. #sec
w = 62.4 #lb/ft**3
g = 32.2 #ft/sec**2
#CALCULATIO
Q1 =Q*10/(w*24*60*60)
hi = l*5280*Q1/((math.pi*(d/12)**2./4)*(g*t))
#RESULTS
print 'height = %.1f ft '%(hi)
import math
#initialisation of variables
d = 6. #in
Q = 0.7854 #cfs
E = 30*10**6 #lb/in**2
t = 0.25 #in
g = 32.2 #ft/sec**2
w = 62.4 #lb/ft**3
K = 300000. #lb/in**2
#CALCULATIONS
v = Q/(math.pi*(d/12)**2/4)
p = v/(math.sqrt(144*(g/w)*((1/K)+(d/(t*E)))))
#RESULTS
print 'rise of presure in the pipe = %.f lb/in**2 '%(p)
import math
#initialisation of variables
w = 62.4 #lb/ft**3
f = 0.005
Q = 100. #cuses
m = 40. #Rs
n = 0.75
n1 = 0.065
K = 15. #Rs
#CALCULATIONS
d = ((5*w/(1.5*550*10))*n*f*Q**3*m/(K*n1))**(1/6.5)
#RESULTS
print 'economical diameter of pipe line = %.3f ft '%(d)