From c0a50597a1983ca393fb3d6c6a4da807fbd56a24 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 7 Feb 2024 13:48:18 +0100 Subject: [PATCH] BlackoilWellModel::computePotentials: improve exception message - add which well the exception added for - concatenate message for all exceptions to show all, not just last exception --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 162ef68a4..5ba9a57a9 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2185,12 +2185,18 @@ namespace Opm { { const int np = numPhases(); std::vector potentials; - const auto& well= well_container_[widx]; + const auto& well = well_container_[widx]; + std::string cur_exc_msg; + auto cur_exc_type = ExceptionType::NONE; try { well->computeWellPotentials(ebosSimulator_, well_state_copy, potentials, deferred_logger); } // catch all possible exception and store type and message. - OPM_PARALLEL_CATCH_CLAUSE(exc_type, exc_msg); + OPM_PARALLEL_CATCH_CLAUSE(cur_exc_type, cur_exc_msg); + if (cur_exc_type != ExceptionType::NONE) { + exc_msg += fmt::format("\nFor well {}: {}", well->name(), cur_exc_msg); + } + exc_type = std::max(exc_type, cur_exc_type); // Store it in the well state // potentials is resized and set to zero in the beginning of well->ComputeWellPotentials // and updated only if sucessfull. i.e. the potentials are zero for exceptions