Merge pull request #5735 from totto82/dontshutGRUPwells

dont shut well with GRUP control that struggles to converge
This commit is contained in:
Kai Bao
2024-11-22 11:48:46 +01:00
committed by GitHub
3 changed files with 35 additions and 10 deletions

View File

@@ -426,24 +426,34 @@ void registerAdaptiveParameters();
// Found no wells to close, chop the timestep as above. // Found no wells to close, chop the timestep as above.
chopTimestep(); chopTimestep();
} else { } else {
// Close all consistently failing wells. // Close all consistently failing wells that are not under group control
int num_shut_wells = 0; std::vector<std::string> shut_wells;
for (const auto& well : failing_wells) { for (const auto& well : failing_wells) {
bool was_shut = solver.model().wellModel().forceShutWellByName(well, substepTimer.simulationTimeElapsed()); bool was_shut = solver.model().wellModel().forceShutWellByName(
well, substepTimer.simulationTimeElapsed(), /*dont_shut_grup_wells =*/ true);
if (was_shut) { if (was_shut) {
++num_shut_wells; shut_wells.push_back(well);
} }
} }
if (num_shut_wells == 0) { // If no wells are closed we also try to shut wells under group control
// None of the problematic wells were shut. if (shut_wells.empty()) {
// We must fall back to chopping again. for (const auto& well : failing_wells) {
bool was_shut = solver.model().wellModel().forceShutWellByName(
well, substepTimer.simulationTimeElapsed(), /*dont_shut_grup_wells =*/ false);
if (was_shut) {
shut_wells.push_back(well);
}
}
}
// If still no wells are closed we must fall back to chopping again
if (shut_wells.empty()) {
chopTimestep(); chopTimestep();
} else { } else {
substepTimer.provideTimeStepEstimate(dt); substepTimer.provideTimeStepEstimate(dt);
if (solverVerbose_) { if (solverVerbose_) {
std::string msg; std::string msg;
msg = "\nProblematic well(s) were shut: "; msg = "\nProblematic well(s) were shut: ";
for (const auto& well : failing_wells) { for (const auto& well : shut_wells) {
msg += well; msg += well;
msg += " "; msg += " ";
} }

View File

@@ -1318,13 +1318,27 @@ needPreStepNetworkRebalance(const int report_step) const
template<class Scalar> template<class Scalar>
bool BlackoilWellModelGeneric<Scalar>:: bool BlackoilWellModelGeneric<Scalar>::
forceShutWellByName(const std::string& wellname, forceShutWellByName(const std::string& wellname,
const double simulation_time) const double simulation_time,
const bool dont_shut_grup_wells)
{ {
// Only add the well to the closed list on the // Only add the well to the closed list on the
// process that owns it. // process that owns it.
int well_was_shut = 0; int well_was_shut = 0;
for (const auto& well : well_container_generic_) { for (const auto& well : well_container_generic_) {
if (well->name() == wellname) { if (well->name() == wellname) {
// if one well on individuel control (typical thp/bhp) in a group strugles to converge
// it may lead to problems for the other wells in the group
// we dont want to shut all the wells in a group only the one creating the problems.
const auto& ws = this->wellState().well(well->indexOfWell());
if (dont_shut_grup_wells) {
if (well->isInjector()) {
if (ws.injection_cmode == Well::InjectorCMode::GRUP)
continue;
} else {
if (ws.production_cmode == Well::ProducerCMode::GRUP)
continue;
}
}
wellTestState().close_well(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time); wellTestState().close_well(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
well_was_shut = 1; well_was_shut = 1;
break; break;

View File

@@ -191,7 +191,8 @@ public:
/// Shut down any single well /// Shut down any single well
/// Returns true if the well was actually found and shut. /// Returns true if the well was actually found and shut.
bool forceShutWellByName(const std::string& wellname, bool forceShutWellByName(const std::string& wellname,
const double simulation_time); const double simulation_time,
const bool dont_shut_grup_wells);
const std::vector<PerforationData<Scalar>>& perfData(const int well_idx) const const std::vector<PerforationData<Scalar>>& perfData(const int well_idx) const
{ return well_perf_data_[well_idx]; } { return well_perf_data_[well_idx]; }