Merge pull request #3771 from totto82/fixUpdateGR

Update guiderates after with new rates from newly opened wells
This commit is contained in:
Bård Skaflestad 2022-01-21 10:33:00 +01:00 committed by GitHub
commit 9fc9f5421c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View File

@ -2377,14 +2377,28 @@ runWellPIScaling(const int timeStepIdx,
bool
BlackoilWellModelGeneric::
guideRateUpdateIsNeeded() const {
const auto need_update =
guideRateUpdateIsNeeded(const int reportStepIdx) const {
auto need_update =
std::any_of(this->well_container_generic_.begin(),
this->well_container_generic_.end(),
[](const WellInterfaceGeneric* well)
{
return well->changedToOpenThisStep();
});
if (!need_update && this->report_step_starts_) {
const auto& events = this->schedule()[reportStepIdx].wellgroup_events();
const auto effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
+ ScheduleEvents::INJECTION_TYPE_CHANGED
+ ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER
+ ScheduleEvents::NEW_WELL;
need_update = std::any_of(this->well_container_generic_.begin(),
this->well_container_generic_.end(),
[&events, effective_events_mask](const WellInterfaceGeneric* well)
{
return events.hasEvent(well->name(), effective_events_mask);
});
}
return this->comm_.max(static_cast<int>(need_update));
}

View File

@ -396,7 +396,7 @@ protected:
const SummaryConfig& summaryConfig,
DeferredLogger& deferred_logger);
bool guideRateUpdateIsNeeded() const;
bool guideRateUpdateIsNeeded(const int reportStepIdx) const;
// create the well container
virtual void createWellContainer(const int time_step) = 0;

View File

@ -842,8 +842,8 @@ namespace Opm {
terminal_output_, grid().comm());
//update guide rates
if (guideRateUpdateIsNeeded()) {
const int reportStepIdx = ebosSimulator_.episodeIndex();
const int reportStepIdx = ebosSimulator_.episodeIndex();
if (guideRateUpdateIsNeeded(reportStepIdx)) {
const double simulationTime = ebosSimulator_.time();
const auto& comm = ebosSimulator_.vanguard().grid().comm();
const auto& summaryState = ebosSimulator_.vanguard().summaryState();