# Top width, area of lfow, hydraulic radius
from math import *
from __future__ import division
# Given
b = 3 # base of the channel
z = 0.5 # slope of the channel
y = 2 # depth of the channel
# Solution
T = b + 2*z*y
print "Top width =",round(T,0),"m"
A = (b+z*y)*y
print "Area of flow =",round(A,0),"m**2"
P = b + 2*y*sqrt(1+z**2)
print "Wetted perimeter =",round(P,3),"m"
R = A/P
print "Hydraulic radius =",round(R,2),"m"
D = A/T
print "Hydraulic depth =",round(D,2),"m"
Z = A*sqrt(D)
print "Secton Factor =",round(Z,2),"m**2"
# Discharge for the trapezoidal channel
from math import *
from __future__ import division
# Given
z = 1.0 # slide slope
b = 3.0 # base width
y = 1.5 # depth
S = 0.0009
n = 0.012 # for concrete
# Solution
A = (b+z*y)*y
P = P = b + 2*y*sqrt(1+z**2)
R = A/P
# from mannings eqquation
Q = A*(1/n)*(R**(2/3)*S**(1/2))
print "Discharge for the channel =",round(Q,2),"m**3/s"
# Determine cross sectional area
from __future__ import division
from math import *
# Given
z = 1
Q = 10000/60 # discharge of water in ft**#/s
# Solution
y = (Q/(1.828*2.25*sqrt(0.5)))**(2/5)
print "depth(y) =",round(y,2),"ft"
b = 0.828*y
print "base width(b) =",round(b,2),"ft"
# Calculate criticcal depth
from math import *
from __future__ import division
# Given
y = 2.5 # depth
V = 8 # velocity in m/s
g = 9.81 # acceleration due to gravity in m/s**2
# Solution
Yc = (20**2/g)**(1/3)
print "Critical depth =",round(Yc,2),"m"
# determine normal depth, flow regine, critical depth
from math import *
from __future__ import division
# Given
Q = 15 # flow rate in m**3/s
w = 4.0 # bottom width
S = 0.0008 # bed slope
n = 0.025 # manning constant
z = 0.5 # slope
# Solution
# We use a trial and error method here to find the value of y i.e. normal depth
y = 2.22 # we take the value of y as 2.2 m
Q = ((4+0.5*y)*(y/(n))*(((4+0.5*y)*y)/(4+2.236*y))**(0.667)*(S)**(0.5))
print "a )Normal Depth =",round(y,2),"m"
A = (4+0.5*y)*y
T = (w+2*z*y)
D = A/T
V = (Q/A)
F =V/(sqrt(9.81*D))
print "b )F = ",round(F,2)," Since the Froude number is less than 1, the flow is subcritical"
# we use trail and error to find the value of yc for critical depth
yc = 1.08
Q1 = (4+z*yc)*yc*sqrt((9.81*(4+0.5*yc)*yc)/(4+2*z*yc))
print "c )Critical depth is = ",round(yc,2),"m"
# Height, type and length of jump and loss of energy
from math import *
from __future__ import division
# Given
b = 60 # base width in ft
y1 = 2.5 # base depth in ft
Q = 2500 # discharge in ft**3/s
g = 32.2
# Solution
V1 = Q/(b*y1)
F1 = V1/sqrt(g*y1)
y2 = y1*0.5*(sqrt(1+8*F1**2)-1)
V2 = Q/(b*y2)
print "Since F1 =",round(F1,2)," It is a weak jump"
L = y2*4.25
print "Length of the jump =",round(L,0),"ft"
E1 = y1+(V1**2/(2*g))
E2 = y2+(V2**2/(2*g))
El = E1-E2
Te = El*62.4*Q/543
print "Total energy loss =",round(Te,2),"HP"
# Determine flow rate
from math import *
from __future__ import division
# Given
d = 6 # depth of the channel
w= 12 # width of the channel
h = 1.0 # height of the channel
p = 9 # pressure drop in m
g = 32.2
# Solution
y2 = y1 - h - 0.75
V1 = sqrt(2*g*0.75/((1.41)**2-1))
Q = w*b*V1/10
print "Discharge =",round(Q,0),"cfs"