From 9f4fdd09fa0f7f6875e4e620c27d306e5daa9c27 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Sun, 29 Sep 2024 22:30:01 +0200 Subject: [PATCH] Throw an error if the status "lastStepFailed" in prepareStep of BlackoilModel is not the same across all processes --- opm/simulators/flow/BlackoilModel.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opm/simulators/flow/BlackoilModel.hpp b/opm/simulators/flow/BlackoilModel.hpp index 1d62a68c8..a4443dcdb 100644 --- a/opm/simulators/flow/BlackoilModel.hpp +++ b/opm/simulators/flow/BlackoilModel.hpp @@ -272,7 +272,11 @@ namespace Opm { Dune::Timer perfTimer; perfTimer.start(); // update the solution variables in the model - if ( timer.lastStepFailed() ) { + int lastStepFailed = timer.lastStepFailed(); + if (grid_.comm().size() > 1 && lastStepFailed != grid_.comm().min(lastStepFailed)) { + OPM_THROW(std::runtime_error, fmt::format("Misalignment of the parallel simulation run in prepareStep - the previous step succeeded on rank {} but failed on the other ranks.", grid_.comm().rank())); + } + if ( lastStepFailed ) { simulator_.model().updateFailed(); } else { simulator_.model().advanceTimeLevel();