![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Configuration for the 2D surface routing CVODE solver. More...
#include <SolverOptions2D.hpp>
Public Attributes | |
| double | max_timestep = 10.0 |
| Max CVODE internal step (s) | |
| double | min_timestep = 0.001 |
| Min CVODE internal step (s) | |
| double | rel_tolerance = 1.0e-4 |
| CVODE relative tolerance. | |
| double | abs_tolerance = 1.0e-6 |
| CVODE absolute tolerance (m) | |
| double | dry_depth = 0.001 |
| Dry cell threshold (m) | |
| double | limiter_epsilon = 1.0e-6 |
| double | flux_dh_eps = 0.004 |
| Diffusive-flux gradient floor (m) | |
| double | coupling_cd = 0.65 |
| Default discharge coefficient. | |
| int | max_krylov_dim = 30 |
| Max Krylov subspace dimension. | |
| int | coupling_interval = 0 |
| double | coupling_window = -1.0 |
| int | max_cvode_steps = 500 |
| Max CVODE steps per advance. | |
| bool | active_set = false |
| int | active_set_halo = 2 |
| bool | report_2d = true |
| Write 2D results to output. | |
| IntegratorType | integrator = IntegratorType::CVODE |
| MomentumType | momentum = MomentumType::DW |
| RainfallMode | rainfall_mode = RainfallMode::NATURAL_NEIGHBOUR |
| LinearSolverType | linear_solver = LinearSolverType::GMRES |
| PreconditionerType | preconditioner = PreconditionerType::AMG |
| std::string | mesh_file |
| Path from [2D_MESH_FILE] FILE token. Empty = mesh is inline in main .inp. | |
| std::string | output_file |
| double | len_1d_to_2d = 1.0 |
| 1D length → 2D length (ft→m, 0.3048) | |
| double | len_2d_to_1d = 1.0 |
| 2D length → 1D length (m→ft, 3.2808) | |
| double | vol_1d_to_2d = 1.0 |
| 1D volume → 2D volume (ft³→m³, 0.02832) | |
| double | flow_1d_to_2d = 1.0 |
| 1D flow → 2D flow (ft³/s→m³/s, 0.02832) | |
| double | flow_2d_to_1d = 1.0 |
| 2D flow → 1D flow (m³/s→ft³/s, 35.315) | |
| int | num_threads = 1 |
| bool | mesh_units_si = false |
| bool | mesh_scaled_to_si = false |
| bool | pending_rows_drained = false |
Configuration for the 2D surface routing CVODE solver.
Populated from [2D_OPTIONS] input section. Defaults are chosen for typical urban drainage surface routing problems.
| double openswmm::twoD::SolverOptions2D::abs_tolerance = 1.0e-6 |
CVODE absolute tolerance (m)
| bool openswmm::twoD::SolverOptions2D::active_set = false |
Dry-cell active-set masking: restrict the RHS pipeline to wet/sourced cells plus an ACTIVE_SET_HALO-ring neighbourhood; frozen cells get ydot ≡ 0 (exactly their unmasked value — dry, source-free, walled). The CVODE system stays full size. Exactly OFF-able; default OFF until field-validated. Parsed from [2D_OPTIONS] ACTIVE_SET (YES/NO); env OPENSWMM_2D_ACTIVE_SET (0/1) overrides. CVODE+DW only.
| int openswmm::twoD::SolverOptions2D::active_set_halo = 2 |
BFS halo ring count around the wet/sourced seed set (≥1); auto-doubled (capped) when a front crosses the whole halo within one window. Parsed from [2D_OPTIONS] ACTIVE_SET_HALO; env OPENSWMM_2D_ACTIVE_SET_HALO.
| double openswmm::twoD::SolverOptions2D::coupling_cd = 0.65 |
Default discharge coefficient.
| int openswmm::twoD::SolverOptions2D::coupling_interval = 0 |
0 = every SWMM step
| double openswmm::twoD::SolverOptions2D::coupling_window = -1.0 |
2D advance window in SECONDS of simulation time. −1 = AUTO (window = the nominal [OPTIONS] ROUTING_STEP, clamped to MAX_TIMESTEP); 0 = advance every routing step; > 0 = explicit window length. A time-based window is immune to 1D variable-step collapse — a step-count COUPLING_INTERVAL silently shrinks with the routing step, which is exactly the regime where the 2D advance cost explodes. An explicit COUPLING_WINDOW takes precedence over COUPLING_INTERVAL; AUTO defers to COUPLING_INTERVAL > 1 for backward compatibility. Parsed from [2D_OPTIONS] COUPLING_WINDOW; env OPENSWMM_2D_COUPLING_WINDOW overrides.
| double openswmm::twoD::SolverOptions2D::dry_depth = 0.001 |
Dry cell threshold (m)
| double openswmm::twoD::SolverOptions2D::flow_1d_to_2d = 1.0 |
1D flow → 2D flow (ft³/s→m³/s, 0.02832)
| double openswmm::twoD::SolverOptions2D::flow_2d_to_1d = 1.0 |
2D flow → 1D flow (m³/s→ft³/s, 35.315)
| double openswmm::twoD::SolverOptions2D::flux_dh_eps = 0.004 |
Diffusive-flux gradient floor (m)
Head-difference regularization (m) for the diffusive-wave flux √|Δη|. Below this gradient the flux is linearized (C¹) so the transmissivity stays bounded as the water surface flattens — without it, deep near-level ponding (e.g. a large design storm draining) makes the flux Jacobian blow up and the implicit step collapse. Only affects millimeter-scale gradients, so bulk flow is preserved; raise it for extra robustness on very deep problems. Default 4 mm; 0 = bare √. Parsed from [2D_OPTIONS] FLUX_DH_EPS; env OPENSWMM_2D_FLUX_DH_EPS overrides.
| IntegratorType openswmm::twoD::SolverOptions2D::integrator = IntegratorType::CVODE |
| double openswmm::twoD::SolverOptions2D::len_1d_to_2d = 1.0 |
1D length → 2D length (ft→m, 0.3048)
| double openswmm::twoD::SolverOptions2D::len_2d_to_1d = 1.0 |
2D length → 1D length (m→ft, 3.2808)
| double openswmm::twoD::SolverOptions2D::limiter_epsilon = 1.0e-6 |
Slope limiter epsilon
| LinearSolverType openswmm::twoD::SolverOptions2D::linear_solver = LinearSolverType::GMRES |
| int openswmm::twoD::SolverOptions2D::max_cvode_steps = 500 |
Max CVODE steps per advance.
| int openswmm::twoD::SolverOptions2D::max_krylov_dim = 30 |
Max Krylov subspace dimension.
| double openswmm::twoD::SolverOptions2D::max_timestep = 10.0 |
Max CVODE internal step (s)
| std::string openswmm::twoD::SolverOptions2D::mesh_file |
Path from [2D_MESH_FILE] FILE token. Empty = mesh is inline in main .inp.
| bool openswmm::twoD::SolverOptions2D::mesh_scaled_to_si = false |
Runtime-only: true after SurfaceRouter2D::initialize() applied the FLOW_UNITS ft→m in-place mesh scaling (vx/vy/vz, coupling areas). Lets serialization (InpWriter, GeoPackage) un-scale back to the authored units, and makes a repeated initialize() idempotent against double-scaling. Never parsed from input, never persisted.
| bool openswmm::twoD::SolverOptions2D::mesh_units_si = false |
When true, the inline .inp or referenced .2dm declared ;; UNITS: SI (m) (or an equivalent metric keyword). The mesh on disk is already in SI metres, so SurfaceRouter2D::initialize SKIPS the FLOW_UNITS-based mesh scaling (vx/vy/vz and the coupling areas). The 1D⇄2D coupling factors (len_1d_to_2d, vol_1d_to_2d, flow_*) are unaffected — they are always the feet⇄metres conversion (the 1D side is always feet), not the mesh scaling.
| double openswmm::twoD::SolverOptions2D::min_timestep = 0.001 |
Min CVODE internal step (s)
| MomentumType openswmm::twoD::SolverOptions2D::momentum = MomentumType::DW |
| int openswmm::twoD::SolverOptions2D::num_threads = 1 |
Runtime-only: resolved OpenMP thread count for the embarrassingly- parallel 2D per-cell / per-vertex loops (RHS pipeline, Jacobi preconditioner, post-step diagnostics). Set in SurfaceRouter2D::initialize() from SimulationOptions::num_threads (the global THREADS option) using the same min(N,max) + size-gate DWSolver::setNumThreads applies. 1 = serial. The parallelised loops use schedule(static) and write only their own cell/vertex slot, so any thread count is bit-identical to serial. Never parsed/persisted.
| std::string openswmm::twoD::SolverOptions2D::output_file |
HDF5 output file path from [2D_OPTIONS] OUTPUT_FILE token. Empty = no 2D output is written. Resolved relative to the parent .inp directory by the section handler.
| bool openswmm::twoD::SolverOptions2D::pending_rows_drained = false |
Runtime-only: true after SurfaceRouter2D::initialize() drained the pending [2D_BOUNDARY_CONDITIONS] / [2D_EDGE_CONVEYANCE] rows into BoundaryData / MeshData::edge_conveyance. Serialization collectors (Serialize2D.hpp) switch to the drained arrays once this is set — they are the live state that post-initialize API mutations edit; the retained pending rows would be stale. Never parsed/persisted.
| PreconditionerType openswmm::twoD::SolverOptions2D::preconditioner = PreconditionerType::AMG |
| RainfallMode openswmm::twoD::SolverOptions2D::rainfall_mode = RainfallMode::NATURAL_NEIGHBOUR |
| double openswmm::twoD::SolverOptions2D::rel_tolerance = 1.0e-4 |
CVODE relative tolerance.
| bool openswmm::twoD::SolverOptions2D::report_2d = true |
Write 2D results to output.
| double openswmm::twoD::SolverOptions2D::vol_1d_to_2d = 1.0 |
1D volume → 2D volume (ft³→m³, 0.02832)