diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index c13c4e0c4..4a747754a 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -188,9 +188,11 @@ namespace Opm { 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")->getSIDouble(0); + double surfaceInjectionRate = record->getItem("SURFACE_FLOW_TARGET")->getSIDouble(0); + double reservoirInjectionRate = record->getItem("RESV_FLOW_TARGET")->getSIDouble(0); - well->setSurfaceInjectionRate( currentStep , injectionRate ); + well->setSurfaceInjectionRate( currentStep , surfaceInjectionRate ); + well->setReservoirInjectionRate( currentStep , reservoirInjectionRate ); well->setInPredictionMode(currentStep, true); } } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp index 281d7390e..a0278578d 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp @@ -32,6 +32,7 @@ namespace Opm { m_gasRate(new DynamicState(timeMap, 0.0)), m_waterRate(new DynamicState(timeMap, 0.0)), m_surfaceInjectionRate(new DynamicState(timeMap, 0.0)), + m_reservoirInjectionRate(new DynamicState(timeMap, 0.0)), m_inPredictionMode(new DynamicState(timeMap, true)), m_isProducer(new DynamicState(timeMap, true)) , m_completions( new DynamicState( timeMap , CompletionSetConstPtr( new CompletionSet()) )), @@ -94,6 +95,16 @@ namespace Opm { switch2Injector( timeStep ); } + double Well::getReservoirInjectionRate(size_t timeStep) const { + return m_reservoirInjectionRate->get(timeStep); + } + + void Well::setReservoirInjectionRate(size_t timeStep, double injectionRate) { + m_reservoirInjectionRate->add(timeStep, injectionRate); + switch2Injector( timeStep ); + } + + bool Well::isProducer(size_t timeStep) const { return m_isProducer->get(timeStep); } @@ -105,6 +116,7 @@ namespace Opm { void Well::switch2Producer(size_t timeStep ) { m_isProducer->add(timeStep , true); m_surfaceInjectionRate->add(timeStep, 0); + m_reservoirInjectionRate->add(timeStep , 0); } void Well::switch2Injector(size_t timeStep ) { diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well.hpp index 5d2e4d1d4..03a2ddfec 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.hpp @@ -48,6 +48,8 @@ namespace Opm { void setWaterRate(size_t timeStep, double waterRate); double getSurfaceInjectionRate(size_t timeStep) const; void setSurfaceInjectionRate(size_t timeStep, double injectionRate); + double getReservoirInjectionRate(size_t timeStep) const; + void setReservoirInjectionRate(size_t timeStep, double injectionRate); int getHeadI() const; int getHeadJ() const; @@ -71,6 +73,7 @@ namespace Opm { std::shared_ptr > m_gasRate; std::shared_ptr > m_waterRate; std::shared_ptr > m_surfaceInjectionRate; + std::shared_ptr > m_reservoirInjectionRate; std::shared_ptr > m_inPredictionMode; std::shared_ptr > m_isProducer; diff --git a/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp b/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp index 085cf0d0e..4416410bb 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp @@ -160,6 +160,17 @@ BOOST_AUTO_TEST_CASE(setSurfaceInjectionRate_RateSetCorrect) { } +BOOST_AUTO_TEST_CASE(setReservoirInjectionRate_RateSetCorrect) { + Opm::TimeMapPtr timeMap = createXDaysTimeMap(10); + Opm::Well well("WELL1" , 0, 0, 0.0, timeMap , 0); + + BOOST_CHECK_EQUAL(0.0 , well.getReservoirInjectionRate( 5 )); + well.setReservoirInjectionRate( 5 , 108 ); + BOOST_CHECK_EQUAL(108 , well.getReservoirInjectionRate( 5 )); + BOOST_CHECK_EQUAL(108 , well.getReservoirInjectionRate( 8 )); +} + + BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { Opm::TimeMapPtr timeMap = createXDaysTimeMap(10); Opm::Well well("WELL1" , 0, 0, 0.0, timeMap ,0); @@ -168,11 +179,18 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { BOOST_CHECK_EQUAL( false , well.isInjector(0)); BOOST_CHECK_EQUAL( true , well.isProducer(0)); - /* Set an injection rate => Well becomes an Injector */ + /* Set a surface injection rate => Well becomes an Injector */ well.setSurfaceInjectionRate(3 , 100); BOOST_CHECK_EQUAL( true , well.isInjector(3)); BOOST_CHECK_EQUAL( false , well.isProducer(3)); BOOST_CHECK_EQUAL( 100 , well.getSurfaceInjectionRate(3)); + + /* Set a reservoir injection rate => Well becomes an Injector */ + well.setReservoirInjectionRate(4 , 200); + BOOST_CHECK_EQUAL( true , well.isInjector(4)); + BOOST_CHECK_EQUAL( false , well.isProducer(4)); + BOOST_CHECK_EQUAL( 200 , well.getReservoirInjectionRate(4)); + /* Set rates => Well becomes a producer; injection rate should be set to 0. */ well.setOilRate(4 , 100 ); @@ -182,15 +200,16 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { BOOST_CHECK_EQUAL( false , well.isInjector(4)); BOOST_CHECK_EQUAL( true , well.isProducer(4)); BOOST_CHECK_EQUAL( 0 , well.getSurfaceInjectionRate(4)); + BOOST_CHECK_EQUAL( 0 , well.getReservoirInjectionRate(4)); BOOST_CHECK_EQUAL( 100 , well.getOilRate(4)); BOOST_CHECK_EQUAL( 200 , well.getGasRate(4)); BOOST_CHECK_EQUAL( 300 , well.getWaterRate(4)); /* Set injection rate => Well becomes injector - all produced rates -> 0 */ - well.setSurfaceInjectionRate( 6 , 50 ); + well.setReservoirInjectionRate( 6 , 50 ); BOOST_CHECK_EQUAL( true , well.isInjector(6)); BOOST_CHECK_EQUAL( false , well.isProducer(6)); - BOOST_CHECK_EQUAL( 50 , well.getSurfaceInjectionRate(6)); + BOOST_CHECK_EQUAL( 50 , well.getReservoirInjectionRate(6)); BOOST_CHECK_EQUAL( 0 , well.getOilRate(6)); BOOST_CHECK_EQUAL( 0 , well.getGasRate(6)); BOOST_CHECK_EQUAL( 0 , well.getWaterRate(6)); diff --git a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp index dff514564..fd9f8f81f 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -104,6 +104,8 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK( well1->isInjector(9)); BOOST_CHECK_CLOSE(20000/Metric::Time , well1->getSurfaceInjectionRate(9) , 0.001); BOOST_CHECK_CLOSE(5000/Metric::Time , well1->getSurfaceInjectionRate(10) , 0.001); + + BOOST_CHECK_CLOSE(200000/Metric::Time , well1->getReservoirInjectionRate(9) , 0.001); } } diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 index 075dbc13f..7c091a55e 100644 --- a/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2 @@ -82,7 +82,7 @@ DATES -- 9 / WCONINJE - 'W_1' 'WATER' 1* 'RATE' 20000.000 5* / + 'W_1' 'WATER' 1* 'RATE' 20000.000 200000.000 5* / / DATES -- 10 @@ -90,7 +90,7 @@ DATES -- 10 / WCONINJH - 'W_1' 'WATER' 1* 5000.000 / + 'W_1' 'WATER' 1* 5000.000 50000.000 / /