![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Dynamic wave solver — operates on entire link/node system. More...
#include <DynamicWave.hpp>
Public Types | |
| using | NonConduitFlowFunc = std::function< void(SimulationContext &, double, int)> |
Public Member Functions | |
| void | init (int n_nodes, int n_links, const XSectGroups &groups, const SimulationContext &ctx) |
| void | setNumThreads (int n) |
| Set the number of OpenMP threads for parallel loops. | |
| int | execute (SimulationContext &ctx, double dt, NonConduitFlowFunc non_conduit_fn=nullptr) |
| Execute one DW routing timestep. | |
| double | getRoutingStep (SimulationContext &ctx, double fixed_step, double courant_factor) |
| Compute CFL-based variable timestep. | |
| uint8_t & | nodeSurchargedFlag (int idx) |
| Direct write access to the per-node is_surcharged flag (for tests/non-conduit scatter). | |
| double * | nodeNewSurfAreaDataMut () |
| Mutable pointer to the per-node new_surf_area array (for HydStructures scatter). | |
| double & | nodeSumDqdh (int n) |
| Mutable reference to the per-node sumdqdh accumulator at index n. | |
| const std::vector< uint8_t > & | aaSkipFlags () const |
| Access per-node AA skip flags (read-only, for testing/diagnostics). | |
| const DPSLinkArrays & | dpsState () const |
| Read-only access to DPS per-conduit state arrays (for tests/diagnostics). | |
| const DPSConfig & | dpsConfig () const |
| Read-only access to DPS configuration (for tests/diagnostics). | |
| DPSLinkArrays & | dpsStateMut () |
| Mutable access to DPS state for tests that need to seed slot conditions. | |
Public Attributes | |
| double | head_tol = DEFAULT_HEAD_TOL |
| int | max_trials = DEFAULT_MAX_TRIALS |
| double | omega = OMEGA |
| SurchargeMethod | surcharge_method = SurchargeMethod::EXTRAN |
| NodeContinuity | node_continuity = NodeContinuity::EXPLICIT |
| bool | anderson_accel = false |
| Enable Anderson acceleration. | |
| double | evap_rate = 0.0 |
Dynamic wave solver — operates on entire link/node system.
Working arrays are allocated once at init and reused each timestep. The solver pre-computes all cross-section geometry via XSectGroups batch API before entering the momentum arithmetic loop, ensuring the inner loop is branch-free and vectorisable.
| using openswmm::dynwave::DWSolver::NonConduitFlowFunc = std::function<void(SimulationContext&, double, int)> |
Callback for computing non-conduit link flows inside the Picard loop. Parameters: (ctx, dt, picard_step) where step=0 is first iteration.
|
inline |
Access per-node AA skip flags (read-only, for testing/diagnostics).
|
inline |
Read-only access to DPS configuration (for tests/diagnostics).
|
inline |
Read-only access to DPS per-conduit state arrays (for tests/diagnostics).
|
inline |
Mutable access to DPS state for tests that need to seed slot conditions.
| int openswmm::dynwave::DWSolver::execute | ( | SimulationContext & | ctx, |
| double | dt, | ||
| DWSolver::NonConduitFlowFunc | non_conduit_fn = nullptr |
||
| ) |
Execute one DW routing timestep.
| ctx | Simulation context. |
| dt | Timestep (seconds). |
| non_conduit_fn | Optional callback to compute pump/orifice/weir/outlet flows inside the Picard iteration loop (matching legacy). |
| double openswmm::dynwave::DWSolver::getRoutingStep | ( | SimulationContext & | ctx, |
| double | fixed_step, | ||
| double | courant_factor | ||
| ) |
Compute CFL-based variable timestep.
Also updates per-node/link CFL-critical counters (matching legacy stats_updateCriticalTimeCount).
| void openswmm::dynwave::DWSolver::init | ( | int | n_nodes, |
| int | n_links, | ||
| const XSectGroups & | groups, | ||
| const SimulationContext & | ctx | ||
| ) |
|
inline |
Mutable pointer to the per-node new_surf_area array (for HydStructures scatter).
|
inline |
Mutable reference to the per-node sumdqdh accumulator at index n.
|
inline |
Direct write access to the per-node is_surcharged flag (for tests/non-conduit scatter).
| void openswmm::dynwave::DWSolver::setNumThreads | ( | int | n | ) |
Set the number of OpenMP threads for parallel loops.
Called after init() when the thread count is finalized. A threshold is applied: if n_links < 4 * n, threading is disabled (matching legacy dynwave.c behaviour).
| n | Requested thread count (0 = use omp_get_max_threads()). |
| bool openswmm::dynwave::DWSolver::anderson_accel = false |
Enable Anderson acceleration.
| double openswmm::dynwave::DWSolver::evap_rate = 0.0 |
Evaporation rate (ft/s) — set by Router::step() each timestep so that solveMomentumBatch can recompute dq6 per Picard iteration (Gap #14).
| double openswmm::dynwave::DWSolver::head_tol = DEFAULT_HEAD_TOL |
| int openswmm::dynwave::DWSolver::max_trials = DEFAULT_MAX_TRIALS |
| NodeContinuity openswmm::dynwave::DWSolver::node_continuity = NodeContinuity::EXPLICIT |
| double openswmm::dynwave::DWSolver::omega = OMEGA |
| SurchargeMethod openswmm::dynwave::DWSolver::surcharge_method = SurchargeMethod::EXTRAN |