import math
# Variables :
Do = 25.; #mm
Dc = 20.; #mm
H = 85.; #mm
x = 335.; #mm
y = 350.; #mm
# Calculations and Results
a = math.pi/4*Do**2; #m**2
ac = math.pi/4*Dc**2; #m**2
Cc = ac/a;
print "Coefficient of contraction : ",Cc
Cv = math.sqrt(x**2/4/H/y);
print "Coefficient of velocity : %.3f"%Cv
Cd = Cc*Cv;
print "Coefficient of discharge : %.2f"%Cd
Cr = (1/Cv**2-1);
print "Coefficient of Resistance : %.2f"%Cr
import math
# Variables :
Do = 0.125; #m
H = 10.5; #mm
Q = 6500.; #litres/minute
Q = Q/60./1000; #cumec
x = 6.; #m
y = 1.; #m
g = 9.81; #gravity consmath.tant
# Calculations and Results
a = math.pi/4*Do**2; #m**2
Qth = a*math.sqrt(2*g*H); #cumec
Cd = Q/Qth; #
print "Coefficient of discharge : %.2f"%Cd
Cv = math.sqrt(x**2/4/H/y);
print "Coefficient of velocity : %.3f"%Cv
Cc = Cd/Cv;
print "Coefficient of contraction : %.3f"%Cc
Cr = (1/Cv**2-1);
print "Coefficient of Resistance : %.3f"%Cr
import math
# Variables :
g = 9.81; #consmath.tant
h = 102.; #mm
H = 105.; #mm
# Calculations
Cv = math.sqrt(2*g*h)/math.sqrt(2*g*H);
# Results
print "Coefficient of velocity : %.2f"%Cv
import math
# Variables :
Q = 180./62; #litres/sec
Q = Q/1000; #cumec
Dc = 25./1000; #m
H = 1.9; #m
# Calculations
ac = math.pi/4*Dc**2; #m**2
g = 9.81; #consmath.tant
Cv = Q/math.sqrt(2*g*H)/ac;
# Results
print "Coefficient of velocity : %.2f"%Cv
import math
# Variables :
g = 9.81; #consmath.tant
d = 30./1000; #meter
wl = 2; #kgm
w1 = 148.6/60; #kg/sec
y = 1.65; #meter
H = 1.3; #meter
# Calculations and Results
Cv = wl/w1/y*math.sqrt(g)/math.sqrt(2*H);
print "Coefficient of velocity : %.3f"%Cv
Q = w1/1000; #Cumec
a = math.pi/4*d**2; #meter**2
Qth = a*math.sqrt(2*g*H); #Cumec
Cd = Q/Qth; #coeff. of discharge
print "Coefficient of discharge : %.3f"%Cd
Cc = Cd/Cv; #coeff. of contraction
print "Coefficient of contraction : %.3f"%Cc
#Answer in the book are not accurate.
import math
# Variables :
g = 9.81; #consmath.tant
a = 9*10**-4; #m**2
H = 3; #meter
x = 2.5; #meter
y = 54./100; #meter
Qactual = 250*10**-3/60; #Cumec
# Calculations and Results
Qth = a*math.sqrt(2*g*H); #Cumec
Cd = Qactual/Qth; #coeff. of discharge
print "Coefficient of discharge : %.3f"%Cd
Cv = math.sqrt(x**2)/math.sqrt(4*H*y); #velocity
print "Coefficient of velocity : %.3f"%Cv
Cc = Cd/Cv; #coeff. of contraction
print "Coefficient of contraction : %.3f"%Cc
#Answer in the book are not accurate.
import math
# Variables :
g = 9.81; #consmath.tant
d = 20./1000; #meter
a = math.pi/4*d**2; #m**2
H = 1; #meter
# Calculations
Qactual = 0.85*10**-3; #m**3/sec
v = math.sqrt(2*g*H); #m/sec
Qth = a*v; #Cumec
Cd = Qactual/Qth; #coeff. of discharge
# Results
print "Coefficient of discharge : %.2f"%Cd
import math
# Variables :
g = 9.81; #consmath.tant
d = 1.5; #meter
h = 1.; #meter
Volume = math.pi/4*d**2*h; #m**3
time = 25.; #sec
Qactual = Volume/time; #Cumec
H = 10.; #meter
do = 10./100; #meter
x = 4.3; #meter
y = 0.5; #meter
# Calculations and Results
ao = math.pi/4*do**2; #m**2
Qth = ao*math.sqrt(2*g*H); #cumec
Cd = Qactual/Qth; #Coeff. ofdischarge
print "Coefficient of discharge : %.3f"%Cd
Cv = math.sqrt(x**2)/math.sqrt(4*H*y); #Coefficient of velocity
print "Coefficient of velocity : %.3f"%Cv
Cc = Cd/Cv; #coeff. of contraction
print "Coefficient of contraction : %.2f"%Cc
Cr_dash = (1/Cv**2-1); #coeff. of Resistance
print "Coefficient. of Resistance : %.2f"%Cr_dash
import math
# Variables :
g = 9.81; #consmath.tant
do = 2.5/100; #meter
H = 75./100; #meter
x = 30./100; #meter
y = 3.2/100; #meter
# Calculations and Results
Qactual = 1.186*10**-3; #Cumec
ao = math.pi/4*do**2; #m**2
Qth = ao*math.sqrt(2*g*H); #cumec
Cd = Qactual/Qth; #Coeff. ofdischarge
print "Coefficient of discharge : %.2f"%Cd
Cv = math.sqrt(x**2)/math.sqrt(4*H*y); #Coefficient of velocity
print "Coefficient of velocity : %.4f"%Cv
Cc = Cd/Cv; #coeff. of contraction
print "Coefficient of contraction : %.3f"%Cc
Cr_dash = (1/Cv**2-1); #coeff. of Resistance
print "Coefficient. of Resistance : %.3f"%Cr_dash
#Answers in the book are not accurate.
import math
# Variables :
g = 9.81; #consmath.tant
H1 = 4-1; #meter
H2 = 4.; #meter
Cv1 = 0.9; #Coefficient of velocity
Cv2 = 0.9; #Coefficient of velocity
# Calculations
#Cv1 = Cv2 & x1 = x2 at meeting point
#x1/math.sqrt(4*H1*y1) = x2/math.sqrt(4*H2*y2)
y1BYy2 = H2/H1;
#y1 = 1+y2;
y2 = 1/(y1BYy2-1); #meter
y1 = y1BYy2*y2; #meter
x1 = Cv1*math.sqrt(4*H1*y1); #meter
# Results
print "Meeting point horizontal & vertical co-ordinates are(x1 & y1 in meter) : %.2f"%x1,y1
#Answer in the book are not accurate.
import math
# Variables :
g = 9.81; #consmath.tant
Cd = 0.6; #Coefficient of discharge
B = 1.3; #meter
H1 = 6-(1.8+1.5); #meter
H2 = 6-1.5; #meter
# Calculations
Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2)); #m**3/sec
# Results
print "Discharge through the orifice in m**3/sec : %.4f"%Q
import math
# Variables :
g = 9.81; #consmath.tant
Cd = 0.62; #Coefficient of discharge
B = 2.; #meter
H1 = 3.; #meter
H2 = 3+1.5; #meter
# Calculations
Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2)); #m**3/sec or cumec
# Results
print "Discharge through the orifice in cumec : %.3f"%Q
import math
# Variables :
g = 9.81; #consmath.tant
Cd = 0.6; #Coefficient of discharge
B = 1.6; #meter
H1 = 1500./1000; #meter
H2 = (1500.+1250)/1000; #meter
# Calculations and Results
Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2)); #m**3/sec or cumec
print "Discharge through the opening in cumec : %.3f"%Q
#For small opening
H = 1.5+1.25/2; #meter
D = 1.25; #meter
Qdash = Cd*(B*D)*math.sqrt(2*g*H); #cumec
Error = (Qdash-Q)/Q*100; #%
print "%% of error : %.3f"%Error
#Answer is wrong in the book.
import math
# Variables :
g = 9.81; #consmath.tant
Cd = 0.6; #Coefficient of discharge
B = 1600./1000; #meter
D = 1250./1000; #meter
ao = 1.6*1.25; #m**2
H1 = 2+1.25/2; #meter
H2 = 0.8+1.25/2; #meter
H = H1-H2; #meter
# Calculations
Q = Cd*ao*math.sqrt(2*g*H); #m**3/sec or Cumec
# Results
print "Discharge in Cumec : %.3f"%Q
#Answer is wrong in the book.
import math
# Variables :
g = 9.81; #consmath.tant
Cd = 0.6; #Coefficient of discharge
B = 1600./1000; #meter
D = 1250./1000; #meter
ao = 1.6*1.25; #m**2
H1 = 2+1.25; #meter
H2 = 2; #meter
H = H1-0.8; #meter
# Calculations
Q = 2./3*Cd*B*math.sqrt(2*g)*(H**(3./2)-H2**(3./2))+Cd*B*(H1-H)*math.sqrt(2*g*H); #m**3/sec or Cumec
# Results
print "Discharge through the orifice in Cumec : %.2f"%Q
import math
# Variables :
g = 9.81; #consmath.tant
d = 4; #meter
d0 = 0.5; #meter
H1 = 5; #meter
H2 = 2; #meter
Cd = 0.6; #Coefficient of discharge
ao = math.pi/4*d0**2; #m**2
A = math.pi/4*d**2; #m**2
# Calculations and Results
t = 2*A/Cd/ao/math.sqrt(2*g)*(math.sqrt(H1)-math.sqrt(H2))
print "Time taken to fall from 5m to 2m(in seconds) : %.1f"%t
#For emptying H2 = 0;
H2 = 0; #meter
t = 2*A/Cd/ao/math.sqrt(2*g)*(math.sqrt(H1)-math.sqrt(H2))
print "Time taken for completely emptying(in seconds) : %.1f"%t
import math
# Variables :
g = 9.81; #consmath.tant
d = 1.2; #meter
do = 50./1000; #meter
H = 3.; #meter
Cd = 0.6; #Coefficient of discharge
# Calculations
ao = math.pi/4*do**2; #m**2
A = math.pi/4*d**2; #m**2
t = 2*A*math.sqrt(H)/Cd/ao/math.sqrt(2*g); #sec
# Results
print "Time taken for emptying the tank is ",math.floor(t/60)," minute %.1f"%((t/60-math.floor(t/60))*60)," seconds."
import math
# Variables :
g = 9.81; #consmath.tant
A = 3.2; #m**2
a = 10*10**-4; #m**2
H1 = 5; #meter
H2 = 2.5; #meter
Cd = 0.6; #Coefficient of discharge
# Calculations
t = 2*A*(math.sqrt(H1)-math.sqrt(H2))/Cd/a/math.sqrt(2*g); #sec
# Results
print "Time taken is ",(math.floor(t/60))," minute ",round((t/60-math.floor(t/60))*60)," seconds."
import math
import datetime
# Variables :
g = 9.81; #consmath.tant
A = 3.2; #m**2
a = 10*10**-4; #m**2
H = 5; #meter
Cd = 0.6; #Coefficient of discharge
# Calculations
t = 2.*A*math.sqrt(H)/Cd/a/math.sqrt(2*g); #sec
# Results
print "Time taken is : in hours, minutes, seconds", datetime.timedelta(seconds=t)
#(math.floor(t/3600))," hour ",round((t/3600-math.floor(t/3600))*60)," minute ",(((t/3600-t/3600)*60-(t/3600-t/3600)*60)*60)," seconds."