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

Implementation of gradient computation, slope limiting, and edge fluxes. More...

#include "SurfaceFluxCalculator.hpp"
#include "InertialKernels.hpp"
#include "../data/BoundaryData.hpp"
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <limits>
Include dependency graph for SurfaceFluxCalculator.cpp:

Namespaces

namespace  openswmm
 
namespace  openswmm::twoD
 

Functions

void openswmm::twoD::computeUnlimitedGradients (const MeshData &mesh, SurfaceStateData &state, int nthreads=1)
 Compute unlimited gradients for all triangles via Green-Gauss theorem.
 
void openswmm::twoD::computeLimitedGradients (const MeshData &mesh, SurfaceStateData &state, double epsilon, int nthreads=1)
 Apply Jawahar-Kamath slope limiter (Eq. [23]–[24]).
 
void openswmm::twoD::computeCellContinuity (const MeshData &mesh, SurfaceStateData &state, const SolverOptions2D &opts, double dt)
 Compute the per-cell continuity residual (local mass-balance check).
 
void openswmm::twoD::computeFaceVelocity (const MeshData &mesh, SurfaceStateData &state, const SolverOptions2D &opts)
 Reconstruct diagnostic cell velocity from wetted-edge normal velocities.
 
double openswmm::twoD::computeBoundaryEdgeFlux (const MeshData &mesh, const SurfaceStateData &state, const SolverOptions2D &opts, double dh_eps, int i, int idx) noexcept
 Boundary-edge flux for cell i across flat mesh edge slot idx (m³/s, inflow-positive). Exported wrapper over the file-local boundary kernel for host boundary queries. Explicit inertial marchers may use their own prognostic stage-boundary update instead.
 
OPENSWMM_KERNEL_FN double openswmm::twoD::faceDepthFromEta (double eta, double z_lo, double z_hi) noexcept
 Wetted-edge flow depth from a free surface η over an edge with endpoint beds z_lo ≤ z_hi — Begnudelli & Sanders (2007) Eq. 14, the exact cross-sectional water area divided by the full edge length: η ≤ z_lo : 0 (wetting gate: bed above water) z_lo < η ≤ z_hi : (η − z_lo)² / (2(z_hi − z_lo)) (partially submerged) η > z_hi : η − (z_lo + z_hi)/2 (fully submerged: mean depth) The quadratic branch matches value AND slope at both joins (C¹), so overtopping onset is smooth. Single source for the CPU boundary path, the GPU boundary kernels, and the VFR interior-face path — byte-identical to the copies it replaced in SurfaceFluxCalculator.cpp and ExplicitKokkosSurfaceSolver.cpp.
 

Detailed Description

Implementation of gradient computation, slope limiting, and edge fluxes.

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