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
43
44#ifndef OPENSWMM_GW_TRANSPORT_H
45#define OPENSWMM_GW_TRANSPORT_H
46
47#include "openswmm_engine.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/* ---- Scopes and zones ---------------------------------------------------- */
54
55#define SWMM_GW_SCOPE_GLOBAL 0
56#define SWMM_GW_SCOPE_TAG 1
57#define SWMM_GW_SCOPE_CELL 2
58
59#define SWMM_GW_ZONE_SAT 0
60#define SWMM_GW_ZONE_UNSAT 1
61#define SWMM_GW_ZONE_LAYER 2
62
63/* =========================================================================
64 * [GW_TRANSPORT_OPTIONS]
65 * =========================================================================
66 * Key/value like swmm_options_get_ext: TRANSPORT_POLLUTANTS, TRANSPORT_MSX,
67 * TRANSPORT_AGE, TRANSPORT_TEMPERATURE, DISPERSION, CONDUCTION,
68 * SURFACE_THERMAL_BC, DEEP_THERMAL_BC, THERMAL_MIXING, C_DIFF. Values use the
69 * section's own spelling; SURFACE_THERMAL_BC / DEEP_THERMAL_BC read back with
70 * their argument appended ("FIXED 12.5", "GEOTHERMAL_FLUX 0.065 DEPTH 20").
71 * Additive porous-model keys: THERMAL_MODEL WATER_ONLY|POROUS_EQUILIBRIUM,
72 * THERMAL_LAYERS (fixed depth cells, 1..128), LATERAL_CONDUCTION (default NO),
73 * THERMAL_MAX_STEP (s), WATER_THERMAL_CONDUCTIVITY and AIR_THERMAL_CONDUCTIVITY
74 * (W/m/K), SURFACE_THERMAL_RESISTANCE (m2 K/W), SOIL_ET_HEAT
75 * LATENT_SURFACE|SENSIBLE_ONLY. WATER_ONLY never activates dormant conduction.
76 */
77
90SWMM_ENGINE_API int swmm_gw_transport_option_get(SWMM_Engine engine, const char* key, char* buf,
91 int buflen);
92
106 const char* value);
107
115
116/* =========================================================================
117 * [GW_TRANSPORT_PARAMS]
118 * ========================================================================= */
119
120typedef struct SWMM_GwParams {
121 int scope;
122 int cell;
123 double rho_s;
124 double c_s;
125 double lambda_s;
126 double a_s;
127 double alpha_L;
128 double alpha_T;
129 double D_m;
130 double D_v;
131 double geo_flux;
133
155 char* tag_buf, int tag_len);
171 const char* tag);
182
183/* =========================================================================
184 * [GW_SORPTION]
185 * ========================================================================= */
186
212SWMM_ENGINE_API int swmm_gw_sorption_get(SWMM_Engine engine, int idx, int* scope, char* tag_buf,
213 int tag_len, int* cell, char* species_buf, int species_len,
214 double* kd, double* decay);
232SWMM_ENGINE_API int swmm_gw_sorption_set(SWMM_Engine engine, int scope, const char* tag, int cell,
233 const char* species, double kd, double decay);
244
245/* =========================================================================
246 * [GW_INITIAL_QUALITY]
247 * ========================================================================= */
248
276SWMM_ENGINE_API int swmm_gw_init_quality_get(SWMM_Engine engine, int idx, int* scope, char* tag_buf,
277 int tag_len, int* cell, int* zone, int* layer,
278 char* species_buf, int species_len, double* value);
299SWMM_ENGINE_API int swmm_gw_init_quality_set(SWMM_Engine engine, int scope, const char* tag,
300 int cell, int zone, int layer, const char* species,
301 double value);
321SWMM_ENGINE_API int swmm_gw_init_quality_file_get(SWMM_Engine engine, char* buf, int buflen);
333SWMM_ENGINE_API int swmm_gw_init_quality_file_set(SWMM_Engine engine, const char* path);
334
335/* =========================================================================
336 * [GW_BOUNDARY_QUALITY]
337 * =========================================================================
338 * `kind` is "CONC", "TS", "MASSFLUX" or "HEATFLUX". A row carries either a
339 * constant value or a series name (never both).
340 */
341
368SWMM_ENGINE_API int swmm_gw_boundary_quality_get(SWMM_Engine engine, int idx, int* cell, int* edge,
369 char* species_buf, int species_len, char* kind_buf,
370 int kind_len, double* value, char* ts_buf,
371 int ts_len);
390SWMM_ENGINE_API int swmm_gw_boundary_quality_set(SWMM_Engine engine, int cell, int edge,
391 const char* species, const char* kind,
392 double value, const char* ts_name);
403
404/* =========================================================================
405 * [GW_SOURCES]
406 * ========================================================================= */
407
434SWMM_ENGINE_API int swmm_gw_source_get(SWMM_Engine engine, int idx, char* name_buf, int name_len,
435 int* scope, char* tag_buf, int tag_len, int* cell,
436 double* flow, char* flow_ts_buf, int flow_ts_len);
455SWMM_ENGINE_API int swmm_gw_source_set(SWMM_Engine engine, const char* name, int scope,
456 const char* tag, int cell, double flow, const char* flow_ts);
467SWMM_ENGINE_API int swmm_gw_source_scale_get(SWMM_Engine engine, int idx, double* value);
479SWMM_ENGINE_API int swmm_gw_source_scale_set(SWMM_Engine engine, int idx, double value);
490
516SWMM_ENGINE_API int swmm_gw_source_species_get(SWMM_Engine engine, int src_idx, int term_idx,
517 char* species_buf, int species_len, char* kind_buf,
518 int kind_len, double* value, char* ts_buf,
519 int ts_len);
538SWMM_ENGINE_API int swmm_gw_source_species_set(SWMM_Engine engine, int src_idx, const char* species,
539 const char* kind, double value, const char* ts_name);
549SWMM_ENGINE_API int swmm_gw_source_species_remove(SWMM_Engine engine, int src_idx, int term_idx);
550
551#ifdef __cplusplus
552} /* extern "C" */
553#endif
554
555#endif /* OPENSWMM_GW_TRANSPORT_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:62
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:55
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)
Parse and atomically assign one groundwater transport option.
Definition ApiGwTransport.cpp:202
SWMM_ENGINE_API int swmm_gw_source_scale_set(SWMM_Engine engine, int idx, double value)
Set the multiplier for a named source's flow and MASS terms.
Definition ApiGwTransport.cpp:638
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)
Read an authored scope/species sorption record.
Definition ApiGwTransport.cpp:329
SWMM_ENGINE_API int swmm_gw_transport_option_get(SWMM_Engine engine, const char *key, char *buf, int buflen)
Serialize one groundwater transport option using its section spelling.
Definition ApiGwTransport.cpp:137
SWMM_ENGINE_API int swmm_gw_params_remove(SWMM_Engine engine, int idx)
Remove one authored groundwater physical-parameter row.
Definition ApiGwTransport.cpp:309
SWMM_ENGINE_API int swmm_gw_params_count(SWMM_Engine engine)
Count authored groundwater physical-parameter rows.
Definition ApiGwTransport.cpp:245
SWMM_ENGINE_API int swmm_gw_source_scale_get(SWMM_Engine engine, int idx, double *value)
Read the multiplier for a named source's flow and MASS terms.
Definition ApiGwTransport.cpp:629
SWMM_ENGINE_API int swmm_gw_source_species_remove(SWMM_Engine engine, int src_idx, int term_idx)
Remove one species term from a named source.
Definition ApiGwTransport.cpp:716
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)
Read an authored groundwater edge-quality record.
Definition ApiGwTransport.cpp:491
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)
Upsert a named groundwater water source and its scope.
Definition ApiGwTransport.cpp:592
SWMM_ENGINE_API int swmm_gw_params_set(SWMM_Engine engine, const SWMM_GwParams *row, const char *tag)
Upsert a raw porous-media parameter row keyed by scope/tag/cell.
Definition ApiGwTransport.cpp:275
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)
Read an authored groundwater initial-quality record.
Definition ApiGwTransport.cpp:397
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)
Read an authored named groundwater source and its scope.
Definition ApiGwTransport.cpp:573
SWMM_ENGINE_API int swmm_gw_boundary_quality_count(SWMM_Engine engine)
Count authored groundwater exterior-quality rows.
Definition ApiGwTransport.cpp:484
SWMM_ENGINE_API int swmm_gw_source_species_count(SWMM_Engine engine, int src_idx)
Count species terms carried by one named groundwater source.
Definition ApiGwTransport.cpp:658
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)
Upsert a named source's species term by species name.
Definition ApiGwTransport.cpp:687
SWMM_ENGINE_API int swmm_gw_sorption_count(SWMM_Engine engine)
Count authored groundwater species-sorption rows.
Definition ApiGwTransport.cpp:322
SWMM_ENGINE_API int swmm_gw_init_quality_count(SWMM_Engine engine)
Count authored groundwater initial-quality rows.
Definition ApiGwTransport.cpp:390
SWMM_ENGINE_API int swmm_gw_params_get(SWMM_Engine engine, int idx, SWMM_GwParams *row, char *tag_buf, int tag_len)
Copy an authored porous-media parameter row and its optional tag.
Definition ApiGwTransport.cpp:252
SWMM_ENGINE_API int swmm_gw_init_quality_file_get(SWMM_Engine engine, char *buf, int buflen)
Read the initial-quality CSV sidecar reference.
Definition ApiGwTransport.cpp:463
SWMM_ENGINE_API int swmm_gw_source_remove(SWMM_Engine engine, int idx)
Remove one authored groundwater named-source row.
Definition ApiGwTransport.cpp:649
SWMM_ENGINE_API int swmm_gw_sorption_remove(SWMM_Engine engine, int idx)
Remove one authored groundwater species-sorption row.
Definition ApiGwTransport.cpp:377
SWMM_ENGINE_API int swmm_gw_transport_authored(SWMM_Engine engine)
Test whether groundwater transport has any authored configuration.
Definition ApiGwTransport.cpp:234
SWMM_ENGINE_API int swmm_gw_init_quality_remove(SWMM_Engine engine, int idx)
Remove one authored groundwater initial-quality row.
Definition ApiGwTransport.cpp:454
SWMM_ENGINE_API int swmm_gw_source_count(SWMM_Engine engine)
Count authored groundwater named-source rows.
Definition ApiGwTransport.cpp:566
SWMM_ENGINE_API int swmm_gw_boundary_quality_remove(SWMM_Engine engine, int idx)
Remove one authored groundwater exterior-quality row.
Definition ApiGwTransport.cpp:553
SWMM_ENGINE_API int swmm_gw_init_quality_file_set(SWMM_Engine engine, const char *path)
Assign the initial-quality CSV sidecar reference.
Definition ApiGwTransport.cpp:471
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)
Upsert groundwater edge quality for a species and concentration/flux category.
Definition ApiGwTransport.cpp:511
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)
Upsert initial quality keyed by scope, zone/layer and species.
Definition ApiGwTransport.cpp:419
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)
Read a named groundwater source species term.
Definition ApiGwTransport.cpp:668
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)
Upsert one scope/species partition coefficient and decay override.
Definition ApiGwTransport.cpp:349
Definition openswmm_gw_transport.h:120
double alpha_T
Definition openswmm_gw_transport.h:128
double a_s
Definition openswmm_gw_transport.h:126
double rho_s
Definition openswmm_gw_transport.h:123
int scope
Definition openswmm_gw_transport.h:121
double lambda_s
Definition openswmm_gw_transport.h:125
double D_v
Definition openswmm_gw_transport.h:130
double geo_flux
Definition openswmm_gw_transport.h:131
double alpha_L
Definition openswmm_gw_transport.h:127
double c_s
Definition openswmm_gw_transport.h:124
int cell
Definition openswmm_gw_transport.h:122
double D_m
Definition openswmm_gw_transport.h:129