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

Functions

int translateShape (XsectShape link_shape)
 Translate LinkData::XsectShape to batch XSectShape int code.
 
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)
 Compute normal-flow depth from flow rate (inverse Manning).
 
double getCapacity (const XSectParams &xs, double depth)
 Compute the capacity fraction (depth / full depth for conduits, setting for other links).
 
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.
 

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

◆ getCapacity()

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

Compute the capacity fraction (depth / full depth for conduits, setting for other links).

Here is the call graph for this function:

◆ getDepthFromFlow()

double openswmm::link::getDepthFromFlow ( const XSectParams & xs,
double beta,
double q )

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

◆ translateShape()

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

Translate LinkData::XsectShape to batch XSectShape int code.

The two enums have different orderings. This function provides a safe mapping for use wherever XSectParams.type is set from LinkData::xsect_shape.

Here is the caller graph for this function: