Skip to content

Fix/issue 1 junction surface area#60

Open
wiesnerfriedman wants to merge 6 commits into
HydroCouple:swmm6_relfrom
wiesnerfriedman:fix/issue-1-junction-surface-area
Open

Fix/issue 1 junction surface area#60
wiesnerfriedman wants to merge 6 commits into
HydroCouple:swmm6_relfrom
wiesnerfriedman:fix/issue-1-junction-surface-area

Conversation

@wiesnerfriedman
Copy link
Copy Markdown
Collaborator

@wiesnerfriedman wiesnerfriedman commented Apr 18, 2026

I have read the CLA Document and I hereby sign the CLA.

@cbuahin
Copy link
Copy Markdown
Member

cbuahin commented Apr 20, 2026

@wiesnerfriedman, any chance we can remove the AMM implementation from this PR so that it dels with the immediate issue referenced?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands dynamic-wave routing configuration/diagnostics and adds a new RDII computation path (AMM), alongside a large set of verification and introspection tests.

Changes:

  • Make DW routing respect a configurable MIN_SURFAREA floor in internal units (and adjust node intrinsic surface-area handling for junctions/storage).
  • Add an “operator snapshot” API (callback + polling + optional iteration residual history) to expose per-substep DW solver state.
  • Introduce an AMM-based RDII option and wire parsing/initialization into the engine; add extensive new unit/integration/concurrency tests and a benchmark.

Reviewed changes

Copilot reviewed 33 out of 35 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/engine/hydraulics/Node.cpp/.hpp Change node intrinsic surface-area rules (junctions now 0; storage returns physical).
src/engine/hydraulics/Routing.cpp Convert DW options (head_tol, min_surf_area) to internal units at router init.
src/engine/hydraulics/DynamicWave.cpp/.hpp Add min_surf_area, iteration residual recording, and snapshot population plumbing.
src/engine/core/OperatorSnapshotState.hpp New per-engine storage for snapshot buffers, callback, polling, iteration history.
include/openswmm/engine/openswmm_operator_snapshot.h New public C API and snapshot structure definition.
src/engine/core/openswmm_engine_impl.cpp Add C API entry points for snapshot/callback/polling/iteration history.
src/engine/core/SWMMEngine.cpp/.hpp Wire snapshot population into routing; add AMM RDII compute path and initialization.
src/engine/hydrology/AMM.cpp/.hpp New AMM solver implementation + parameter/state definitions.
src/engine/input/handlers/InflowsHandler.cpp/.hpp Parse [AMM] section and store component definitions + assignments.
src/engine/input/handlers/OptionsHandler.cpp Parse RDII_METHOD option and store in SimulationOptions.
src/engine/plugins/DefaultInputPlugin.cpp Register built-in [AMM] section handler.
src/engine/data/InflowData.hpp / src/engine/core/SimulationContext.hpp Add AMMAssignData to context.
tests/unit/engine/test_routing.cpp Add regression/unit tests for min surface area behavior and DW node continuity.
tests/unit/engine/test_operator_snapshot.cpp Add unit tests for snapshot callback + poll behavior.
tests/unit/engine/test_dynamic_preissmann_slot.cpp Add targeted DPS verification suite.
tests/unit/engine/test_concurrent_engines.cpp Add concurrency determinism test (two engines in two threads).
tests/benchmarks/bench_operator_snapshot.cpp Add benchmark for snapshot overhead.
tests/unit/engine/CMakeLists.txt / tests/benchmarks/CMakeLists.txt Register new unit tests and benchmark targets.
docs/thread_safety_verification.md Add thread-safety audit report and testing notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/engine/core/SWMMEngine.cpp Outdated
Comment on lines +1215 to +1229
if (ctx_.n_gages() > 0) avg_rainfall /= ctx_.n_gages();
double air_temp = climate_.temperature; // current air temperature (deg F)
amm_.computeAll(ctx_, avg_rainfall, air_temp, dt_routing);
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

When RDII_METHOD is set to AMM, the engine still unconditionally applies RTK RDII inflows via rdii_.applyRdiiInflows() (and rdii_.computeAll() still runs at the wet-weather step). This will double-count RDII if any [RDII]/[HYDROGRAPHS] data is present. Gate the RTK RDII compute/apply path on rdii_method == RTK (or explicitly document/support running both methods and add a separate option).

Copilot uses AI. Check for mistakes.
…Node, wire option into DWSolver with unit conversion, add .inp-driven regression tests

Phase 1: Non-storage getSurfArea() returns 0.0 (physical area only)
Phase 2: Storage getSurfArea() purely geometric (no MIN_SURFAREA clamp)
         Wire MIN_SURFAREA/HEAD_TOL options into DWSolver with UCF conversion
Phase 3: Add minimal_conduit.inp fixture and DWNodeContinuity tests
         (DepthRisesWithForcedLateralInflow, MultipleStepsAccumulateDepth)

All 61 routing + 21 site-drainage tests pass.
@wiesnerfriedman wiesnerfriedman force-pushed the fix/issue-1-junction-surface-area branch from dac366e to 8f75098 Compare April 21, 2026 02:22
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.

3 participants