Skip to content

Commit

Permalink
Fix FPR and RPR for 2p GasOil
Browse files Browse the repository at this point in the history
  • Loading branch information
totto82 committed Nov 24, 2017
1 parent 64e2d2f commit 2236de1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions opm/output/eclipse/Summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,14 @@ quantity fpr( const fn_args& args ) {

const auto& p = args.state.data( "PRESSURE" );
const auto& pv = args.pv;
const auto& sw = args.state.data( "SWAT" );
const bool hasSwat = args.state.has( "SWAT" );
const auto& swat = hasSwat? args.state.data( "SWAT" ): std::vector<double>(p.size(),0.0);
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]);
for (size_t cell_index = 0; cell_index < p.size(); ++cell_index) {
double hcs= 1.0;
hcs -= swat[cell_index];
double hcpv = pv[cell_index]*hcs;
fpr += hcpv * p[cell_index];
sum_hcpv += hcpv;
}
Expand All @@ -397,12 +400,15 @@ quantity rpr(const fn_args& args) {

const auto& p = args.state.data( "PRESSURE" );
const auto& pv = args.pv;
const auto& sw = args.state.data( "SWAT" );
const bool hasSwat = args.state.has( "SWAT" );

const auto& swat = hasSwat? args.state.data( "SWAT" ): std::vector<double>(cells.size(),0.0);
double rpr = 0.0;
double sum_hcpv = 0.0;
for (auto cell_index : cells) {
double hcpv = pv[cell_index]*(1.0 - sw[cell_index]);
double hcs= 1.0;
hcs -= swat[cell_index];
double hcpv = pv[cell_index]*hcs;
rpr += hcpv * p[cell_index];
sum_hcpv += hcpv;
}
Expand Down

0 comments on commit 2236de1

Please sign in to comment.