import math
#initialisation of variables
# points
hob= 34. #ft
hoc= 5. #ft
hoa= 50. #ft
hod= 80. #ft height
g= 32.2 #ft/sec**2
# sectional areas
A= 2.1 #in**2
A1= 4.8 #in**2
A2= 9.6 #in**2
#CALCULATIONS
v= math.sqrt(2*g*(hod-hoc))
Q= v*A/144
va= v*A/A1
vb= v*A/A2
Va= va**2/(2*g)
Vb= vb**2/(2*g)
r= hob+hod-hoa-(va**2/(2*g))
r1=hob+hod-hob-(vb**2/(2*g))
#RESULTS
print 'Discharge = %.2f cuses'%(Q)
print ' Velocity head at A = %.2f ft-lb/lb'%(Va)
print ' Velocity head at B = %.2f ft-lb/lb'%(Vb)
print ' Pressure head at A = %.2f ft-lb/lb'%(r)
print ' Pressure head at B = %.2f ft-lb/lb'%(r1)
import math
#initialisation of variables
w= 62.4 #lb/ft**3
P= 1.7 #lb/in**2 pressure
d1= 6. #in diameters
d2= 3. #in diameters
hab= 8. #ft
Q= 0.75 #cuses
sm= 13.6 # gravity
g= 32.2 #ft/sec**2
#CALCULATIONS
dP= P*144/w
va= Q*(d1/d2)**4/math.pi
k= -(((d1/d2)**4-1)-((-dP+hab)*2*g/va**2))
h= (-dP+hab)*12/(sm-1)
#RESULTS
print 'k = %.f '%(k)
print 'height difference = %.2f in'%(h)
import math
#initialisation of variables
h= 20. #ft pressure head
Q= 4.81 #cuses
C= 1.
g= 32.2 #ft/sec**2
d= 10. #indiameter
#CALCULATIONS
d= ((Q*4*144/(d**2*math.pi))**2*100**2/((Q*4*144/(d**2*math.pi))**2+2*g*h))**0.25
#RESULTS
print 'Smallest Diameter = %.1f in'%(d)
import math
#initialisation of variables
d= 1./3 #ft
g= 32.2 #ft/sec**2
d1= 4. #in
d2= 1.6 #in diameter
# guage readings
h1= 5.7 #ft
h2= -1.9 #ft
Q= 0.3 #cuses
H1= 34. #ft height of water
H2= 19. #ft
H3= 7. #ft
H4= 9.2 #ft
h3= 2.9 #ft
h4= 3.9 #ft
Et= 54. #ft-lb/lb
#CALCULATIONS
v1= math.sqrt(2*g*(h1-h2)/((d1/d2)**4-1))
Q1= math.pi*v1*d**2/4
k= Q/Q1
P= (H1+H2)*H3/H4
P1= P-h3
r= P+h1-h2-h4
V= v1**2/(2*g)
E= r+V
dE= Et-E
#RESULTS
print 'Coefficienct of venturi meter = %.4f '%(k)
print ' Pressure of venturi throat = %.2f ft of water'%(P1)
print ' Loss in energy = %.1f ft-lb/lb'%(dE)
# Note : The answer is a bit different due to rounding off error in textbook