In [1]:

```
import math
from numpy import linspace,zeros
#design an expansion transition for canal by Mitra's method
#Given
Lf = 16.; #length of flume
Bf = 9.; #width of throat
Bo = 15.; #width of canal
#width at any dismath.tance x from flumed section is given by
#Bx = Bo*Bf*Lf/(Lf*Bo-(Bo-Bf)x)
#on solving we get
#Bx = 2160/(240-6x)
x = linspace(2,16,8) #dismath.tance
print "width at any dismath.tance x from flumed section:";
Bx = zeros(8)
for i in range(8):
Bx[i] = 2160./(240-6*x[i]);
Bx[i] = round(Bx[i]*100)/100;
print '%.2f'%(Bx[i]);
```

In [2]:

```
import math
from numpy import linspace,zeros
#design an expansion transition for canal by Chaturvedi's method
#Given;
Lf = 16.; #length of flume
Bf = 9.; #width of throat
Bo = 15.; #width of canal
x = linspace(2,16,8); #dismath.tance
#dismath.tance x is related as x = Lf*Bo**(2/3)(1-(Bf/Bx)**1.5)/(Bo**1.5-Bf**1.5)
#on solving we get
#(Bf/Bx)**1.5 = 1-(x/29.893) (relation is misprinted in book)
#let (Bf/Bx)**1.5 = r
r = zeros(8)
R = zeros(8)
Bx = zeros(8)
print "width at any dismath.tance x from flumed section:";
for i in range(8):
r[i] = 1-(x[i]/29.893); #Bf/Bx**(1.5)
R[i] = r[i]**(2./3); #Bf/Bx
Bx[i] = Bf/R[i];
Bx[i] = round(Bx[i]*100)/100;
print "%.2f."%(Bx[i]);
```

In [4]:

```
import math
from numpy import linspace,zeros,zeros_like
#design a syphon aqueduct
#Given
Q = 25.; #design discharge of canal
B = 20.; #bed width of canal
D = 1.5; #depth of water in canal
bl = 160.; #bed level of canal
hfq = 400.; #high flood discharge of drainage
hfl = 160.5; #high flood level of drainage
bl_drain = 158.; #bed level of drainage
gl = 160.; #general ground level
#demath.sing of drainage water-way
P = 4.75*(hfq)**0.5; #laecey P-Q formula
print "design of drainage water-way:wetted perimeter of river = %i m.provide 13 spans \
of 6 m each,separated by 12 piers each of 1.25 m thick."%(P);
t = 78.+15;
print "total length of water-way = %i m."%(t);
v = 2; #velocity through syphon
hb = hfq/(78*v);
ac = hfq/(6*2.5*1.3); #calculation is wrong in book
hb = round(hb*100)/100;
ac = round(ac*100)/100;
print "height of barrels = %.2f m.provide recmath.tangular barrels 6 m wide and 2.5 m high.actual \
velocity through barrels = %.2f m/sec."%(hb,ac);
#design of canal waterway
print "design of canal waterway:Type 3 aqueduct is adopted.";
l1 = B-10;
l2 = (20-10)*3/2;
print "providing a splay 2:1 in expansion,length of contraction transition = %i m.providing\
a splay of 3:1 in expansion,length of expansion transition = %i m."%(l1,l2);
print 'In transition side slopes are warped from original slope of 1.5:1 to vertical.';
#design of levels of different sectionn
print "design of levels of different sectionn:at section 4-4:";
A = (B+1.5*D); #area
V = Q/A; #velocity of flow
vh = V**2/(2*9.81); #velocity head
ws = gl+D; #R.L of water surface
tel = ws+vh;
tel = round(tel*1000)/1000;
print "R.L of T.E.L = %.2f m. at section 3-3:"%(tel);
A = 10*D; #area of trough
V = Q/A; #velocity
vh1 = V**2/(2*9.81); #velocity head
le = 0.3*(vh1-vh); #loss of head in expansion from section 3-3 to 4-4
tel = tel+le;
rlw = tel-vh1;
rlb = rlw-D;
tel = round(tel*1000)/1000;
rlb = round(rlb*1000)/1000;
print "elevation of T.E.L = %.2f m.R.L of bed to maintain consmath.tant water depth = %.2f m."%(tel,rlb);
#at section 2-2
R = A/P;
N = 0.016;
S = V**2*N**2/R**(4./3); #from manning's formula
L = 93; #length of trough
hl = L*S; #head loss
tel = tel+hl;
rlw = tel-vh1;
rlb = rlw-D;
tel = round(tel*1000)/1000;
rlb = round(rlb*1000)/1000;
print "at section 2-2:R.L of T.E.L = %.2f m.R.L of bed to maintain consmath.tant water depth = %.2f m."%(tel,rlb);
#at section 1-1
hl = 0.2*(vh1-vh); #loss of hed in contraction transition
tel = tel+hl;
rlw = tel-vh;
rlb = tel-D;
tel = round(tel*1000)/1000;
rlb = round(rlb*1000)/1000;
print "at section 1-1:R.L of T.E.L = %.2f m.R.L of bed to maintain consmath.tant water depth = %.2f m."%(tel,rlb);
#design of contraction transition
#it is designed on the basis of chaturvedi's formula
Bo = 20.;
Bf = 10.;
L = 10.;
#from chaturvedi formula we get relation between x and Bx as: x = 15.45(1-(10/Bx)**1.5);
Bx = linspace(10,20,11)
print "design of contraction transition on the basis of chaturvedi formula:\nBx x";
x = zeros_like(Bx)
for i in range(11):
x[i] = 15.45*(1-(10/Bx[i])**1.5);
x[i] = round(x[i]*100)/100;
print "%i %.2f"%(Bx[i],x[i]);
#design of expansion transition on the basis of chaturvedi formula
L = 15.;
Bf = 10.;Bo = 20.;
#from chaturvedi formula we get relation between x and Bx as: x = 23.15(1-(10/Bx)**1.5);
print "design of expansion transition on the basis of chaturvedi formula:\nBx x";
for i in range(11):
x[i] = 23.15*(1-(10/Bx[i])**1.5);
x[i] = round(x[i]*100)/100;
print "%i %.2f"%(Bx[i],x[i]);
#design of trough
print "design of the trough:";
print "flumed water way of canal = 10 m.trough carrying canal will divide into two \
compartments each 5 m wide an dseparated by 0.3 m thick partiions.heigth of trough will be \
= 2 m.trough iss constructed umath.sing monolithic reinforced concrete.the outer and inner walls\
ca be kept 0.4 m thick.thus,outer width of trough = 11.1 m.";
#head loss through syphon barrels
V = 2.05; #velocity through barrels
f1 = 0.505; #coefficient of loss of head at entry
a = 0.00316;
b = 0.030;
R = (6*2.5)/(2*(6+2.5));
f2 = a*(1+b/R);
L = 11.1; #length of barrel
h = (1+f1+f2*L/R)*V**2/(2*9.81);
hfl_up = hfl+h;
h = round(h*1000)/1000;
hfl_up = round(hfl_up*1000)/1000;
print "head loss through syphon barrels = %.2f m.upstream H.F.L = %.2f m."%(h,hfl_up)
#uplift pressure on the roof
bt = gl-0.4; #R.L of bottom of the trough
hl = 0.505*V**2/(2*9.81);
u = hfl_up-hl-159.6;
up = u*9.81;
print "uplift pressure on the roof = %.2f kN/square m.trough slab is 0.4 m thick and exert a downward load of 9.42 kN."%(up);
print "th ebalance of the uplift pressure has to be resisted by bending action of \
trough slab.so,reinforcement has to be provided at the top of the slab.";
#uplift on the floor of the barrel and its design
#(a) static head
print "uplift on the floor of the barrel and its design:a static head:";
bf = bt-2.5; #R.L of barrel floor
t = 0.8; #tentative thickness of floor
bot = bf-t;
static = bl_drain-bot;
static = round(static*100)/100;
print "static uplift on the floor = %.2f m."%(static);
#(b) seepage head
L = 10.; #length of u/s transition
bs = 3.; #half the barrel span
df = 11.; #end drainage floor
tcl = 24.; #total creep length
tsh = 161.5-bl_drain; #total seepage head
rs = tsh*(1-13/tcl); #residual seepage at B
tu = (static+rs)*9.81;
tu = round(tu*100)/100;
print "b) seepage head:total uplift = %.2f kN/square m.provide thickness of floor 0.8 m"%(tu);
bending = tu-17.58;
bending = round(bending*100)/100;
print "uplift to be resisted by bending action of floor = %.2f kN/square m."%(bending);
#design of cut-off and protection works for drainage floor
print "design of cut-off and protection works for drainage floor:";
Q = 400;f = 1;
R = 0.47*(Q/f)**(1/3);
d_up = 1.5*R; #depth of u/s cut-off
bot_up = hfl_up-d_up; #R.L of bottom of u/s cut-off
d_down = 1.5*R; #depth of d/s cut-off
bot_down = hfl-d_down; #R.L of bottom of d/s cut-off
l_down = 2.5*(bl_drain-bot_down);
l_down1 = 2*(bl_drain-bot_up);
bot_up = round(bot_up*100)/100;
bot_down = round(bot_down*100)/100;
l_down = round(l_down);
l_down1 = round(l_down1);
print "R.L of bottom of u/s cut-off = %.2f m.R.L of bottom of d/s cut-off = %.2f m."%(bot_up,bot_down);
print "length of d/s protection consisting of 40 cm brick pritching = %.2f m.pitching is \
supported by toe wall 0.4 m wide and 1.5 m deep at its d/s end.length of d/s protection consisting\
of 0.4 cm brick pritching = %.2f m.pitching is supported by toe wall 0.4 m wide and\
1 m deep at its u/s end."%(l_down,l_down1);
```