In the unequal flow calculation program (normal flow calculation) introduced earlier, it is necessary to specify the water level at the downstream end association, and the equal flow depth is used for it. In other words, it is necessary to know the uniform flow depth. For the time being, you will be solving nonlinear equations, but I think the good thing about Python is that you can do such calculations quickly.
The basic formula for calculating the uniform flow depth of a rectangular cross section is as follows.
\begin{gather}
Q=A\cdot v \\
v=\cfrac{1}{n}\cdot R^{2/3}\cdot i^{1/2} \\
R=\cfrac{b\cdot h}{b+2\cdot h}
\end{gather}
$ Q $ td> | (known) flow rate td> tr> Mr |
$ n $ td> | (Known) Manning Roughness Length td> tr> |
$ i $ td> | (Known) Canal floor gradient td> tr> |
$ h $ td> | (unknown) constant flow depth td> tr> |
The following equation, which is a transformation of the above equation into the form $ f = 0 $, is solved for $ h $.
\begin{equation}
f=Q-\cfrac{b\cdot h}{n}\cdot \left(\cfrac{b\cdot h}{b+2\cdot h}\right)^{2/3}\cdot i^{1/2}=0
\end{equation}
In this program, it is solved using scipy.optimize.brentq
.
The initial value of the solution given to the Brent method is given as `` `h1 = 0, h2 = 10```.
The calculation of the critical water depth $ h_c $ is a bonus.
The program is as shown below.
# normal depth and critical depth of rectangular cross section
import numpy as np
from scipy import optimize
def cal_hc(q,b):
# critical depth
g=9.8
hc=(q**2/g/b**2)**(1/3)
return hc
def func(h,q,b,n,i):
f=q-b*h/n*(b*h/(b+2*h))**(2/3)*i**(1/2)
return f
def main():
q=42.0 # discharge
b=4.0 # channel width
n=0.014 # Manning's roughness coefficient
i=0.001 # invert gradient
h1=0.0
h2=10.0
hh=optimize.brentq(func,h1,h2,args=(q,b,n,i))
print('hn=',hh) # normal depth
hc=cal_hc(q,b)
print('hc=',hc) # critical depth
#==============
# Execution
#==============
if __name__ == '__main__': main()
The calculation result is as follows.
hn= 3.866645305835682
hc= 2.2407023732785825
That's all. Thank you.
Recommended Posts