diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 6bb9aaa70..22fa46a58 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -72,6 +72,11 @@ namespace Opm { if (keyword->name() == "WCONPROD") handleWCONPROD(keyword, currentStep); + if (keyword->name() == "WCONINJE") + handleWCONINJE(keyword, currentStep); + + if (keyword->name() == "WCONINJH") + handleWCONINJH(keyword, currentStep); if (keyword->name() == "COMPDAT") handleCOMPDAT( keyword , currentStep ); @@ -101,24 +106,52 @@ namespace Opm { } } - void Schedule::handleWCON(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode) { + void Schedule::handleWCONProducer(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode) { for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { DeckRecordConstPtr record = keyword->getRecord(recordNr); - const std::string& wellName = record->getItem(0)->getString(0); - double orat = record->getItem("ORAT")->getDouble(0); + const std::string& wellName = record->getItem("WELL")->getString(0); WellPtr well = getWell(wellName); - + double orat = record->getItem("ORAT")->getDouble(0); + double wrat = record->getItem("WRAT")->getDouble(0); + double grat = record->getItem("GRAT")->getDouble(0); + well->setOilRate(currentStep, orat); + well->setWaterRate(currentStep, wrat); + well->setGasRate(currentStep, grat); well->setInPredictionMode(currentStep, isPredictionMode); } } void Schedule::handleWCONHIST(DeckKeywordConstPtr keyword, size_t currentStep) { - handleWCON(keyword, currentStep, false); + handleWCONProducer(keyword, currentStep, false); } void Schedule::handleWCONPROD(DeckKeywordConstPtr keyword, size_t currentStep) { - handleWCON(keyword, currentStep, true); + handleWCONProducer(keyword, currentStep, true); + } + + void Schedule::handleWCONINJE(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); + double injectionRate = record->getItem("SURFACE_FLOW_TARGET")->getDouble(0); + + well->setInjectionRate( currentStep , injectionRate ); + well->setInPredictionMode(currentStep, true); + } + } + + void Schedule::handleWCONINJH(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); + double injectionRate = record->getItem("RATE")->getDouble(0); + + well->setInjectionRate( currentStep , injectionRate ); + well->setInPredictionMode(currentStep, false ); + } } void Schedule::handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep) { diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 8e60c55b5..969fb71c7 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -55,10 +55,12 @@ namespace Opm void addWell(const std::string& wellName); void handleWELSPECS(DeckKeywordConstPtr keyword); - void handleWCON(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode); + void handleWCONProducer(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode); void handleWCONHIST(DeckKeywordConstPtr keyword , size_t currentStep); void handleWCONPROD(DeckKeywordConstPtr keyword, size_t currentStep); void handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep); + void handleWCONINJE(DeckKeywordConstPtr keyword, size_t currentStep); + void handleWCONINJH(DeckKeywordConstPtr keyword, size_t currentStep); void handleDATES(DeckKeywordConstPtr keyword); void handleTSTEP(DeckKeywordConstPtr keyword); }; diff --git a/opm/parser/eclipse/IntegrationTests/ParseACTION.cpp b/opm/parser/eclipse/IntegrationTests/ParseACTION.cpp index 4574147bd..2e4e3e7dd 100644 --- a/opm/parser/eclipse/IntegrationTests/ParseACTION.cpp +++ b/opm/parser/eclipse/IntegrationTests/ParseACTION.cpp @@ -64,14 +64,14 @@ BOOST_AUTO_TEST_CASE( parse_ACTION_OK ) { DeckRecordConstPtr rec3 = kw1->getRecord(2); BOOST_CHECK_EQUAL( 11U , rec3->size() ); - DeckItemConstPtr item1 = rec1->getItem("WellName"); + DeckItemConstPtr item1 = rec1->getItem("WELL"); DeckItemConstPtr item1_index = rec1->getItem(0); BOOST_CHECK_EQUAL( item1 , item1_index ); BOOST_CHECK_EQUAL( "OP_1" , item1->getString(0)); - item1 = rec3->getItem("WellName"); + item1 = rec3->getItem("WELL"); BOOST_CHECK_EQUAL( "OP_3" , item1->getString(0)); diff --git a/opm/parser/eclipse/IntegrationTests/ParseWCONHIST.cpp b/opm/parser/eclipse/IntegrationTests/ParseWCONHIST.cpp index 5022f4fc3..8455decb7 100644 --- a/opm/parser/eclipse/IntegrationTests/ParseWCONHIST.cpp +++ b/opm/parser/eclipse/IntegrationTests/ParseWCONHIST.cpp @@ -49,14 +49,14 @@ BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) { DeckRecordConstPtr rec3 = kw1->getRecord(2); BOOST_CHECK_EQUAL( 11U , rec3->size() ); - DeckItemConstPtr item1 = rec1->getItem("WellName"); + DeckItemConstPtr item1 = rec1->getItem("WELL"); DeckItemConstPtr item1_index = rec1->getItem(0); BOOST_CHECK_EQUAL( item1 , item1_index ); BOOST_CHECK_EQUAL( "OP_1" , item1->getString(0)); - item1 = rec3->getItem("WellName"); + item1 = rec3->getItem("WELL"); BOOST_CHECK_EQUAL( "OP_3" , item1->getString(0)); @@ -65,5 +65,5 @@ BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) { BOOST_CHECK_EQUAL( 2U , deck->numKeywords("WCONHIST")); kw1 = deck->getKeyword("WCONHIST" , 1 ); rec3 = kw1->getRecord(2); - BOOST_CHECK_EQUAL( "OP_3_B" , rec3->getItem("WellName")->getString(0)); + BOOST_CHECK_EQUAL( "OP_3_B" , rec3->getItem("WELL")->getString(0)); } diff --git a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp index a3a459a3a..b1e17ee74 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -68,26 +68,29 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK_EQUAL(4000, well1->getOilRate(3)); BOOST_CHECK_EQUAL(4000, well1->getOilRate(4)); BOOST_CHECK_EQUAL(4000, well1->getOilRate(5)); + BOOST_CHECK_EQUAL(4 , well1->getWaterRate(3)); + BOOST_CHECK_EQUAL(12345 , well1->getGasRate(3)); + BOOST_CHECK_EQUAL(4 , well1->getWaterRate(4)); + BOOST_CHECK_EQUAL(12345 , well1->getGasRate(4)); + BOOST_CHECK_EQUAL(4 , well1->getWaterRate(5)); + BOOST_CHECK_EQUAL(12345 , well1->getGasRate(5)); + BOOST_CHECK(!well1->isInPredictionMode(6)); BOOST_CHECK_EQUAL(14000, well1->getOilRate(6)); BOOST_CHECK(well1->isInPredictionMode(7)); BOOST_CHECK_EQUAL(11000, well1->getOilRate(7)); + BOOST_CHECK_EQUAL(44 , well1->getWaterRate(7)); + BOOST_CHECK_EQUAL(188 , well1->getGasRate(7)); BOOST_CHECK(!well1->isInPredictionMode(8)); BOOST_CHECK_EQUAL(13000, well1->getOilRate(8)); - BOOST_CHECK_EQUAL(13000, well1->getOilRate(9)); - BOOST_CHECK_EQUAL(13000, well1->getOilRate(10)); - - BOOST_CHECK_EQUAL( 3U , sched->numWells()); - BOOST_CHECK( sched->hasWell("W_1")); - BOOST_CHECK( sched->hasWell("W_2")); - BOOST_CHECK( sched->hasWell("W_3")); - { - WellPtr well1 = sched->getWell("W_1"); - BOOST_CHECK_EQUAL( 13000 , well1->getOilRate( 8 )); - } + + BOOST_CHECK( well1->isInjector(9)); + BOOST_CHECK_EQUAL(20000, well1->getInjectionRate(9)); + BOOST_CHECK_EQUAL(5000, well1->getInjectionRate(10)); + } } diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 index 5a22da80c..73f67be3c 100644 --- a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 @@ -36,7 +36,7 @@ COMPDAT WCONHIST - 'W_1' 'OPEN' 'ORAT' 4000.000 4.000 1.46402E+006 5* / + 'W_1' 'OPEN' 'ORAT' 4000.000 4.000 12345 5* / 'W_2' 'OPEN' 'ORAT' 7998.000 2.000 1461075.000 5* / 'W_3' 'OPEN' 'ORAT' 7999.000 1.000 1471824.000 5* / / @@ -63,7 +63,7 @@ COMPDAT WCONPROD - 'W_1' 'OPEN' 'ORAT' 11000.000 4.000 1.46402E+006 5* / + 'W_1' 'OPEN' 'ORAT' 11000.000 44.000 188 5* / 'W_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* / 'W_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* / / @@ -77,7 +77,23 @@ WCONHIST 'W_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* / / -DATES -- 9, 10 +DATES -- 9 10 JLY 2008 / +/ + +WCONINJE + 'W_1' 'WATER' 1* 'RATE' 20000.000 5* / +/ + +DATES -- 10 10 AUG 2008 / / + +WCONINJH + 'W_1' 'WATER' 1* 5000.000 / +/ + + +DATES -- 11 + 10 SEP 2008 / +/