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

flow — VoF rung V3 (WO-O): the view-level driver for the curvature cascade. More...

#include <algorithm>
#include <chrono>
#include <Kokkos_Core.hpp>
#include <stdexcept>
#include <vector>
#include "mac_stencils.hpp"
#include "policy.hpp"
#include "vof/advect_wy.hpp"
#include "vof/curvature.hpp"
#include "vof/surface_tension.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::vof::VofPvCached
 The cache-backed accessor: slot[j] >= 0 iff cell j of the grown region is interfacial, and cache[slot[j]] is its entry (written by the planes pass of the same cascade). More...
 
struct  peclet::flow::vof::VofPvOnTheFly< SF >
 The on-the-fly accessor of the dense mode (useWorklist = false, no list and no slot): the interfacial test is vofIsInterface(c(j)), and the entry is built from the planes. More...
 
struct  peclet::flow::vof::VofPvTeamScratch
 
struct  peclet::flow::vof::VofRawField
 A raw-pointer field accessor with the View<double*> call syntax, for kernels that walk SEVERAL blocks' fields in one launch (a device-side array of Views would carry reference counts). More...
 
struct  peclet::flow::vof::VofCurvFallbackJob
 One block's share of a batched tier-3 launch (VofCurvature::fallbackBatch): its fields, its compacted interfacial list, and every argument its own fallbackPass would pass to curvFallbackCell. More...
 
struct  peclet::flow::vof::VofCurvFallbackTable< N >
 The job table of one batched launch, passed to the kernel BY VALUE (namespace scope: nvcc's extended lambdas may not capture a function-local type). More...
 
class  peclet::flow::vof::VofCurvature
 Curvature of the colour field on an extended (inner + ghost) block. More...
 
struct  peclet::flow::vof::VofCurvature::Stats
 Per-call census of the cascade over this block's inner region (LOCAL; a distributed caller sums them itself — the driver stays MPI-free, exactly as WyAdvector does). More...
 
struct  peclet::flow::vof::VofCurvature::Timing
 

Namespaces

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

Macros

#define PECLET_VOF_DEVICE_NOINLINE
 ONE compiled device body per tier-3 piece (C1 ruling, design G WO-3).
 

Typedefs

using peclet::flow::vof::VofPvTerms = Kokkos::View< PvTerm *, SExec::scratch_memory_space, Kokkos::MemoryUnmanaged >
 Team scratch of the device tier-3 body: the compacted stencil's canonical offset indices, their terms, and the 27 accumulated entries (about 10 KB at the 5^3 stencil).
 
using peclet::flow::vof::VofPvInts = Kokkos::View< int *, SExec::scratch_memory_space, Kokkos::MemoryUnmanaged >
 
using peclet::flow::vof::VofPvDbls = Kokkos::View< double *, SExec::scratch_memory_space, Kokkos::MemoryUnmanaged >
 

Functions

bool peclet::flow::vof::vofIsInterface (double c, double eps)
 wyIsMixed with a wisp threshold: the cell carries an interface only while eps < C < 1 - eps.
 
template<class SF >
void peclet::flow::vof::curvHeightCell (long i, SF c, SF mx, SF my, SF mz, SF al, SF kap, SF br, long s0, long s1, long s2, double mtol, double ptW, double ieps, bool forceFb, bool oneDir, bool useFit, VofMetric g, double peps)
 WO-V9 — the per-cell bodies of the two cascade tiers, lifted VERBATIM out of the kernels they used to be written inline in, so the dense (whole-region) and the compacted (interfacial-cell list) kernels below can share ONE body instead of two copies that could drift apart.
 
template<class SF >
void peclet::flow::vof::curvFallbackStore (long i, const PvFit &fit, SF kap, SF br)
 Tier 3's last step: solve the accumulated PV system and write the target's kappa and branch.
 
PECLET_VOF_DEVICE_NOINLINE void peclet::flow::vof::curvMomentsBuild (double mx, double my, double mz, double alpha, const VofMetric &g, PvMoments &P)
 pvMomentsBuild, the one call every planes pass and the dense accessor make (out of line on a device, see PECLET_VOF_DEVICE_NOINLINE).
 
template<class SF , class Acc >
void peclet::flow::vof::curvFallbackCell (long i, const Acc &acc, SF kap, SF br, long sy, long sz, int gr, double dW, double cmin, VofMetric g)
 Tier 3 for one target, one thread (host): the frame from the target's entry (pvFrameMoments: the physical normal, its tangents, the polygon's area centroid as the origin), the 5^3 stencil in canonical order (pvTermMoments), lower-triangle accumulation, the solve.
 
template<class Member , class SF , class Acc >
PECLET_VOF_DEVICE_NOINLINE void peclet::flow::vof::curvFallbackTeam (const Member &tm, const VofPvTeamScratch &sc, long i, const Acc &acc, SF kap, SF br, long sy, long sz, int gr, double dW, double cmin, VofMetric g)
 curvFallbackCell for one target on a whole team (design G §5.4; the team shape of C3, doc/vof_step_performance_design.md §4.7, §5.11).
 

Variables

constexpr int peclet::flow::vof::kVofWarp = 32
 The team size of a device tier-3 launch: one warp / wavefront.
 

Detailed Description

flow — VoF rung V3 (WO-O): the view-level driver for the curvature cascade.

vof/curvature.hpp holds the promotable, container-free kernels (WO-D signature rule). This file is their block-walking driver: it owns the PLIC scratch fields, walks the colour block, and produces the two output fields

  • kappa — 2H in units of 1/h (cell units), positive for a convex blob of liquid;
  • kappa_branch — which tier of the cascade produced it (CurvatureBranch), as a double so it rides the ordinary field registry / IO / redistribute path.

Both live on the colour advector's g = 3 block, which is exactly the reach the cascade needs and no more:

  • tier 1/2 (height functions) read a 3 x 3 x 7 patch of colour — transverse +/-1, column +/-3;
  • tier 3 (the 5^3 PV fit) reads a PLIC plane at +/-2, and each plane's MYC normal reads colour at +/-1 around it — again +/-3.

So no new halo machinery: IbmSolver::vofFillGhosts on the colour field is the only exchange this rung needs, and the whole computation is a pure local stencil, hence bitwise decomposition-independent by construction (there is not one reduction in it).

The one deliberate cost: the PLIC planes are rebuilt here over the inner region grown by 2, rather than reusing WyAdvector's (reconstruct() covers inner+1 only, and it is a validated kernel body that hard rule 1 forbids editing).

Definition in file curvature_field.hpp.

Macro Definition Documentation

◆ PECLET_VOF_DEVICE_NOINLINE

#define PECLET_VOF_DEVICE_NOINLINE

ONE compiled device body per tier-3 piece (C1 ruling, design G WO-3).

Inlined into each kernel, nvcc contracts the same source (a*b + c -> FMA) differently per call site, so the batched and the per-block kernels disagreed at round-off (C1 failed on CUDA; bitwise with --fmad=false). Kept out of line in the DEVICE pass only, the moment build and the team body are each compiled once and every kernel calls that one copy. Host passes stay inlined (contract-off there).

Definition at line 194 of file curvature_field.hpp.