flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
block_batch.hpp File Reference

flow — batched execution of the VoF block container's stages (C1, doc/vof_step_performance_design.md §4.6, §5.9). More...

#include <Kokkos_Core.hpp>
#include "mac_stencils.hpp"
#include "vof/advect_wy.hpp"
#include "vof/curvature_field.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::vof::VofRawMask
 Read-only raw accessor of an unsigned-char field (the WO-R out-of-domain mask). More...
 
struct  peclet::flow::vof::VofBlockJob
 One master block's share of a batched container launch. More...
 
struct  peclet::flow::vof::VofBlockTable
 The job table of one launch, by value. More...
 
struct  peclet::flow::vof::VofCountTable
 The exact offset table of a host list launch: job k's entries are [o[k], o[k + 1]). More...
 
struct  peclet::flow::vof::VofRowTable
 The row offsets of a host region launch: job k's rows are [off[k], off[k + 1]). More...
 
struct  peclet::flow::vof::VofDebrisFlags
 Flags of the pass, uniform over the blocks. More...
 
struct  peclet::flow::vof::VofCurvJob
 One master block's cascade (VofCurvature, worklist mode) for the batched launches: its planes, curvature, branch and force fields, and every argument the per-cascade passes give the shared cell bodies (wyReconstructCell, curvHeightCell, curvFallbackCell, the clip, the census, csfFaceCurvature + csfFaceForce). More...
 
struct  peclet::flow::vof::VofCurvTable
 
struct  peclet::flow::vof::VofSumN< N >
 N double sums in one team reduction (Kokkos::Sum<VofSumN<N>>). More...
 
struct  Kokkos::reduction_identity< peclet::flow::vof::VofSumN< N > >
 
struct  peclet::flow::vof::VofStatsPrev
 What measure() reads besides the colour: each job's previous centroid and whether it is valid (the host's prevCentroid_ / hasPrev_, current when the launch is issued). More...
 

Namespaces

namespace  peclet
 
namespace  peclet::flow
 
namespace  peclet::flow::vof
 
namespace  Kokkos
 

Macros

#define PECLET_FLOW_OMP_SIMD
 

Enumerations

enum  peclet::flow::vof::VofDebrisSlot : int {
  peclet::flow::vof::kDbSumD = 0 , peclet::flow::vof::kDbSumR , peclet::flow::vof::kDbW , peclet::flow::vof::kDbVA ,
  peclet::flow::vof::kDbDV , peclet::flow::vof::kDbActed , peclet::flow::vof::kDbND , peclet::flow::vof::kDbNR ,
  peclet::flow::vof::kDbPending , peclet::flow::vof::kDbSlots
}
 The per-job slots of the debris packet (out(stride * (base + k) + slot)). More...
 

Functions

int peclet::flow::vof::vofJobOf (const long *off, long t)
 Job of flat index t (off[0] <= t < off[nj]): a walk over at most 16 offsets.
 
template<class F >
long peclet::flow::vof::vofSetOffsets (VofBlockTable &T, F size)
 Fill T.off from a per-job range size.
 
long peclet::flow::vof::vofJobLen (const VofBlockJob &J)
 
long peclet::flow::vof::vofJobInner (const VofBlockJob &J)
 
long peclet::flow::vof::vofJobGrown1 (const VofBlockJob &J)
 The inner region grown by one cell per side: WyAdvector::reconstructImpl's range.
 
template<class Exec , class Cnt , class F >
void peclet::flow::vof::vofHostListFor (const char *name, int nj, Cnt cnt, F body)
 H-4(a): a host list kernel over the EXACT entry counts, cnt(k) (read directly: the count Views are HostSpace), with a dynamic schedule in chunks of 16 – so the active entries spread over every thread instead of sitting at the head of one block's static share.
 
template<class Tab >
auto peclet::flow::vof::vofListCount (const Tab &T, LField start, LField end)
 The [start, end) count of job k of a list launch.
 
template<class Exec , class Rows , class F >
void peclet::flow::vof::vofHostRowFor (const char *name, int nj, Rows rows, F row)
 H-4(b): a host region kernel over ROWS – rows(k) x-runs for job k, row(k, r) handling job k's local row r with the x loop inside – so the job search and the index math run once per row, not once per cell.
 
template<class Exec , class Rows , class RowOf , class Hit >
void peclet::flow::vof::vofHostRowScan (const char *name, int nj, int base, Rows rows, RowOf rowOf, Hit hit, LField list, LField start, LField end)
 H-4(d): a host compaction scan over ROWS.
 
void peclet::flow::vof::vofBatchCfl (const VofBlockTable &T, SField out)
 One team per job: WyAdvector::maxCourant or maxCourantInterface (per the job's interfaceCfl), the same predicates and the same fmax chain.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchFreeze (const VofBlockTable &T)
 WyAdvector::freezeDilationFlag over every job's extended block.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchWorklist (const VofBlockTable &T, LField list, LField start, LField end)
 WyAdvector::reconstructImpl's worklist scan, over the concatenated grown-by-one regions (T.off = vofJobGrown1).
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchPlic (const VofBlockTable &T, LField list, LField start, LField end)
 wyReconstructCell over each job's compacted list: launched over the upper bound (the job's region), a thread past its job's count exits.
 
long peclet::flow::vof::vofJobFaces (const VofBlockJob &J, int d)
 A sweep's face range of one job: the inner region with one extra layer on the low side of d.
 
void peclet::flow::vof::vofBatchFluxCell (const VofBlockJob &J, int d, long p)
 The flux of d-face p of job J (the per-cell body of vofBatchFlux, both launch forms).
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchFlux (const VofBlockTable &T, int d)
 WyAdvector::computeFluxesImpl (uncut): one flux per d-face, wyFaceFlux (or, for a job carrying the WO-R mask, wyFaceFluxBc).
 
void peclet::flow::vof::vofBatchBcLedger (const VofBlockTable &T, int d, SField out, int stride, int slot0)
 The WO-R boundary ledger (WyAdvector::accumulateBcFaceVolume) of the jobs carrying the mask: one thread per (job, side), summing its plane of d-fluxes in (p0 fastest, p1) row order into out(stride (base + k) + slot0 + face) – a fixed order, which is a C2 order change against the per-block MDRange2 reduction (recorded; doc/vof_step_performance_design.md §5.9).
 
void peclet::flow::vof::vofBatchUpdateCell (const VofBlockJob &J, int d, long i)
 The sweep update of inner cell i of job J (the per-cell body of vofBatchUpdate).
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchUpdate (const VofBlockTable &T, int d)
 WyAdvector::applySweepImpl (uncut) over the inner regions (T.off = vofJobInner); the expression verbatim.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchGhostZero (const VofBlockTable &T)
 Pass 1: every ghost cell of every job -> 0.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchPeriodic (const VofBlockTable &T, int a)
 Pass 2 on axis a (colour_field.hpp::periodicFill, one axis): only the jobs whose block spans the periodic axis a are in T; T.off = the transverse plane sizes dims[b] * dims[c].
 
void peclet::flow::vof::vofBatchClampCell (const VofBlockJob &J, int x, int y, int z, int q0, int q1, int q2, bool p0, bool p1, bool p2)
 The clamp of extended cell (x, y, z) of job J (the per-cell body of vofBatchClamp).
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchClamp (const VofBlockTable &T, I3 gs, bool px, bool py, bool pz)
 Pass 3 (colour_field.hpp::clampFill, skip = 0): the part of each extended block outside a NON-periodic domain takes the globally clamped value.
 
template<class SF >
bool peclet::flow::vof::vofDebrisCell (const SF &c, long i, long sy, long sz, double ieps, double cfull)
 The debris predicate of doc/vof_overlap_design.md §11 on cell i: interfacial, and NO cell of the marker at or above cfull within two cells (the 5^3 fit stencil).
 
template<class SF >
bool peclet::flow::vof::vofAttachedCell (const SF &c, long i, long sy, long sz, double ieps, double cfull)
 The ATTACHED predicate (§5.3 step 2): interfacial with a cell at or above cfull within two.
 
bool peclet::flow::vof::vofResidueCell (double ci, double weps)
 The residue predicate (§13): 0 < |C| <= wispEps.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchMark (const VofBlockTable &T, int kind, double ieps, double cfull, double weps, LField list, LField start, LField end)
 One mark scan over the concatenated inner regions (T.off = vofJobInner), in each block's inner-box index order – the per-block scan's order, so every list is the per-block list.
 
void peclet::flow::vof::vofBatchDebrisSums (const VofBlockTable &T, VofDebrisFlags F, LField listD, LField listR, LField listA, LField sD0, LField eD0, LField sR0, LField eR0, LField sA0, LField eA0, SField out, int stride, int slot0)
 Step 2 of the pass: one thread per job, every sum in list order (the per-block kernel's single thread and order, so the same bits).
 
long peclet::flow::vof::vofDebrisActCount (const VofDebrisFlags &F, LField sA0, LField eA0, SField out, long ob, int j)
 The number of act entries of job j (its D removed, then R, then A), 0 when it did not act: the per-block write kernel's range.
 
void peclet::flow::vof::vofDebrisActEntry (const VofBlockTable &T, const VofDebrisFlags &F, int k, long t, LField listD, LField listR, LField listA, LField sD0, LField sR0, LField sA0, LField eA0, SField out, int stride, int slot0, SField ex, Kokkos::View< int *, SMem > capf)
 Act entry t of job k (the per-block write kernel's expressions verbatim); t past the job's count, or a job that did not act, is a no-op.
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchDebrisWrite (const VofBlockTable &T, VofDebrisFlags F, LField listD, LField listR, LField listA, LField sD0, LField sR0, LField sA0, LField eA0, SField out, int stride, int slot0, SField ex, Kokkos::View< int *, SMem > capf)
 Step 4, the act: removed cells -> 0, attached C += dV C(1-C)/W capped at 1 (the per-block write kernel's expressions verbatim).
 
void peclet::flow::vof::vofBatchDebrisLost (const VofBlockTable &T, LField sA0, LField eA0, SField out, int stride, int slot0, SField ex, Kokkos::View< int *, SMem > capf)
 lost: the capped excess of an acted job summed in list order on one thread (only where a cap fired, as the per-block path; 0 otherwise).
 
template<class Exec = SExec>
void peclet::flow::vof::vofBatchBox (const VofBlockTable &T, double eps, SField out, int stride, int slot0)
 One team per job: the tight box of |C| > eps over the inner region, in the block's LOCAL inner frame (bubbleBox's six Min/Max reductions; order-free).
 
template<class F >
long peclet::flow::vof::vofSetOffsets (VofCurvTable &T, F size)
 
long peclet::flow::vof::vofCurvInner (const VofCurvJob &J)
 
long peclet::flow::vof::vofCurvGrown (const VofCurvJob &J)
 The inner region grown by kPvHalf: every cell VofCurvature::reconstructPlanes writes.
 
long peclet::flow::vof::vofCurvCell (const VofCurvJob &J, long r, bool grown)
 Cell r of job J's grown (grown) or inner region, in the region's x-fastest order.
 
long peclet::flow::vof::vofCurvRows (const VofCurvJob &J, bool grown)
 Rows of job J's grown (grown) or inner region, for the host row forms (H-4b).
 
long peclet::flow::vof::vofCurvRow (const VofCurvJob &J, long r, bool grown, int &x0, int &x1)
 The first cell of row r of job J's grown or inner region, and the region's x range.
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvCompact (const VofCurvTable &T, bool grown, LField list, LField start, LField end)
 VofCurvature::compact: the interfacial cells of the grown (grown) or inner region, in the per-cascade scan's order; each job's range lands in start/end (absolute list positions).
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvPlanesZero (const VofCurvTable &T)
 reconstructPlanes (worklist mode), part 1: zero the four plane fields and clear the slot map (design G §5.2) over the grown region.
 
void peclet::flow::vof::vofCurvPlaneEntry (const VofCurvTable &T, int k, long q, LField list)
 Entry q (an absolute grown-list position) of job k of the planes pass (below).
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvPlanesList (const VofCurvTable &T, LField list, LField start, LField end)
 Part 2: wyReconstructCell over the grown interfacial list (upper bound: the grown region), and each cell's moment cache entry from the plane it just wrote, at its list position q, which becomes its slot (design G §5.2).
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvHfReset (const VofCurvTable &T)
 heightPass (worklist mode), part 1: every inner cell to kappa = 0, branch = kCurvNone.
 
void peclet::flow::vof::vofCurvFallbackTeams (const VofCurvTable &T, LField list, LField start, LField end)
 
void peclet::flow::vof::vofCurvListEntry (const VofCurvTable &T, int pass, int k, long q, LField list, LField cnt)
 Entry q (an absolute list position) of job k of a cascade list pass (see below): the body shared by the device and host launch forms.
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvListPass (const VofCurvTable &T, int pass, LField list, LField start, LField end, LField cnt)
 The per-list-cell passes of the cascade over the inner interfacial list (upper bound: the inner region): pass 0 = tiers 1-2 (curvHeightCell), 1 = tier 3 (curvFallbackCell), 2 = the admissibility clip (its count into cnt(8 (base + k) + 7)), 3 = the branch census (its seven counters into cnt(8 (base + k) + 0..6), in VofCurvature::census's order).
 
template<class Exec = SExec>
void peclet::flow::vof::vofCurvListPasses (const VofCurvTable &T, bool anyClip, LField list, LField start, LField end, LField cnt)
 The whole cascade list stage of a chunk: tiers 1-2, tier 3, the clip (only if some job clips), the census.
 
void peclet::flow::vof::vofCsfForceCell (const VofCurvJob &J, long i, double sig, double w0, double w1, double w2)
 The three CSF face-force components at the low faces of inner cell i of job J (the per-cell body of vofCsfForceBatch).
 
template<class Exec = SExec>
void peclet::flow::vof::vofCsfForceBatch (const VofCurvTable &T, double sig, double w0, double w1, double w2)
 VofBlockSet::buildCsfForce for every job, the three components per cell: the V4 balanced-force CSF at the LOW face of each inner cell, the per-block kernel's expressions verbatim.
 
void peclet::flow::vof::vofBatchStats (const VofBlockTable &T, const VofStatsPrev &P, double hh, double aeps, double dt, SField out, long off)
 VofBlockSet::measure for every job in one launch, one team per job: the first moments, then the central second moments and the PLIC interface area (VofBlockSet::interfaceArea's body) together, each as ONE team reduction over the inner box, with the per-cell expressions of the per-block reductions verbatim.
 

Variables

constexpr int peclet::flow::vof::kVofBlockBatch = 16
 Jobs per launch; a container with more master blocks runs each stage in chunks.
 
template<class Exec >
constexpr bool peclet::flow::vof::kVofHostExec = std::is_same_v<typename Exec::memory_space, Kokkos::HostSpace>
 The host branches select on this (§14.2).
 
constexpr int peclet::flow::vof::kVofTier3MaxTeams = 1 << 16
 Tier 3 of the batched cascade on a DEVICE (C3, doc/vof_step_performance_design.md §4.7, §5.11; launch shape: coordinator decision 2026-10-02, option C).
 
constexpr int peclet::flow::vof::kVofStats = 14
 Doubles per job in the statistics packet: volume, centroid[3], velocity[3], area, moment[6].
 

Detailed Description

flow — batched execution of the VoF block container's stages (C1, doc/vof_step_performance_design.md §4.6, §5.9).

The block container runs one WyAdvector per marker on a small box (~24^3). Run block by block, every stage is ~60 launches and ~8 host reads per block: on a GPU the step is launch latency and pipeline drains, not work. Here each stage runs for ALL master blocks in ONE launch, through a by-value job table of raw device pointers plus extents (the pattern of DebrisTable and VofCurvFallbackTable); a flat index is mapped to (job, local cell) by walking the table's prefix offsets. Nothing about the container's DATA changes – every block keeps its own Views – and every per-cell body is the existing inline function (wyReconstructCell, wyFaceFlux, the update and ghost-fill expressions verbatim), so the state is bit-identical to the per-block path.

Compaction counts stay on the device: a scan writes each job's list start and end, and the consumer launches over the upper bound (the job's region) and exits at t >= count.

The table rides in the functor by value. With nvcc's grid-constant kernel parameters (Kokkos KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT, 32 KiB) a table of 16 jobs is passed as a kernel argument – no constant-memory staging, no host synchronisation per launch.

Definition in file block_batch.hpp.

Macro Definition Documentation

◆ PECLET_FLOW_OMP_SIMD

#define PECLET_FLOW_OMP_SIMD

Definition at line 156 of file block_batch.hpp.