import math
#Given
D = 100.0; #F.S.L of distributory
wc = 99.90; #F.S.L of water course
L = 9.; #length of pipe
d = 20.; #diameter of pipe
f = 0.005; #coefficient of friction
g = 9.81; #acceleration due to gravity
# Calculations
H = D-wc; #working head
C = (d/((1.5*d/(400*f)+L)*f))**0.5/20;
A = math.pi*d**2/(4*10000);
q = C*A*(2*g*H)**0.5;
q = round(q*10000)/10000;
# Results
print "discharge through the outlet = %.5f cumec."%(q);
import math
#design a submerged pipe
#Given
q = 0.04; #discharge through outlet
D = 100.0; #F.S.L of distributing canal
wc = 99.90; #F.S.L of water course
dep = 1.1; #full supply depth distributing canal
C = 0.7; #average value of coefficient of discharge
g = 9.81; #acceleration due to gravity
# Calculations
H = D-wc; #available head
A = q/(C*(2*g*H)**0.5);
d = (4*A/math.pi)**0.5*100;
d = round(d*10)/10;
# Results
print "diameter of pipe required = %.2f cm."%(d);
print "use pipe of diameter 25 cm.";
import math
#design submerged pipe
#Given
q = 0.04; #discharge through outlet
D = 100.0; #F.S.L of distributing canal
wc = 99.90; #F.S.L of water course
dep = 1.1; #full supply depth distributing canal
f = 0.01; #coefficient of friction
g = 9.81; #acceleration due to gravity
L = 9.; #Length of pipe
H = D-wc; #working head
# Calculations
#first trial
#taking d = 22.8 cm
d = 22.8;
C = (d/((1.5*d/(400*f)+L)*f))**0.5/20;
A = q/(C*(2*g*H)**0.5);
d = (4*A/math.pi)**0.5*100;
#second trial
C = (d/((1.5*d/(400*f)+L)*f))**0.5/20;
A = q/(C*(2*g*H)**0.5);
d = (4*A/math.pi)**0.5*100;
d = round(d*100)/100;
# Results
print "diameter of pipe required = %.2f cm."%(d);
print "provide diameter of pipe as 25 cm.";
import math
#design an open flume outlet
#Given
Q = 0.06; #discharge
D = 0.85; #full supply depth
Hw = 15.; #available working head
Bt = 7.;
C = 1.6; #let us choose
# Calculations and Results
H = (Q*100/(C*Bt))**(2./3);
mh = 0.2*H; #minimum modular head
mh = round(mh*1000)/1000;
print "minimum modular head = %.2f m. < available working head.hemce,design is safe."%(mh);
o = H/D;
o = round(o*1000)/1000;
print "setting of outlet = %.2f. <0.9.hence,outlet will work as hyper propotional outlet."%(o);