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

Single-source scalar kernels for the explicit FV 1D network solver. More...

#include <algorithm>
#include <cmath>
#include "FvOptions.hpp"
#include "NetworkMeshData.hpp"
Include dependency graph for FvKernels.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmm::fv::kernels::FaceState
 One side of a face after hydrostatic reconstruction. More...
 
struct  openswmm::fv::kernels::FaceFlux
 Result of a face flux evaluation. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::fv
 
namespace  openswmm::fv::kernels
 

Functions

OPENSWMM_KERNEL_FN double openswmm::fv::kernels::slotRamp (double s) noexcept
 Evaluate the smooth slot-mouth opening fraction.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::slotRampIntegral (double s) noexcept
 Integrate the normalized slot-mouth opening from zero to s.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::areaOfDepth (const FvGeometry &g, double h) noexcept
 Evaluate memoryless slot area at a depth.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::widthOfDepth (const FvGeometry &g, double h) noexcept
 Evaluate memoryless slot top width at a depth.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::hydRadOfDepth (const FvGeometry &g, double h) noexcept
 Evaluate memoryless closure friction radius.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::i1OfDepth (const FvGeometry &g, double h, double area_at_h) noexcept
 Evaluate the memoryless closure hydrostatic area integral.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::depthOfArea (const FvGeometry &g, double a) noexcept
 Invert aggregate area on the memoryless closure.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::celerity (double a, double t) noexcept
 Compute the gravity-wave speed from aggregate area and top width.
 
OPENSWMM_KERNEL_FN void openswmm::fv::kernels::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 openswmm::fv::kernels::physicalFlux (const FaceState &S, double &fa, double &fq) noexcept
 Evaluate the conservative Saint-Venant physical flux of one state.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::riemannMassFlux (const FaceState &L, const FaceState &R) noexcept
 Evaluate only the HLL volumetric flux for an algebraic node residual.
 
OPENSWMM_KERNEL_FN FaceFlux openswmm::fv::kernels::riemannFlux (const FaceState &L, const FaceState &R) noexcept
 Evaluate HLL hydraulic flux and the scalar contact-wave speed.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::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 openswmm::fv::kernels::frictionUpdate (double q, double u, double r, double dt, double rough_factor) noexcept
 Apply a semi-implicit Manning discharge sink.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::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 openswmm::fv::kernels::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 openswmm::fv::kernels::tpaDepthOfArea (const FvGeometry &g, double a) noexcept
 Evaluate the signed-pressure TPA area-to-head extension.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::tpaAreaOfDepth (const FvGeometry &g, double h) noexcept
 Evaluate aggregate TPA area on the slot line in either pressure direction.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::tpaI1OfDepth (const FvGeometry &g, double h) noexcept
 Evaluate the TPA pressure integral without numerical slot-storage pressure.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::faceCflDt (double cfl, double dx, double u, double c) noexcept
 Compute a local advective/acoustic Courant timestep bound.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::positivityScale (double vol, double outflow, double dt) noexcept
 Limit exported substep volume to the available donor water.
 

Variables

constexpr double openswmm::fv::kernels::kGravity = 32.2
 
constexpr double openswmm::fv::kernels::kDryDepth = 1.0e-7
 
constexpr double openswmm::fv::kernels::kDryArea = 1.0e-12
 Area floor paired with kDryDepth for the u = Q/A division.
 
constexpr double openswmm::fv::kernels::kEtaDeadband = 1.0e-12
 

Detailed Description

Single-source scalar kernels for the explicit FV 1D network solver.

The numerical core of ExplicitFvSolver: the Preissmann-slot cross- section closure, hydrostatic (Audusse) face reconstruction, the HLL/HLLC flux for the conservative St. Venant system, semi-implicit Manning friction, and the CFL bound. Everything is a plain inline function over scalars and const references to POD — no owning containers, no allocation, no exceptions — so the identical bodies compile for the CPU solver and, annotated, for the Kokkos device backend. Same pattern as 2d/solver/InertialKernels.hpp.

Scheme summary (face between cells L,R; flux positive L→R; internal US units, g = 32.2 ft/s²):

U = [A, Q] conserved across all barrels F = [Q, Q·u + g·I₁(h)] physical flux I₁ = ∫₀ʰ A(η)dη hydrostatic first moment c = √(g·A/T) wave celerity

Hydrostatic reconstruction (Audusse et al. 2004):

z* = max(z_L, z_R) h*_K = max(0, η_K − z*), u*_K = u_K F = HLLC(U*_L, U*_R) F_L^corrected = F + [0, g(I₁(h_L) − I₁(h*_L))] F_R^corrected = F + [0, g(I₁(h_R) − I₁(h*_R))]

At rest (η_L = η_R) the HLLC flux reduces to [0, g·I₁(h*)] and the correction leaves g·I₁(h_i) at BOTH faces of cell i, so the momentum divergence is exactly zero for any bed — lake-at-rest holds to machine precision, and it holds regardless of the quadrature error in the I₁ table because only single-valuedness is required.

See also
plans/EXPLICIT_FV_KOKKOS_1D_SOLVER_PLAN.md §3.2, §3.3
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0