Skip to content

feat(lgr): add ghost node correction data for a GWF-GWF exchange - #2790

Open
jdhughes-dev wants to merge 1 commit into
modflowpy:developfrom
jdhughes-dev:feat-lgr-gnc
Open

feat(lgr): add ghost node correction data for a GWF-GWF exchange#2790
jdhughes-dev wants to merge 1 commit into
modflowpy:developfrom
jdhughes-dev:feat-lgr-gnc

Conversation

@jdhughes-dev

@jdhughes-dev jdhughes-dev commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Added get_gnc_exchange to compute ghost node correction data for the connections between two models joined by a GWF-GWF exchange
  • Added Lgr.get_gnc_data to return it for a parent and child model
  • MODFLOW 6 requires one record for every exchange record in the same order, so a connection that needs no correction is written with a cellid of zero and a contributing factor of zero

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.7%. Comparing base (556c088) to head (89a17d1).
⚠️ Report is 183 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/utils/gnc.py 93.6% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2790      +/-   ##
===========================================
+ Coverage     55.5%    72.7%   +17.1%     
===========================================
  Files          644      662      +18     
  Lines       124135   132715    +8580     
===========================================
+ Hits         68947    96509   +27562     
+ Misses       55188    36206   -18982     
Files with missing lines Coverage Δ
flopy/utils/__init__.py 100.0% <100.0%> (ø)
flopy/utils/lgrutil.py 97.4% <100.0%> (+0.1%) ⬆️
flopy/utils/gnc.py 94.6% <93.6%> (ø)

... and 579 files with indirect coverage changes

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

Ghost node data could only be built for the connections inside one model. The
connections between two models joined by a GWF-GWF exchange need the same
correction, and a local grid refinement pair is the common case.

get_gnc_exchange computes the data from the two model grids and the exchange
records, and Lgr.get_gnc_data returns it for a parent and child model. The
ghost node and its contributing cells are in the first model of the exchange,
which must therefore be the coarser one. MODFLOW 6 requires one record for
every exchange record in the same order, so a connection that needs no
correction, such as a child cell centered on the face of a parent cell, is
written with a cellid of zero and a contributing factor of zero.

A notebook shows the workflow and compares the corrected and uncorrected
solutions against the exact solution for a confined homogeneous problem with a
linear head field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant