import math
#initialisation of variables
p = 70. #per cent
Cd = 0.6
Q = 50. #million gallons
H = 2. #ft
w = 62.4 #lb/ft**3
g = 32.2 #ft/sec**2
#CALCULATIONS
Q1 = p*Q*10**6*10/(100*w*24*3600)
L = Q1*3/(2*Cd*math.sqrt(2*g)*H**1.5)
#RESULTS
print 'length of the weir = %.2f ft '%(L)
import math
#initialisation of variables
L = 15. #ft
H = 1. #ft
Cd = 0.6
v = 80. #ft/min
g = 32.2 #ft/sec62
w = 62.4 #lb/ft**3
#CALCULATIONS
vo = v/60
Q = 2*Cd*math.sqrt(2*g)*L*((1+(vo**2/(2*g)))**1.5-(vo**2/(2*g))**1.5)*w*100/(3*550)
#RESULTS
print 'HP = %.f HP '%(Q)
# This is accurate answer. Please calcualte manually.
import math
#initialisation of variables
L = 11. #ft
H = 0.7 #ft
Cd = 0.6
g = 32.2 #ft/sec**2
h = 1.95 #ft
Q = 20.65 #cuses
Q1 = 21.2 #cfs
#CALCULATIONS
Q = 2*Cd*math.sqrt(2*g)*L*H**1.5/3
vo = Q/(h*L)
h1 = vo**2/(2*g)
Q1 = 2*Cd*math.sqrt(2*g)*L*((H+(vo**2/(2*g)))**1.5-(vo**2/(2*g))**1.5)/3
v1 = Q1/(L*h)
Q2 = 2*Cd*math.sqrt(2*g)*L*((H+(v1**2/(2*g)))**1.5-(v1**2/(2*g))**1.5)/3
p = (Q2-Q1)*100/Q1
#RESULTS
print "Head to velocity approach = %.1f cu ft/sec"%Q1
print "Q2 = %.2f cu ft/sec"%Q2
print 'discharge percent = %.3f per cent '%(p)
# Note : answers may vary because of rounding error. Please calculate manually.
import math
#initialisation of variables
b = 3. #ft
H = 1 #ft
Q = 9 #cfs
Q1 = 1.105 # log Q from fig.
h = 0.1 # log H from fig. ft
#CALCULATIONS
K = Q/b
n = (Q1-math.log10(3*K))/h
#RESULTS
print 'K = %.f '%(K)
print 'n = %.1f '%(n)
import math
#initialisation of variables
g = 32.2 #ft/sec**2
Cd = 0.62
L = 7.573 #ft
H = 1.2 #ft
S = 2.85 #ft
#CALCULATIONS
Q1 = 2*Cd*math.sqrt(2*g)*L*H**1.5/3
Q2 = 3.33*L*H**1.5
Q3 = math.sqrt(2*g)*L*H**1.5*(0.405+(0.00984/H))
He = H+0.004
Q4 = (3.227+0.435*(He/S))*L*He**1.5
#RESULTS
print 'Q = %.2f cuses '%(Q1)
print 'Q = %.2f cuses '%(Q2)
print 'Q = %.2f cuses '%(Q3)
print 'Q = %.2f cuses '%(Q4)
# Note : answers may vari because of rounding error. Please check manually.
import math
#initialisation of variables
H = 2.5 #ft
L = 10 #ft
A = 10 #miles
p = 30 #per cent
a = 2 #in/hr
w = 2 #ft
#CALCULATIONS
Q = L*1760**2*3**2*a*p/(60*60*12*100)
n = ((Q/(3.33*H**1.5))-(L-0.1*w*H))/(L-0.1*w*H)
#RESULTS
print 'n = %.f '%(n)
import math
#initialisation of variables
L = 2.5 #ft
H = 1 #ft
g = 32.2 #ft/sec**2
Cd = 0.61
L1 = 1.75 #ft
L2 = 2.25 #ft
#CALCULATIONS
Q1 = 2*Cd*math.sqrt(2*g)*L*H/3
Q2 = 2*Cd*math.sqrt(2*g)*L1*(L1**1.5-1)/3
Q3 = 2*Cd*math.sqrt(2*g)*H*(L2**1.5-L1**1.5)/3
Q = Q1+Q2+Q3
#RESULTS
print 'Total discharge = %.1f cfs '%(Q)
import math
#initialisation of variables
g = 32.2 #ft/sec**2
h1 = 16.63 #cm
h2 = 10.18 #cm
h3 = 16.53 #cm
#CALCULATIONS
H1 = h1-h2
H2 = h3-h2
p = (H1**1.5-H2**1.5)*100/H1**1.5
#RESULTS
print 'Percent decrease in discharge = %.2f %% '%(p)
import math
#initialisation of variables
Cd = 0.6
a = 20000 #yd**2
H2 = 12 #in
L = 5 #ft
H1 = 2 #ft
g =32.2 #ft/s**2
#CALCULATIONS
t = 2*a*9*(L-H1)*((1/math.sqrt(H2/12))-(1/math.sqrt(H1)))/(2*60*Cd*math.sqrt(2*g)*L)
#RESULTS
print 'time required to lower level of reservoir = %.2f min '%(t)
import math
#initialisation of variables
L = 3. #ft
H = 6. #in
Cd = 0.62
Cd1 = 0.59
a = 45. #degrees
g = 32.2 #ft/sec**2
#CALCULATIONS
H = ((2./3)*Cd*math.sqrt(2*g)*L*(H/12)**1.5/((8./15)*Cd1*math.sqrt(2*g)))**0.4
#RESULTS
print 'depth of water = %.3f ft '%(H)
import math
#initialisation of variables
V = 20. #litres
g = 981. #cm/sec**2
Cd = 0.593
r = 2.5
r1 = 1.5
e = 2. #mm
Cd1 = 0.623
L = 30. #cm
#CALCULATIONS
H = (V*1000*15/(8*Cd*math.sqrt(2*g)))**0.4
dH1 = e/10.
p = r*dH1*100/H
H1 = (V*3*1000/(2*Cd1*math.sqrt(2*g)*L))**(2./3)
p1 = r1*dH1*100/H1
#RESULTS
print 'percentage error of discharge over the weir = %.2f %% '%(p)
print 'percentage error of discharge over the weir = %.2f %% '%(p1)
import math
#initialisation of variables
L = 16. #in
H = 9. #in
h = 18. #in
g = 32.2 #ft/sec**2
w = 2. #ft
Cd = 0.63
W = 62.4 #lbs/ft**3
#CALCULATIONS
Q = 2*Cd*math.sqrt(2*g)*(L/12)*(H/12)**1.5/3
v = Q/(w*(h/12))
H1 = v**2/(2*g)
Q1 = 2*Cd*math.sqrt(2*g)*(L/12)*(((H/12)+H1)**1.5-H1**1.5)*W*6/3.
#RESULTS
print 'Discharge = %.f gpm '%(Q1)
import math
#initialisation of variables
L = 100 #ft
H = 2.25 #ft
Cd = 0.95
w = 120 #ft
h = 2 #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
Q = round(3.087*Cd*L*H**1.5)
v0 = round(Q/(w*(h+H)),2)
Q1 = 3.087*Cd*L*((H+(v0**2/(2*g)))**1.5-(v0**2/(2*g))**1.5)
#RESULTS
print 'Discharge = %.0f cuses '%(Q1)
# Note: answer is slightly different because of rounding error.
import math
#initialisation of variables
L = 6 #ft
H1 = 0.5 #ft
H2 = 0.25 #ft
g = 32.2 #ft/sec**2
Cd1 = 0.58
Cd2 = 0.8
w = 6.24 #lb/ft**3
#CALCULATIONS
Q1 = 2*Cd1*math.sqrt(2*g)*L*(H1-H2)**1.5/3
Q2 = Cd2*L*H2*math.sqrt(2*g*(H1-H2))
Q = round((Q1+Q2)*w*3600,-3)
#RESULTS
print 'Discharge = %.f gph '%(Q)
import math
#initialisation of variables
W = 100 #ft
h = 10 #ft
v = 4 #ft/sec
h1 = 3 #ft
g = 32.2 #ft/sec**2
H = 5.4 #ft
Cd1 = 0.58
Cd2 = 0.8
#CALCULATIONS
v0 = (W*h*v)/(W*(h+h1))
h0 =v0**2/(2*g)
H2 = (W*h*v-(2*Cd1*W*math.sqrt(2*g)*((h1+h0)**1.5-h0**1.5)/3))/(Cd2*W*math.sqrt(2*g*(h1+h0)))
dh = h-H2
#RESULTS
print 'height of anicut which is drowned = %.f ft '%(dh)
import math
#initialisation of variables
x = 6. #in
l = 200. #ft
d = 10. #ft
v = 4. #ft/sec
Ce = 0.95
g = 32.2 #ft/sec**2
#CALCULATIONS
l1 = math.sqrt(l**2/(Ce**2*(((x/12)*2*g/v**2)+(d**2/(d+(x/12))**2))))
#RESULTS
print 'length = %.f ft '%(l1)
import math
#initialisation of variables
g = 32.2 #ft/sec**2
H = 25. #ft
l = 2.5 #ft
b = 5. #ft
Cd = 0.64
Q = 3200. #cuses
L =150. #ft
C =3.2
depth =0.5 #ft
A1 =5000000. #sq yards
#CALCULATIONS
Q1 = Cd*l*b*math.sqrt(2*g*H)
n = Q/Q1
h = (Q/(3.2*L))**(2./3)
hr =h-depth
Area =A1*9
V = round(Area*hr,-6)
#RESULTS
print 'number of spilways = %.f '%(n)
print "Volume of extra water stored = %d cu ft"%(V)