Skip to content

feat(grid): add ihc to UnstructuredGrid#2681

Merged
wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:ihc
Jan 16, 2026
Merged

feat(grid): add ihc to UnstructuredGrid#2681
wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:ihc

Conversation

@wpbonelli

Copy link
Copy Markdown
Member

Add ihc (horizontal connection) init parameter and property to UnstructuredGrid and populate it from the DISU package when initializing MFModel.modelgrid. Then use it for vertical barrier detection in plotutil.py instead of floating point comparisons on coordinates, if available (but don't assume it's available).

@wpbonelli wpbonelli added this to the 3.10 milestone Jan 16, 2026
@wpbonelli wpbonelli added enhancement refactor Non-functional changes labels Jan 16, 2026
@codecov

codecov Bot commented Jan 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.8%. Comparing base (556c088) to head (807dbdb).
⚠️ Report is 108 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/plot/plotutil.py 78.5% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2681      +/-   ##
===========================================
+ Coverage     55.5%    72.8%   +17.2%     
===========================================
  Files          644      667      +23     
  Lines       124135   130124    +5989     
===========================================
+ Hits         68947    94741   +25794     
+ Misses       55188    35383   -19805     
Files with missing lines Coverage Δ
flopy/discretization/unstructuredgrid.py 81.7% <100.0%> (+0.2%) ⬆️
flopy/mf6/mfmodel.py 56.9% <ø> (-24.0%) ⬇️
flopy/plot/plotutil.py 51.6% <78.5%> (-5.2%) ⬇️

... and 558 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wpbonelli wpbonelli marked this pull request as ready for review January 16, 2026 16:22
@wpbonelli

Copy link
Copy Markdown
Member Author

discussed offline with @jlarsen-usgs

@wpbonelli wpbonelli merged commit 905d20b into modflowpy:develop Jan 16, 2026
20 checks passed
@wpbonelli wpbonelli deleted the ihc branch January 16, 2026 22:19
wpbonelli added a commit that referenced this pull request Jan 31, 2026
Improve the shared face finding algorithm for HFB (Horizontal Flow Barrier) plotting. Factor out @jlarsen-usgs's index-based approach from #2671 into reusable function(s) and use it instead of floating point comparisons as before. Should be faster.

I moved the new face-related functions to a new module faceutil.py instead of plotutil.py as they are used not only for plotting but for export, and may be useful in other cases. I considered putting them in gridutil.py but that is used by the grid classes, while the face functions use the grid classes, so it would have created a circular import.

I also changed the name of is_vertical_barrier -> is_vertical and inverted the semantics so it works on faces, not barriers (a face between horizontally adjacent cells is a vertical polygon, and a face between vertically adjacent cells is a horizontal polygon, but we call the former a "horizontal"  flow barrier and the latter a "vertical" flow barrier). I figure writing these utils in terms of faces for the general case makes sense, and just interpreting the results for the specific case of HFBs.

This PR builds on

- #2671's shared face finding approach
- #2680 which gives all grid types a consistent get_node() method
- #2681 which adds an ihc init parameter/attribute to UnstructuredGrid

Some ad hoc cell ID -> node number conversion utilities are removed and get_node() used instead.

I am classifying all this a refactor though it introduces a new utility module, as the new utils are in service of the refactor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement refactor Non-functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant