From 1cc38786dcb41005dc81e9a5d684e45e58ccef29 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 24 Jan 2014 12:36:45 +0100 Subject: [PATCH 1/2] Renamed well->InjectionRate to SurfaceInjectionRate. --- .../EclipseState/Schedule/Schedule.cpp | 4 ++-- .../eclipse/EclipseState/Schedule/Well.cpp | 12 +++++------ .../eclipse/EclipseState/Schedule/Well.hpp | 6 +++--- .../EclipseState/Schedule/tests/WellTests.cpp | 20 +++++++++---------- .../ScheduleCreateFromDeck.cpp | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 9a2cf6129..c13c4e0c4 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -190,7 +190,7 @@ namespace Opm { WellPtr well = getWell(wellName); double injectionRate = record->getItem("SURFACE_FLOW_TARGET")->getSIDouble(0); - well->setInjectionRate( currentStep , injectionRate ); + well->setSurfaceInjectionRate( currentStep , injectionRate ); well->setInPredictionMode(currentStep, true); } } @@ -202,7 +202,7 @@ namespace Opm { WellPtr well = getWell(wellName); double injectionRate = record->getItem("RATE")->getSIDouble(0); - well->setInjectionRate( currentStep , injectionRate ); + well->setSurfaceInjectionRate( currentStep , injectionRate ); well->setInPredictionMode(currentStep, false ); } } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp index 076afa6ee..281d7390e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp @@ -31,7 +31,7 @@ namespace Opm { : m_oilRate( new DynamicState( timeMap , 0.0)) , m_gasRate(new DynamicState(timeMap, 0.0)), m_waterRate(new DynamicState(timeMap, 0.0)), - m_injectionRate(new DynamicState(timeMap, 0.0)), + m_surfaceInjectionRate(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()) )), @@ -85,12 +85,12 @@ namespace Opm { switch2Producer( timeStep ); } - double Well::getInjectionRate(size_t timeStep) const { - return m_injectionRate->get(timeStep); + double Well::getSurfaceInjectionRate(size_t timeStep) const { + return m_surfaceInjectionRate->get(timeStep); } - void Well::setInjectionRate(size_t timeStep, double injectionRate) { - m_injectionRate->add(timeStep, injectionRate); + void Well::setSurfaceInjectionRate(size_t timeStep, double injectionRate) { + m_surfaceInjectionRate->add(timeStep, injectionRate); switch2Injector( timeStep ); } @@ -104,7 +104,7 @@ namespace Opm { void Well::switch2Producer(size_t timeStep ) { m_isProducer->add(timeStep , true); - m_injectionRate->add(timeStep, 0); + m_surfaceInjectionRate->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 2ab5690c3..5d2e4d1d4 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.hpp @@ -46,8 +46,8 @@ namespace Opm { void setGasRate(size_t timeStep, double gasRate); double getWaterRate(size_t timeStep) const; void setWaterRate(size_t timeStep, double waterRate); - double getInjectionRate(size_t timeStep) const; - void setInjectionRate(size_t timeStep, double injectionRate); + double getSurfaceInjectionRate(size_t timeStep) const; + void setSurfaceInjectionRate(size_t timeStep, double injectionRate); int getHeadI() const; int getHeadJ() const; @@ -70,7 +70,7 @@ namespace Opm { std::shared_ptr > m_oilRate; std::shared_ptr > m_gasRate; std::shared_ptr > m_waterRate; - std::shared_ptr > m_injectionRate; + std::shared_ptr > m_surfaceInjectionRate; 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 a52d80cb9..085cf0d0e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/tests/WellTests.cpp @@ -149,14 +149,14 @@ BOOST_AUTO_TEST_CASE(setWaterRate_RateSetCorrect) { } -BOOST_AUTO_TEST_CASE(setInjectionRate_RateSetCorrect) { +BOOST_AUTO_TEST_CASE(setSurfaceInjectionRate_RateSetCorrect) { Opm::TimeMapPtr timeMap = createXDaysTimeMap(10); Opm::Well well("WELL1" , 0, 0, 0.0, timeMap , 0); - BOOST_CHECK_EQUAL(0.0 , well.getInjectionRate( 5 )); - well.setInjectionRate( 5 , 108 ); - BOOST_CHECK_EQUAL(108 , well.getInjectionRate( 5 )); - BOOST_CHECK_EQUAL(108 , well.getInjectionRate( 8 )); + BOOST_CHECK_EQUAL(0.0 , well.getSurfaceInjectionRate( 5 )); + well.setSurfaceInjectionRate( 5 , 108 ); + BOOST_CHECK_EQUAL(108 , well.getSurfaceInjectionRate( 5 )); + BOOST_CHECK_EQUAL(108 , well.getSurfaceInjectionRate( 8 )); } @@ -169,10 +169,10 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { BOOST_CHECK_EQUAL( true , well.isProducer(0)); /* Set an injection rate => Well becomes an Injector */ - well.setInjectionRate(3 , 100); + well.setSurfaceInjectionRate(3 , 100); BOOST_CHECK_EQUAL( true , well.isInjector(3)); BOOST_CHECK_EQUAL( false , well.isProducer(3)); - BOOST_CHECK_EQUAL( 100 , well.getInjectionRate(3)); + BOOST_CHECK_EQUAL( 100 , well.getSurfaceInjectionRate(3)); /* Set rates => Well becomes a producer; injection rate should be set to 0. */ well.setOilRate(4 , 100 ); @@ -181,16 +181,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.getInjectionRate(4)); + BOOST_CHECK_EQUAL( 0 , well.getSurfaceInjectionRate(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.setInjectionRate( 6 , 50 ); + well.setSurfaceInjectionRate( 6 , 50 ); BOOST_CHECK_EQUAL( true , well.isInjector(6)); BOOST_CHECK_EQUAL( false , well.isProducer(6)); - BOOST_CHECK_EQUAL( 50 , well.getInjectionRate(6)); + BOOST_CHECK_EQUAL( 50 , well.getSurfaceInjectionRate(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 03fc26e02..dff514564 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -102,8 +102,8 @@ BOOST_AUTO_TEST_CASE(WellTesting) { BOOST_CHECK_CLOSE(13000/Metric::Time , well1->getOilRate(8) , 0.001); BOOST_CHECK( well1->isInjector(9)); - BOOST_CHECK_CLOSE(20000/Metric::Time , well1->getInjectionRate(9) , 0.001); - BOOST_CHECK_CLOSE(5000/Metric::Time , well1->getInjectionRate(10) , 0.001); + BOOST_CHECK_CLOSE(20000/Metric::Time , well1->getSurfaceInjectionRate(9) , 0.001); + BOOST_CHECK_CLOSE(5000/Metric::Time , well1->getSurfaceInjectionRate(10) , 0.001); } } From 1ba278022a92ce37e7205e665b829cb60b499e90 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 24 Jan 2014 13:24:22 +0100 Subject: [PATCH 2/2] Have added ReservoirRates to well injector. --- .../EclipseState/Schedule/Schedule.cpp | 6 +++-- .../eclipse/EclipseState/Schedule/Well.cpp | 12 +++++++++ .../eclipse/EclipseState/Schedule/Well.hpp | 3 +++ .../EclipseState/Schedule/tests/WellTests.cpp | 25 ++++++++++++++++--- .../ScheduleCreateFromDeck.cpp | 2 ++ .../SCHEDULE/SCHEDULE_WELLS2 | 4 +-- 6 files changed, 45 insertions(+), 7 deletions(-) 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 / /