From 45edfc88483a2f967e122dda2b4d546a4188dd27 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 26 Feb 2014 16:01:32 +0100 Subject: [PATCH] [bugfix] Fixed imcrementing the cell centroid. Imcrementation should be done at the end of the loop body as otherwise the first cell is skipped and we are out of bounds for the last iteration. This patch move the increment to the correct location. --- opm/core/pressure/tpfa/TransTpfa_impl.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opm/core/pressure/tpfa/TransTpfa_impl.hpp b/opm/core/pressure/tpfa/TransTpfa_impl.hpp index eecc2db5..05ea44f3 100644 --- a/opm/core/pressure/tpfa/TransTpfa_impl.hpp +++ b/opm/core/pressure/tpfa/TransTpfa_impl.hpp @@ -39,7 +39,6 @@ tpfa_htrans_compute(const Grid* G, const double *perm, double *htrans) for (int c =0, i = 0; c < numCells(*G); c++) { K = perm + (c * d * d); - cc = increment(cc, 1, d); typedef typename Cell2FacesTraits::Type::row_type FaceRow; FaceRow faces = c2f[c]; @@ -67,6 +66,8 @@ tpfa_htrans_compute(const Grid* G, const double *perm, double *htrans) htrans[i] /= denom; htrans[i] = fabs(htrans[i]); } + // Move to next cell centroid. + cc = increment(cc, 1, d); } }