mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5025 from blattms/expect-singular-matrices-upate-WellControl
[bugfix] Expect singular matrices, terminate updateWellControls/nonlinear and cut timestep
This commit is contained in:
commit
cb3ab14a71
@ -1916,12 +1916,19 @@ namespace Opm {
|
||||
}
|
||||
// Check wells' group constraints and communicate.
|
||||
bool changed_well_to_group = false;
|
||||
for (const auto& well : well_container_) {
|
||||
const auto mode = WellInterface<TypeTag>::IndividualOrGroup::Group;
|
||||
const bool changed_well = well->updateWellControl(ebosSimulator_, mode, this->wellState(), this->groupState(), deferred_logger);
|
||||
if (changed_well) {
|
||||
changed_well_to_group = changed_well || changed_well_to_group;
|
||||
}
|
||||
{
|
||||
// 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::Group;
|
||||
const bool changed_well = well->updateWellControl(ebosSimulator_, mode, this->wellState(), this->groupState(), deferred_logger);
|
||||
if (changed_well) {
|
||||
changed_well_to_group = changed_well || changed_well_to_group;
|
||||
}
|
||||
}
|
||||
OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel: updating well controls failed: ",
|
||||
ebosSimulator_.gridView().comm());
|
||||
}
|
||||
|
||||
changed_well_to_group = comm.sum(static_cast<int>(changed_well_to_group));
|
||||
@ -1932,13 +1939,21 @@ namespace Opm {
|
||||
|
||||
// Check individual well constraints and communicate.
|
||||
bool changed_well_individual = false;
|
||||
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);
|
||||
if (changed_well) {
|
||||
changed_well_individual = changed_well || changed_well_individual;
|
||||
}
|
||||
{
|
||||
// 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);
|
||||
if (changed_well) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user