OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_subcatchments_impl.cpp File Reference

C API implementation — subcatchment identity, creation, properties, state, bulk. More...

Include dependency graph for openswmm_subcatchments_impl.cpp:

Functions

SWMM_ENGINE_API int swmm_subcatch_count (SWMM_Engine engine)
 Get the total number of subcatchments in the model.
 
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.
 
SWMM_ENGINE_API const char * swmm_subcatch_id (SWMM_Engine engine, int idx)
 Get the string identifier of a subcatchment by index.
 
SWMM_ENGINE_API int swmm_subcatch_add (SWMM_Engine engine, const char *id)
 Add a new subcatchment to the model.
 
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.
 
SWMM_ENGINE_API int swmm_subcatch_set_area (SWMM_Engine engine, int idx, double area)
 Set the subcatchment area.
 
SWMM_ENGINE_API int swmm_subcatch_set_width (SWMM_Engine engine, int idx, double width)
 Set the characteristic overland flow width.
 
SWMM_ENGINE_API int swmm_subcatch_set_slope (SWMM_Engine engine, int idx, double slope)
 Set the average surface slope.
 
SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct (SWMM_Engine engine, int idx, double pct)
 Set the percentage of impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_n_imperv (SWMM_Engine engine, int idx, double n)
 Set Manning's n for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_n_perv (SWMM_Engine engine, int idx, double n)
 Set Manning's n for the pervious area.
 
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.
 
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.
 
SWMM_ENGINE_API int swmm_subcatch_set_gage (SWMM_Engine engine, int idx, int gage_idx)
 Assign a rain gage to a subcatchment.
 
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.
 
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.
 
SWMM_ENGINE_API int swmm_subcatch_set_infil_curve_number (SWMM_Engine engine, int idx, double cn)
 Set Curve Number infiltration parameter.
 
SWMM_ENGINE_API int swmm_subcatch_get_area (SWMM_Engine engine, int idx, double *area)
 Get the subcatchment area.
 
SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct (SWMM_Engine engine, int idx, double *pct)
 Get the percentage of impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_outlet (SWMM_Engine engine, int idx, int *node_idx)
 Get the outlet node index for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_width (SWMM_Engine engine, int idx, double *w)
 Get the characteristic overland flow width.
 
SWMM_ENGINE_API int swmm_subcatch_get_slope (SWMM_Engine engine, int idx, double *s)
 Get the average surface slope.
 
SWMM_ENGINE_API int swmm_subcatch_get_n_imperv (SWMM_Engine engine, int idx, double *n)
 Get Manning's n for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_n_perv (SWMM_Engine engine, int idx, double *n)
 Get Manning's n for the pervious area.
 
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.
 
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.
 
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.
 
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).
 
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).
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_model (SWMM_Engine engine, int idx, int *model)
 Get the infiltration model type for a subcatchment.
 
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.
 
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.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_curve_number (SWMM_Engine engine, int idx, double *cn)
 Get the Curve Number infiltration parameter for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_stat_precip (SWMM_Engine engine, int idx, double *vol)
 Get the total precipitation volume at a subcatchment.
 
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.
 
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.
 
SWMM_ENGINE_API int swmm_subcatch_set_coverage (SWMM_Engine engine, int sc_idx, int lu_idx, double fraction)
 Set the land use coverage fraction for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_coverage (SWMM_Engine engine, int sc_idx, int lu_idx, double *fraction)
 Get the land use coverage fraction for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_runoff (SWMM_Engine engine, int idx, double *runoff)
 Get the current runoff rate from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_groundwater (SWMM_Engine engine, int idx, double *gw_flow)
 Get the current groundwater flow from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_rainfall (SWMM_Engine engine, int idx, double *rainfall)
 Get the current rainfall intensity at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_snow_depth (SWMM_Engine engine, int idx, double *depth)
 Get the current snow depth on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_evap (SWMM_Engine engine, int idx, double *evap)
 Get the current evaporation rate at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil (SWMM_Engine engine, int idx, double *infil)
 Get the current infiltration rate at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_rainfall (SWMM_Engine engine, int idx, double rainfall)
 Override rainfall on a subcatchment for the current timestep.
 
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.
 
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.
 
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.
 

Detailed Description

C API implementation — subcatchment identity, creation, properties, state, bulk.

See also
include/openswmm/engine/openswmm_subcatchments.h
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License

Function Documentation

◆ swmm_subcatch_add()

SWMM_ENGINE_API int swmm_subcatch_add ( SWMM_Engine  engine,
const char *  id 
)

Add a new subcatchment to the model.

The engine must be in SWMM_STATE_BUILDING. After creation, use the property setters to configure area, slope, imperviousness, etc.

Parameters
engineEngine handle.
idUnique null-terminated identifier for the new subcatchment.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_count()

SWMM_ENGINE_API int swmm_subcatch_count ( SWMM_Engine  engine)

Get the total number of subcatchments in the model.

Parameters
engineEngine handle.
Returns
Number of subcatchments, or -1 on error.

◆ swmm_subcatch_get_area()

SWMM_ENGINE_API int swmm_subcatch_get_area ( SWMM_Engine  engine,
int  idx,
double *  area 
)

Get the subcatchment area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]areaReceives the area in project area units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_coverage()

SWMM_ENGINE_API int swmm_subcatch_get_coverage ( SWMM_Engine  engine,
int  sc_idx,
int  lu_idx,
double *  fraction 
)

Get the land use coverage fraction for a subcatchment.

Parameters
engineEngine handle.
sc_idxZero-based subcatchment index.
lu_idxZero-based land use index.
[out]fractionReceives the coverage fraction (0–1).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_ds_imperv()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]dsReceives the depression storage depth.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_ds_perv()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]dsReceives the depression storage depth.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_evap()

SWMM_ENGINE_API int swmm_subcatch_get_evap ( SWMM_Engine  engine,
int  idx,
double *  evap 
)

Get the current evaporation rate at a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]evapReceives the evaporation rate.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_gage()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]gage_idxReceives the gage index.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_groundwater()

SWMM_ENGINE_API int swmm_subcatch_get_groundwater ( SWMM_Engine  engine,
int  idx,
double *  gw_flow 
)

Get the current groundwater flow from a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]gw_flowReceives the groundwater flow in project flow units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct ( SWMM_Engine  engine,
int  idx,
double *  pct 
)

Get the percentage of impervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]pctReceives the imperviousness percentage (0–100).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_infil()

SWMM_ENGINE_API int swmm_subcatch_get_infil ( SWMM_Engine  engine,
int  idx,
double *  infil 
)

Get the current infiltration rate at a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]infilReceives the infiltration rate.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_infil_curve_number()

SWMM_ENGINE_API int swmm_subcatch_get_infil_curve_number ( SWMM_Engine  engine,
int  idx,
double *  cn 
)

Get the Curve Number infiltration parameter for a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]cnReceives the SCS curve number.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_infil_green_ampt()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]suctionReceives the soil capillary suction head.
[out]conductivityReceives the saturated hydraulic conductivity.
[out]deficitReceives the initial moisture deficit (fraction).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_infil_horton()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]f0Receives the maximum infiltration rate.
[out]fminReceives the minimum infiltration rate.
[out]decayReceives the decay constant (1/hr).
[out]dry_timeReceives the time to fully dry (hours).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_infil_model()

SWMM_ENGINE_API int swmm_subcatch_get_infil_model ( SWMM_Engine  engine,
int  idx,
int *  model 
)

Get the infiltration model type for a subcatchment.

Returns an integer code: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]modelReceives the infiltration model code.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_n_imperv()

SWMM_ENGINE_API int swmm_subcatch_get_n_imperv ( SWMM_Engine  engine,
int  idx,
double *  n 
)

Get Manning's n for the impervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]nReceives Manning's n.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_n_perv()

SWMM_ENGINE_API int swmm_subcatch_get_n_perv ( SWMM_Engine  engine,
int  idx,
double *  n 
)

Get Manning's n for the pervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]nReceives Manning's n.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_outlet()

SWMM_ENGINE_API int swmm_subcatch_get_outlet ( SWMM_Engine  engine,
int  idx,
int *  node_idx 
)

Get the outlet node index for a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]node_idxReceives the outlet node index.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_outlet_subcatch()

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).

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]sc_idxReceives the downstream subcatchment index, or -1 if none.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_quality()

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.

Parameters
engineEngine handle.
subcatch_idxZero-based subcatchment index.
pollutant_idxZero-based pollutant index.
[out]concReceives the concentration in pollutant units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_quality_bulk()

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.

Parameters
engineEngine handle.
pollutant_idxZero-based pollutant index.
[out]bufCaller-allocated buffer of at least count doubles.
countNumber of elements (should equal swmm_subcatch_count()).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_rainfall()

SWMM_ENGINE_API int swmm_subcatch_get_rainfall ( SWMM_Engine  engine,
int  idx,
double *  rainfall 
)

Get the current rainfall intensity at a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]rainfallReceives the rainfall in project rate units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_runoff()

SWMM_ENGINE_API int swmm_subcatch_get_runoff ( SWMM_Engine  engine,
int  idx,
double *  runoff 
)

Get the current runoff rate from a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]runoffReceives the runoff rate in project flow units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_runoff_bulk()

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.

Parameters
engineEngine handle.
[out]bufCaller-allocated buffer of at least count doubles.
countNumber of elements (should equal swmm_subcatch_count()).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_slope()

SWMM_ENGINE_API int swmm_subcatch_get_slope ( SWMM_Engine  engine,
int  idx,
double *  s 
)

Get the average surface slope.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]sReceives the slope percentage.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_snow_depth()

SWMM_ENGINE_API int swmm_subcatch_get_snow_depth ( SWMM_Engine  engine,
int  idx,
double *  depth 
)

Get the current snow depth on a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]depthReceives the snow depth in project length units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_stat_max_runoff()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]rateReceives the maximum runoff rate in project flow units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_stat_precip()

SWMM_ENGINE_API int swmm_subcatch_get_stat_precip ( SWMM_Engine  engine,
int  idx,
double *  vol 
)

Get the total precipitation volume at a subcatchment.

Parameters
engineEngine handle (ENDED or RUNNING state).
idxZero-based subcatchment index.
[out]volReceives the precipitation volume in project volume units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_stat_runoff_vol()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]volReceives the runoff volume in project volume units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_get_width()

SWMM_ENGINE_API int swmm_subcatch_get_width ( SWMM_Engine  engine,
int  idx,
double *  w 
)

Get the characteristic overland flow width.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
[out]wReceives the width in project length units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_id()

SWMM_ENGINE_API const char * swmm_subcatch_id ( SWMM_Engine  engine,
int  idx 
)

Get the string identifier of a subcatchment by index.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
Returns
Null-terminated string owned by the engine, or NULL on error.

◆ swmm_subcatch_index()

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.

Parameters
engineEngine handle.
idNull-terminated subcatchment identifier.
Returns
Zero-based index, or -1 if not found.

◆ swmm_subcatch_set_area()

SWMM_ENGINE_API int swmm_subcatch_set_area ( SWMM_Engine  engine,
int  idx,
double  area 
)

Set the subcatchment area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
areaArea in project area units (acres or hectares).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_coverage()

SWMM_ENGINE_API int swmm_subcatch_set_coverage ( SWMM_Engine  engine,
int  sc_idx,
int  lu_idx,
double  fraction 
)

Set the land use coverage fraction for a subcatchment.

Assigns what fraction of a subcatchment's area is covered by a particular land use category (for buildup/washoff modeling).

Parameters
engineEngine handle.
sc_idxZero-based subcatchment index.
lu_idxZero-based land use index.
fractionCoverage fraction (0–1).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_ds_imperv()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
dsDepression storage in project length units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_ds_perv()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
dsDepression storage in project length units.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_gage()

SWMM_ENGINE_API int swmm_subcatch_set_gage ( SWMM_Engine  engine,
int  idx,
int  gage_idx 
)

Assign a rain gage to a subcatchment.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
gage_idxZero-based rain gage index.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct ( SWMM_Engine  engine,
int  idx,
double  pct 
)

Set the percentage of impervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
pctImperviousness as a percentage (0–100).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_infil_curve_number()

SWMM_ENGINE_API int swmm_subcatch_set_infil_curve_number ( SWMM_Engine  engine,
int  idx,
double  cn 
)

Set Curve Number infiltration parameter.

◆ swmm_subcatch_set_infil_green_ampt()

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.

◆ swmm_subcatch_set_infil_horton()

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.

◆ swmm_subcatch_set_n_imperv()

SWMM_ENGINE_API int swmm_subcatch_set_n_imperv ( SWMM_Engine  engine,
int  idx,
double  n 
)

Set Manning's n for the impervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
nManning's roughness coefficient.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_n_perv()

SWMM_ENGINE_API int swmm_subcatch_set_n_perv ( SWMM_Engine  engine,
int  idx,
double  n 
)

Set Manning's n for the pervious area.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
nManning's roughness coefficient.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_outlet()

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.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
node_idxZero-based node index of the receiving node.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_outlet_subcatch()

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).

When a subcatchment drains to another subcatchment instead of directly to a node, use this function. Mutually exclusive with swmm_subcatch_set_outlet().

Parameters
engineEngine handle.
idxZero-based subcatchment index.
sc_idxZero-based index of the receiving subcatchment.
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_rainfall()

SWMM_ENGINE_API int swmm_subcatch_set_rainfall ( SWMM_Engine  engine,
int  idx,
double  rainfall 
)

Override rainfall on a subcatchment for the current timestep.

Overrides the gage-driven rainfall for this subcatchment only. Value is applied for the current timestep; call again each step to sustain. Pass a negative value to revert to gage-driven.

◆ swmm_subcatch_set_slope()

SWMM_ENGINE_API int swmm_subcatch_set_slope ( SWMM_Engine  engine,
int  idx,
double  slope 
)

Set the average surface slope.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
slopeSlope as a percentage (e.g., 2.0 = 2%).
Returns
SWMM_OK on success, or an error code.

◆ swmm_subcatch_set_width()

SWMM_ENGINE_API int swmm_subcatch_set_width ( SWMM_Engine  engine,
int  idx,
double  width 
)

Set the characteristic overland flow width.

Parameters
engineEngine handle.
idxZero-based subcatchment index.
widthWidth in project length units.
Returns
SWMM_OK on success, or an error code.