fix a compressed vs logically Cartesian cell index bug

PVTNUM is for logically Cartesian indices, but was accessed by
compressed ones.
This commit is contained in:
Andreas Lauser 2015-11-04 14:53:50 +01:00
parent 547b701a57
commit 6a9e11a4e1

View File

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