From 6698381d8ec6486907f5d04f5535db35f223a7cd Mon Sep 17 00:00:00 2001 From: "Sveinung Styve Rundhovde (IT SI SIB)" Date: Mon, 27 Nov 2017 14:33:13 +0100 Subject: [PATCH] Add WTHPH+WBHPH keywords --- opm/output/eclipse/Summary.cpp | 33 +++++++++++++++++++++++++++++++++ tests/summary_deck.DATA | 6 +++--- tests/test_Summary.cpp | 10 ++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/opm/output/eclipse/Summary.cpp b/opm/output/eclipse/Summary.cpp index 2e3974b..d8f2c49 100644 --- a/opm/output/eclipse/Summary.cpp +++ b/opm/output/eclipse/Summary.cpp @@ -261,6 +261,36 @@ inline quantity thp( const fn_args& args ) { return { p->second.thp, measure::pressure }; } +inline quantity bhp_history( const fn_args& args ) { + if( args.timestep == 0 ) return { 0.0, measure::pressure }; + + const auto timestep = args.timestep - 1; + const Well* sched_well = args.schedule_wells.front(); + + double bhp_hist; + if ( sched_well->isProducer( timestep ) ) + bhp_hist = sched_well->getProductionProperties( timestep ).BHPH; + else + bhp_hist = sched_well->getInjectionProperties( timestep ).BHPH; + + return { bhp_hist, measure::pressure }; +} + +inline quantity thp_history( const fn_args& args ) { + if( args.timestep == 0 ) return { 0.0, measure::pressure }; + + const auto timestep = args.timestep - 1; + const Well* sched_well = args.schedule_wells.front(); + + double thp_hist; + if ( sched_well->isProducer( timestep ) ) + thp_hist = sched_well->getProductionProperties( timestep ).THPH; + else + thp_hist = sched_well->getInjectionProperties( timestep ).THPH; + + return { thp_hist, measure::pressure }; +} + template< Phase phase > inline quantity production_history( const fn_args& args ) { /* @@ -631,6 +661,9 @@ static const std::unordered_map< std::string, ofun > funs = { sum( production_history< Phase::WATER >, production_history< Phase::OIL > ) ) }, + { "WTHPH", thp_history }, + { "WBHPH", bhp_history }, + { "GWPRH", production_history< Phase::WATER > }, { "GOPRH", production_history< Phase::OIL > }, { "GGPRH", production_history< Phase::GAS > }, diff --git a/tests/summary_deck.DATA b/tests/summary_deck.DATA index c41272b..e1a2d92 100644 --- a/tests/summary_deck.DATA +++ b/tests/summary_deck.DATA @@ -568,13 +568,13 @@ WCONHIST -- history rates are set so that W_1 produces 1, W_2 produces 2 etc. -- index.offset. -- organised as oil-water-gas - W_1 SHUT ORAT 10.1 10 10.2 / - W_2 SHUT ORAT 20.1 20 20.2 / + W_1 SHUT ORAT 10.1 10 10.2 2* 0.2 0.1 / + W_2 SHUT ORAT 20.1 20 20.2 2* 1.2 1.1 / / WCONINJH -- Injection historical rates (water only, as we only support pure injectors) - W_3 WATER STOP 30.0 / + W_3 WATER STOP 30.0 2.1 2.2 / / TSTEP diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 8921eec..ac506c9 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -402,6 +402,16 @@ BOOST_AUTO_TEST_CASE(well_keywords) { BOOST_CHECK_CLOSE( 0.2, ecl_sum_get_well_var( resp, 1, "W_1", "WTHP" ), 1e-5 ); BOOST_CHECK_CLOSE( 1.2, ecl_sum_get_well_var( resp, 1, "W_2", "WTHP" ), 1e-5 ); BOOST_CHECK_CLOSE( 2.2, ecl_sum_get_well_var( resp, 1, "W_3", "WTHP" ), 1e-5 ); + + /* BHP (history) */ + BOOST_CHECK_CLOSE( 0.1, ecl_sum_get_well_var( resp, 1, "W_1", "WBHPH" ), 1e-5 ); + BOOST_CHECK_CLOSE( 1.1, ecl_sum_get_well_var( resp, 1, "W_2", "WBHPH" ), 1e-5 ); + BOOST_CHECK_CLOSE( 2.1, ecl_sum_get_well_var( resp, 1, "W_3", "WBHPH" ), 1e-5 ); + + /* THP (history) */ + BOOST_CHECK_CLOSE( 0.2, ecl_sum_get_well_var( resp, 1, "W_1", "WTHPH" ), 1e-5 ); + BOOST_CHECK_CLOSE( 1.2, ecl_sum_get_well_var( resp, 1, "W_2", "WTHPH" ), 1e-5 ); + BOOST_CHECK_CLOSE( 2.2, ecl_sum_get_well_var( resp, 1, "W_3", "WTHPH" ), 1e-5 ); } BOOST_AUTO_TEST_CASE(group_keywords) {