import math
#design Sarda type fall
#Given
Q = 40.; #full supply discharge
sl_u = 218.3; #supply level at upstream
sl_d = 216.8; #supply level at downstream
D = 1.8; #suplly depth
L = 26.; #bed width
bl_u = 216.5; #bed level upstream
bl_d = 215.; #bed level downstream
drop = 1.5;
#from the eqauation; Q = 1.99LH**1.5*(H/B)**(1/6);
#B = 0.55*(H+d)**0.5;
#H+d = drop+D;
#we get
H = (0.774)**0.6;
d = 3.3-H;
Hc = D-H;
d = round(d*100)/100;
H = round(H*100)/100;
Hc = round(Hc*100)/100;
print "H = %.2f m.d = %.2f m."%(H,d);
print "crest height above bed = %.2f m."%(Hc);
#adopt trapezoidal crest
B = 1; #top width
print "D/S batter = 1:3; U/S batter = 1:8.";
Va = Q/((27+D)*D);
vh = Va**2/(2*9.81);
tel_up = sl_u+vh;
crest = sl_u-H;
E = sl_u-crest;
print "R.L of crest = %.2f m."%(crest);
print 'E = %.2f m.'%(E);
#design of cistern
x = (E*drop)**(2/3)/4; #depth of cistern
lc = 5*(E*drop)**0.5; #length of cistern
cb = bl_d-x;
x = round(x*100)/100;
cb = round(cb*1000)/1000;
lc = round(lc*10)/10;
print "depth of cistern = %.2f m."%(x);
print "length of cistern = %.2f m."%(lc);
print "R.L of bed of cistern = %.2f m."%(cb);
print "keep cistern at R.L 214.69.";
#design of impervious floor
Hs = 2.44; #seepage head
c = 8.; #Bligh's coefficient
li = Hs*c;
d1 = 1;d2 = 1.6;
vl = 2*(d1+d2);
lh = li-vl;
print "design of impervious floor:";
print "provide upstream cut-off = %i m.; downstream cut-off = %.2f m."%(d1,d2);
print "length of horizontal impervious floor = %.2f m."%(lh);
print "provide 15 m length impervious floor.";
ld = 2*(D+1.2)+drop;
print "minimum length of impervious floor to the d/s of toe of crest wall = %.2f m."%(ld);
print "provide ld = 8 m.";
bl = 15-8;
print "the balance of the length %i m is to be provided under and u/s of the crest."%(bl);
tcl = 15+2*(1+16);
print "uplift pressure is counter balanced by weigth of water. hence provide thickness of 0.4 m.";
rho = 2.24;
static = 2.44*(1-0.446)+x;
t = static/(rho-1);
t = round(t*100)/100;
print "for other points; thickness required = %.2f m."%(t);
print "provide thickness of 1.40 m.";
print "at downstream end of floor provide thickness of 0.6 m overlaid by 0.2 m brick pitching.";
n = d2/(Hs*5); #n = 1/math.pi*(lambda)**0.5
#from khosla exit curve we get
alpha = 10.5;
lambda1 = (1/(math.pi*n))**2;
alpha = ((2*lambda1-1)**2-1)**0.5;
b = alpha*d2;
b = round(b*100)/100;
print "checking of floor thickness by khosla theory:";
print "length of floor provided = %.2f m. > length by Bligh theory."%(b);
b = 15;
d2 = 1.8;
alpha = b/d2;
n = 0.145;
Ge = Hs*n/d2;
Ge = round(Ge*10)/10;
print "exit gradient after increase in depth cut-off = %.2f. which is in permissible limit"%(Ge);
print 'provide depth cut-off to 1.8 m.';
#calculation of pressure
print "calculation of pressure:";
print "U/S cut-off:";
d1 = 1.;
b = 15.;
alpha_ = d1/b;
fic1 = 100-24;
fid1 = 100-17;
t = 0.4;
fic1 = fic1+(fid1-fic1)*t/d1;
print "corrected fic1 = %.2f percent."%(fic1);
print "D/S cut-off wall:";
d2 = 1.8;
b = 15.;
alpha_ = d1/b;
fie2 = 31.;
fid2 = 21.5;
t = 0.6;
fie2 = fie2-(fie2-fid2)*t/1.8;
fie2 = round(fie2*10)/10;
print "correcte fie2 = %.2f percent."%(fie2);
#calculation of thickness
print "provide a minimum thickness of 0.4 m for u/s floor.";
pre = fie2+(fic1-fie2)*8/b;
static = pre*Hs/100+x;
t = static/(rho-1);
t = round(t*100)/100;
print "thickness at d/s toe of crest = %.2f m."%(t);
print "provide thickness of 1.4 m thick concrete overlaid by 0.2 m brick pitching.";
pre = fie2+(fic1-fie2)*5/b;
static = pre*Hs/100+x;
t = static/(rho-1);
t = round(t*100)/100;
print "thickness at 3 m from d/s toe of crest = %.2f m."%(t);
print "provide thickness of 1.2 m thick concrete overlaid by 0.2 m brick pitching.";
pre = fie2+(fic1-fie2)*2/b;
static = pre*Hs/100; #calculation is wrong in book
t = static/(rho-1);
t = round(t*100)/100;
print "thickness at 6m from d/s toe of crest = %.2f m."%(t);
print "provide thickness of 0.7 m thick concrete overlaid by 0.2 m brick pitching.";
#design of downstream wings
wing = 6*(E*drop)**0.5;
hw = D+0.5;
print "heigth of top of downstream wings above the bed = %.2f m."%(hw);
projec = hw*3;
print "length of warped wing measured along centre line of canal = %.2f m."%(projec);
#downstream pitching
l = 9+2*1.5;
print "length of bed pitching = %.2f m."%(l);
print "length of sloping pitching = 7 m.length of horizontal pitching = 6 m.";
print "provide one toe wall of 1 m depth and 0.4 m width.";
print "side pitching is curtailed at 45 degree from the end of bed pitching \
in plan.supprot the side pitching on toe wall 0.4 m thick and 1 m deep. ";
#energy dissipators
q = Q/L;
dc = (q**2/9.81)**(1./3);
print "size and position of friction blocks:";
L = 2*dc;
w = dc;
h = dc;
di = 1.5*dc;
L = round(L*10)/10;
w = round(w*10)/10;
h = round(h*10)/10;
di = round(di);
print "length of block = %.2f m.width of block = %.2f m.height of block = %.2f \
m.dismath.tance from toe of crest = %.2f m."%(L,w,h,di);
print "provide two rows staggered ata dismath.tance of 1 m from toe of crest.";
print "size and position of cube blocks:";
L = D/10;
w = D/10;
h = w;
L = round(L*10)/10;
w = round(w*10)/10;
h = round(h*10)/10;
print "length of block = %.2f m.width of block = %.2f m.height of block = %.2f m."%(L,w,h);
print "provide two rows staggered at the end of impervious floor.";
#u/s approach
r = 6*H;
print "provide wing wall segmental with 5 m radius subtending angle of 60 degree at the centre.";
import math
#design an unflumed straight glacis non-meter fall
#Given
Q = 40.; #full supply discharge
sl_u = 218.3; #supply level at upstream
sl_d = 216.8; #supply level at downstream
D = 1.8; #suplly depth
L = 26.; #bed width
bl_u = 216.5; #bed level upstream
bl_d = 215.; #bed level downstream
drop = 1.5;
Ge = 1./6; #permissible exit gradient
#design of crest
print "design of crest:";
E = (Q/(1.84*L))**(2/3);
V = Q/((L+D)*D);
vh = V**2/(2*9.81);
tel_up = sl_u+vh;
cl = tel_up-E;
w = 2*E/3;
w = round(w*10)/10;
print "length of crest = %.2f m."%(L);
print "width of crest = %.2f m."%(w);
#design of cistern
q = Q/L;
Hl = 1.5;
#from blench curve
Ef2 = 1.44;
cistern = sl_d+0.03-1.25*Ef2;
print "R.L of cistern = %.2f m. > d/s bed level."%(cistern);
print "keep R.L of cistern at 214.5 m.";
l = 6*Ef2;
print "length of cistern = %.2f m."%(l);
print "provide cistern of 9 m length ";
d = bl_d-214.5;
print "depth of cistern = %.2f m."%(d);
#design of impervious floor
d1 = D/3;
print "design of impervious floor:";
print "provide 0.4 m wide and 1 m deep curtain wall at u/s.";
d2 = D/2;
print "provide 0.4 m wide and 1 m deep curtain wall at d/s.the curtain wall will project the above the d/s bed by 0.18 m.";
Hs = cl-bl_d;
d2 = 1;
n = d2*Ge/Hs; #n = 1/(math.pi*(lambda)**0.5)
#from khosla exit curves we get
alpha = 40;
lambda1 = (1/(math.pi*n))**2;
alpha = ((2*lambda1-1)**2-1)**0.5;
b = alpha*d2;
#math.since length is to excessive
d2 = 2;
n = d2*Ge/Hs; #n = 1/(math.pi*(lambda)**0.5)
#from khosla exit curves we get
alpha = 10;
lambda1 = (1/(math.pi*n))**2;
alpha = ((2*lambda1-1)**2-1)**0.5;
b = alpha*d2+1;
print "total length = %i m.length of cistern = 9 m.length of d/s glacis = 5.88\
m.width of crest = 0.6 m.length of u/s glacis = 0.47 m.balance to be provided to u/s of the u/s glacis = 4.05 m."%(b);
#pressure calculations
print "pressure calculations:";
print "upstream curtain wall:";
d1 = 1.;
b = 20;
alpha_ = d1/b;
t = 0.3;
fic1 = 100-22;
fid1 = 100-15;
corec = (fid1-fic1)*t/d1
fic1 = fic1+corec;
print "corrected fi_c1 = %.2f percent."%(fic1);
print "downstream curtain wall:";
d2 = 2.;b = 20;
alpha_ = d2/b;
t = 0.5;
fie = 29.;
fid = 21;
corec = (fie-fid)*t/d2
fie = fie-corec;
print "corrected fi_e = %.2f percent."%(fie);
print "toe of glacis:";
#assuming linear variation of pressure
p = fie+(80-fie)*9/20;
print "pressure at downstream of the glacis = %.2f percent."%(p);
#floor thickness
rho = 2.24;
print "floor thickness:provide minimum thickness of 0.3 m at the u/s floor.";
static = p*2.44/100+(bl_d-214.5);
t = static/(rho-1);
t = round(t*100)/100;
print "floor thickness required at toe of glacis = %.2f m.provide 1.5 m thick floor for length of 3 m."%(t);
p = fie+(80-fie)*6/20;
static = p*2.44/100+(bl_d-214.5);
t = static/(rho-1);
t = round(t*100)/100;
print "floor thickness required at 3m from toe of glacis = %.2f m.provide \
1.3 m thick floor from 3 m to 6.5 m from toe of glacis."%(t);
t = 0.27*2.44/(rho-1);
t = round(t*100)/100;
print "thickness of d/s end of cistern = %.2f m.provide thickness of 0.6 m at d/s end of floor."%(t);
#design of d/s protection
print "no bed protection is needed as deflector wall is provided.";
sp = 3*D;
print "length of side protection = %.2f m.provide 5.5 m length of 20 cm\
thick brick pitching beyond impervious floor.pitching will rest on toe wall 0.4 \
m wide and 0.9 m deep.provide 0.4 m wide profile at the end of pitching"%(sp);
#design of u/s approach
print "u/s wing wall is splayed at 45 degree from u/s end of impervious\
floor.extend 1 m into earthen banks from line of F.S.L.";
import math
#design a cross -regulator and head regulatorfor a distributory channel
#givrn
Q = 100.; #discharge of parent channel
Qd = 15.; #discharge ofdistributory
fsl_u = 218.1; #F.S.L of upstream parent channel
fsl_d = 217.9; #F.S.L of downstream of parent channel
bw_u = 42.; #bed width of parent channel upstream
bw_d = 38.; #bed width of parent channel downstream
hw = 2.5; #depth of water in parent channel
fsl_dis = 217.1; #F.S.L of distributory
hw_dis = 1.5; #depth of water in distributory
Ge = 1./5; #permissible exit gradient
#design of cross regulator
print "DESIGN OF CROSS-REGULATOR::";
#design of crest and waterway
print "design of crest and waterway:";
cl = fsl_u-hw;
h = fsl_u-fsl_d;
d = fsl_d-cl;
C1 = 0.557;C2 = 0.8;
L = Q/(2*C1*(2*9.81)**0.5*h**1.5/3+C2*d*(2*9.81*h)**0.5);
L = round(L*10)/10;
print "crest level = %.2f m."%(cl);
print "length of crest = %.2f m."%(L);
tw = 28+4.5;
print "provide 3 piers of 1.5 m width each.total width of cross regulator = %.2f m."%(tw);
#design of d/s floor
L = 28.;
q = Q/L;
Hl = fsl_u-fsl_d;
Ef2 = 1.89; #from blench curve
fl_d = fsl_d-Ef2;
print "design of d/s floor:";
print "d/s floor level = %.2f m.; which is higher than d/s bed level.adopt floor level = d/s bed level = 215.40 m."%(fl_d);
Ef1 = Ef2+Hl;
#from specific energy curve
D1 = 0.7;
D2 = 1.65;
cil = 5*(D2-D1); #cistern length
tl = 2*16/3;
tl = round(tl*10)/10;
print "cistern length = %.2f m.length of d/s floor = %.2f m."%(cil,tl);
#design of impervious floor
d1 = hw/3+0.6; #depth of u/s cut-off
w = 0.5; #width of cut-off
d2 = hw/2+0.6; #deth of d/s cut-off
d2 = 2; #keep
Hs = fsl_u-(fsl_d-hw); #maximum static head
n = Ge*d2/Hs; #n = 1/math.pi*(lambda)**0.5;
#from exit gradient curves we get
alpha = 8.;
n = 0.148;
b = alpha*d2;
print "design of impervious floor:";
print "total length of impervious floor = %i m.;which is divided as-"%(b);
print "d/s floor length = 10.6 m.d/s glacis length with 2:1 slope = 0.4 m.balance to be provided upstream = 5 m.";
d1 = 1.5;b = 16;
alpha_ = d1/b;
#hence
fic1 = 100-28;
fid1 = 100-19;
t = 0.5;
fic1 = fic1+(fid1-fic1)*t/d1;
print "pressure calculation:upstream cut-off:pressure = %.2f percent."%(fic1);
d2 = 2.;
b = 16;
alpha_ = d2/b;
#hence
t = 0.6;
fie2 = 31.;
fid2 = 22.;
fie2 = fie2-(fie2-fid2)*t/d2;
print "downstream cut-off:pressure = %.2f percent."%(fie2);
t = 10.6;
p = fie2+(fic1-fie2)*t/b;
p = round(p*10)/10;
print "toe of glacis:pressure = %.2f percent."%(p);
print "thickness of floor:minimu thickness for u/s floor = 0.5 m.";
rho = 2.24;
t = fie2*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor near d/s cut-off = %.2f m.provide 0.7 m thick floor for last 2.1 m length."%(t);
t = 1.6/(rho-1);
t = round(t*100)/100;
print "thickness of floor at toe of glacis = %.2f m."%(t);
t = 6.6;
p = fie2+(fic1-fie2)*t/b;
t = p*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor at 4 m from toe of glais = %.2f m.provide 1.1 m thick floor for next 2 m length"%(t);
t = 4.6;
p = fie2+(fic1-fie2)*t/b;
t = p*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor at 6 m from toe of glais = %.2f m.provide 0.9 m thick floor for next 2.5 m length"%(t);
#design of u/s protection
d1 = hw/3+0.6;
v = d1;
v = round(v*100)/100;
print "design of u/s protection:volume of block protection = %.2f cubic metre/metre."%(v);
print "keep thickness of protection = 1 m.provide 0.8mx0.8mx0.6m thick concret blocks over 0.4 m thick apron in length of 0.6 m.";
cu = 2.25*d1;
cu = round(cu*100)/100;
print "cubic content of launching apron = %.2f cubic metre/metre.provide 1 m thick and 3.5 m long launching apron."%(cu);
#design of d/s protection
d2 = hw/2+0.6;
v = d2;
v = round(v*100)/100;
print "design of d/s protection:volume of inverted filter = %.2f cubic metre/metre."%(v);
print "keep thickness of concrete block = 0.6 m.provide 2 rows of 0.8mx0.8mx0.6m thick \
concret blocks over 0.6 m graded filter for length of 1.6 m.";
cu = 2.25*d2;
cu = round(cu*100)/100;
print "launching apron volume = %.2f cubic metre/metre.provide 1 m thick launching apron\
for length of 4.5 m.provide a toe wall 0.4 m wide and 1.5 m deep between filter and launching apron."%(cu);
#design of head regulator
print "DESIGN OF DISTRIBUTORY HEAD REGULATOR::";
#design of crest and waterway
print "design of crest and waterway:";
cl = fsl_u-hw+0.5;
h = fsl_u-fsl_dis;
d = fsl_dis-cl;
C1 = 0.557;C2 = 0.8;
L = Qd/(2*C1*(2*9.81)**0.5*h**1.5/3+C2*d*(2*9.81*h)**0.5);
L = round(L*100)/100;
print "crest level = %.2f m."%(cl);
print "length of crest = %.2f m."%(L);
print "provide 2 bays of 3.5 m each with a 1 m thick pier in between.";
tw = 8;
print "total width of cross regulator = %.2f m."%(tw);
#design of d/s floor
L = 7.5;
q = Q/L;
Hl = fsl_u-fsl_dis;
Ef2 = 1.58; #from blench curve
fl_d = fsl_dis-Ef2;
print "design of d/s floor:";
print "d/s floor level = %.2f m.;keepR.L of d/s floor = 215.50 m."%(fl_d);
Ef1 = Ef2+Hl;
#from specific energy curve
D1 = 0.42;D2 = 2.55;
cil = 5*(D2-D1); #cistern length
tl = 2*14/3;
print "cistern length = %.2f m."%(cil);
#design of impervious floor
d1 = hw/3+0.6; #depth of u/s cut-off
w = 0.5; #width of cut-off
d2 = hw_dis/2+0.6; #deth of d/s cut-off
d2 = 2; #keep
Hs = fsl_u-215.5; #maximum static head
n = Ge*d2/Hs; #n = 1/math.pi*(lambda)**0.5;
#from exit gradient curves we get
alpha = 7;n = 0.154;
b = alpha*d2;
print "design of impervious floor:";
print "total length of impervious floor = %i m.;which is divided as-"%(b);
print "length below the toe of glacis = 10.5 mlength of d/s glacis at 2:1 slope =\
1.2 m.width of crest = 1 m.length of u/s glacis at 1:1 slope = 0.5 m.u/s floor:balnce = 0.8 m.";
d1 = 1.5;
b = 16.;
alpha_ = d1/b;
#hence
fic1 = 100-28;
fid1 = 100-19;
t = 0.5;
fic1 = fic1+(fid1-fic1)*t/d1;
print "pressure calculation:upstream cut-off:pressure = %.2f percent."%(fic1);
d2 = 2.;
b = 16;
alpha_ = d2/b;
#hence
t = 0.6;
fie2 = 31.;
fid2 = 22;
fie2 = fie2-(fie2-fid2)*t/d2;
print "downstream cut-off:pressure = %.2f percent."%(fie2);
t = 10.6;
p = fie2+(fic1-fie2)*t/b;
p = round(p*100)/100;
print "toe of glacis:pressure = %.2f percent."%(p);
print "thickness of floor:minimu thickness for u/s floor = 0.5 m.";
rho = 2.24;
t = p*2.6/(100*(rho-1));
t = round(t*100)/100;
print "thickness under the crest = 1 m.";
print "thickness of floor at toe of glacis = %.2f m."%(t);
t = 9.5;
p = fie2+(fic1-fie2)*t/b;
t = p*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor at 2 m from toe of glais = %.2f m.provide 1.1 m thick floor for next 4 m length"%(t);
t = 4.5;
p = fie2+(fic1-fie2)*t/b;
t = p*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor at 6 m from toe of glais = %.2f m.provide 0.9 m thick floor for next 2.5 m length"%(t);
t = 2;
p = fie2+(fic1-fie2)*t/b;
t = p*2.7/(100*(rho-1));
t = round(t*100)/100;
print "thickness of floor at 8.5 m from toe of glais = %.2f m.provide 0.7 m thick floor for next 2 m length"%(t);
#design of upstream protection
d = hw/3+0.6;
d = round(d*10)/10;
print "design of u/s protection:u/s scour depth = %.2f m.provide same protection as in cross regulator"%(d);
#design of d/s protection
d2 = hw_dis/2+0.6;
v = d2;
print "design of d/s protection:volume of inverted filter = %.2f cubic metre/metre."%(v);
print "keep thickness of concrete block = 0.5 m.provide 2 rows of \
0.8mx0.8mx0.5m thick concret blocks over 0.5 m thick graded filter.";
cu = 2.25*d2;
print "launching apron volume = %.2f cubic metre/metre.provide 1 m thick \
launching apron for length of 3.5 m.provide a masonary toe wall 0.4 m wide and 1.2 m deep between filter and launching apron."%(cu);