OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_subcatchments.h
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
31
32#ifndef OPENSWMM_SUBCATCHMENTS_H
33#define OPENSWMM_SUBCATCHMENTS_H
34
35#include "openswmm_engine.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* =========================================================================
42 * Identity
43 * ========================================================================= */
44
51
58SWMM_ENGINE_API int swmm_subcatch_index(SWMM_Engine engine, const char* id);
59
66SWMM_ENGINE_API const char* swmm_subcatch_id(SWMM_Engine engine, int idx);
67
68/* =========================================================================
69 * Creation (BUILDING or OPENED — "editable" states)
70 * ========================================================================= */
71
85SWMM_ENGINE_API int swmm_subcatch_add(SWMM_Engine engine, const char* id);
86
87/* =========================================================================
88 * Property setters (BUILDING or OPENED)
89 * ========================================================================= */
90
98SWMM_ENGINE_API int swmm_subcatch_set_outlet(SWMM_Engine engine, int idx, int node_idx);
99
107SWMM_ENGINE_API int swmm_subcatch_set_area(SWMM_Engine engine, int idx, double area);
108
116SWMM_ENGINE_API int swmm_subcatch_set_width(SWMM_Engine engine, int idx, double width);
117
125SWMM_ENGINE_API int swmm_subcatch_set_slope(SWMM_Engine engine, int idx, double slope);
126
134SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct(SWMM_Engine engine, int idx, double pct);
135
145SWMM_ENGINE_API int swmm_subcatch_set_zero_imperv_pct(SWMM_Engine engine, int idx, double pct);
146
154SWMM_ENGINE_API int swmm_subcatch_set_n_imperv(SWMM_Engine engine, int idx, double n);
155
163SWMM_ENGINE_API int swmm_subcatch_set_n_perv(SWMM_Engine engine, int idx, double n);
164
172SWMM_ENGINE_API int swmm_subcatch_set_ds_imperv(SWMM_Engine engine, int idx, double ds);
173
181SWMM_ENGINE_API int swmm_subcatch_set_ds_perv(SWMM_Engine engine, int idx, double ds);
182
190SWMM_ENGINE_API int swmm_subcatch_set_gage(SWMM_Engine engine, int idx, int gage_idx);
191
192/* --- Infiltration parameters (BUILDING or OPENED) --- */
193
196 double f0, double fmin,
197 double decay, double dry_time);
198
201 double suction, double conductivity,
202 double initial_deficit);
203
216 double cn, double drying_time);
217
231SWMM_ENGINE_API int swmm_subcatch_set_infil_model(SWMM_Engine engine, int idx, int model);
232
233/* =========================================================================
234 * Property getters
235 * ========================================================================= */
236
244SWMM_ENGINE_API int swmm_subcatch_get_area(SWMM_Engine engine, int idx, double* area);
245
253SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct(SWMM_Engine engine, int idx, double* pct);
254
263SWMM_ENGINE_API int swmm_subcatch_get_zero_imperv_pct(SWMM_Engine engine, int idx, double* pct);
264
272SWMM_ENGINE_API int swmm_subcatch_get_outlet(SWMM_Engine engine, int idx, int* node_idx);
273
281SWMM_ENGINE_API int swmm_subcatch_get_width(SWMM_Engine engine, int idx, double* w);
282
290SWMM_ENGINE_API int swmm_subcatch_get_slope(SWMM_Engine engine, int idx, double* s);
291
299SWMM_ENGINE_API int swmm_subcatch_get_n_imperv(SWMM_Engine engine, int idx, double* n);
300
308SWMM_ENGINE_API int swmm_subcatch_get_n_perv(SWMM_Engine engine, int idx, double* n);
309
317SWMM_ENGINE_API int swmm_subcatch_get_ds_imperv(SWMM_Engine engine, int idx, double* ds);
318
326SWMM_ENGINE_API int swmm_subcatch_get_ds_perv(SWMM_Engine engine, int idx, double* ds);
327
335SWMM_ENGINE_API int swmm_subcatch_get_gage(SWMM_Engine engine, int idx, int* gage_idx);
336
349SWMM_ENGINE_API int swmm_subcatch_set_outlet_subcatch(SWMM_Engine engine, int idx, int sc_idx);
350
358SWMM_ENGINE_API int swmm_subcatch_get_outlet_subcatch(SWMM_Engine engine, int idx, int* sc_idx);
359
360/* =========================================================================
361 * Infiltration getters
362 * ========================================================================= */
363
375SWMM_ENGINE_API int swmm_subcatch_get_infil_model(SWMM_Engine engine, int idx, int* model);
376
388 double* f0, double* fmin,
389 double* decay, double* dry_time);
390
401 double* suction, double* conductivity,
402 double* deficit);
403
414 double* cn, double* drying_time);
415
416/* =========================================================================
417 * Subcatchment statistics
418 * ========================================================================= */
419
427SWMM_ENGINE_API int swmm_subcatch_get_stat_precip(SWMM_Engine engine, int idx, double* vol);
428
436SWMM_ENGINE_API int swmm_subcatch_get_stat_runoff_vol(SWMM_Engine engine, int idx, double* vol);
437
445SWMM_ENGINE_API int swmm_subcatch_get_stat_max_runoff(SWMM_Engine engine, int idx, double* rate);
446
447/* =========================================================================
448 * Subcatchment landuse coverage
449 * ========================================================================= */
450
465SWMM_ENGINE_API int swmm_subcatch_set_coverage(SWMM_Engine engine, int sc_idx, int lu_idx, double fraction);
466
475SWMM_ENGINE_API int swmm_subcatch_get_coverage(SWMM_Engine engine, int sc_idx, int lu_idx, double* fraction);
476
490SWMM_ENGINE_API int swmm_subcatch_get_coverages(SWMM_Engine engine, int sc_idx, double* out, int n);
491
492/* =========================================================================
493 * Initial pollutant loadings ([LOADINGS])
494 * ========================================================================= */
495
509SWMM_ENGINE_API int swmm_subcatch_set_initial_loading(SWMM_Engine engine, int sc_idx, int pollut_idx, double buildup);
510
519SWMM_ENGINE_API int swmm_subcatch_get_initial_loading(SWMM_Engine engine, int sc_idx, int pollut_idx, double* buildup);
520
521/* =========================================================================
522 * Hydraulic state getters
523 * ========================================================================= */
524
532SWMM_ENGINE_API int swmm_subcatch_get_runoff(SWMM_Engine engine, int idx, double* runoff);
533
541SWMM_ENGINE_API int swmm_subcatch_get_groundwater(SWMM_Engine engine, int idx, double* gw_flow);
542
550SWMM_ENGINE_API int swmm_subcatch_get_rainfall(SWMM_Engine engine, int idx, double* rainfall);
551
559SWMM_ENGINE_API int swmm_subcatch_get_snow_depth(SWMM_Engine engine, int idx, double* depth);
560
568SWMM_ENGINE_API int swmm_subcatch_get_evap(SWMM_Engine engine, int idx, double* evap);
569
570/* =========================================================================
571 * Groundwater configuration ([GROUNDWATER])
572 * =========================================================================
573 * Configure a subcatchment's [GROUNDWATER] flow routing. Values are stored
574 * exactly as parsed from the input file (raw user units) so they round-trip
575 * identically. Distinct from the runtime gw STATE (theta / lower_depth)
576 * injected via swmm_subcatch_set_gw_state. All are BUILDING/OPENED editable.
577 */
578
580SWMM_ENGINE_API int swmm_subcatch_set_aquifer(SWMM_Engine engine, int idx, int aquifer_idx);
581
583SWMM_ENGINE_API int swmm_subcatch_get_aquifer(SWMM_Engine engine, int idx, int* aquifer_idx);
584
586SWMM_ENGINE_API int swmm_subcatch_set_gw_node(SWMM_Engine engine, int idx, int node_idx);
587
589SWMM_ENGINE_API int swmm_subcatch_get_gw_node(SWMM_Engine engine, int idx, int* node_idx);
590
602 double surf_elev, double a1, double b1,
603 double a2, double b2, double a3,
604 double tw, double hstar);
605
608 double* surf_elev, double* a1, double* b1,
609 double* a2, double* b2, double* a3,
610 double* tw, double* hstar);
611
612/* =========================================================================
613 * State injection (data assimilation)
614 * ========================================================================= */
615
632 double theta, double lower_depth);
633
644 double* theta, double* lower_depth);
645
663 int surface, double swe, double fw,
664 double ati, double coldc);
665
679 int surface, double* swe, double* fw,
680 double* ati, double* coldc);
681
689SWMM_ENGINE_API int swmm_subcatch_get_infil(SWMM_Engine engine, int idx, double* infil);
690
691/* --- Runtime forcing (RUNNING state only) --- */
692
700SWMM_ENGINE_API int swmm_subcatch_set_rainfall(SWMM_Engine engine, int idx, double rainfall);
701
702/* =========================================================================
703 * Water quality
704 * ========================================================================= */
705
714SWMM_ENGINE_API int swmm_subcatch_get_quality(SWMM_Engine engine, int subcatch_idx,
715 int pollutant_idx, double* conc);
716
717/* =========================================================================
718 * Bulk access
719 * ========================================================================= */
720
728SWMM_ENGINE_API int swmm_subcatch_get_runoff_bulk(SWMM_Engine engine, double* buf, int count);
729
739 double* buf, int count);
740
741/* =========================================================================
742 * Phase 3 bulk getters — added in OpenSWMM 6.0.0 to eliminate the N
743 * round-trip cost of per-subcatchment scalar accessors. All return a
744 * caller-allocated @c double buffer of length @c count (clipped at
745 * @c swmm_subcatch_count()); the IDs variant returns a stride-packed
746 * UTF-8 buffer following the same format as @ref swmm_node_get_ids_bulk.
747 * ========================================================================= */
748
754SWMM_ENGINE_API int swmm_subcatch_get_rainfall_bulk(SWMM_Engine engine, double* buf, int count);
755
762SWMM_ENGINE_API int swmm_subcatch_get_evap_bulk(SWMM_Engine engine, double* buf, int count);
763
770SWMM_ENGINE_API int swmm_subcatch_get_infil_bulk(SWMM_Engine engine, double* buf, int count);
771
780SWMM_ENGINE_API int swmm_subcatch_get_snow_depth_bulk(SWMM_Engine engine, double* buf, int count);
781
797 char* buf,
798 int stride,
799 int count);
800
801/* =========================================================================
802 * Ponded quality (mass in standing water between events)
803 * ========================================================================= */
804
807 int subcatch_idx, int pollutant_idx, double* mass);
808
811 int subcatch_idx, int pollutant_idx, double mass);
812
816SWMM_ENGINE_API int swmm_subcatch_rename(SWMM_Engine engine, int idx, const char* newId);
817
818/* =========================================================================
819 * Aquifer definitions ([AQUIFERS] section) — Slice BM.0 / BP.6.6.4
820 * ========================================================================= */
821
828
835SWMM_ENGINE_API int swmm_aquifer_index(SWMM_Engine engine, const char* id);
836
843SWMM_ENGINE_API const char* swmm_aquifer_id(SWMM_Engine engine, int idx);
844
856SWMM_ENGINE_API int swmm_aquifer_add(SWMM_Engine engine, const char* id);
857
873SWMM_ENGINE_API int swmm_aquifer_rename(SWMM_Engine engine, int idx, const char* new_id);
874
901
910SWMM_ENGINE_API int swmm_aquifer_get_param(SWMM_Engine engine, int idx, int param, double* value);
911
926SWMM_ENGINE_API int swmm_aquifer_set_param(SWMM_Engine engine, int idx, int param, double value);
927
945SWMM_ENGINE_API int swmm_aquifer_get_evap_pattern(SWMM_Engine engine, int idx, char* buf, int buflen);
946
961SWMM_ENGINE_API int swmm_aquifer_set_evap_pattern(SWMM_Engine engine, int idx, const char* name);
962
963/* =========================================================================
964 * Snowpack definitions ([SNOWPACKS] section) — Slice BM.0 / BP.6.6.5
965 * ========================================================================= */
966
973
980SWMM_ENGINE_API int swmm_snowpack_index(SWMM_Engine engine, const char* id);
981
988SWMM_ENGINE_API const char* swmm_snowpack_id(SWMM_Engine engine, int idx);
989
1003SWMM_ENGINE_API int swmm_snowpack_add(SWMM_Engine engine, const char* id);
1004
1022SWMM_ENGINE_API int swmm_snowpack_rename(SWMM_Engine engine, int idx, const char* new_id);
1023
1024/* -------------------------------------------------------------------------
1025 * Snowpack surface parameters
1026 *
1027 * A snowpack carries three snow-melt surfaces — PLOWABLE, IMPERVIOUS and
1028 * PERVIOUS — plus an optional REMOVAL row, matching the four line types of
1029 * the legacy `[SNOWPACKS]` section. Each surface takes seven values in
1030 * input-file units:
1031 *
1032 * cmin Minimum melt coefficient (in or mm /hr/deg)
1033 * cmax Maximum melt coefficient (in or mm /hr/deg)
1034 * tbase Snow-melt base temperature (deg F or C)
1035 * fwfrac Free-water capacity as a fraction of depth
1036 * sd0 Initial snow depth (in or mm water equiv.)
1037 * fw0 Initial free water (in or mm)
1038 * last PLOWABLE: fraction of the impervious area that is plowable;
1039 * IMPERVIOUS / PERVIOUS: snow depth above which there is 100% cover
1040 * (in or mm).
1041 *
1042 * Setters are pre-start-only (BUILDING / OPENED) — the surface parameters seed
1043 * per-subcatchment snow state at start(); a mid-run change returns
1044 * SWMM_ERR_LIFECYCLE. Each setter has an inverse getter so the GUI snowpack
1045 * editor can load existing definitions. Any getter out-param may be null.
1046 * ------------------------------------------------------------------------- */
1047
1050 double cmin, double cmax, double tbase,
1051 double fwfrac, double sd0, double fw0, double last);
1054 double* cmin, double* cmax, double* tbase,
1055 double* fwfrac, double* sd0, double* fw0, double* last);
1056
1059 double cmin, double cmax, double tbase,
1060 double fwfrac, double sd0, double fw0, double last);
1063 double* cmin, double* cmax, double* tbase,
1064 double* fwfrac, double* sd0, double* fw0, double* last);
1065
1068 double cmin, double cmax, double tbase,
1069 double fwfrac, double sd0, double fw0, double last);
1072 double* cmin, double* cmax, double* tbase,
1073 double* fwfrac, double* sd0, double* fw0, double* last);
1074
1087 double dsnow, double fout, double fimp,
1088 double fperv, double fimelt, double fsubcatch);
1091 double* dsnow, double* fout, double* fimp,
1092 double* fperv, double* fimelt, double* fsubcatch);
1093
1095SWMM_ENGINE_API int swmm_snowpack_set_removal_subcatch(SWMM_Engine engine, int idx, const char* name);
1097SWMM_ENGINE_API int swmm_snowpack_get_removal_subcatch(SWMM_Engine engine, int idx, char* buf, int buflen);
1098
1099/* =========================================================================
1100 * Tag — free-form string label from the INP `[TAGS]` section
1101 * ========================================================================= */
1102
1105 char* buf, int buflen);
1106
1109 const char* tag);
1110
1127 double factor);
1128
1131 double* factor);
1132
1150 double factor);
1151
1154 double* factor);
1155
1156/* =========================================================================
1157 * Custom groundwater flow expressions ([GWF] section)
1158 * ========================================================================= */
1159
1173
1187SWMM_ENGINE_API int swmm_subcatch_get_gwf_expression(SWMM_Engine engine, int index, int type,
1188 char* buf, int buflen);
1189
1207SWMM_ENGINE_API int swmm_subcatch_set_gwf_expression(SWMM_Engine engine, int index, int type,
1208 const char* expr);
1209
1233SWMM_ENGINE_API int swmm_gwf_validate_expression(SWMM_Engine engine, const char* expr,
1234 char* errbuf, int buflen, int* col_out);
1235
1242
1251SWMM_ENGINE_API int swmm_gwf_variable_name(SWMM_Engine engine, int i, char* buf, int buflen);
1252
1262SWMM_ENGINE_API int swmm_gwf_variable_description(SWMM_Engine engine, int i, char* buf, int buflen);
1263
1270
1281SWMM_ENGINE_API int swmm_gwf_function_name(SWMM_Engine engine, int i, char* buf, int buflen);
1282
1283#ifdef __cplusplus
1284} /* extern "C" */
1285#endif
1286
1287#endif /* OPENSWMM_SUBCATCHMENTS_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:53
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:51
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API int swmm_snowpack_get_plowable(SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
Read the PLOWABLE surface parameters. Inverse of swmm_snowpack_set_plowable.
Definition openswmm_subcatchments_impl.cpp:1413
SWMM_ENGINE_API int swmm_subcatch_set_coverage(SWMM_Engine engine, int sc_idx, int lu_idx, double fraction)
Set the land use coverage percent for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:464
SWMM_ENGINE_API int swmm_aquifer_rename(SWMM_Engine engine, int idx, const char *new_id)
Rename an aquifer in place.
Definition openswmm_subcatchments_impl.cpp:1167
SWMM_ENGINE_API int swmm_subcatch_get_n_perv(SWMM_Engine engine, int idx, double *n)
Get Manning's n for the pervious area.
Definition openswmm_subcatchments_impl.cpp:330
SWMM_ENGINE_API int swmm_subcatch_add(SWMM_Engine engine, const char *id)
Add a new subcatchment to the model.
Definition openswmm_subcatchments_impl.cpp:68
SWMM_ENGINE_API int swmm_aquifer_set_param(SWMM_Engine engine, int idx, int param, double value)
Set an aquifer parameter (input-file units).
Definition openswmm_subcatchments_impl.cpp:1237
SWMM_ENGINE_API int swmm_subcatch_set_snow_state(SWMM_Engine engine, int idx, int surface, double swe, double fw, double ati, double coldc)
Set the snow pack state on one snow subarea of a subcatchment.
Definition openswmm_subcatchments_impl.cpp:837
SWMM_ENGINE_API int swmm_subcatch_set_gw_state(SWMM_Engine engine, int idx, double theta, double lower_depth)
Set the groundwater state on a subcatchment.
Definition openswmm_subcatchments_impl.cpp:796
SWMM_ENGINE_API int swmm_subcatch_set_n_imperv(SWMM_Engine engine, int idx, double n)
Set Manning's n for the impervious area.
Definition openswmm_subcatchments_impl.cpp:153
SWMM_ENGINE_API int swmm_subcatch_get_ids_bulk(SWMM_Engine engine, char *buf, int stride, int count)
Get subcatchment IDs for all subcatchments in a single call (stride-packed UTF-8).
Definition openswmm_subcatchments_impl.cpp:1028
SWMM_ENGINE_API int swmm_aquifer_set_evap_pattern(SWMM_Engine engine, int idx, const char *name)
Set or clear the aquifer's upper-zone evaporation pattern name.
Definition openswmm_subcatchments_impl.cpp:1288
SWMM_ENGINE_API int swmm_subcatch_set_rain_scale_factor(SWMM_Engine engine, int idx, double factor)
Set the subcatchment's rainfall scale factor (optional token 9 of [SUBCATCHMENTS]; default 1....
Definition openswmm_subcatchments_impl.cpp:1509
SWMM_ENGINE_API int swmm_subcatch_get_outlet(SWMM_Engine engine, int idx, int *node_idx)
Get the outlet node index for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:294
SWMM_ENGINE_API int swmm_subcatch_get_aquifer(SWMM_Engine engine, int idx, int *aquifer_idx)
Get the aquifer index assigned to a subcatchment (-1 = none).
Definition openswmm_subcatchments_impl.cpp:627
SWMM_ENGINE_API int swmm_subcatch_set_aquifer(SWMM_Engine engine, int idx, int aquifer_idx)
Assign the aquifer (by index, -1 = none) used by a subcatchment.
Definition openswmm_subcatchments_impl.cpp:618
SWMM_ENGINE_API int swmm_subcatch_get_quality(SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double *conc)
Get the pollutant concentration in subcatchment runoff.
Definition openswmm_subcatchments_impl.cpp:930
SWMM_ENGINE_API int swmm_subcatch_rename(SWMM_Engine engine, int idx, const char *newId)
Rename the subcatchment at idx to newId. Returns SWMM_ERR_BADPARAM if newId is null,...
Definition openswmm_subcatchments_impl.cpp:1080
SWMM_ENGINE_API int swmm_gwf_validate_expression(SWMM_Engine engine, const char *expr, char *errbuf, int buflen, int *col_out)
Validate a [GWF] expression WITHOUT modifying engine state.
Definition openswmm_subcatchments_impl.cpp:747
SWMM_ENGINE_API int swmm_subcatch_set_outlet_subcatch(SWMM_Engine engine, int idx, int sc_idx)
Set a subcatchment's outlet to another subcatchment (cascading).
Definition openswmm_subcatchments_impl.cpp:362
SWMM_ENGINE_API int swmm_subcatch_get_n_imperv(SWMM_Engine engine, int idx, double *n)
Get Manning's n for the impervious area.
Definition openswmm_subcatchments_impl.cpp:322
SWMM_ENGINE_API int swmm_gwf_variable_name(SWMM_Engine engine, int i, char *buf, int buflen)
Name of the i-th [GWF] variable (upper-case, e.g. "HGW").
Definition openswmm_subcatchments_impl.cpp:768
SWMM_ENGINE_API int swmm_snowpack_get_removal(SWMM_Engine engine, int idx, double *dsnow, double *fout, double *fimp, double *fperv, double *fimelt, double *fsubcatch)
Read the REMOVAL parameters. Inverse of swmm_snowpack_set_removal.
Definition openswmm_subcatchments_impl.cpp:1465
SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct(SWMM_Engine engine, int idx, double pct)
Set the percentage of impervious area.
Definition openswmm_subcatchments_impl.cpp:135
SWMM_ENGINE_API int swmm_subcatch_set_rainfall(SWMM_Engine engine, int idx, double rainfall)
Override rainfall on a subcatchment for the current timestep.
Definition openswmm_subcatchments_impl.cpp:916
SWMM_ENGINE_API int swmm_subcatch_get_gw_params(SWMM_Engine engine, int idx, double *surf_elev, double *a1, double *b1, double *a2, double *b2, double *a3, double *tw, double *hstar)
Get the groundwater flow parameters (see swmm_subcatch_set_gw_params).
Definition openswmm_subcatchments_impl.cpp:674
SWMM_ENGINE_API int swmm_subcatch_set_infil_horton(SWMM_Engine engine, int idx, double f0, double fmin, double decay, double dry_time)
Set Horton infiltration parameters.
Definition openswmm_subcatchments_impl.cpp:202
SWMM_ENGINE_API int swmm_subcatch_get_gw_node(SWMM_Engine engine, int idx, int *node_idx)
Get the node index receiving the subcatchment's groundwater flow (-1 = none).
Definition openswmm_subcatchments_impl.cpp:644
SWMM_ENGINE_API int swmm_subcatch_set_gage(SWMM_Engine engine, int idx, int gage_idx)
Assign a rain gage to a subcatchment.
Definition openswmm_subcatchments_impl.cpp:189
SWMM_ENGINE_API int swmm_subcatch_get_stat_precip(SWMM_Engine engine, int idx, double *vol)
Get the total precipitation volume at a subcatchment.
Definition openswmm_subcatchments_impl.cpp:433
SWMM_ENGINE_API int swmm_snowpack_set_plowable(SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
Set the PLOWABLE surface parameters (last = plowable area fraction).
Definition openswmm_subcatchments_impl.cpp:1405
SWMM_ENGINE_API int swmm_subcatch_get_runoff(SWMM_Engine engine, int idx, double *runoff)
Get the current runoff rate from a subcatchment.
Definition openswmm_subcatchments_impl.cpp:570
SWMM_ENGINE_API const char * swmm_snowpack_id(SWMM_Engine engine, int idx)
Get the string identifier of a snowpack definition by index.
Definition openswmm_subcatchments_impl.cpp:1315
SWMM_ENGINE_API int swmm_aquifer_index(SWMM_Engine engine, const char *id)
Look up an aquifer's zero-based index by its string identifier.
Definition openswmm_subcatchments_impl.cpp:1124
SWMM_ENGINE_API int swmm_subcatch_set_snow_scale_factor(SWMM_Engine engine, int idx, double factor)
Set the subcatchment's snowfall scale factor (optional token 10 of [SUBCATCHMENTS]; default 1....
Definition openswmm_subcatchments_impl.cpp:1526
SWMM_ENGINE_API int swmm_gwf_function_name(SWMM_Engine engine, int i, char *buf, int buflen)
Name of the i-th expression function (lower-case, stable order: abs, sgn, sqrt, log,...
Definition openswmm_subcatchments_impl.cpp:785
SWMM_ENGINE_API int swmm_subcatch_get_slope(SWMM_Engine engine, int idx, double *s)
Get the average surface slope.
Definition openswmm_subcatchments_impl.cpp:311
SWMM_ENGINE_API int swmm_aquifer_add(SWMM_Engine engine, const char *id)
Add a new aquifer definition with default (zero) parameters.
Definition openswmm_subcatchments_impl.cpp:1138
SWMM_ENGINE_API int swmm_subcatch_get_ds_imperv(SWMM_Engine engine, int idx, double *ds)
Get the depression storage depth for the impervious area.
Definition openswmm_subcatchments_impl.cpp:338
SWMM_ENGINE_API int swmm_snowpack_set_impervious(SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
Set the IMPERVIOUS surface parameters (last = 100%-cover depth).
Definition openswmm_subcatchments_impl.cpp:1421
SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct(SWMM_Engine engine, int idx, double *pct)
Get the percentage of impervious area.
Definition openswmm_subcatchments_impl.cpp:278
SWMM_ENGINE_API int swmm_subcatch_set_outlet(SWMM_Engine engine, int idx, int node_idx)
Set the outlet node that receives runoff from this subcatchment.
Definition openswmm_subcatchments_impl.cpp:94
SWMM_ENGINE_API int swmm_subcatch_get_infil_bulk(SWMM_Engine engine, double *buf, int count)
Get infiltration losses for all subcatchments in a single call.
Definition openswmm_subcatchments_impl.cpp:1006
SWMM_ENGINE_API int swmm_subcatch_get_snow_depth_bulk(SWMM_Engine engine, double *buf, int count)
Get snow depths for all subcatchments in a single call.
Definition openswmm_subcatchments_impl.cpp:1017
SWMM_ENGINE_API int swmm_subcatch_set_tag(SWMM_Engine engine, int idx, const char *tag)
Set or clear the subcatchment's tag. Null/empty clears. Persists across rename.
Definition openswmm_subcatchments_impl.cpp:1104
SWMM_ENGINE_API int swmm_subcatch_set_ds_perv(SWMM_Engine engine, int idx, double ds)
Set the depression storage depth for the pervious area.
Definition openswmm_subcatchments_impl.cpp:180
SWMM_ENGINE_API int swmm_subcatch_set_zero_imperv_pct(SWMM_Engine engine, int idx, double pct)
Set the percentage of the impervious area having no depression storage.
Definition openswmm_subcatchments_impl.cpp:144
SWMM_ENGINE_API int swmm_subcatch_get_infil_horton(SWMM_Engine engine, int idx, double *f0, double *fmin, double *decay, double *dry_time)
Get Horton infiltration parameters for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:391
SWMM_ENGINE_API int swmm_subcatch_get_coverage(SWMM_Engine engine, int sc_idx, int lu_idx, double *fraction)
Get the land use coverage percent for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:485
SWMM_ENGINE_API int swmm_subcatch_get_gw_state(SWMM_Engine engine, int idx, double *theta, double *lower_depth)
Get the groundwater state on a subcatchment.
Definition openswmm_subcatchments_impl.cpp:820
SWMM_ENGINE_API int swmm_snowpack_get_removal_subcatch(SWMM_Engine engine, int idx, char *buf, int buflen)
Read the REMOVAL destination subcatchment name (empty if none). NUL-terminates, truncates to buflen.
Definition openswmm_subcatchments_impl.cpp:1490
SWMM_ENGINE_API int swmm_snowpack_set_removal_subcatch(SWMM_Engine engine, int idx, const char *name)
Set/clear the destination subcatchment for the REMOVAL fsubcatch fraction. Pre-start-only.
Definition openswmm_subcatchments_impl.cpp:1481
SWMM_ENGINE_API int swmm_subcatch_get_tag(SWMM_Engine engine, int idx, char *buf, int buflen)
Read the subcatchment's tag into buf (NUL-terminated, truncated if too small).
Definition openswmm_subcatchments_impl.cpp:1089
SWMM_ENGINE_API int swmm_subcatch_get_infil(SWMM_Engine engine, int idx, double *infil)
Get the current infiltration rate at a subcatchment.
Definition openswmm_subcatchments_impl.cpp:903
SWMM_ENGINE_API int swmm_subcatch_get_coverages(SWMM_Engine engine, int sc_idx, double *out, int n)
Get all land use coverage percents for a subcatchment in one call.
Definition openswmm_subcatchments_impl.cpp:504
SWMM_ENGINE_API int swmm_subcatch_set_gw_params(SWMM_Engine engine, int idx, double surf_elev, double a1, double b1, double a2, double b2, double a3, double tw, double hstar)
Set the groundwater flow parameters ([GROUNDWATER] token order).
Definition openswmm_subcatchments_impl.cpp:654
SWMM_ENGINE_API const char * swmm_aquifer_id(SWMM_Engine engine, int idx)
Get the string identifier of an aquifer definition by index.
Definition openswmm_subcatchments_impl.cpp:1131
SWMM_ENGINE_API int swmm_snowpack_rename(SWMM_Engine engine, int idx, const char *new_id)
Rename a snow pack in place.
Definition openswmm_subcatchments_impl.cpp:1343
SWMM_ENGINE_API int swmm_subcatch_get_infil_model(SWMM_Engine engine, int idx, int *model)
Get the infiltration model type for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:383
SWMM_ENGINE_API int swmm_subcatch_get_infil_green_ampt(SWMM_Engine engine, int idx, double *suction, double *conductivity, double *deficit)
Get Green–Ampt infiltration parameters for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:405
SWMM_ENGINE_API int swmm_gwf_variable_count(SWMM_Engine engine)
Number of variables a [GWF] expression may reference.
Definition openswmm_subcatchments_impl.cpp:763
SWMM_ENGINE_API int swmm_subcatch_set_gw_node(SWMM_Engine engine, int idx, int node_idx)
Set the node (by index, -1 = none) receiving the subcatchment's groundwater flow.
Definition openswmm_subcatchments_impl.cpp:635
SWMM_ENGINE_API int swmm_subcatch_get_evap_bulk(SWMM_Engine engine, double *buf, int count)
Get evaporation losses for all subcatchments in a single call.
Definition openswmm_subcatchments_impl.cpp:995
SWMM_ENGINE_API int swmm_subcatch_get_stat_runoff_vol(SWMM_Engine engine, int idx, double *vol)
Get the total runoff volume from a subcatchment.
Definition openswmm_subcatchments_impl.cpp:442
SWMM_ENGINE_API int swmm_subcatch_get_stat_max_runoff(SWMM_Engine engine, int idx, double *rate)
Get the maximum runoff rate from a subcatchment.
Definition openswmm_subcatchments_impl.cpp:451
SWMM_ENGINE_API int swmm_subcatch_get_snow_state(SWMM_Engine engine, int idx, int surface, double *swe, double *fw, double *ati, double *coldc)
Get the snow pack state on one snow subarea of a subcatchment.
Definition openswmm_subcatchments_impl.cpp:870
SWMM_ENGINE_API int swmm_subcatch_get_rain_scale_factor(SWMM_Engine engine, int idx, double *factor)
Get the subcatchment's rainfall scale factor.
Definition openswmm_subcatchments_impl.cpp:1518
SWMM_ENGINE_API int swmm_subcatch_get_snow_scale_factor(SWMM_Engine engine, int idx, double *factor)
Get the subcatchment's snowfall scale factor.
Definition openswmm_subcatchments_impl.cpp:1535
SWMM_ENGINE_API int swmm_snowpack_count(SWMM_Engine engine)
Get the total number of snowpack definitions in the model.
Definition openswmm_subcatchments_impl.cpp:1303
SWMM_ENGINE_API int swmm_subcatch_set_infil_model(SWMM_Engine engine, int idx, int model)
Set ONLY the infiltration model code for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:255
SWMM_ENGINE_API int swmm_subcatch_set_initial_loading(SWMM_Engine engine, int sc_idx, int pollut_idx, double buildup)
Set the initial pollutant buildup on a subcatchment.
Definition openswmm_subcatchments_impl.cpp:525
SWMM_ENGINE_API int swmm_subcatch_set_gwf_expression(SWMM_Engine engine, int index, int type, const char *expr)
Set or clear a subcatchment's custom groundwater flow expression.
Definition openswmm_subcatchments_impl.cpp:733
SWMM_ENGINE_API const char * swmm_subcatch_id(SWMM_Engine engine, int idx)
Get the string identifier of a subcatchment by index.
Definition openswmm_subcatchments_impl.cpp:57
SWMM_ENGINE_API int swmm_subcatch_set_area(SWMM_Engine engine, int idx, double area)
Set the subcatchment area.
Definition openswmm_subcatchments_impl.cpp:103
SWMM_ENGINE_API int swmm_aquifer_count(SWMM_Engine engine)
Get the total number of aquifer definitions in the model.
Definition openswmm_subcatchments_impl.cpp:1119
SWMM_ENGINE_API int swmm_snowpack_add(SWMM_Engine engine, const char *id)
Add a new snowpack definition with default (zero) parameters.
Definition openswmm_subcatchments_impl.cpp:1322
SWMM_ENGINE_API int swmm_subcatch_get_ponded_quality(SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double *mass)
Get ponded quality mass for a subcatchment-pollutant pair.
Definition openswmm_subcatchments_impl.cpp:1052
SWMM_ENGINE_API int swmm_subcatch_get_quality_bulk(SWMM_Engine engine, int pollutant_idx, double *buf, int count)
Get pollutant concentrations for all subcatchments for one pollutant.
Definition openswmm_subcatchments_impl.cpp:958
SWMM_ENGINE_API int swmm_subcatch_get_groundwater(SWMM_Engine engine, int idx, double *gw_flow)
Get the current groundwater flow from a subcatchment.
Definition openswmm_subcatchments_impl.cpp:579
SWMM_ENGINE_API int swmm_aquifer_get_param(SWMM_Engine engine, int idx, int param, double *value)
Get an aquifer parameter (input-file units).
Definition openswmm_subcatchments_impl.cpp:1226
SWMM_ENGINE_API int swmm_subcatch_get_area(SWMM_Engine engine, int idx, double *area)
Get the subcatchment area.
Definition openswmm_subcatchments_impl.cpp:269
SWMM_ENGINE_API int swmm_gwf_function_count(SWMM_Engine engine)
Number of built-in functions a [GWF] expression may call.
Definition openswmm_subcatchments_impl.cpp:780
SWMM_GwfType
Which of a subcatchment's two custom groundwater flow expressions.
Definition openswmm_subcatchments.h:1169
@ SWMM_GWF_LATERAL
Definition openswmm_subcatchments.h:1170
@ SWMM_GWF_DEEP
Definition openswmm_subcatchments.h:1171
SWMM_ENGINE_API int swmm_snowpack_set_pervious(SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
Set the PERVIOUS surface parameters (last = 100%-cover depth).
Definition openswmm_subcatchments_impl.cpp:1437
SWMM_ENGINE_API int swmm_subcatch_get_evap(SWMM_Engine engine, int idx, double *evap)
Get the current evaporation rate at a subcatchment.
Definition openswmm_subcatchments_impl.cpp:894
SWMM_ENGINE_API int swmm_subcatch_set_infil_green_ampt(SWMM_Engine engine, int idx, double suction, double conductivity, double initial_deficit)
Set Green-Ampt infiltration parameters.
Definition openswmm_subcatchments_impl.cpp:218
SWMM_ENGINE_API int swmm_subcatch_set_width(SWMM_Engine engine, int idx, double width)
Set the characteristic overland flow width.
Definition openswmm_subcatchments_impl.cpp:112
SWMM_ENGINE_API int swmm_subcatch_get_ds_perv(SWMM_Engine engine, int idx, double *ds)
Get the depression storage depth for the pervious area.
Definition openswmm_subcatchments_impl.cpp:346
SWMM_ENGINE_API int swmm_subcatch_get_runoff_bulk(SWMM_Engine engine, double *buf, int count)
Get runoff rates for all subcatchments in a single call.
Definition openswmm_subcatchments_impl.cpp:947
SWMM_ENGINE_API int swmm_subcatch_set_ds_imperv(SWMM_Engine engine, int idx, double ds)
Set the depression storage depth for the impervious area.
Definition openswmm_subcatchments_impl.cpp:171
SWMM_ENGINE_API int swmm_subcatch_get_infil_curve_number(SWMM_Engine engine, int idx, double *cn, double *drying_time)
Get the Curve Number infiltration parameters for a subcatchment.
Definition openswmm_subcatchments_impl.cpp:418
SWMM_ENGINE_API int swmm_subcatch_get_rainfall_bulk(SWMM_Engine engine, double *buf, int count)
Get rainfall rates for all subcatchments in a single call.
Definition openswmm_subcatchments_impl.cpp:984
SWMM_AquiferParam
Aquifer parameter codes for swmm_aquifer_get_param / _set_param.
Definition openswmm_subcatchments.h:887
@ SWMM_AQUIFER_WATER_TABLE_ELEV
Definition openswmm_subcatchments.h:898
@ SWMM_AQUIFER_LOWER_EVAP_DEPTH
Definition openswmm_subcatchments.h:895
@ SWMM_AQUIFER_WILTING_POINT
Definition openswmm_subcatchments.h:889
@ SWMM_AQUIFER_CONDUCTIVITY
Definition openswmm_subcatchments.h:891
@ SWMM_AQUIFER_UPPER_EVAP_FRAC
Definition openswmm_subcatchments.h:894
@ SWMM_AQUIFER_LOWER_LOSS_COEFF
Definition openswmm_subcatchments.h:896
@ SWMM_AQUIFER_BOTTOM_ELEV
Definition openswmm_subcatchments.h:897
@ SWMM_AQUIFER_UPPER_MOISTURE
Definition openswmm_subcatchments.h:899
@ SWMM_AQUIFER_TENSION_SLOPE
Definition openswmm_subcatchments.h:893
@ SWMM_AQUIFER_POROSITY
Definition openswmm_subcatchments.h:888
@ SWMM_AQUIFER_CONDUCT_SLOPE
Definition openswmm_subcatchments.h:892
@ SWMM_AQUIFER_FIELD_CAPACITY
Definition openswmm_subcatchments.h:890
SWMM_ENGINE_API int swmm_snowpack_set_removal(SWMM_Engine engine, int idx, double dsnow, double fout, double fimp, double fperv, double fimelt, double fsubcatch)
Set the REMOVAL parameters (snow redistribution at depth dsnow).
Definition openswmm_subcatchments_impl.cpp:1453
SWMM_ENGINE_API int swmm_subcatch_get_outlet_subcatch(SWMM_Engine engine, int idx, int *sc_idx)
Get the downstream subcatchment index (for cascading outlets).
Definition openswmm_subcatchments_impl.cpp:371
SWMM_ENGINE_API int swmm_snowpack_get_impervious(SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
Read the IMPERVIOUS surface parameters. Inverse of swmm_snowpack_set_impervious.
Definition openswmm_subcatchments_impl.cpp:1429
SWMM_ENGINE_API int swmm_subcatch_get_zero_imperv_pct(SWMM_Engine engine, int idx, double *pct)
Get the percentage of the impervious area having no depression storage.
Definition openswmm_subcatchments_impl.cpp:286
SWMM_ENGINE_API int swmm_snowpack_get_pervious(SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
Read the PERVIOUS surface parameters. Inverse of swmm_snowpack_set_pervious.
Definition openswmm_subcatchments_impl.cpp:1445
SWMM_ENGINE_API int swmm_subcatch_set_n_perv(SWMM_Engine engine, int idx, double n)
Set Manning's n for the pervious area.
Definition openswmm_subcatchments_impl.cpp:162
SWMM_ENGINE_API int swmm_subcatch_get_width(SWMM_Engine engine, int idx, double *w)
Get the characteristic overland flow width.
Definition openswmm_subcatchments_impl.cpp:302
SWMM_ENGINE_API int swmm_subcatch_set_infil_curve_number(SWMM_Engine engine, int idx, double cn, double drying_time)
Set Curve Number infiltration parameters.
Definition openswmm_subcatchments_impl.cpp:233
SWMM_ENGINE_API int swmm_subcatch_count(SWMM_Engine engine)
Get the total number of subcatchments in the model.
Definition openswmm_subcatchments_impl.cpp:47
SWMM_ENGINE_API int swmm_gwf_variable_description(SWMM_Engine engine, int i, char *buf, int buflen)
Short English description of the i-th [GWF] variable, with a units placeholder, e....
Definition openswmm_subcatchments_impl.cpp:774
SWMM_ENGINE_API int swmm_subcatch_get_rainfall(SWMM_Engine engine, int idx, double *rainfall)
Get the current rainfall intensity at a subcatchment.
Definition openswmm_subcatchments_impl.cpp:588
SWMM_ENGINE_API int swmm_subcatch_get_gwf_expression(SWMM_Engine engine, int index, int type, char *buf, int buflen)
Read a subcatchment's custom groundwater flow expression.
Definition openswmm_subcatchments_impl.cpp:721
SWMM_ENGINE_API int swmm_subcatch_get_gage(SWMM_Engine engine, int idx, int *gage_idx)
Get the rain gage index assigned to a subcatchment.
Definition openswmm_subcatchments_impl.cpp:354
SWMM_ENGINE_API int swmm_subcatch_set_slope(SWMM_Engine engine, int idx, double slope)
Set the average surface slope.
Definition openswmm_subcatchments_impl.cpp:122
SWMM_ENGINE_API int swmm_snowpack_index(SWMM_Engine engine, const char *id)
Look up a snowpack's zero-based index by its string identifier.
Definition openswmm_subcatchments_impl.cpp:1308
SWMM_ENGINE_API int swmm_subcatch_get_snow_depth(SWMM_Engine engine, int idx, double *depth)
Get the current snow depth on a subcatchment.
Definition openswmm_subcatchments_impl.cpp:597
SWMM_ENGINE_API int swmm_aquifer_get_evap_pattern(SWMM_Engine engine, int idx, char *buf, int buflen)
Read the aquifer's upper-zone evaporation pattern name.
Definition openswmm_subcatchments_impl.cpp:1276
SWMM_ENGINE_API int swmm_subcatch_index(SWMM_Engine engine, const char *id)
Look up a subcatchment's zero-based index by its string identifier.
Definition openswmm_subcatchments_impl.cpp:52
SWMM_ENGINE_API int swmm_subcatch_get_initial_loading(SWMM_Engine engine, int sc_idx, int pollut_idx, double *buildup)
Get the initial pollutant buildup on a subcatchment.
Definition openswmm_subcatchments_impl.cpp:547
SWMM_ENGINE_API int swmm_subcatch_set_ponded_quality(SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double mass)
Set ponded quality mass for a subcatchment-pollutant pair.
Definition openswmm_subcatchments_impl.cpp:1066