mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5423 from blattms/bugfix/mswell-exceptions-are-problems
Only indicate problems for exceptions whem updating well potentials,
This commit is contained in:
commit
9dbaad2b3e
@ -130,7 +130,27 @@ inline void logAndCheckForExceptionsAndThrow(Opm::DeferredLogger& deferred_logge
|
|||||||
_throw(exc_type, message, comm);
|
_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
|
/// \brief Macro to setup the try of a parallel try-catch
|
||||||
///
|
///
|
||||||
/// Use OPM_END_PARALLEL_TRY_CATCH or OPM_END_PARALLEL_TRY_CATCH_LOG
|
/// Use OPM_END_PARALLEL_TRY_CATCH or OPM_END_PARALLEL_TRY_CATCH_LOG
|
||||||
|
@ -1542,9 +1542,9 @@ updateWellPotentials(const int reportStepIdx,
|
|||||||
}
|
}
|
||||||
++widx;
|
++widx;
|
||||||
}
|
}
|
||||||
logAndCheckForExceptionsAndThrow(deferred_logger, exc_type,
|
logAndCheckForProblemsAndThrow(deferred_logger, exc_type,
|
||||||
"computeWellPotentials() failed: " + exc_msg,
|
"updateWellPotentials() failed: " + exc_msg,
|
||||||
terminal_output_, comm_);
|
terminal_output_, comm_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
|
Loading…
Reference in New Issue
Block a user