OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
Constants.hpp
Go to the documentation of this file.
1
23#ifndef OPENSWMM_CONSTANTS_HPP
24#define OPENSWMM_CONSTANTS_HPP
25
26namespace openswmm {
27
28// ============================================================================
29// Physical constants
30// ============================================================================
31
32namespace constants {
33
36constexpr double GRAVITY = 32.2;
37
39constexpr double SQRT_GRAVITY = 5.67450438786; // sqrt(32.2)
40
42constexpr double INV_SQRT_GRAVITY = 0.17622692584; // 1.0 / sqrt(32.2)
43
45constexpr double PI = 3.141592654;
46
50constexpr double PHI = 1.486;
51
54constexpr double MEXP = 5.0 / 3.0;
55
57constexpr double VISCOS = 1.1e-5;
58
60constexpr double SEC_PER_DAY = 86400.0;
61
63constexpr double FT_PER_IN = 1.0 / 12.0;
64
66constexpr double IN_PER_FT = 12.0;
67
68// ============================================================================
69// Numerical thresholds and tolerances
70// ============================================================================
71
75constexpr double FUDGE = 0.0001;
76
79constexpr double MIN_SURFAREA = 12.566; // 4*pi
80
82constexpr double MIN_DELTA_Z = 0.001;
83
86constexpr double XTOL = 0.001;
87
89constexpr double TINY = 1.0e-6;
90
93static constexpr double MISSING = -1.0e10;
94
95// ============================================================================
96// Dynamic wave solver constants
97// ============================================================================
98
101constexpr double OMEGA = 0.5;
102
105constexpr double DEFAULT_HEAD_TOL = 0.005;
106
109constexpr int DEFAULT_MAX_TRIALS = 8;
110
113constexpr double MAX_VELOCITY = 50.0;
114
117constexpr double MIN_TIMESTEP = 0.001;
118
121constexpr double EXTRAN_CROWN_CUTOFF = 0.96;
122
124constexpr double SLOT_CROWN_CUTOFF = 0.985257;
125
127constexpr double SLOT_WIDTH_FACTOR = 0.001;
128
129// ============================================================================
130// ODE solver constants (RK45 Cash-Karp)
131// ============================================================================
132
133namespace ode {
134
136constexpr int MAX_STEPS = 10000;
137
139constexpr double ODE_TINY = 1.0e-30;
140
142constexpr double SAFETY = 0.9;
143
145constexpr double PGROW = -0.2;
146
148constexpr double PSHRNK = -0.25;
149
151constexpr double ERRCON = 1.89e-4;
152
155constexpr double GWTOL = 0.0001;
156
158constexpr double ODETOL = 0.0001;
159
160} // namespace ode
161
162// ============================================================================
163// Hydraulic structure constants
164// ============================================================================
165
167constexpr double MIN_LINK_FLOW = 0.001;
168
169// ============================================================================
170// Cross-section constants
171// ============================================================================
172
174constexpr double RECT_ALFMAX = 0.97;
175
177constexpr double TRAP_ALFMAX = 0.98;
178
180constexpr int N_TRANSECT_TBL = 51;
181
183constexpr int MAX_SHAPES = 26;
184
185// ============================================================================
186// Data structure constants
187// ============================================================================
188
190constexpr int N_FLOW_CLASSES = 7;
191
193constexpr int MAX_PAST_RAIN = 48;
194
196constexpr int N_TIME_BINS = 5;
197
202constexpr int DATE_DELTA = 693594;
203
204} // namespace constants
205} // namespace openswmm
206
207#endif // OPENSWMM_CONSTANTS_HPP
#define MISSING
Missing value code.
Definition consts.h:136
constexpr double PGROW
Exponent for step increase.
Definition Constants.hpp:145
constexpr double ODETOL
Runoff ODE tolerance.
Definition Constants.hpp:158
constexpr double GWTOL
Definition Constants.hpp:155
constexpr double ERRCON
Error control threshold = (5/SAFETY)^(1/PGROW).
Definition Constants.hpp:151
constexpr int MAX_STEPS
Maximum number of integration steps.
Definition Constants.hpp:136
constexpr double PSHRNK
Exponent for step decrease.
Definition Constants.hpp:148
constexpr double ODE_TINY
Underflow protection for scaling.
Definition Constants.hpp:139
constexpr double SAFETY
Safety factor for step size adjustment.
Definition Constants.hpp:142
constexpr int DATE_DELTA
Definition Constants.hpp:202
constexpr double MIN_SURFAREA
Definition Constants.hpp:79
constexpr double DEFAULT_HEAD_TOL
Definition Constants.hpp:105
constexpr int MAX_PAST_RAIN
Maximum past rain hours tracked per gage.
Definition Constants.hpp:193
constexpr double FUDGE
Definition Constants.hpp:75
constexpr double IN_PER_FT
Inches per foot.
Definition Constants.hpp:66
constexpr double MEXP
Definition Constants.hpp:54
constexpr double GRAVITY
Definition Constants.hpp:36
constexpr int MAX_SHAPES
Maximum number of cross-section shape types.
Definition Constants.hpp:183
constexpr double PHI
Definition Constants.hpp:50
constexpr double SQRT_GRAVITY
sqrt(GRAVITY) — precomputed to avoid per-element std::sqrt in Froude calc.
Definition Constants.hpp:39
constexpr double EXTRAN_CROWN_CUTOFF
Definition Constants.hpp:121
constexpr double MAX_VELOCITY
Definition Constants.hpp:113
constexpr double SLOT_WIDTH_FACTOR
Preissmann slot width factor (slot_width = y_full * this factor).
Definition Constants.hpp:127
constexpr int N_TIME_BINS
Number of time step histogram bins.
Definition Constants.hpp:196
constexpr double OMEGA
Definition Constants.hpp:101
constexpr double MIN_DELTA_Z
Minimum elevation drop for conduit slope computation (ft).
Definition Constants.hpp:82
constexpr double TINY
Small positive number for underflow protection.
Definition Constants.hpp:89
constexpr int DEFAULT_MAX_TRIALS
Definition Constants.hpp:109
constexpr double MIN_TIMESTEP
Definition Constants.hpp:117
constexpr int N_FLOW_CLASSES
Number of flow classification bins.
Definition Constants.hpp:190
constexpr double FT_PER_IN
Feet per inch.
Definition Constants.hpp:63
constexpr double PI
Pi.
Definition Constants.hpp:45
constexpr double SLOT_CROWN_CUTOFF
Preissmann slot crown cutoff fraction.
Definition Constants.hpp:124
constexpr double TRAP_ALFMAX
Maximum alpha fraction for trapezoidal shapes.
Definition Constants.hpp:177
constexpr double SEC_PER_DAY
Seconds per day.
Definition Constants.hpp:60
constexpr double INV_SQRT_GRAVITY
1.0 / sqrt(GRAVITY) — multiply instead of divide in Froude computation.
Definition Constants.hpp:42
constexpr double XTOL
Definition Constants.hpp:86
constexpr double VISCOS
Kinematic viscosity of water at 20°C (ft²/sec).
Definition Constants.hpp:57
constexpr double RECT_ALFMAX
Maximum alpha fraction for rectangular shapes.
Definition Constants.hpp:174
constexpr int N_TRANSECT_TBL
Transect discretization table size.
Definition Constants.hpp:180
constexpr double MIN_LINK_FLOW
Minimum orifice/weir flow threshold.
Definition Constants.hpp:167
Definition NodeCoupling.cpp:15