import math
#initialisation of variables
i = 0.000146
v = 2.8 #ft/sec
m = 7. #ft
#CALCULAIONS
C = v/math.sqrt(m*i)
K = (157.6-C)*math.sqrt(m)/C
#RESULTS
print 'C = %.3f '%(C)
print 'K = %.3f '%(K)
# answers may vary because of rounding error
import math
#initialisation of variables
b = 10. #ft
n = 1.
i = 1./1000
d = 1.5 #ft
C = 110.
w = 62.4 #lb/ft**3
#CALCULATIONS
L = math.sqrt(2*d**2)
P = b+2*L
A = d*(b+n*d)
m = A/P
v = round(C*math.sqrt(m*i),2)
A_v = round(A*v)
Q = A_v*w*60*60*24/10
#RESULTS
print 'Discharge = %.2e gal/day '%(Q)
import math
#initialisation of variables
b = 10. #ft
n = 2.
d = 3.5 #ft
i = 1./625
#CALCULATIONS
A = d*(b+(d/n))
L = math.sqrt(d**2+(d/2)**2)
P = b+2*L
m = A/P
v = 1.486*m**(2./3)*i**0.5/0.03
Q = A*v
#RESULTS
print 'Discharge = %.1f cuses '%(Q)
# Note : answer may vary because of rounding error.
import math
#initialisation of variables
d = 3. #ft
i = 1./4500
C = 80.
#CALCULATIONS
A = 0.5*(math.pi*d**2/4)
P = math.pi*d/2
m = A/P
v = C*math.sqrt(m*i)
Q = v*A
#RESULTS
print 'Discharge = %.2f cuses '%(Q)
import math
#initialisation of variables
A = 2500. #acres
n = 20.
Q = 40. #gal/head
C = 130.
i = 1./3000
p = 7. #per cent
w = 62.4 #lb/ft**3
#CALCULATIONS
Q1 = Q*50000*p/(60*100*60*w)
Q2 = Q1+(A*4840*9/(12*24*60*60))
d = (Q2*8*math.sqrt(4/i)/(math.pi*C))**0.4
#RESULTS
print 'Diameter = %.3f ft '%(d)
# answer is different because of rounding error.
import math
#initialisation of variables
Qt = 150000. #cuses
i = 1/10000.
n1 = 1.
n2 = 2./3
d1 = 30. #ft
C1 = 100.
C2 = 75.
b1 = 600. #ft
b2 = 2000. #ft
r = 2.
A1 = (b1+d1)*d1
P1 = b1+(2*d1*math.sqrt(2))
m1 = A1/P1
v1 = C1*math.sqrt(m1*i)
Q1 = A1*v1
Q2 = Qt-Q1
v2 = v1/2
A2 = Q2/v2
d2 = (-b2+math.sqrt(b2**2+4*1.5*A2))/(2*1.5)
#RESULTS
print 'depth of water = %.f ft '%(d2)
import math
#initialisation of variables
d = 3. #ft
i = 1./1000
C = 65.
Cd = 0.56
g = 32.2 #ft/sec**2
h1 = 7.5 #ft
h2 = 3. #ft
#CALCULATIONS
m = d
v = C*math.sqrt(m*i)
Q = v*d
H = (Q*d/(2*math.sqrt(2*g)*Cd))**(2./3)
h = h1+h2-H
#RESULTS
print 'Height of dam = %.2f ft '%(h)
import math
#initialisation of variables
Q =100. #cuses
v = 2. #/ft/sec
n = 1.5
A = 50. #ft**2
C = 120.
#CALCULATIONS
d = math.sqrt((Q/v)/(2*math.sqrt(n**2+1)-n))
m = A/d
h1 = m-n*d
h2 = m+n*d
i = (v/C)**2*(2/d)
#RSULTS
print 'Depth = %.2f ft '%(d)
print ' Bottom width = %.2f ft '%(h1)
print ' Top width = %.2f ft '%(h2)
import math
#initialisation of variables
Q = 1100. #cuses
i = 1/1800.
C = 95.
n = 1.5
#CALCULATIONS
d = ((Q*math.sqrt(3600)/C)/(n+0.6))**0.4
b = 0.6*d
ht = b+2*(n*d)
#RESULTS
print 'Depth = %.1f ft '%(d)
print ' Bottom width = %.2f ft '%(b)
print ' Top width = %.1f ft '%(ht)
import math
#initialisation of variables
n = 1.5
Q = 800. #cuses
i = 2.5/5280
n1 = 9.24
r = 0.6
k = 1.49
#CALCULATIONS
d = (k*10**7*4/n1)**(1/8.)
#RESULTS
print 'Depth of channel = %.1f ft '%(d)
import math
#initialisation of variables
d = 8. #ft
i = 1./1200
C = 90.
a = 308. #degrees
#CALCULATIONS
h = 0.95*d
A = (d/2)**2*(a*(math.pi/180)-math.sin(math.radians(a)))/2
m = 0.29*d
Q = A*C*math.sqrt(m*i)
#RESULTS
print 'Discharge = %.f cuses '%(Q)
import math
#initialisation of variables
v = 5. #ft/sec
Q = 500. #cuses
w = 25. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
h = (Q/v)/w
E = h+(v**2/(2*g))
he = round((400*2/64.4)**(1./3),2)
ve = round(20./2.32,2)
Emin = he + (ve**2 / (g*2))
#RESULTS
print 'Specific energy = %.2f ft '%(E)
print "Critical Velocity of flow = %.2f ft/sec"%ve
print 'Minimum energy Emin = %.2f ft'%Emin
import math
#initialisation of variables
i = 1./5000
C = 100.
b = 50. #ft
h = 10. #ft
Q = 1000. #cuses
g = 32.2 #ft/sec**2
#CALCULATIONS
f = 2.*g/C**2
m = (b*h)/(b+2*h)
v = Q/(b*h)
r = (i-(f*4/(2*g*m)))/(1-(2**2/(g*h)))
s = i-r
#RESULTS
print 'Slope = %.6f '%(s)
import math
#Initialization of variables
B =48. #ft
D =5. #ft
f =0.005
i =1./1000
g =32.2
#calculations
C =math.sqrt(2*g/f)
m =B*D/(B+2*D)
V =C*math.sqrt(m*i)
Q =B*D*V
Dc =(Q**2 /(g*B**2))**(1./3)
d1 =2.25 #ft
Q1 =1*D*V
d2 =-d1/2 + math.sqrt(2*Q1**2 /(g*d1) + d1**2 /4)
hd =d2-d1
#results
print "height required = %.1f ft"%(hd)
#The answer is a bit different due to rounding off error in textbook
import math
#initialisation of variables
Q = 360. #cfs
d1 = 1. #ft
B = 18. #ft
g = 32.2 #ft/sec**2
w1 = 624. #lb/ft**3
d2 =4.5 #ft
#CALCULATIONS
w = Q/B
v1 = w/d1
v2 = v1/d2
d2 = -0.5+math.sqrt((2*v1**2*d1/(g))+(d1**2./4))
El = (d1+(w**2/(2*g)))-(d2+(v2**2/(2*g)))
EL = round(w1*Q*El,-4)
#RESULTS
print 'loss in energy = %.f lb '%(EL)
import math
#initialisation of variables
d1 = 4. #ft
v1 = 60. #ft/sec
g = 32.2 #ft/sec**2
#CALULATIONS
d2 = d1*(math.sqrt(1+8*v1**2/(g*d1))-1)/2.
#RESULTS
print 'd2 = %.f ft '%(d2)
import math
#initialisation of variables
b = 150. #ft
d = 12. #ft
N = 0.03
i = 1./10000
h = 10. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
A = b*d
P = b+2*d
m = A/P
v = m**(2/3.)*1.49*i**0.5/N
A1 = b*(h+d)
P1 = b+2*(h+d)
m1 = A1/P1
C1 = 1.49*m1**(1./6)/N
v1 = A*v/A1
s = (i-(v1**2/(C1**2*m1)))/(1-(v1**2/(g*(h+d))))
L = round(2*h/s,-3)
#RESULTS
print 'Length of back water = %.f ft '%(L)
import math
#initialisation of variables
b1 = 3.2 #ft
b2 = 1.3 #ft
h1 = 1.86 #ft
h2 = 1.63 #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
a1 = b1*h1
a2 = b2*h2
Q = a1*a2*math.sqrt(2*g)*math.sqrt(h1-h2)/(math.sqrt(a1**2-a2**2))
#RESULTS
print 'Discharge = %.1f cuses '%(Q)
import math
#initialisation of variables
b1 = 4. #ft
b2 = 2. #ft
h1 = 2. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
Qmax = 3.09*b2*h1**1.5
v1 = Qmax/(b1*h1)
H = h1+(v1**2/(2*g))
Qmax2 = 3.09*b2*H**1.5
h2 = 2*H/3
#RESULTS
print 'Qmax = %.2f cfs '%(Qmax2)
print 'h2 = %.3f ft '%(h2)
import math
#initialisation of variables
h1 = 8. #ft
b1 = 32. #ft
h = 1. #ft
b2 = 24. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
H = h1-h
h = 9.65
Q = 3.09*H**1.5*b2
v1 = Q/(b1*h1)
Q1 = 3.09*(H+(v1**2/(2*g)))**1.5*b2
hc = (Q1**2/(g*b2**2))**(1./3)
d2 = -(hc/2)+math.sqrt(9*hc**2/2)
#RESULTS
print 'Q = %.f cfs '%(Q1)
print 'hc = %.2f ft '%(hc)
print 'max depth = %.2f ft '%(d2)
print 'Maximum depth of water downstream %.2f ft'%(d2+1)
print 'h = %.2f ft'%h
# answers may vary because of rounding error.