Update guiderates after with new rates from newly opened wells

This commit is contained in:
Tor Harald Sandve
2022-01-17 13:01:42 +01:00
parent ee3c3db1af
commit d1c2032e73
3 changed files with 19 additions and 5 deletions

View File

@@ -2377,14 +2377,28 @@ runWellPIScaling(const int timeStepIdx,
bool bool
BlackoilWellModelGeneric:: BlackoilWellModelGeneric::
guideRateUpdateIsNeeded() const { guideRateUpdateIsNeeded(const int reportStepIdx) const {
const auto need_update = auto need_update =
std::any_of(this->well_container_generic_.begin(), std::any_of(this->well_container_generic_.begin(),
this->well_container_generic_.end(), this->well_container_generic_.end(),
[](const WellInterfaceGeneric* well) [](const WellInterfaceGeneric* well)
{ {
return well->changedToOpenThisStep(); 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)); return this->comm_.max(static_cast<int>(need_update));
} }

View File

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

View File

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