🥥Python水力学和水文学应用
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Python | Matplotlib | Numpy | 非线性方程 | 线性方程 | 法向深度 | 水力学 | 曼宁通道摩擦系数 | 达西-魏斯巴赫方程 | 哈森-威畨公式 | 矩阵 | 单位水位线 | 高斯消元法 | 数学 | 休恩法 | 龙格-库塔法 | 常微分方程 | 质量守恒定律 | 溶解年生化需年量 | 杜普伊特假设 | 非线性 | 欧拉法 | 泰勒级数 | 边界条件 | 微积分 | 偏微分方程 | 普赖斯曼方法 | 运动波方程 | 圣维南流动方程 | 拉普拉斯方程 | 笛卡尔直角坐标 | 动量方程 | 数值计算 | 曼宁通道摩擦系数 | 牛顿-拉夫逊方法 | 概率 | 导水率 | 拉普拉斯方程 | 稳态条件 | 蓄水层 | 一维瞬态渗流 | 二维瞬态地下水流 | 模型几何
import numpy as np
import matplotlib.pylab as plt
g = 9.81
Atop = 1.0
Abottom = 0.5
D = 0.75
Aoutlet = 0.005
Cd = 0.7
dt = 1 # Time step (in seconds
ntimes = int(time_simulation/dt)
print(ntimes)
h=np.zeros(ntimes) # Sequence of water depths in bucket
time = np.zeros(ntimes) # Time markers for plotting
h[0] = 0.0
for n in range (0,ntimes-1):
time[n+1] = time[n] + dt
if(time[n] <= time_control1):
Qin = Qin1
elif(time[n] > time_control1 and time[n] <=
time_control2):
Qin = Qin2
else:
Qin = 0.0
Qout = Cd*Aoutlet*np.sqrt(2*g*h[n])
Area = Abottom + h[n]*(Atop-Abottom)/D
dhdt0 = (Qin - Qout)/Area
h1 = h[n]+dhdt0*dt
Qout1 = Cd*Aoutlet*np.sqrt(2*g*h1)
Area1 = Abottom + h1*(Atop-Abottom)/D
dhdt1 = (Qin - Qout1)/Area1
dhdt = 0.5*(dhdt0+dhdt1)
h[n+1] = dhdt*dt+h[n]
if(h[n+1] < 0.01): h[n+1] = 0.0
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(time, h)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Water Depth (m)')
plt.show()