OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
HydrologyData.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
29
30#ifndef OPENSWMM_ENGINE_HYDROLOGY_DATA_HPP
31#define OPENSWMM_ENGINE_HYDROLOGY_DATA_HPP
32
33#include <vector>
34#include <string>
35#include <array>
36
38
39namespace openswmm {
40
41// ============================================================================
42// Snowpack definitions (from [SNOWPACKS] section)
43// ============================================================================
44
55 int count() const { return static_cast<int>(names.size()); }
56
57 std::vector<std::string> names;
58
59 // PLOWABLE surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
60 std::vector<std::array<double, 7>> plowable;
61
62 // IMPERVIOUS surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
63 std::vector<std::array<double, 7>> impervious;
64
65 // PERVIOUS surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
66 std::vector<std::array<double, 7>> pervious;
67
68 // REMOVAL: dSnow, fOut, fImp, fPerv, fImelt, fToSubcatch, subcatch_name
69 std::vector<std::array<double, 6>> removal;
70 std::vector<std::string> removal_subcatch;
71};
72
73// ============================================================================
74// Aquifer definitions (from [AQUIFERS] section)
75// ============================================================================
76
85 int count() const { return static_cast<int>(names.size()); }
86
87 std::vector<std::string> names;
88 std::vector<double> porosity;
89 std::vector<double> wilting_point;
90 std::vector<double> field_capacity;
91 std::vector<double> conductivity;
92 std::vector<double> conduct_slope;
93 std::vector<double> tension_slope;
94 std::vector<double> upper_evap;
95 std::vector<double> lower_evap;
96 std::vector<double> lower_loss;
97 std::vector<double> bottom_elev;
98 std::vector<double> water_table_elev;
99 std::vector<double> upper_moist;
100 std::vector<std::string> upper_evap_pat;
101};
102
103// ============================================================================
104// LID control definitions (from [LID_CONTROLS] section)
105// ============================================================================
106
118 int count() const { return static_cast<int>(names.size()); }
119
120 std::vector<std::string> names;
121
123 std::vector<std::string> lid_type;
124
126 std::vector<std::array<double, 5>> surface;
127
129 std::vector<std::array<double, 7>> soil;
130
132 std::vector<std::array<double, 6>> pavement;
133
135 std::vector<std::array<double, 4>> storage;
136
138 std::vector<std::array<double, 6>> drain;
139
141 std::vector<std::array<double, 3>> drainmat;
142
146 std::vector<std::vector<std::pair<int, double>>> removals;
147};
148
149// ============================================================================
150// LID usage assignments (from [LID_USAGE] section)
151// ============================================================================
152
159 int count() const { return static_cast<int>(subcatch_index.size()); }
160
161 std::vector<int> subcatch_index;
162 std::vector<int> lid_index;
163 std::vector<int> number;
164 std::vector<double> area;
165 std::vector<double> width;
166 std::vector<double> init_sat;
167 std::vector<double> from_imperv;
168 std::vector<int> to_perv;
172 std::vector<FilePathPair> rpt_file;
173 std::vector<std::string> drain_to;
174 std::vector<double> from_perv;
175
176 // Water balance results (ft depth, filled at end of simulation from LIDGroupSoA)
177 std::vector<double> wb_inflow;
178 std::vector<double> wb_evap;
179 std::vector<double> wb_infil;
180 std::vector<double> wb_surf_flow;
181 std::vector<double> wb_drain_flow;
182 std::vector<double> wb_init_vol;
183 std::vector<double> wb_final_vol;
184
185 void resize_wb(int n) {
186 auto un = static_cast<std::size_t>(n);
187 wb_inflow.assign(un, 0.0);
188 wb_evap.assign(un, 0.0);
189 wb_infil.assign(un, 0.0);
190 wb_surf_flow.assign(un, 0.0);
191 wb_drain_flow.assign(un, 0.0);
192 wb_init_vol.assign(un, 0.0);
193 wb_final_vol.assign(un, 0.0);
194 }
195};
196
197} // namespace openswmm
198
199#endif // OPENSWMM_ENGINE_HYDROLOGY_DATA_HPP
Carrier for an external file reference in a SWMM model.
Definition NodeCoupling.cpp:16
SoA storage for aquifer parameter sets.
Definition HydrologyData.hpp:84
std::vector< double > wilting_point
Definition HydrologyData.hpp:89
std::vector< double > tension_slope
Definition HydrologyData.hpp:93
std::vector< double > bottom_elev
Definition HydrologyData.hpp:97
std::vector< double > lower_loss
Definition HydrologyData.hpp:96
std::vector< double > conduct_slope
Definition HydrologyData.hpp:92
std::vector< double > lower_evap
Definition HydrologyData.hpp:95
int count() const
Definition HydrologyData.hpp:85
std::vector< double > conductivity
Definition HydrologyData.hpp:91
std::vector< double > field_capacity
Definition HydrologyData.hpp:90
std::vector< std::string > upper_evap_pat
ET pattern name (optional)
Definition HydrologyData.hpp:100
std::vector< double > upper_evap
Definition HydrologyData.hpp:94
std::vector< std::string > names
Definition HydrologyData.hpp:87
std::vector< double > water_table_elev
Definition HydrologyData.hpp:98
std::vector< double > upper_moist
Definition HydrologyData.hpp:99
std::vector< double > porosity
Definition HydrologyData.hpp:88
SoA storage for LID control type definitions.
Definition HydrologyData.hpp:117
std::vector< std::array< double, 5 > > surface
SURFACE layer params (up to 5 values).
Definition HydrologyData.hpp:126
std::vector< std::string > lid_type
LID type code string: BC, RG, GR, IT, PP, RB, RD, VS.
Definition HydrologyData.hpp:123
std::vector< std::array< double, 6 > > drain
DRAIN layer params (up to 6 values).
Definition HydrologyData.hpp:138
int count() const
Definition HydrologyData.hpp:118
std::vector< std::array< double, 3 > > drainmat
DRAINMAT layer params (up to 3 values).
Definition HydrologyData.hpp:141
std::vector< std::array< double, 4 > > storage
STORAGE layer params (up to 4 values).
Definition HydrologyData.hpp:135
std::vector< std::string > names
Definition HydrologyData.hpp:120
std::vector< std::array< double, 6 > > pavement
PAVEMENT layer params (up to 6 values).
Definition HydrologyData.hpp:132
std::vector< std::vector< std::pair< int, double > > > removals
REMOVALS: per-LID pollutant removal fractions. removals[lid_index] = vector of {pollutant_index,...
Definition HydrologyData.hpp:146
std::vector< std::array< double, 7 > > soil
SOIL layer params (up to 7 values).
Definition HydrologyData.hpp:129
SoA storage for LID usage assignments to subcatchments.
Definition HydrologyData.hpp:158
std::vector< double > wb_drain_flow
Total drain outflow depth (ft)
Definition HydrologyData.hpp:181
std::vector< double > init_sat
Initial saturation (0–1)
Definition HydrologyData.hpp:166
std::vector< std::string > drain_to
Drain-to subcatchment name (optional)
Definition HydrologyData.hpp:173
std::vector< double > width
Top width of overland flow (ft or m)
Definition HydrologyData.hpp:165
std::vector< double > wb_surf_flow
Total surface outflow depth (ft)
Definition HydrologyData.hpp:180
std::vector< double > wb_init_vol
Initial stored depth (ft)
Definition HydrologyData.hpp:182
std::vector< int > to_perv
Definition HydrologyData.hpp:168
std::vector< int > subcatch_index
Subcatchment index.
Definition HydrologyData.hpp:161
std::vector< double > from_perv
% of pervious area routed to LID
Definition HydrologyData.hpp:174
void resize_wb(int n)
Definition HydrologyData.hpp:185
std::vector< double > wb_final_vol
Final stored depth (ft)
Definition HydrologyData.hpp:183
int count() const
Definition HydrologyData.hpp:159
std::vector< FilePathPair > rpt_file
Definition HydrologyData.hpp:172
std::vector< double > wb_inflow
Total inflow depth (ft)
Definition HydrologyData.hpp:177
std::vector< double > from_imperv
% of impervious area routed to LID
Definition HydrologyData.hpp:167
std::vector< int > number
Number of replicate units.
Definition HydrologyData.hpp:163
std::vector< double > wb_evap
Total evaporation depth (ft)
Definition HydrologyData.hpp:178
std::vector< double > area
Area of each unit (ft2 or m2)
Definition HydrologyData.hpp:164
std::vector< int > lid_index
Index into LidControlStore.
Definition HydrologyData.hpp:162
std::vector< double > wb_infil
Total exfiltration depth (ft)
Definition HydrologyData.hpp:179
SoA storage for snowpack parameter sets.
Definition HydrologyData.hpp:54
std::vector< std::array< double, 7 > > pervious
Definition HydrologyData.hpp:66
std::vector< std::array< double, 6 > > removal
Definition HydrologyData.hpp:69
int count() const
Definition HydrologyData.hpp:55
std::vector< std::array< double, 7 > > plowable
Definition HydrologyData.hpp:60
std::vector< std::string > names
Definition HydrologyData.hpp:57
std::vector< std::string > removal_subcatch
Definition HydrologyData.hpp:70
std::vector< std::array< double, 7 > > impervious
Definition HydrologyData.hpp:63