OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_gw2d.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
51
52#ifndef OPENSWMM_GW2D_H
53#define OPENSWMM_GW2D_H
54
55#include "openswmm_engine.h"
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/* ---- Scopes (same encoding as the [GW_*] transport API) ------------------ */
62
63#define SWMM_GW2D_SCOPE_GLOBAL 0
64#define SWMM_GW2D_SCOPE_TAG 1
65#define SWMM_GW2D_SCOPE_CELL 2
66
67/* ---- Soil-characteristic laws ------------------------------------------- */
68
69#define SWMM_GW2D_SOIL_RUSSO 0
70#define SWMM_GW2D_SOIL_GARDNER 1
71#define SWMM_GW2D_SOIL_BROOKS_COREY 2
72#define SWMM_GW2D_SOIL_VAN_GENUCHTEN 3
73
74/* ---- Unsaturated-zone closures ------------------------------------------ */
75
76#define SWMM_GW2D_CLOSURE_AUTO (-1)
77#define SWMM_GW2D_CLOSURE_CLOSED_FORM 0
78#define SWMM_GW2D_CLOSURE_ENSLAVED 1
79#define SWMM_GW2D_CLOSURE_SIGMA 2
80
81/* ---- Per-cell state selectors ------------------------------------------- */
82
83#define SWMM_GW2D_VAR_HG 0
84#define SWMM_GW2D_VAR_HU 1
85#define SWMM_GW2D_VAR_TABLE_EL 2
86#define SWMM_GW2D_VAR_Q0 3
87#define SWMM_GW2D_VAR_QLAT 4
88#define SWMM_GW2D_VAR_QNODE 5
89#define SWMM_GW2D_VAR_QDEEP 6
90#define SWMM_GW2D_VAR_QET 7
91#define SWMM_GW2D_VAR_DUNNE 8
92#define SWMM_GW2D_VAR_QPLUS 9
93#define SWMM_GW2D_VAR_DT_CELL 10
94#define SWMM_GW2D_VAR_TIER 11
95#define SWMM_GW2D_VAR_CLOSURE 12
96
97/* ---- Ledger selectors (m3, cumulative) ---------------------------------- */
98
99#define SWMM_GW2D_LED_RECHARGE 0
100#define SWMM_GW2D_LED_LATERAL 1
101#define SWMM_GW2D_LED_DEEP 2
102#define SWMM_GW2D_LED_NODE 3
103#define SWMM_GW2D_LED_DUNNE 4
104#define SWMM_GW2D_LED_CAPRISE 5
105#define SWMM_GW2D_LED_ET 6
106#define SWMM_GW2D_LED_INFIL_IN 7
107#define SWMM_GW2D_LED_INIT_STORAGE 8
108#define SWMM_GW2D_LED_STORAGE 9
109
110/* =========================================================================
111 * [2D_AQUIFER_OPTIONS]
112 * ========================================================================= */
113
116SWMM_ENGINE_API int swmm_gw2d_option_get(SWMM_Engine engine, const char* key,
117 char* buf, int buflen);
118
121SWMM_ENGINE_API int swmm_gw2d_option_set(SWMM_Engine engine, const char* key,
122 const char* value);
123
124/* =========================================================================
125 * [2D_AQUIFER] rows
126 * ========================================================================= */
127
129SWMM_ENGINE_API int swmm_gw2d_row_count(SWMM_Engine engine, int* count);
130
143SWMM_ENGINE_API int swmm_gw2d_row_add(SWMM_Engine engine, int scope,
144 const char* tag, int cell,
145 double ks, double zs,
146 double theta_s, double theta_r,
147 double alpha);
148
151SWMM_ENGINE_API int swmm_gw2d_row_get(SWMM_Engine engine, int index,
152 int* scope, char* tag, int taglen,
153 int* cell, double* ks, double* zs,
154 double* theta_s, double* theta_r,
155 double* alpha);
156
163 const char* key, double value);
164
167 const char* key, double* value);
168
171
172/* =========================================================================
173 * [2D_AQUIFER_NODE] beds
174 * ========================================================================= */
175
176SWMM_ENGINE_API int swmm_gw2d_node_count(SWMM_Engine engine, int* count);
177
180SWMM_ENGINE_API int swmm_gw2d_node_add(SWMM_Engine engine, const char* node,
181 int cell, double kc, double dc,
182 double area);
183
185 char* node, int nodelen, int* cell,
186 double* kc, double* dc, double* area);
187
189
190/* =========================================================================
191 * Running state — SI throughout
192 * ========================================================================= */
193
195SWMM_ENGINE_API int swmm_gw2d_is_active(SWMM_Engine engine, int* active);
196
200 int* n_cells, int* m_layers);
201
203SWMM_ENGINE_API int swmm_gw2d_get_cell(SWMM_Engine engine, int cell, int var,
204 double* value);
205
209 double* out, int len,
210 int* written);
211
216 double* theta, int len,
217 int* written);
218
221 double* value);
222
233 double* value);
234
238 long* out, int len,
239 int* written);
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif /* OPENSWMM_GW2D_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_gw2d_row_set_property(SWMM_Engine engine, int index, const char *key, double value)
Definition ApiGw2D.cpp:204
SWMM_ENGINE_API int swmm_gw2d_row_get_property(SWMM_Engine engine, int index, const char *key, double *value)
Definition ApiGw2D.cpp:237
SWMM_ENGINE_API int swmm_gw2d_node_count(SWMM_Engine engine, int *count)
Definition ApiGw2D.cpp:270
SWMM_ENGINE_API int swmm_gw2d_get_tier_histogram(SWMM_Engine engine, long *out, int len, int *written)
Definition ApiGw2D.cpp:510
SWMM_ENGINE_API int swmm_gw2d_row_get(SWMM_Engine engine, int index, int *scope, char *tag, int taglen, int *cell, double *ks, double *zs, double *theta_s, double *theta_r, double *alpha)
Definition ApiGw2D.cpp:184
SWMM_ENGINE_API int swmm_gw2d_node_add(SWMM_Engine engine, const char *node, int cell, double kc, double dc, double area)
Definition ApiGw2D.cpp:277
SWMM_ENGINE_API int swmm_gw2d_get_ledger(SWMM_Engine engine, int term, double *value)
Definition ApiGw2D.cpp:454
SWMM_ENGINE_API int swmm_gw2d_get_cell(SWMM_Engine engine, int cell, int var, double *value)
Definition ApiGw2D.cpp:373
SWMM_ENGINE_API int swmm_gw2d_row_remove(SWMM_Engine engine, int index)
Definition ApiGw2D.cpp:257
SWMM_ENGINE_API int swmm_gw2d_node_get(SWMM_Engine engine, int index, char *node, int nodelen, int *cell, double *kc, double *dc, double *area)
Definition ApiGw2D.cpp:296
SWMM_ENGINE_API int swmm_gw2d_get_column(SWMM_Engine engine, int cell, double *theta, int len, int *written)
Definition ApiGw2D.cpp:399
SWMM_ENGINE_API int swmm_gw2d_row_count(SWMM_Engine engine, int *count)
Definition ApiGw2D.cpp:146
SWMM_ENGINE_API int swmm_gw2d_get_cell_bulk(SWMM_Engine engine, int var, double *out, int len, int *written)
Definition ApiGw2D.cpp:385
SWMM_ENGINE_API int swmm_gw2d_row_add(SWMM_Engine engine, int scope, const char *tag, int cell, double ks, double zs, double theta_s, double theta_r, double alpha)
Append one row. Values are in the PROJECT's units.
Definition ApiGw2D.cpp:153
SWMM_ENGINE_API int swmm_gw2d_option_set(SWMM_Engine engine, const char *key, const char *value)
Definition ApiGw2D.cpp:126
SWMM_ENGINE_API int swmm_gw2d_option_get(SWMM_Engine engine, const char *key, char *buf, int buflen)
Definition ApiGw2D.cpp:99
SWMM_ENGINE_API int swmm_gw2d_is_active(SWMM_Engine engine, int *active)
Definition ApiGw2D.cpp:332
SWMM_ENGINE_API int swmm_gw2d_get_dimensions(SWMM_Engine engine, int *n_cells, int *m_layers)
Definition ApiGw2D.cpp:340
SWMM_ENGINE_API int swmm_gw2d_get_continuity_error(SWMM_Engine engine, double *value)
Continuity residual (m3): storage_now − storage_init − (in − out).
Definition ApiGw2D.cpp:475
SWMM_ENGINE_API int swmm_gw2d_node_remove(SWMM_Engine engine, int index)
Definition ApiGw2D.cpp:316