OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::link Namespace Reference

Functions

int translateShape (XsectShape link_shape)
 Map model-storage section type to its distinct kernel numbering.
 
double getVelocity (const XSectParams &xs, double flow, double depth, int barrels=1)
 Compute flow velocity from flow and depth.
 
double getFroude (const XSectParams &xs, double v, double y)
 Compute Froude number from velocity and depth.
 
void computeConveyance (double roughness, double slope, double s_full, double &beta, double &rough_factor, double &q_full)
 Compute Manning conveyance coefficients for a conduit.
 
double getDepthFromFlow (const XSectParams &xs, double beta, double q, double q_max=-1.0)
 Compute normal-flow depth from flow rate (inverse Manning).
 
double getCapacity (const XSectParams &xs, double depth)
 Compute the wetted-area fraction relative to full cross-section area.
 
double getHydPower (double flow, double head_upstream, double head_downstream)
 Compute hydraulic power dissipated in a link.
 
XSectParams buildXSectParams (const LinkData &links, std::size_t uj, const std::vector< transect::TransectData > *transects=nullptr)
 Build XSectParams from LinkData SoA arrays.
 
void applyTabulatedXSectParams (XSectParams &xs, const transect::TransectData &td, double y_full, int transect_idx)
 Derive the full-flow properties of a tabulated cross-section.
 
double filledCircularOffsetBump (const LinkData &links, std::size_t j, bool resolved)
 Read the resolved sediment-depth adjustment for a filled circular conduit.
 

Function Documentation

◆ applyTabulatedXSectParams()

void openswmm::link::applyTabulatedXSectParams ( XSectParams & xs,
const transect::TransectData & td,
double y_full,
int transect_idx )

Derive the full-flow properties of a tabulated cross-section.

The counterpart of xsect::setParams() for the three shapes whose geometry comes from a transect table rather than a formula: IRREGULAR, CUSTOM and STREET_XSECT. Fills the y_full/a_full/r_full/ w_max/s_full/s_max/a_bot/yw_max fields of xs from the built table, and attaches the table pointers.

Beyond a/r/w_full this sets the PHYSICAL s_max and a_bot (the area at the maximum section factor), which drive link_getYnorm's getAofS normal-depth solve and the flow limit q_max. Leaving s_max = s_full and a_bot = 0 diverges every transect whose section factor peaks below full depth.

Note
PARITY: legacy getTransectParams (xsect.c:1339-1358) for IRREGULAR / STREET_XSECT, and setCustomXsectParams (xsect.c:668-700) for CUSTOM. xs.type must already be set to the batch XSectShape code.
Parameters
xs[in/out] Params to fill; type must be set on entry.
tdBuilt transect table (buildTables / buildCustomTables output).
y_fullFull depth (ft). Used only by CUSTOM, whose table is built at unit height and scaled here; ignored for IRREGULAR/STREET, which take y_full from td.
transect_idxIndex to record in xs.transect, or -1 when the table is owned rather than pooled.
Here is the caller graph for this function:

◆ buildXSectParams()

XSectParams openswmm::link::buildXSectParams ( const LinkData & links,
std::size_t uj,
const std::vector< transect::TransectData > * transects = nullptr )

Build XSectParams from LinkData SoA arrays.

Parameters
linksLink SoA data.
ujLink index (size_t).
transectsOptional transect-table pool (ctx.transect_tables). When supplied, IRREGULAR/CUSTOM/STREET_XSECT links get their A/R/W table pointers attached so the per-element accessors can evaluate tabulated geometry. Pass nullptr when the link is known to be a self-contained shape.
Returns
Populated XSectParams struct.
Here is the caller graph for this function:

◆ computeConveyance()

void openswmm::link::computeConveyance ( double roughness,
double slope,
double s_full,
double & beta,
double & rough_factor,
double & q_full )

Compute Manning conveyance coefficients for a conduit.

Sets:

  • beta = PHI * sqrt(|slope|) / roughness
  • rough_factor = GRAVITY * (roughness / PHI)^2
  • q_full = s_full * beta
Parameters
roughnessManning's n.
slopeConduit slope (rise/run).
s_fullSection factor at full depth (ft^8/3).
[out]betaManning conveyance factor.
[out]rough_factorHead loss coefficient.
[out]q_fullFull-pipe flow rate (ft3/s).

◆ filledCircularOffsetBump()

double openswmm::link::filledCircularOffsetBump ( const LinkData & links,
std::size_t j,
bool resolved )
inline

Read the resolved sediment-depth adjustment for a filled circular conduit.

Does not mutate offsets or validate the index; callers add/subtract this bump when crossing authored/resolved offset conventions.

Parameters
[in]linksBorrowed aligned link type/shape/bottom-depth columns.
[in]jValid global link slot if resolved=true; not read when false.
[in]resolvedTrue only after geometry resolution has applied the filled-bottom adjustment.
Returns
Stored xsect_y_bot in native ft for a resolved FILLED_CIRCULAR conduit, otherwise0.
Here is the caller graph for this function:

◆ getCapacity()

double openswmm::link::getCapacity ( const XSectParams & xs,
double depth )

Compute the wetted-area fraction relative to full cross-section area.

This helper reports area fraction, not depth fraction or regulator setting. It does not cap an analytic open shape's above-full area ratio at1.

Parameters
[in]xsBorrowed valid native section with live optional tables.
[in]depthFinite nonnegative native water depth ft.
Returns
A(depth)/a_full, or0 when y_full<=0 or a_full<=0.
Here is the call graph for this function:

◆ getDepthFromFlow()

double openswmm::link::getDepthFromFlow ( const XSectParams & xs,
double beta,
double q,
double q_max = -1.0 )

Compute normal-flow depth from flow rate (inverse Manning).

Given Q, find y such that Q = beta * S(y). S = Q / beta → A = getAofS(xs, S) → y = getYofA(xs, A).

Parameters
xsCross-section parameters.
betaManning conveyance factor.
qFlow rate (ft3/s).
q_maxConduit's flow at the maximum section factor; q is capped at it first, as legacy link_getYnorm does (link.c:800). getAofS caps the section factor at sMax anyway, but the tabular shapes take their inverse-lookup argument from the UNcapped psi = s/sFull, so an over-capacity q0 on an egg / horseshoe / gothic / catenary / semi-elliptical / basket-handle / semi-circular conduit reads the table past its end. Negative disables the cap.
Returns
Normal depth (ft).
Here is the call graph for this function:

◆ getFroude()

double openswmm::link::getFroude ( const XSectParams & xs,
double v,
double y )

Compute Froude number from velocity and depth.

Fr = |V| / sqrt(g * D_h) where D_h = A/T (hydraulic depth). Returns 0 for dry or fully-full closed conduits.

Parameters
xsCross-section parameters.
vVelocity (ft/s).
yWater depth (ft).
Returns
Froude number (dimensionless).
Here is the call graph for this function:

◆ getHydPower()

double openswmm::link::getHydPower ( double flow,
double head_upstream,
double head_downstream )

Compute hydraulic power dissipated in a link.

P = gamma * Q * hL where gamma = specific weight of water, Q = flow rate, hL = head loss across link. hL = friction slope * length (for conduits).

See also
Legacy: link_getPower() in link.c
Parameters
flowFlow rate (ft3/s).
head_upstreamHead at upstream node (ft).
head_downstreamHead at downstream node (ft).
Returns
Power (ft-lbs/s). Divide by 550 for horsepower.

◆ getVelocity()

double openswmm::link::getVelocity ( const XSectParams & xs,
double flow,
double depth,
int barrels = 1 )

Compute flow velocity from flow and depth.

V = Q / (barrels * A(y)), where A is the cross-sectional area. Returns 0 if depth < 0.01 ft or area < FUDGE.

Parameters
xsCross-section parameters.
flowFlow rate (ft3/s).
depthWater depth (ft).
barrelsNumber of identical barrels (default 1).
Returns
Velocity (ft/s).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ translateShape()

int openswmm::link::translateShape ( XsectShape link_shape)

Map model-storage section type to its distinct kernel numbering.

Parameters
[in]link_shapeStorage XsectShape candidate; known types map by name.
Returns
Matching XSectShape integer code; DUMMY for DUMMY or unrecognized storage value.
Here is the caller graph for this function: