From bd145913e839bcf423cc2f8b2da1e323872a584d Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 25 Apr 2022 08:08:37 +0200 Subject: [PATCH] use alternative init for wells with all rates less than eps --- opm/simulators/wells/WellInterface_impl.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 4b0013ce3..0cee2191a 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -1053,8 +1053,9 @@ namespace Opm // if more than one nonzero rate. auto& ws = well_state.well(this->index_of_well_); int nonzero_rate_index = -1; + const double floating_point_error_epsilon = 1e-14; for (int p = 0; p < this->number_of_phases_; ++p) { - if (ws.surface_rates[p] != 0.0) { + if (std::abs(ws.surface_rates[p]) > floating_point_error_epsilon) { if (nonzero_rate_index == -1) { nonzero_rate_index = p; } else {