OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
SimulationOptions.hpp
Go to the documentation of this file.
1
24#ifndef OPENSWMM_ENGINE_SIMULATION_OPTIONS_HPP
25#define OPENSWMM_ENGINE_SIMULATION_OPTIONS_HPP
26
27#include <string>
28#include <vector>
29#include <unordered_map>
30#include <cstdint>
31
32namespace openswmm {
33
34// ============================================================================
35// Enumerators matching legacy SWMM enums.h
36// ============================================================================
37
42enum class FlowUnits : int {
43 CFS = 0,
44 GPM = 1,
45 MGD = 2,
46 CMS = 3,
47 LPS = 4,
48 MLD = 5
49};
50
55enum class RoutingModel : int {
56 STEADY = 0,
57 KINWAVE = 1,
58 DYNWAVE = 2
59};
60
65enum class InfiltrationModel : int {
66 HORTON = 0,
67 MOD_HORTON = 1,
68 GREEN_AMPT = 2,
70 CURVE_NUMBER = 4
71};
72
77enum class RunoffModel : int {
78 NONE = 0,
79 NL_POND = 1
80};
81
99enum class NodeContinuity : int {
100 EXPLICIT = 0,
101 SEMI_IMPLICIT = 1
102};
103
104// ============================================================================
105// SimulationOptions struct
106// ============================================================================
107
123 // -----------------------------------------------------------------------
124 // Time control
125 // -----------------------------------------------------------------------
126
129 double start_date = 2453006.0; // Jan 1, 2004 OADate (days since 12/30/1899) (legacy default)
130
132 double end_date = 0.0;
133
135 double report_start = 0.0;
136
138 double routing_step = 20.0;
139
141 double min_routing_step = 0.5;
142
144 double dry_step = 3600.0;
145
147 double wet_step = 300.0;
148
150 double report_step = 900.0;
151
153 double dry_days = 0.0;
154
157 double variable_step = 0.75;
158
164 double lengthening_step = 0.0;
165
167 int sweep_start = 1;
168
170 int sweep_end = 365;
171
172 // -----------------------------------------------------------------------
173 // Flow and routing
174 // -----------------------------------------------------------------------
175
178
181
184
187
188 // -----------------------------------------------------------------------
189 // Solver settings
190 // -----------------------------------------------------------------------
191
193 int max_trials = 8;
194
199
204 double dps_target_celerity = 25.0;
205
211 double dps_alpha = 3.0;
212
218 double dps_decay_time = 0.5;
219
222
232 bool anderson_accel = false;
233
236 int normal_flow_ltd = 2; // BOTH (legacy default)
237
241
244 int inertial_damping = 1; // PARTIAL (legacy default)
245
248 int link_offsets = 0; // DEPTH_OFFSET (legacy default)
249
251 double min_slope = 0.0;
252
254 double min_surf_area = 0.0; // 0 = use MIN_SURFAREA constant
255
258 double head_tol = 0.005;
259
262 double sys_flow_tol = 0.05;
263
266 double lat_flow_tol = 0.05;
267
272 bool skip_steady_state = false;
273
274 // -----------------------------------------------------------------------
275 // System settings
276 // -----------------------------------------------------------------------
277
279 bool quality_routing = false;
280
282 bool allow_ponding = false;
283
285 bool ignore_rainfall = false;
286
288 bool ignore_snow_melt = false;
289
291 bool ignore_groundwater = false;
292
294 bool ignore_rdii = false;
295
297 bool ignore_routing = false;
298
300 bool ignore_quality = false;
301
302 // -----------------------------------------------------------------------
310 double rule_step = 0.0;
311
312 // Threading
313 // -----------------------------------------------------------------------
314
329 int num_threads = 1;
330
331 // -----------------------------------------------------------------------
332 // New in 6.0.0 — CRS (R06)
333 // -----------------------------------------------------------------------
334
351 std::string crs;
352
353 // -----------------------------------------------------------------------
354 // New in 6.0.0 — Extension options map (R05)
355 // -----------------------------------------------------------------------
356
374 std::unordered_map<std::string, std::string> ext_options;
375
376 // -----------------------------------------------------------------------
377 // Evaporation settings (from [EVAPORATION] section)
378 // -----------------------------------------------------------------------
379
381 int evap_type = 0;
382
384 double evap_values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
385
387 std::string evap_ts_name;
388
390 std::string evap_recovery_pat;
391
393 bool evap_dry_only = false;
394
396 double pan_coeff[12] = {1,1,1,1,1,1,1,1,1,1,1,1};
397
398 // -----------------------------------------------------------------------
399 // Temperature settings (from [TEMPERATURE] section)
400 // -----------------------------------------------------------------------
401
403 int temp_source = 0;
404
406 std::string temp_ts_name;
407
409 std::string temp_file;
410
412 double temp_file_start = 0.0;
413
415 int wind_type = 0;
416
418 double wind_speed[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
419
421 double snow_divt = 34.0;
422
424 double snow_ati_wt = 0.5;
425
427 double snow_nrg_ratio = 0.6;
428
430 double snow_lat = 0.0;
431
436 double snow_elev = 0.0;
437
439 double snow_min_melt = 0.0;
440
442 double snow_max_melt = 0.0;
443
445 double adc_imperv[10] = {1,1,1,1,1,1,1,1,1,1};
446
448 double adc_perv[10] = {1,1,1,1,1,1,1,1,1,1};
449
450 // -----------------------------------------------------------------------
451 // Report settings (from [REPORT] section)
452 // -----------------------------------------------------------------------
453
455 bool rpt_disabled = false;
456
459
461 int rpt_nodes = 1;
462
464 int rpt_links = 1;
465
467 bool rpt_input = false;
468
470 bool rpt_continuity = true;
471
473 bool rpt_flowstats = true;
474
476 bool rpt_controls = false;
477
479 bool rpt_averages = false;
480
482 std::vector<std::string> rpt_subcatch_names;
483
485 std::vector<std::string> rpt_node_names;
486
488 std::vector<std::string> rpt_link_names;
489};
490
491} /* namespace openswmm */
492
493#endif /* OPENSWMM_ENGINE_SIMULATION_OPTIONS_HPP */
Definition NodeCoupling.cpp:15
InfiltrationModel
Infiltration methods.
Definition SimulationOptions.hpp:65
FlowUnits
Flow unit systems.
Definition SimulationOptions.hpp:42
@ GPM
Gallons per minute.
@ MGD
Million gallons per day.
@ CFS
Cubic feet per second.
@ MLD
Million liters per day.
@ CMS
Cubic meters per second.
@ LPS
Liters per second.
NodeContinuity
Node continuity formulation for depth update.
Definition SimulationOptions.hpp:99
@ EXPLICIT
Classic explicit two-branch (default)
@ SEMI_IMPLICIT
Unified semi-implicit formulation.
RunoffModel
Runoff routing methods.
Definition SimulationOptions.hpp:77
@ NL_POND
Non-linear reservoir (default)
RoutingModel
Flow routing methods.
Definition SimulationOptions.hpp:55
@ KINWAVE
Kinematic wave approximation.
@ STEADY
Steady-state (no routing)
@ DYNWAVE
Dynamic wave (full Saint-Venant)
All SWMM simulation options parsed from [OPTIONS] section.
Definition SimulationOptions.hpp:122
bool ignore_groundwater
Ignore groundwater.
Definition SimulationOptions.hpp:291
double dry_step
Dry-weather runoff timestep in seconds.
Definition SimulationOptions.hpp:144
bool rpt_disabled
TRUE if all reporting is disabled.
Definition SimulationOptions.hpp:455
double adc_imperv[10]
Areal depletion curve for impervious surfaces (10 fractions).
Definition SimulationOptions.hpp:445
bool rpt_continuity
Report continuity errors (default true).
Definition SimulationOptions.hpp:470
double routing_step
Hydraulic routing timestep in seconds. Legacy default: 20.
Definition SimulationOptions.hpp:138
double variable_step
Courant factor for variable time stepping (0 = fixed step).
Definition SimulationOptions.hpp:157
bool ignore_routing
Ignore routing.
Definition SimulationOptions.hpp:297
double snow_min_melt
Snowmelt: minimum melt coefficient.
Definition SimulationOptions.hpp:439
int rpt_links
Link reporting: 0=NONE, 1=ALL, 2=SOME. Default ALL.
Definition SimulationOptions.hpp:464
double min_routing_step
Minimum routing timestep in seconds (CFL floor).
Definition SimulationOptions.hpp:141
double end_date
Simulation end date/time (decimal days, OADate (days since 12/30/1899)).
Definition SimulationOptions.hpp:132
std::string crs
Coordinate reference system string.
Definition SimulationOptions.hpp:351
FlowUnits flow_units
Flow units system.
Definition SimulationOptions.hpp:177
int evap_type
Evaporation type: 0=CONSTANT, 1=MONTHLY, 2=TIMESERIES, 3=TEMPERATURE, 4=FILE.
Definition SimulationOptions.hpp:381
double lat_flow_tol
Lateral inflow tolerance (fraction, e.g., 0.05 = 5%).
Definition SimulationOptions.hpp:266
bool ignore_rainfall
Ignore rainfall (for hot start runs).
Definition SimulationOptions.hpp:285
double wet_step
Wet-weather runoff timestep in seconds.
Definition SimulationOptions.hpp:147
double snow_divt
Snowmelt: dividing temperature.
Definition SimulationOptions.hpp:421
std::string evap_ts_name
Timeseries name for evaporation (evap_type == 2).
Definition SimulationOptions.hpp:387
std::string evap_recovery_pat
Recovery pattern name for evaporation.
Definition SimulationOptions.hpp:390
int wind_type
Wind speed type: 0=MONTHLY, 1=FILE.
Definition SimulationOptions.hpp:415
RoutingModel routing_model
Routing method. Legacy default: DYNWAVE.
Definition SimulationOptions.hpp:180
bool ignore_snow_melt
Ignore snowmelt.
Definition SimulationOptions.hpp:288
std::unordered_map< std::string, std::string > ext_options
Key-value map for unknown [OPTIONS] keys.
Definition SimulationOptions.hpp:374
std::vector< std::string > rpt_link_names
Named links to report (used when rpt_links == 2).
Definition SimulationOptions.hpp:488
bool rpt_flowstats
Report flow statistics (default true).
Definition SimulationOptions.hpp:473
int surcharge_method
Surcharge method: 0=EXTRAN, 1=SLOT, 2=DYNAMIC_SLOT (DPS).
Definition SimulationOptions.hpp:198
double dps_decay_time
DPS decay time scale (seconds).
Definition SimulationOptions.hpp:218
double pan_coeff[12]
Monthly pan coefficients (used when evap_type == 4/FILE).
Definition SimulationOptions.hpp:396
bool rpt_controls
Report control actions (default false).
Definition SimulationOptions.hpp:476
double head_tol
Convergence head tolerance in project length units.
Definition SimulationOptions.hpp:258
bool skip_steady_state
Skip routing when system is in steady state.
Definition SimulationOptions.hpp:272
double snow_elev
Snowmelt: site elevation above sea level (ft, internal units).
Definition SimulationOptions.hpp:436
int rpt_nodes
Node reporting: 0=NONE, 1=ALL, 2=SOME. Default ALL.
Definition SimulationOptions.hpp:461
double evap_values[12]
Monthly evaporation values (used when evap_type == 0 or 1).
Definition SimulationOptions.hpp:384
double snow_nrg_ratio
Snowmelt: negative melt ratio.
Definition SimulationOptions.hpp:427
double dps_target_celerity
DPS target pressure celerity (m/s, converted to ft/s at init).
Definition SimulationOptions.hpp:204
double snow_max_melt
Snowmelt: maximum melt coefficient.
Definition SimulationOptions.hpp:442
RunoffModel runoff_model
Runoff routing method.
Definition SimulationOptions.hpp:186
int rpt_subcatchments
Subcatchment reporting: 0=NONE, 1=ALL, 2=SOME. Default ALL.
Definition SimulationOptions.hpp:458
int sweep_start
Street sweeping start day-of-year (1-365). 0 = not set.
Definition SimulationOptions.hpp:167
std::string temp_file
File path for temperature data.
Definition SimulationOptions.hpp:409
int inertial_damping
Inertial damping: 0=NONE, 1=PARTIAL, 2=FULL.
Definition SimulationOptions.hpp:244
double snow_lat
Snowmelt: latitude (degrees).
Definition SimulationOptions.hpp:430
std::string temp_ts_name
Timeseries name for temperature data.
Definition SimulationOptions.hpp:406
std::vector< std::string > rpt_node_names
Named nodes to report (used when rpt_nodes == 2).
Definition SimulationOptions.hpp:485
double temp_file_start
Temperature file start date (OADate).
Definition SimulationOptions.hpp:412
double report_start
Report start date/time.
Definition SimulationOptions.hpp:135
bool ignore_quality
Ignore water quality.
Definition SimulationOptions.hpp:300
double sys_flow_tol
System flow tolerance (fraction, e.g., 0.05 = 5%).
Definition SimulationOptions.hpp:262
int normal_flow_ltd
Normal flow limitation: 0=SLOPE, 1=FROUDE, 2=BOTH, 3=NEITHER.
Definition SimulationOptions.hpp:236
int force_main_eqn
Force main equation: 0=Hazen-Williams, 1=Darcy-Weisbach.
Definition SimulationOptions.hpp:240
NodeContinuity node_continuity
Node continuity formulation for depth update. Default: EXPLICIT (legacy).
Definition SimulationOptions.hpp:221
std::vector< std::string > rpt_subcatch_names
Named subcatchments to report (used when rpt_subcatchments == 2).
Definition SimulationOptions.hpp:482
bool rpt_averages
Report time-averaged results (default false).
Definition SimulationOptions.hpp:479
double rule_step
Control rule evaluation interval (seconds).
Definition SimulationOptions.hpp:310
int max_trials
Maximum number of flow routing iterations (dynamic wave).
Definition SimulationOptions.hpp:193
bool rpt_input
Report input summary.
Definition SimulationOptions.hpp:467
int link_offsets
Link offset mode: 0=DEPTH_OFFSET, 1=ELEV_OFFSET.
Definition SimulationOptions.hpp:248
bool evap_dry_only
If true, evaporation only occurs on dry days.
Definition SimulationOptions.hpp:393
double snow_ati_wt
Snowmelt: ATI weight (0–1).
Definition SimulationOptions.hpp:424
double start_date
Simulation start date/time (decimal days, OADate (days since 12/30/1899)).
Definition SimulationOptions.hpp:129
double adc_perv[10]
Areal depletion curve for pervious surfaces (10 fractions).
Definition SimulationOptions.hpp:448
double min_surf_area
Minimum node surface area (ft²).
Definition SimulationOptions.hpp:254
double wind_speed[12]
Monthly wind speed values (12 months).
Definition SimulationOptions.hpp:418
bool quality_routing
True if quality routing is enabled.
Definition SimulationOptions.hpp:279
bool allow_ponding
True if evaporation is included.
Definition SimulationOptions.hpp:282
bool anderson_accel
Enable Anderson acceleration for Picard iteration convergence.
Definition SimulationOptions.hpp:232
double report_step
Reporting output interval in seconds.
Definition SimulationOptions.hpp:150
int temp_source
Temperature source: 0=NONE, 1=TIMESERIES, 2=FILE.
Definition SimulationOptions.hpp:403
InfiltrationModel infiltration
Infiltration method for subcatchments.
Definition SimulationOptions.hpp:183
bool ignore_rdii
Ignore RDII.
Definition SimulationOptions.hpp:294
double dry_days
Antecedent dry days.
Definition SimulationOptions.hpp:153
int num_threads
Number of OpenMP threads for parallel solver loops.
Definition SimulationOptions.hpp:329
double dps_alpha
DPS surcharge shock parameter (dimensionless, >= 2).
Definition SimulationOptions.hpp:211
double min_slope
Minimum conduit slope (ft/ft).
Definition SimulationOptions.hpp:251
int sweep_end
Street sweeping end day-of-year (1-365). 0 = not set.
Definition SimulationOptions.hpp:170
double lengthening_step
Conduit lengthening timestep (seconds, 0 = use routing_step).
Definition SimulationOptions.hpp:164