From 6e9b13ad5a1597262c013ee4764e86a5679f8b73 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 5 Aug 2016 14:43:56 +0200 Subject: [PATCH] ebos: use grid.cellCenterDepth() instead of the Z coordinate of the centroid grid.cellCenterDepth() is the average of the Z-coordinates of the element vertices which, for distorted elements, is slightly different from the depth of the centroid. IMO this is conceptually a change for the worse, but ECL likes to do a lot of things inconsistently, so let's budge. --- applications/ebos/eclfluxmodule.hh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/applications/ebos/eclfluxmodule.hh b/applications/ebos/eclfluxmodule.hh index b3156304d..d779f325c 100644 --- a/applications/ebos/eclfluxmodule.hh +++ b/applications/ebos/eclfluxmodule.hh @@ -210,6 +210,7 @@ protected: Valgrind::SetUndefined(*this); const auto& problem = elemCtx.problem(); + const auto& grid = elemCtx.simulator().gridManager().grid(); const auto& stencil = elemCtx.stencil(timeIdx); const auto& scvf = stencil.interiorFace(scvfIdx); @@ -231,8 +232,13 @@ protected: const auto &intQuantsIn = elemCtx.intensiveQuantities(interiorDofIdx_, timeIdx); const auto &intQuantsEx = elemCtx.intensiveQuantities(exteriorDofIdx_, timeIdx); - Scalar zIn = elemCtx.pos(interiorDofIdx_, timeIdx)[dimWorld - 1]; - Scalar zEx = elemCtx.pos(exteriorDofIdx_, timeIdx)[dimWorld - 1]; + // this is quite hacky because the dune grid interface does not provide a + // cellCenterDepth() method (so this code is specific to the OPM derived + // grids). The "good" solution would be to take the Z coordinate of the element + // centers, but since ECL seems to like to be inconsistent on that front, it + // needs to be done like here... + Scalar zIn = grid.cellCenterDepth(I); + Scalar zEx = grid.cellCenterDepth(J); // the distances from the DOF's depths. (i.e., the additional depth of the // exterior DOF)