Merge pull request #2167 from totto82/addEvents

add WELTARG and WEFAC to events
This commit is contained in:
Bård Skaflestad
2020-12-21 21:30:54 +01:00
committed by GitHub
2 changed files with 23 additions and 3 deletions
@@ -54,7 +54,7 @@ namespace Opm
/*
The PRODUCTION_UPDATE event is triggered by the
WCONPROD and WCONHIST keywords. The event will be
WCONPROD, WCONHIST, WELTARG, WEFAC keywords. The event will be
triggered if *any* of the elements in one of keywords
is changed. Quite simlar for INJECTION_UPDATE and
POLYMER_UPDATE.
@@ -106,6 +106,11 @@ namespace Opm
* New explicit well productivity/injectivity assignment.
*/
WELL_PRODUCTIVITY_INDEX = (1 << 16),
/*
* Well/group efficiency factor has changed
*/
WELLGROUP_EFFICIENCY_UPDATE = (1 << 17),
};
}
@@ -524,11 +524,14 @@ namespace {
for (const auto& group_name : group_names) {
auto group_ptr = std::make_shared<Group>(this->getGroup(group_name, handlerContext.currentStep));
if (group_ptr->update_gefac(gefac, transfer))
if (group_ptr->update_gefac(gefac, transfer)) {
this->addWellGroupEvent( group_name, ScheduleEvents::WELLGROUP_EFFICIENCY_UPDATE, handlerContext.currentStep);
m_events.addEvent( ScheduleEvents::WELLGROUP_EFFICIENCY_UPDATE , handlerContext.currentStep);
this->updateGroup(std::move(group_ptr), handlerContext.currentStep);
}
}
}
}
void Schedule::handleGLIFTOPT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
this->handleGLIFTOPT(handlerContext.keyword, handlerContext.currentStep, parseContext, errors);
@@ -1120,11 +1123,14 @@ namespace {
for (const auto& well_name : well_names) {
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well>(*dynamic_state[handlerContext.currentStep]);
if (well2->updateEfficiencyFactor(efficiencyFactor))
if (well2->updateEfficiencyFactor(efficiencyFactor)){
this->addWellGroupEvent( well_name, ScheduleEvents::WELLGROUP_EFFICIENCY_UPDATE, handlerContext.currentStep);
m_events.addEvent( ScheduleEvents::WELLGROUP_EFFICIENCY_UPDATE , handlerContext.currentStep);
this->updateWell(std::move(well2), handlerContext.currentStep);
}
}
}
}
void Schedule::handleWELOPEN (const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
this->applyWELOPEN(handlerContext.keyword, handlerContext.currentStep, false, parseContext, errors);
@@ -1323,10 +1329,19 @@ namespace {
update |= well2->updateWellGuideRate(new_arg.get<double>());
}
if (update)
{
if (well2->isProducer()) {
this->addWellGroupEvent( well_name, ScheduleEvents::PRODUCTION_UPDATE, handlerContext.currentStep);
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , handlerContext.currentStep);
} else {
this->addWellGroupEvent( well_name, ScheduleEvents::INJECTION_UPDATE, handlerContext.currentStep);
m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , handlerContext.currentStep);
}
this->updateWell(std::move(well2), handlerContext.currentStep);
}
}
}
}
void Schedule::handleWFOAM(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
for (const auto& record : handlerContext.keyword) {