52#ifndef OPENSWMM_GW2D_H
53#define OPENSWMM_GW2D_H
63#define SWMM_GW2D_SCOPE_GLOBAL 0
64#define SWMM_GW2D_SCOPE_TAG 1
65#define SWMM_GW2D_SCOPE_CELL 2
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
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
82#define SWMM_GW2D_BOUNDARY_HEAD 0
83#define SWMM_GW2D_BOUNDARY_FLOW 1
111 char* series,
int series_len);
153 double* requested_out,
double* applied_in,
154 double* applied_out);
174 double* advective_in,
double* advective_out,
175 double* imposed_in,
double* imposed_out);
179#define SWMM_GW2D_VAR_HG 0
180#define SWMM_GW2D_VAR_HU 1
181#define SWMM_GW2D_VAR_TABLE_EL 2
182#define SWMM_GW2D_VAR_Q0 3
183#define SWMM_GW2D_VAR_QLAT 4
184#define SWMM_GW2D_VAR_QNODE 5
185#define SWMM_GW2D_VAR_QDEEP 6
186#define SWMM_GW2D_VAR_QET 7
187#define SWMM_GW2D_VAR_DUNNE 8
188#define SWMM_GW2D_VAR_QPLUS 9
189#define SWMM_GW2D_VAR_DT_CELL 10
190#define SWMM_GW2D_VAR_TIER 11
191#define SWMM_GW2D_VAR_CLOSURE 12
192#define SWMM_GW2D_VAR_QLINK 13
194#define SWMM_GW2D_VAR_INFIL_CAPACITY 14
195#define SWMM_GW2D_VAR_INFIL_REMAINING \
197#define SWMM_GW2D_VAR_INFIL_REFRESH 16
198#define SWMM_GW2D_VAR_INFIL_PENDING 17
199#define SWMM_GW2D_VAR_REJECT 18
200#define SWMM_GW2D_VAR_REJECT_CUM 19
201#define SWMM_GW2D_VAR_DUNNE_CUM 20
202#define SWMM_GW2D_VAR_ET_PENDING \
204#define SWMM_GW2D_VAR_ET_POTENTIAL_CUM \
206#define SWMM_GW2D_VAR_ET_SURFACE_CUM 23
207#define SWMM_GW2D_VAR_ET_SOIL_CUM 24
208#define SWMM_GW2D_VAR_ET_UNUSED_CUM 25
209#define SWMM_GW2D_VAR_ET_SURFACE \
211#define SWMM_GW2D_VAR_ET_POTENTIAL 27
212#define SWMM_GW2D_VAR_ET_STRESS 28
213#define SWMM_GW2D_VAR_ET_REFRESH 29
217#define SWMM_GW2D_LED_RECHARGE 0
218#define SWMM_GW2D_LED_LATERAL 1
219#define SWMM_GW2D_LED_DEEP 2
220#define SWMM_GW2D_LED_NODE 3
221#define SWMM_GW2D_LED_REJECT 13
222#define SWMM_GW2D_LED_DUNNE 4
223#define SWMM_GW2D_LED_CAPRISE 5
224#define SWMM_GW2D_LED_ET 6
225#define SWMM_GW2D_LED_INFIL_IN 7
226#define SWMM_GW2D_LED_INIT_STORAGE 8
227#define SWMM_GW2D_LED_STORAGE 9
228#define SWMM_GW2D_LED_SOURCE_IN 11
229#define SWMM_GW2D_LED_BOUNDARY_IN 14
230#define SWMM_GW2D_LED_BOUNDARY_OUT 15
231#define SWMM_GW2D_LED_SOURCE_OUT 12
232#define SWMM_GW2D_LED_LINK 10
237#define SWMM_GW2D_ZONE_SAT 0
238#define SWMM_GW2D_ZONE_UNSAT 1
241#define SWMM_GW2D_SPL_INIT 0
242#define SWMM_GW2D_SPL_STORAGE 1
243#define SWMM_GW2D_SPL_INFIL_IN 2
244#define SWMM_GW2D_SPL_NODE_IN 3
245#define SWMM_GW2D_SPL_LINK_IN 4
246#define SWMM_GW2D_SPL_LATERAL_NET 5
247#define SWMM_GW2D_SPL_DEEP_OUT 6
248#define SWMM_GW2D_SPL_NODE_OUT 7
249#define SWMM_GW2D_SPL_LINK_OUT 8
250#define SWMM_GW2D_SPL_DUNNE_OUT 9
251#define SWMM_GW2D_SPL_ET_OUT 10
252#define SWMM_GW2D_SPL_REACTED 11
253#define SWMM_GW2D_SPL_SOURCE_IN 13
254#define SWMM_GW2D_SPL_SOURCE_OUT 14
255#define SWMM_GW2D_SPL_BOUNDARY_IN 15
256#define SWMM_GW2D_SPL_BOUNDARY_OUT 16
257#define SWMM_GW2D_SPL_BOUNDARY_FLUX_IN 17
258#define SWMM_GW2D_SPL_BOUNDARY_FLUX_OUT 18
259#define SWMM_GW2D_SPL_AGE_GENERATED 19
260#define SWMM_GW2D_SPL_RESIDUAL 12
307 int len,
int* written);
328 int species,
double* water,
double* mass,
329 double* concentration);
389 const char* link,
const char* wilting,
441 double ks,
double zs,
double theta_s,
double theta_r,
463 int taglen,
int* cell,
double* ks,
double* zs,
464 double* theta_s,
double* theta_r,
double* alpha);
546 double dc,
double area);
563 int* cell,
double* kc,
double* dc,
double* area);
593 int* exchange,
int* automatic);
649 int bottom_count,
int apply);
697 double* kc,
double* dc,
int* exchange);
842#define SWMM_GW2D_OP_CLOSED_FORM_RECHARGE 1u
843#define SWMM_GW2D_HOST_WATER_AND_RECEIPTS 1u
844#define SWMM_GW2D_HOST_TRANSPORT 2u
845#define SWMM_GW2D_HOST_REACTIONS 4u
846#define SWMM_GW2D_HOST_THERMAL 8u
#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_gw2d_link_count(SWMM_Engine engine, int *count)
Read the authored conduit-bed row count.
Definition ApiGw2D.cpp:708
SWMM_ENGINE_API int swmm_gw2d_row_set_property(SWMM_Engine engine, int index, const char *key, double value)
Set one of a row's optional properties. Keys: PSI_B, LAMBDA, N, L, C_LOSS, HG0, SOIL_CHAR,...
Definition ApiGw2D.cpp:406
SWMM_ENGINE_API int swmm_gw2d_row_get_property(SWMM_Engine engine, int index, const char *key, double *value)
Read one optional property back.
Definition ApiGw2D.cpp:456
SWMM_ENGINE_API int swmm_gw2d_node_count(SWMM_Engine engine, int *count)
Read the current aquifer node-bed row count.
Definition ApiGw2D.cpp:502
SWMM_ENGINE_API int swmm_gw2d_get_tier_histogram(SWMM_Engine engine, long *out, int len, int *written)
Cumulative firings per LTS tier — the G-A telemetry. Writes min(len, tier_count) entries.
Definition ApiGw2D.cpp:1191
SWMM_ENGINE_API int swmm_gw2d_node_get_flags(SWMM_Engine engine, int index, int *locate, int *exchange, int *automatic)
G-X2 (2026-09-19): a bed's enrolment state. locate — the cell is found from the node's [COORDINATES] ...
Definition ApiGw2D.cpp:556
SWMM_ENGINE_API int swmm_gw2d_get_layer_quality(SWMM_Engine engine, int cell, int layer, int species, double *water, double *mass, double *concentration)
Canonical SIGMA chemistry, zero-based layer and species. Outputs are unchanged on error; BULK chemist...
Definition ApiGw2D.cpp:1055
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)
Read row index back, in the units it was authored in. Any out pointer may be NULL....
Definition ApiGw2D.cpp:380
SWMM_ENGINE_API int swmm_gw2d_node_add(SWMM_Engine engine, const char *node, int cell, double kc, double dc, double area)
Add a node bed. kc in in/hr | mm/hr, dc in ft | m, area in ft2 | m2 (0 = the cell's own area)....
Definition ApiGw2D.cpp:510
SWMM_ENGINE_API int swmm_gw2d_boundary_water(SWMM_Engine engine, int index, double *requested_in, double *requested_out, double *applied_in, double *applied_out)
Runtime totals, in SI m3; getters leave outputs unchanged on error.
Definition ApiGw2D.cpp:196
SWMM_ENGINE_API int swmm_gw2d_get_ledger(SWMM_Engine engine, int term, double *value)
One ledger term — see SWMM_GW2D_LED_*.
Definition ApiGw2D.cpp:951
SWMM_ENGINE_API int swmm_gw2d_link_add(SWMM_Engine engine, const char *link, double kc, double dc, int exchange)
Add a conduit bed row. kc in the [LOSSES] seepage units (0 = the conduit's own seep rate),...
Definition ApiGw2D.cpp:716
SWMM_ENGINE_API int swmm_gw2d_get_cell(SWMM_Engine engine, int cell, int var, double *value)
One cell, one variable — see SWMM_GW2D_VAR_*.
Definition ApiGw2D.cpp:872
SWMM_ENGINE_API int swmm_gw2d_row_remove(SWMM_Engine engine, int index)
Remove row index.
Definition ApiGw2D.cpp:489
SWMM_ENGINE_API int swmm_gw2d_boundary_count(SWMM_Engine engine)
Read the authored exterior aquifer-boundary count.
Definition ApiGw2D.cpp:146
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)
Read one authored/resolved aquifer node-bed row.
Definition ApiGw2D.cpp:533
SWMM_ENGINE_API int swmm_gw2d_get_column(SWMM_Engine engine, int cell, double *theta, int len, int *written)
The sigma column of one cell: m_layers water contents, layer 0 at the ground surface....
Definition ApiGw2D.cpp:903
SWMM_ENGINE_API int swmm_gw2d_link_get(SWMM_Engine engine, int index, char *link, int linklen, double *kc, double *dc, int *exchange)
Read one authored aquifer conduit-bed row.
Definition ApiGw2D.cpp:734
SWMM_ENGINE_API int swmm_gw2d_species_count(SWMM_Engine engine, int *count)
How many species rows the aquifer transports (0 when it carries none).
Definition ApiGw2D.cpp:1015
SWMM_ENGINE_API int swmm_gw2d_boundary_species(SWMM_Engine engine, int index, int species, double *advective_in, double *advective_out, double *imposed_in, double *imposed_out)
Runtime totals in native concentration*m3 (age s*m3, temperature degC*m3). advective in/out and indep...
Definition ApiGw2D.cpp:211
SWMM_ENGINE_API int swmm_gw2d_boundary_get(SWMM_Engine engine, int index, SWMM_GwBoundary *row, char *series, int series_len)
Copy one authored exterior aquifer boundary and series name.
Definition ApiGw2D.cpp:150
SWMM_ENGINE_API int swmm_gw2d_node_set_exchange(SWMM_Engine engine, int index, int exchange)
G-X2: set a row's EXCHANGE flag (0 = the node exchanges with nothing).
Definition ApiGw2D.cpp:571
SWMM_ENGINE_API int swmm_gw2d_node_replace(SWMM_Engine engine, const SWMM_GwNodeBed *expected, int expected_count, const SWMM_GwNodeBed *replacement, int count, const SWMM_LidNodeBottomEdit *bottoms, int bottom_count, int apply)
BUILDING/OPENED only. Compares the entire current bed list with expected, validates every replacement...
Definition ApiGw2D.cpp:593
SWMM_ENGINE_API int swmm_gw2d_row_count(SWMM_Engine engine, int *count)
Number of authored rows.
Definition ApiGw2D.cpp:338
SWMM_ENGINE_API int swmm_gw2d_boundary_remove(SWMM_Engine engine, int index)
Erase one authored exterior aquifer boundary.
Definition ApiGw2D.cpp:188
SWMM_ENGINE_API int swmm_gw2d_boundary_set(SWMM_Engine engine, const SWMM_GwBoundary *row, const char *series)
Upsert an authored exterior aquifer boundary by cell and edge.
Definition ApiGw2D.cpp:164
SWMM_ENGINE_API int swmm_gw2d_get_species_ledger(SWMM_Engine engine, int species, int term, double *value)
One term of one species' cumulative ledger — see SWMM_GW2D_SPL_*.
Definition ApiGw2D.cpp:1081
SWMM_ENGINE_API int swmm_gw2d_get_cell_bulk(SWMM_Engine engine, int var, double *out, int len, int *written)
Bulk read of one variable over [0, n_cells). len must be at least the cell count; the number written ...
Definition ApiGw2D.cpp:887
SWMM_ENGINE_API int swmm_gw2d_link_remove(SWMM_Engine engine, int index)
Erase one authored aquifer conduit-bed row.
Definition ApiGw2D.cpp:755
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:346
SWMM_ENGINE_API int swmm_gw2d_species_name(SWMM_Engine engine, int species, char *buf, int buflen)
One species row's name (TransportPolicy order: pollutants, MSX, __WATER_AGE__, __TEMPERATURE__).
Definition ApiGw2D.cpp:1024
SWMM_ENGINE_API int swmm_gw2d_option_set(SWMM_Engine engine, const char *key, const char *value)
Set an authored option from text through the same parser as the file.
Definition ApiGw2D.cpp:318
SWMM_ENGINE_API int swmm_gw2d_option_get(SWMM_Engine engine, const char *key, char *buf, int buflen)
Read one option as text. Keys: SOIL_CHAR, CLOSURE, M_LAYERS, CAPILLARY_DIFF, C_GW,...
Definition ApiGw2D.cpp:232
SWMM_ENGINE_API int swmm_gw2d_is_active(SWMM_Engine engine, int *active)
Non-zero once a [2D_AQUIFER] row has resolved and the kernel is live.
Definition ApiGw2D.cpp:771
SWMM_ENGINE_API int swmm_gw2d_get_dimensions(SWMM_Engine engine, int *n_cells, int *m_layers)
Cells the kernel covers, and the sigma layer count (1 when no cell uses closure B)....
Definition ApiGw2D.cpp:781
SWMM_ENGINE_API int swmm_gw2d_get_execution_status(SWMM_Engine engine, SWMM_GwExecutionStatus *status)
Runtime after initialization. Availability is distinct from actual use; surface backend selection is ...
Definition ApiGw2D.cpp:122
SWMM_ENGINE_API int swmm_gw2d_get_cell_conc(SWMM_Engine engine, int zone, int species, double *out, int len, int *written)
Per-cell CONCENTRATION of one species in one zone, in the species' own units. BULK retains total inve...
Definition ApiGw2D.cpp:1035
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:1157
SWMM_ENGINE_API int swmm_gw2d_process_options_set(SWMM_Engine engine, const char *et, const char *link, const char *wilting, int authored)
Atomically replace GW_ET, LINK_SEEPAGE and WILTING_SUCTION before a run. GW_ET AUTO defaults to BOTH ...
Definition ApiGw2D.cpp:301
SWMM_ENGINE_API int swmm_gw2d_node_remove(SWMM_Engine engine, int index)
Erase one aquifer node-bed row and its stored node name.
Definition ApiGw2D.cpp:581
Definition openswmm_gw2d.h:87
int edge
Definition openswmm_gw2d.h:88
int cell
Definition openswmm_gw2d.h:88
double value
Definition openswmm_gw2d.h:89
int kind
Definition openswmm_gw2d.h:88
Definition openswmm_gw2d.h:848
char detail[256]
Definition openswmm_gw2d.h:856
unsigned int struct_size
Definition openswmm_gw2d.h:849
int effective_threads
Definition openswmm_gw2d.h:852
unsigned int host_owned_operations
Definition openswmm_gw2d.h:851
unsigned int available_operators
Definition openswmm_gw2d.h:851
char recharge_backend[16]
Definition openswmm_gw2d.h:854
int active
Definition openswmm_gw2d.h:850
unsigned long long accepted_batches
Definition openswmm_gw2d.h:853
char profile[128]
Definition openswmm_gw2d.h:855
unsigned int executed_operators
Definition openswmm_gw2d.h:851
unsigned long long accepted_cells
Definition openswmm_gw2d.h:853
Definition openswmm_gw2d.h:611
int cell
Definition openswmm_gw2d.h:613
double dc
Definition openswmm_gw2d.h:614
int automatic
Definition openswmm_gw2d.h:613
double area
Definition openswmm_gw2d.h:614
double kc
Definition openswmm_gw2d.h:614
const char * node
Definition openswmm_gw2d.h:612
int exchange
Definition openswmm_gw2d.h:613
int locate
Definition openswmm_gw2d.h:613
Definition openswmm_gw2d.h:618
int node
Definition openswmm_gw2d.h:619
int expected_mode
Definition openswmm_gw2d.h:619
int mode
Definition openswmm_gw2d.h:619