equinor / equinor/resdata

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

Open
#1,070 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
127
Forks
103
Avg merge
2d 5h
Merged PRs (30d)
18

Description

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)`:
```python
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.