import math
#design a guide bank required for a bridge in a river
#Given
Q = 50000.; #discharge
f = 1.1; #silt factor
bl = 130.; #bed level of river
hfl = 140.; #high flood level
# Calculations and Results
L = 4.75*(Q)**0.5;
L = L+212; #providing 20 percent more length
L_up = 5*L/4; #upstream length of guide bund
L_down = L/4; #downstream length of guide bund
r_up = 0.45*L; #radius of upstream curved head
print "upstream length of guide bund = %i m."%(L_up);
print "downstream length of guide bund = %i m."%(L_down);
print "upstream radius of curved head = %i m.;it can be carved at 145 degrees."%(r_up);
print "downstream radius of curved head = 287m.;it can be carved at 60 degrees.";
fb = 1.5; #free board
ltop = fb+hfl; #level of top of guide bund
print "level of top of guide bund = %.2f m."%(ltop);
print "adopt top level = 142 m.";
ltop = 142;
Hr = ltop-bl;
print "keep top width = 4 m. and side slope as 2:1.";
T = 0.06*(Q)**(1./3); #thickness of stone pitching
T = round(T*100)/100;
print "Thickness of stone pitching = %.2f m."%(T);
R = 0.47*(Q/f)**(1./3); #depth of scour
Rmax = 1.25*R; #maximum scour
rl = hfl-Rmax; #R.L at maximum anticipated cover
D = bl-rl; #depth of maximum scour
Lapron = 1.5*D;
R = round(R*100)/100;
Lapron = round(Lapron*100)/100;
print "depth of scour = %.2f m."%(R);
print "for straigtht reach of guide band:";
print "length of apron = %.2f m."%(Lapron);
Rmax = 1.5*R;
rl = hfl-Rmax;
D1 = bl-rl;
Lapron = 1.5*D1;
R = round(R*100)/100;
print "for curvilinear transition portion of guide band:";
print "length of apron = %.2f m."%(Lapron);
T1 = 1.9*T;
T1 = round(T1*10)/10;
print "thickness of apron = %.2f m."%(T1);
print "volume of stones:";
ss = 5**0.5*(141-130)*T;
as1 = 5**0.5*D*1.25*T;
ss = round(ss*100)/100;
as1 = round(as1*100)/100;
print "at shank:";
print "on slope = %.2f cubic metre/m."%(ss);
print "on apron with a slope 2:1 = %.2f cubic metre/m."%(as1);
va = 5**0.5*D1*1.25*T;
vs = ss;
vs = round(vs*100)/100;
va = round(va*100)/100;
print "U/S andD/S curved portion:";
print "on slope = %.2f cubic metre/m."%(vs);
print "on apron = %.2f cubic metre/m."%(va);
ta = va/(1.5*D1);
ta = round(ta*10)/10;
print "thickness of launching apron = %.2f m."%(ta);