In [3]:

```
import math
#uplift presuures and thickness of floor at 6m, 12m and 18m from u/s
#Given
rho = 2.24; #relative density of material
gamma_w = 9.81; #unit weigth of water
L = 22.; #total length
lc = (2.*6)+L+(2*8); #length of creep
hg = 4./lc; #hydraulic gradient
print "avearge hydraulic gradient = %.2f."%(hg);
#at 6 m from u/s
x = 6.;
lg = (6.*2)+x;
h1 = 4.*(1-lg/50); #unbalanced head
up = gamma_w*h1;
t = 4.*h1/(3*(rho-1));
up = round(up*100)/100;
t = round(t*100)/100;
print "uplift at 6 m from u/s = %.2f kN/square metre."%(up);
print "thickness at 6 m from u/s = %.2f m."%(t);
#at 12 m from u/s
x = 12.;
lg = (6.*2)+x;
h1 = 4.*(1-lg/50); #unbalanced head
up = gamma_w*h1;
t = 4.*h1/(3*(rho-1));
up = round(up*100)/100;
t = round(t*100)/100;
print "uplift at 12 m from u/s = %.2f kN/square metre."%(up);
print "thickness at 12 m from u/s = %.2f m."%(t);
#at 18m from u/s
x = 18.;
lg = (6.*2)+x;
h1 = 4.*(1-lg/50); #unbalanced head
up = gamma_w*h1;
t = 4*h1/(3*(rho-1));
up = round(up*10)/10;
t = round(t*100)/100;
print "uplift at 18 m from u/s = %.2f kN/square metre."%(up);
print "thickness at 18 m from u/s = %.2f m."%(t);
```

In [4]:

```
import math
#check whether section is safe against overturning and piping
#Given
b = 54.; #width of section
D1D2 = 16; #dismath.tance between points D1 and D2
D2D3 = 37; #dismath.tance between points D2 and D3
#first pipe line
#taking data from figure
d = 105-97;
b1 = 0.5;
alpha = b/d;
#from the curves we get
fic1 = 0.665;
fid1 = 0.76;
fie1 = 1;
t = 105-104; #floor thickness
corec = (fid1-fic1)*100*t/d; #correction for floor thickness
#for pile no. 2
D = 104-97;
d = 104-97;
bdash = 16;
C = 19*(D/bdash)**0.5*(d+D)/b; #correction for pile no. 2
fic1 = fic1*100+corec+C; #corrected pressures
#intermedite pipe line
d = 105-97;
b1 = 16.5;
alpha = b/d;
r = b1/b; #ratio b1/b
#from the curves we get
fic2 = 0.52;
fie2 = 0.725;
fid2 = 0.615;
corec_c1 = (fid2-fic2)*100*t/d;
corec_e1 = (fie2-fid2)*100/d;
#for pile no. 1
C1 = C;
d = 104-97;
bdash = 37;
D = 104-95;
C2 = 19*(D/bdash)**0.5*(d+D)/b;
#correction due to slope
corec_e2 = 3.3; #from table 12.4
#correction is negative due to upwrd slope
l = 4; #horizontal length of slope
corec_c2 = corec_e2*l/bdash;
fie2 = fie2*100-corec_e1-corec_e2;
fic2 = fic2*100+corec_c1+C2-corec_c2;
#pile no. 3 at d/s end
d = 103.5-95;
alpha_ = d/b;
#for curves
fie3 = 0.35;fid3 = 0.242;
corec_t = (fie3-fid3)*100*(103.5-102)/d;
#correction for interference at pile no. 2
d = 102-95;
D = 102-97;
C3 = 19*(D/bdash)**0.5*(d+D)/b;
fie3 = fie3*100-corec_t-C3;
point = ['C1', 'C2' ,'E2' ,'E3']; #Point
P = [fic1 ,fic2 ,fie2 ,fie3]; #pressure percent
P_ = [3.55 ,2.78, 3.39, 1.58]; #pressure head
print "Points Pressure percent Pressure head";
for i in range(4):
P[i] = round(P[i]*10)/10;
print "%s %.2f %.2f"%(point[i],P[i],P_[i]);
#check for floor thickness
Pa = P_[1]-((P_[1]-P_[3])*6.5/37);
Pb = P_[1]-((P_[1]-P_[3])*24/37);
Pc = P_[1]-((P_[1]-P_[3])*30/37);
rho = 2.24; #specific gravity of concrete
ta = Pa/(rho-1);
tb = Pb/(rho-1);
tc = Pc/(rho-1);
ta = round(ta*100)/100;
tb = round(tb*100)/100;
tc = round(tc*100)/100;
print "Thickness required at A = %.2f m."%(ta);
print "Thickness required at B = %.2f m."%(tb);
print "Thickness required at C = %.2f m."%(tc);
t = 103.5-102;
print "Thickness provided = %.2f m."%(t);
print "Floor thickness at B and C are adequate";
#exit gradient
H = 108.5-103.5; #seepage head
d = 103.5-95; #depth cut-off
#from exit gradient curve
alpha = 6.35;
lambda1 = (1+(1+alpha**2)**0.5)/2;
Ge = H/(d*math.pi*lambda1**0.5);
print "exit gradient = %.2f."%(Ge);
print " it is less than permissible exit gradient < 1/6Hence safe..";
```

In [6]:

```
import math
from numpy import roots,ceil
#design a vertical drop weir on Bligh's theory
#test floor by Khosla's theory
#Given
Q = 2800; #maximum flood discharge
hfl = 285; #H.F.L before construction
hw = 278; #minimum water level
fsl = 284; #F.S.L of canal
c = 12; #coefficient of creep
flux = 1; #allowable afflux
Ge = 1./6; #permissible exit gradient
rho = 2.24; #specific gravity of concrete
#Hydraulic calculation
L = 4.75*Q**0.5;
q = Q/L;
q = round(q*10)/10;
print "Hydraulic calculation:";
print "discharge per unit width of river = %.2f cumecs."%(q);
f = 1;
R = 1.35*(q**2/f)**(1./3);
R = round(R*100)/100;
print "regime scour depth = %.2f m."%(R);
V = q/R; #regime velocity
vh = V**2/(2*9.81); #velocity head
l_down = hfl+vh;
l_up = l_down+flux;
hfl_up = l_up-vh;
hfl_down = hfl-0.5;
hfl_down = round(hfl_down*100)/100;
print "actual d/s H.F.L allowing 0.5 m for retrogation = %.2f m."%(hfl_down);
K = (q/1.7)**(2./3);
cl = l_up-K; #crest level
cl = round(cl*100)/100;
print "crest level = %.2f m."%(cl);
pl = fsl+0.5; #pond level
s = hfl_down-cl; #heigth of shutter
print "heigth of shutter = %.2f m."%(s);
rl_up_pile = hfl_up-1.5*R; #R.L of bottom u/s pile
d_up_cut = hw-276; #depth of upstream cut-off
print "depth of upstream cut-off = %.2f m."%(d_up_cut);
print " provide concrete cut off 2 m depth.";
rl_bot_ds = hfl_down-2*R;
Hs = hfl_down-hw; #seepage head
Hc = cl-hw; #heigth of crest
print "R.L of gates crest = %.2f m."%(Hs);
print "Heigth of crest = %.2f m."%(Hc);
#design of weir wall
d = hfl_up-cl;
a = d/(rho)**0.5;
a = 3*d/(2*rho); #from sliding consideration
a = s+1; #from practical consieration
a = a+1;
print "design of weir wall:"
print "provide top width of %i m."%(a);
Mo = 9.81*Hs**3/6; #overtirning moment
#equating the moment of resismath.tance to overturning moment and putting the values we get
#y = poly([-1.084,0.020,0.039],'x','c');
y = [0.039,0.020,-1.084]
b = roots(y)[1];
#we get b = - 5.5347261 and 5.0219056
#taking
b = 5;
#when weir is submerged
C = 0.58;
d = (q**2/((2*C/3)**2*2*9.81))**(1./3);
Mo = 9.81*d*Hc**2/2;
#from equation of moment of resistence we get
y = [1,3,-77.55]
b = ceil(roots(y)[1]); #we get b = - 10.433085 and 7.4330846
print "bottom width = %i m."%(b);
#design of impervious and pervious aprons
C = 12;
L = C*Hs;
print "design of impervious and pervious aprons:";
print "total creep length = %i m."%(L);
l1 = 2.21*C*(Hs/13)**0.5;
l1_ = l1+1;
print "length of downstream impervious apron = %i m."%(l1_);
d1 = hw-276;
d2 = hw-271;
l2 = L-l1-(b+2*d1+2*d2);
print "length of upstream impervious apron = %i m."%(l2);
l3 = 18*C*(Hs*q/975)**0.5;
print "total length of d/s apron = %i m."%(l3); #calculation is wrong in book
l = l3-l1;
le = l/2;
le = round(le*100)/100;
print 'provide filter of length %.2f m. and launching apron of length %.2f m.'%(le,le);
t = d2*10**0.5/le;
print "thickness of launching apron in horizontal position = %.2f m."%(t);
print "provide launching apron of thickness 1.5 m.";
T = 2*d1;
V = d1*10**0.5;
ta = V/T;
ta = round(ta*10)/10;
print "thickness of apron in horizontal position = %.2f m."%(ta);
Hr = Hs-Hs*(4+33+8)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print 'provide thickness of %.2f m from d/s of weir wall to point 6 m from it.'%(t);
Hr = Hs-Hs*(4+33+8+6)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print "provide thickness of %.2f m from 6 m to 12 m from d/s end of weir wall."%(t);
Hr = Hs-Hs*(4+33+8+12)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print "provide thickness of %.2f m for rest of length of weir floor."%(t);
#check by khosla's theory
b = 33+8+19; #total horizontal length of impervious floor
d = 7; #depth of downstream pile
alpha = b/d;
n = 0.14; #n = 1/math.pi*(lambda)**0.5;
Ge = Hs*n/d;
print "check by Khosla theory:";
print "exit gradient = %.2f. < 1/6 hence safe"%(Ge);
alpha_ = d/b;
fic1 = 0.83;fid1 = 0.88;
corec_c1 = (fid1-fic1)*100/2;
bdash = b;
d = 2;D = 7;
C1 = 19*(D/bdash)**0.5*(d+D)/b;
fic1 = fic1*100+corec_c1+C1;
Pc = Hs*fic1/100; #pressure head at C
alpha_ = d/b;
fie2 = 0.31;fid2 = 0.21;
corec_e1 = (fie2-fid2)*1.7*100/7;
bdash = b;
d = 7;D = 2;
C1 = 19*(D/bdash)**0.5*(d+D)/b;
fie2 = fie2*100-corec_e1-C1; #in book 3.53 value is wrong
Pe = Hs*fie2/100; #pressue head at E
#assuming linear variation of pressure for intermediate points
Pa = Pc-(Pc-Pe)*(33+8)/b;
t = Pa/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at d/s of weir wall = %.2f m."%(Pa);
print "thickness at d/s of weir wall = %.2f m. < thickness by Bligh theory;hence safe."%(t);
Pb = Pc-(Pc-Pe)*(33+8+6)/b;
t = Pb/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at 6 m from d/s of weir wall = %.2f m."%(Pb);
print "thickness at 6m from d/s of weir wall = %.2f m. < thickness by Bligh theory;hence safe."%(t);
Pc = Pc-(Pc-Pe)*(33+8+12)/b;
t = Pc/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at 12 m from d/s of weir wall = %.2f m."%(Pc);
print "thickness at 12m from d/s of weir wall = %.2f m. > thickness by Bligh theory;hence unsafe."%(t);
print "hence increase th ethickness to 1.9 m for a length of 7 m of impervious floor.";
```

In [7]:

```
import math
#design a slopeing glacis
#Given
q = 10; #maximum discharge intensity on weir crest
hfl = 255; #H.F.L before construction of weir
rb = 249.5; #R.L of river bed
pl = 254; #pond level
s = 1; #heigth of crest shutter
dhw = 251.5; #anticipated downstream water level in river when water is dischrging with pond level upstream
br = 0.5; #bed retrogression
f = 0.9; #Laecey silt factor
Ge = 1./7; #permissible exit gradient
flux = 1; #permissible afflux
cl = pl-s; #crest level
print "crest level = %.2f m."%(cl);
K = (q/1.7)**(2./3);
tel_up = cl+K;
tel_up = round(tel_up*100)/100;
print "elevation of u/s T.E.L = %.2f m."%(tel_up);
R = 1.35*(q**2/f)**(1./3);
R = round(R*10)/10;
print "regime scour depth = %.2f m."%(R);
V = q/R; #regime velocity
vh = V**2/(2*9.81); #velocity head
hfl_up = tel_up-vh;
tel_down = hfl+vh;
flux = hfl_up-hfl;
flux = round(flux*100)/100;
print "afflux = %.2f. which is near to permissible"%(flux);
hfl_down = hfl-br; #downstream H.F.L after retrogression
tel_down = tel_down-br; #downstream T.F.L after retrogression
Hl = tel_up-tel_down; #loss of head in flood
Hl = round(Hl*100)/100;
print "loss of head in at high flood = %.2f m."%(Hl);
K = pl-cl; #head over crest
q_ = 1.7*(K)**1.5;
Hl_ = pl-dhw; #loss of head
print "loss of head = %.2f m."%(Hl_);
Ef2 = 4.3;
Ef2_ = 1.7; #from Blench curve
jump = tel_down-Ef2;
jump_ = 251.5-Ef2_; #level at which jump will form
Ef1 = Ef2+Hl;
Ef1_ = Ef2_+Hl_;
D1 = 1.03;
D1_ = 0.15;
D2 = 3.96;D2_ = 1.68;
hj = D2-D1;
hj_ = D2_-D1_; #heigth of jump
concrete = 5*hj;
concrete_ = 5*hj_; #length of concrete floor
print "Hydraulic jump calculation:";
print "heigth of jump for high flood condition = %.2f m."%(hj);
print "length of concrete floor for high flood condition = %.2f m."%(concrete);
print "heigth of jump for pond level condition = %.2f m."%(hj_);
print "length of concrete floor for high pond level condition = %.2f m."%(concrete_);
cw = 2; #crets width
us = 2; #upstream slope
ds = 3; #downstream slope
l = 15;
print " upstream slope of glacis = %i:1."%(us);
print "downstream slope of glacis = %i:1."%(ds);
print "horizontal length of floor beyond the toe = %i m.."%(l);
R = 6.5;
sh_up = hfl_up-1.5*R;
sh_down = hfl_down-2*R;
sh_up = round(sh_up*100)/100;
print "R.L of bottom of upstream sheet pile = %.2f m."%(sh_up);
print "R.L of downstream sheet pile = %.2f m."%(sh_down);
print "provide intermediate sheet pile at d/s toe of glacis.";
Hs = pl-249.6; #maximum percolation head
d = 249.6-sh_down; #depth of d/s cut-off
n = Ge*d/Hs; #n = 1/(math.pi*lambda**0.5);
#from khosla exit gradient curve
alpha = 1.5;
b = alpha*d;
print "length of impervious floor = %.2f m."%(b);
fl = (2*(253-249.5))+2+(3*(253-249.6))+15;
us = 36-fl;
print "length of floor already provide = %.2f m."%(fl);
print "which is more than required from permissible exit gradient.no upstream floor is required.";
print "provide %.2f m upstream floor so that total length becomes 36 m."%(us);
alpha_1 = 0.089;
alpha_2 = 0.225; #alpha_ = 1/alpha
b1 = 21;
alpha = 4.44;
print "Pressure percent at points:";
point = ['C1', 'D1' ,'C2' ,'E2' ,'D2' ,'D3' ,'E3'];
bc = [72 ,82 ,31.5 ,45.5 ,58.5 ,29 ,44];
crt = [3.1, 0, 3.5, 0, -3.2, 0, 0, -3.6];
crs = [0 ,0, 0, 0, 2.3, 0, 0, 0];
cri = [3.7, 0, 6.4, 0, -2.4, 0, -6.4];
after = [0,0,0,0,0,0,0]
print "Points Before correction After correction";
for i in range(7):
after[i] = bc[i]+crt[i]+crs[i]+cri[i];
print "%s %i %.2f"%(point[i],bc[i],after[i]);
Hs = 254-249.6; #no flow condition
Hs_ = 256.13-254.5; #high flood condition
Hs__ = 254-251.5; #flow at pond level
print "elevation of subsoil H.G above datum:";
print "no flow condition:";
fie1 = 1*Hs;
fid1 = 0.82*Hs;
fic1 = 0.788*Hs;
fie2 = 0.552*Hs;
fid2 = 0.455*Hs;
fic2 = 0.414*Hs;
fie3 = 0.34*Hs;
fid3 = 0.29*Hs;
fic3 = 0;
fie1 = round(fie1*100)/100;fid1 = round(fid1*100)/100;fic1 = round(fic1*100)/100;
fie2 = round(fie2*100)/100;fid2 = round(fid2*100)/100;fic2 = round(fic2*100)/100;
fie3 = round(fie3*100)/100;fid3 = round(fid3*100)/100;fic3 = round(fic3*100)/100;
print "fie1 = %.2f.;fid1 = %.2f.;fic1 = %.2f.fie2 = %.2f.;fid2 = %.2f.;fic2 = %.2f.fie3 = %.2f.;\
fid3 = %.2f.;fic3 = %.2f."%(fie1,fid1,fic1,fie2,fid2,fic2,fie3,fid3,fic3);
print "high flood condition:";
fie1 = 1*Hs_;
fid1 = 0.82*Hs_;
fic1 = 0.788*Hs_;
fie2 = 0.552*Hs_;
fid2 = 0.455*Hs_;
fic2 = 0.414*Hs_;
fie3 = 0.34*Hs_;
fid3 = 0.29*Hs_;
fic3 = 0;
fie1 = round(fie1*100)/100;fid1 = round(fid1*100)/100;fic1 = round(fic1*100)/100;
fie2 = round(fie2*100)/100;fid2 = round(fid2*100)/100;fic2 = round(fic2*100)/100;
fie3 = round(fie3*100)/100;fid3 = round(fid3*100)/100;fic3 = round(fic3*100)/100;
print "fie1 = %.2f.;fid1 = %.2f.;fic1 = %.2f.fie2 = %.2f.;fid2 = %.2f.;fic2 = %.2f.fie3 = %.2f.;\
fid3 = %.2f.;fic3 = %.2f."%(fie1,fid1,fic1,fie2,fid2,fic2,fie3,fid3,fic3);
print "flow at pond level:";
fie1 = 1*Hs__;
fid1 = 0.82*Hs__;
fic1 = 0.788*Hs__;
fie2 = 0.552*Hs__;
fid2 = 0.455*Hs__;
fic2 = 0.414*Hs__;
fie3 = 0.34*Hs__;
fid3 = 0.29*Hs__;
fic3 = 0;
fie1 = round(fie1*100)/100;fid1 = round(fid1*100)/100;fic1 = round(fic1*100)/100;
fie2 = round(fie2*100)/100;fid2 = round(fid2*100)/100;fic2 = round(fic2*100)/100;
fie3 = round(fie3*100)/100;fid3 = round(fid3*100)/100;fic3 = round(fic3*100)/100;
print "fie1 = %.2f.;fid1 = %.2f.;fic1 = %.2f.fie2 = %.2f.;fid2 = %.2f.;fic2 = %.2f.fie3 = %.2f.;\
fid3 = %.2f.;fic3 = %.2f."%(fie1,fid1,fic1,fie2,fid2,fic2,fie3,fid3,fic3);
print "Prejump profile:";
print "high flood condition:";
dist = [3 ,6, 8.4]; #dismath.tance
glacis = [252, 251, 250.32]; #R.L of glacis
D1 = [1.3 ,1.15, 1.03];
Ef1 = [0,0,0]
print "Ef1 D1";
for i in range(3):
Ef1[i] = 256.25-glacis[i];
print "%.2f %.2f"%(Ef1[i],D1[i]);
print "pond level flow:";
dist = [3, 6, 9, 9.6]; #dismath.tance
glacis = [252, 251, 250, 249.9]; #R.Lof glacis
D1 = [0.31, 0.23, 0.16, 0.15];
Ef1 = [0,0,0,0]
print "Ef1 D1";
for i in range(4):
Ef1[i] = 254-glacis[i];
print "%.2f %.2f"%(Ef1[i],D1[i]);
rho = 2.24;
Uf = 4; #unbalanced head for high flood condtion
Us = 2.56; #unbalanced static head
Hf = 2*Uf/3;
t = Hf/(rho-1);
t = round(t*10)/10;
print "floor thickness at the point of formation of hydraulic jump = %.2f m."%(t);
Uf = 2.9; #unbalanced head for high flood condtion
Us = 2.2; #unbalanced static head
Hf = 2*Uf/3;
t = Us/(rho-1);
t = round(t*10)/10;
print "floor thickness at the point of formation of hydraulic jump at the pond level condition = %.2f m."%(t);
P = 1.5; #pressure head at d/s end of floor
t = P/(rho-1);
t = round(t*10)/10;
print "floor thickness at downstream side of sloping glacis = %.2f m."%(t);
D = rb-sh_up; #depth of u/s scour hole above bed level
a = 1.5*D;
a = round(a*10)/10;
print "minimum length of upstream launching apron = %.2f m."%(a);
print "provide 1.5 m thick apron for length of 5 m.";
D = 249.6-241.5;
a = 1.5*D;
print "minimum length of downstream launching apron = %.2f m."%(a);
print "provide 1.5 m thick apron for length of 12 m.";
```

In [8]:

```
import math
#Given
b = 16; #total length of floor
d = 5; #depth of downstream pile
D = 4; #depth of upstream pile
H = 2.5; #head created by weir
#pressure at E
alpha = b/d;
lambda1 = (1+(1+alpha**2)**0.5)/2;
fie = math.acos((lambda1-2)/lambda1)/math.pi;
C = 19*(D/b)**0.5*((d+D)/b);
fie = fie*100-C;
P = H*fie/100;
P = round(P*1000)/1000;
print "Pressure at E = %.2f m."%(P);
#pressure at C1
alpha = b/D;
lambda1 = (1+(1+alpha**2)**0.5)/2;
fie = math.acos((lambda1-2)/lambda1)/math.pi;
fic = 1-fie; #by principle reversibility of flow
C = 19*(d/b)**0.5*((d+D)/b);
fic = fic*100+C;
P = fic*H/100;
P = round(P*1000)/1000;
print " Pressure at C = %.2f m."%(P);
```

In [9]:

```
import math
#Given
b = 13; #length of floor
d = 2; #depth of downstream wall
D = 1.5; #depth of upstream cut-off
rho = 2.24; #relative density
H = 1.5;
#at junction of d/s cut-off with floor
alpha = b/d;
lambda1 = (1+(1+alpha**2)**0.5)/2;
fie = math.acos((lambda1-2)/lambda1)/math.pi;
C = 19*(D/b)**0.5*((d+D)/b);
fie = fie*100-C;
P = H*fie/100;
t = P/(rho-1);
t = round(t*10)/10;
print "floor thickness at junction of d/s cut-off with floor = %.2f m."%(t);
#at junction of u/s cut-off with floor
alpha = b/D;
lambda11 = (1+(1+alpha**2)**0.5)/2;
fie = math.acos((lambda11-2)/lambda11)/math.pi;
fic = 1-fie; #by principle reversibility of flow
C = 19*(D/b)**0.5*((d+D)/b);
fiec = fic*100+C;
P = fiec*H/100;
t = 0.3; #this the uplift will be counter balanced by downward weigth of impounded water
print "floor thickness at junction of u/s cut-off with floor = %.2f m."%(t);
#at mid-length
P = (1.08+0.489)/2; #assuming linear variation
t = P/(rho-1);
t = round(t*100)/100;
print "floor thickness at mid-length = %.2f m."%(t);
#exit gradient
G = H/(d*math.pi*(lambda1)**0.5);
G = round(G*1000)/1000;
#math.since G<0.18
print " G = %.2f. <0.18./nfloor is safe against failure by piping."%(G);
```

In [10]:

```
import math
#Given
B = 30; #stream width
D = 3; #stream depth
V = 1.25; #mean velocity
Cd = 0.95; #discharge coefficient
Q = B*D*V;
# Calculations
C = 2*Cd*(2*9.81)**0.5/3;
x = 4-(Q/(C*B))**(2./3);
x = round(x*1000)/1000;
# Results
print "heigth of weir to be built = %.2f m."%(x);
```

In [11]:

```
import math
#Given
b = 50.; #length of floor
d = 8.; #depth of downstream pile
D = 8.; #depth of upstream pile
H = 5.; #effective head
tu = 1.; #floor thickness at upstream
td = 2.; #floor thickness at downstream
# Calculations and Results
#downstream cut-off
alpha = b/d;
lambda1 = (1+(1+alpha**2)**0.5)/2;
fie = math.acos((lambda1-2)/lambda1)/math.pi;
fid = math.acos((lambda1-1)/lambda1)/math.pi;
Ct = (fie-fid)*td/d;
C = 19*(D/b)**0.5*((d+D)/b);
fie = fie*100-C-Ct*100;
P = H*fie/100;
P = round(P*100)/100;
print "Pressure at downstream cut-off = %.2f m."%(P);
#upstream cut-off
fie = math.acos((lambda1-2)/lambda1)/math.pi;
fid = math.acos((lambda1-1)/lambda1)/math.pi;
fic1 = 1-fie;
fid1 = 1-fid;
Ct = (fic1-fid1)*td/d;
C = -19*(D/b)**0.5*((d+D)/b);
fic1 = fic1*100-C-Ct*100;
P = H*fic1/100;
P = round(P*100)/100;
print "Pressure at upstream cut-off = %.2f m."%(P);
G = H/(d*math.pi*(lambda1)**0.5);
print "Exit Gradient = %.2f."%(G);
```

In [12]:

```
import math
#Given
Q = 1000.; #discharge of river
L = 256.; #crest length of diversion
f = 1.1; #silt factor
seg = 1./6; #safe exit gradient
hfl = 103; #high flood level
cf = 100; #reduced level of downstream concrete floor
H = 2.4; #maximum static head of weir
b = 40; #length of concrete floor
# Calculations and Results
q = Q/L;
R = 1.35*(q**2/f)**(1./3);
rld = hfl-1.5*R;
d = cf-rld;
d = round(d*100)/100;
print "depth of downstream cut-off = %.2f m."%(d);
alpha = b/d;
lambda1 = (1+(1+alpha**2)**0.5)/2;
G = H/(d*math.pi*(lambda1)**0.5);
#math.since G<seg
print " G = %.2f. <1/6./nfloor is safe against failure by piping."%(G);
```

In [13]:

```
import math
#Given
b = 60; #length of floor
H = 6; #static head of weir
d = 6; #downstream depth of pile
n = 0.3; #porousity of soil particles
G = 2.7; #relative density of soil particles
alpha = b/d;
lambda1 = (1+(1+alpha**2)**0.5)/2;
Ge = H/(d*math.pi*(lambda1)**0.5);
e = n/(1-n);
chg = (G-1)/(1+e);
f = chg/Ge;
f = round(f*100)/100;
print "critical exit gradient = %.2f.\
\nfactor of safety of system = %.2f."%(chg,f);
```

In [14]:

```
import math
from numpy import roots,ceil
#design a vertical drop weir on Bligh's theory
#test floor by Khosla's theory
#Given
Q = 2800.; #maximum flood discharge
hfl = 285.; #H.F.L before construction
hw = 278.; #minimum water level
fsl = 284.; #F.S.L of canal
c = 12.; #coefficient of creep
flux = 1.; #allowable afflux
Ge = 1./6; #permissible exit gradient
rho = 2.24; #specific gravity of concrete
#Hydraulic calculation
L = 4.75*Q**0.5;
q = Q/L;
q = round(q*10)/10;
print "Hydraulic calculation:";
print "discharge per unit width of river = %.2f cumecs."%(q);
f = 1;
R = 1.35*(q**2/f)**(1./3);
R = round(R*100)/100;
print "regime scour depth = %.2f m."%(R);
V = q/R; #regime velocity
vh = V**2/(2*9.81); #velocity head
l_down = hfl+vh;
l_up = l_down+flux;
hfl_up = l_up-vh;
hfl_down = hfl-0.5;
hfl_down = round(hfl_down*100)/100;
print "actual d/s H.F.L allowing 0.5 m for retrogation = %.2f m."%(hfl_down);
K = (q/1.7)**(2./3);
cl = l_up-K; #crest level
cl = round(cl*100)/100;
print "crest level = %.2f m."%(cl);
pl = fsl+0.5; #pond level
s = hfl_down-cl; #heigth of shutter
print "heigth of shutter = %.2f m."%(s);
rl_up_pile = hfl_up-1.5*R; #R.L of bottom u/s pile
d_up_cut = hw-276; #depth of upstream cut-off
print "depth of upstream cut-off = %.2f m."%(d_up_cut);
print " provide concrete cut off 2 m depth.";
rl_bot_ds = hfl_down-2*R;
Hs = hfl_down-hw; #seepage head
Hc = cl-hw; #heigth of crest
print "R.L of gates crest = %.2f m."%(Hs);
print "Heigth of crest = %.2f m."%(Hc);
#design of weir wall
d = hfl_up-cl;
a = d/(rho)**0.5;
a = 3*d/(2*rho); #from sliding consideration
a = s+1; #from practical consieration
a = a+1;
print "design of weir wall:"
print "provide top width of %i m."%(a);
Mo = 9.81*Hs**3/6; #overtirning moment
#equating the moment of resismath.tance to overturning moment and putting the values we get
y = [0.039,0.020,-1.084]
b = int(roots(y)[1]);
#we get b = - 5.5347261 and 5.0219056
#taking
#b = 5;
#when weir is submerged
C = 0.58;
d = (q**2/((2*C/3)**2*2*9.81))**(1./3);
Mo = 9.81*d*Hc**2/2;
#from equation of moment of resistence we get
y = [1,3,-77.55]
b = ceil(roots(y)[1]);
#we get b = - 10.433085 and 7.4330846
#taking
#b = 8;
print "bottom width = %i m."%(b);
#design of impervious and pervious aprons
C = 12;
L = C*Hs;
print "design of impervious and pervious aprons:";
print "total creep length = %i m."%(L);
l1 = 2.21*C*(Hs/13)**0.5;
l1_ = l1+1;
print "length of downstream impervious apron = %i m."%(l1_);
d1 = hw-276;
d2 = hw-271;
l2 = L-l1-(b+2*d1+2*d2);
print "length of upstream impervious apron = %i m."%(l2);
l3 = 18*C*(Hs*q/975)**0.5;
print "total length of d/s apron = %i m."%(l3); #calculation is wrong in book
l = l3-l1;
le = l/2;
le = round(le*100)/100;
print 'provide filter of length %.2f m. and launching apron of length %.2f m.'%(le,le);
t = d2*10**0.5/le;
print "thickness of launching apron in horizontal position = %.2f m."%(t);
print "provide launching apron of thickness 1.5 m.";
T = 2*d1;
V = d1*10**0.5;
ta = V/T;
ta = round(ta*10)/10;
print "thickness of apron in horizontal position = %.2f m."%(ta);
Hr = Hs-Hs*(4+33+8)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print 'provide thickness of %.2f m from d/s of weir wall to point 6 m from it.'%(t);
Hr = Hs-Hs*(4+33+8+6)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print "provide thickness of %.2f m from 6 m to 12 m from d/s end of weir wall."%(t);
Hr = Hs-Hs*(4+33+8+12)/L;
t = 4*Hr/(3*(rho-1));
t = round(t*10)/10;
print "provide thickness of %.2f m for rest of length of weir floor."%(t);
#check by khosla's theory
b = 33+8+19; #total horizontal length of impervious floor
d = 7; #depth of downstream pile
alpha = b/d;
n = 0.14; #n = 1/math.pi*(lambda)**0.5;
Ge = Hs*n/d;
print "check by Khosla theory:";
print "exit gradient = %.2f. < 1/6 hence safe"%(Ge);
alpha_ = d/b;
fic1 = 0.83;fid1 = 0.88;
corec_c1 = (fid1-fic1)*100/2;
bdash = b;
d = 2.;D = 7;
C1 = 19*(D/bdash)**0.5*(d+D)/b;
fic1 = fic1*100+corec_c1+C1;
Pc = Hs*fic1/100; #pressure head at C
alpha_ = d/b;
fie2 = 0.31;fid2 = 0.21;
corec_e1 = (fie2-fid2)*1.7*100/7;
bdash = b;
d = 7;D = 2;
C1 = 19*(D/bdash)**0.5*(d+D)/b;
fie2 = fie2*100-corec_e1-C1; #in book 3.53 value is wrong
Pe = Hs*fie2/100; #pressue head at E
#assuming linear variation of pressure for intermediate points
Pa = Pc-(Pc-Pe)*(33+8)/b;
t = Pa/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at d/s of weir wall = %.2f m."%(Pa);
print "thickness at d/s of weir wall = %.2f m. < thickness by Bligh theory;hence safe."%(t);
Pb = Pc-(Pc-Pe)*(33+8+6)/b;
t = Pb/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at 6 m from d/s of weir wall = %.2f m."%(Pb);
print "thickness at 6m from d/s of weir wall = %.2f m. < thickness by Bligh theory;hence safe."%(t);
Pc = Pc-(Pc-Pe)*(33+8+12)/b;
t = Pc/1.24;
Pa = round(Pa*100)/100;
t = round(t*100)/100;
print "pressure at 12 m from d/s of weir wall = %.2f m."%(Pc);
print "thickness at 12m from d/s of weir wall = %.2f m. > thickness by Bligh theory;hence unsafe."%(t);
print "hence increase th ethickness to 1.9 m for a length of 7 m of impervious floor.";
```

In [15]:

```
import math
#number of gates required for the barrage
#length and R.L of bamath.sin floor if silting bamath.sin is provided downstream of barrage
#Given
Lmax = 212; #maximum reservior level
Lp = 211; #pond level
hfl = 210; #downstream high flood level in the river
Qmax = 3500; #maximum design flood discharge
Lcrest = 207; #crest level of the barrage
Lcrest_r = 208; #crest level of head regulator
Cd = 2.1; #coefficient of discharge for barrage
Cd_r = 1.5; #coefficient of discharge for head regulator
rbl = 205; #river bed level
Q = 500; #design discharge of main canal
#design of water way for barrage during flood
H = Lmax-Lcrest;
L = Qmax/(Cd*H**1.5);
#which gives L = 149.07.
print "nunmber of gates for the barrage = 15.";
#design of waterway for canal head regulator
H = Lp-Lcrest_r;
L1 = Q/(Cd_r*H**1.5);
#which gives L = 64.2
#hence provide 7 bays of 10 m each
print "nunmber of gates for the head regulator = 7.";
#design of stilling bamath.sin
Hl = Lmax-hfl;
q = Qmax/L;
yc = (q**2/9.81)**(1./3);
Z = Hl/yc;
#math.since Z<1
Y = 1+0.93556*Z**0.368;
y2 = Y*yc;
Lc = 5*y2;
Lc = round(Lc*10)/10;
print "Length of cistern = %.2f m."%(Lc);
Ef2 = yc*(Y+1/(2*Y**2));
j = hfl-Ef2;
j = round(j*10)/10;
print "R.L of cistern = %.2f m."%(j);
```