From f2aa193a32302371645b65476ca09f5c316990d1 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 18 Nov 2013 16:06:50 +0100 Subject: [PATCH] Added IntegrationTest of Schedule->Groups->injection properties --- .../EclipseState/Schedule/Schedule.cpp | 34 ++++++++++++++++++- .../EclipseState/Schedule/Schedule.hpp | 1 + .../ScheduleCreateFromDeck.cpp | 28 +++++++++++---- .../SCHEDULE/SCHEDULE_GROUPS | 4 +-- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 6177167d7..ca51cd064 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -83,6 +83,9 @@ namespace Opm { if (keyword->name() == "COMPDAT") handleCOMPDAT( keyword , currentStep ); + if (keyword->name() == "GCONINJE") + handleGCONINJE( keyword , currentStep ); + deckIndex++; } } @@ -98,7 +101,12 @@ namespace Opm { void Schedule::handleWELSPECS(DeckKeywordConstPtr keyword) { for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { DeckRecordConstPtr record = keyword->getRecord(recordNr); - const std::string& wellName = record->getItem(0)->getString(0); + const std::string& wellName = record->getItem("WELL")->getString(0); + const std::string& groupName = record->getItem("GROUP")->getString(0); + + if (!hasGroup(groupName)) { + addGroup(groupName); + } if (!hasWell(wellName)) { addWell(wellName); @@ -156,6 +164,30 @@ namespace Opm { } } + + void Schedule::handleGCONINJE(DeckKeywordConstPtr keyword, size_t currentStep) { + for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { + DeckRecordConstPtr record = keyword->getRecord(recordNr); + const std::string& groupName = record->getItem("GROUP")->getString(0); + GroupPtr group = getGroup(groupName); + + { + PhaseEnum phase = PhaseEnumFromString( record->getItem("PHASE")->getString(0) ); + group->setInjectionPhase( currentStep , phase ); + } + { + GroupInjectionControlEnum controlMode = GroupInjectionControlEnumFromString( record->getItem("CONTROL_MODE")->getString(0) ); + group->setInjectionControlMode( currentStep , controlMode ); + } + group->setSurfaceMaxRate( currentStep , record->getItem("SURFACE_TARGET")->getDouble(0)); + group->setReservoirMaxRate( currentStep , record->getItem("RESV_TARGET")->getDouble(0)); + group->setTargetReinjectFraction( currentStep , record->getItem("REINJ_TARGET")->getDouble(0)); + group->setTargetVoidReplacementFraction( currentStep , record->getItem("VOIDAGE_TARGET")->getDouble(0)); + } + } + + + void Schedule::handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep) { std::map > completionMapList = Completion::completionsFromCOMPDATKeyword( keyword ); std::map >::iterator iter; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index fa522f5bb..4e18d5c24 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -70,6 +70,7 @@ namespace Opm void handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep); void handleWCONINJE(DeckKeywordConstPtr keyword, size_t currentStep); void handleWCONINJH(DeckKeywordConstPtr keyword, size_t currentStep); + void handleGCONINJE(DeckKeywordConstPtr keyword, size_t currentStep); void handleDATES(DeckKeywordConstPtr keyword); void handleTSTEP(DeckKeywordConstPtr keyword); }; diff --git a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp index c2a8f4405..5c0b2d1dc 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -123,9 +123,25 @@ BOOST_AUTO_TEST_CASE( WellTestCOMPDAT ) { } -//BOOST_AUTO_TEST_CASE( WellTestGroups ) { -// ParserPtr parser(new Parser()); -// boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS"); -// DeckPtr deck = parser->parse(scheduleFile.string()); -// ScheduleConstPtr sched( new Schedule(deck)); -//} +BOOST_AUTO_TEST_CASE( WellTestGroups ) { + ParserPtr parser(new Parser()); + boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS"); + DeckPtr deck = parser->parse(scheduleFile.string()); + ScheduleConstPtr sched( new Schedule(deck)); + + BOOST_CHECK_EQUAL( 3U , sched->numGroups() ); + BOOST_CHECK( sched->hasGroup( "INJ" )); + BOOST_CHECK( sched->hasGroup( "OP" )); + + GroupPtr group = sched->getGroup("INJ"); + BOOST_CHECK_EQUAL( WATER , group->getInjectionPhase( 3 )); + BOOST_CHECK_EQUAL( VREP , group->getInjectionControlMode( 3 )); + BOOST_CHECK_EQUAL( 10 , group->getSurfaceMaxRate( 3 )); + BOOST_CHECK_EQUAL( 20 , group->getReservoirMaxRate( 3 )); + BOOST_CHECK_EQUAL( 0.75 , group->getTargetReinjectFraction( 3 )); + BOOST_CHECK_EQUAL( 0.95 , group->getTargetVoidReplacementFraction( 3 )); + + BOOST_CHECK_EQUAL( OIL , group->getInjectionPhase( 6 )); + BOOST_CHECK_EQUAL( RATE , group->getInjectionControlMode( 6 )); + BOOST_CHECK_EQUAL( 1000 , group->getSurfaceMaxRate( 6 )); +} diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS b/testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS index 3660beca1..6e5e364e5 100644 --- a/testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS @@ -21,7 +21,7 @@ WELSPECS GCONINJE - 'INJ' 'WATER' 'VREP' 3* 0.95 6* / + 'INJ' 'WATER' 'VREP' 10 20 0.75 0.95 6* / / @@ -30,7 +30,7 @@ TSTEP -- 4,5,6 GCONINJE - 'INJ' 'WATER' 'RATE' 1000 2* 0.95 6* / + 'INJ' 'OIL' 'RATE' 1000 2* 0.95 6* / /