From 0089275691414bc361223b481026e47e580e2e82 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Tue, 1 Oct 2024 10:21:20 +0200 Subject: [PATCH] Fail water balance check on either tolerance https://github.com/Deltares/Ribasim/issues/1853#issuecomment-2383488129 --- core/src/callback.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/callback.jl b/core/src/callback.jl index 8990d86f8..6d4636a1a 100644 --- a/core/src/callback.jl +++ b/core/src/callback.jl @@ -310,7 +310,7 @@ function check_water_balance_error( mean_flow_rate = (total_in + total_out) / 2 relative_error = iszero(mean_flow_rate) ? 0.0 : balance_error / mean_flow_rate - if abs(balance_error) > water_balance_abstol && + if abs(balance_error) > water_balance_abstol || abs(relative_error) > water_balance_reltol errors = true @error "Too large water balance error" id balance_error relative_error