diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 8316ccb0d..422830b03 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -50,6 +50,7 @@ #include +#include #include #include #include @@ -738,39 +739,31 @@ inline quantity injection_history( const fn_args& args ) { return { sum, rate_unit< phase >() }; } -inline quantity abondoned_injectors( const fn_args& args ) { +template< bool injection > +inline quantity abondoned_well( const fn_args& args ) { std::size_t count = 0; for (const auto& sched_well : args.schedule_wells) { - if (sched_well.hasInjected()) { - const auto& well_name = sched_well.name(); - auto well_iter = args.wells.find( well_name ); - if (well_iter == args.wells.end()) - continue; + if (injection && !sched_well.hasInjected()) + continue; - count += !well_iter->second.flowing(); + if (!injection && !sched_well.hasProduced()) + continue; + + + const auto& well_name = sched_well.name(); + auto well_iter = args.wells.find( well_name ); + if (well_iter == args.wells.end()) { + count += 1; + continue; } + + count += !well_iter->second.flowing(); } return { 1.0 * count, measure::identity }; } -inline quantity abondoned_producers( const fn_args& args ) { - std::size_t count = 0; - - for (const auto& sched_well : args.schedule_wells) { - if (sched_well.hasProduced()) { - const auto& well_name = sched_well.name(); - auto well_iter = args.wells.find( well_name ); - if (well_iter == args.wells.end()) - continue; - - count += !well_iter->second.flowing(); - } - } - - return { 1.0 * count, measure::identity }; -} inline quantity res_vol_production_target( const fn_args& args ) { @@ -1379,8 +1372,8 @@ static const std::unordered_map< std::string, ofun > funs = { { "FMWIN", flowing< injector > }, { "FMWPR", flowing< producer > }, { "FVPRT", res_vol_production_target }, - { "FMWPA", abondoned_producers }, - { "FMWIA", abondoned_injectors }, + { "FMWPA", abondoned_well< producer > }, + { "FMWIA", abondoned_well< injector >}, //Field control mode { "FMCTP", group_control< false, true, false, false >}, diff --git a/tests/SPE1CASE1.DATA b/tests/SPE1CASE1.DATA index ef7c1eeb7..b56c00f83 100644 --- a/tests/SPE1CASE1.DATA +++ b/tests/SPE1CASE1.DATA @@ -455,7 +455,7 @@ TSTEP WELOPEN 'RFTP' 'SHUT' / - 'RFTI' 'SHUT' / + 'RFTI' 'STOP' / / TSTEP diff --git a/tests/msim/test_msim.cpp b/tests/msim/test_msim.cpp index b1e6db6e4..22eb142c4 100644 --- a/tests/msim/test_msim.cpp +++ b/tests/msim/test_msim.cpp @@ -56,11 +56,16 @@ double prod_rft(const EclipseState& es, const Schedule& /* sched */, const Summ return -units.to_si(UnitSystem::measure::rate, 0.0); } -double inj_rft(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { +double inj_rfti(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { const auto& units = es.getUnits(); return units.to_si(UnitSystem::measure::rate, 0.0); } +double inj_inj(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { + const auto& units = es.getUnits(); + return units.to_si(UnitSystem::measure::rate, 100); +} + void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solution& sol, size_t /* report_step */, double seconds_elapsed) { const auto& grid = es.getInputGrid(); const auto& units = es.getUnits(); @@ -90,7 +95,8 @@ BOOST_AUTO_TEST_CASE(RUN) { msim.well_rate("PROD", data::Rates::opt::oil, prod_opr); msim.well_rate("RFTP", data::Rates::opt::oil, prod_rft); - msim.well_rate("RFTI", data::Rates::opt::wat, inj_rft); + msim.well_rate("RFTI", data::Rates::opt::wat, inj_rfti); + msim.well_rate("INJ", data::Rates::opt::gas, inj_inj); msim.solution("PRESSURE", pressure); { const WorkArea work_area("test_msim"); @@ -128,6 +134,7 @@ BOOST_AUTO_TEST_CASE(RUN) { BOOST_CHECK_EQUAL( fmwpa[0], 0.0 ); BOOST_CHECK_EQUAL( fmwia[0], 0.0 ); + // The RFTP /RFTI wells will appear as an abondoned well. BOOST_CHECK_EQUAL( fmwpa[dates.size() - 1], 1.0 ); BOOST_CHECK_EQUAL( fmwia[dates.size() - 1], 1.0 );