Skip to content

fix(issue-3): extend Anderson acceleration skip guard to DPS and SLOT…#62

Merged
cbuahin merged 2 commits intoHydroCouple:swmm6_relfrom
wiesnerfriedman:fix/issue-3-anderson-acceleration-scope
Apr 20, 2026
Merged

fix(issue-3): extend Anderson acceleration skip guard to DPS and SLOT…#62
cbuahin merged 2 commits intoHydroCouple:swmm6_relfrom
wiesnerfriedman:fix/issue-3-anderson-acceleration-scope

Conversation

@wiesnerfriedman
Copy link
Copy Markdown
Collaborator

… regimes

Anderson acceleration (AA) requires a smooth fixed-point operator G between consecutive Picard iterates. Three surcharge formulations violate this assumption:

EXTRAN: discontinuous dQ/dH formulation at crown
DYNAMIC_SLOT: per-iterate geometry rewrite
SLOT: C⁰ kink at the slot cutoff (~0.985·yFull)

The existing PR only skipped AA for EXTRAN surcharged nodes (from pr/aa-extran-guard). This extends the guard to all three regimes via a per-node aa_skip_ flag vector, scatter-computed each Picard iteration after geometry is known:

  • EXTRAN: skip when xnode_.is_surcharged
  • DPS: skip end-nodes of conduits with active slot area (As > 0)
  • SLOT: skip end-nodes of conduits with depth_mid/yFull in [0.98, 1.02]

Free-surface nodes (95%+ of network) retain full AA speedup. No physics is altered; only the numerical accelerator is gated.

Implementation:

  • DynamicWave.hpp: add aa_skip_ (vector<uint8_t>), computeAASkipFlags() declaration, aaSkipFlags() const accessor
  • DynamicWave.cpp: allocate aa_skip_ in init(), implement computeAASkipFlags() with O(n_conduits) scatter, call after computeLinkGeometry() in execute(), guard AA block in updateNodeDepths() with !aa_skip_[ui]

Tests: 6 new AASkipFlagTest cases in test_routing.cpp

  • FreeSurfaceNoSkip, ExtranSurchargedSkips, DPSActiveSkipsEndNodes, SlotNearKinkSkipsEndNodes, SlotFarFromKinkNoSkip, AADisabledNoFlags All 61 routing tests pass.

wiesnerfriedman and others added 2 commits April 19, 2026 14:38
… regimes

Anderson acceleration (AA) requires a smooth fixed-point operator G
between consecutive Picard iterates. Three surcharge formulations
violate this assumption:

  EXTRAN:       discontinuous dQ/dH formulation at crown
  DYNAMIC_SLOT: per-iterate geometry rewrite (Sharior et al. 2023)
  SLOT:         C⁰ kink at the slot cutoff (~0.985·yFull)

The existing code only skipped AA for EXTRAN surcharged nodes (from
pr/aa-extran-guard). This extends the guard to all three regimes via
a per-node aa_skip_ flag vector, scatter-computed each Picard iteration
after geometry is known:

  - EXTRAN: skip when xnode_.is_surcharged
  - DPS:    skip end-nodes of conduits with active slot area (As > 0)
  - SLOT:   skip end-nodes of conduits with depth_mid/yFull in [0.98, 1.02]

Free-surface nodes (95%+ of network) retain full AA speedup.
No physics is altered; only the numerical accelerator is gated.

Implementation:
  - DynamicWave.hpp: add aa_skip_ (vector<uint8_t>), computeAASkipFlags()
    declaration, aaSkipFlags() const accessor
  - DynamicWave.cpp: allocate aa_skip_ in init(), implement
    computeAASkipFlags() with O(n_conduits) scatter, call after
    computeLinkGeometry() in execute(), guard AA block in
    updateNodeDepths() with !aa_skip_[ui]

Tests: 6 new AASkipFlagTest cases in test_routing.cpp
  - FreeSurfaceNoSkip, ExtranSurchargedSkips, DPSActiveSkipsEndNodes,
    SlotNearKinkSkipsEndNodes, SlotFarFromKinkNoSkip, AADisabledNoFlags
  All 61 routing tests pass.
Copy link
Copy Markdown
Member

@cbuahin cbuahin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@cbuahin cbuahin merged commit 1df1bd7 into HydroCouple:swmm6_rel Apr 20, 2026
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.

2 participants