Weir Design Code
Weir Design Code
#HYDRAULIC CALCULATIONS
q = Q / Lw #specific discharge
print('The specific discharge is=',q)
f = 1.76 * ((dmm)**(0.5)) #silt factor
print('The silt factor is=',f)
R = round((1.35 * ((q ** 2) / f) ** (1 / 3)),2) #ScourDepth
print('The scour depth is=',R)
R_Velocity = round((q / R),2) #Regime Velocity
print('The regime velocity is=',R_Velocity)
Velocity_Head = round((((R_Velocity) ** 2) / (2 * 9.81)),2) #VelocityHead
print('The velocity head is=',Velocity_Head)
Ho = (Q/(Cd*Lw))**(2/3) #HeadOverCrest
print('The head over crest is=',Ho)
ds_TEL = BL + Ho
print('The downstream TEL is=',ds_TEL)
ds_HFL = ds_TEL - Velocity_Head
print('The downstream HFL is=',ds_HFL)
us_TEL = CrestLevel + Ho
print('The upstream TEL is=',us_TEL)
us_HFL = us_TEL - Velocity_Head
print('The upstream HFL is=',us_HFL)
HeadLoss = us_TEL - ds_TEL
print('The headloss is=',HeadLoss)
def f(m):
return (((m ** 4) * (m + 1)) / ((m - 1) ** 9)) - x2
[ayc,ay1,ay2,aEf1,aEf2,aL_concretefloor,afroude_number,aJumpFormationLevel]=equatio
n(q,HeadLoss,ds_TEL)
JumpFormingLevel= np.round(aJumpFormationLevel-0.2,1)
#ChuteBlocks
heightCB = 2* ay1
toplengthCB = 2*ay1
widthCB = ay1
spacingCB = 2.5*ay1
leaveAlongEachWall = ay1/2
#BasinBlocks
heightBB = ay1 * ((10**(-5))*(afroude_number**5)-
0.0007*(afroude_number**4)+0.015*(afroude_number**3)-
0.1507*(afroude_number**2)+0.8717*afroude_number-0.5265)
topWidthBB = 0.2 *heightBB
widthBB = heightBB
spacingBB = heightBB
distbetCBandBB = 0.8 * ay2
#Endsill
heightES = 0.2 * ay2
lengthES = 2 * heightES
widthES = 0.15 * ay2
spacingES = 0.15 *ay2
topcrestES = 0.02* ay2
numberofesb = math.ceil((Lw+spacingES)/(spacingES+widthES))
if usCutoffLevel>BL or (usCutoffLevel-BL)<2:
print('If you are seeing this, either there is no need of cutoff wall or the
depth of cutoff wall calculated is less than 2m')
new = float(input('Assume a depth of cutoff wall for stability purposes'))
usCutoffDepth = new
usCutoffLevel = BL - usCutoffDepth
else:
usCutoffLevel = us_HFL - usCutoffDepth
if dsCutoffLevel>JumpFormingLevel or (usCutoffLevel-JumpFormingLevel)<2:
print('If you are seeing this, either there is no need of cutoff wall or the
depth of cutoff wall calculated is less than 2m')
new1 = float(input('Assume a depth of cutoff wall for stability purposes'))
dsCutoffDepth = new1
dsCutoffLevel = JumpFormingLevel - dsCutoffDepth
else:
dsCutoffLevel = ds_HFL - dsCutoffDepth
print('The RL of cutoff wall below Floor Level in ds is=',JumpFormingLevel-
dsCutoffDepth)
print("Now, you have to select the Khosla's Safe Gradient for Different Types of
Soil")
print('For Shingle, from 0.25 to 0.20')
print('For Course Sand, from 0.20 to 0.17')
print('For Fine Sand, from 0.17 to 0.14')
#US Correction
D = (BL - USAsThick) - (JumpFormingLevel-dsCutoffDepth)
d = (BL - USAsThick) - (BL-usCutoffDepth)
b1 = totalbreadth - 2 * (EdgeDist)
if (b1>dsCutoffDepth and b1>usCutoffDepth):
print('Mutual Interference effect may be neglected.')
Correction1 = 0
else:
Correction1 = 19 * (D/b1)**0.5 * ((d+D)/totalbreadth)
Correction2 = (PhiD1-PhiC1)/(BL-(JumpFormingLevel-dsCutoffDepth))*(USAsThick)
CorrectPhiC1 = np.around(PhiC1 + Correction1 + Correction2,4)
print('The correct PhiC1=',CorrectPhiC1)
#DS Correction
D = (JumpFormingLevel - DSAsThick) - (BL-usCutoffDepth)
d = (JumpFormingLevel - DSAsThick) - (JumpFormingLevel-dsCutoffDepth)
b1 = totalbreadth - 2 * (EdgeDist)
if (b1>dsCutoffDepth and b1>usCutoffDepth):
print('Mutual Interference effect may be neglected.')
Correction1 = 0
else:
Correction1 = 19 * (D/b1)**0.5 * ((d+D)/totalbreadth)
Correction2 = (PhiE2-PhiD2)/(JumpFormingLevel-(JumpFormingLevel-
dsCutoffDepth))*(DSAsThick)
CorrectPhiE2 = np.around(PhiE2 - Correction1 - Correction2,4)
print('The correct PhiE2=',CorrectPhiE2)
print('After correction:')
print('PhiE1=',PhiE1)
print('PhiD1=',PhiD1)
print('PhiC1=',CorrectPhiC1)
print('PhiE2=',CorrectPhiE2)
print('PhiD2=',PhiD2)
print('PhiC2=',PhiC2)
#Data tabulation
def
KhoslaTableLine1(PhiE1,PhiC2,PhiD1,CorrectPhiC1,CorrectPhiE2,PhiD2,usLevel,dsLevel)
:
MSH = np.around(usLevel - dsLevel,2)
a1 = np.round(PhiE1/100*MSH)
a = np.round(PhiD1/100*MSH,2)
b = np.round(CorrectPhiC1/100*MSH,2)
c = np.round(CorrectPhiE2/100*MSH,2)
d = np.round(PhiD2/100*MSH,2)
d1 = np.round(PhiC2/100*MSH)
return np.round(usLevel,2),np.round(dsLevel,2),MSH,a1,a,b,c,d,d1
def
KhoslaTableLine2(PhiE1,PhiC2,PhiD1,CorrectPhiC1,CorrectPhiE2,PhiD2,usLevel,dsLevel)
:
MSH = np.around(usLevel - dsLevel,2)
a= np.around(dsLevel+ (PhiD1/100)*(usLevel-dsLevel),2)
b= np.around(dsLevel+ (CorrectPhiC1/100)*(usLevel-dsLevel),2)
c= np.around(dsLevel+ (CorrectPhiE2/100)*(usLevel-dsLevel),2)
d= np.around(dsLevel+ (PhiD2/100)*(usLevel-dsLevel),2)
return
np.round(usLevel,2),np.round(dsLevel,2),MSH,np.round(usLevel,2),a,b,c,d,np.round(ds
Level,2)
[aa,bb,cc,dd,ee,ff,gg,hh,ii]=KhoslaTableLine1(PhiE1,PhiC2,PhiD1,CorrectPhiC1,Correc
tPhiE2,PhiD2,CrestLevel,JumpFormingLevel)
[aa2,bb2,cc2,dd2,ee2,ff2,gg2,hh2,ii2]=KhoslaTableLine2(PhiE1,PhiC2,PhiD1,CorrectPhi
C1,CorrectPhiE2,PhiD2,CrestLevel,JumpFormingLevel)
[aa3,bb3,cc3,dd3,ee3,ff3,gg3,hh3,ii3]=KhoslaTableLine1(PhiE1,PhiC2,PhiD1,CorrectPhi
C1,CorrectPhiE2,PhiD2,us_HFL,ds_HFL)
[aa4,bb4,cc4,dd4,ee4,ff4,gg4,hh4,ii4]=KhoslaTableLine2(PhiE1,PhiC2,PhiD1,CorrectPhi
C1,CorrectPhiE2,PhiD2,us_HFL,ds_HFL)
x = PrettyTable()
x.field_names = ['Flow Cond.', 'USlvl',
'DSlvl','Head','E1','D1','C1','E2','D2','C2']
#PreJump Profile:
x12=PrettyTable()
x12.field_names = ['Dist from d/s to start of glacis','Glacis Level','High Flood
Ef1','High Flood y1']
i=2
GlacisLevel = CrestLevel
while GlacisLevel>JumpFormingLevel:
GlacisLevel = CrestLevel - i/DSlope
Ef1 = us_TEL - GlacisLevel
p = np.poly1d([2,-Ef1/ayc*2,0,1])
roots = p.roots
output = roots[(roots>0)&(roots<1)]
finaly = np.around(ayc * output,3)
if GlacisLevel>JumpFormingLevel:
x12.add_row([i,GlacisLevel,round(Ef1,3),finaly])
i = i + DSlope
GlacisLevel = aJumpFormationLevel
FinalDistance = 2*(CrestLevel-GlacisLevel)
FEf1 = us_TEL - GlacisLevel
p = np.poly1d([2,-Ef1/ayc*2,0,1])
roots = p.roots
output = roots[(roots>0)&(roots<1)]
finaly = np.around(ayc * output,3)
x12.add_row([FinalDistance,GlacisLevel,np.around(us_TEL-GlacisLevel,3),finaly])
print(x12)
#PostJumpProfile
print('For the post jump profile, the values of Froude number and initial depth
(y1) are ',afroude_number,'and ',ay1,'respectively.')
FroudeSquare = afroude_number**2
print('The value of Froude number sqaure is',FroudeSquare)
nearvalue = int(input("Out of Plate 10.3 (a) in SK Garg's Book, which value is near
your square out of 4, 8, 15, 30 and 60?"))
x13=PrettyTable()
x13.field_names = ['x/y1','y/y1','y','x']
xbyx1=0
if nearvalue == 60:
for xbyx1 in np.arange(0,25,2.5):
ybyy1 = 6*(10**-7)*xbyx1**5 - 6*(10**-5)*xbyx1**4 + 0.0021*xbyx1**3 -
0.035*xbyx1**2 + 0.4782*xbyx1 + 0.959
yvalue = ybyy1 * ay1
xvalue = xbyx1 * ay1
x13.add_row([xbyx1,ybyy1,yvalue,xvalue])
print(x13)
if nearvalue == 30:
for xbyx1 in np.arange(0,25,2.5):
ybyy1 = 5*(10**-7)*xbyx1**5 - 5*(10**-5)*xbyx1**4 + 0.002*xbyx1**3 -
0.035*xbyx1**2 + 0.4842*xbyx1 + 0.9543
yvalue = ybyy1 * ay1
xvalue = xbyx1 * ay1
x13.add_row([xbyx1,ybyy1,yvalue,xvalue])
print(x13)
if nearvalue == 15:
for xbyx1 in np.arange(0,25,2.5):
ybyy1 = -3*(10**-6)*xbyx1**4 + 0.0004*xbyx1**3 - 0.0192*xbyx1**2 +
0.442*xbyx1 + 0.9476
yvalue = ybyy1 * ay1
xvalue = xbyx1 * ay1
x13.add_row([xbyx1,ybyy1,yvalue,xvalue])
print(x13)
if nearvalue == 8:
for xbyx1 in np.arange(0,25,2.5):
ybyy1 = 5*(10**-7)*xbyx1**5 - 5*(10**-5)*xbyx1**4 + 0.002*xbyx1**3 -
0.0427*xbyx1**2 + 0.5017*xbyx1 + 0.9714
yvalue = ybyy1 * ay1
xvalue = xbyx1 * ay1
x13.add_row([xbyx1,ybyy1,yvalue,xvalue])
print(x13)
if nearvalue == 4:
for xbyx1 in np.arange(0,25,2.5):
ybyy1 = 5*(10**-6)*xbyx1**5 - 0.0003*xbyx1**4 + 0.0064*xbyx1**3 -
0.0717*xbyx1**2 + 0.4626*xbyx1 + 0.9838
yvalue = ybyy1 * ay1
xvalue = xbyx1 * ay1
x13.add_row([xbyx1,ybyy1,yvalue,xvalue])
print(x13)
else:
print('If your value is not near these values, proceed manually.')
print(x14)
print(x15)