OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
FvOptions.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
36
37#ifndef OPENSWMM_ENGINE_FV_OPTIONS_HPP
38#define OPENSWMM_ENGINE_FV_OPTIONS_HPP
39
40namespace openswmm::fv {
41
49inline constexpr int kMaxLtsTiers = 8;
50
55enum class RiemannSolver : int {
56 HLL = 0,
57 HLLC = 1
58};
59
61enum class Limiter : int {
62 MINMOD = 0,
65};
66
68enum class ScalarScheme : int {
69 UPWIND = 0,
70 MUSCL = 1,
72};
73
75enum class TimeIntegration : int {
76 EULER = 0,
77 RK2 = 1
78};
79
80// FV_NODE_COUPLING, FV_NODE_DT and FV_NODE_PICARD were retired 2026-08-29
81// (parsed and warned when they ask for the behaviour that no longer exists):
82// storage-node coupling is always semi-implicit, the node accuracy bound is
83// always armed, and the correction is always a single sweep -- each the
84// former default. The SWASHES table that justified FV_NODE_DT was measured
85// under the BUCKET junction model described below, three days before that
86// model was deleted, and never re-measured
87// (plans/FV1D_PERF_PLAN_REVIEW_2026-08-20.md §3.1).
88
89// Junctions are always ALGEBRAIC interfaces, not states (matching legacy
90// DYNWAVE, where a junction's own surface area is exactly zero and all
91// working area belongs to the conduits — here, the cells): degree-2 nodes
92// with no local injection pass fluxes straight through as a direct face, and
93// every other junction solves its head from the instantaneous flux balance
94// per substep. The earlier BUCKET model (MIN_SURFAREA control volume
95// integrated in time, FV_JUNCTION_MODEL option) manufactured a millisecond
96// dt bound and a transshipment cap dt ≤ V_node/Q that jammed junction-dense
97// channels at the crown; it was removed after the algebraic interface passed
98// the open-channel validation suite. See ExplicitFvSolver::solveAlgebraicNode.
99
101enum class StructureCoupling : int {
104};
105
107enum class Backend : int {
108 CPU = 0,
109 AUTO = 1,
110 OMP = 2,
111 CUDA = 3,
112 HIP = 4,
114};
115
123struct FvOptions {
124 // -- Mesh (plan §3.2) ---------------------------------------------------
125
129 double cell_length = 0.0;
130
150 int min_cells = 4;
151
152 // -- Pressure closure (issue #156 Phase 4) -------------------------------
160
161 // -- Unsteady friction (issue #156) --------------------------------------
162 // Mirrors SimulationOptions::unsteady_friction / uf_k3 (shared [OPTIONS]
163 // keys UNSTEADY_FRICTION / UF_K3, not FV_*); copied in Router::initFv so
164 // the solver keeps seeing only FvOptions. Both dimensionless.
165
168
170 double uf_k3 = 0.015;
171
172 // -- Scheme -------------------------------------------------------------
173
174 double cfl = 0.5;
176 int order = 1;
180
185 double slot_celerity = 100.0;
186
201
202 // -- Coupling -----------------------------------------------------------
203
205
206 // -- Execution ----------------------------------------------------------
207
209
213 long min_parallel_cells = 20000;
214
215 // -- Performance levers (plan §5.2) -------------------------------------
216
220 bool compaction = true;
221
226 bool lts = true;
227
273 bool node_feedback_dt = false;
274
277
295
296 // -- Transport (plan §3.2 / §6.11) --------------------------------------
297
301 double dispersion = 0.0;
302};
303
304} // namespace openswmm::fv
305
306#endif // OPENSWMM_ENGINE_FV_OPTIONS_HPP
Definition ExplicitFvSolver.cpp:25
Backend
Backend selection for the solver kernels.
Definition FvOptions.hpp:107
@ CPU
Definition FvOptions.hpp:108
@ SYCL
Definition FvOptions.hpp:113
@ HIP
Definition FvOptions.hpp:112
@ OMP
Definition FvOptions.hpp:110
@ CUDA
Definition FvOptions.hpp:111
@ AUTO
default: try plugins above the parallel gate, else CPU
Definition FvOptions.hpp:109
ScalarScheme
Reconstruction used for the advected scalar field.
Definition FvOptions.hpp:68
@ MUSCL
2nd-order TVD, one-cell stencil (default)
Definition FvOptions.hpp:70
@ QUICKEST_ULTIMATE
3rd-order, two-cell upstream stencil
Definition FvOptions.hpp:71
@ UPWIND
1st-order upwind — monotone, diffusive
Definition FvOptions.hpp:69
constexpr int kMaxLtsTiers
Definition FvOptions.hpp:49
RiemannSolver
Definition FvOptions.hpp:55
@ HLLC
default
Definition FvOptions.hpp:57
@ HLL
baseline / debug only
Definition FvOptions.hpp:56
StructureCoupling
When pump/orifice/weir/outlet structure equations are re-evaluated.
Definition FvOptions.hpp:101
@ ROUTING_STEP
once per routing step (matches DW-scale control cadence)
Definition FvOptions.hpp:103
@ SUBSTEP
every explicit substep (default; physically exact)
Definition FvOptions.hpp:102
TimeIntegration
Temporal integrator.
Definition FvOptions.hpp:75
@ EULER
forward Euler (default)
Definition FvOptions.hpp:76
@ RK2
SSP-RK2 (Heun) — strong-stability-preserving.
Definition FvOptions.hpp:77
Limiter
Slope limiter used by the second-order (MUSCL) reconstruction.
Definition FvOptions.hpp:61
@ VANLEER
Definition FvOptions.hpp:63
@ SUPERBEE
sharpest; can artificially steepen smooth profiles
Definition FvOptions.hpp:64
@ MINMOD
most diffusive, most robust (default)
Definition FvOptions.hpp:62
Knobs for FLOW_ROUTING FV.
Definition FvOptions.hpp:123
bool pressurized_implicit
Definition FvOptions.hpp:200
bool node_feedback_dt
Definition FvOptions.hpp:273
ScalarScheme scalar_scheme
Definition FvOptions.hpp:178
int cfl_census_interval
Definition FvOptions.hpp:294
double cell_length
Definition FvOptions.hpp:129
long min_parallel_cells
Definition FvOptions.hpp:213
Backend backend
Definition FvOptions.hpp:208
int min_cells
Definition FvOptions.hpp:150
int lts_max_tiers
Maximum LTS tier count (tier k advances at 2^k·dt₀). 6 ⇒ 64× spread.
Definition FvOptions.hpp:276
double dispersion
Definition FvOptions.hpp:301
double cfl
Definition FvOptions.hpp:174
TimeIntegration time_integration
Definition FvOptions.hpp:179
double slot_celerity
Definition FvOptions.hpp:185
double uf_k3
Brunone-type k3 coefficient; consumed only when unsteady_friction != 0.
Definition FvOptions.hpp:170
StructureCoupling structure_coupling
Definition FvOptions.hpp:204
RiemannSolver riemann
Definition FvOptions.hpp:175
int unsteady_friction
0 = NONE (default, bit-inert), 1 = VITKOVSKY.
Definition FvOptions.hpp:167
Limiter limiter
Definition FvOptions.hpp:177
int order
1 | 2 (MUSCL-Hancock)
Definition FvOptions.hpp:176
bool compaction
Definition FvOptions.hpp:220
bool lts
Definition FvOptions.hpp:226
int pressure_closure
Definition FvOptions.hpp:159