%matplotlib inline
#Given
z2=0.5 #ft
q=5.75 #(ft**2)/sec
y1=2.3 #ft
z1=0 #ft
V1=2.5 #ft/sec
#calculation
#bernoulli equation
a=y1+((V1**2)/(2*32.2))+z1-z2 #ft where a=y2+((V**2)/(2*g))
#continuity equation
from scipy.optimize import fsolve
#Calculation
b=(y1*V1) #(ft**2/sec) where b=(y2*V2)
#From b and bernouli eq. f=y**3-1.90*y**2+0.513
def f(y):
f1=y**3-1.90*y**2+0.513
return(f1)
y=fsolve(f,2)
L=y+z2
print "Surface Elevation is ",round(L,2),"ft"
#Plot
E=[3,2,1.51,2.4,3]
Y=[2.9,1.8,1.01,0.5,0.4]
a=plot(E,Y)
xlabel("E ft")
ylabel("Y (ft)")
plt.xlim((0,4))
plt.ylim((0,4))
show(a)
#Given
y=5.0 #ft
angle=40.0 #degree
l=12.0 #ft
rate=1.4 #ft per 1000 ft of length
K=1.49
#Calculation
import math
A=(l*y)+(y*y/math.tan(angle*math.pi/180)) #ft
P=(l+(2*y/math.sin(angle*math.pi/180))) #ft
Rh=A/P
S0=rate/10**3
x=K*(A)*(Rh**(0.666667))*(S0**(0.5)) #where Rh=Q*n
n=0.012
Q=x/n #cfs
#Result
print "The flowrate=",round(Q,0),"cfs"
V=Q/A #ft/sec
Fr=V/(32.2*y)**(0.5)
print "Froude number=",round(Fr,2)
y=5 #ft
angle=40 #degree
l=12 #ft
rate=1.4 #ft per 1000 ft of length
Q=10 #m**3/sec
bw=l*1/3.281 #m where bw=bottom width
#Calculation
import math
from scipy.optimize import fsolve
#A=(l*y)+(y*y/math.tan(angle*math.pi/180)) ft**2
#A=1.19*y**2+3.66*y area interms of distance depth y, 1.19,3.66 are constant
#Rh=1.19*y**2+3.66*y/((3.11*y+3.66)**2)
#P=bw(2*y/math.sin(angle*math.pi/180)) m
#Rh=A/P
#Q=10=k*A*Rh**2/3*So**0.5/(n)
n=0.03 #From table 10.1
def f(y):
f1=((1.19*y**2+3.66*y)**5-515*(3.11*y+3.66)**2) #digits used are costants which is used in the area equation.
return(f1)
y=fsolve(f,2)
#Result
print "The depth of the flow=",round(y,1),"m"
#Given
S0=0.002
n1=0.02
z1=0.6 #ft
n2=0.015
n3=0.03
z2=0.8 #ft
#length of section 1 ,2,3
l1=3.0 #ft
l2=2.0 #ft
l3=3.0 #ft
#Area
A1=l1*(z1) #ft**2
A2=l2*(y) #ft**2
A3=l3*(z1) #ft**2
#Pressure head
P1=l1+z1 #ft
P2=l2+(2*z2) #ft
P3=l3+z1 #ft
Rh1=A1/P1 #ft
Rh2=A2/P2 #ft
Rh3=A3/P3 #ft
y=z1+z2 #ft
K=1.49
#Calculation
Q=K*(S0**(0.5))*((A1*(Rh1**(0.667))/n1)+(A3*(Rh3**(0.667))/n3)+(A2*(Rh2**(0.667))/n2)) #(ft**3)/sec
#Result
print "The flowrate=",round(Q,1),"ft**3/s"
aspratio=2 #asp ratio=aspect ratio=b/y
#result
print "The aspect ratio=",aspratio,":1"
#Plot
b=[0.5,1.2,2,5]
q=[0.85,0.98,1,0.93]
a=plot(b,q)
xlabel("b/y ")
ylabel("q/qmax")
plt.xlim((0,5))
plt.ylim((0.80,1.05))
show(a)
#Given
w=100 #ft
y1=0.6 #ft
V1=18 #ft/sec
Fr1=V1/(32.2*y1)**0.5
print "The Froude number before the jump=",round(Fr1,2)
yratio=0.5*(-1+(1+(8*(Fr1**2)))**0.5) #where yratio=y2/y1
y2=y1*yratio #ft
print "The depth after the jump=",round(y2,2),"ft"
#Q1=Q2, hence
V2=(y1*V1)/y2 #ft/sec
Fr2=V2/(32.2*y2)**0.5
print "The froude number after the jump=",round(Fr2,2)
Q=w*y1*V1#(ft**3)/sec
hL=(y1+(V1*V1/(32.2*2)))-(y2+(V2*V2/(2*32.2))) #ft
Pd=62.4*hL*Q/550 #hp
print "Power dissipated within the jump=",round(Pd,3),"hp"
#Plot
b=[1.54,1.2,0.8,0.6,0.4]
P=[0,10,80,277,900]
a=plot(b,P)
xlabel("b (ft)")
ylabel("P (hp)")
plt.xlim((0,1.6))
plt.ylim((0,1000))
show(a)