OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
SolverOptions2D.hpp
Go to the documentation of this file.
1
12
13#ifndef OPENSWMM_ENGINE_2D_SOLVER_OPTIONS_HPP
14#define OPENSWMM_ENGINE_2D_SOLVER_OPTIONS_HPP
15
16#include <cstdint>
17#include <string>
18
19namespace openswmm::twoD {
20
34enum class LinearSolverType : int8_t {
35 GMRES = 0,
37 TFQMR = 2
38};
39
64enum class PreconditionerType : int8_t {
65 NONE = 0,
66 JACOBI = 1,
67 ILU = 2,
68 AMG = 3
69};
70
82enum class IntegratorType : int8_t {
83 CVODE = 0,
84 ARKODE = 1
85};
86
97enum class MomentumType : int8_t {
98 DW = 0,
100};
101
118enum class RainfallMode : int8_t {
120 SYSTEM = 1,
121 NONE = 2
124};
125
133 double max_timestep = 10.0;
134 double min_timestep = 0.001;
135 double rel_tolerance = 1.0e-4;
136 double abs_tolerance = 1.0e-6;
137 double dry_depth = 0.001;
138 double limiter_epsilon = 1.0e-6;
147 double flux_dh_eps = 0.004;
148 double coupling_cd = 0.65;
149 int max_krylov_dim = 30;
160 double coupling_window = -1.0;
161 int max_cvode_steps = 500;
162
169 bool active_set = false;
174 bool report_2d = true;
175
176 // Time integrator. Default CVODE (validated path); ARKODE selects the
177 // ARKStep IMEX solver. Parsed from [2D_OPTIONS] INTEGRATOR; env
178 // OPENSWMM_2D_INTEGRATOR overrides at solver-construction time.
180
181 // Surface-momentum closure. Default DW (diffusive wave). INERTIAL selects the
182 // local-inertial scheme (per-edge q), honored only by ArkodeSurfaceSolver.
183 // Parsed from [2D_OPTIONS] MOMENTUM; env OPENSWMM_2D_MOMENTUM overrides.
185
186 // Rainfall→mesh mapping. Default NATURAL_NEIGHBOUR (spatial interpolation
187 // across all located gages); SYSTEM applies the uniform all-gage mean.
188 // Parsed from [2D_OPTIONS] RAINFALL_MODE; env OPENSWMM_2D_RAINFALL_MODE
189 // (natural|system) overrides.
191
193 // Default to AMG (hypre BoomerAMG): the only preconditioner with
194 // near-mesh-independent Krylov counts on the elliptic diffusive-wave
195 // operator, so it is the right default at every scale (and essential past
196 // ~100k cells). The value is unconditional here (keeping one struct layout
197 // across all TUs); a build WITHOUT hypre resolves AMG → JACOBI at solver
198 // initialize with a one-line notice, so the portable base build still runs.
199 // See docs/2D_KNOWN_STIFFNESS_ISSUE.md.
201
203 std::string mesh_file;
204
208 std::string output_file;
209
210 // -----------------------------------------------------------------------
211 // Unit-system coupling factors — NOT parsed from input. Computed once in
212 // SurfaceRouter2D::initialize() from the project FLOW_UNITS.
213 //
214 // The 2D solver runs internally in SI (metres, m², m³, m³/s, g=9.80665).
215 // The 1D SWMM engine ALWAYS computes internally in FEET (g=32.2, PHI=1.486)
216 // — for EVERY project, US or SI: its reader converts metric inputs to feet
217 // on load and only converts back at the display/output boundary. So these
218 // coupling factors are ALWAYS the feet⇄metres conversion, independent of
219 // FLOW_UNITS. SurfaceRouter2D::initialize() overwrites the 1.0 defaults
220 // with the real ft⇄m factors; the defaults only stand when 2D is inactive
221 // (no coupling occurs). The MESH scaling factor is separate and IS driven
222 // by FLOW_UNITS (the mesh is authored in project units) — see initialize().
223 // -----------------------------------------------------------------------
224 double len_1d_to_2d = 1.0;
225 double len_2d_to_1d = 1.0;
226 double vol_1d_to_2d = 1.0;
227 double flow_1d_to_2d = 1.0;
228 double flow_2d_to_1d = 1.0;
229
238 int num_threads = 1;
239
248 bool mesh_units_si = false;
249
255 bool mesh_scaled_to_si = false;
256
264};
265
266} // namespace openswmm::twoD
267
268#endif // OPENSWMM_ENGINE_2D_SOLVER_OPTIONS_HPP
Definition NodeCoupling.cpp:15
RainfallMode
How raingage rainfall is mapped onto the 2D mesh cells.
Definition SolverOptions2D.hpp:118
@ NATURAL_NEIGHBOUR
Default: spatial interpolation across all gages.
Definition SolverOptions2D.hpp:119
@ SYSTEM
Uniform = mean of all gages.
Definition SolverOptions2D.hpp:120
PreconditionerType
Preconditioner selector for the Krylov inner solver.
Definition SolverOptions2D.hpp:64
@ AMG
WIRED when built with OPENSWMM_WITH_HYPRE (BoomerAMG).
Definition SolverOptions2D.hpp:68
@ NONE
WIRED (no preconditioning).
Definition SolverOptions2D.hpp:65
@ JACOBI
WIRED (diagonal heuristic).
Definition SolverOptions2D.hpp:66
@ ILU
Reserved; rejected at initialize().
Definition SolverOptions2D.hpp:67
LinearSolverType
Krylov linear solver selector for the BDF + Newton + Krylov stack.
Definition SolverOptions2D.hpp:34
@ BICGSTAB
Reserved; rejected at initialize() in Phase 1.
Definition SolverOptions2D.hpp:36
@ TFQMR
Reserved; rejected at initialize() in Phase 1.
Definition SolverOptions2D.hpp:37
@ GMRES
Phase 1: WIRED (SUNLinSol_SPGMR).
Definition SolverOptions2D.hpp:35
IntegratorType
Time-integrator selector for the 2D surface ODE.
Definition SolverOptions2D.hpp:82
@ ARKODE
ARKStep IMEX additive-RK (ArkodeSurfaceSolver).
Definition SolverOptions2D.hpp:84
@ CVODE
Default: fully-implicit BDF (CvodeSurfaceSolver).
Definition SolverOptions2D.hpp:83
MomentumType
Surface-momentum closure for the 2D flux.
Definition SolverOptions2D.hpp:97
@ DW
Manning diffusive wave (default).
Definition SolverOptions2D.hpp:98
@ INERTIAL
Local-inertial (LISFLOOD-FP) with per-edge q.
Definition SolverOptions2D.hpp:99
Configuration for the 2D surface routing CVODE solver.
Definition SolverOptions2D.hpp:132
double flow_2d_to_1d
2D flow → 1D flow (m³/s→ft³/s, 35.315)
Definition SolverOptions2D.hpp:228
int coupling_interval
Definition SolverOptions2D.hpp:150
int max_krylov_dim
Max Krylov subspace dimension.
Definition SolverOptions2D.hpp:149
double coupling_window
Definition SolverOptions2D.hpp:160
double len_2d_to_1d
2D length → 1D length (m→ft, 3.2808)
Definition SolverOptions2D.hpp:225
PreconditionerType preconditioner
Definition SolverOptions2D.hpp:200
double limiter_epsilon
Definition SolverOptions2D.hpp:138
LinearSolverType linear_solver
Definition SolverOptions2D.hpp:192
bool mesh_units_si
Definition SolverOptions2D.hpp:248
double rel_tolerance
CVODE relative tolerance.
Definition SolverOptions2D.hpp:135
double max_timestep
Max CVODE internal step (s)
Definition SolverOptions2D.hpp:133
MomentumType momentum
Definition SolverOptions2D.hpp:184
std::string output_file
Definition SolverOptions2D.hpp:208
double vol_1d_to_2d
1D volume → 2D volume (ft³→m³, 0.02832)
Definition SolverOptions2D.hpp:226
RainfallMode rainfall_mode
Definition SolverOptions2D.hpp:190
double dry_depth
Dry cell threshold (m)
Definition SolverOptions2D.hpp:137
bool report_2d
Write 2D results to output.
Definition SolverOptions2D.hpp:174
int active_set_halo
Definition SolverOptions2D.hpp:173
int num_threads
Definition SolverOptions2D.hpp:238
double coupling_cd
Default discharge coefficient.
Definition SolverOptions2D.hpp:148
int max_cvode_steps
Max CVODE steps per advance.
Definition SolverOptions2D.hpp:161
std::string mesh_file
Path from [2D_MESH_FILE] FILE token. Empty = mesh is inline in main .inp.
Definition SolverOptions2D.hpp:203
bool pending_rows_drained
Definition SolverOptions2D.hpp:263
double flux_dh_eps
Diffusive-flux gradient floor (m)
Definition SolverOptions2D.hpp:147
double len_1d_to_2d
1D length → 2D length (ft→m, 0.3048)
Definition SolverOptions2D.hpp:224
double abs_tolerance
CVODE absolute tolerance (m)
Definition SolverOptions2D.hpp:136
bool mesh_scaled_to_si
Definition SolverOptions2D.hpp:255
bool active_set
Definition SolverOptions2D.hpp:169
double min_timestep
Min CVODE internal step (s)
Definition SolverOptions2D.hpp:134
IntegratorType integrator
Definition SolverOptions2D.hpp:179
double flow_1d_to_2d
1D flow → 2D flow (ft³/s→m³/s, 0.02832)
Definition SolverOptions2D.hpp:227