OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_gw_transport.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 */
17
45
46#ifndef OPENSWMM_GW_TRANSPORT_H
47#define OPENSWMM_GW_TRANSPORT_H
48
49#include "openswmm_engine.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55/* ---- Scopes and zones ---------------------------------------------------- */
56
57#define SWMM_GW_SCOPE_GLOBAL 0
58#define SWMM_GW_SCOPE_TAG 1
59#define SWMM_GW_SCOPE_CELL 2
60
61#define SWMM_GW_ZONE_SAT 0
62#define SWMM_GW_ZONE_UNSAT 1
63#define SWMM_GW_ZONE_LAYER 2
64
65/* =========================================================================
66 * [GW_TRANSPORT_OPTIONS]
67 * =========================================================================
68 * Key/value like swmm_options_get_ext: TRANSPORT_POLLUTANTS, TRANSPORT_MSX,
69 * TRANSPORT_AGE, TRANSPORT_TEMPERATURE, DISPERSION, CONDUCTION,
70 * SURFACE_THERMAL_BC, DEEP_THERMAL_BC, THERMAL_MIXING, C_DIFF. Values use the
71 * section's own spelling; SURFACE_THERMAL_BC / DEEP_THERMAL_BC read back with
72 * their argument appended ("FIXED 12.5", "GEOTHERMAL_FLUX 0.065 DEPTH 20").
73 */
74
77 const char* key, char* buf, int buflen);
78
81 const char* key, const char* value);
82
85
86/* =========================================================================
87 * [GW_TRANSPORT_PARAMS]
88 * ========================================================================= */
89
90typedef struct SWMM_GwParams {
91 int scope;
92 int cell;
93 double rho_s;
94 double c_s;
95 double lambda_s;
96 double a_s;
97 double alpha_L;
98 double alpha_T;
99 double D_m;
100 double D_v;
101 double geo_flux;
103
107 SWMM_GwParams* row, char* tag_buf, int tag_len);
110 const SWMM_GwParams* row, const char* tag);
112
113/* =========================================================================
114 * [GW_SORPTION]
115 * ========================================================================= */
116
120 int* scope, char* tag_buf, int tag_len, int* cell,
121 char* species_buf, int species_len, double* kd, double* decay);
123 const char* tag, int cell, const char* species, double kd, double decay);
125
126/* =========================================================================
127 * [GW_INITIAL_QUALITY]
128 * ========================================================================= */
129
133 int* scope, char* tag_buf, int tag_len, int* cell,
134 int* zone, int* layer, char* species_buf, int species_len, double* value);
136 const char* tag, int cell, int zone, int layer,
137 const char* species, double value);
141 char* buf, int buflen);
143 const char* path);
144
145/* =========================================================================
146 * [GW_BOUNDARY_QUALITY]
147 * =========================================================================
148 * `kind` is "CONC", "TS", "MASSFLUX" or "HEATFLUX". A row carries either a
149 * constant value or a series name (never both).
150 */
151
154 int* cell, int* edge, char* species_buf, int species_len,
155 char* kind_buf, int kind_len, double* value,
156 char* ts_buf, int ts_len);
159 int cell, int edge, const char* species, const char* kind,
160 double value, const char* ts_name);
162
163/* =========================================================================
164 * [GW_SOURCES]
165 * ========================================================================= */
166
169 char* name_buf, int name_len, int* scope, char* tag_buf, int tag_len,
170 int* cell, double* flow, char* flow_ts_buf, int flow_ts_len);
172SWMM_ENGINE_API int swmm_gw_source_set(SWMM_Engine engine, const char* name,
173 int scope, const char* tag, int cell, double flow, const char* flow_ts);
175
179 int term_idx, char* species_buf, int species_len,
180 char* kind_buf, int kind_len, double* value, char* ts_buf, int ts_len);
183 const char* species, const char* kind, double value, const char* ts_name);
185 int src_idx, int term_idx);
186
187#ifdef __cplusplus
188} /* extern "C" */
189#endif
190
191#endif /* OPENSWMM_GW_TRANSPORT_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_gw_transport_option_set(SWMM_Engine engine, const char *key, const char *value)
Set one option (BUILDING/OPENED).
Definition ApiGwTransport.cpp:140
SWMM_ENGINE_API int swmm_gw_sorption_get(SWMM_Engine engine, int idx, int *scope, char *tag_buf, int tag_len, int *cell, char *species_buf, int species_len, double *kd, double *decay)
Definition ApiGwTransport.cpp:247
SWMM_ENGINE_API int swmm_gw_transport_option_get(SWMM_Engine engine, const char *key, char *buf, int buflen)
Read one option into buf. SWMM_ERR_BADPARAM on an unknown key.
Definition ApiGwTransport.cpp:102
SWMM_ENGINE_API int swmm_gw_params_remove(SWMM_Engine engine, int idx)
Definition ApiGwTransport.cpp:229
SWMM_ENGINE_API int swmm_gw_params_count(SWMM_Engine engine)
Definition ApiGwTransport.cpp:177
SWMM_ENGINE_API int swmm_gw_source_species_remove(SWMM_Engine engine, int src_idx, int term_idx)
Definition ApiGwTransport.cpp:572
SWMM_ENGINE_API int swmm_gw_boundary_quality_get(SWMM_Engine engine, int idx, int *cell, int *edge, char *species_buf, int species_len, char *kind_buf, int kind_len, double *value, char *ts_buf, int ts_len)
Definition ApiGwTransport.cpp:394
SWMM_ENGINE_API int swmm_gw_source_set(SWMM_Engine engine, const char *name, int scope, const char *tag, int cell, double flow, const char *flow_ts)
Append or replace the source named name.
Definition ApiGwTransport.cpp:482
SWMM_ENGINE_API int swmm_gw_params_set(SWMM_Engine engine, const SWMM_GwParams *row, const char *tag)
Append or replace the row for (scope, tag/cell).
Definition ApiGwTransport.cpp:204
SWMM_ENGINE_API int swmm_gw_init_quality_get(SWMM_Engine engine, int idx, int *scope, char *tag_buf, int tag_len, int *cell, int *zone, int *layer, char *species_buf, int species_len, double *value)
Definition ApiGwTransport.cpp:307
SWMM_ENGINE_API int swmm_gw_source_get(SWMM_Engine engine, int idx, char *name_buf, int name_len, int *scope, char *tag_buf, int tag_len, int *cell, double *flow, char *flow_ts_buf, int flow_ts_len)
Definition ApiGwTransport.cpp:467
SWMM_ENGINE_API int swmm_gw_boundary_quality_count(SWMM_Engine engine)
Definition ApiGwTransport.cpp:387
SWMM_ENGINE_API int swmm_gw_source_species_count(SWMM_Engine engine, int src_idx)
Species terms carried by source src_idx.
Definition ApiGwTransport.cpp:521
SWMM_ENGINE_API int swmm_gw_source_species_set(SWMM_Engine engine, int src_idx, const char *species, const char *kind, double value, const char *ts_name)
Definition ApiGwTransport.cpp:546
SWMM_ENGINE_API int swmm_gw_sorption_count(SWMM_Engine engine)
Definition ApiGwTransport.cpp:241
SWMM_ENGINE_API int swmm_gw_init_quality_count(SWMM_Engine engine)
Definition ApiGwTransport.cpp:300
SWMM_ENGINE_API int swmm_gw_params_get(SWMM_Engine engine, int idx, SWMM_GwParams *row, char *tag_buf, int tag_len)
Read row idx; tag_buf receives the TAG (empty otherwise).
Definition ApiGwTransport.cpp:183
SWMM_ENGINE_API int swmm_gw_init_quality_file_get(SWMM_Engine engine, char *buf, int buflen)
The FILE <csv> sidecar reference ("" when none).
Definition ApiGwTransport.cpp:366
SWMM_ENGINE_API int swmm_gw_source_remove(SWMM_Engine engine, int idx)
Definition ApiGwTransport.cpp:513
SWMM_ENGINE_API int swmm_gw_sorption_remove(SWMM_Engine engine, int idx)
Definition ApiGwTransport.cpp:288
SWMM_ENGINE_API int swmm_gw_transport_authored(SWMM_Engine engine)
1 when any [GW_*] row was authored, else 0.
Definition ApiGwTransport.cpp:167
SWMM_ENGINE_API int swmm_gw_init_quality_remove(SWMM_Engine engine, int idx)
Definition ApiGwTransport.cpp:357
SWMM_ENGINE_API int swmm_gw_source_count(SWMM_Engine engine)
Definition ApiGwTransport.cpp:461
SWMM_ENGINE_API int swmm_gw_boundary_quality_remove(SWMM_Engine engine, int idx)
Definition ApiGwTransport.cpp:448
SWMM_ENGINE_API int swmm_gw_init_quality_file_set(SWMM_Engine engine, const char *path)
Definition ApiGwTransport.cpp:374
SWMM_ENGINE_API int swmm_gw_boundary_quality_set(SWMM_Engine engine, int cell, int edge, const char *species, const char *kind, double value, const char *ts_name)
Definition ApiGwTransport.cpp:410
SWMM_ENGINE_API int swmm_gw_init_quality_set(SWMM_Engine engine, int scope, const char *tag, int cell, int zone, int layer, const char *species, double value)
Definition ApiGwTransport.cpp:324
SWMM_ENGINE_API int swmm_gw_source_species_get(SWMM_Engine engine, int src_idx, int term_idx, char *species_buf, int species_len, char *kind_buf, int kind_len, double *value, char *ts_buf, int ts_len)
Definition ApiGwTransport.cpp:529
SWMM_ENGINE_API int swmm_gw_sorption_set(SWMM_Engine engine, int scope, const char *tag, int cell, const char *species, double kd, double decay)
Definition ApiGwTransport.cpp:262
Definition openswmm_gw_transport.h:90
double alpha_T
Definition openswmm_gw_transport.h:98
double a_s
Definition openswmm_gw_transport.h:96
double rho_s
Definition openswmm_gw_transport.h:93
int scope
Definition openswmm_gw_transport.h:91
double lambda_s
Definition openswmm_gw_transport.h:95
double D_v
Definition openswmm_gw_transport.h:100
double geo_flux
Definition openswmm_gw_transport.h:101
double alpha_L
Definition openswmm_gw_transport.h:97
double c_s
Definition openswmm_gw_transport.h:94
int cell
Definition openswmm_gw_transport.h:92
double D_m
Definition openswmm_gw_transport.h:99