bug: flopy.utils.cvfdutil.gridlist_to_disv_gridprops
not working for nested grids with arbitrary levels of refinement
#2263
Labels
Describe the bug
Creating a nested grid using
flopy.utils.cvfdutil.gridlist_to_disv_gridprops
does not work correctly when larger cells are connected to 4 or more smaller cells. In that situation vertices are left out of the larger cells, causing the hydraulic connection between the "non-refined" cells and the "refined" cells to be incorrect.This is caused by the fact that the vertex-to-cell mapping isn't updated as vertices are added to larger cells. This works fine as long as each larger cell shares corner vertices with the smaller cells it is connected to. For a quadtree refinement this works fine, and one refinement level extra (3 cells) is also fine, as the 3rd cell is implicitly added by handling the two smaller cells that share corner vertices with the larger cell.
As an example where this doesn't work, consider the following grid (a 1 to 5 cell refinement):
The algorithm does the following:
Cell 11 ends up missing vertices on the shared face between the outer and inner grids:
To Fix
The simple fix that solved my particular case was to update the vertex-to-cell mapping as vertices are added to the larger cell. Not sure if this is sufficiently robust for all cases, but perhaps it's a good start for supporting arbitrary refinement.
Update function
segment_face
to acceptvertex_cell_dict
andicell1
so it updates the vertex-cell mapping when vertices are added to a cell. See the single line addition at the bottom:Then in
to_cvfd()
(L244-245) pass those arguments tosegment_face
To Reproduce
Steps to reproduce the behavior, see notebook:
nested_mf6_grids.zip
Expected behavior
It would be nice if arbitrary levels of refinement were supported by this utility function.
The text was updated successfully, but these errors were encountered: