#initialisation of variables
import math
Q = 16. #gpm
w = 62.4 #lb/ft**3
d = 1. #in
h = 2+(5./12) #ft
g = 32.2 #ft/sec**2
x = 11.5 #ft
h1 = 1.2 #in
#CALCULATIONS
Cd = Q*10/(60*w*(math.pi*(d/12)**2/4)*math.sqrt(2*g*h))
Cv = math.sqrt(x**2/(4*(h1/12)*h*12**2))
Cc = Cd/Cv
Cr = (1-Cv**2)/Cv**2
#RESULTS
print 'Cc = %.3f '%(Cc)
print 'Cv = %.3f '%(Cv)
print 'Cd = %.3f '%(Cd)
print 'Cr = %.3f '%(Cr)
# note : answers are slightly different because of rounding error.
import math
#initialisation of variables
Ww = 261. #lb/min
a = 1. #in**2
h = 4. #ft
y = 5. #ft
W1 = 10.65 #lb
l = 1. #ft
Q = 261. #lb/min
w = 62.4 #lb/ft**3
g = 32.2 #ft/sec**2
#CALCULATIONS
v = Q*144./(w*60)
F = W1*l/y
v = F*g*60./Q
vth = math.sqrt(2*g*h)
Cv = v/vth
Q1 = Ww/w
Qth = vth*60./144
Cd = Q1/Qth
Cc = Cd/Cv
#RESULTS
print 'Cv = %.3f '%(Cv)
print 'Cd = %.3f '%(Cd)
print 'Cc = %.3f '%(Cc)
#initialisation of variables
import math
Q = 10. #ft**3/sec
a1 = 1. #ft**2
a2 = 4. #ft**2
g = 32.2 #ft/sec**2
p1 = 12. #lb/in**2
v1 = 10. #ft/sec
w = 62.4 #lb/ft**3
#RESULTS
v2 = v1*a1/a2
Hl = (v1-v2)**2/(2*g)
p2 = ((p1*144/w)+(v1**2/(2*g))-(v2**2/(2*g))-Hl)*(w/144)
W = Hl*v1*w/550.
#RESULTS
print 'Head lost = %.3f ft of water '%(Hl)
print 'Pressure in larger part of pipe = %.2f lb/in**2 '%(p2)
print 'Work done = %.3f HP '%(W)
#initialisation of variables
import math
Cc = 1.
Cv = 0.833
d = 2. #in
g = 32.2 #ft/sec**2
H = 12. #ft
Pa = 34. #lb/in**2
#/CALCULATIONS
Q = Cc*Cv*math.pi*(d/12)**2*math.sqrt(2*g*H)/4
Cd = Cc*Cv
Pc = Pa-0.92*H
#RESULTS
#RESULTS
print 'Discharge = %.3f cu ft/sec '%(Q)
print 'Coefficient of discharge = %.3f '%(Cd)
print 'Pressure at Vent-contraction = %.2f ft of water '%(Pc)
import math
H = 4. #ft
d = 1. #in
g = 32.2 #ft/sec**2
Cc = 0.5
#CALCULATIONS
Q = Cc*math.pi*(d/12)**2*math.sqrt(2*g*H)/4
#RESULTS
print 'Actual Discharge = %.4f cu ft/sec '%(Q)
import math
#initialisation of variables
D = 4. #ft
d = 2. #in
H1 = 6. #ft
H2 = 2. #ft
t = 4. #min
g = 32.2 #ft/sec**2
w = 62.4 #lb/ft**3
H = 5. #ft
#CALCULATIONS
Cd = (2.*(math.pi/4.)*D**2*(math.sqrt(H1)-math.sqrt(H2)))/(t*60*(math.pi/4)*(d/12)**2*math.sqrt(2*g))
Q = Cd*(math.pi/4)*(d/12)**2*math.sqrt(2*g*H)*w*60/10
#RESULTS
print 'Cd = %.3f '%(Cd)
print 'Discharge = %.1f gpm'%(Q)
# note : answers are slightly different because of rounding error.
import math
#initialisation of variables
H1 = 10. #ft
H2 = 2. #ft
Cd = 0.61
d1 = 8. #ft
g = 32.2 #ft/sec**2
d2 = 3. #ft
#CALCULATIONS
a = d2**2./144
H0 = H1*d2/(d1-d2)
t = math.pi*(d1/2)**2*((2/5.)*(H1**(5./2)-H2**(5./2))+2*H0**2*(math.sqrt(H1)- \
math.sqrt(H2))+(4./3)*H0*(H1**(3./2)-H2**(3./2)))/(60*Cd*a*math.sqrt(2*g)*(H1+H0)**2)
#RESULTS
print 'time required to lower the water level = %.2f min'%(t)
# Note : answer is different because of rounding error.
import math
#initialisation of variables
D = 10. #ft
H1 = 17. #ft
H2 = 5. #ft
d = 3. #in
Cd = 0.62
g =32.2 #ft/s**2
#CALCULATIONS
t1 = (2*math.pi*D**2/4)*(math.sqrt(H1)-math.sqrt(H2))/(Cd*math.sqrt(2*g)*math.pi*(d/12)**2/4)
t2 = math.pi*(14./15)*H2**(5./2)*4/(Cd*math.pi*(d/12.)**2*math.sqrt(2*g))
t = t1+t2
#RESULTS
print 'time required to empty the vessel = %.f sec'%(t)
import math
#initialisation of variables
Cd = 0.8
g = 32.2 #ft/sec**2
d = 3. #in
#CALCULATIONS
t = (60*2/(math.pi*(d/12)**2*math.sqrt(2*g)/4*Cd))*(6-d)**(3./2)/(3*60./2)
#RESULTS
print 'time to emptify biler = %.2f min'%(t)
# note : answer is different because of rounding error.
import math
#initialisation of variables
A = 100 * 27 # sq ft
dif = 8 - 3. # ft
a = 2. # sq ft
Cd = 0.8 # Co-efficient
#CALCULATIONS
t1 = round(A*((a/3 * 22.7) - a/3 * 5.19 - (a/3*11.2))/(Cd*2*8.02*dif))
t2 = round(A*(2./3)*11.2/(Cd*a*8.02*dif))
t = t1 + t2
#RESULTS
print 'Total time to empty the tank = %d sec'%t
import math
#initialisation of variables
H1 = 9. #ft
H2 = 4. #ft
Cd = 0.6
a = 4. #in**2
A1 = 72. #ft**2
A2 = 24. #ft**2
g =32.2 #ft/s**2
#CALCULATIONS
t = (2*A1*A2/(A1+A2))*(math.sqrt(H1)-math.sqrt(H2))*144/(Cd*60*a*math.sqrt(2*g))
#RESULTS
print 'time required to reduce the water level difference = %.1f min'%(t)
#initialisation of variables
import math
l = 80. #ft
w = 12. #ft
t = 3. #min
Hl = 12. #ft
g = 32.2 #ft/sec**2
Cd = 0.6
#CALCULATIONS
s = math.sqrt(2*l*w*Hl**(1./2)/(Cd*math.sqrt(2*g)*t*60.))
#RESULTS
print 'side of the square orifice = %.2f ft'%(s)
#initialisation of variables
import math
g = 32.2 #ft/sec**2
Cd = 0.6
d = 2. #in
H1 = 5. #ft
#CALCULATIONS
K = round(Cd * math.pi/4 * (d/12)**2 * math.sqrt(g*2),3)
t = d*math.pi*(0.5*math.log(1.89) - 0.235)/K**2
v = round(math.sqrt(2*g*H1)/2.)
q = v*Cd*math.pi*(d/12)**2./4
#RESULTS
print "Time required to raise the level is : %.2f sec"%t
print 'Total discharge = %.3f cfs'%(q)
# Note : answers may vary because of rounding error. Please calculate manually.
import math
#initialisation of variables
Cd = 0.62
H = 9. #in
l = 3. #ft
g = 32.2 #t/sec**2
#CALCULATIONS
Q1 = Cd*(H*l/12)*math.sqrt(2*g*3*H/24.)
Q2 = Cd*2*l*math.sqrt(2*g)*((H/6)**(3./2)-(H/12)**(3./2))/3
#RESULTS
print 'Discharge by appropriate formula = %.2f cfs'%(Q1)
print ' Discharge by exact formula = %.2f cfs'%(Q2)
import math
#initialisation of variables
Cd = 0.62
B = 2.5 #ft
H2 = 8. #ft
H1 = 7. #ft
g = 32.2 #ft/sec**2
h = 4. #ft
#CALCULATIONS
Q1 = round(2*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2))/3)
Q2 = Cd*math.sqrt(2*g)*math.sqrt(H2)*B*(h-1)
Q = Q1+Q2
#RESULTS
print 'Total discharge = %d cfs'%(Q)