[bugfix] Expect singular matrices and terminate updateWellControls.

We are experiencing singular matrices when solving mulisegment wells
sometimes. In that case (here during
BlackoilModelEbos::assembleReservoir <-
BlackoilModelEbos::initialLinerization <-
BlackoilModelEbos:::nonlinearIterationNewton ) an exception is thrown
when updating the controls of a well.

The problem here is that this exception only happens on one
process. That one goes to the catch block in
NonLinearSolverEbos::step, marks the nonlinear solve as failed and
cuts the time step. The others move to the collective communication
below. Somehow and somewhen all end up in a non-matching collective
communication with different data types and we get an MPI Error that
the message was truncated.

Now all processes will throw, terminate the nonlinear solver and cut
the timestep as it should be.
This commit is contained in:
Markus Blatt
2023-11-25 18:22:28 +01:00
parent 6a866ac8d2
commit 50c25ead52

View File

@@ -1932,6 +1932,9 @@ namespace Opm {
// Check individual well constraints and communicate.
bool changed_well_individual = false;
// For MS Wells a linear solve is performed below and the matrix might be singular.
// We need to communicate the exception thrown to the others and rethrow.
OPM_BEGIN_PARALLEL_TRY_CATCH()
for (const auto& well : well_container_) {
const auto mode = WellInterface<TypeTag>::IndividualOrGroup::Individual;
const bool changed_well = well->updateWellControl(ebosSimulator_, mode, this->wellState(), this->groupState(), deferred_logger);
@@ -1939,6 +1942,9 @@ namespace Opm {
changed_well_individual = changed_well || changed_well_individual;
}
}
OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel: updating well controls failed: ",
ebosSimulator_.gridView().comm());
changed_well_individual = comm.sum(static_cast<int>(changed_well_individual));
if (changed_well_individual) {
updateAndCommunicate(episodeIdx, iterationIdx, deferred_logger);