Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing warm start and updating reference results for MCT #182

Open
wants to merge 10 commits into
base: feature/mct_optim
Choose a base branch
from
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions src/lisflood/global_modules/default_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,17 +681,17 @@
yearly=False),
'PrevCmMCTEnd': ReportedMap(name='PrevCmMCTEnd', output_var='PrevCm0', unit='-',
end=['repEndMaps'], steps=[], all=[],
restrictoption=[], monthly=False, yearly=False),
restrictoption=['nonInit','MCTRouting'], monthly=False, yearly=False),
'PrevCmMCTState': ReportedMap(name='PrevCmMCTState', output_var='PrevCm0', unit='-',
end=[], steps=['repStateMaps'], all=[],
restrictoption=['nonInit'], monthly=False,
restrictoption=['nonInit','MCTRouting'], monthly=False,
yearly=False),
'PrevDmMCTEnd': ReportedMap(name='PrevDmMCTEnd', output_var='PrevDm0', unit='-',
end=['repEndMaps'], steps=[], all=[],
restrictoption=[], monthly=False, yearly=False),
restrictoption=['nonInit','MCTRouting'], monthly=False, yearly=False),
'PrevDmMCTState': ReportedMap(name='PrevDmMCTState', output_var='PrevDm0', unit='-',
end=[], steps=['repStateMaps'], all=[],
restrictoption=['nonInit'], monthly=False,
restrictoption=['nonInit','MCTRouting'], monthly=False,
yearly=False),
'PolderLevelEnd': ReportedMap(name='PolderLevelEnd', output_var='PolderLevel',
unit='m', end=['repEndMaps'], steps=[],
Expand Down
7 changes: 5 additions & 2 deletions src/lisflood/hydrological_modules/evapowater.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ def dynamic(self):
UpstreamEva = self.var.EWRef * self.var.MMtoM3 * self.var.WaterFraction
# evaporation for loop is amount of water per timestep [cu m]
# Volume of potential evaporation from water surface per time step (conversion to [m3])
# ChanMIter = self.var.ChanM3Kin.copy()
ChanMIter = self.var.ChanM3.copy()

#ChanMIter = self.var.ChanM3Kin.copy()
# for Iteration loop: First value is amount of water in the channel
# amount of water in bankful (first line of routing)
ChanMIter = self.var.ChanM3.copy()

ChanLeft = ChanMIter * 0.1
# 10% of the volume must stay in the river
Expand All @@ -157,6 +159,7 @@ def dynamic(self):

self.var.EvaAddM3Dt = self.var.EvaAddM3 * self.var.InvNoRoutSteps
# splitting water use per timestep into water use per sub time step

self.var.EvaCumM3 += self.var.EvaAddM3
self.var.EvaWBM3 = self.var.EvaAddM3
# summing up for water balance calculation
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def solve1Pixel(
# If old discharge, upstream inflow and lateral inflow are below accuracy: set discharge to 0 and exit
if upstream_inflow <= NEWTON_TOL:
discharge[pix] = 0
return False
return True

# Initial discharge guess using analytically derived boundary values
a_cpui_pow_b_m_1 = b_a_dx_div_dt * upstream_inflow**b_minus_1
Expand All @@ -125,7 +125,7 @@ def solve1Pixel(
# If iterations converge to NEWTON_TOL, set value to 0
if dis == NEWTON_TOL:
discharge[pix] = 0
return False
return True

discharge[pix] = dis
return True
Expand Down Expand Up @@ -164,6 +164,7 @@ def solve1PixelAvg(
# integration on control volume to calc average outflow (channel water mass balance)
discharge_avg[pix] = upstream_inflow_avg + lateral_inflow + a_dx*(channel_volume_start - channel_volume_end) * inv_time_delta


# avoid negative average discharge
if discharge_avg[pix] < 0:
discharge_avg[pix] = 0
Expand Down
5 changes: 4 additions & 1 deletion src/lisflood/hydrological_modules/mct.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def MCTRouting_single(
Dm1: Reynolds number at t+1 for state file
"""

eps = 1e-06
eps = 1e-12

# Calc O' first guess for the outflow at time t+dt
# O'(t+dt)=O(t)+(I(t+dt)-I(t))
Expand Down Expand Up @@ -336,6 +336,9 @@ def MCTRouting_single(
# q1m cannot be smaller than eps or it will cause instability
if q1mm < eps:
q1mm = eps
if ql < 0: ql = 0
# prevent water abstraction or open water evaporation from drying out the channel and keep extracting water
# NOTE THIS GENERATES AN ERROR IN THE WATER BALANCE
V11 = V00 + (q0mm + ql - q1mm) * dt

# q11 Outflow at O(t+dt)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Fri Dec 6 17:31:43 2024
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Wed Dec 18 11:51:47 2024
2
timestep
1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Fri Dec 6 17:31:42 2024
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Wed Dec 18 11:51:47 2024
2
timestep
1
1 -3.30697e-14
2 -1.32214e-12
2 -1.32584e-12
3 -1.38475e-12
4 -9.97322e-13
5 -3.58087e-13
6 -8.56062e-13
7 -9.10272e-13
8 -3.08306e-13
9 -3.70724e-13
10 -3.024e-13
11 -3.94423e-13
12 -1.39469e-13
13 -9.50467e-15
14 -2.01253e-13
15 -8.02574e-14
16 -5.53403e-14
17 -1.79047e-13
18 -1.9021e-13
19 -1.36001e-13
20 -5.62807e-14
21 -4.67998e-15
22 -2.88182e-14
23 -3.67076e-14
24 -8.91695e-14
25 -4.19795e-15
26 -1.60093e-14
27 -2.20108e-13
28 -5.4308e-14
29 -8.13584e-14
30 -6.38634e-13
31 -1.36409e-12
32 -1.86325e-12
33 -4.86176e-14
34 2.54163e-14
35 -1.8196e-13
36 -1.63784e-13
37 -3.10746e-13
38 -6.62854e-13
39 -4.96695e-13
40 -8.91344e-14
41 -5.46212e-14
42 -1.18342e-14
43 -1.35468e-13
44 -9.51185e-15
45 -2.97475e-15
46 6.43172e-15
47 -6.40392e-14
48 -2.20779e-15
49 -2.43569e-15
50 -5.2341e-13
51 -1.12209e-12
52 -3.36704e-13
53 -2.47554e-14
54 -3.80418e-13
55 -5.37929e-14
56 -5.80636e-14
57 -2.16305e-14
58 -6.87203e-14
59 -2.24512e-14
60 -3.52801e-14
61 -1.99017e-14
4 -9.9749e-13
5 -3.57922e-13
6 -8.56238e-13
7 -9.10129e-13
8 -3.08362e-13
9 -3.70661e-13
10 -3.02564e-13
11 -3.94315e-13
12 -1.3958e-13
13 -9.48194e-15
14 -2.01078e-13
15 -8.04142e-14
16 -5.53129e-14
17 -1.78993e-13
18 -1.90124e-13
19 -1.3605e-13
20 -5.62959e-14
21 -4.66443e-15
22 -2.8775e-14
23 -3.68077e-14
24 -8.92489e-14
25 -4.0928e-15
26 -1.60573e-14
27 -2.31189e-13
28 -5.41682e-14
29 -8.13799e-14
30 -6.38821e-13
31 -1.36396e-12
32 -1.86332e-12
33 -4.86131e-14
34 2.54088e-14
35 -1.81881e-13
36 -1.63801e-13
37 -3.10807e-13
38 -6.62867e-13
39 -4.96726e-13
40 -8.90984e-14
41 -5.46311e-14
42 -1.18625e-14
43 -1.35508e-13
44 -9.40317e-15
45 -3.06574e-15
46 6.45396e-15
47 -6.40919e-14
48 -2.02348e-15
49 -2.53303e-15
50 -5.23305e-13
51 -1.1223e-12
52 -3.36726e-13
53 -2.46017e-14
54 -3.80425e-13
55 -5.37968e-14
56 -5.80656e-14
57 -2.16315e-14
58 -6.87208e-14
59 -2.24515e-14
60 -3.52802e-14
61 -1.99018e-14
62 -1.65189e-14
63 -1.1581e-15
63 -1.15812e-15
64 1.04151e-14
65 4.16348e-15
66 -4.87868e-15
Expand Down Expand Up @@ -96,46 +96,46 @@ timestep
92 -3.31777e-13
93 -9.87687e-15
94 -1.11653e-13
95 -9.20258e-13
95 -9.33131e-13
96 -1.90257e-13
97 -3.2849e-14
98 -1.02591e-13
99 -6.72766e-13
100 -5.60174e-14
101 9.48604e-15
102 -3.34815e-14
103 -4.47661e-13
104 -1.58593e-13
105 -1.09767e-13
106 -1.09047e-14
107 -2.75012e-13
108 -7.31655e-15
109 5.06166e-15
110 -9.71637e-14
111 -3.10537e-13
112 -2.43809e-13
113 -2.3351e-13
114 -6.22037e-13
115 -2.71698e-13
116 -3.24233e-13
117 1.17087e-13
118 4.88792e-14
119 -3.78985e-13
120 -9.88185e-13
121 -1.33972e-14
122 -3.83349e-13
123 -1.28261e-12
124 -1.48468e-13
125 -5.79047e-14
126 -2.03477e-13
127 -6.45732e-13
128 -1.10563e-13
97 -3.28507e-14
98 -1.02598e-13
99 -6.72787e-13
100 -5.59025e-14
101 9.37359e-15
102 -3.3525e-14
103 -4.47512e-13
104 -1.5879e-13
105 -1.09496e-13
106 -1.11667e-14
107 -2.74938e-13
108 -7.18592e-15
109 4.9862e-15
110 -9.72046e-14
111 -3.10481e-13
112 -2.43779e-13
113 -2.33652e-13
114 -6.22014e-13
115 -2.71522e-13
116 -3.24261e-13
117 1.16997e-13
118 4.88698e-14
119 -3.78935e-13
120 -9.88094e-13
121 -1.36126e-14
122 -3.83212e-13
123 -1.28262e-12
124 -1.48478e-13
125 -5.79107e-14
126 -2.0348e-13
127 -6.45733e-13
128 -1.10564e-13
129 -1.8158e-13
130 -3.47408e-13
131 -1.06769e-12
132 -2.92118e-13
133 -4.87533e-14
134 -3.93209e-15
133 -4.87534e-14
134 -3.93211e-15
135 1.15787e-13
136 1.84945e-13
137 5.13678e-14
Expand Down Expand Up @@ -1421,16 +1421,16 @@ timestep
1417 -1.78663e-12
1418 -5.56884e-13
1419 -7.94688e-14
1420 -6.41738e-14
1421 -6.52438e-15
1422 -3.05922e-14
1420 -6.41739e-14
1421 -6.69136e-15
1422 -3.04253e-14
1423 -3.15608e-13
1424 -3.17437e-14
1425 -4.30715e-15
1425 -4.30717e-15
1426 -4.30145e-14
1427 -2.9492e-13
1428 -1.76943e-13
1429 -4.78082e-15
1429 -4.78086e-15
1430 -2.11239e-14
1431 -3.27328e-13
1432 -2.49794e-13
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Fri Dec 6 17:31:42 2024
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Wed Dec 18 11:51:47 2024
31
timestep
334
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Fri Dec 6 17:31:42 2024
timeseries valuescale.scalar settingsfile: /perm/mocm/prg/oslisflood/jrc/lisflood-code/tests/data/LF_ETRS89_UseCase/settings/mct_cold_for_results_generation.xml date: Wed Dec 18 11:51:47 2024
31
timestep
334
Expand Down
Loading