Only indicate problems for exceptions whem updating well potentials,

Nearly all exceptions throw when computing well potentoals will not
abort the simulator but result in timestep chops. Hence those should not be
counted as errors (e.g. by calling the OPM_*THROW* macros) and be
reported in the PRT file.

This change will cause at least two more  occurences (in
MSWellHelpers) to be treated as problems. For this we added a new
helper function.
This commit is contained in:
Markus Blatt 2024-06-12 08:45:23 +02:00
parent b2c06415f4
commit 58ede5e789
2 changed files with 23 additions and 3 deletions

View File

@ -130,7 +130,27 @@ inline void logAndCheckForExceptionsAndThrow(Opm::DeferredLogger& deferred_logge
_throw(exc_type, message, comm);
}
inline void logAndCheckForProblemsAndThrow(Opm::DeferredLogger& deferred_logger,
Opm::ExceptionType::ExcEnum exc_type,
const std::string& message,
const bool terminal_output,
Opm::Parallel::Communication comm)
{
// add exception message to logger in order to display message from all ranks
if (exc_type != Opm::ExceptionType::NONE && comm.size() > 1) {
deferred_logger.problem("[Exception on rank " + std::to_string(comm.rank()) + "]: " + message);
}
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(deferred_logger, comm);
if (terminal_output) {
global_deferredLogger.logMessages();
}
// Now that all messages have been logged, they are automatically
// cleared from the global logger, but we must also clear them
// from the local logger.
deferred_logger.clearMessages();
_throw(exc_type, message, comm);
}
/// \brief Macro to setup the try of a parallel try-catch
///
/// Use OPM_END_PARALLEL_TRY_CATCH or OPM_END_PARALLEL_TRY_CATCH_LOG

View File

@ -1542,9 +1542,9 @@ updateWellPotentials(const int reportStepIdx,
}
++widx;
}
logAndCheckForExceptionsAndThrow(deferred_logger, exc_type,
"computeWellPotentials() failed: " + exc_msg,
terminal_output_, comm_);
logAndCheckForProblemsAndThrow(deferred_logger, exc_type,
"updateWellPotentials() failed: " + exc_msg,
terminal_output_, comm_);
}
template<class Scalar>