import math
from scipy.integrate import quad
#initialisation of variables
g= 32.2 #ft/sec**2
d= 6. #ft
di= 2. #in
h= 9. #ft
Cd= 0.6
#CALCULATIONS
def fun(H):
return H**-0.5*(d/2)**2*math.pi/(Cd*math.pi*math.sqrt(2*g)/144)
vec2=quad(fun,0,h)
T= vec2[0]
#RESULTS
print 'Time to emptify = %.f sec'%(T)
import math
from scipy.integrate import quad
#initialisation of variables
d1= 4. #ft
d2= 2. #in
l= 300. #ft
P= 5. #lb/in**2
h1= 3. #ft
h2= 6. #ft
f= 0.01
#CALCULATIONS
X= P*2.31*10*(d2/12)**5/(f*l)
A= math.pi*d1**2/4
def fun(h):
return A*math.sqrt((P*2.31*10*(d2/12)**5/(f*l))-(10*(d2/12)**5*h/(f*l)))/(10*(d2/12)**5/(f*l))/7
vec2=quad(fun,h1,h2)
T= vec2[0]
#RESULTS
print 'time for the channel to fall = %.2f sec'%(T)
# rounding error
from scipy.integrate import quad
import math
#initialisation of variables
d= 10. #in
l= 15. #ft
di= 3. #in
Cd= 0.62
g=32.2
#CALCULATIONS
def fun(H):
return -l*2*math.sqrt((d/2)**2-((d/2)-H)**2)/(Cd*(math.pi*(di/12)**2/4)*H**0.5*math.sqrt(2*g))
vec2=quad(fun,0,d/2)
T= vec2[0]
secs = -T%60
mins = -T/60
#RESULTS
print 'time for the channel to fall = %d mins and %d seconds'%(mins,secs)
# rounding error
import math
from scipy.integrate import quad
#initialisation of variables
h= 4. #ft
w= 6. #ft
l= 100. #yd
a= 60. #degrees
h1= 3. #ft
h2= 2. #ft
Cd= 0.6
g=32.2 #ft/s**2
#CALCULATIONS
A= l*3*w
def fun(H):
return -A*H**-2.5/(Cd*(8./15)*(math.tan(math.radians(a/2)))*math.sqrt(2*g))
vec2=quad(fun,h1,(h1-h2))
T= vec2[0]
#RESULTS
print 'time for the channel to fall = %.f sec'%(T)
import math
#initialisation of variables
A= 1./16 #mile**2
d= 2. #ft
h= 18. #ft
h1= 5. #ft
f= 0.006
l= 200. #ft
h2= 10. #ft
g= 32.2 #ft/sec**2
#CALCULATIONS
X= math.sqrt(1./((1.5+(4*f*l/d))/(2*g)))
def fun(H):
return A*5280**2*H**-0.5/(math.pi*d**2*X/4)
vec2=quad(fun,h-h1,h)
T= vec2[0]
hours = T/3600
mins = T%3600/60
#RESULTS
print 'time for the channel to fall = %d hours and %d mins sec'%(hours,round(mins,-1))
import math
#initialisation of variables
l= 8. #ft
b= 6. #ft
h= 10. #ft
r= 3.
Cd= 0.6
A1= 36. #ft**2
A2= 12. #ft**2
l1= 6. #ft
h1= 1. #ft
d= 2. #in
g=32.2 #ft/s**2
#CALCULATIONS
def fun(H):
return H**-0.5/(Cd*(math.pi*(d/12)**2/4)*math.sqrt(2*g)*((1/A1)+(1/A2)))
vec2=quad(fun,0,(b-h1))
T= vec2[0]
#RESULTS
print 'time for the levels to become equal = %.f sec'%(T)
import math
#initialisation of variables
h1= 3. #ft
h2= 4. #ft diameter
r= 0.95 #m**-1
k= 27.65 #sec
Cd= 0.95
#CALCULATIONS
T= k*(math.log(r*math.sqrt(h2)-1)+(r*math.sqrt(h2)-1))-k*(math.log(r*math.sqrt(h1)-1)+(r*math.sqrt(h1)-1))
h= ((h2-h1)/Cd)**2
#RESULTS
print 'Time = %.2f sec'%(T)
print ' Increase in water level = %.2f ft'%(h)
import math
#initialisation of variables
t= 75. #sec
h= 10.5 #in constant
h1= 13.5 #in
#CALCULATIONS
r= t*math.pi*math.sqrt(2*h**2)/math.log((math.sqrt(2*h1**2)+h1)/(math.sqrt(2*h**2)-h))
t= -r*((1/h1)-(1/h))
#RESULTS
print 'A/K = %.f '%(r)
print ' Time taken = %.1f sec'%(t)
# rounding off error
import math
#initialisation of variables
g= 9.8 #m/sec**2
h1= 10. #in
h2= 12. #in
r1= 1.32
r2= 1.56
r3= 1.97
r4= 4.10
r5= 2.64
#CALCULATIONS
Q= math.sqrt(32.2)*(h2/18)**1.5
T= 10**5*(r1+2*r3+r4+4*(r3+r5))/(6*h2*60*60)
#RESULTS
print 'Actual discharge = %.2f CBH**1.5 cuses'%(Q)
print ' Time = %.1f hr'%(T)
#The answer is a bit different due to rounding off error in textbook