[bugfix] Fixes stopping network update in parallel at max steps.

We did only break in the loop for rank 0 and not the other ones. Hence
all other processes kept iterating beyond the maximum number of
allowed iterations. This lead to hard to find crashes because of
non-matching MPI communication.
This commit is contained in:
Markus Blatt 2023-10-04 12:45:23 +02:00
parent fa04666b8a
commit 9279ce19e8

View File

@ -1122,9 +1122,12 @@ namespace Opm {
std::tie(do_network_update, well_group_control_changed) =
updateWellControlsAndNetworkIteration(mandatory_network_balance, relax_network_balance, dt,local_deferredLogger);
++network_update_iteration;
if (terminal_output_ && (network_update_iteration >= max_iteration) ) {
local_deferredLogger.info("maximum of " + std::to_string(max_iteration) + " iterations has been used, we stop the network update now, "
"the simulation will continue with unconvergeed network results");
if (network_update_iteration >= max_iteration ) {
if (terminal_output_) {
local_deferredLogger.info("maximum of " + std::to_string(max_iteration) + " iterations has been used, we stop the network update now, "
"the simulation will continue with unconvergeed network results");
}
break;
}
}