#calculate the discharge using darcy equation
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5 #ft
T=25 #ft
d=10 #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=math.sqrt(8*g/f)
V=C*math.sqrt(R*S)
Q=V*A
#results
print '%s %.1f %s' %("Discharge using Darcy equation =",Q,"ft^3/s")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#calculate the discharge using kutter ganguillet method
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5 #ft
T=25 #ft
d=10 #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
n=0.017
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))
V=C*math.sqrt(R*S)
Q=V*A
#results
print '%s %.1f %s' %("Discharge using kutter ganguillet formula =",Q," ft^3/s")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#calculate the discharge using bazin formula
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5. #ft
T=25. #ft
d=10. #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
m=0.21
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=157.6 /(1+ m/math.sqrt(R))
V=C*math.sqrt(R*S)
Q=V*A
#results
print '%s %.1f %s' %("Discharge using bazin formula =",Q," ft^3/s")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#calculate the discharge using darcy equation
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5. #ft
T=25. #ft
d=10. #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
n=0.017
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=1.486*math.pow(R,(1./6.)) /n
V=C*math.sqrt(R*S)
Q=V*A
#results
print '%s %.1f %s' %("Discharge using Darcy equation =",Q,"ft^3/s")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#calculate the froude number
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5. #ft
T=25. #ft
d=10. #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
n=0.017
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))
V=C*math.sqrt(R*S)
T=d+ 2*(slope*y)
yh=A/T
Nf=V/(math.sqrt(g*yh))
#results
print '%s %.2f' %("froude number = ",Nf)
#calculate the critical depth
#Initialization of variables
import math
rho=1.94 #slugs/ft^3
mu=2.34e-5 #lb-sec/ft^2
y=5. #ft
T=25. #ft
d=10. #ft
slope=3./2.
g=32.2 #ft/s^2
S=0.001
n=0.017
#calculations
A=y*d+ 2*0.5*y*(slope*y)
WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y
R=A/WP
e=0.01 #ft
rr=2*R/e
f=0.019
C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))
V=C*math.sqrt(R*S)
Q=V*A
T=d+ 2*(slope*y)
yh=A/T
yc=2.88 #ft
#results
print '%s' %("yc is obtained using trial and error method")
print '%s %.2f %s' %("Critical depth =",yc,"ft")
#calculate the minimum scale ratio
#Initialization of variables
import math
Re=4000.
rho=1.94 #slugs/ft^3
vm=5.91 #ft/s
mu=3.24e-5 #ft-lb/s^2
Rm=3.12 #ft
#calculations
lam3=Re*mu/(vm*4*Rm*rho)
lam=math.pow(lam3,(2./3.))
#results
print '%s %.2e' %("Minimum scale ratio = ",lam)
#calculate the discharge, depth of the channel, froude numbers and also the force applied
#Initialization of variables
import math
yc=2. #ft
g=32.2 #ft/s^2
d=10. #ft
gam=62.4
rho=1.94
B=10. #ft
#calculations
Vc=math.sqrt(g*yc)
Ac=yc*d
Q=Vc*Ac
y1=5.88 #ft
y2=0.88 #ft
V1=2.73 #ft/s
V2=18.25 #ft/s
Nf1=0.198
Nf2=3.43
F= 0.5*gam*y1*y1 *B - 0.5*gam*y2*y2 *B - Q*rho*V2 +Q*rho*V1
#results
print '%s %.1f %s' %("Discharge in the channel =",Q,"ft^3/s")
print '%s %.2f %s %.2f %s' %("\n Depth of the channel at upstream and downstream =",y1,"ft and",y2, "ft")
print '%s %.3f %s %.3f' %("\n froude numbers at upstream and downstream =",Nf1," and ",Nf2)
print '%s %d %s' %("\n Force applied =",F,"lb")
print '%s' %("The answers are a bit different from textbook due to rounding off error")
#calculate the distance from vena contracta and also the total distance
#Initialization of variables
import math
S0=0.0009
n=0.018
w=20 #ft
d=0.5 #ft
Q=400 #ft^3/s
g=32.2 #ft/s^2
#calculations
y2=4 #ft
V2=Q/(w*y2)
Nf2=V2/math.sqrt(g*y2)
yr=0.5*(math.sqrt(1+ 8*Nf2*Nf2) -1)
y1=yr*y2
L1=32.5
L2=37.1
L3=51.4
L=L1+L2+L3
#results
print '%s %.1f %s %.2f %s' %("distance from vena contracta =",y2,"ft and",y1,"ft")
print '%s %.1f %s' %("\n Total distance =",L," ft")