Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions opm/input/eclipse/Schedule/Events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ namespace Opm
/// For now, the WELOPEN, WCONPROD and WCONINJE keywords are
/// considered with this event.
REQUEST_OPEN_WELL = (UINT64_C(1) << 21),

/// Analogue to above but when SCHEDULE set it to SHUT
REQUEST_SHUT_WELL = (UINT64_C(1) << 22),
};
} // namespace ScheduleEvents

Expand Down
44 changes: 22 additions & 22 deletions opm/input/eclipse/Schedule/Well/WellKeywordHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ std::string trim_wgname(const DeckKeyword& keyword,
return wgname;
}

void updateOpenShutEvents(HandlerContext& handlerContext, const std::string& well_name){
if (handlerContext.getWellStatus(well_name) == WellStatus::OPEN) {
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::REQUEST_OPEN_WELL);
handlerContext.state().wellgroup_events().clearEvent( well_name, ScheduleEvents::REQUEST_SHUT_WELL);
}
if (handlerContext.getWellStatus(well_name) == WellStatus::SHUT) {
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::REQUEST_SHUT_WELL);
handlerContext.state().wellgroup_events().clearEvent( well_name, ScheduleEvents::REQUEST_OPEN_WELL);
}
}

void handleWCONHIST(HandlerContext& handlerContext)
{
for (const auto& record : handlerContext.keyword) {
Expand Down Expand Up @@ -177,11 +188,8 @@ void handleWCONHIST(HandlerContext& handlerContext)
handlerContext.affected_well(well_name);
}

// Always check if well can be opened (it could have been closed for numerical reasons and possible to operate with new params)
if (handlerContext.getWellStatus(well_name) == WellStatus::OPEN) {
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::REQUEST_OPEN_WELL);
}

// Add Event if well open/shut is requested
updateOpenShutEvents(handlerContext, well_name);
}
}
}
Expand Down Expand Up @@ -255,11 +263,8 @@ void handleWCONINJE(HandlerContext& handlerContext)
handlerContext.state().wells.update( std::move(well2) );
handlerContext.affected_well(well_name);
}

if (handlerContext.state().wells.get( well_name ).getStatus() == Well::Status::OPEN) {
handlerContext.state().wellgroup_events().addEvent(well_name, ScheduleEvents::REQUEST_OPEN_WELL);
}

// Add Event if well open/shut is requested
updateOpenShutEvents(handlerContext, well_name);
auto udq_active = handlerContext.state().udq_active.get();
if (injection->updateUDQActive(handlerContext.state().udq.get(), udq_active)) {
handlerContext.state().udq_active.update( std::move(udq_active) );
Expand Down Expand Up @@ -334,10 +339,8 @@ void handleWCONINJH(HandlerContext& handlerContext)
handlerContext.affected_well(well_name);
}

// Always check if well can be opened (it could have been closed for numerical reasons and possible to operate with new params)
if (handlerContext.getWellStatus(well_name) == WellStatus::OPEN) {
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::REQUEST_OPEN_WELL);
}
// Add Event if well open/shut is requested
updateOpenShutEvents(handlerContext, well_name);
}
}
}
Expand Down Expand Up @@ -426,17 +429,16 @@ void handleWCONPROD(HandlerContext& handlerContext)
update_well = true;
}

if (well2.getStatus() == WellStatus::OPEN) {
handlerContext.state().wellgroup_events().addEvent(well2.name(), ScheduleEvents::REQUEST_OPEN_WELL);
}

if (update_well) {
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::PRODUCTION_UPDATE);
handlerContext.state().wells.update( std::move(well2) );
handlerContext.affected_well(well_name);
}

// Add Event if well open/shut is requested
updateOpenShutEvents(handlerContext, well_name);

auto udq_active = handlerContext.state().udq_active.get();
if (properties->updateUDQActive(handlerContext.state().udq.get(), udq_active)) {
handlerContext.state().udq_active.update( std::move(udq_active));
Expand Down Expand Up @@ -524,10 +526,8 @@ void handleWELOPEN(HandlerContext& handlerContext)
handlerContext.state().wells.update(std::move(well2));
}
}

if (new_well_status == open) {
handlerContext.state().wellgroup_events().addEvent( wname, ScheduleEvents::REQUEST_OPEN_WELL);
}
// Add Event if well open/shut is requested
updateOpenShutEvents(handlerContext, wname);
}
continue;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/parser/EventTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ BOOST_AUTO_TEST_CASE(MergeEvents)

BOOST_CHECK_MESSAGE(! ev1.hasEvent(SchEvt::REQUEST_OPEN_WELL),
R"(Merged collection must NOT have REQUEST_OPEN_WELL)");

BOOST_CHECK_MESSAGE(! ev1.hasEvent(SchEvt::REQUEST_SHUT_WELL),
R"(Merged collection must NOT have REQUEST_SHUT_WELL)");
}

BOOST_AUTO_TEST_CASE(MergeEventCollections)
Expand Down