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::sectionArea (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::sectionWidth (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::sectionHydRad (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::slotRamp (double s) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::slotRampIntegral (double s) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::areaOfDepth (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::widthOfDepth (const FvGeometry &g, double h) noexcept
 Top width dA/dh at depth h, INCLUDING the tapered slot.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::hydRadOfDepth (const FvGeometry &g, double h) noexcept
 Hydraulic radius at depth h.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::i1OfDepth (const FvGeometry &g, double h, double area_at_h) noexcept
 Hydrostatic first moment I₁(h) = ∫₀ʰ A(η)dη.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::depthOfAreaBracketed (const FvGeometry &g, double a) noexcept
 Invert A → h — the EXACT inverse of areaOfDepth above.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::depthOfArea (const FvGeometry &g, double a) noexcept
 Invert A → h. Same root as depthOfAreaBracketed, found far faster.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::celerity (double a, double t) noexcept
 
OPENSWMM_KERNEL_FN void openswmm::fv::kernels::waveSpeeds (const FaceState &L, const FaceState &R, double &sl, double &sr) noexcept
 
OPENSWMM_KERNEL_FN void openswmm::fv::kernels::physicalFlux (const FaceState &S, double &fa, double &fq) noexcept
 Physical flux of one state.
 
OPENSWMM_KERNEL_FN FaceFlux openswmm::fv::kernels::riemannFlux (const FaceState &L, const FaceState &R) noexcept
 Flux for the conservative St. Venant system, plus the contact 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
 Species flux for the A(phi) component.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::frictionUpdate (double q, double u, double r, double dt, double rough_factor) noexcept
 Semi-implicit Manning friction — unconditionally stable, so friction imposes no time-step restriction.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::localLossUpdate (double q, double u, double k, double dx, double dt) noexcept
 Semi-implicit entrance/exit loss at a node-coupling face.
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::ufUpdate (double q, double a, double u_old, double k3, double grad_term, double dt) noexcept
 Unsteady-friction momentum update (issue #156).
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::tpaDepthOfArea (const FvGeometry &g, double a) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::tpaAreaOfDepth (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::tpaI1OfDepth (const FvGeometry &g, double h) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::faceCflDt (double cfl, double dx, double u, double c) noexcept
 CFL-limited step for one face: α·Δx/(|u| + c).
 
OPENSWMM_KERNEL_FN double openswmm::fv::kernels::positivityScale (double vol, double outflow, double dt) noexcept
 Positivity scale for a cell about to export more volume than it holds.
 

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 per barrel 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\n Apache-2.0