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 "LidNodeData.hpp"
38#include <vector>
39#include <string>
40#include <array>
41
43
44namespace openswmm {
45
46// ============================================================================
47// Snowpack definitions (from [SNOWPACKS] section)
48// ============================================================================
49
60 // Derived at report time from accepted native and completed source owners.
61 // Not restart state; it is rebuilt after every run/resume.
62 std::vector<std::pair<std::string, double>> report_values;
67 std::vector<climate::SnowDailyWeather> daily_weather;
72 int count() const { return static_cast<int>(names.size()); }
73
74 std::vector<std::string> names;
75
76 // PLOWABLE surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
77 std::vector<std::array<double, 7>> plowable;
78
79 // IMPERVIOUS surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
80 std::vector<std::array<double, 7>> impervious;
81
82 // PERVIOUS surface: cmin, cmax, tbase, fwfrac, sd0, fw0, snn0
83 std::vector<std::array<double, 7>> pervious;
84
85 // REMOVAL: dSnow, fOut, fImp, fPerv, fImelt, fToSubcatch, subcatch_name
86 std::vector<std::array<double, 6>> removal;
87 std::vector<std::string> removal_subcatch;
88};
89
90// ============================================================================
91// Aquifer definitions (from [AQUIFERS] section)
92// ============================================================================
93
106 int count() const { return static_cast<int>(names.size()); }
107
108 std::vector<std::string> names;
109 std::vector<double> porosity;
110 std::vector<double> wilting_point;
111 std::vector<double> field_capacity;
112 std::vector<double> conductivity;
113 std::vector<double> conduct_slope;
114 std::vector<double> tension_slope;
115 std::vector<double> upper_evap;
116 std::vector<double> lower_evap;
117 std::vector<double> lower_loss;
118 std::vector<double> bottom_elev;
119 std::vector<double> water_table_elev;
120 std::vector<double> upper_moist;
121 std::vector<std::string> upper_evap_pat;
122};
123
124// ============================================================================
125// LID control definitions (from [LID_CONTROLS] section)
126// ============================================================================
127
139 std::vector<std::vector<LidNodeLayer>> node_layers;
144 int count() const { return static_cast<int>(names.size()); }
145
146 std::vector<std::string> names;
147
149 std::vector<std::string> lid_type;
150
152 std::vector<std::array<double, 5>> surface;
153
155 std::vector<std::array<double, 7>> soil;
156
158 std::vector<std::array<double, 6>> pavement;
159
161 std::vector<std::array<double, 4>> storage;
162
164 std::vector<std::array<double, 6>> drain;
165 std::vector<std::string> drain_curve;
166
168 std::vector<std::array<double, 3>> drainmat;
169
173 std::vector<std::vector<std::pair<int, double>>> removals;
174
180 std::vector<std::vector<std::pair<std::string, double>>> removals_by_name;
181};
182
183// ============================================================================
184// LID usage assignments (from [LID_USAGE] section)
185// ============================================================================
186
197 int count() const { return static_cast<int>(subcatch_index.size()); }
198
199 std::vector<int> subcatch_index;
200 std::vector<int> lid_index;
201 std::vector<int> number;
202 std::vector<double> area;
203 std::vector<double> width;
204 std::vector<double> init_sat;
205 std::vector<double> from_imperv;
206 std::vector<int> to_perv;
210 std::vector<FilePathPair> rpt_file;
211 std::vector<std::string> drain_to;
212 std::vector<double> from_perv;
213
214 // Water balance results (ft depth, filled at end of simulation from LIDGroupSoA)
215 std::vector<double> wb_inflow;
216 std::vector<double> wb_evap;
217 std::vector<double> wb_infil;
218 std::vector<double> wb_surf_flow;
219 std::vector<double> wb_drain_flow;
220 std::vector<double> wb_init_vol;
221 std::vector<double> wb_final_vol;
222
231 void resize_wb(int n) {
232 auto un = static_cast<std::size_t>(n);
233 wb_inflow.assign(un, 0.0);
234 wb_evap.assign(un, 0.0);
235 wb_infil.assign(un, 0.0);
236 wb_surf_flow.assign(un, 0.0);
237 wb_drain_flow.assign(un, 0.0);
238 wb_init_vol.assign(un, 0.0);
239 wb_final_vol.assign(un, 0.0);
240 }
241};
242
243} // namespace openswmm
244
245#endif // OPENSWMM_ENGINE_HYDROLOGY_DATA_HPP
Carrier for an external file reference in a SWMM model.
Preparation and interpolation of hourly meteorological forcing.
Data-oriented storage for LID node layers, properties, and state.
Configuration and resolution of mesh snow packs and overrides.
Utah Energy Balance snow model configuration and validation.
Utah Energy Balance snow processing for subcatchments.
Owned consecutive hourly records with interval-weighted means. Concurrent const queries are safe only...
Definition HourlyMeteorology.hpp:34
Definition ExchangeLaw.hpp:60
SoA storage for aquifer parameter sets.
Definition HydrologyData.hpp:101
std::vector< double > wilting_point
Definition HydrologyData.hpp:110
std::vector< double > tension_slope
Definition HydrologyData.hpp:114
std::vector< double > bottom_elev
Definition HydrologyData.hpp:118
std::vector< double > lower_loss
Definition HydrologyData.hpp:117
std::vector< double > conduct_slope
Definition HydrologyData.hpp:113
std::vector< double > lower_evap
Definition HydrologyData.hpp:116
int count() const
Count AquiferStore rows from the names column.
Definition HydrologyData.hpp:106
std::vector< double > conductivity
Definition HydrologyData.hpp:112
std::vector< double > field_capacity
Definition HydrologyData.hpp:111
std::vector< std::string > upper_evap_pat
ET pattern name (optional)
Definition HydrologyData.hpp:121
std::vector< double > upper_evap
Definition HydrologyData.hpp:115
std::vector< std::string > names
Definition HydrologyData.hpp:108
std::vector< double > water_table_elev
Definition HydrologyData.hpp:119
std::vector< double > upper_moist
Definition HydrologyData.hpp:120
std::vector< double > porosity
Definition HydrologyData.hpp:109
SoA storage for LID control type definitions.
Definition HydrologyData.hpp:138
std::vector< std::vector< std::pair< std::string, double > > > removals_by_name
REMOVALS entries naming something that was not a pollutant when the row was read: a reaction species,...
Definition HydrologyData.hpp:180
std::vector< std::array< double, 5 > > surface
SURFACE layer params (up to 5 values).
Definition HydrologyData.hpp:152
std::vector< std::string > lid_type
LID type code string: BC, RG, GR, IT, PP, RB, RD, VS.
Definition HydrologyData.hpp:149
std::vector< std::array< double, 6 > > drain
DRAIN layer params (up to 6 values).
Definition HydrologyData.hpp:164
int count() const
Count LidControlStore rows from the names column.
Definition HydrologyData.hpp:144
std::vector< std::string > drain_curve
Definition HydrologyData.hpp:165
std::vector< std::array< double, 3 > > drainmat
DRAINMAT layer params (up to 3 values).
Definition HydrologyData.hpp:168
std::vector< std::array< double, 4 > > storage
STORAGE layer params (up to 4 values).
Definition HydrologyData.hpp:161
std::vector< std::string > names
Definition HydrologyData.hpp:146
std::vector< std::array< double, 6 > > pavement
PAVEMENT layer params (up to 6 values).
Definition HydrologyData.hpp:158
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:173
std::vector< std::vector< LidNodeLayer > > node_layers
Definition HydrologyData.hpp:139
std::vector< std::array< double, 7 > > soil
SOIL layer params (up to 7 values).
Definition HydrologyData.hpp:155
SoA storage for LID usage assignments to subcatchments.
Definition HydrologyData.hpp:192
std::vector< double > wb_drain_flow
Total drain outflow depth (ft)
Definition HydrologyData.hpp:219
std::vector< double > init_sat
Initial saturation (0–1)
Definition HydrologyData.hpp:204
std::vector< std::string > drain_to
Drain-to subcatchment name (optional)
Definition HydrologyData.hpp:211
std::vector< double > width
Top width of overland flow (ft or m)
Definition HydrologyData.hpp:203
std::vector< double > wb_surf_flow
Total surface outflow depth (ft)
Definition HydrologyData.hpp:218
std::vector< double > wb_init_vol
Initial stored depth (ft)
Definition HydrologyData.hpp:220
std::vector< int > to_perv
Definition HydrologyData.hpp:206
std::vector< int > subcatch_index
Subcatchment index.
Definition HydrologyData.hpp:199
std::vector< double > from_perv
% of pervious area routed to LID
Definition HydrologyData.hpp:212
void resize_wb(int n)
Replace all LID usage water-balance columns with zero totals.
Definition HydrologyData.hpp:231
std::vector< double > wb_final_vol
Final stored depth (ft)
Definition HydrologyData.hpp:221
int count() const
Count LidUsageStore rows from the subcatch_index column.
Definition HydrologyData.hpp:197
std::vector< FilePathPair > rpt_file
Definition HydrologyData.hpp:210
std::vector< double > wb_inflow
Total inflow depth (ft)
Definition HydrologyData.hpp:215
std::vector< double > from_imperv
% of impervious area routed to LID
Definition HydrologyData.hpp:205
std::vector< int > number
Number of replicate units.
Definition HydrologyData.hpp:201
std::vector< double > wb_evap
Total evaporation depth (ft)
Definition HydrologyData.hpp:216
std::vector< double > area
Area of each unit (ft2 or m2)
Definition HydrologyData.hpp:202
std::vector< int > lid_index
Index into LidControlStore.
Definition HydrologyData.hpp:200
std::vector< double > wb_infil
Total exfiltration depth (ft)
Definition HydrologyData.hpp:217
SoA storage for snowpack parameter sets.
Definition HydrologyData.hpp:59
std::vector< std::array< double, 7 > > pervious
Definition HydrologyData.hpp:83
std::vector< std::array< double, 6 > > removal
Definition HydrologyData.hpp:86
int count() const
Count SnowpackStore rows from the names column.
Definition HydrologyData.hpp:72
std::vector< std::array< double, 7 > > plowable
Definition HydrologyData.hpp:77
std::vector< std::pair< std::string, double > > report_values
Definition HydrologyData.hpp:62
std::vector< std::string > names
Definition HydrologyData.hpp:74
surface::MeshSnowConfig mesh_config
Definition HydrologyData.hpp:65
std::vector< std::string > removal_subcatch
Definition HydrologyData.hpp:87
surface::ueb::NativeState runtime
Definition HydrologyData.hpp:63
surface::SnowConfig config
Definition HydrologyData.hpp:64
std::vector< climate::SnowDailyWeather > daily_weather
Definition HydrologyData.hpp:67
std::vector< std::array< double, 7 > > impervious
Definition HydrologyData.hpp:80
climate::HourlyMeteorology meteorology
Definition HydrologyData.hpp:66
Definition MeshSnowConfig.hpp:25
Definition UebConfig.hpp:37
Owned per-surface UEB predictions, accepted outputs and whole-model ledgers. Three surface columns pe...
Definition UebSubcatchments.hpp:27