-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuns_dikes.py
68 lines (51 loc) · 1.65 KB
/
funs_dikes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
Created on Thu Jul 06 14:51:04 2017
@author: ciullo
"""
import numpy as np
def dikefailure(
sb, inflow, hriver, hbas, hground, status_t1, Bmax, Brate, simtime, tbreach, critWL
):
"""Function establising dike failure as well as flow balance between the
river and the polder
inflow = flow coming into the node
status = if False the dike has not failed yet
critWL = water level above which we have failure
"""
tbr = tbreach
# h1 = hriver - hbreach
# h2 = (hbas + hground) - hbreach
# h river is a water level, hbas a water depth
h1 = hriver - (hground + hbas)
# if the dike has already failed:
if status_t1 == True:
B = Bmax * (1 - np.exp(-Brate * (simtime - tbreach)))
if h1 > 0:
breachflow = 1.7 * B * (h1) ** 1.5
# h1 <0 ==> no flow:
else:
breachflow = 0
outflow = max(0, inflow - breachflow)
status_t2 = status_t1
# if the dike has not failed yet:
else:
failure = hriver > critWL
outflow = inflow
breachflow = 0
# if it fails:
if failure:
status_t2 = True
tbr = simtime
# if it does not:
else:
status_t2 = False
# if effects of hydrodynamic system behaviour have to be ignored:
if sb == False:
outflow = inflow
return outflow, breachflow, status_t2, tbr
def Lookuplin(MyFile, inputcol, searchcol, inputvalue):
"""Linear lookup function"""
return np.interp(inputvalue, MyFile[:, inputcol], MyFile[:, searchcol])
def init_node(value, time):
init = np.repeat(value, len(time)).tolist()
return init