Merge pull request #2482 from joakim-hove/actionx-well-event

Add new well event for wells which have been touched by ACTIONX
This commit is contained in:
Joakim Hove 2021-05-22 11:16:46 +02:00 committed by GitHub
commit 76fdcc2985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -121,6 +121,11 @@ namespace Opm
* Well switched between injector and producer
*/
WELL_SWITCHED_INJECTOR_PRODUCER = (1 << 19),
/*
* The well has been affected in an ACTIONX keyword.
*/
ACTIONX_WELL_EVENT = (1 << 20),
};
}

View File

@ -1194,6 +1194,12 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
&affected_wells,
&target_wellpi);
}
if (!affected_wells.empty()) {
this->snapshots.back().events().addEvent( ScheduleEvents::ACTIONX_WELL_EVENT );
for (const auto& well: affected_wells)
this->snapshots.back().wellgroup_events().addEvent(well, ScheduleEvents::ACTIONX_WELL_EVENT);
}
if (reportStep < this->m_sched_deck.size() - 1)
iterateScheduleSection(reportStep + 1, this->m_sched_deck.size(), parseContext, errors, true, &target_wellpi, nullptr, nullptr, prefix);
OpmLog::info("\\----------------------------------------------------------------------");

View File

@ -150,6 +150,22 @@ TSTEP
BOOST_CHECK_EQUAL( affected_wells.size(), 1);
BOOST_CHECK_EQUAL( affected_wells.count("W1"), 1);
{
const auto& wg_events = sched[0].wellgroup_events();
const auto& events = sched[0].events();
BOOST_CHECK(events.hasEvent(ScheduleEvents::ACTIONX_WELL_EVENT));
BOOST_CHECK(wg_events.hasEvent("W1", ScheduleEvents::ACTIONX_WELL_EVENT));
BOOST_CHECK(!wg_events.hasEvent("W2", ScheduleEvents::ACTIONX_WELL_EVENT));
}
{
const auto& wg_events = sched[1].wellgroup_events();
const auto& events = sched[1].events();
BOOST_CHECK(!events.hasEvent(ScheduleEvents::ACTIONX_WELL_EVENT));
BOOST_CHECK(!wg_events.hasEvent("W1", ScheduleEvents::ACTIONX_WELL_EVENT));
BOOST_CHECK(!wg_events.hasEvent("W2", ScheduleEvents::ACTIONX_WELL_EVENT));
}
// The deck3 contains the 'GRID' keyword in the ACTIONX block - that is not a whitelisted keyword.
ParseContext parseContext( {{ParseContext::ACTIONX_ILLEGAL_KEYWORD, InputError::THROW_EXCEPTION}} );
BOOST_CHECK_THROW( make_schedule(WITH_GRID, parseContext), OpmInputError );