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

Classes

struct  CulvertCurve
 Inlet-control curve coefficients for one culvert type code. More...
 

Functions

OPENSWMM_KERNEL_FN double fricSlopeHW (double velocity, double hyd_rad, double c_hw) noexcept
 Compute Hazen-Williams friction slope from velocity and hydraulic radius.
 
OPENSWMM_KERNEL_FN double fricSlopeDW (double velocity, double hyd_rad, double roughness) noexcept
 Compute Darcy-Weisbach slope with laminar or Swamee-Jain friction factor.
 
OPENSWMM_KERNEL_FN double culvertInflow (double q_proposed, double head, double y_full, double a_full, double slope, const CulvertCurve &cc, bool mitered, double &dqdh) noexcept
 Limit proposed culvert flow by a three-regime inlet-control curve.
 

Variables

constexpr double kViscosity = 1.1e-5
 
constexpr double kGravity = 32.2
 Gravity in internal units, matching constants::GRAVITY.
 

Function Documentation

◆ culvertInflow()

OPENSWMM_KERNEL_FN double openswmm::hydkernels::culvertInflow ( double q_proposed,
double head,
double y_full,
double a_full,
double slope,
const CulvertCurve & cc,
bool mitered,
double & dqdh )
noexcept

Limit proposed culvert flow by a three-regime inlet-control curve.

Uses unsubmerged h/D<=0.95, submerged above derived transition, linear interpolation between. No global finite/geometry validation, donor cap or sign handling.

Parameters
[in]q_proposedNonnegative proposed native cfs discharge.
[in]headUpstream headwater above invert ft; nonpositive bypasses control.
[in]y_fullPositive full culvert depth ft; nonpositive bypasses.
[in]a_fullPositive full area ft2; nonpositive bypasses.
[in]slopeFinite conduit slope ft/ft used for inlet correction.
[in]ccBorrowed valid FHWA coefficients K/M/C/Y; K=0 bypasses, physical branches require valid positive divisors.
[in]miteredTrue uses-7*slope correction, false+0.5*slope.
[out]dqdhSet0 first, then derivative of the inlet curve in cfs/ft when evaluated; can remain nonzero even if q_proposed is the returned minimum.
Returns
min(proposed,inlet) cfs on evaluated branch; proposed unchanged for bypass/invalid curve arguments.

◆ fricSlopeDW()

OPENSWMM_KERNEL_FN double openswmm::hydkernels::fricSlopeDW ( double velocity,
double hyd_rad,
double roughness )
noexcept

Compute Darcy-Weisbach slope with laminar or Swamee-Jain friction factor.

Uses diameter4R, viscosity1.1e-5ft2/s and gravity32.2ft/s2. Re<=2000 selects64/Re; higher selects explicit turbulent approximation. No transition blending or general finite guard.

Parameters
[in]velocitySigned native ft/s, magnitude used.
[in]hyd_radPositive native ft radius; <=0 returns0.
[in]roughnessNonnegative absolute roughness height ft, caller-validated.
Returns
Dimensionless nonnegative friction slope for finite physical inputs;0 for nonpositive radius/Re or logarithm argument.
Here is the caller graph for this function:

◆ fricSlopeHW()

OPENSWMM_KERNEL_FN double openswmm::hydkernels::fricSlopeHW ( double velocity,
double hyd_rad,
double c_hw )
noexcept

Compute Hazen-Williams friction slope from velocity and hydraulic radius.

Uses (abs(v)/(1.318*C*R^0.63))^(1/0.54); no general finite checks or source-direction sign.

Parameters
[in]velocitySigned ft/s velocity; formula uses magnitude.
[in]hyd_radPositive hydraulic radius ft; <=0 returns0.
[in]c_hwPositive Hazen-Williams C coefficient; <=0 returns0.
Returns
Dimensionless nonnegative friction slope for finite physical inputs.
Here is the caller graph for this function:

Variable Documentation

◆ kGravity

double openswmm::hydkernels::kGravity = 32.2
inlineconstexpr

Gravity in internal units, matching constants::GRAVITY.

◆ kViscosity

double openswmm::hydkernels::kViscosity = 1.1e-5
inlineconstexpr

Kinematic viscosity of water, ft²/s. Spelled here rather than included so the header stays dependency-free for the plugin build; it must equal constants::VISCOS, and a static_assert in ForceMain.cpp holds it to that.