Skip to content

find_cell does not work for all concave cells, despite references to concavity in the code #1070

@eivindjahren

Description

@eivindjahren

If you have the following grid:

GRID

COORD
   0.1  0.1  0.1    0.1  0.1 100
   50  0.1  0.1    50  0.1 100
  100  0.1  0.1   100  0.1 100
   0.1  50  0.1    0.1  50 100
   10  10  0.1    10  10 100
  100  50  0.1   100  50 100
   0.1 100  0.1    0.1 100 100
   50 100  0.1    50 100 100
  100 100  0.1   100 100 100
/

ZCORN
  0 0 0 0
  0 0 0 0
  0 0 0 0
  0 0 0 0
  50 50 50 50
  50 50 50 50
  50 50 50 50
  50 50 50 50
  50 50 50 50
  50 50 50 50
  50 50 50 50
  50 50 50 50
  100 100 100 100
  100 100 100 100
  100 100 100 100
  100 100 100 100
/

Then find_cell will think some points in cell at i,jk=(1,1,0) is actually in i,j,k=(0,0,0):

In [1]: import resdata.grid
In [2]: grid = resdata.grid.Grid("tests/data/eightcells/EIGHTCELLS.EGRID")
In [3]: grid.find_cell(11.0, 11.0, 0.1)
Out[3]: (0, 0, 0)
In [4]: grid.find_cell(11.1, 11.1, 0.1)
Out[4]: (0, 0, 0)

In [5]: grid[0,0,0].corners
Out[5]: 
[(0.10000000149011612, 0.10000000149011612, 0.0),
 (50.0, 0.10000000149011612, 0.0),
 (0.10000000149011612, 50.0, 0.0),
 (10.0, 10.0, 0.0),
 (0.10000000149011612, 0.10000000149011612, 50.0),
 (50.0, 0.10000000149011612, 50.0),
 (0.10000000149011612, 50.0, 50.0),
 (10.0, 10.0, 50.0)]

This is because the tetrahedron decomposition does not completely solve the problem of concave cells. The following visualization shows the cell in grey, the tetrahedron the point (11.0, 11.0, 0.1) belongs to in blue and the point.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions