OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
Inlet.hpp
Go to the documentation of this file.
1
19#ifndef OPENSWMM_INLET_HPP
20#define OPENSWMM_INLET_HPP
21
22#include <vector>
23
24namespace openswmm {
25
26struct SimulationContext;
27
28namespace inlet {
29
30enum class InletType : int {
31 GRATE = 0,
32 CURB = 1,
33 COMBO = 2,
34 SLOTTED = 3,
35 DROP_GRATE = 4,
36 DROP_CURB = 5,
37 CUSTOM = 6
38};
39
40enum class GrateType : int {
41 P_BAR_50 = 0,
42 P_BAR_50x100 = 1,
43 P_BAR_30 = 2,
44 CURVED_VANE = 3,
45 TILT_BAR_45 = 4,
46 TILT_BAR_30 = 5,
47 RETICULINE = 6,
48 GENERIC = 7
49};
50
51struct InletSoA {
52 int count = 0;
53 std::vector<int> link_idx;
54 std::vector<int> node_idx;
55 std::vector<int> bypass_node;
56 std::vector<int> inlet_type;
57 std::vector<int> grate_type;
58 std::vector<double> grate_length;
59 std::vector<double> grate_width;
60 std::vector<double> curb_length;
61 std::vector<double> curb_height;
62 std::vector<int> curb_throat;
63 std::vector<double> slotted_length;
64 std::vector<double> slotted_width;
65 std::vector<double> clog_factor;
66 std::vector<double> opening_ratio;
67 std::vector<int> num_inlets;
68 std::vector<double> flow_limit;
69 std::vector<double> local_depress;
70 std::vector<double> local_width;
71 std::vector<int> n_sides;
72
73 // Street geometry (resolved from StreetStore)
74 std::vector<double> sx;
75 std::vector<double> gutter_depression;
76 std::vector<double> gutter_width;
77 std::vector<double> road_roughness;
78 std::vector<double> t_crown;
79
80 // Working arrays (per-inlet results)
81 std::vector<double> flow_capture;
82
83 void resize(int n);
84};
85
87public:
88 void init(SimulationContext& ctx);
89
96 void computeAll(SimulationContext& ctx, double dt);
97
98private:
99 InletSoA soa_;
100
102 static double grateCapture(double flow, double velocity, double length,
103 double sx, int grate_type, double open_ratio);
104
106 static double curbCapture(double flow, double curb_length,
107 double sx, double sl, double n,
108 double gutter_depress, double gutter_width,
109 double spread);
110
112 static double splashOverVelocity(double length, int grate_type);
113
115 static double computeFlowSpread(double flow, double qfactor,
116 double sx, double sw, double a_gutter,
117 double w_gutter, double t_crown);
118
120 static double computeEo(double sr, double ts, double w);
121
123 double computeOnGradeCapture(int idx, double flow, double depth) const;
124};
125
126} // namespace inlet
127} // namespace openswmm
128
129#endif // OPENSWMM_INLET_HPP
Definition Inlet.hpp:86
void computeAll(SimulationContext &ctx, double dt)
Batch compute inlet capture for all inlets.
Definition Inlet.cpp:362
void init(SimulationContext &ctx)
Definition Inlet.cpp:254
GrateType
Definition Inlet.hpp:40
InletType
Definition Inlet.hpp:30
Definition Controls.cpp:24
Central, reentrant simulation context.
Definition SimulationContext.hpp:141
Definition Inlet.hpp:51
std::vector< double > flow_capture
Captured flow rate (cfs)
Definition Inlet.hpp:81
std::vector< int > grate_type
Definition Inlet.hpp:57
std::vector< double > slotted_width
Slotted drain width (ft)
Definition Inlet.hpp:64
std::vector< double > local_width
Local depression width (ft)
Definition Inlet.hpp:70
std::vector< double > local_depress
Local gutter depression (ft)
Definition Inlet.hpp:69
std::vector< int > inlet_type
Definition Inlet.hpp:56
std::vector< double > gutter_width
Street gutter width (ft)
Definition Inlet.hpp:76
std::vector< double > grate_length
Grate inlet length (ft)
Definition Inlet.hpp:58
std::vector< double > opening_ratio
Grate opening ratio.
Definition Inlet.hpp:66
int count
Definition Inlet.hpp:52
std::vector< int > num_inlets
Number of inlets per side.
Definition Inlet.hpp:67
std::vector< double > t_crown
Distance curb to crown (ft)
Definition Inlet.hpp:78
std::vector< int > bypass_node
Bypass node (downstream of street conduit)
Definition Inlet.hpp:55
std::vector< double > curb_height
Curb opening height (ft)
Definition Inlet.hpp:61
std::vector< double > grate_width
Grate inlet width (ft)
Definition Inlet.hpp:59
std::vector< double > sx
Street cross slope (fraction)
Definition Inlet.hpp:74
std::vector< int > link_idx
Street conduit link index.
Definition Inlet.hpp:53
std::vector< double > slotted_length
Slotted drain length (ft)
Definition Inlet.hpp:63
std::vector< int > n_sides
1 or 2 sided street
Definition Inlet.hpp:71
std::vector< double > curb_length
Curb opening length (ft)
Definition Inlet.hpp:60
std::vector< double > flow_limit
Max capture flow per inlet (cfs)
Definition Inlet.hpp:68
std::vector< int > node_idx
Receiving node index.
Definition Inlet.hpp:54
std::vector< double > road_roughness
Street Manning's n.
Definition Inlet.hpp:77
void resize(int n)
Definition Inlet.cpp:23
std::vector< double > gutter_depression
Street gutter depression (ft)
Definition Inlet.hpp:75
std::vector< double > clog_factor
Clogging reduction (0-1)
Definition Inlet.hpp:65
std::vector< int > curb_throat
Throat angle type (0=horiz, 1=inclined, 2=vert)
Definition Inlet.hpp:62