-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lgr-disv): add to_disv_gridprops() method to lgr object #2271
feat(lgr-disv): add to_disv_gridprops() method to lgr object #2271
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2271 +/- ##
=========================================
+ Coverage 73.7% 74.3% +0.5%
=========================================
Files 294 294
Lines 59102 59365 +263
=========================================
+ Hits 43593 44139 +546
+ Misses 15509 15226 -283
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @langevin-usgs, I tried using the LGR class to set up the grids and I can confirm that it's working nicely!
One comment, about the function gridlist_to_disv_gridprops
. This function hasn't been changed so it will not work for a refinement level beyond 3. What are the plans for this function? Is it just a utility function for some of the flopy tests or is it exposed to users? If the latter option, it would be smart to either add a trap, or fix the function to work for an arbitrary refinement level. What do you think?
Thanks for looking, @dbrakenhoff. I'm inclined to deprecate and then remove |
I doubt many people were using the utility, so deprecation sounds like the way to go then I think! |
Add
to_disv_gridprops()
method to the Lgr object. Thelgrutil.Lgr
class helps to create the parent and child configuration for a two-model modflow6 simulation. The new method combines the parent and child grids into a single DISV mesh. Once this mesh is created, it can be used to create a single-model modflow6 simulation that should give the same results as the two-model parent-child simulation.Most of the work of this export involves the identification and handling of "hanging vertices." Hanging vertices are vertices that must be added along the edges of parent cells to mark the locations of child cell corners. These vertices are not strictly necessary to define a parent cell grid shape (a square or rectangle can be defined by just the four corner vertices), but they are required by modflow so that connections between parent and child cells can be automatically determined through shared vertices.
There are some limited nested-grid capabilities available in
cvfdutil.gridlist_to_disv_gridprops()
but they do not seem to work for refinement contrasts greater than 1 parent to 3 child cells (as identified in #2263). The new method as part of this PR also avoids geometric intersections, which could be problematic with the cvfdutil version, and instead determines hanging vertices directly through parent-child relations, essentially using a form of integer math.For the problem identified in #2263, we now get the correct hanging vertices for cellid 11, as shown in the figure below.
One small limitation with the current approach is that there may be duplicate vertices, but only the first will ever be used. It may be beneficial to write a compression function for verts and iverts to remove any vertices that are not used. This could be generally useful, and might live in cvfdutil.
flopy.utils.cvfdutil.gridlist_to_disv_gridprops
not working for nested grids with arbitrary levels of refinement #2263cvfdutil.gridlist_to_disv_gridprops()