mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fetch events from ScheduleState
This commit is contained in:
parent
8983b8d532
commit
237eb2b7ee
@ -1019,18 +1019,18 @@ public:
|
||||
int episodeIdx = simulator.episodeIndex();
|
||||
auto& eclState = simulator.vanguard().eclState();
|
||||
const auto& schedule = simulator.vanguard().schedule();
|
||||
const auto& events = schedule.getEvents();
|
||||
const auto& events = schedule[episodeIdx].events();
|
||||
const auto& timeMap = schedule.getTimeMap();
|
||||
|
||||
if (episodeIdx >= 0 && events.hasEvent(Opm::ScheduleEvents::GEO_MODIFIER, episodeIdx)) {
|
||||
if (episodeIdx >= 0 && events.hasEvent(Opm::ScheduleEvents::GEO_MODIFIER)) {
|
||||
// bring the contents of the keywords to the current state of the SCHEDULE
|
||||
// section.
|
||||
//
|
||||
// TODO (?): make grid topology changes possible (depending on what exactly
|
||||
// has changed, the grid may need be re-created which has some serious
|
||||
// implications on e.g., the solution of the simulation.)
|
||||
const auto& miniDeck = schedule.getModifierDeck(episodeIdx);
|
||||
eclState.applyModifierDeck(miniDeck);
|
||||
const auto& miniDeck = schedule[episodeIdx].geo_keywords();
|
||||
eclState.apply_geo_keywords( miniDeck );
|
||||
|
||||
// re-compute all quantities which may possibly be affected.
|
||||
transmissibilities_.update(true);
|
||||
@ -1058,7 +1058,7 @@ public:
|
||||
|
||||
// react to TUNING changes
|
||||
bool tuningEvent = false;
|
||||
if (episodeIdx > 0 && enableTuning_ && events.hasEvent(Opm::ScheduleEvents::TUNING_CHANGE, episodeIdx))
|
||||
if (episodeIdx > 0 && enableTuning_ && events.hasEvent(Opm::ScheduleEvents::TUNING_CHANGE))
|
||||
{
|
||||
const auto& tuning = schedule[episodeIdx].tuning();
|
||||
initialTimeStepSize_ = tuning.TSINIT;
|
||||
@ -3243,7 +3243,6 @@ private:
|
||||
return dtNext;
|
||||
|
||||
const auto& simulator = this->simulator();
|
||||
const auto& events = simulator.vanguard().schedule().getEvents();
|
||||
int episodeIdx = simulator.episodeIndex();
|
||||
|
||||
// first thing in the morning, limit the time step size to the maximum size
|
||||
@ -3265,11 +3264,12 @@ private:
|
||||
// if a well event occured, respect the limit for the maximum time step after
|
||||
// that, too
|
||||
int reportStepIdx = std::max(episodeIdx, 0);
|
||||
const auto& events = simulator.vanguard().schedule()[reportStepIdx].events();
|
||||
bool wellEventOccured =
|
||||
events.hasEvent(Opm::ScheduleEvents::NEW_WELL, reportStepIdx)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::PRODUCTION_UPDATE, reportStepIdx)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::INJECTION_UPDATE, reportStepIdx)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::WELL_STATUS_CHANGE, reportStepIdx);
|
||||
events.hasEvent(Opm::ScheduleEvents::NEW_WELL)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::PRODUCTION_UPDATE)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::INJECTION_UPDATE)
|
||||
|| events.hasEvent(Opm::ScheduleEvents::WELL_STATUS_CHANGE);
|
||||
if (episodeIdx >= 0 && wellEventOccured && maxTimeStepAfterWellEvent_ > 0)
|
||||
dtNext = std::min(dtNext, maxTimeStepAfterWellEvent_);
|
||||
}
|
||||
|
@ -609,11 +609,10 @@ public:
|
||||
// for the "until the universe dies" episode, the wells don't change
|
||||
return false;
|
||||
|
||||
const Opm::Events& events = schedule.getEvents();
|
||||
const Opm::Events& events = schedule[reportStepIdx].events();
|
||||
return events.hasEvent(Opm::ScheduleEvents::PRODUCTION_UPDATE |
|
||||
Opm::ScheduleEvents::INJECTION_UPDATE |
|
||||
Opm::ScheduleEvents::WELL_STATUS_CHANGE,
|
||||
reportStepIdx);
|
||||
Opm::ScheduleEvents::WELL_STATUS_CHANGE );
|
||||
}
|
||||
|
||||
void initFromRestartFile(const RestartValue& restartValues OPM_UNUSED){
|
||||
@ -636,10 +635,9 @@ protected:
|
||||
// for the "until the universe dies" episode, the wells don't change
|
||||
return false;
|
||||
|
||||
const Opm::Events& events = schedule.getEvents();
|
||||
const Opm::Events& events = schedule[reportStepIdx].events();
|
||||
return events.hasEvent(Opm::ScheduleEvents::NEW_WELL |
|
||||
Opm::ScheduleEvents::COMPLETION_CHANGE,
|
||||
reportStepIdx);
|
||||
Opm::ScheduleEvents::COMPLETION_CHANGE);
|
||||
}
|
||||
|
||||
void updateWellTopology_(unsigned reportStepIdx OPM_UNUSED,
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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() )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user