OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SectionGeometry.hpp File Reference

Exact cross-section geometry — area, top width and wetted perimeter as closed forms of the section's defining dimensions. More...

#include <algorithm>
#include <cmath>
#include "../XSectBatch.hpp"
Include dependency graph for SectionGeometry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::fv
 
namespace  openswmm::fv::secgeom
 
namespace  openswmm::fv::secgeom::detail
 

Functions

double openswmm::fv::secgeom::detail::circTheta (double r, double y)
 Evaluate the central angle of a circular water segment.
 
double openswmm::fv::secgeom::detail::circArea (double r, double y)
 Evaluate the exact wetted area of a circular segment.
 
double openswmm::fv::secgeom::detail::circWidth (double r, double y)
 Evaluate the exact circular free-surface chord width.
 
double openswmm::fv::secgeom::detail::circPerim (double r, double y)
 Evaluate the exact submerged circular arc length.
 
template<class F>
double openswmm::fv::secgeom::detail::simpsonStep (F &f, double a, double b, double fa, double fm, double fb, double whole, double eps, int depth)
 Recursively refine a cached Simpson panel to an absolute error target.
 
template<class F>
double openswmm::fv::secgeom::detail::integrate (F f, double a, double b, double eps=1.0e-12, int depth=40)
 Integrate a scalar function with adaptive Simpson quadrature.
 
double openswmm::fv::secgeom::detail::ellipsePerim (double ax, double by, double y)
 Integrate the submerged arc of a mathematical ellipse.
 
bool openswmm::fv::secgeom::hasClosedForm (int type)
 Identify shapes with an analytic area/width and direct or quadrature perimeter here.
 
bool openswmm::fv::secgeom::isPolynomialOpen (int type)
 Identify open sections represented by quadratic area and linear perimeter.
 
double openswmm::fv::secgeom::areaOfDepth (const XSectParams &xs, double h)
 Evaluate per-barrel flow area for the FV closure builder.
 
double openswmm::fv::secgeom::widthOfDepth (const XSectParams &xs, double h)
 Evaluate per-barrel top width including the invert boundary value.
 
double openswmm::fv::secgeom::perimeterOfDepth (const XSectParams &xs, double h)
 Evaluate per-barrel wetted perimeter for FV geometry sampling.
 
double openswmm::fv::secgeom::hydRadOfDepth (const XSectParams &xs, double h)
 Evaluate per-barrel hydraulic radius for the FV closure builder.
 

Variables

constexpr double openswmm::fv::secgeom::kPi = 3.14159265358979323846
 
constexpr double openswmm::fv::secgeom::kRectAlfMax = 0.97
 

Detailed Description

Exact cross-section geometry — area, top width and wetted perimeter as closed forms of the section's defining dimensions.

Build-time only (plan FV1D_CLOSURE_KERNEL_PERF_PLAN_2026-09-11 §2a′): the FV closure tables are sampled from these functions, never from the legacy 51-row lookup tables, so the solver's geometry is the section to interpolation accuracy rather than to table accuracy. Full-precision π; no legacy operand-order constraints — this header is not under the dynamic-wave bit-parity contract and must not be used by the dynamic-wave path.

Closed forms exist for CIRCULAR, FORCE_MAIN, FILLED_CIRCULAR, RECT_CLOSED, RECT_OPEN, TRAPEZOIDAL, TRIANGULAR, PARABOLIC and POWERFUNC (hasClosedForm). Every other shape — the composites RECT_TRIANG / RECT_ROUND / MOD_BASKET, the table-defined ARCH / EGGSHAPED / HORSESHOE / GOTHIC / CATENARY / SEMIELLIPTICAL / BASKETHANDLE / SEMICIRCULAR, and the transect shapes IRREGULAR / CUSTOM / STREET — is evaluated through the legacy evaluator, whose table (or piecewise formula) is that shape's definition. The closure built from them still gains the derivative pair T ≡ dA/dh and I₁ ≡ ∫A, which the legacy tables lack.

HORIZ_ELLIPSE and VERT_ELLIPSE are table-defined on purpose: SWMM's elliptical pipes are the standard elliptical concrete-pipe profiles, not mathematical ellipses — measured against a true ellipse of the same height and width, the legacy 3×4 ft horizontal section carries 21 % more full area and a different perimeter. Treating them as ellipses would silently change what the shape keyword means.

Everything here is a plain function over XSectParams, host-only (acos, adaptive quadrature), and may be freely reused by a later dynamic-wave program under its own gates.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0