diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index de5d9ac77..6306ef791 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -324,7 +324,7 @@ inline quantity flowing( const fn_args& args ) { measure::identity }; } -template< rt phase, bool injection = true > +template< rt phase, bool injection = true, bool polymer = false > inline quantity crate( const fn_args& args ) { const quantity zero = { 0, rate_unit< phase >() }; // The args.num value is the literal value which will go to the @@ -334,24 +334,29 @@ inline quantity crate( const fn_args& args ) { const size_t global_index = args.num - 1; if( args.schedule_wells.empty() ) return zero; - const auto& name = args.schedule_wells.front()->name(); + const auto& well = args.schedule_wells.front(); + const auto& name = well->name(); if( args.wells.count( name ) == 0 ) return zero; - const auto& well = args.wells.at( name ); - const auto& completion = std::find_if( well.connections.begin(), - well.connections.end(), + const auto& well_data = args.wells.at( name ); + const auto& completion = std::find_if( well_data.connections.begin(), + well_data.connections.end(), [=]( const data::Connection& c ) { return c.index == global_index; } ); - if( completion == well.connections.end() ) return zero; + if( completion == well_data.connections.end() ) return zero; double eff_fac = efac( args.eff_factors, name ); + double concentration = polymer + ? well->getPolymerProperties( args.sim_step ).m_polymerConcentration + : 1; - const auto v = completion->rates.get( phase, 0.0 ) * eff_fac; + auto v = completion->rates.get( phase, 0.0 ) * eff_fac * concentration; if( ( v > 0 ) != injection ) return zero; + if( !injection ) v *= -1; - if( !injection ) return { -v, rate_unit< phase >() }; + if( polymer ) return { v, measure::mass_rate }; return { v, rate_unit< phase >() }; } @@ -687,6 +692,7 @@ static const std::unordered_map< std::string, ofun > funs = { { "CWIR", crate< rt::wat, injector > }, { "CGIR", crate< rt::gas, injector > }, + { "CCIR", crate< rt::wat, injector, polymer > }, { "CWIT", mul( crate< rt::wat, injector >, duration ) }, { "CGIT", mul( crate< rt::gas, injector >, duration ) }, { "CNIT", mul( crate< rt::solvent, injector >, duration ) }, @@ -700,6 +706,7 @@ static const std::unordered_map< std::string, ofun > funs = { { "COPT", mul( crate< rt::oil, producer >, duration ) }, { "CGPT", mul( crate< rt::gas, producer >, duration ) }, { "CNPT", mul( crate< rt::solvent, producer >, duration ) }, + { "CCIT", mul( crate< rt::wat, injector, polymer >, duration ) }, { "FWPR", rate< rt::wat, producer > }, { "FOPR", rate< rt::oil, producer > }, diff --git a/src/opm/parser/eclipse/share/keywords/000_Eclipse100/C/CONNECTION_PROBE b/src/opm/parser/eclipse/share/keywords/000_Eclipse100/C/CONNECTION_PROBE index a3e4c4f8a..1ed5dad34 100644 --- a/src/opm/parser/eclipse/share/keywords/000_Eclipse100/C/CONNECTION_PROBE +++ b/src/opm/parser/eclipse/share/keywords/000_Eclipse100/C/CONNECTION_PROBE @@ -64,6 +64,8 @@ "CVIR", "CVIT", "CVITL", + "CCIR", + "CCIT", "CWCT", "CWCTL", "CGOR", diff --git a/tests/summary_deck.DATA b/tests/summary_deck.DATA index 4538e05ac..71932c93b 100644 --- a/tests/summary_deck.DATA +++ b/tests/summary_deck.DATA @@ -556,6 +556,14 @@ CNIT '*' / / +CCIR + '*' / +/ + +CCIT + '*' / +/ + CWPT 'W_1' 1 1 1 / / diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index d85bc301c..6892827a5 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -626,21 +626,26 @@ BOOST_AUTO_TEST_CASE(completion_kewords) { BOOST_CHECK_CLOSE( 2 * 100.3, ecl_sum_get_well_completion_var( resp, 2, "W_1", "CNPT", 1 ), 1e-5 ); /* Injection rates */ - BOOST_CHECK_CLOSE( 300.0, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CWIR", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 300.2, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CGIR", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CWIR", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.2, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CGIR", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0 * 1.5, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CCIR", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0 * 2.5, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CCIR", 3 ), 1e-5 ); /* Injection totals */ - BOOST_CHECK_CLOSE( 300.0, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CWIT", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 300.2, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CGIT", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 300.3, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CNIT", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 2 * 300.0, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CWIT", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 2 * 300.2, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CGIT", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 2 * 300.3, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CNIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CWIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.2, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CGIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.3, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CNIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0 * 1.5, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CCIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 2 * 300.0, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CWIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 2 * 300.2, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CGIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 2 * 300.3, ecl_sum_get_well_completion_var( resp, 2, "W_3", "CNIT", 3 ), 1e-5 ); + BOOST_CHECK_CLOSE( 300.0 * 1.5 + 300.0 * 2.5, + ecl_sum_get_well_completion_var( resp, 2, "W_3", "CCIT", 3 ), 1e-5 ); /* Solvent flow rate + or - Note OPM uses negative values for producers, while CNFR outputs positive values for producers*/ BOOST_CHECK_CLOSE( -300.3, ecl_sum_get_well_completion_var( resp, 1, "W_3", "CNFR", 3 ), 1e-5 ); - BOOST_CHECK_CLOSE( 200.3, ecl_sum_get_well_completion_var( resp, 1, "W_2", "CNFR", 2 ), 1e-5 ); + BOOST_CHECK_CLOSE( 200.3, ecl_sum_get_well_completion_var( resp, 1, "W_2", "CNFR", 2 ), 1e-5 ); } BOOST_AUTO_TEST_CASE(field_keywords) {