From 0329819f04eca7e741f8b5a780aa5a63f53b52d3 Mon Sep 17 00:00:00 2001 From: Sam Hatchett Date: Mon, 24 Jun 2024 13:08:13 -0400 Subject: [PATCH] fixes regression related to tank fill/empty events In the affected code, q is really just a proxy for flow direction. And in cases where a tank has filled in a previous step, its connected link will have been TEMPCLOSED making the flow pretty small. When this occurs, the link actually never opens even if dH says that the tank should be draining. --- src/hydstatus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hydstatus.c b/src/hydstatus.c index e746e586..6367dc08 100644 --- a/src/hydstatus.c +++ b/src/hydstatus.c @@ -433,10 +433,10 @@ void tankstatus(Project *pr, int k, int n, double q) if (tank->A == 0.0) return; // Can't add flow to a full tank - if (hyd->NodeHead[n] >= tank->Hmax && !tank->CanOverflow && q < TINY) + if (hyd->NodeHead[n] >= tank->Hmax && !tank->CanOverflow && q < 0.0) hyd->LinkStatus[k] = TEMPCLOSED; // Can't remove flow from an empty tank - else if (hyd->NodeHead[n] <= tank->Hmin && q > -TINY) + else if (hyd->NodeHead[n] <= tank->Hmin && q > 0.0) hyd->LinkStatus[k] = TEMPCLOSED; }