From 299aa77e185cc0dfa219c9fd791cfea6e9c281e6 Mon Sep 17 00:00:00 2001 From: osae Date: Thu, 27 Aug 2015 19:22:59 +0200 Subject: [PATCH 1/3] Cell center depth also from zcorn average. There is a sligth difference between the cell depth taken from the centroid (opm) and a straightforward average of corner coordinates (ecl). For the initialisation of Norne this causes some differences when deciding cell center positions relative contact depths. --- opm/core/grid/GridHelpers.cpp | 11 +++++++++++ opm/core/grid/GridHelpers.hpp | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/opm/core/grid/GridHelpers.cpp b/opm/core/grid/GridHelpers.cpp index 85006cc3..03528a18 100644 --- a/opm/core/grid/GridHelpers.cpp +++ b/opm/core/grid/GridHelpers.cpp @@ -57,6 +57,17 @@ const double* beginCellCentroids(const UnstructuredGrid& grid) return grid.cell_centroids; } +double cellCenterDepth(const UnstructuredGrid& grid, int cell_index) +{ + double zz = 0.0; + for (int i=grid.cell_facepos[cell_index+1]-2; i CellCentroidTraits::IteratorType beginCellCentroids(const UnstructuredGrid& grid); + +/// \brief Get vertical position of cell center ("zcorn" average.) +/// \brief grid The grid. +/// \brief cell_index The index of the specific cell. +double cellCenterDepth(const UnstructuredGrid& grid, int cell_index); + + /// \brief Get a coordinate of a specific cell centroid. /// \brief grid The grid. /// \brief cell_index The index of the specific cell. From 565fa4278eb11a675e80961a3f3e6dca583c8e6e Mon Sep 17 00:00:00 2001 From: osae Date: Thu, 10 Sep 2015 18:23:00 +0200 Subject: [PATCH 2/3] Add some comments and limit to 3 dimensions. --- opm/core/grid/GridHelpers.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/opm/core/grid/GridHelpers.cpp b/opm/core/grid/GridHelpers.cpp index 03528a18..afbaf9b4 100644 --- a/opm/core/grid/GridHelpers.cpp +++ b/opm/core/grid/GridHelpers.cpp @@ -59,13 +59,22 @@ const double* beginCellCentroids(const UnstructuredGrid& grid) double cellCenterDepth(const UnstructuredGrid& grid, int cell_index) { + // This method is an alternative to the method cellCentroidCoordinate(...) below. + // The cell center depth is computed as a raw average of cell corner depths. + // For cornerpoint grids, this is likely to give slightly different depths that seem + // to agree with eclipse. + assert(grid.dimensions == 3); + const int nd = 3; // Assuming 3-dimensional grid ... + const int nv = 8; // Assuming 2*4 vertices ... double zz = 0.0; + // Traverse the bottom and top cell-face for (int i=grid.cell_facepos[cell_index+1]-2; i Date: Fri, 11 Sep 2015 11:47:27 +0200 Subject: [PATCH 3/3] Assure 4 vertices for each face of the grid. --- opm/core/grid/GridHelpers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/opm/core/grid/GridHelpers.cpp b/opm/core/grid/GridHelpers.cpp index afbaf9b4..e8d268a2 100644 --- a/opm/core/grid/GridHelpers.cpp +++ b/opm/core/grid/GridHelpers.cpp @@ -70,6 +70,7 @@ double cellCenterDepth(const UnstructuredGrid& grid, int cell_index) // Traverse the bottom and top cell-face for (int i=grid.cell_facepos[cell_index+1]-2; i