Merge pull request #3514 from totto82/fixEmptyRegion

Handle empty region in average calculator
This commit is contained in:
Tor Harald Sandve 2021-09-09 09:06:00 +02:00 committed by GitHub
commit ea392b58ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,10 +185,11 @@ namespace Opm {
// using the pore volume to do the averaging
const auto& attri_pv = attributes_pv[reg];
const double pv_sum = comm.sum(attri_pv.pv);
assert(pv_sum > 0.);
const double p_pv_sum = comm.sum(attri_pv.pressure);
ra.pressure = p_pv_sum / pv_sum;
// pore volums can be zero if a fipnum region is empty
if (pv_sum > 0) {
const double p_pv_sum = comm.sum(attri_pv.pressure);
ra.pressure = p_pv_sum / pv_sum;
}
}
}
}