Communicate exceptions during WellModel::updateAndCommunicate

For multi segment well the underlying call to
MultisegmentWell::updateWellStateWithTarget (at least if
updateWellStateWithTHPTargetProd is called for a producer under thp
control) might throw as there might be a singular matrix during the
solve needed in MultisegmentWell::iterateWellEqWithControl.

Previously, if that happened then the MPI process where it happened would
stop the nonlinear iteration as failed and try with a chopped time
step. The others might go one with the current time step and we would
see MPI errors about truncated messages.

Now we communicate any exception happening during this part of
WellModel::updateAndCommunicate and all processes will stop the
nonlinear iteration as failed and chop the time step.
This commit is contained in:
Markus Blatt committed 2023-12-04 22:26:55 +01:00
1 parent cb3ab14a71
commit 779dd74923
1 file changed
+6
@@ -2144,10 +2144,16 @@ namespace Opm {
DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
updateAndCommunicateGroupData(reportStepIdx, iterationIdx); updateAndCommunicateGroupData(reportStepIdx, iterationIdx);
// updateWellStateWithTarget might throw for multisegment wells hence we
// have a parallel try catch here to thrown on all processes.
OPM_BEGIN_PARALLEL_TRY_CATCH()
// if a well or group change control it affects all wells that are under the same group // if a well or group change control it affects all wells that are under the same group
for (const auto& well : well_container_) { for (const auto& well : well_container_) {
well->updateWellStateWithTarget(ebosSimulator_, this->groupState(), this->wellState(), deferred_logger); well->updateWellStateWithTarget(ebosSimulator_, this->groupState(), this->wellState(), deferred_logger);
} }
OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel::updateAndCommunicate failed: ",
ebosSimulator_.gridView().comm())
updateAndCommunicateGroupData(reportStepIdx, iterationIdx); updateAndCommunicateGroupData(reportStepIdx, iterationIdx);
} }