OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::twoD::gpu::swe_kernels Namespace Reference

Classes

struct  Gradients
 
struct  Mesh
 
struct  State
 
struct  Transfers
 

Functions

void gradients (const Mesh &mesh, const State &state, const Gradients &grad, const IView &cells, int count, double dry)
 Launch connected-wet-neighbor reconstruction for eta, velocity and depth gradients.
 
void faces (const Mesh &mesh, const State &state, const Gradients &grad, const Transfers &acc, const IView &face_list, int count, const IView &face_tier, double dt, double dry, double beta, bool second_order, bool global_step)
 Launch one Euler stage's interior-face water and momentum receipt booking.
 
void gather (const Mesh &mesh, const State &state, const Transfers &acc, const IView &cells, int count, const DView &dmx, const DView &dmy)
 Gather and clear selected cells' owned interior-face receipt sides.
 
void momentum (const Mesh &mesh, const State &state, const IView &cells, int count, const DView &dmx, const DView &dmy, const IView &wall_ptr, const IView &wall_slot, const DView &roughness, double dt, double dry)
 Launch selected-cell momentum adoption with physical-wall pressure and Manning friction.
 
void averageLedger (const DView &initial, const DView &live)
 Retain half the two-stage increment of a cumulative RK2 ledger.
 

Function Documentation

◆ averageLedger()

void openswmm::twoD::gpu::swe_kernels::averageLedger ( const DView & initial,
const DView & live )
inline

Retain half the two-stage increment of a cumulative RK2 ledger.

Parameters
[in]initialDevice snapshot before either Euler stage, with the same extent as live.
[in,out]liveDevice ledger after both stage increments; each entry becomes initial + 0.5*(live-initial), in the ledger's own physical units.
Note
Views must not alias and must remain alive/device-accessible through completion. Launches on ExecSpace without an explicit fence; caller orders producers/consumers and excludes other writers. No extents, finite values or int-index range are checked. This is ledger averaging only, not a hydraulic/quality state or closure update; runtime launch errors may propagate.

◆ faces()

void openswmm::twoD::gpu::swe_kernels::faces ( const Mesh & mesh,
const State & state,
const Gradients & grad,
const Transfers & acc,
const IView & face_list,
int count,
const IView & face_tier,
double dt,
double dry,
double beta,
bool second_order,
bool global_step )
inline

Launch one Euler stage's interior-face water and momentum receipt booking.

Parameters
[in]meshPrepared SI unique-face geometry, CSR-related metadata, cell areas/counts and finite nonnegative conveyance, with all view extents covering referenced cells/faces.
[in]stateStable head/depth m, volume m3, momentum qx/qy m2/s and integer cell tiers.
[in]gradPrepared four-block x/y gradients, required when second_order is true.
[in,out]accDevice per-face receipt views. Adds signed water m3 and integrated x/y momentum m4/s to left/right sides, and overwrites discharge m2/s. A blocked face only sets its discharge to zero; previously queued receipt accumulators remain for their owner's gather.
[in]face_listDevice list with at least count valid distinct interior-face indices.
[in]countNonnegative number of listed faces.
[in]face_tierDevice tier per face. In LTS mode giver tier minus face tier must be a valid nonnegative int shift count; hierarchy/refire consistency belongs to the caller.
[in]dtFinite nonnegative face interval s.
[in]dryFinite positive wet/dry threshold m.
[in]betaFinite donor availability fraction in [0,1], divided across giver faces/refires.
[in]second_orderTrue reconstructs eta/velocity/depth at faces; false uses cell states.
[in]global_stepTrue uses one refire, otherwise tier differences scale each face's budget.

Riemann pressure corrections are not multiplied by conveyance; donor limiting scales water and advective/Riemann momentum together. Equal/opposite water receipts preserve pairing; this kernel changes neither cell volume nor canonical qx/qy.

Note
Launches on ExecSpace without an explicit fence. All views must be device-accessible, correctly sized and alive through completion; caller orders dependent kernels/copies and excludes conflicting writes. Input counts/indices/geometry are unchecked, listed cells/faces must be unique, and runtime launch/allocation errors may propagate. These are experimental building blocks, not a registered complete FULL_SWE solver or a complete RK2 stage.
Here is the call graph for this function:

◆ gather()

void openswmm::twoD::gpu::swe_kernels::gather ( const Mesh & mesh,
const State & state,
const Transfers & acc,
const IView & cells,
int count,
const DView & dmx,
const DView & dmy )
inline

Gather and clear selected cells' owned interior-face receipt sides.

Parameters
[in]meshPrepared CSR incidence/side-sign views with valid unique-face indices.
[in,out]stateAdds gathered water to selected volume m3 and floors at zero; head/depth and qx/qy are untouched and must be refreshed/advanced by the stage owner.
[in,out]accConsumes and zeros each listed cell's left or right water/momentum receipts. The opposite cell's side and instantaneous discharge are retained.
[in]cellsDevice list of at least count valid distinct cells.
[in]countNonnegative selected cell count.
[out]dmxDevice per-cell x integrated momentum increment m4/s; selected entries overwritten.
[out]dmyDevice per-cell y integrated momentum increment m4/s; selected entries overwritten.

Performs no closure, boundary wall pressure, friction, source update or RK averaging. Receipt views and outputs must not alias state or each other in conflicting ways.

Note
Launches on ExecSpace without an explicit fence. All views must be device-accessible, correctly sized and alive through completion; caller orders dependent kernels/copies and excludes conflicting writes. Input counts/indices/geometry are unchecked, listed cells/faces must be unique, and runtime launch/allocation errors may propagate. These are experimental building blocks, not a registered complete FULL_SWE solver or a complete RK2 stage.

◆ gradients()

void openswmm::twoD::gpu::swe_kernels::gradients ( const Mesh & mesh,
const State & state,
const Gradients & grad,
const IView & cells,
int count,
double dry )
inline

Launch connected-wet-neighbor reconstruction for eta, velocity and depth gradients.

Parameters
[in]meshPrepared SI cell/unique-face/CSR geometry. Per-cell arrays span n, CSR row pointers n+1, incidence arrays their terminal pointer and padded boundary/slot arrays 4*n. Cells have three/four vertices, valid reciprocal faces, positive finite area and distinct centroids.
[in]stateStable cell head/depth m, qx/qy m2/s and active mask spanning n=depth.extent(0).
[out]gradDevice x/y output views, each at least 4*n doubles, in contiguous blocks for eta, u, v and depth; gradient units are dimensionless, 1/s, 1/s and dimensionless respectively.
[in]cellsDevice list with at least count valid distinct cell indices.
[in]countNonnegative number of selected cells to overwrite; unlisted gradients are retained.
[in]dryFinite positive wet/dry depth threshold m. Cells <=10*dry get zero gradients; dry/inactive/disconnected neighbors are excluded, with conditioned wet-neighbor fits at shore.

Physical boundaries complete the Green-Gauss sum by self extrapolation. Shore velocity gradients remain zero; BJ bounds and omitted-face depth positivity constrain reconstructed fields.

Note
Launches on ExecSpace without an explicit fence. All views must be device-accessible, correctly sized and alive through completion; caller orders dependent kernels/copies and excludes conflicting writes. Input counts/indices/geometry are unchecked, listed cells/faces must be unique, and runtime launch/allocation errors may propagate. These are experimental building blocks, not a registered complete FULL_SWE solver or a complete RK2 stage.
Here is the call graph for this function:

◆ momentum()

void openswmm::twoD::gpu::swe_kernels::momentum ( const Mesh & mesh,
const State & state,
const IView & cells,
int count,
const DView & dmx,
const DView & dmy,
const IView & wall_ptr,
const IView & wall_slot,
const DView & roughness,
double dt,
double dry )
inline

Launch selected-cell momentum adoption with physical-wall pressure and Manning friction.

Parameters
[in]meshPrepared positive cell areas m2 and padded four-slot boundary geometry.
[in,out]stateSelected qx/qy m2/s are updated from gathered increments and wall receipts; depth/head must already reflect current volume/source closure and remain stable through this call. Cells at/below dry have both momentum components reset to zero.
[in]cellsDevice list with at least count valid distinct selected cells.
[in]countNonnegative selected cell count.
[in]dmxDevice per-cell integrated x momentum receipts m4/s from gather().
[in]dmyDevice per-cell integrated y momentum receipts m4/s.
[in]wall_ptrDevice CSR pointers, n+1, into wall_slot, enumerating only physical WALL slots.
[in]wall_slotDevice padded slot indices matching each selected cell's physical boundaries.
[in]roughnessDevice finite nonnegative Manning n per cell, s/m^(1/3).
[in]dtFinite nonnegative momentum/friction interval s.
[in]dryFinite positive dry-depth threshold m.

Adds reflected-ghost wall pressure, divides integrated momentum by cell area and applies friction. Non-wall boundary forcing and live node exchange are separately ordered stage work.

Note
Launches on ExecSpace without an explicit fence. All views must be device-accessible, correctly sized and alive through completion; caller orders dependent kernels/copies and excludes conflicting writes. Input counts/indices/geometry are unchecked, listed cells/faces must be unique, and runtime launch/allocation errors may propagate. These are experimental building blocks, not a registered complete FULL_SWE solver or a complete RK2 stage.
Here is the call graph for this function: