Skip to content

Commit 0d932f0

Browse files
author
Cinzia Mazzetti
committed
avoid negative discharge
1 parent 9fd40a4 commit 0d932f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lisflood/hydrological_modules/routing.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,12 @@ def MCTRoutingLoop(self,ChanQMCTOutStart,ChanQMCTInStart,ChanQKinOut,ChanQKinOut
12891289
# calc average discharge outflow q1m for MCT channels during routing sub step dt
12901290
# Calculate average outflow using water balance for MCT channel grid cell over sub-routing step
12911291
q1m[idpix] = q0m[idpix] + ql[idpix] + (V00[idpix] - V11[idpix]) / dt
1292+
# cmcheck no valori di portata negativi
1293+
if q1m[idpix] < 0.:
1294+
q1m[idpix] = eps
1295+
V11[idpix] = V00[idpix] + (q0m[idpix] + ql[idpix] - q1m[idpix]) * dt
1296+
1297+
12921298

12931299

12941300
# Update contribution from upstream pixels at time t+1 (dim=all pixels) using the newly calculated q11
@@ -1378,7 +1384,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql, Cm0, Dm0, dt, xpix, s0, Balv
13781384
# check for negative and zero discharge values
13791385
# zero outflow is not allowed
13801386
if q11 <= 0:
1381-
q11 = eps
1387+
q11 = 0
13821388

13831389
# calc reference discharge at time t
13841390
# qm0 = (I(t)+O(t))/2

0 commit comments

Comments
 (0)