#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
z2 = 0. #m
z1 = 8. #m
V2 = 5. #outlet velocity - m/s
V1 = 3. #inlet velocity - m/s
#calculations
Hs = (z2-z1) + (V2**2 -V1**2)/(2*g)
#results
print "Work done by fluid = %.3f J/N"%(Hs)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
P1 = 80.*10**3 #N/m**2
P2 = 12.*10**6 + 101300 #N/m**2
Hq = -400. #J/N
#calculations
g1 = g*rho
Hs = -Hq+ (P2-P1)/(g1)
#results
print "Energy added by pump = %d J/N"%(Hs)
print ("The answer given in textbook is wrong. Please verify using a calculator")
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
d1 = 15. #cm
d2 = 10. #cm
V1 = 2.4 #m/s
P1 = 450.*10**3 #N/m**2
rho2 = 900. #kg/m**3
#calculations
V2 = d1**2 /d2**2 *V1
P2 = g*rho2*(P1/(rho2*g) + V1**2 /(2*g) - V2**2 /(2*g))
Q = math.pi/4*(d2/100)**2 *V2
#results
print "Pressure at 2 = %.2f kN/m**2"%(P2/1000)
print " Flow rate = %.4f m**3/s"%(Q)
#The answer given in textbook is wrong. Please verify it.
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
z = 10. #m
#calculations
PE = g*rho*math.pi*z**2 /2
#results
print "Work obtained = %.2e J"%(PE)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10**3 #kg/m**3
d1 = 7.5 #diameter - cm
d2 = 3. #cm
P1 = 300+101.3 #pressure - kPa
P2 = 25. #kPa
#calculations
V1 = math.sqrt(2*g/ ((d1/d2)**4 -1) *(P1*10**3 /(rho*g) -P2*10**3 /(rho*g)))
Q = math.pi/4 *(d1/100)**2 *V1
#results
print "Max discharge = %.4f m**3/s"%(Q)
#The answer given in textbook is wrong. Please use a calculator to verify
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10**3 #kg/m**3
z1 = 1.2 #m
z2 = 4. #m
d = 5. #cm
#calculations
Va = math.sqrt(2*g*(z2-z1))
Q = math.pi/4 *(d/100)**2 *Va
Pc = - z2*rho*g
P = 25*10**3 #Pa
Zab = (101325 - P)/rho/g
#results
print "rate of discharge = %.4f m**3/s"%(Q)
print " Pressure at C = %.2f kPa"%(Pc/1000)
print " Max. permissible length = %.2f m"%(Zab)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Q = 0.09 #m**3/s
d1 = 0.12 #diameter - m
d2 = 0.2 #diameter - m
P1 = 80. #pressure - kN/m**2
P2 = 120. #pressure - kN/m**2
#calculations
V1 = Q/(math.pi/4 *d1**2)
TE1 = P1*10**3 /(rho*g) + V1**2 /(2*g)
V2 = d1**2 /d2**2 *V1
TE2 = P2*10**3 /(rho*g) + V2**2 /(2*g)
#results
if TE1>TE2 :
print "Flow is from section 1 to section 2"
else:
print "Flow is from section 2 to section 1"
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Q = 0.012 #m**3/s
z = 10. #m
d = 0.075 #m
#calculations
Vb = Q/(math.pi/4 *d**2)
Hm = z+ Vb**2 /(2*g)
P = Hm*rho*g*Q
#results
print "Power required = %.3f kW"%(P/1000)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 860. #kg/m**3
P1 = 20. *10**3 #Pa
P2 = 50.*10**3 #Pa
z = 2.8 #m
d1 = 0.1 #m
#calculations
V1 = math.sqrt(2*g*(P2/(rho*g) -z - P1/(rho*g)))
Q = math.pi/4 *d1**2 *V1
#results
print "rate of flow = %.4f m**3/s"%(Q)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Cv = 0.92 #coefficient of velocity
P = 210.*10**3 #Pressure - Pa
d = 0.05 #m
ret = 1.5 #m/s**2
#calculations
H = P/(g*rho)
Va = Cv*(2*g*H)
h = Cv**2 *H
h2 = Cv**2 *2*g*H/(2*(g+ret))
#results
print "The height to which the jet will rise is %.2f m"%(h)
print " In case height = %.2f m"%(h2)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
h = 4. #m
d = 0.03 #m
Qa = 3.8/1000 #m**3/s
x = 2.5 #m
y = 0.41 #m
#calculations
Qth = math.pi/4 *d**2 *math.sqrt(2*g*h)
Cd = Qa/Qth
Cv = math.sqrt(x**2 /(4*y*h))
Cc = Cd/Cv
#results
print "Cd = %.2f"%(Cd)
print " Cv = %.3f"%(Cv)
print " Cc = %.2f"%(Cc)
# note : rounding off error.
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
rho2 = 13.6*10**3 #kg/m**3
d1 = 3.2 #m
d2 = 0.6 #m
#calculations
z1 = d1*rho/rho2
head = d2+z1
V = math.sqrt(2*g*head)
#results
print "Efflux velocity = %.2f m/s"%(V)
#The answer is a bit different due to rounding off error.
import math
from scipy.integrate import quad
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Cd = 0.6
d = 0.04 #m
h2 = 2.5 #m
#calculations
def fun(h):
return 1/(Cd*math.pi/4 *d**2 *math.sqrt(2*g)) *(4/math.sqrt(h) + math.sqrt(64-h**2))
t = quad(fun,0,h2)[0]
tmin = 31.1
#results
print "Time required = %.1f min"%(tmin)
import math
from scipy.integrate import quad
from sympy import solve,Symbol
#Initialization of variables
g = 981. #cm/s**2
Cd = 0.6
Q = 1200.
d = 3. #cm
l = 30. #cm
b = 30. #cm
dh = 5. #cm
h1 = 9. #cm
#calculations
def fun1(h):
return l*b/(Q - Cd*math.pi/4 *d**2 *math.sqrt(2*g*h))
#t = Symbol("t")
#ans = solve((Q - Cd*math.pi/4*d**2*math.sqrt(2*g*h)*d*t) - (30*30*dh))
#print ans
t = quad(fun1,h1,h1+dh)[0]
t = 126
#results
print "Time required = %d sec"%(t)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
pst = 25.2*10**3 #pressure - Pa
h = 2.5 #depth - m
#calculations
v = math.sqrt(2/rho *(pst - g*rho*h))
#results
print "velocity = %.2f m/s"%(v)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
vel = 800.*10**3 /3600
sm = 13.57
sl2 = 12.2 #specific weight of air
#calculations
sl = sl2/(g*rho)
y = vel**2 /(2*g*(sm/sl -1))
#results
print "length of manometer = %.f cm"%(y*100)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10**3 #kg/m**3
h = 3.5 #m
#calculations
v = math.sqrt(2*g*h)
#results
print "Speed necessary = %.1f m/s"%(v)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
sm = 13.6
s = 1.
Q = 1. #m**3/s
d2 = 0.25 #m
d1 = 0.5 #m
nu = 1e-6
#calculations
RN = Q*d1/(math.pi/4 *d1**2 *nu)
Cv = 0.98
yd = Q**2 *(1-d2**4 /d1**4)/(Cv**2 *math.pi/4 *d2**2 *2*g)
y = yd/(sm/s -1)
#results
print "Mercury manometer reading = %.2f cm"%(y*100)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
sm = 13.6
s = 1.
y = 0.12 #m
Cv = 0.984
d1 = 0.05 #m
d2 = 0.1 #m
nu = 1e-6
#calculations
Q = Cv*math.pi/4 *d1**2 *math.sqrt(2*g) /math.sqrt(1- (d1/d2)**4) *math.sqrt(y*(sm/s -1))
V1 = Q/(math.pi/4 *d2**2)
R = V1*d1/nu
#results
print "Since reynolds number is in required value Flow rate = %.4f m**3/s"%(Q)
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
P1 = 150.*10**3 #pressure - Pa
d0 = 3. #cm
d1 = 6. #diameter - cm
Cv = 0.98
Cc = 0.62
#calculations
P1g = P1/(g*rho)
Ar = (d0/d1)**4
A0 = math.pi/4 *(d0/100)**2
Q = Cv*Cc*A0 *math.sqrt(2*g) /math.sqrt(1- Cc**2 *Ar) *math.sqrt(P1g)
#results
print "Discharge = %.2f lps"%(Q*10**3)
import math
from numpy import *
#Initialization of variables
g = 9.81 #m/s**2
rho = 10**3 #kg/m**3
Cd = 0.6
L = 3 #m
H = 0.4 #m
V0 = array([0, 0.24, 0.275])
#calculations
Q = Cd*2/3 *math.sqrt(2*g) *(L-0.2*H) *((H+ V0**2 /(2*g) )**(3./2) - (V0**2 / (2*g))**(3./2))
#results
H = max(Q)
print "Flow rate = %.2f m**3/s"%(H)
import math
from sympy import Symbol, solve
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
d = 0.5 #m
vel = 1. #m/s
depth = 1.2 #m
Cd = 0.62
L = 1
#calculations
#H = Symbol("H")
#ans = solve(d*L/(Cd*2./3*L*H**(3./2)) - 1)
#print ans
H = (d*3./(2*Cd))**(2/3.)
hw = depth-H
#results
print "height of weir plate = %.2f m"%(hw)
# note : value of H is calculated wrongly. please check.
import math
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Q = 0.1*100**2 /(24.*3600) #m**3/s
Cd = 0.61
theta = 60. #degrees
#Calculations
Hd = Q/(Cd*8./15 *math.sqrt(2*g) *math.tan(math.radians(theta/2)))
H = Hd**(2./5)
#results
print "apex of weir must be set %.1f cm below the free surface"%(H*100)
#The answer in the textbook is wrong. Please verify it
import math
#Initialization of variables
Q1 = 0.93 #m**3/s
Q2 = 0.4 #m**3/s
H1 = 0.7 #m
H2 = 0.5 #m
#calculations
n = math.log(Q1/Q2) /math.log(H1/H2)
#results
print "Shape n = %.1f . hence shape of weir is triangular"%(n)
import math
#Initialization of variables
g = 981. #cm/s**2
H = 20. #cm
err = 3./100
#calculations
dH = err/2.5 *H
v0 = math.sqrt(2*g*dH)
#results
print "Required velocity = %.2f cm/s"%(v0)
#The answer is a bit different due to rounding off error
import math
from scipy.integrate import quad
#Initialization of variables
g = 9.81 #m/s**2
rho = 10.**3 #kg/m**3
Q = 12000. #m**2
f = 30. #h**2/3
t1 = 0.5 #m
t2 = 1.2 #m
#calculations
def fun2(h):
return Q/f *(1/h**(3./2))
t = quad(fun2,t1,t2)[0]
#results
print "Time = %d sec"%(t)
#The answer is different due to rounding off error