Support WCI(R/T)

This commit is contained in:
Lars Petter Øren Hauge
2018-06-22 14:09:08 +02:00
parent 1f7a2d5459
commit fc3bc714fc
5 changed files with 61 additions and 3 deletions

View File

@@ -59,6 +59,7 @@ namespace Opm {
rate,
transmissibility,
mass,
mass_rate,
gas_oil_ratio,
oil_gas_ratio,
water_cut,

View File

@@ -132,6 +132,7 @@ using rt = data::Rates::opt;
using measure = UnitSystem::measure;
constexpr const bool injector = true;
constexpr const bool producer = false;
constexpr const bool polymer = true;
/* Some numerical value with its unit tag embedded to enable caller to apply
* unit conversion. This removes a lot of boilerplate. ad-hoc solution to poor
@@ -158,6 +159,10 @@ measure div_unit( measure denom, measure div ) {
div == measure::time )
return measure::gas_surface_volume;
if( denom == measure::mass_rate &&
div == measure::time )
return measure::mass;
return measure::identity;
}
@@ -176,6 +181,9 @@ measure mul_unit( measure lhs, measure rhs ) {
( rhs == measure::rate && lhs == measure::time ) )
return measure::volume;
if( lhs == measure::mass_rate && rhs == measure::time)
return measure::mass;
return lhs;
}
@@ -273,7 +281,7 @@ double efac( const std::vector<std::pair<std::string,double>>& eff_factors, cons
return (it != eff_factors.end()) ? it->second : 1;
}
template< rt phase, bool injection = true >
template< rt phase, bool injection = true, bool polymer = false >
inline quantity rate( const fn_args& args ) {
double sum = 0.0;
@@ -283,13 +291,19 @@ inline quantity rate( const fn_args& args ) {
double eff_fac = efac( args.eff_factors, name );
const auto v = args.wells.at(name).rates.get(phase, 0.0) * eff_fac;
double concentration = polymer
? sched_well->getPolymerProperties( args.sim_step ).m_polymerConcentration
: 1;
const auto v = args.wells.at(name).rates.get(phase, 0.0) * eff_fac * concentration;
if( ( v > 0 ) == injection )
sum += v;
}
if( !injection ) sum *= -1;
if( polymer ) return { sum, measure::mass_rate };
return { sum, rate_unit< phase >() };
}
@@ -503,11 +517,13 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "WOIR", rate< rt::oil, injector > },
{ "WGIR", rate< rt::gas, injector > },
{ "WNIR", rate< rt::solvent, injector > },
{ "WCIR", rate< rt::wat, injector, polymer > },
{ "WWIT", mul( rate< rt::wat, injector >, duration ) },
{ "WOIT", mul( rate< rt::oil, injector >, duration ) },
{ "WGIT", mul( rate< rt::gas, injector >, duration ) },
{ "WNIT", mul( rate< rt::solvent, injector >, duration ) },
{ "WCIT", mul( rate< rt::wat, injector, polymer >, duration ) },
{ "WVIT", mul( sum( sum( rate< rt::reservoir_water, injector >, rate< rt::reservoir_oil, injector > ),
rate< rt::reservoir_gas, injector > ), duration ) },

View File

@@ -65,6 +65,7 @@ namespace {
0.0,
0.0,
0.0,
0.0,
0.0
};
@@ -86,6 +87,7 @@ namespace {
1 / ( Metric::ReservoirVolume / Metric::Time ),
1 / Metric::Transmissibility,
1 / Metric::Mass,
1 / ( Metric::Mass / Metric::Time ),
1, /* gas-oil ratio */
1, /* oil-gas ratio */
1, /* water cut */
@@ -116,6 +118,7 @@ namespace {
Metric::ReservoirVolume / Metric::Time,
Metric::Transmissibility,
Metric::Mass,
Metric::Mass / Metric::Time,
1, /* gas-oil ratio */
1, /* oil-gas ratio */
1, /* water cut */
@@ -146,6 +149,7 @@ namespace {
"RM3/DAY",
"CPR3/DAY/BARS",
"KG",
"KG/DAY",
"SM3/SM3",
"SM3/SM3",
"SM3/SM3",
@@ -185,6 +189,7 @@ namespace {
0.0,
0.0,
0.0,
0.0,
0.0
};
@@ -206,6 +211,7 @@ namespace {
1 / ( Field::ReservoirVolume / Field::Time ),
1 / Field::Transmissibility,
1 / Field::Mass,
1 / ( Field::Mass / Field::Time ),
1 / ( Field::GasSurfaceVolume / Field::LiquidSurfaceVolume ), /* gas-oil ratio */
1 / ( Field::LiquidSurfaceVolume / Field::GasSurfaceVolume ), /* oil-gas ratio */
1, /* water cut */
@@ -236,6 +242,7 @@ namespace {
Field::ReservoirVolume / Field::Time,
Field::Transmissibility,
Field::Mass,
Field::Mass / Field::Time,
Field::GasSurfaceVolume / Field::LiquidSurfaceVolume, /* gas-oil ratio */
Field::LiquidSurfaceVolume / Field::GasSurfaceVolume, /* oil-gas ratio */
1, /* water cut */
@@ -266,6 +273,7 @@ namespace {
"RB/DAY",
"CPRB/DAY/PSI",
"LB",
"LB/DAY"
"MSCF/STB",
"STB/MSCF",
"STB/STB",
@@ -305,6 +313,7 @@ namespace {
0.0,
0.0,
0.0,
0.0,
0.0
};
@@ -326,6 +335,7 @@ namespace {
1 / ( Lab::ReservoirVolume / Lab::Time ),
1 / Lab::Transmissibility,
1 / Lab::Mass,
1 / ( Lab::Mass / Lab::Time ),
1 / Lab::GasDissolutionFactor, /* gas-oil ratio */
1 / Lab::OilDissolutionFactor, /* oil-gas ratio */
1, /* water cut */
@@ -356,6 +366,7 @@ namespace {
Lab::ReservoirVolume / Lab::Time,
Lab::Transmissibility,
Lab::Mass,
Lab::Mass / Lab::Time,
Lab::GasDissolutionFactor, /* gas-oil ratio */
Lab::OilDissolutionFactor, /* oil-gas ratio */
1, /* water cut */
@@ -386,6 +397,7 @@ namespace {
"RCC/HR",
"CPRCC/HR/ATM",
"G",
"G/HR",
"SCC/SCC",
"SCC/SCC",
"SCC/SCC",
@@ -425,6 +437,7 @@ namespace {
0.0,
0.0,
0.0,
0.0,
0.0
};
@@ -446,6 +459,7 @@ namespace {
1 / ( PVT_M::ReservoirVolume / PVT_M::Time ),
1 / PVT_M::Transmissibility,
1 / PVT_M::Mass,
1 / ( PVT_M::Mass / PVT_M::Time ),
1 / (PVT_M::GasSurfaceVolume / PVT_M::LiquidSurfaceVolume), // Rs
1 / (PVT_M::LiquidSurfaceVolume / PVT_M::GasSurfaceVolume), // Rv
1, /* water cut */
@@ -476,6 +490,7 @@ namespace {
PVT_M::ReservoirVolume / PVT_M::Time,
PVT_M::Transmissibility,
PVT_M::Mass,
PVT_M::Mass / PVT_M::Time,
PVT_M::GasSurfaceVolume / PVT_M::LiquidSurfaceVolume, // Rs
PVT_M::LiquidSurfaceVolume / PVT_M::GasSurfaceVolume, // Rv
1, /* water cut */
@@ -506,6 +521,7 @@ namespace {
"RM3/DAY",
"CPR3/DAY/ATM",
"KG",
"KG/DAY",
"SM3/SM3",
"SM3/SM3",
"SM3/SM3",
@@ -546,6 +562,7 @@ namespace {
0.0,
0.0,
0.0,
0.0,
0.0
};
@@ -576,6 +593,7 @@ namespace {
1,
1,
1,
1,
1
};
@@ -606,6 +624,7 @@ namespace {
1,
1,
1,
1,
1
};
@@ -627,6 +646,7 @@ namespace {
"RM3/DAY",
"CPR3/DAY/BARS",
"KG",
"KG/DAY",
"SM3/SM3",
"SM3/SM3",
"SM3/SM3",

View File

@@ -393,6 +393,12 @@ WGITH
WNIR
W_3
/
WCIR
W_3
/
WCIT
W_3
/
WNIT
W_3
/
@@ -586,6 +592,10 @@ COMPDAT
W_3 0 0 1 1 / -- Active index: 2
/
WPOLYMER
'W_3' 1.5 1.0 /
/
WCONHIST
-- history rates are set so that W_1 produces 1, W_2 produces 2 etc.
-- index.offset.
@@ -608,7 +618,14 @@ TSTEP
-- and 2. Without this, totals/accumulations would fail (segfault) when looking
-- up historical rates and volumes. These volumes however don't change, i.e.
-- every time step has the same set of values
10 10 /
10 /
WPOLYMER
'W_3' 2.5 1.0 /
/
TSTEP
10 /
-- Register a fourth well with completions later. This ensure we handle when
-- wells are registered or activated later in a simulation

View File

@@ -321,16 +321,20 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
BOOST_CHECK_CLOSE( 30.8, ecl_sum_get_well_var( resp, 1, "W_3", "WGVIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.2, ecl_sum_get_well_var( resp, 1, "W_3", "WGIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.3, ecl_sum_get_well_var( resp, 1, "W_3", "WNIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.0 * 1.5, ecl_sum_get_well_var( resp, 1, "W_3", "WCIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.0 * 2.5, ecl_sum_get_well_var( resp, 2, "W_3", "WCIR" ), 1e-5 );
/* Injection totals */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_well_var( resp, 1, "W_3", "WWIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.2, ecl_sum_get_well_var( resp, 1, "W_3", "WGIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.3, ecl_sum_get_well_var( resp, 1, "W_3", "WNIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.0 * 1.5, ecl_sum_get_well_var( resp, 1, "W_3", "WCIT" ), 1e-5 );
BOOST_CHECK_CLOSE( (30.6 + 30.7 + 30.8),
ecl_sum_get_well_var( resp, 1, "W_3", "WVIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.0, ecl_sum_get_well_var( resp, 2, "W_3", "WWIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.2, ecl_sum_get_well_var( resp, 2, "W_3", "WGIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.3, ecl_sum_get_well_var( resp, 2, "W_3", "WNIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.0 * 1.5 + 30.0 * 2.5, ecl_sum_get_well_var( resp, 2, "W_3", "WCIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2* (30.6 + 30.7 + 30.8),
ecl_sum_get_well_var( resp, 2, "W_3", "WVIT" ), 1e-5 );