Add summary evaluation support for CPR

This commit is contained in:
Joakim Hove 2021-03-23 07:46:50 +01:00
parent ee86cf0196
commit 39e5ca32c0
3 changed files with 39 additions and 1 deletions

View File

@ -607,6 +607,37 @@ inline quantity ratel( const fn_args& args ) {
return { sum, unit };
}
inline quantity cpr( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
// The args.num value is the literal value which will go to the
// NUMS array in the eclipse SMSPEC file; the values in this array
// are offset 1 - whereas we need to use this index here to look
// up a completion with offset 0.
const size_t global_index = args.num - 1;
if (args.schedule_wells.empty())
return zero;
const auto& name = args.schedule_wells.front().name();
auto xwPos = args.wells.find(name);
if ((xwPos == args.wells.end()) ||
(xwPos->second.dynamicStatus == Opm::Well::Status::SHUT))
return zero;
const auto& well_data = xwPos->second;
const auto& connection =
std::find_if(well_data.connections.begin(),
well_data.connections.end(),
[global_index](const Opm::data::Connection& c)
{
return c.index == global_index;
});
if (connection == well_data.connections.end())
return zero;
return { connection->pressure, measure::pressure };
}
template< rt phase, bool injection = true >
inline quantity cratel( const fn_args& args ) {
const auto unit = ((phase == rt::polymer) || (phase == rt::brine))
@ -1595,6 +1626,7 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "GVPRT", res_vol_production_target },
{ "CPR", cpr },
{ "CGIRL", cratel< rt::gas, injector> },
{ "CGITL", mul( cratel< rt::gas, injector>, duration) },
{ "CWIRL", cratel< rt::wat, injector> },

View File

@ -737,6 +737,11 @@ CGIR
'W_3' 3 1 1 /
/
CPR
'W_1' 1 1 1 /
/
CWIT
'W_3' /
/

View File

@ -265,7 +265,7 @@ data::Wells result_wells(const bool w3_injector = true)
syncronized with the global index in the COMPDAT keyword in the
input deck.
*/
data::Connection well1_comp1 { 0 , crates1, 1.9 , 123.4, 314.15, 0.35 , 0.25, 2.718e2, 111.222*cp_rm3_per_db() };
data::Connection well1_comp1 { 0 , crates1, 1.9 *unit::barsa , 123.4, 314.15, 0.35 , 0.25, 2.718e2, 111.222*cp_rm3_per_db() };
data::Connection well2_comp1 { 1 , crates2, 1.10 , 123.4, 212.1 , 0.78 , 0.0 , 12.34 , 222.333*cp_rm3_per_db() };
data::Connection well2_comp2 { 101, crates3, 1.11 , 123.4, 150.6 , 0.001, 0.89, 100.0 , 333.444*cp_rm3_per_db() };
data::Connection well3_comp1 { 2 , crates3, 1.11 , 123.4, 456.78, 0.0 , 0.15, 432.1 , 444.555*cp_rm3_per_db() };
@ -1127,6 +1127,7 @@ BOOST_AUTO_TEST_CASE(connection_kewords) {
BOOST_CHECK_CLOSE( 100.0, ecl_sum_get_well_connection_var( resp, 1, "W_1", "CWPR", 1, 1, 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 100.1, ecl_sum_get_well_connection_var( resp, 1, "W_1", "COPR", 1, 1, 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 100.2, ecl_sum_get_well_connection_var( resp, 1, "W_1", "CGPR", 1, 1, 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 1.9, ecl_sum_get_well_connection_var( resp, 1, "W_1", "CPR", 1, 1, 1), 1e-5);
BOOST_CHECK_CLOSE(ecl_sum_get_well_var(resp, 1, "W_1", "WOPRL__1"), ecl_sum_get_well_connection_var(resp, 1, "W_1", "COPR", 1,1,1), 1e-5);
BOOST_CHECK_CLOSE(ecl_sum_get_well_var(resp, 1, "W_2", "WOPRL__2"), ecl_sum_get_well_connection_var(resp, 1, "W_2", "COPR", 2,1,1) +