Add support for output of solvent in summary file

The following keywords are implemented
[F,G,W,C]N[P,I][R,T]
FNPR, WNIR etc.
This commit is contained in:
Tor Harald Sandve 2016-09-23 15:57:10 +02:00 committed by jokva
parent 9ad8fcae19
commit f3b9c88a53
4 changed files with 106 additions and 2 deletions

View File

@ -48,6 +48,7 @@ namespace Opm {
oil = (1 << 1),
gas = (1 << 2),
polymer = (1 << 3),
solvent = (1 << 4),
};
/// Query if a value is set.
@ -74,6 +75,7 @@ namespace Opm {
double oil;
double gas;
double polymer;
double solvent;
};
struct Completion {
@ -164,6 +166,7 @@ namespace Opm {
case opt::oil: return this->oil;
case opt::gas: return this->gas;
case opt::polymer: return this->polymer;
case opt::solvent: return this->solvent;
}
throw std::invalid_argument(

View File

@ -106,6 +106,9 @@ struct quantity {
if( rhs.value == 0 ) return { 0.0, res_unit };
return { this->value / rhs.value, res_unit };
}
quantity operator-( const quantity& rhs) const {
return { this->value - rhs.value, this->unit };
}
};
/*
@ -141,6 +144,9 @@ measure rate_unit< rt::gas >() { return measure::gas_surface_rate; }
template<> constexpr
measure rate_unit< Phase::GAS >() { return measure::gas_surface_rate; }
template<> constexpr
measure rate_unit< rt::solvent >() { return measure::gas_surface_rate; }
template< rt phase, bool injection = true >
inline quantity rate( const fn_args& args ) {
double sum = 0.0;
@ -177,6 +183,7 @@ inline quantity crate( const fn_args& args ) {
return { v, rate_unit< phase >() };
}
template< rt phase > inline quantity prodrate( const fn_args& args )
{ return rate< phase, false >( args ); }
template< rt phase > inline quantity injerate( const fn_args& args )
@ -298,23 +305,33 @@ template< typename F, typename G >
auto div( F f, G g ) -> bin_op< F, G, std::divides< quantity > >
{ return { f, g }; }
template< typename F, typename G >
auto sub( F f, G g ) -> bin_op< F, G, std::minus< quantity > >
{ return { f, g }; }
using ofun = std::function< quantity( const fn_args& ) >;
static const std::unordered_map< std::string, ofun > funs = {
{ "WWIR", injerate< rt::wat > },
{ "WOIR", injerate< rt::oil > },
{ "WGIR", injerate< rt::gas > },
{ "WNIR", injerate< rt::solvent > },
{ "WWIT", mul( injerate< rt::wat >, duration ) },
{ "WOIT", mul( injerate< rt::oil >, duration ) },
{ "WGIT", mul( injerate< rt::gas >, duration ) },
{ "WNIT", mul( injerate< rt::solvent >, duration ) },
{ "WWPR", prodrate< rt::wat > },
{ "WOPR", prodrate< rt::oil > },
{ "WGPR", prodrate< rt::gas > },
{ "WNPR", prodrate< rt::solvent > },
{ "WLPR", sum( prodrate< rt::wat >, prodrate< rt::oil > ) },
{ "WWPT", mul( prodrate< rt::wat >, duration ) },
{ "WOPT", mul( prodrate< rt::oil >, duration ) },
{ "WGPT", mul( prodrate< rt::gas >, duration ) },
{ "WNPT", mul( prodrate< rt::solvent >, duration ) },
{ "WLPT", mul( sum( prodrate< rt::wat >, prodrate< rt::oil > ),
duration ) },
@ -333,18 +350,22 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "GWIR", injerate< rt::wat > },
{ "GOIR", injerate< rt::oil > },
{ "GGIR", injerate< rt::gas > },
{ "GNIR", injerate< rt::solvent > },
{ "GWIT", mul( injerate< rt::wat >, duration ) },
{ "GOIT", mul( injerate< rt::oil >, duration ) },
{ "GGIT", mul( injerate< rt::gas >, duration ) },
{ "GNIT", mul( injerate< rt::solvent >, duration ) },
{ "GWPR", prodrate< rt::wat > },
{ "GOPR", prodrate< rt::oil > },
{ "GGPR", prodrate< rt::gas > },
{ "GNPR", prodrate< rt::solvent > },
{ "GLPR", sum( prodrate< rt::wat >, prodrate< rt::oil > ) },
{ "GWPT", mul( prodrate< rt::wat >, duration ) },
{ "GOPT", mul( prodrate< rt::oil >, duration ) },
{ "GGPT", mul( prodrate< rt::gas >, duration ) },
{ "GNPT", mul( prodrate< rt::solvent >, duration ) },
{ "GLPT", mul( sum( prodrate< rt::wat >, prodrate< rt::oil > ),
duration ) },
@ -404,31 +425,41 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "CGIR", injecrate< rt::gas > },
{ "CWIT", mul( injecrate< rt::wat >, duration ) },
{ "CGIT", mul( injecrate< rt::gas >, duration ) },
{ "CNIT", mul( injecrate< rt::solvent >, duration ) },
{ "CWPR", prodcrate< rt::wat > },
{ "COPR", prodcrate< rt::oil > },
{ "CGPR", prodcrate< rt::gas > },
// Minus for injection rates and pluss for production rate
{ "CNFR", sub( prodcrate< rt::solvent>, injecrate<rt::solvent>) },
{ "CWPT", mul( prodcrate< rt::wat >, duration ) },
{ "COPT", mul( prodcrate< rt::oil >, duration ) },
{ "CGPT", mul( prodcrate< rt::gas >, duration ) },
{ "CNPT", mul( prodcrate< rt::solvent >, duration ) },
{ "FWPR", prodrate< rt::wat > },
{ "FOPR", prodrate< rt::oil > },
{ "FGPR", prodrate< rt::gas > },
{ "FNPR", prodrate< rt::solvent > },
{ "FLPR", sum( prodrate< rt::wat >, prodrate< rt::oil > ) },
{ "FWPT", mul( prodrate< rt::wat >, duration ) },
{ "FOPT", mul( prodrate< rt::oil >, duration ) },
{ "FGPT", mul( prodrate< rt::gas >, duration ) },
{ "FNPT", mul( prodrate< rt::solvent >, duration ) },
{ "FLPT", mul( sum( prodrate< rt::wat >, prodrate< rt::oil > ),
duration ) },
{ "FWIR", injerate< rt::wat > },
{ "FOIR", injerate< rt::oil > },
{ "FGIR", injerate< rt::gas > },
{ "FNIR", injerate< rt::solvent > },
{ "FLIR", sum( injerate< rt::wat >, injerate< rt::oil > ) },
{ "FWIT", mul( injerate< rt::wat >, duration ) },
{ "FOIT", mul( injerate< rt::oil >, duration ) },
{ "FGIT", mul( injerate< rt::gas >, duration ) },
{ "FNIT", mul( injerate< rt::solvent >, duration ) },
{ "FLIT", mul( sum( injerate< rt::wat >, injerate< rt::oil > ),
duration ) },
@ -581,8 +612,7 @@ void Summary::add_timestep( int report_step,
const auto schedule_wells = find_wells( schedule, f.first, timestep );
const auto val = f.second( { schedule_wells, duration, timestep, num, wells , state , regionCells , grid} );
const auto num_val = val.value > 0 ? val.value : 0.0;
const auto unit_applied_val = es.getUnits().from_si( val.unit, num_val );
const auto unit_applied_val = es.getUnits().from_si( val.unit, val.value );
const auto res = smspec_node_is_total( f.first ) && prev_tstep
? ecl_sum_tstep_get_from_key( prev_tstep, genkey ) + unit_applied_val
: unit_applied_val;

View File

@ -57,12 +57,14 @@ FLPR
FLPRH
FGSR
FGCR
FNPR -- solvent
--FTPRSEA
-- Injection Rates
FVIR
FWIR
FWIRH
FGIR
FNIR -- solvent
FGIRH
-- Production Cummulatives
FVPT
@ -71,6 +73,7 @@ FOPT
FLPT
FLPTH
FGPT
FNPT
FOPTH
FGPTH
FWPTH
@ -81,6 +84,7 @@ FVIT
FWIT
FWITH
FGIT
FNIT
FGITH
-- In place
FWIP
@ -162,6 +166,8 @@ GGPT
/
GWPT
/
GNPT
/
GOPR
/
GGPR
@ -172,10 +178,17 @@ GWPRH
/
GGIR
/
GNPR
/
GNIR
/
GGIRH
/
GGIT
/
GNIT
/
GGITH
/
GWCT
@ -268,6 +281,8 @@ WOPRH
/
WGPR
/
WNPR
/
WGPRH
/
WLPR
@ -307,6 +322,12 @@ WGIRH
WGITH
W_3
/
WNIR
W_3
/
WNIT
W_3
/
-- Production Cummulatives
WWPT
@ -321,6 +342,9 @@ WGPT
/
WGPTH
/
WNPT
/
-- Tracers
--WTPRSEA
--/
@ -428,6 +452,18 @@ CGPR
'*' /
/
CNFR
'*' /
/
CNPT
'*' /
/
CNIT
'*' /
/
CWPT
'W_1' 1 1 1 /
/

View File

@ -106,32 +106,39 @@ static data::Wells result_wells() {
rates1.set( rt::wat, -10.0 / day );
rates1.set( rt::oil, -10.1 / day );
rates1.set( rt::gas, -10.2 / day );
rates1.set( rt::solvent, -10.3 / day );
data::Rates rates2;
rates2.set( rt::wat, -20.0 / day );
rates2.set( rt::oil, -20.1 / day );
rates2.set( rt::gas, -20.2 / day );
rates2.set( rt::solvent, -20.3 / day );
data::Rates rates3;
rates3.set( rt::wat, 30.0 / day );
rates3.set( rt::oil, 30.1 / day );
rates3.set( rt::gas, 30.2 / day );
rates3.set( rt::solvent, 30.3 / day );
/* completion rates */
data::Rates crates1;
crates1.set( rt::wat, -100.0 / day );
crates1.set( rt::oil, -100.1 / day );
crates1.set( rt::gas, -100.2 / day );
crates1.set( rt::solvent, -100.3 / day );
data::Rates crates2;
crates2.set( rt::wat, -200.0 / day );
crates2.set( rt::oil, -200.1 / day );
crates2.set( rt::gas, -200.2 / day );
crates2.set( rt::solvent, -200.3 / day );
data::Rates crates3;
crates3.set( rt::wat, 300.0 / day );
crates3.set( rt::oil, 300.1 / day );
crates3.set( rt::gas, 300.2 / day );
crates3.set( rt::solvent, 300.3 / day );
data::Completion comp1 { 1, crates1 };
data::Completion comp2 { 1, crates2 };
@ -208,13 +215,19 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
/* Production rates */
BOOST_CHECK_CLOSE( 10.0, ecl_sum_get_well_var( resp, 1, "W_1", "WWPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.0, ecl_sum_get_well_var( resp, 1, "W_2", "WWPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.1, ecl_sum_get_well_var( resp, 1, "W_1", "WOPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.1, ecl_sum_get_well_var( resp, 1, "W_2", "WOPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.2, ecl_sum_get_well_var( resp, 1, "W_1", "WGPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.2, ecl_sum_get_well_var( resp, 1, "W_2", "WGPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.0 + 10.1, ecl_sum_get_well_var( resp, 1, "W_1", "WLPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.0 + 20.1, ecl_sum_get_well_var( resp, 1, "W_2", "WLPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.3, ecl_sum_get_well_var( resp, 1, "W_1", "WNPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.3, ecl_sum_get_well_var( resp, 1, "W_2", "WNPR" ), 1e-5 );
/* Production totals */
BOOST_CHECK_CLOSE( 10.0, ecl_sum_get_well_var( resp, 1, "W_1", "WWPT" ), 1e-5 );
@ -223,6 +236,8 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
BOOST_CHECK_CLOSE( 20.1, ecl_sum_get_well_var( resp, 1, "W_2", "WOPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.2, ecl_sum_get_well_var( resp, 1, "W_1", "WGPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.2, ecl_sum_get_well_var( resp, 1, "W_2", "WGPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.3, ecl_sum_get_well_var( resp, 1, "W_1", "WNPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 20.3, ecl_sum_get_well_var( resp, 1, "W_2", "WNPT" ), 1e-5 );
BOOST_CHECK_CLOSE( (10.0 + 10.1), ecl_sum_get_well_var( resp, 1, "W_1", "WLPT" ), 1e-5 );
BOOST_CHECK_CLOSE( (20.0 + 20.1), ecl_sum_get_well_var( resp, 1, "W_2", "WLPT" ), 1e-5 );
@ -234,6 +249,8 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
BOOST_CHECK_CLOSE( 2 * 20.2, ecl_sum_get_well_var( resp, 2, "W_2", "WGPT" ), 1e-5 );
BOOST_CHECK_CLOSE( ( 20.0 + 20.1 ), ecl_sum_get_well_var( resp, 2, "W_2", "WLPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * (20.0 + 20.1), ecl_sum_get_well_var( resp, 2, "W_2", "WLPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 10.3, ecl_sum_get_well_var( resp, 2, "W_1", "WNPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 20.3, ecl_sum_get_well_var( resp, 2, "W_2", "WNPT" ), 1e-5 );
/* Production rates (history) */
BOOST_CHECK_CLOSE( 10, ecl_sum_get_well_var( resp, 1, "W_1", "WWPRH" ), 1e-5 );
@ -254,12 +271,15 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
/* Injection rates */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_well_var( resp, 1, "W_3", "WWIR" ), 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 );
/* 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( 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 );
/* Injection rates (history) */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_well_var( resp, 1, "W_3", "WWIRH" ), 1e-5 );
@ -333,14 +353,17 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
BOOST_CHECK_CLOSE( 10.0 + 20.0, ecl_sum_get_group_var( resp, 1, "G_1", "GWPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.1 + 20.1, ecl_sum_get_group_var( resp, 1, "G_1", "GOPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.2 + 20.2, ecl_sum_get_group_var( resp, 1, "G_1", "GGPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.3 + 20.3, ecl_sum_get_group_var( resp, 1, "G_1", "GNPR" ), 1e-5 );
/* Production totals */
BOOST_CHECK_CLOSE( 10.0 + 20.0, ecl_sum_get_group_var( resp, 1, "G_1", "GWPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.1 + 20.1, ecl_sum_get_group_var( resp, 1, "G_1", "GOPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.2 + 20.2, ecl_sum_get_group_var( resp, 1, "G_1", "GGPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 10.3 + 20.3, ecl_sum_get_group_var( resp, 1, "G_1", "GNPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * (10.0 + 20.0), ecl_sum_get_group_var( resp, 2, "G_1", "GWPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * (10.1 + 20.1), ecl_sum_get_group_var( resp, 2, "G_1", "GOPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * (10.2 + 20.2), ecl_sum_get_group_var( resp, 2, "G_1", "GGPT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * (10.3 + 20.3), ecl_sum_get_group_var( resp, 2, "G_1", "GNPT" ), 1e-5 );
/* Production rates (history) */
BOOST_CHECK_CLOSE( 10.0 + 20.0, ecl_sum_get_group_var( resp, 1, "G_1", "GWPRH" ), 1e-5 );
@ -363,12 +386,15 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
/* Injection rates */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_group_var( resp, 1, "G_2", "GWIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.2, ecl_sum_get_group_var( resp, 1, "G_2", "GGIR" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.3, ecl_sum_get_group_var( resp, 1, "G_2", "GNIR" ), 1e-5 );
/* Injection totals */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_group_var( resp, 1, "G_2", "GWIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.2, ecl_sum_get_group_var( resp, 1, "G_2", "GGIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 30.3, ecl_sum_get_group_var( resp, 1, "G_2", "GNIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.0, ecl_sum_get_group_var( resp, 2, "G_2", "GWIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.2, ecl_sum_get_group_var( resp, 2, "G_2", "GGIT" ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 30.3, ecl_sum_get_group_var( resp, 2, "G_2", "GNIT" ), 1e-5 );
/* Injection totals (history) */
BOOST_CHECK_CLOSE( 30.0, ecl_sum_get_group_var( resp, 1, "G_2", "GWITH" ), 1e-5 );
@ -410,9 +436,11 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
BOOST_CHECK_CLOSE( 100.0, ecl_sum_get_well_completion_var( resp, 1, "W_1", "CWPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 100.1, ecl_sum_get_well_completion_var( resp, 1, "W_1", "COPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 100.2, ecl_sum_get_well_completion_var( resp, 1, "W_1", "CGPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 100.3, ecl_sum_get_well_completion_var( resp, 1, "W_1", "CNPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 100.0, ecl_sum_get_well_completion_var( resp, 2, "W_1", "CWPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 100.1, ecl_sum_get_well_completion_var( resp, 2, "W_1", "COPT", 1 ), 1e-5 );
BOOST_CHECK_CLOSE( 2 * 100.2, ecl_sum_get_well_completion_var( resp, 2, "W_1", "CGPT", 1 ), 1e-5 );
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 );
@ -421,8 +449,15 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
/* 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 );
/* 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", 1 ), 1e-5 );
/* CGPT's wildcarding means W_2's completions should also be available */
BOOST_CHECK_CLOSE( 200.2, ecl_sum_get_well_completion_var( resp, 1, "W_2", "CGPT", 1 ), 1e-5 );