@@ -1381,7 +1381,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1381
1381
1382
1382
# check for negative and zero discharge values
1383
1383
# zero outflow is not allowed
1384
- if q11 <= 0 :
1384
+ if q11 < eps : # cmcheck <=0
1385
1385
q11 = eps
1386
1386
1387
1387
# calc reference discharge at time t
@@ -1393,13 +1393,13 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1393
1393
1394
1394
# reference I discharge at x=0
1395
1395
qmx0 = (q00 + q01 ) / 2.
1396
- if qmx0 == 0 :
1396
+ if qmx0 < eps : # cmcheck ==0
1397
1397
qmx0 = eps
1398
1398
hmx0 = self .hoq (qmx0 , s0 , Balv , ANalv , Nalv )
1399
1399
1400
1400
# reference O discharge at x=1
1401
1401
qmx1 = (q10 + q11 ) / 2.
1402
- if qmx1 == 0 :
1402
+ if qmx1 < eps : # cmcheck ==0
1403
1403
qmx1 = eps
1404
1404
hmx1 = self .hoq (qmx1 , s0 ,Balv ,ANalv ,Nalv )
1405
1405
@@ -1413,7 +1413,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1413
1413
# Q(t+dt)=(I(t+dt)+O'(t+dt))/2
1414
1414
qm1 = (q01 + q11 ) / 2.
1415
1415
#cm
1416
- if qm1 == 0 :
1416
+ if qm1 < eps : # cmcheck ==0
1417
1417
qm1 = eps
1418
1418
#cm
1419
1419
hm1 = self .hoq (qm1 ,s0 ,Balv ,ANalv ,Nalv )
@@ -1442,7 +1442,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1442
1442
# Mass balance equation that takes into consideration the lateral flow
1443
1443
q11 = c1 * q01 + c2 * q00 + c3 * q10 + c4 * ql
1444
1444
1445
- if q11 <= 0. :
1445
+ if q11 < eps : # cmcheck <=0
1446
1446
q11 = eps
1447
1447
1448
1448
#### end of for loop
@@ -1475,7 +1475,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1475
1475
q1mm = q0mm + ql + (V00 - V11 ) / dt
1476
1476
1477
1477
# cmcheck
1478
- # q1m cannot be too small or it will cause instability
1478
+ # q1m cannot be smaller than eps or it will cause instability
1479
1479
if q1mm < eps :
1480
1480
q1mm = eps
1481
1481
V11 = V00 + (q0mm + ql - q1mm ) * dt
@@ -1486,6 +1486,7 @@ def MCTRouting_single(self, V00, q10, q01, q00, ql,q0mm, Cm0, Dm0, dt, xpix, s0,
1486
1486
return q11 , V11 , q1mm , Cm1 , Dm1
1487
1487
1488
1488
1489
+
1489
1490
def hoq (self ,q ,s0 ,Balv ,ANalv ,Nalv ):
1490
1491
"""Water depth from discharge.
1491
1492
Given a generic cross-section (rectangular, triangular or trapezoidal) and a steady-state discharge q=Q*, it computes
0 commit comments