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

The analytic shape formulas — the single definition of each. More...

Functions

OPENSWMM_KERNEL_FN double rectAofY (double y, double w_max)
 Compute rectangular area as depth times width.
 
OPENSWMM_KERNEL_FN double trapezAofY (double y, double y_bot, double s_bot)
 Compute trapezoid area as (bottom width+side slope*depth)*depth.
 
OPENSWMM_KERNEL_FN double triangAofY (double y, double s_bot)
 Compute triangular area from depth and side slope.
 
OPENSWMM_KERNEL_FN double parabAofY (double y, double r_bot)
 Compute parabolic area using its square-root depth relation.
 
OPENSWMM_KERNEL_FN double powerfuncAofY (double y, double s_bot, double r_bot)
 Compute power-function section area.
 
OPENSWMM_KERNEL_FN double rectClosedRofA (double a, double w_max, double a_full)
 Compute closed rectangular hydraulic radius with near-crown perimeter correction.
 
OPENSWMM_KERNEL_FN double rectOpenRofA (double a, double w_max, double s_bot)
 Compute open rectangular radius excluding selected side banks.
 
OPENSWMM_KERNEL_FN double trapezRofY (double y, double y_bot, double s_bot, double r_bot)
 Compute trapezoid hydraulic radius from depth.
 
OPENSWMM_KERNEL_FN double triangRofY (double y, double s_bot, double r_bot)
 Compute triangular hydraulic radius from its side geometry.
 
OPENSWMM_KERNEL_FN double rectClosedWofY (double y_norm, double w_max)
 Apply the closed rectangular crown top-width convention.
 
OPENSWMM_KERNEL_FN double trapezWofY (double y, double y_bot, double s_bot)
 Compute trapezoid top width from depth.
 
OPENSWMM_KERNEL_FN double triangWofY (double y, double s_bot)
 Compute triangular top width from depth.
 
OPENSWMM_KERNEL_FN double parabWofY (double y, double r_bot)
 Compute parabolic top width from depth.
 
OPENSWMM_KERNEL_FN double powerfuncWofY (double y, double s_bot, double r_bot)
 Compute power-function top width as the area-depth derivative.
 

Detailed Description

The analytic shape formulas — the single definition of each.

These are the shapes whose geometry is a closed-form expression rather than a table lookup. They live outside XsectEval because they need no tables at all, which lets the two consumers that are shaped differently share them:

  • XsectEval's per-element methods (host DW scalar fallbacks, FV, device), which unpack an XSectParams; and
  • xsect_batch's SoA loops (XSectBatch.cpp), which DWSolver's computeLinkGeometry STEP B/D runs on and which read parallel arrays.

Both call the same function on the same operands, so the two paths cannot drift — which is the point (plan §5.1, Phase 4b). Each body is legacy xsect.c verbatim, including operand order and the guards: multiplication is not associative in IEEE-754, so y*y*sBot and sBot*y*y are different computations and only the first is legacy's.

The y/a guards are legacy's own (xsect_getRofA's a <= 0 early return for the rect family, trapez_getRofY's y == 0). STEP A floors every conduit depth at FUDGE before STEP B/D sees it, so on the DW path they are unreachable either way; they are here so the shared body is complete rather than context-dependent.

Function Documentation

◆ parabAofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::parabAofY ( double y,
double r_bot )

Compute parabolic area using its square-root depth relation.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]r_botPositive inverse sqrt(parabola coefficient), units sqrt(ft).
Returns
(4/3)*r_bot*y*sqrt(y), ft2.
Here is the caller graph for this function:

◆ parabWofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::parabWofY ( double y,
double r_bot )

Compute parabolic top width from depth.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]r_botPositive inverse sqrt(parabola coefficient), sqrt(ft).
Returns
2*r_bot*sqrt(y), ft.
Here is the caller graph for this function:

◆ powerfuncAofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::powerfuncAofY ( double y,
double s_bot,
double r_bot )

Compute power-function section area.

No finite/power-domain checks.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]s_botPositive depth exponent (inverse authoring exponent), dimensionless.
[in]r_botPositive area coefficient, units ft^(1-s_bot).
Returns
r_bot*y^(s_bot+1), ft2.
Here is the caller graph for this function:

◆ powerfuncWofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::powerfuncWofY ( double y,
double s_bot,
double r_bot )

Compute power-function top width as the area-depth derivative.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]s_botPositive depth exponent, dimensionless.
[in]r_botPositive coefficient with units ft^(1-s_bot).
Returns
(s_bot+1)*r_bot*y^s_bot, ft.
Here is the caller graph for this function:

◆ rectAofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectAofY ( double y,
double w_max )

Compute rectangular area as depth times width.

No clamp to full depth.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]w_maxPositive section width in ft.
Returns
Wetted area ft2.
Here is the caller graph for this function:

◆ rectClosedRofA()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectClosedRofA ( double a,
double w_max,
double a_full )

Compute closed rectangular hydraulic radius with near-crown perimeter correction.

Above RECT_ALFMAX full-area fraction, adds a linearly increasing crown width to wetted perimeter.

Parameters
[in]aFinite nonnegative wetted area in ft2; caller supplies valid initialized geometry.
[in]w_maxPositive section width in ft.
[in]a_fullPositive full section area ft2.
Returns
Radius ft,0 when a<=0.
Here is the caller graph for this function:

◆ rectClosedWofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectClosedWofY ( double y_norm,
double w_max )

Apply the closed rectangular crown top-width convention.

Does not clamp negative/overfull normalized depths.

Parameters
[in]y_normNormalized depth y/y_full; exact1 denotes crown.
[in]w_maxPositive section width in ft.
Returns
0 exactly at y_norm=1, otherwise w_max ft.
Here is the caller graph for this function:

◆ rectOpenRofA()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectOpenRofA ( double a,
double w_max,
double s_bot )

Compute open rectangular radius excluding selected side banks.

Perimeter is width+(2-s_bot)*depth.

Parameters
[in]aFinite nonnegative wetted area in ft2; caller supplies valid initialized geometry.
[in]w_maxPositive section width in ft.
[in]s_botNumber of excluded wetted banks, convention0,1 or2; caller validates.
Returns
Radius ft,0 when a<=0.
Here is the caller graph for this function:

◆ trapezAofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezAofY ( double y,
double y_bot,
double s_bot )

Compute trapezoid area as (bottom width+side slope*depth)*depth.

No full-depth clamp.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]y_botNonnegative bottom width ft, with valid positive section dimensions.
[in]s_botAverage horizontal/vertical side slope, dimensionless.
Returns
Area ft2.
Here is the caller graph for this function:

◆ trapezRofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezRofY ( double y,
double y_bot,
double s_bot,
double r_bot )

Compute trapezoid hydraulic radius from depth.

No nonzero-denominator validation.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]y_botBottom width ft.
[in]s_botAverage horizontal/vertical side slope.
[in]r_botPositive sum of sloped side lengths per unit depth, dimensionless.
Returns
Area/(y_bot+y*r_bot), ft;0 exactly at y=0.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trapezWofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezWofY ( double y,
double y_bot,
double s_bot )

Compute trapezoid top width from depth.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]y_botNonnegative bottom width ft.
[in]s_botAverage horizontal/vertical side slope.
Returns
y_bot+2*y*s_bot, ft.
Here is the caller graph for this function:

◆ triangAofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangAofY ( double y,
double s_bot )

Compute triangular area from depth and side slope.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]s_botPositive horizontal/vertical side slope, dimensionless.
Returns
y*y*s_bot in ft2.
Here is the caller graph for this function:

◆ triangRofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangRofY ( double y,
double s_bot,
double r_bot )

Compute triangular hydraulic radius from its side geometry.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]s_botPositive horizontal/vertical side slope.
[in]r_botPositive side-length/depth factor sqrt(1+s_bot*s_bot).
Returns
y*s_bot/(2*r_bot), ft.
Here is the caller graph for this function:

◆ triangWofY()

OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangWofY ( double y,
double s_bot )

Compute triangular top width from depth.

Parameters
[in]yFinite nonnegative water depth in ft; caller keeps input within the intended geometric branch.
[in]s_botPositive horizontal/vertical side slope.
Returns
2*s_bot*y, ft.
Here is the caller graph for this function: