Fetch events from ScheduleState

This commit is contained in:
Joakim Hove
2021-01-10 21:46:45 +01:00
parent 8983b8d532
commit 237eb2b7ee
6 changed files with 29 additions and 31 deletions

View File

@@ -235,7 +235,6 @@ public:
timer.currentStepLength());
ebosSimulator_.setEpisodeIndex(timer.currentStepNum());
solver->model().beginReportStep();
const auto& events = schedule().getEvents();
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
// If sub stepping is enabled allow the solver to sub cycle
@@ -244,16 +243,17 @@ public:
// \Note: The report steps are met in any case
// \Note: The sub stepping will require a copy of the state variables
if (adaptiveTimeStepping_) {
const auto& events = schedule()[timer.currentStepNum()].events();
if (enableTUNING) {
if (events.hasEvent(ScheduleEvents::TUNING_CHANGE,timer.currentStepNum())) {
if (events.hasEvent(ScheduleEvents::TUNING_CHANGE)) {
adaptiveTimeStepping_->updateTUNING(schedule()[timer.currentStepNum()].tuning());
}
}
bool event = events.hasEvent(ScheduleEvents::NEW_WELL, timer.currentStepNum()) ||
events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE, timer.currentStepNum()) ||
events.hasEvent(ScheduleEvents::INJECTION_UPDATE, timer.currentStepNum()) ||
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE, timer.currentStepNum());
bool event = events.hasEvent(ScheduleEvents::NEW_WELL) ||
events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE) ||
events.hasEvent(ScheduleEvents::INJECTION_UPDATE) ||
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
auto stepReport = adaptiveTimeStepping_->step(timer, *solver, event, nullptr);
report_ += stepReport;
} else {

View File

@@ -282,7 +282,7 @@ namespace Opm {
+ ScheduleEvents::INJECTION_UPDATE
+ ScheduleEvents::NEW_WELL;
if(!schedule().hasWellGroupEvent(well.name(), effective_events_mask, timeStepIdx))
if(!schedule()[timeStepIdx].wellgroup_events().hasEvent(well.name(), effective_events_mask))
continue;
if (well.isProducer()) {
@@ -308,7 +308,7 @@ namespace Opm {
schedule().getVFPProdTables(timeStepIdx)) );
this->initializeWellProdIndCalculators();
if (this->schedule().getEvents().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX, timeStepIdx)) {
if (this->schedule()[timeStepIdx].events().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX)) {
this->runWellPIScaling(timeStepIdx, local_deferredLogger);
}
@@ -2628,10 +2628,9 @@ namespace Opm {
auto hasWellPIEvent = [this, timeStepIdx](const int well_index) -> bool
{
return this->schedule()
.hasWellGroupEvent(this->wells_ecl_[well_index].name(),
ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX,
timeStepIdx);
return this->schedule()[timeStepIdx]
.wellgroup_events().hasEvent(this->wells_ecl_[well_index].name(),
ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX);
};
auto getWellPI = [this](const int well_index) -> double

View File

@@ -79,8 +79,9 @@ namespace WellGroupHelpers
wellState.setCurrentProductionGroupControl(group.name(), Group::ProductionCMode::NONE);
}
const auto& events = schedule[reportStepIdx].wellgroup_events();
if (group.isInjectionGroup()
&& schedule.hasWellGroupEvent(group.name(), ScheduleEvents::GROUP_INJECTION_UPDATE, reportStepIdx)) {
&& events.hasEvent(group.name(), ScheduleEvents::GROUP_INJECTION_UPDATE)) {
for (Phase phase : all) {
if (!group.hasInjectionControl(phase))
@@ -92,7 +93,7 @@ namespace WellGroupHelpers
}
if (group.isProductionGroup()
&& schedule.hasWellGroupEvent(group.name(), ScheduleEvents::GROUP_PRODUCTION_UPDATE, reportStepIdx)) {
&& events.hasEvent(group.name(), ScheduleEvents::GROUP_PRODUCTION_UPDATE)) {
const auto controls = group.productionControls(summaryState);
wellState.setCurrentProductionGroupControl(group.name(), controls.cmode);
}

View File

@@ -121,7 +121,7 @@ namespace Opm
+ ScheduleEvents::INJECTION_UPDATE;
for (int w = 0; w < nw; ++w) {
effective_events_occurred_[w]
= schedule.hasWellGroupEvent(wells_ecl[w].name(), effective_events_mask, report_step);
= schedule[report_step].wellgroup_events().hasEvent(wells_ecl[w].name(), effective_events_mask);
}
} // end of if (!well_ecl.empty() )