From 01c56deb3f5ffb6b44fede70742bab1868b57134 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 9 May 2017 14:17:55 +0200 Subject: [PATCH] PV weight FPR --- opm/output/eclipse/Summary.hpp | 1 + src/opm/output/eclipse/Summary.cpp | 24 +++++++++++++++++------- tests/FIRST_SIM.DATA | 2 ++ tests/summary_deck.DATA | 2 ++ tests/table_deck.DATA | 3 ++- tests/testBlackoilState3.DATA | 5 ++--- tests/testRFT.DATA | 5 ++++- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/opm/output/eclipse/Summary.hpp b/opm/output/eclipse/Summary.hpp index ad044cb42..9f92af6dc 100644 --- a/opm/output/eclipse/Summary.hpp +++ b/opm/output/eclipse/Summary.hpp @@ -70,6 +70,7 @@ class Summary { const ecl_sum_tstep_type* prev_tstep = nullptr; double prev_time_elapsed = 0; double initial_oip = 0.0; + const std::vector porv; }; } diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index e61b73d76..0450d64f2 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -155,6 +155,7 @@ struct fn_args { const out::RegionCache& regionCache; const EclipseGrid& grid; double initial_oip; + const std::vector& pv; }; /* Since there are several enums in opm scattered about more-or-less @@ -370,10 +371,16 @@ quantity fpr( const fn_args& args ) { return { 0.0, measure::pressure }; const auto& p = args.state.data( "PRESSURE" ); - const auto& total = std::accumulate( p.begin(), p.end(), 0.0 ); - const auto size = std::max( p.size(), size_t( 1 ) ); - - return { total / size, measure::pressure }; + const auto& pv = args.pv; + const auto& sw = args.state.data( "SWAT" ); + double fpr = 0.0; + double sum_hcpv = 0.0; + for (size_t cell_index = 0; cell_index < sw.size(); ++cell_index) { + double hcpv = pv[cell_index]*(1.0 - sw[cell_index]); + fpr += hcpv * p[cell_index]; + sum_hcpv += hcpv; + } + return { fpr / sum_hcpv, measure::pressure }; } quantity rpr(const fn_args& args) { @@ -804,7 +811,8 @@ Summary::Summary( const EclipseState& st, st.getInputGrid().getNZ() ) ), - handlers( new keyword_handlers() ) + handlers( new keyword_handlers() ), + porv( st.get3DProperties().getDoubleGridProperty("PORV").compressedCopy(grid_arg)) { /* register all keywords handlers and pair with the newly-registered ert * entry. @@ -831,7 +839,8 @@ Summary::Summary( const EclipseState& st, {}, // Solution::State {}, // Region <-> cell mappings. this->grid, - this->initial_oip }; + this->initial_oip, + {} }; const auto val = handle( no_args ); const auto* unit = st.getUnits().name( val.unit ); @@ -867,7 +876,8 @@ void Summary::add_timestep( int report_step, state, this->regionCache, this->grid, - this->initial_oip } ); + this->initial_oip, + this->porv}); const auto unit_applied_val = es.getUnits().from_si( val.unit, val.value ); const auto res = smspec_node_is_total( f.first ) && prev_tstep diff --git a/tests/FIRST_SIM.DATA b/tests/FIRST_SIM.DATA index a1819266a..4f13b46bf 100644 --- a/tests/FIRST_SIM.DATA +++ b/tests/FIRST_SIM.DATA @@ -19,6 +19,8 @@ DZV TOPS 100*0.25 / +PORO +1000*0.2 / SOLUTION RESTART diff --git a/tests/summary_deck.DATA b/tests/summary_deck.DATA index 520372e98..f58c4c096 100644 --- a/tests/summary_deck.DATA +++ b/tests/summary_deck.DATA @@ -33,6 +33,8 @@ TOPS ACTNUM 901*1 0 98*1 / +PORO +1000*0.2 / REGIONS diff --git a/tests/table_deck.DATA b/tests/table_deck.DATA index 73ec2d3e4..45deeec40 100644 --- a/tests/table_deck.DATA +++ b/tests/table_deck.DATA @@ -39,7 +39,8 @@ DZ TOPS 100*1 / - +PORO +1000*0.2 / PROPS =============================================================== PVTO diff --git a/tests/testBlackoilState3.DATA b/tests/testBlackoilState3.DATA index 27834606a..404d5ca9e 100644 --- a/tests/testBlackoilState3.DATA +++ b/tests/testBlackoilState3.DATA @@ -30,9 +30,8 @@ DZV DEPTHZ 121*1000 / - - - +PORO +1000*0.2 / SCHEDULE diff --git a/tests/testRFT.DATA b/tests/testRFT.DATA index de8b8ff80..d59590e74 100644 --- a/tests/testRFT.DATA +++ b/tests/testRFT.DATA @@ -14,6 +14,9 @@ DZV TOPS 100*0.25 / +PORO +1000*0.2 / + START -- 0 1 NOV 1979 / SCHEDULE @@ -41,4 +44,4 @@ WELOPEN / DATES -- 3 10 NOV 2008 / -/ \ No newline at end of file +/