![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Classes | |
| struct | ClosureEval |
| A, T and I₁ at one depth, from one panel locate. More... | |
| struct | FaceFlux |
| Result of a face flux evaluation. More... | |
| struct | FaceState |
| One side of a face after hydrostatic reconstruction. More... | |
Functions | |
| OPENSWMM_KERNEL_FN void | closureLocate (const FvClosure &c, double h, int &i, double &t) noexcept |
| Locate a uniform depth panel and its clamped local coordinate. | |
| OPENSWMM_KERNEL_FN void | closureHermite (const FvClosure &c, int i, double t, double &a, double &dadh, double &int_dh) noexcept |
| Evaluate one cubic area panel, its derivative and its partial integral. | |
| OPENSWMM_KERNEL_FN ClosureEval | closureEval (const FvClosure &c, double h) noexcept |
| Evaluate area, top width and cumulative hydrostatic integral together. | |
| OPENSWMM_KERNEL_FN ClosureEval | closureEval (const FvClosure &c, double h, double &radius) noexcept |
| Evaluate closure area/width/integral and friction radius at one depth. | |
| OPENSWMM_KERNEL_FN double | closureArea (const FvClosure &c, double h) noexcept |
| Evaluate the closure flow area. | |
| OPENSWMM_KERNEL_FN double | closureWidth (const FvClosure &c, double h) noexcept |
| Evaluate the closure area derivative used as top width. | |
| OPENSWMM_KERNEL_FN double | closureI1 (const FvClosure &c, double h) noexcept |
| Evaluate the closure hydrostatic first moment. | |
| OPENSWMM_KERNEL_FN double | closureHydRad (const FvClosure &c, double h) noexcept |
| Evaluate the friction hydraulic radius. | |
| OPENSWMM_KERNEL_FN double | closureDepthOfArea (const FvClosure &c, double a) noexcept |
| Invert aggregate closure area using the same forward geometry. | |
| OPENSWMM_KERNEL_FN double | slotRamp (double s) noexcept |
| Evaluate the smooth slot-mouth opening fraction. | |
| OPENSWMM_KERNEL_FN double | slotRampIntegral (double s) noexcept |
| Integrate the normalized slot-mouth opening from zero to s. | |
| OPENSWMM_KERNEL_FN double | areaOfDepth (const FvGeometry &g, double h) noexcept |
| Evaluate memoryless slot area at a depth. | |
| OPENSWMM_KERNEL_FN double | widthOfDepth (const FvGeometry &g, double h) noexcept |
| Evaluate memoryless slot top width at a depth. | |
| OPENSWMM_KERNEL_FN double | hydRadOfDepth (const FvGeometry &g, double h) noexcept |
| Evaluate memoryless closure friction radius. | |
| OPENSWMM_KERNEL_FN double | i1OfDepth (const FvGeometry &g, double h, double area_at_h) noexcept |
| Evaluate the memoryless closure hydrostatic area integral. | |
| OPENSWMM_KERNEL_FN double | depthOfArea (const FvGeometry &g, double a) noexcept |
| Invert aggregate area on the memoryless closure. | |
| OPENSWMM_KERNEL_FN double | celerity (double a, double t) noexcept |
| Compute the gravity-wave speed from aggregate area and top width. | |
| OPENSWMM_KERNEL_FN void | waveSpeeds (const FaceState &L, const FaceState &R, double &sl, double &sr) noexcept |
| Estimate left and right signal speeds with dry-front and pressure-bore bounds. | |
| OPENSWMM_KERNEL_FN void | physicalFlux (const FaceState &S, double &fa, double &fq) noexcept |
| Evaluate the conservative Saint-Venant physical flux of one state. | |
| OPENSWMM_KERNEL_FN double | riemannMassFlux (const FaceState &L, const FaceState &R) noexcept |
| Evaluate only the HLL volumetric flux for an algebraic node residual. | |
| OPENSWMM_KERNEL_FN FaceFlux | riemannFlux (const FaceState &L, const FaceState &R) noexcept |
| Evaluate HLL hydraulic flux and the scalar contact-wave speed. | |
| OPENSWMM_KERNEL_FN double | speciesFlux (const FaceState &L, const FaceState &R, const FaceFlux &f, double phi_l, double phi_r, bool hllc) noexcept |
| Evaluate a conservative advected-scalar flux using the hydraulic fan. | |
| OPENSWMM_KERNEL_FN double | frictionUpdate (double q, double u, double r, double dt, double rough_factor) noexcept |
| Apply a semi-implicit Manning discharge sink. | |
| OPENSWMM_KERNEL_FN double | localLossUpdate (double q, double u, double k, double dx, double dt) noexcept |
| Apply a semi-implicit entrance/exit momentum loss over an end cell. | |
| OPENSWMM_KERNEL_FN double | ufUpdate (double q, double a, double u_old, double k3, double grad_term, double dt) noexcept |
| Apply the bounded unsteady-friction acceleration correction. | |
| OPENSWMM_KERNEL_FN double | tpaDepthOfArea (const FvGeometry &g, double a) noexcept |
| Evaluate the signed-pressure TPA area-to-head extension. | |
| OPENSWMM_KERNEL_FN double | tpaAreaOfDepth (const FvGeometry &g, double h) noexcept |
| Evaluate aggregate TPA area on the slot line in either pressure direction. | |
| OPENSWMM_KERNEL_FN double | tpaI1OfDepth (const FvGeometry &g, double h) noexcept |
| Evaluate the TPA pressure integral without numerical slot-storage pressure. | |
| OPENSWMM_KERNEL_FN double | faceCflDt (double cfl, double dx, double u, double c) noexcept |
| Compute a local advective/acoustic Courant timestep bound. | |
| OPENSWMM_KERNEL_FN double | positivityScale (double vol, double outflow, double dt) noexcept |
| Limit exported substep volume to the available donor water. | |
Variables | |
| constexpr double | kGravity = 32.2 |
| constexpr double | kDryDepth = 1.0e-7 |
| constexpr double | kDryArea = 1.0e-12 |
| Area floor paired with kDryDepth for the u = Q/A division. | |
| constexpr double | kEtaDeadband = 1.0e-12 |
|
noexcept |
Evaluate memoryless slot area at a depth.
Delegates to closureArea; the closure includes the tapered slot.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite native depth in ft; <=0 is dry and above-crown geometry follows the slot/vertical-wall continuation. |
|
noexcept |
Compute the gravity-wave speed from aggregate area and top width.
Guards do not validate NaN, infinity or overflow in positive inputs.
| [in] | a | Finite area in ft2; <=kDryArea returns zero. |
| [in] | t | Finite top width in ft; <=0 returns zero. |
|
noexcept |
Evaluate the closure flow area.
Uses the same polynomial/cubic or above-crown slot area as closureEval; no table ownership or state changes.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft; <=0 returns a zero/dry result, and >=y_full uses the analytic above-crown continuation. |
|
noexcept |
Invert aggregate closure area using the same forward geometry.
Polynomial geometry uses a cancellation-resistant quadratic inverse. Tabulated geometry locates the area bracket then performs at most 12 safeguarded Newton/bisection steps on its monotone cubic with 1e-15*y_full depth-step target. Returns the last iterate if that budget is exhausted; no convergence flag/error estimate is provided. Coherent monotone tables, valid LUT panel indices and positive slot width are caller preconditions. No allocation or mutation occurs.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | a | Finite aggregate area in ft2; <=0 returns zero. The sub-crown LUT coordinate must be int-representable. |
|
noexcept |
Evaluate area, top width and cumulative hydrostatic integral together.
Uses the open polynomial or one Hermite panel below the crown; Hermite width is floored at zero. At/above crown the linear slot/vertical-wall area and its exact integral are used. At h==0 width is zero by the dry convention.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft; <=0 returns a zero/dry result, and >=y_full uses the analytic above-crown continuation. |
|
noexcept |
Evaluate closure area/width/integral and friction radius at one depth.
Shares the panel locate while retaining the separate closureEval/closureHydRad arithmetic, including the linear radius interpolation. No persistent cache, allocation or geometry modification; intended for a cell's post-update closure.
| [in] | c | Initialized immutable closure, as required by closureEval. |
| [in] | h | Finite depth in ft; dry and above-crown conventions are unchanged. |
| [out] | radius | Per-barrel hydraulic radius in ft; must not alias c. |
|
noexcept |
Evaluate one cubic area panel, its derivative and its partial integral.
Output references must denote distinct storage and must not alias the closure samples. This pure scalar evaluation allocates nothing and reports no finite/monotonicity status.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | i | Valid panel index in [0,kClosurePanels-1], unchecked. |
| [in] | t | Dimensionless panel coordinate, normally [0,1]; extrapolation is not clamped. |
| [out] | a | Cubic area in aggregate ft2. |
| [out] | dadh | Raw dA/dh in aggregate ft; no nonnegative clamp. |
| [out] | int_dh | Integral from panel start to t in aggregate ft3, excluding c.I1[i]. |
|
noexcept |
Evaluate the friction hydraulic radius.
At/above crown returns r_full. Polynomial geometry divides aggregate area by aggregate wetted perimeter if positive; tabulated geometry linearly interpolates R rather than using the area cubic.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft; <=0 returns a zero/dry result, and >=y_full uses the analytic above-crown continuation. |
|
noexcept |
Evaluate the closure hydrostatic first moment.
Delegates to closureEval and returns its cumulative integral, including the analytic slot continuation.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft; <=0 returns a zero/dry result, and >=y_full uses the analytic above-crown continuation. |
|
noexcept |
Locate a uniform depth panel and its clamped local coordinate.
Conversion to int occurs before index clamping, so NaN/infinite/overflowing input is unsupported. Does not access table samples or allocate memory.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft with h*inv_dh representable as int; normally 0<=h<y_full. |
| [out] | i | Panel index in [0,kClosurePanels-1]. |
| [out] | t | Dimensionless coordinate within that panel, clamped to [0,1]. |
|
noexcept |
Evaluate the closure area derivative used as top width.
Hermite derivatives are floored at zero; at/above crown returns t_slot. The polynomial derivative is returned directly.
| [in] | c | Initialized immutable closure with positive y_full/dh, consistent monotone tables/index map and positive t_slot. Native areas/widths aggregate barrels; radius remains per barrel. |
| [in] | h | Finite depth in ft; <=0 returns a zero/dry result, and >=y_full uses the analytic above-crown continuation. |
|
noexcept |
Invert aggregate area on the memoryless closure.
Polynomial inversion is direct; tabulated inversion uses up to 12 guarded Newton steps on the same cubic as areaOfDepth. Returns the last iterate without convergence status if the iteration limit is reached. Positive slot width and valid monotone samples/index map are required.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | a | Finite aggregate flow area in ft2; <=0 returns zero. |
|
noexcept |
Compute a local advective/acoustic Courant timestep bound.
| [in] | cfl | Positive dimensionless Courant factor. |
| [in] | dx | Positive characteristic length in ft. |
| [in] | u | Finite advective velocity in ft/s. |
| [in] | c | Finite nonnegative wave celerity in ft/s. |
|
noexcept |
Apply a semi-implicit Manning discharge sink.
For valid nonnegative inputs the denominator is >=1 and does not reverse flow. No finite check or timestep limiter is applied.
| [in] | q | Candidate aggregate discharge in ft3/s, either sign. |
| [in] | u | Conveyance velocity in ft/s; magnitude determines resistance. |
| [in] | r | Per-barrel hydraulic radius in ft; <=0 disables the update. |
| [in] | dt | Nonnegative timestep in seconds. |
| [in] | rough_factor | Precomputed 32.2*(n/1.486)^2 in native Manning units, including any lengthening adjustment; <=0 disables the update. |
|
noexcept |
Evaluate memoryless closure friction radius.
Delegates to closureHydRad; above-crown radius stays r_full.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite native depth in ft; <=0 is dry and above-crown geometry follows the slot/vertical-wall continuation. |
|
noexcept |
Evaluate the memoryless closure hydrostatic area integral.
Uses the exact integral of the same panel polynomial/slot continuation as areaOfDepth, ensuring a single-valued pressure closure.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite native depth in ft; <=0 is dry and above-crown geometry follows the slot/vertical-wall continuation. |
| [in] | area_at_h | Unused compatibility value; the integral is computed entirely from the closure and h. |
|
noexcept |
Apply a semi-implicit entrance/exit momentum loss over an end cell.
| [in] | q | Candidate aggregate discharge in ft3/s. |
| [in] | u | Conveyance velocity in ft/s. |
| [in] | k | Dimensionless local-loss coefficient; <=0 leaves q unchanged. |
| [in] | dx | Positive cell length in ft; <=0 leaves q unchanged. |
| [in] | dt | Nonnegative timestep in seconds. |
|
noexcept |
Evaluate the conservative Saint-Venant physical flux of one state.
Output references must be distinct and must not alias S; no dry-state correction is applied.
| [in] | S | Finite, physically consistent aggregate face state. |
| [out] | fa | Mass/volume flux S.q in ft3/s. |
| [out] | fq | Momentum flux S.q*S.u+32.2*S.i1 in ft4/s2. |
|
noexcept |
Limit exported substep volume to the available donor water.
Returns one if outflow*dt<=max(vol,0), otherwise max(vol,0)/(outflow*dt). Caller must apply the identical scaled face flux to both incident ledgers to preserve conservation; this function does not mutate either state.
| [in] | vol | Finite available donor volume in ft3; negative volume is treated as zero. |
| [in] | outflow | Sum of outgoing volume rates in ft3/s; <=0 returns one. |
| [in] | dt | Substep duration in seconds; <=0 returns one. |
|
noexcept |
Evaluate HLL hydraulic flux and the scalar contact-wave speed.
Both dry returns a zero result. Supersonic flow selects one physical flux. A straddling fan uses HLL for the two hydraulic equations; contact speed is supplied only for advected scalar selection, with HLL-average fallback for a near-zero contact denominator. No hydrostatic side correction, positivity scaling, gate or culvert limit is applied here; callers apply those consistently afterward.
| [in] | L | Finite left reconstructed face state; area ft2, discharge ft3/s, velocity/celerity ft/s and integral ft3. |
| [in] | R | Finite right reconstructed state in the same aggregate geometry and left-to-right orientation. |
|
noexcept |
Evaluate only the HLL volumetric flux for an algebraic node residual.
Uses the same wave speeds and expression as riemannFlux.mass, including wet supersonic branches. Valid states must yield a nonzero fan width when the fan straddles zero; no separate degeneracy/error status is returned.
| [in] | L | Finite left reconstructed face state; area ft2, discharge ft3/s, velocity/celerity ft/s and integral ft3. |
| [in] | R | Finite right reconstructed state in the same aggregate geometry and left-to-right orientation. |
|
noexcept |
Evaluate the smooth slot-mouth opening fraction.
C1 continuous at both endpoints; no units, allocation or state.
| [in] | s | Finite normalized depth (h-y_crown)/(y_full-y_crown). |
|
noexcept |
Integrate the normalized slot-mouth opening from zero to s.
Multiply by slot width times taper height to obtain aggregate slot area in ft2.
| [in] | s | Finite normalized depth; negative values are treated as dry. |
|
noexcept |
Evaluate a conservative advected-scalar flux using the hydraulic fan.
HLL uses the physical-state discharges on supersonic branches. For a dry/dry result with zero signal speeds its left branch returns L.q*phi_l, so callers must supply zero discharge for dry states. No concentration clamp or positivity correction is performed here.
| [in] | L | Finite left reconstructed face state; area ft2, discharge ft3/s, velocity/celerity ft/s and integral ft3. |
| [in] | R | Finite right reconstructed state in the same aggregate geometry and left-to-right orientation. |
| [in] | f | Hydraulic FaceFlux computed from the same L/R states; required for consistent water/scalar transport. |
| [in] | phi_l | Finite left scalar concentration in the caller chosen species units. |
| [in] | phi_r | Finite right concentration in the same units. |
| [in] | hllc | True selects contact-speed upwind times f.mass; false uses the HLL scalar fan. |
|
noexcept |
Evaluate aggregate TPA area on the slot line in either pressure direction.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite piezometric depth in ft; no invert/crown clamp. |
|
noexcept |
Evaluate the signed-pressure TPA area-to-head extension.
Caller must select TPA-flagged closed cells and enforce admissible state; regime history is not read here.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | a | Finite aggregate area in ft2; no dry or lower-area clamp. |
|
noexcept |
Evaluate the TPA pressure integral without numerical slot-storage pressure.
Intentionally omits the quadratic slot-area pressure term; this is not the integral of tpaAreaOfDepth.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite signed piezometric depth in ft; no clamp. |
|
noexcept |
Apply the bounded unsteady-friction acceleration correction.
Returns q unchanged if both old and candidate velocities are below 0.01 ft/s. Otherwise folds local acceleration implicitly, adds the explicit gradient term, then caps the total discharge change to half abs(q). q==0 therefore remains zero. No neighboring state is read or changed by this scalar kernel.
| [in] | q | Candidate aggregate discharge in ft3/s. |
| [in] | a | Aggregate flow area in ft2; <=0 disables the update. |
| [in] | u_old | Consistent old-snapshot velocity in ft/s. |
| [in] | k3 | Nonnegative dimensionless unsteady-friction coefficient; <=0 disables the update. |
| [in] | grad_term | Old-snapshot celerity*sign(u_old)*abs(dV/dx), in ft/s2. |
| [in] | dt | Nonnegative substep duration in seconds. |
|
noexcept |
Estimate left and right signal speeds with dry-front and pressure-bore bounds.
Both dry gives zero speeds; one wet side uses its rarefaction tail u±2c. Wet/wet uses Davis bounds, narrowed by a Rankine-Hugoniot bore estimate at interior slot/free interfaces (press 0 versus 1). press==2 node ghosts are excluded from that narrowing. Inputs must carry physically consistent area/discharge/velocity and nonnegative celerity; no validation occurs.
| [in] | L | Finite left reconstructed face state; area ft2, discharge ft3/s, velocity/celerity ft/s and integral ft3. |
| [in] | R | Finite right reconstructed state in the same aggregate geometry and left-to-right orientation. |
| [out] | sl | Left signal speed in ft/s. |
| [out] | sr | Right signal speed in ft/s. |
|
noexcept |
Evaluate memoryless slot top width at a depth.
Delegates to closureWidth; at/above the crown returns the slot or open-section continuation width.
| [in] | g | Borrowed initialized geometry with valid closure table, positive full depth/slot width and monotone samples; no pointer is retained. |
| [in] | h | Finite native depth in ft; <=0 is dry and above-crown geometry follows the slot/vertical-wall continuation. |
|
inlineconstexpr |
Area floor paired with kDryDepth for the u = Q/A division.
|
inlineconstexpr |
Depth below which a cell is treated as dry: no velocity, no flux, no celerity contribution. The threshold is 1e-7 ft; the separate area floor guards Q/A divisions in callers.
|
inlineconstexpr |
Free-surface difference below which a face is treated as exactly level. Without it the momentum update integrates 1-ulp closure round-trip noise; 1e-12 ft is far below any physical head.
|
inlineconstexpr |
Gravity in internal units. Matches constants::GRAVITY — spelled here so the header stays dependency-free for the plugin build.