Fix/issue 1 junction surface area#60
Conversation
|
@wiesnerfriedman, any chance we can remove the AMM implementation from this PR so that it dels with the immediate issue referenced? |
There was a problem hiding this comment.
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_SURFAREAfloor 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.
| 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); | ||
| } |
There was a problem hiding this comment.
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).
…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.
dac366e to
8f75098
Compare
I have read the CLA Document and I hereby sign the CLA.