Skip to content

fix(uzf): set single trailing wave speed from flux derivative - #3174

Open
wpbonelli wants to merge 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:fix-uzf-trailwav-speed
Open

wpbonelli wants to merge 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:fix-uzf-trailwav-speed

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Followup to #3152, addressing review comment there.

When infiltration decreases only slightly (the new water content is within 1e-9 of the top wave's), trailwav adds a single wave instead of a set of trailing waves. Its speed came from leadspeed(), a finite difference across a water content gap of at most 1e-9 with nearly equal fluxes, which gives roughly 1e-15/Δθ instead of the flux derivative. The wave could crawl, or in rare cases race, through the unsaturated zone. MODFLOW-NWT (TRAILWAVE2) instead sets the speed from the derivative at the preceding wave's water content, before assigning the new water content. Do the same, including NWT's near-zero clamp on the relative saturation.


Checklist of items for pull request

  • Replaced section above with description of pull request
  • Added new test or modified an existing test
  • Added doc/ReleaseNotes/items/*.toml entry
  • Formatted source files with fprettify
  • Removed checklist items not relevant to this pull request

When infiltration decreases only slightly, trailwav adds a single wave
whose water content differs from the wave above by at most 1e-9. Its
speed was computed with leadspeed() as a finite difference across that
gap, which gives a speed near 1e-15/dtheta instead of the flux
derivative. Set the speed from the derivative at the preceding wave's
water content before assigning smoist, as TRAILWAVE2 in MODFLOW-NWT
does.

Add a unit test that leaves junk in the new wave's slot, calls trailwav
in the single-wave branch, and checks the new wave's water content,
depth, flux and speed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant