![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Top-level orchestrator for the 2D surface routing module. More...
#include <SurfaceRouter2D.hpp>
Public Types | |
| using | PendingBoundaryRow = twoD::PendingBoundaryRow |
Per-row buffer for [2D_BOUNDARY_CONDITIONS] parse output. | |
| using | PendingEdgeConveyanceRow = twoD::PendingEdgeConveyanceRow |
Per-row buffer for [2D_EDGE_CONVEYANCE] parse output (§11A). | |
Public Member Functions | |
| SurfaceRouter2D ()=default | |
| ~SurfaceRouter2D ()=default | |
| SurfaceRouter2D (const SurfaceRouter2D &)=delete | |
| SurfaceRouter2D & | operator= (const SurfaceRouter2D &)=delete |
| SurfaceRouter2D (SurfaceRouter2D &&)=default | |
| SurfaceRouter2D & | operator= (SurfaceRouter2D &&)=default |
| void | initialize (SimulationContext &ctx) |
| Initialize the 2D module after input parsing is complete. | |
| void | step (SimulationContext &ctx, double dt, double t) |
| Advance the 2D surface routing by one SWMM routing step. | |
| void | updateOutfallsPreRouting (SimulationContext &ctx) |
| Pre-routing hook: update outfall boundaries from 2D surface heads. | |
| void | advancePostRouting (SimulationContext &ctx, double dt, double t) |
| Post-routing hook: compute coupling exchange and advance 2D solver. | |
| void | prepareOneShotForcing (SimulationContext &ctx) |
| Prepare a RESET 2D forcing to apply on the next routing step. | |
| void | finalize (SimulationContext &ctx) |
| Finalize the 2D module at simulation end. | |
| double | computeCflHint (const SimulationContext &ctx) const |
| Compute a CFL-like stability hint for the 2D domain. | |
| bool | isActive () const noexcept |
| Check if the 2D module is active. | |
| void | prepareForEdit () |
| Make the parsed mesh editable without a full initialize(). | |
| const MeshData & | mesh () const noexcept |
| Access mesh data (read-only). | |
| MeshData & | mesh () noexcept |
| Access mesh data (mutable, for input parsing). | |
| const SurfaceStateData & | state () const noexcept |
| Access surface state (read-only). | |
| SurfaceStateData & | state () noexcept |
| Access surface state (mutable, for forcing). | |
| const SolverOptions2D & | options () const noexcept |
| Access solver options (read-only). | |
| SolverOptions2D & | options () noexcept |
| Access solver options (mutable). | |
| const BoundaryData & | boundary () const noexcept |
| Access per-edge boundary-condition data (read-only). | |
| BoundaryData & | boundary () noexcept |
| Access per-edge boundary-condition data (mutable, for forcing/parsing). | |
| std::vector< PendingBoundaryRow > & | pendingBCRows () noexcept |
| const std::vector< PendingBoundaryRow > & | pendingBCRows () const noexcept |
| std::vector< PendingEdgeConveyanceRow > & | pendingEdgeConveyanceRows () noexcept |
| const std::vector< PendingEdgeConveyanceRow > & | pendingEdgeConveyanceRows () const noexcept |
| double | totalVolume () const |
| Get total 2D surface volume (sum of depth * area). | |
| double | totalExchangeFlow () const |
| Get total exchange flow (sum of coupling flows, m³/s). | |
| long | lastCvodeSteps () const |
| double | lastCvodeStepSize () const |
Top-level orchestrator for the 2D surface routing module.
Per-row buffer for [2D_BOUNDARY_CONDITIONS] parse output.
V-E3. Populated by the input parser during reading (before the mesh is finalized), drained into boundary_ during initialize() after boundary_.resize() allocates the per-edge slots. Retained after the drain so serialization (InpWriter / GeoPackage) can re-emit the authored rows (group label, TS-vs-constant choice). Hoisted to data/PendingRows2D.hpp; alias kept for call sites.
Per-row buffer for [2D_EDGE_CONVEYANCE] parse output (§11A).
Populated by the input parser during reading (vertices known but mesh topology not yet built), drained into mesh_.edge_conveyance during initialize() after buildMeshTopology has populated the neighbour table. Mirrored to both slots of an interior edge so antisymmetric FV flux integration stays mass-conservative. Retained after the drain for faithful re-serialization.
|
default |
|
default |
|
delete |
|
default |
| void openswmm::twoD::SurfaceRouter2D::advancePostRouting | ( | SimulationContext & | ctx, |
| double | dt, | ||
| double | t ) |
Post-routing hook: compute coupling exchange and advance 2D solver.
Must be called AFTER the 1D routing step.
| ctx | Simulation context. |
| dt | SWMM routing timestep (seconds). |
| t | Current simulation time (seconds from start). |
|
inlinenoexcept |
Access per-edge boundary-condition data (read-only).
|
inlinenoexcept |
Access per-edge boundary-condition data (mutable, for forcing/parsing).
| double openswmm::twoD::SurfaceRouter2D::computeCflHint | ( | const SimulationContext & | ctx | ) | const |
Compute a CFL-like stability hint for the 2D domain.
Returns an advisory maximum dt based on mesh resolution and wave speeds. CVODE handles its own sub-stepping, but this prevents the coupling interval from being too large. Returns a value cached at the last 2D advance (the state cannot change between advances), so the per-routing- step call is O(1).
| ctx | Simulation context. |
| void openswmm::twoD::SurfaceRouter2D::finalize | ( | SimulationContext & | ctx | ) |
Finalize the 2D module at simulation end.
Flushes any partial macro-step window (routing time accumulated since the last 2D advance) so the 2D clock ends at the simulation end instead of up to one window short, then releases the solver.
| ctx | Simulation context (needed for the flush advance). |
| void openswmm::twoD::SurfaceRouter2D::initialize | ( | SimulationContext & | ctx | ) |
Initialize the 2D module after input parsing is complete.
Builds mesh topology, vertex stencils, resolves coupling names, and initializes the CVODE solver.
| ctx | Simulation context (must have mesh_2d populated from parsing). |
|
inlinenoexcept |
Check if the 2D module is active.
|
inline |
|
inline |
|
inlinenoexcept |
Access mesh data (read-only).
|
inlinenoexcept |
Access mesh data (mutable, for input parsing).
|
delete |
|
default |
|
inlinenoexcept |
Access solver options (read-only).
|
inlinenoexcept |
Access solver options (mutable).
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| void openswmm::twoD::SurfaceRouter2D::prepareForEdit | ( | ) |
Make the parsed mesh editable without a full initialize().
The GUI keeps the engine in OPENED (not INITIALIZED) state so 1D property edits stay legal. In that state the 2D mesh is parsed but the [2D_BOUNDARY_CONDITIONS] / [2D_EDGE_CONVEYANCE] rows still live in the pending-row buffers, which the serializer prefers over live state. This drains those rows into BoundaryData / mesh edge slots (the same drain initialize() performs) so per-edge API edits take effect and are written on save. No-op once drained or when no mesh is loaded.
| void openswmm::twoD::SurfaceRouter2D::prepareOneShotForcing | ( | SimulationContext & | ctx | ) |
Prepare a RESET 2D forcing to apply on the next routing step.
Flushes any already accumulated macro-window before the new one-shot is recorded, then forces the next routing step to fire a 2D advance so the prescription applies to future time only and is cleared after use.
|
inlinenoexcept |
Access surface state (read-only).
|
inlinenoexcept |
Access surface state (mutable, for forcing).
| void openswmm::twoD::SurfaceRouter2D::step | ( | SimulationContext & | ctx, |
| double | dt, | ||
| double | t ) |
Advance the 2D surface routing by one SWMM routing step.
Sequence:
| ctx | Simulation context. |
| dt | SWMM routing timestep (seconds). |
| t | Current simulation time (seconds from start). |
| double openswmm::twoD::SurfaceRouter2D::totalExchangeFlow | ( | ) | const |
Get total exchange flow (sum of coupling flows, m³/s).
| double openswmm::twoD::SurfaceRouter2D::totalVolume | ( | ) | const |
Get total 2D surface volume (sum of depth * area).
| void openswmm::twoD::SurfaceRouter2D::updateOutfallsPreRouting | ( | SimulationContext & | ctx | ) |
Pre-routing hook: update outfall boundaries from 2D surface heads.
Must be called BEFORE the 1D routing step, after setOutfallDepths().
| ctx | Simulation context. |