wolfhece 1.8.12__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/GraphNotebook.py +0 -1
- wolfhece/PyCrosssections.py +591 -5
- wolfhece/PyDraw.py +1151 -413
- wolfhece/PyGui.py +2 -4
- wolfhece/PyParams.py +1515 -852
- wolfhece/PyVertex.py +73 -73
- wolfhece/PyVertexvectors.py +226 -808
- wolfhece/RatingCurve.py +19 -6
- wolfhece/apps/wolf2D.py +11 -0
- wolfhece/apps/wolfcompare2Darrays.py +51 -22
- wolfhece/bernoulli/NetworkOpenGL.py +337 -341
- wolfhece/drawing_obj.py +25 -0
- wolfhece/hydrology/Catchment.py +77 -77
- wolfhece/hydrology/Optimisation.py +206 -53
- wolfhece/hydrology/PostProcessHydrology.py +22 -22
- wolfhece/hydrology/SubBasin.py +17 -17
- wolfhece/hydrology/constant.py +4 -0
- wolfhece/hydrology/cst_exchanges.py +2 -1
- wolfhece/lazviewer/processing/estimate_normals/estimate_normals.cp310-win_amd64.pyd +0 -0
- wolfhece/lazviewer/vfuncs/vfuncs.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
- wolfhece/libs/wolfpy.cp310-win_amd64.pyd +0 -0
- wolfhece/mesh2d/wolf2dprev.py +4 -4
- wolfhece/multiprojects.py +13 -13
- wolfhece/pylogging.py +1 -1
- wolfhece/pyshields.py +213 -136
- wolfhece/pyviews.py +23 -23
- wolfhece/wolf_array.py +69 -152
- wolfhece/wolf_texture.py +39 -16
- wolfhece/wolfresults_2D.py +4 -4
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/METADATA +3 -2
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/RECORD +38 -34
- wolfhece/apps/wolfgpu.py +0 -19
- /wolfhece/lazviewer/processing/estimate_normals/{estimate_normals.pyd → estimate_normals.cp39-win_amd64.pyd} +0 -0
- /wolfhece/lazviewer/vfuncs/{vfuncs.pyd → vfuncs.cp39-win_amd64.pyd} +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/LICENCE +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/WHEEL +0 -0
- {wolfhece-1.8.12.dist-info → wolfhece-2.0.0.dist-info}/top_level.txt +0 -0
wolfhece/multiprojects.py
CHANGED
@@ -6,7 +6,7 @@ from typing import Literal
|
|
6
6
|
from concurrent.futures import ThreadPoolExecutor
|
7
7
|
import logging
|
8
8
|
|
9
|
-
from .PyParams import Wolf_Param
|
9
|
+
from .PyParams import Wolf_Param, key_Param
|
10
10
|
from .PyVertexvectors import Zones, vector, zone
|
11
11
|
from .PyPalette import wolfpalette
|
12
12
|
from .PyTranslate import _
|
@@ -88,7 +88,7 @@ class Wolf2D_Project(Project):
|
|
88
88
|
if verbose:
|
89
89
|
print(key)
|
90
90
|
|
91
|
-
cursim = self.mysims[key] = Wolfresults_2D(join(self.wdir, val[
|
91
|
+
cursim = self.mysims[key] = Wolfresults_2D(join(self.wdir, val[key_Param.VALUE]), eps=epsilon, idx=key)
|
92
92
|
cursim.plotted=True
|
93
93
|
|
94
94
|
self.set_vectors()
|
@@ -125,10 +125,10 @@ class Wolf2D_Project(Project):
|
|
125
125
|
for curkey,curvec in vec.items():
|
126
126
|
|
127
127
|
filename=''
|
128
|
-
if exists(curvec[
|
128
|
+
if exists(curvec[key_Param.VALUE]):
|
129
129
|
filename = curvec
|
130
|
-
elif exists(join(self.wdir,curvec[
|
131
|
-
filename = join(self.wdir,curvec[
|
130
|
+
elif exists(join(self.wdir,curvec[key_Param.VALUE])):
|
131
|
+
filename = join(self.wdir,curvec[key_Param.VALUE])
|
132
132
|
|
133
133
|
if filename!='':
|
134
134
|
self.mycontours[curkey] = Zones(filename)
|
@@ -140,8 +140,8 @@ class Wolf2D_Project(Project):
|
|
140
140
|
locvec = None
|
141
141
|
cursim = None
|
142
142
|
|
143
|
-
if curname[
|
144
|
-
locvec = self.mycontours[curname[
|
143
|
+
if curname[key_Param.VALUE] in self.mycontours.keys():
|
144
|
+
locvec = self.mycontours[curname[key_Param.VALUE]]
|
145
145
|
|
146
146
|
if curid in self.mysims.keys():
|
147
147
|
cursim = self.mysims[curid]
|
@@ -160,10 +160,10 @@ class Wolf2D_Project(Project):
|
|
160
160
|
|
161
161
|
for curid, curname in pals.items():
|
162
162
|
filename=''
|
163
|
-
if exists(curname[
|
164
|
-
filename = curname[
|
165
|
-
elif exists(join(self.wdir, curname[
|
166
|
-
filename=join(self.wdir, curname[
|
163
|
+
if exists(curname[key_Param.VALUE]):
|
164
|
+
filename = curname[key_Param.VALUE]
|
165
|
+
elif exists(join(self.wdir, curname[key_Param.VALUE])):
|
166
|
+
filename=join(self.wdir, curname[key_Param.VALUE])
|
167
167
|
|
168
168
|
if filename!='':
|
169
169
|
mypal = wolfpalette(None, '')
|
@@ -175,10 +175,10 @@ class Wolf2D_Project(Project):
|
|
175
175
|
palsarrays = self.get_group('palette-array')
|
176
176
|
if palsarrays is not None:
|
177
177
|
for curid, curname in palsarrays.items():
|
178
|
-
if curname[
|
178
|
+
if curname[key_Param.VALUE] in self.set_colormap.keys():
|
179
179
|
if curid in self.mysims.keys():
|
180
180
|
curarray = self.mysims[curid]
|
181
|
-
mypal = self.mycolormaps[curname[
|
181
|
+
mypal = self.mycolormaps[curname[key_Param.VALUE]]
|
182
182
|
curarray.mypal = mypal
|
183
183
|
curarray.mypal.automatic = False
|
184
184
|
|
wolfhece/pylogging.py
CHANGED
@@ -58,7 +58,7 @@ def create_wxlogwindow(winTitle='Log') -> wx.LogWindow:
|
|
58
58
|
logging.getLogger().addHandler(log_bridge_handler)
|
59
59
|
|
60
60
|
# Set some logging level, just to show up.
|
61
|
-
logging.getLogger().setLevel(logging.
|
61
|
+
logging.getLogger().setLevel(logging.INFO)
|
62
62
|
log_bridge_handler.setLevel(logging.INFO)
|
63
63
|
wx.Log.SetVerbose(True)
|
64
64
|
|
wolfhece/pyshields.py
CHANGED
@@ -2,13 +2,15 @@ import matplotlib.pyplot as plt
|
|
2
2
|
import math
|
3
3
|
import numpy as np
|
4
4
|
from scipy.optimize import root_scalar
|
5
|
+
from typing import Literal
|
6
|
+
import logging
|
5
7
|
|
6
8
|
from .friction_law import f_barr_bathurst
|
7
9
|
|
8
|
-
RHO_PUREWATER = 1000
|
9
|
-
RHO_SEAWATER = 1025
|
10
|
-
KIN_VISCOSITY = 1.e-6
|
11
|
-
GRAVITY = 9.81
|
10
|
+
RHO_PUREWATER = 1000. # kg/m3
|
11
|
+
RHO_SEAWATER = 1025. # kg/m3
|
12
|
+
KIN_VISCOSITY = 1.e-6 # m2/s
|
13
|
+
GRAVITY = 9.81 # m/s2
|
12
14
|
|
13
15
|
BED_LOAD=1
|
14
16
|
SUSPENDED_LOAD_50=2
|
@@ -78,7 +80,7 @@ Autres :
|
|
78
80
|
|
79
81
|
"""
|
80
82
|
|
81
|
-
def get_sadim(d,rhom=2650
|
83
|
+
def get_sadim(d:float, rhom:float =2650., rho:float =RHO_PUREWATER) -> float:
|
82
84
|
"""
|
83
85
|
s_adim = d**(3/2) * ((s-1) * g)**.5 / (4 * nu)
|
84
86
|
|
@@ -87,18 +89,18 @@ def get_sadim(d,rhom=2650,rho=RHO_PUREWATER):
|
|
87
89
|
s=rhom/rho
|
88
90
|
return d**(3./2.) * ((s-1) * GRAVITY)**.5 / (4 * KIN_VISCOSITY)
|
89
91
|
|
90
|
-
def get_dstar(d,rhom=2650.,rho=RHO_PUREWATER):
|
91
|
-
|
92
|
+
def get_dstar(d:float, rhom:float =2650., rho:float=RHO_PUREWATER) -> float:
|
93
|
+
""" compute d* """
|
92
94
|
s = rhom/rho
|
93
95
|
return d*(GRAVITY*(s-1)/KIN_VISCOSITY**2)**(1./3.) #VanRijn Formula
|
94
96
|
|
95
|
-
def sadim2dstar(sadim):
|
97
|
+
def sadim2dstar(sadim:float) -> float:
|
96
98
|
return (4*sadim)**(2/3)
|
97
99
|
|
98
|
-
def dstar2sadim(dstar):
|
100
|
+
def dstar2sadim(dstar:float) -> float:
|
99
101
|
return dstar**(3./2.) / 4
|
100
102
|
|
101
|
-
def get_d_from_sadim(sadim,rhom=2650
|
103
|
+
def get_d_from_sadim(sadim:float, rhom:float=2650., rho:float=RHO_PUREWATER) -> float:
|
102
104
|
"""
|
103
105
|
s_adim = d**(3/2) * ((s-1) * g)**.5 / (4 * nu)
|
104
106
|
|
@@ -107,7 +109,7 @@ def get_d_from_sadim(sadim,rhom=2650,rho=RHO_PUREWATER):
|
|
107
109
|
s=rhom/rho
|
108
110
|
return (sadim*(4*KIN_VISCOSITY)/math.sqrt((s-1)*GRAVITY))**(2/3)
|
109
111
|
|
110
|
-
def get_d_from_dstar(dstar,rhom=2650
|
112
|
+
def get_d_from_dstar(dstar:float, rhom:float=2650., rho:float=RHO_PUREWATER) -> float:
|
111
113
|
"""
|
112
114
|
d_star = d * (g * (s-1) / nu**2)**(1/3)
|
113
115
|
|
@@ -116,7 +118,7 @@ def get_d_from_dstar(dstar,rhom=2650,rho=RHO_PUREWATER):
|
|
116
118
|
s=rhom/rho
|
117
119
|
return dstar / (GRAVITY*(s-1)/KIN_VISCOSITY**2)**(1./3.)
|
118
120
|
|
119
|
-
def get_psi_cr(s_adim):
|
121
|
+
def get_psi_cr(s_adim:float) -> float:
|
120
122
|
"""
|
121
123
|
https://nl.mathworks.com/matlabcentral/fileexchange/97447-modified-shields-diagram-and-criterion?tab=reviews
|
122
124
|
"""
|
@@ -130,7 +132,7 @@ def get_psi_cr(s_adim):
|
|
130
132
|
|
131
133
|
return psicr
|
132
134
|
|
133
|
-
def get_psi_cr2(dstar):
|
135
|
+
def get_psi_cr2(dstar:float) -> float:
|
134
136
|
"""
|
135
137
|
http://docs.opentelemac.org/doxydocs/v8p2r0/html/shields_8f_source.html
|
136
138
|
"""
|
@@ -146,7 +148,7 @@ def get_psi_cr2(dstar):
|
|
146
148
|
psicr= 0.045
|
147
149
|
return psicr
|
148
150
|
|
149
|
-
def get_psi_cr3(dstar):
|
151
|
+
def get_psi_cr3(dstar:float) -> float:
|
150
152
|
"""
|
151
153
|
Fluvial Processes, IAHR 2001, pp 6-9
|
152
154
|
"""
|
@@ -154,81 +156,85 @@ def get_psi_cr3(dstar):
|
|
154
156
|
psicr = 0.13*dstar**-0.392*math.exp(-0.015*dstar**2.)+0.045*(1-math.exp(-0.068*dstar))
|
155
157
|
return psicr
|
156
158
|
|
157
|
-
def get_shields_cr(d,rhom=2650.,rho=RHO_PUREWATER,which=2):
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
critical_shear_velocity =
|
163
|
-
0.012649
|
164
|
-
taocr =
|
165
|
-
0.16399
|
166
|
-
"""
|
159
|
+
# def get_shields_cr(d, rhom=2650., rho=RHO_PUREWATER, which=2):
|
160
|
+
# """
|
161
|
+
# Example:
|
162
|
+
# [critical_shear_velocity, tau_cr,xadim_val, psicr] = get_shields_cr(0.2E-3, 2650)
|
163
|
+
# """
|
167
164
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
165
|
+
# funcs = [(get_sadim,get_psi_cr),(get_dstar,get_psi_cr2),(get_dstar,get_psi_cr3)]
|
166
|
+
# # % Getting the sediment-fluid parameter
|
167
|
+
# s = rhom/rho # [-]
|
168
|
+
# denom_shields= (s-1)*GRAVITY*d # [m²/s²] en réalité denom/rho
|
172
169
|
|
173
|
-
|
174
|
-
|
170
|
+
# xadim_val = funcs[which][0](d,rhom,rho)
|
171
|
+
# psicr = funcs[which][1](xadim_val)
|
175
172
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
173
|
+
# # Using the critical value of Shields parameter
|
174
|
+
# # Knowing the maximum bottom shear stress
|
175
|
+
# tau_cr = rho * denom_shields * psicr # Pa
|
176
|
+
# critical_shear_velocity = math.sqrt(denom_shields * psicr) # m/s
|
180
177
|
|
181
|
-
|
178
|
+
# return [critical_shear_velocity, tau_cr,xadim_val, psicr]
|
182
179
|
|
183
|
-
def _poly(x):
|
184
|
-
|
180
|
+
def _poly(x:float) -> float:
|
181
|
+
return ((0.002235*x**5)-(0.06043*x**4)+(0.20307*x**3)+ \
|
185
182
|
(0.054252*x**2)-(0.636397*x)-1.03167)
|
186
183
|
|
187
|
-
def _dpolydx(x):
|
188
|
-
|
184
|
+
def _dpolydx(x:float) -> float:
|
185
|
+
""" derivative of _poly """
|
186
|
+
return ((0.002235*5*x**4)-(0.06043*4*x**3)+(0.20307*3*x**2)+ \
|
189
187
|
(0.054252*2*x)-(0.636397))
|
190
188
|
|
191
|
-
def get_sadim_min():
|
192
|
-
return root_scalar(_dpolydx,method='bisect',bracket=[10, 20]).root
|
189
|
+
def get_sadim_min() -> float:
|
190
|
+
return root_scalar(_dpolydx, method='bisect', bracket=[10, 20]).root
|
193
191
|
|
194
|
-
def get_tau_from_psiadim(psiadim,d,rhom=2650,rho=RHO_PUREWATER):
|
192
|
+
def get_tau_from_psiadim(psiadim, d:float, rhom:float=2650, rho:float=RHO_PUREWATER) -> float:
|
195
193
|
s=rhom/rho
|
196
194
|
denom_shields= (s-1)*GRAVITY*d ## en réalité denom/rho
|
197
195
|
return rho * denom_shields * psiadim
|
198
196
|
|
199
|
-
def get_d_min(rhom=2650
|
197
|
+
def get_d_min(rhom:float=2650., rho:float=RHO_PUREWATER) -> float:
|
200
198
|
return get_d_from_sadim(get_sadim_min(),rhom,rho)
|
201
199
|
|
202
|
-
def _d_cr(x,tau_obj,rhom,rho,xadim,yadim):
|
203
|
-
|
200
|
+
def _d_cr(x:float, tau_obj:float, rhom:float, rho:float, xadim:float, yadim:float) -> float:
|
201
|
+
""" Equation to solve to get d_cr """
|
204
202
|
s=rhom/rho
|
205
203
|
denom_shields= (s-1)*GRAVITY*x ## en réalité denom/rho
|
206
204
|
psi_obj = tau_obj/denom_shields/rho
|
207
205
|
psi_cr=yadim(xadim(x,rhom,rho))
|
208
206
|
return psi_obj-psi_cr
|
209
207
|
|
210
|
-
def _get_d_cr(tau_cr,rhom=2650,rho=RHO_PUREWATER):
|
208
|
+
# def _get_d_cr(tau_cr,rhom=2650,rho=RHO_PUREWATER):
|
211
209
|
|
212
|
-
|
213
|
-
|
214
|
-
|
210
|
+
# dminabs = 1.e-6
|
211
|
+
# dmaxabs = .5
|
212
|
+
# d_cr = root_scalar(_d_cr,(tau_cr,rhom,rho,get_sadim,get_psi_cr),'bisect',bracket=[dminabs, dmaxabs])
|
215
213
|
|
216
|
-
|
214
|
+
# return d_cr
|
217
215
|
|
218
|
-
def get_d_cr(q,h,K,rhom=2650
|
216
|
+
def get_d_cr(q:float, h:float, K:float, rhom:float=2650., rho:float=RHO_PUREWATER, method='brenth', which=2) -> list[float]:
|
219
217
|
"""
|
220
218
|
Diamètre critique d'emportement par :
|
221
219
|
- Shields
|
222
220
|
- Izbach
|
221
|
+
|
222
|
+
@param q : discharge [m3/s]
|
223
|
+
@param h : water depth [m]
|
224
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
225
|
+
@param rhom : sediment density [kg/m3]
|
226
|
+
@param rho : water density [kg/m3]
|
227
|
+
@param method : method to solve the equation (default 'brenth')
|
228
|
+
@param which : which formula to use (default 2) -- see funcs = [(get_sadim,get_psi_cr),(get_dstar,get_psi_cr2),(get_dstar,get_psi_cr3)]
|
223
229
|
"""
|
224
230
|
if q==0.:
|
225
231
|
return 0.,0.
|
226
232
|
|
227
|
-
tau_cr = (q/K)**2 / h**(7/3) * rho * GRAVITY
|
233
|
+
tau_cr = (q/K)**2 / h**(7/3) * rho * GRAVITY # rho*g*h*J
|
228
234
|
dminabs = 1.e-100
|
229
235
|
dmaxabs = 20
|
230
236
|
|
231
|
-
funcs = [(get_sadim,get_psi_cr),(get_dstar,get_psi_cr2),(get_dstar,get_psi_cr3)]
|
237
|
+
funcs = [(get_sadim, get_psi_cr),(get_dstar, get_psi_cr2),(get_dstar, get_psi_cr3)]
|
232
238
|
|
233
239
|
try:
|
234
240
|
d_cr = root_scalar(_d_cr,(tau_cr,rhom,rho,funcs[which][0],funcs[which][1]),method,bracket=[dminabs, dmaxabs],rtol = 1e-2)
|
@@ -237,17 +243,28 @@ def get_d_cr(q,h,K,rhom=2650,rho=RHO_PUREWATER,method='brenth',which=2):
|
|
237
243
|
izbach = izbach_d_cr(q,h,rhom,rho)
|
238
244
|
return izbach,izbach
|
239
245
|
|
240
|
-
def get_settling_vel(d,rhom=2650
|
246
|
+
def get_settling_vel(d:float, rhom:float=2650., rho:float=RHO_PUREWATER) -> float:
|
241
247
|
"""
|
242
248
|
Vitesse de chute
|
249
|
+
|
250
|
+
@param d : grain diameter [m]
|
251
|
+
@param rhom : sediment density [kg/m3]
|
252
|
+
@param rho : water density [kg/m3]
|
243
253
|
"""
|
244
254
|
dstar = get_dstar(d,rhom,rho)
|
245
255
|
ws = KIN_VISCOSITY/d*(math.sqrt(25+1.2*dstar**2.)-5)**(3./2.)
|
246
256
|
return ws
|
247
257
|
|
248
|
-
def get_Rouse(d,q,h,K,rhom=2650
|
258
|
+
def get_Rouse(d:float, q:float, h:float, K:float, rhom:float=2650., rho:float=RHO_PUREWATER) -> float:
|
249
259
|
"""
|
250
260
|
Vitesse de chute
|
261
|
+
|
262
|
+
@param d : grain diameter [m]
|
263
|
+
@param q : discharge [m3/s]
|
264
|
+
@param h : water depth [m]
|
265
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
266
|
+
@param rhom : sediment density [kg/m3]
|
267
|
+
@param rho : water density [kg/m3]
|
251
268
|
"""
|
252
269
|
# tau_cr = (q/K)**2 / h**(7/3) * rho * GRAVITY
|
253
270
|
# shear_vel = math.sqrt(tau_cr/rho)
|
@@ -258,9 +275,16 @@ def get_Rouse(d,q,h,K,rhom=2650,rho=RHO_PUREWATER):
|
|
258
275
|
|
259
276
|
return ws/(k*shear_vel)
|
260
277
|
|
261
|
-
def _get_Rouse(d,q,h,K,rhom=2650
|
278
|
+
def _get_Rouse(d:float, q:float, h:float, K:float, rhom:float=2650., rho:float=RHO_PUREWATER, frac:float=50) -> float:
|
262
279
|
"""
|
263
|
-
|
280
|
+
Settling velocity function -- used in root_scalar
|
281
|
+
|
282
|
+
@param d : grain diameter [m]
|
283
|
+
@param q : discharge [m3/s]
|
284
|
+
@param h : water depth [m]
|
285
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
286
|
+
@param rhom : sediment density [kg/m3]
|
287
|
+
@param rho : water density [kg/m3]
|
264
288
|
"""
|
265
289
|
# tau_cr = (q/K)**2 / h**(7/3) * rho * GRAVITY
|
266
290
|
# shear_vel = math.sqrt(tau_cr/rho)
|
@@ -279,7 +303,20 @@ def _get_Rouse(d,q,h,K,rhom=2650,rho=RHO_PUREWATER,frac=50):
|
|
279
303
|
elif frac==100:
|
280
304
|
return rouse-1.2
|
281
305
|
|
282
|
-
def get_transport_mode(d,q,h,K,rhom=2650
|
306
|
+
def get_transport_mode(d:float, q:float, h:float, K:float, rhom:float=2650., rho:float=RHO_PUREWATER) -> BED_LOAD | SUSPENDED_LOAD_50 | SUSPENDED_LOAD_100 | WASH_LOAD:
|
307
|
+
"""
|
308
|
+
Transport mode
|
309
|
+
|
310
|
+
return in [BED_LOAD, SUSPENDED_LOAD_50, SUSPENDED_LOAD_100, WASH_LOAD]
|
311
|
+
|
312
|
+
@param d : grain diameter [m]
|
313
|
+
@param q : discharge [m3/s]
|
314
|
+
@param h : water depth [m]
|
315
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
316
|
+
@param rhom : sediment density [kg/m3]
|
317
|
+
@param rho : water density [kg/m3]
|
318
|
+
|
319
|
+
"""
|
283
320
|
|
284
321
|
rouse = get_Rouse(d,q,h,K,rhom,rho)
|
285
322
|
if rouse>=2.5:
|
@@ -291,9 +328,16 @@ def get_transport_mode(d,q,h,K,rhom=2650,rho=RHO_PUREWATER):
|
|
291
328
|
else:
|
292
329
|
return WASH_LOAD
|
293
330
|
|
294
|
-
def get_d_cr_susp(q,h,K,rhom=2650
|
331
|
+
def get_d_cr_susp(q:float, h:float, K:float, rhom:float=2650., rho:float=RHO_PUREWATER, method='brenth', which=50) -> float:
|
295
332
|
"""
|
296
333
|
Diamètre critique d'emportement par suspension à 50% --> cf Rouse 1.2
|
334
|
+
|
335
|
+
@param q : discharge [m3/s]
|
336
|
+
@param h : water depth [m]
|
337
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
338
|
+
@param rhom : sediment density [kg/m3]
|
339
|
+
@param rho : water density [kg/m3]
|
340
|
+
|
297
341
|
"""
|
298
342
|
if q==0.:
|
299
343
|
return 0.
|
@@ -306,7 +350,8 @@ def get_d_cr_susp(q,h,K,rhom=2650,rho=RHO_PUREWATER,method='brenth',which=50):
|
|
306
350
|
except:
|
307
351
|
return 0.
|
308
352
|
|
309
|
-
def shieldsdia_sadim(s_psicr=None,dstar_psicr=None,rhom=2650
|
353
|
+
def shieldsdia_sadim(s_psicr=None, dstar_psicr=None, rhom=2650., rho=RHO_PUREWATER, figax=None) -> [plt.Figure,plt.Axes]:
|
354
|
+
""" Plot Shields diagram with sadim"""
|
310
355
|
|
311
356
|
smax = 1000
|
312
357
|
rangoS = np.arange(0.1,smax,0.1)
|
@@ -361,7 +406,8 @@ def shieldsdia_sadim(s_psicr=None,dstar_psicr=None,rhom=2650,rho=RHO_PUREWATER,f
|
|
361
406
|
|
362
407
|
return fig,ax
|
363
408
|
|
364
|
-
def shieldsdia_dstar(s_psicr=None,dstar_psicr=None,rhom=2650
|
409
|
+
def shieldsdia_dstar(s_psicr=None, dstar_psicr=None, rhom=2650., rho=RHO_PUREWATER, figax=None) -> [plt.Figure,plt.Axes]:
|
410
|
+
""" Plot Shields diagram with dstar"""
|
365
411
|
|
366
412
|
smax = 1000
|
367
413
|
d_stars = np.arange(0.1,smax,0.1)
|
@@ -419,7 +465,9 @@ def shieldsdia_dstar(s_psicr=None,dstar_psicr=None,rhom=2650,rho=RHO_PUREWATER,f
|
|
419
465
|
|
420
466
|
return fig,ax
|
421
467
|
|
422
|
-
def shieldsdia_dim(figax=None):
|
468
|
+
def shieldsdia_dim(figax=None) -> [plt.Figure,plt.Axes]:
|
469
|
+
""" Plot Shields diagram with dimensional values"""
|
470
|
+
|
423
471
|
smax=1e6
|
424
472
|
rangoS = np.concatenate([np.arange(0.1,300,0.1),np.arange(300.,smax,5.)])
|
425
473
|
psicri = np.asarray([get_psi_cr(curx) for curx in rangoS])
|
@@ -455,85 +503,25 @@ def shieldsdia_dim(figax=None):
|
|
455
503
|
|
456
504
|
return fig,ax
|
457
505
|
|
458
|
-
def
|
506
|
+
def get_Shields_2D_Manning(s:float, d:float, q:float, h:float, K:float) -> float:
|
459
507
|
"""
|
508
|
+
Compute Shields dimensionless parameter for 2D flow with Manning friction law
|
509
|
+
|
510
|
+
@param s : sediment density / water density [-]
|
511
|
+
@param d : sediment diameter [m]
|
512
|
+
@param q : discharge [m3/s]
|
513
|
+
@param h : water depth [m]
|
514
|
+
@param K : Strickler friction coefficient [m1/3/s]
|
460
515
|
"""
|
461
516
|
# calcul de terme de pente de frottement
|
462
|
-
if which_law == 'Manning':
|
463
|
-
j = (q_abs/h/k_rough)**2.0 / h**(7./3.)
|
464
|
-
elif which_law == 'Barr_Bathurst':
|
465
|
-
k_sur_h = k_rough/(4.0*h)
|
466
|
-
Reynolds = 4.0 * q_abs /KIN_VISCOSITY # u*4h/nu == 4q/nu
|
467
|
-
j = f_barr_bathurst(k_sur_h,Reynolds)/(4.0*h) * (q_abs/h)**2.0/2.0/GRAVITY
|
468
517
|
|
469
|
-
|
518
|
+
j = (q/h)**2.0 / K**2. / h**(4./3.)
|
470
519
|
|
471
|
-
|
472
|
-
# shields = tau / (rho_s - rho_w) /g /d
|
473
|
-
# tau = f/8 * rho_w * u**2
|
520
|
+
shields = j*h / (d*(s-1))
|
474
521
|
|
475
522
|
return shields
|
476
523
|
|
477
|
-
def
|
478
|
-
"""
|
479
|
-
Calcul du diamètre de grain emporté par une approche basée sur une tension efficace
|
480
|
-
|
481
|
-
Portage du code de calcul de WOLF2D
|
482
|
-
@authors : Pierre Archambeau (2022)
|
483
|
-
"""
|
484
|
-
|
485
|
-
#if which_friction_law#=rough_Barr_Bathurst:
|
486
|
-
##les autres lois de frottement ne sont pas implémentées mais aucune difficulté particulière
|
487
|
-
##ne devraient empêcher cela
|
488
|
-
|
489
|
-
my_exp = [0.0, 0.10, 0.20, 0.30, 0.40, 0.420, 0.440, 0.460, 0.480,
|
490
|
-
0.50, 0.52, 0.54, 0.56, 0.58,
|
491
|
-
0.6, 0.62, 0.64, 0.66, 0.68,
|
492
|
-
0.7, 0.71, 0.72, 0.73, 0.74, 0.75]
|
493
|
-
|
494
|
-
##calcul du coefficient de frottement (point de vue de l'écoulement)
|
495
|
-
u_abs = q_abs/h
|
496
|
-
Reynolds = q_abs * 4 / KIN_VISCOSITY
|
497
|
-
k_sur_h = k_rough/(4*h)
|
498
|
-
f_flow = f_barr_bathurst(k_sur_h,Reynolds)
|
499
|
-
|
500
|
-
#valeur initiale (pas de tension efficace)
|
501
|
-
exp = my_exp[0]
|
502
|
-
d = f_flow**(1-exp)*u_abs**2/(8*(s-1)*GRAVITY*theta_cr)
|
503
|
-
#boucle pour approcher les exposants requis
|
504
|
-
for cur_exponent in range(1,25):
|
505
|
-
exp = my_exp[cur_exponent]
|
506
|
-
#partie constante du rapport d = lamda'^(3/4)*lambda^(1/4)*U^2/8/(s-1)/g/theta_cr
|
507
|
-
cst = f_flow**(1-exp)*u_abs**2/(8*(s-1)*GRAVITY*theta_cr)
|
508
|
-
#boucle pour converger sur un diamètre qui respecte l'égalité
|
509
|
-
k_sur_h = d/(4*h)
|
510
|
-
f_grain = f_barr_bathurst(k_sur_h,Reynolds)
|
511
|
-
f_obj = d-f_grain**exp*cst
|
512
|
-
nb_ite = 0
|
513
|
-
while abs(f_obj) > 1.e-6 and nb_ite < 20:
|
514
|
-
#calcul de la dérivée numérique
|
515
|
-
k_sur_h = (d+1.e-6)/(4*h)
|
516
|
-
f_pert1 = f_barr_bathurst(k_sur_h,Reynolds)
|
517
|
-
k_sur_h = (d-1.e-6)/(4*h)
|
518
|
-
f_pert2 = f_barr_bathurst(k_sur_h,Reynolds)
|
519
|
-
dfdd = 1-cst*exp*f_grain**(exp-1)*(f_pert1-f_pert2)/2.e-6
|
520
|
-
frac = f_obj/dfdd
|
521
|
-
#modifiation de d
|
522
|
-
if abs(frac) > 0.5*d:
|
523
|
-
if frac>0:
|
524
|
-
frac = 0.5*d
|
525
|
-
else:
|
526
|
-
frac = -0.5*d
|
527
|
-
d = d - frac
|
528
|
-
#calcul de la nouvelle donction objectif
|
529
|
-
k_sur_h = d/(4*h)
|
530
|
-
f_grain = f_barr_bathurst(k_sur_h,Reynolds)
|
531
|
-
f_obj = d-f_grain**exp*cst
|
532
|
-
nb_ite = nb_ite + 1
|
533
|
-
|
534
|
-
return d
|
535
|
-
|
536
|
-
def izbach_d_cr(q,h,rhom=2650,rho=RHO_PUREWATER,method='ridder'):
|
524
|
+
def izbach_d_cr(q:float, h:float, rhom:float=2650, rho:float=RHO_PUREWATER, method='ridder') -> float:
|
537
525
|
"""
|
538
526
|
https://en.wikipedia.org/wiki/Izbash_formula
|
539
527
|
|
@@ -546,9 +534,98 @@ def izbach_d_cr(q,h,rhom=2650,rho=RHO_PUREWATER,method='ridder'):
|
|
546
534
|
--> d = u_c**2 / (s * g) / 1.7**2
|
547
535
|
|
548
536
|
--> d = (0.85 * q/h)**2 / (s * g) / 1.7**2
|
537
|
+
|
538
|
+
@param q : discharge [m3/s]
|
539
|
+
@param h : water depth [m]
|
540
|
+
@param rhom : sediment density [kg/m3]
|
541
|
+
@param rho : water density [kg/m3]
|
542
|
+
@param method : method to solve the equation (default 'ridder')
|
549
543
|
"""
|
550
544
|
s = rhom/rho
|
551
|
-
#
|
552
|
-
#
|
553
|
-
#
|
545
|
+
# (0.85 * q/h)**2. / ((s-1.) * GRAVITY) / 1.7**2.
|
546
|
+
# <=> 0.7 * (0.85*q/h)**2. / (2 * GRAVITY) / (s-1.)
|
547
|
+
# <=> (q/h)**2. / (2 * GRAVITY) / (s-1.) / .86**2
|
554
548
|
return (q/h)**2. / (2 * GRAVITY) / (s-1.) / 1.2**2
|
549
|
+
|
550
|
+
|
551
|
+
## Portage de WOLF2D - Fortran pour Barr-Bathurst
|
552
|
+
|
553
|
+
# def get_Shields_2D_pw(s:float, d:float, q_abs:float, h:float, k_rough:float, which_law = 'Manning'):
|
554
|
+
# """
|
555
|
+
# """
|
556
|
+
# # calcul de terme de pente de frottement
|
557
|
+
# if which_law == 'Manning':
|
558
|
+
|
559
|
+
# j = (q_abs/h)**2.0 / k_rough**2. / h**(4./3.)
|
560
|
+
|
561
|
+
# elif which_law == 'Barr_Bathurst':
|
562
|
+
# k_sur_h = k_rough/(4.0*h)
|
563
|
+
# Reynolds = 4.0 * q_abs /KIN_VISCOSITY # u*4h/nu == 4q/nu
|
564
|
+
# j = f_barr_bathurst(k_sur_h,Reynolds)/(4.0*h) * (q_abs/h)**2.0/2.0/GRAVITY
|
565
|
+
|
566
|
+
# shields = j*h / (d*(s-1))
|
567
|
+
|
568
|
+
# # shields = f/4 * u**2 /2 /g /(d * (rho_s-rho_w) / rho_w)
|
569
|
+
# # shields = tau / (rho_s - rho_w) /g /d
|
570
|
+
# # tau = f/8 * rho_w * u**2
|
571
|
+
|
572
|
+
# return shields
|
573
|
+
|
574
|
+
# def get_effective_d_2D(s:float, theta_cr:float, q_abs:float, h:float, k_rough:float):
|
575
|
+
# """
|
576
|
+
# Calcul du diamètre de grain emporté par une approche basée sur une tension efficace
|
577
|
+
|
578
|
+
# Portage du code de calcul de WOLF2D
|
579
|
+
# @authors : Pierre Archambeau (2022)
|
580
|
+
# """
|
581
|
+
|
582
|
+
# #if which_friction_law#=rough_Barr_Bathurst:
|
583
|
+
# ##les autres lois de frottement ne sont pas implémentées mais aucune difficulté particulière
|
584
|
+
# ##ne devraient empêcher cela
|
585
|
+
|
586
|
+
# my_exp = [0.0, 0.10, 0.20, 0.30, 0.40, 0.420, 0.440, 0.460, 0.480,
|
587
|
+
# 0.50, 0.52, 0.54, 0.56, 0.58,
|
588
|
+
# 0.6, 0.62, 0.64, 0.66, 0.68,
|
589
|
+
# 0.7, 0.71, 0.72, 0.73, 0.74, 0.75]
|
590
|
+
|
591
|
+
# ##calcul du coefficient de frottement (point de vue de l'écoulement)
|
592
|
+
# u_abs = q_abs/h
|
593
|
+
# Reynolds = q_abs * 4 / KIN_VISCOSITY
|
594
|
+
# k_sur_h = k_rough/(4*h)
|
595
|
+
# f_flow = f_barr_bathurst(k_sur_h,Reynolds)
|
596
|
+
|
597
|
+
# #valeur initiale (pas de tension efficace)
|
598
|
+
# exp = my_exp[0]
|
599
|
+
# d = f_flow**(1-exp)*u_abs**2/(8*(s-1)*GRAVITY*theta_cr)
|
600
|
+
# #boucle pour approcher les exposants requis
|
601
|
+
# for cur_exponent in range(1,25):
|
602
|
+
# exp = my_exp[cur_exponent]
|
603
|
+
# #partie constante du rapport d = lamda'^(3/4)*lambda^(1/4)*U^2/8/(s-1)/g/theta_cr
|
604
|
+
# cst = f_flow**(1-exp)*u_abs**2/(8*(s-1)*GRAVITY*theta_cr)
|
605
|
+
# #boucle pour converger sur un diamètre qui respecte l'égalité
|
606
|
+
# k_sur_h = d/(4*h)
|
607
|
+
# f_grain = f_barr_bathurst(k_sur_h,Reynolds)
|
608
|
+
# f_obj = d-f_grain**exp*cst
|
609
|
+
# nb_ite = 0
|
610
|
+
# while abs(f_obj) > 1.e-6 and nb_ite < 20:
|
611
|
+
# #calcul de la dérivée numérique
|
612
|
+
# k_sur_h = (d+1.e-6)/(4*h)
|
613
|
+
# f_pert1 = f_barr_bathurst(k_sur_h,Reynolds)
|
614
|
+
# k_sur_h = (d-1.e-6)/(4*h)
|
615
|
+
# f_pert2 = f_barr_bathurst(k_sur_h,Reynolds)
|
616
|
+
# dfdd = 1-cst*exp*f_grain**(exp-1)*(f_pert1-f_pert2)/2.e-6
|
617
|
+
# frac = f_obj/dfdd
|
618
|
+
# #modifiation de d
|
619
|
+
# if abs(frac) > 0.5*d:
|
620
|
+
# if frac>0:
|
621
|
+
# frac = 0.5*d
|
622
|
+
# else:
|
623
|
+
# frac = -0.5*d
|
624
|
+
# d = d - frac
|
625
|
+
# #calcul de la nouvelle donction objectif
|
626
|
+
# k_sur_h = d/(4*h)
|
627
|
+
# f_grain = f_barr_bathurst(k_sur_h,Reynolds)
|
628
|
+
# f_obj = d-f_grain**exp*cst
|
629
|
+
# nb_ite = nb_ite + 1
|
630
|
+
|
631
|
+
# return d
|