Support CCI(R/T)
This commit is contained in:
parent
7a91bebd61
commit
5c68a0aaa8
@ -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 > },
|
||||
|
@ -64,6 +64,8 @@
|
||||
"CVIR",
|
||||
"CVIT",
|
||||
"CVITL",
|
||||
"CCIR",
|
||||
"CCIT",
|
||||
"CWCT",
|
||||
"CWCTL",
|
||||
"CGOR",
|
||||
|
@ -556,6 +556,14 @@ CNIT
|
||||
'*' /
|
||||
/
|
||||
|
||||
CCIR
|
||||
'*' /
|
||||
/
|
||||
|
||||
CCIT
|
||||
'*' /
|
||||
/
|
||||
|
||||
CWPT
|
||||
'W_1' 1 1 1 /
|
||||
/
|
||||
|
@ -628,14 +628,19 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
|
||||
/* 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 * 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( 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*/
|
||||
|
Loading…
Reference in New Issue
Block a user