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.
This commit is contained in:
osae
2015-08-27 19:22:59 +02:00
parent ce0c928903
commit 299aa77e18
2 changed files with 18 additions and 0 deletions

View File

@@ -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<grid.cell_facepos[cell_index+1]; ++i) {
for (int j=grid.face_nodepos[grid.cell_faces[i]]; j<grid.face_nodepos[grid.cell_faces[i]+1]; ++j) {
zz += (grid.node_coordinates+dimensions(grid)*(grid.face_nodes[j]))[2];
}
}
return zz/8.0;
}
double cellCentroidCoordinate(const UnstructuredGrid& grid, int cell_index,
int coordinate)
{

View File

@@ -137,6 +137,13 @@ struct CellCentroidTraits<UnstructuredGrid>
CellCentroidTraits<UnstructuredGrid>::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.