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

Face kernels for MOMENTUM_EQUATION FULL_SWE — the conservative shallow-water equations with the convective term and shock capturing (plans/2D_FULL_SWE_SHOCK_CAPTURING_PLAN_2026-09-05.md §2.2). More...

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

Go to the source code of this file.

Classes

struct  openswmm::twoD::swe::FaceSide
 
struct  openswmm::twoD::swe::FaceFlux
 

Namespaces

namespace  openswmm
 
namespace  openswmm::twoD
 
namespace  openswmm::twoD::swe
 

Macros

#define OPENSWMM_KERNEL_FN   inline
 

Functions

OPENSWMM_KERNEL_FN void openswmm::twoD::swe::physicalFlux (const FaceSide &s, double &fh, double &fn, double &ft) noexcept
 Physical flux of the SWE in the normal frame: [h·un, h·un² + ½g h², h·un·ut].
 
OPENSWMM_KERNEL_FN void openswmm::twoD::swe::waveSpeeds (const FaceSide &L, const FaceSide &R, double &sl, double &sr) noexcept
 
OPENSWMM_KERNEL_FN void openswmm::twoD::swe::hllcFlux (const FaceSide &L, const FaceSide &R, double &fh, double &fn, double &ft, double &sstar) noexcept
 HLLC flux in the face-normal frame.
 
OPENSWMM_KERNEL_FN bool openswmm::twoD::swe::faceFlux (double etaL, double hL, double qxL, double qyL, double etaR, double hR, double qxR, double qyR, double nx, double ny, double h_dry, FaceFlux &out, double &corrL_x, double &corrL_y, double &corrR_x, double &corrR_y) noexcept
 Full face evaluation: hydrostatic reconstruction, rotation, HLLC, rotation back, and the per-side bed-slope corrections.
 
OPENSWMM_KERNEL_FN bool openswmm::twoD::swe::faceFluxRecon (double etaLf, double uxLf, double uyLf, double zL, double hL_cell, double etaRf, double uxRf, double uyRf, double zR, double hR_cell, double nx, double ny, double h_dry, FaceFlux &out, double &corrL_x, double &corrL_y, double &corrR_x, double &corrR_y) noexcept
 Face flux from RECONSTRUCTED side states (RECONSTRUCTION_ORDER 2).
 
OPENSWMM_KERNEL_FN double openswmm::twoD::swe::bjLimiter (double w, double wf, double wmin, double wmax) noexcept
 
OPENSWMM_KERNEL_FN void openswmm::twoD::swe::frictionUpdate (double &qx, double &qy, double h, double n, double dt) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::swe::criticalDepth (double q) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::swe::depthFromInvariantAndDischarge (double r, double q, double h_interior) noexcept
 Ghost depth of a SUBCRITICAL prescribed-discharge boundary.
 

Variables

constexpr double openswmm::twoD::swe::kGravity = 9.80665
 

Detailed Description

Face kernels for MOMENTUM_EQUATION FULL_SWE — the conservative shallow-water equations with the convective term and shock capturing (plans/2D_FULL_SWE_SHOCK_CAPTURING_PLAN_2026-09-05.md §2.2).

Cell state (h, q⃗ = h·u⃗) per cell; a face between cells L and R with unit normal n̂ (L→R) evaluates one Godunov flux:

  1. Hydrostatic reconstruction (Audusse et al. 2004) against the face bed z_f = max(z_L, z_R), z_side = η_side − h_side: h*_L = max(0, η_L − z_f), h*_R = max(0, η_R − z_f)
  2. Rotate the velocities into the (n̂, t̂) frame, t̂ = (−n_y, n_x).
  3. HLLC (Toro 2001) on U = [h, h·u_n, h·u_t]: HLL for mass and normal momentum, tangential momentum upwinded on the contact speed S*. Wave speeds from the two-rarefaction estimate with the dry-bed limits.
  4. Rotate the momentum flux back to (x, y).
  5. Bed-slope source per side, ½·g·(h*² − h²)·n̂ (the Audusse correction): at rest the HLLC flux is [0, ½g h*², 0] and the correction cancels it face by face, so a lake at rest over any bed is an exact steady state (C-property).

Friction is applied per cell after the flux update, semi-implicit (the same division the local-inertial face law uses), which can only shrink |q⃗| and never reverses it (Liang & Marche 2009's stopping condition is satisfied by construction).

Everything is plain scalar arithmetic over raw values so the same bodies can be annotated for Kokkos later (OPENSWMM_KERNEL_FN).

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

Macro Definition Documentation

◆ OPENSWMM_KERNEL_FN

#define OPENSWMM_KERNEL_FN   inline