From 1ee7cb7f7a05cf5a8716ef945008a4eb8b1ed4b4 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 23 Nov 2017 13:20:32 +0100 Subject: [PATCH] Add TUNING_CHANGE event for TUNING --- lib/eclipse/EclipseState/Schedule/Schedule.cpp | 2 ++ .../opm/parser/eclipse/EclipseState/Schedule/Events.hpp | 7 ++++++- lib/eclipse/tests/TuningTests.cpp | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/eclipse/EclipseState/Schedule/Schedule.cpp b/lib/eclipse/EclipseState/Schedule/Schedule.cpp index 0aee8b688..e776b8ff0 100644 --- a/lib/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/lib/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1202,6 +1202,8 @@ namespace Opm { this->m_tuning.setXXXDPR(currentStep, XXXDPR); } } + m_events.addEvent( ScheduleEvents::TUNING_CHANGE , currentStep); + } diff --git a/lib/eclipse/include/opm/parser/eclipse/EclipseState/Schedule/Events.hpp b/lib/eclipse/include/opm/parser/eclipse/EclipseState/Schedule/Events.hpp index 2d20ce3ec..170a96530 100644 --- a/lib/eclipse/include/opm/parser/eclipse/EclipseState/Schedule/Events.hpp +++ b/lib/eclipse/include/opm/parser/eclipse/EclipseState/Schedule/Events.hpp @@ -84,7 +84,12 @@ namespace Opm /* Geology modifier. */ - GEO_MODIFIER = 1024 + GEO_MODIFIER = 1024, + + /* + TUNING has changed + */ + TUNING_CHANGE = 2048 }; } diff --git a/lib/eclipse/tests/TuningTests.cpp b/lib/eclipse/tests/TuningTests.cpp index 528fc1967..2c50706a8 100644 --- a/lib/eclipse/tests/TuningTests.cpp +++ b/lib/eclipse/tests/TuningTests.cpp @@ -75,13 +75,15 @@ BOOST_AUTO_TEST_CASE(TuningTest) { Eclipse3DProperties eclipseProperties ( deck , table, grid); Schedule schedule( deck, grid , eclipseProperties, Phases(true, true, true) , ParseContext()); auto tuning = schedule.getTuning(); - + auto event = schedule.getEvents(); const double diff = 1.0e-14; /*** TIMESTEP 4***/ /********* Record 1 ***********/ size_t timestep = 4; + BOOST_CHECK(!event.hasEvent(ScheduleEvents::TUNING_CHANGE, timestep)); + double TSINIT_default = tuning.getTSINIT(timestep); BOOST_CHECK_CLOSE(TSINIT_default, 1 * Metric::Time, diff); @@ -197,6 +199,7 @@ BOOST_AUTO_TEST_CASE(TuningTest) { /*** TIMESTEP 5***/ /********* Record 1 ***********/ timestep = 5; + BOOST_CHECK(event.hasEvent(ScheduleEvents::TUNING_CHANGE, timestep)); double TSINIT = tuning.getTSINIT(timestep); BOOST_CHECK_CLOSE(TSINIT, 2 * Metric::Time, diff); @@ -305,11 +308,13 @@ BOOST_AUTO_TEST_CASE(TuningTest) { BOOST_CHECK_CLOSE(XXXDPR, 1.0 * Metric::Pressure, diff); - + /*** TIMESTEP 7 ***/ + BOOST_CHECK(!event.hasEvent(ScheduleEvents::TUNING_CHANGE, 7)); /*** TIMESTEP 10 ***/ /********* Record 1 ***********/ timestep = 10; + BOOST_CHECK(event.hasEvent(ScheduleEvents::TUNING_CHANGE, timestep)); TMAXWC_has_value = tuning.getTMAXWChasValue(timestep); TMAXWC_default = tuning.getTMAXWC(timestep); BOOST_CHECK_EQUAL(true, TMAXWC_has_value);