From 9db42f6eb3b7a52a18c5fb215cae62656bd2b971 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Tue, 4 Feb 2014 16:12:49 +0100 Subject: [PATCH] Added support for WELOPEN in the Schedule class, NOT support specific completions, only the well --- .../EclipseState/Schedule/Schedule.cpp | 18 ++++++ .../EclipseState/Schedule/Schedule.hpp | 1 + .../ScheduleCreateFromDeck.cpp | 24 ++++++++ opm/parser/share/keywords/W/WELOPEN | 4 +- .../SCHEDULE/SCHEDULE_WELOPEN | 58 +++++++++++++++++++ .../SCHEDULE/SCHEDULE_WELOPEN_INVALID | 27 +++++++++ 6 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN create mode 100644 testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN_INVALID diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 5ed418904..4109a990a 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -88,6 +88,8 @@ namespace Opm { if (keyword->name() == "COMPDAT") handleCOMPDAT(keyword, currentStep); + if (keyword->name() == "WELOPEN") + handleWELOPEN(keyword, currentStep); if (keyword->name() == "GRUPTREE") handleGRUPTREE(keyword, currentStep); @@ -287,6 +289,22 @@ namespace Opm { } } + void Schedule::handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep) { + for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { + DeckRecordConstPtr record = keyword->getRecord(recordNr); + const std::string& wellName = record->getItem("WELL")->getString(0); + WellPtr well = getWell(wellName); + + for (size_t i=2; i<7; i++) { + if (record->getItem(i)->getInt(0) > 0 ) { + throw std::logic_error("Error processing WELOPEN keyword, specifying specific connections is not supported yet."); + } + } + WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getString(0)); + well->setStatus(currentStep, status); + } + } + void Schedule::handleGCONINJE(DeckKeywordConstPtr keyword, size_t currentStep) { for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 061486219..9b399321f 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -75,6 +75,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 handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep); void handleGCONINJE(DeckKeywordConstPtr keyword, size_t currentStep); void handleGCONPROD(DeckKeywordConstPtr keyword, size_t currentStep); void handleDATES(DeckKeywordConstPtr keyword); diff --git a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp index 27af3dddd..548e932b4 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -408,3 +408,27 @@ BOOST_AUTO_TEST_CASE(WellTestWELSPECS_InvalidConfig_Throws) { } +BOOST_AUTO_TEST_CASE(WellTestWELOPEN_ConfigWithIndexes_Throws) { + ParserPtr parser(new Parser()); + boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN_INVALID"); + DeckPtr deck = parser->parseFile(scheduleFile.string()); + BOOST_CHECK_THROW(new Schedule(deck), std::logic_error); +} + + +BOOST_AUTO_TEST_CASE(WellTestWELOPENControlsSet) { + ParserPtr parser(new Parser()); + boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN"); + DeckPtr deck = parser->parseFile(scheduleFile.string()); + ScheduleConstPtr sched(new Schedule(deck)); + + WellConstPtr well1 = sched->getWell("W_1"); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, sched->getWell("W_1")->getStatus(0)); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, sched->getWell("W_1")->getStatus(1)); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, sched->getWell("W_1")->getStatus(2)); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::STOP, sched->getWell("W_1")->getStatus(3)); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::AUTO, sched->getWell("W_1")->getStatus(4)); + BOOST_CHECK_EQUAL(WellCommon::StatusEnum::STOP, sched->getWell("W_1")->getStatus(5)); +} + + diff --git a/opm/parser/share/keywords/W/WELOPEN b/opm/parser/share/keywords/W/WELOPEN index e217f862b..6db7d8e97 100644 --- a/opm/parser/share/keywords/W/WELOPEN +++ b/opm/parser/share/keywords/W/WELOPEN @@ -1,9 +1,9 @@ {"name" : "WELOPEN", "items" : [ - {"name" : "well" , "value_type" : "STRING"}, + {"name" : "WELL" , "value_type" : "STRING"}, {"name" : "STATUS" , "value_type" : "STRING" , "default" : "OPEN"}, {"name" : "I" , "value_type" : "INT" , "default" : -1}, {"name" : "J" , "value_type" : "INT" , "default" : -1}, {"name" : "K" , "value_type" : "INT" , "default" : -1}, {"name" : "C1" , "value_type" : "INT" , "default" : -1}, {"name" : "C2" , "value_type" : "INT" , "default" : -1} -]} \ No newline at end of file +]} diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN new file mode 100644 index 000000000..4847767ad --- /dev/null +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN @@ -0,0 +1,58 @@ +START +10 MAI 2007 / + + +SCHEDULE + +WELSPECS + 'W_1' 'GROUP1' 30 37 1* 'OIL' 7* / +/ + +COMPDAT +-- WELL I J K1 K2 Sat. CF DIAM KH SKIN ND DIR Ro + 'W_1' 10 32 1 1 'OPEN' 1* 118.457 0.216 12025.229 2* 'Z' 24.860 / +/ + +TSTEP + 10 / + +WELOPEN + 'W_1' 'SHUT' 5* / +/ + +TSTEP + 10 / + +WELOPEN + 'W_1' 'OPEN' 5* / +/ + + +TSTEP + 10 / + +WELOPEN + 'W_1' 'STOP' 5* / +/ + + +TSTEP + 10 / + +WELOPEN + 'W_1' 'AUTO' 5* / +/ + + +TSTEP + 10 / + +WELOPEN + 'W_1' 'STOP' 0 0 0 2* / +/ + + +TSTEP + 10 / + +END diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN_INVALID b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN_INVALID new file mode 100644 index 000000000..48a70ee15 --- /dev/null +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELOPEN_INVALID @@ -0,0 +1,27 @@ +START +10 MAI 2007 / + + +SCHEDULE + +WELSPECS + 'W_1' 'GROUP1' 30 37 1* 'OIL' 7* / + 'W_2' 'GROUP1' 20 51 1* 'OIL' 7* / +/ + +COMPDAT +-- WELL I J K1 K2 Sat. CF DIAM KH SKIN ND DIR Ro + 'W_1' 10 32 1 1 'OPEN' 1* 118.457 0.216 12025.229 2* 'Z' 24.860 / +/ + +TSTEP + 10 / + +WELOPEN + 'W_1' 'SHUT' 1 0 0 2* / +/ + +TSTEP + 10 / + +END