diff --git a/opm/core/utility/thresholdPressures.hpp b/opm/core/utility/thresholdPressures.hpp index 1ae5e899..2b9d631c 100644 --- a/opm/core/utility/thresholdPressures.hpp +++ b/opm/core/utility/thresholdPressures.hpp @@ -99,9 +99,12 @@ namespace Opm // retrieve the PVT region of each cell. note that we need c++ instead of // Fortran indices. - std::vector pvtRegion = eclipseState->getIntGridProperty("PVTNUM")->getData(); - for (auto it = pvtRegion.begin(); it != pvtRegion.end(); ++ it) { - *it = std::max(0, *it - 1); + const int* gc = UgGridHelpers::globalCell(grid); + std::vector pvtRegion(numCells); + const auto& cartPvtRegion = eclipseState->getIntGridProperty("PVTNUM")->getData(); + for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) { + int cartCellIdx = gc?gc[cellIdx]:cellIdx; + pvtRegion[cellIdx] = std::max(0, cartPvtRegion[cartCellIdx] - 1); } // compute the initial "phase presence" of each cell (required to calculate @@ -215,7 +218,7 @@ namespace Opm pvtRegion.data(), phasePressure[gpos].data(), initialState.temperature().data(), - initialState.gasoilratio().data(), + initialState.rv().data(), cond.data(), b.data(), dummy.data(), @@ -236,7 +239,6 @@ namespace Opm std::map, double> maxDp; const int num_faces = UgGridHelpers::numFaces(grid); thpres_vals.resize(num_faces, 0.0); - const int* gc = UgGridHelpers::globalCell(grid); auto fc = UgGridHelpers::faceCells(grid); for (int face = 0; face < num_faces; ++face) { const int c1 = fc(face, 0);