From 354351daeea4cb3d0bb38b58ff13c94079e06351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 28 Oct 2020 22:31:46 +0100 Subject: [PATCH] Record General Event When Processing WELPI This commit ensures that we record a general, Schedule-level WELL_PRODUCTIVITY_INDEX event in addition to the well-specific event already recorded when we encounter a WELPI keyword. We need this information in order to trigger a PI calculation across all MPI processes in opm-simulators. --- .../eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 ++ tests/parser/ScheduleTests.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index e7714599a..1c61eeacc 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -1133,6 +1133,8 @@ namespace { this->addWellGroupEvent(well_name, ScheduleEvents::WELL_PRODUCTIVITY_INDEX, handlerContext.currentStep); } } + + this->m_events.addEvent(ScheduleEvents::WELL_PRODUCTIVITY_INDEX, handlerContext.currentStep); } void Schedule::handleWELSEGS(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) { diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 1cbe62256..08d49e2d6 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -3931,9 +3931,15 @@ END BOOST_REQUIRE_EQUAL(sched.getTimeMap().last(), std::size_t{5}); BOOST_REQUIRE_MESSAGE(sched.hasWellGroupEvent("P", ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX, 1), - "Schedule must have WELL_PRODUCTIVITY_INDEX Event at report step 1"); + R"(Schedule must have WELL_PRODUCTIVITY_INDEX Event for well "P" at report step 1)"); BOOST_REQUIRE_MESSAGE(sched.hasWellGroupEvent("P", ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX, 3), + R"(Schedule must have WELL_PRODUCTIVITY_INDEX Event for well "P" at report step 3)"); + + BOOST_REQUIRE_MESSAGE(sched.getEvents().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX, 1), + "Schedule must have WELL_PRODUCTIVITY_INDEX Event at report step 1"); + + BOOST_REQUIRE_MESSAGE(sched.getEvents().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX, 3), "Schedule must have WELL_PRODUCTIVITY_INDEX Event at report step 3"); auto getScalingFactor = [&sched](const std::size_t report_step, const double wellPI) -> double