|
flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
The container: a replicated table of blocks, the per-step orchestration (gather → advect → re-centre → scatter/union) and the per-bubble statistics. More...
#include <block_container.hpp>
Classes | |
| struct | DebrisJob |
| One block's share of the batched sums (raw pointers: the table rides in the functor). More... | |
| struct | DebrisTable |
Public Member Functions | |
| void | init (I3 gs, std::array< bool, 3 > per, int rank, int size, double h=1.0) |
| void | setMetric (const VofMetric &g) |
| The anisotropic cell metric (Phase 3). | |
| const VofMetric & | metric () const |
| void | setExchange (std::shared_ptr< VofBlockExchangeBase > x) |
| VofBlockExchangeBase * | exchange () const |
| int | margin () const |
| int | ghost () const |
| void | setWispEps (double eps) |
Set wispEps on the set AND on every live advector (pooled ones take it on reuse). | |
| double | cellSize () const |
| std::size_t | count () const |
| std::vector< VofBlock > & | blocks () |
| The block table. | |
| const std::vector< VofBlock > & | blocks () const |
| long | step () const |
| void | setStep (long s) |
| int | masterOf (long id) const |
| Master assignment: round robin by block id (VOF_PLAN §10 W0; the weighted-ORB assignment is W1). | |
| void | seedSphere (double cx, double cy, double cz, double r, int subLevels=4, int extraPad=0) |
| Seed a spherical bubble (centre and radius in CELL units, global). | |
| void | advect (double dt, SField cLocal) |
One kinematic block step: gather the face velocity, advect every local block, re-centre, replicate the table, and union the colour back into cLocal. | |
| long | lastReassigned () const |
Blocks that changed master at the last advect() (rung W1 item a). | |
| void | enableCsf (double sigmaValue) |
| Turn on the block CSF. | |
| void | computeCsf (SField fx, SField fy, SField fz) |
| Per-block curvature cascade + the CSF face force, summed into the caller's three face-force patches. | |
| VofCurvature::Stats | csfCurvatureStats () const |
| void | setKappaMax (double km) |
Set the curvature admissibility clip (VofCurvature::kappaMax, index units) on the prototype AND on every block's live cascade, so a change mid-run takes effect at the next step. | |
| void | allocateCsf (std::size_t idx) |
| void | buildCsfForce (VofBlock &b) |
The V4 balanced-force CSF on the BLOCK's faces — the same csfFaceCurvature + csfFaceForce pair Solver::addCsfRhs applies to the global field, on the block's own colour and curvature. | |
| void | scatterSum (SField sLocal) |
S = sum_k C_k of the CURRENT (replicated) table into sLocal's inner region (§5.6). | |
| void | scatter (SField cLocal) |
Union the current colour into cLocal without advecting (used right after seeding). | |
| std::vector< int > | plannedMasters () const |
The master each block WOULD get under assignMode, from the current block cell counts. | |
| long | assignMasters () |
Apply plannedMasters(): allocate on the gaining ranks, migrate the colour, free on the losing ranks. | |
| void | seedBox (const VofBox &bb, int extraPad=0) |
Seed one block on the global index box bb (the BUBBLE extent; the inner box is bb grown by margin), with the colour gathered from the caller's colour patch. | |
| void | finishSeeding (SField cLocal) |
Gather the colour of every seedBox-seeded block from cLocal, fill its ghosts and measure. | |
| std::vector< double > | blockColourHost (std::size_t idx) |
One block's INNER colour, copied to the host in x-fastest order over blocks_[idx].box. | |
| std::vector< double > | blockKappaHost (std::size_t idx) |
| One marker's OWN curvature over its inner box, x-fastest (empty unless this rank masters it and the block CSF is on). | |
| void | seedBoxWithColour (const VofBox &bb, const std::vector< double > &colour) |
Seed a block whose INNER box is EXACTLY bb (not grown by the margin: bb is what blockColourHost was paired with) and whose colour is the given host array, x-fastest over bb. | |
| void | clipToSeed (VofBlock &b) |
| A seeded block's colour is its OWN bubble's: the gather copies the whole INNER box (bubble extent + margin) out of the global field, and the margin ring belongs to no marker by the margin contract (it is what makes the block conservative), so anything the gather picked up there is a NEIGHBOURING marker's liquid and must not be adopted. | |
| void | fillBlockGhosts (VofBlock &b) |
| The block's own colour ghost policy — see the file header. | |
| std::vector< VofBlockStats > | statsAll () |
| Per-bubble census on the master (empty entries on a non-master). | |
| void | masterCensus (std::vector< long > &masters, std::vector< long > &cells) const |
Load-balance census of the CURRENT master assignment: masters[r] = blocks mastered by rank r, cells[r] = the inner cells those blocks carry (the actual VoF work). | |
| double | cellImbalance () const |
| max/mean of the per-rank block-cell load (1.0 = perfect). 0 blocks -> 1.0. | |
| I3 | globalSize () const |
| std::array< bool, 3 > | periodic () const |
| int | rank () const |
| int | size () const |
| long | poolHits () const |
| long | poolMisses () const |
| void | clearPool () |
| bool | bubbleBox (const VofBlock &b, VofBox &out) const |
Tight bounding box of C > 0 over the inner region, in GLOBAL indices. | |
| void | recentre (std::size_t idx) |
| Move / resize the block when the bubble has spent its margin (or when the box has grown wastefully large). | |
| void | recentreTo (std::size_t idx, const VofBox &bb) |
recentre for a bubble box already measured (the batched path's read #2). | |
| void | debrisPass (VofBlock &b) |
Debris + residue pass on one master block (doc/vof_overlap_design.md §5.2-5.3, predicate of §11, residue of §13). | |
| void | debrisPassBatch (std::vector< VofBlock * > &bs, bool deferLedger=false) |
| The pass on several master blocks at once. | |
| void | debrisPassBatchImpl (std::vector< VofBlock * > &bs) |
| double | outOfBoxSum (const VofBlock &b, const VofBox &nb) const |
Sum of the block's colour over inner cells whose GLOBAL index falls outside nb. | |
| double | outOfBoxSum (const VofBlock &b, const VofBox &nb, const bool wrap[3]) const |
... where an axis flagged in wrap spans the whole periodic domain in nb and is copied with the wrap: every old cell lands in nb on that axis, so it drops nothing there. | |
| double | innerSum (const VofBlock &b) const |
| double | interfaceArea (const VofBlock &b) const |
Rung W1 item (d): the marker's interface area, in CELL units squared (the same convention volume uses: cell volumes, NOT the physical length units centroid carries) — the sum over the inner box of the PLIC polygon area of every mixed cell, reconstructed from the MYC normal exactly as the curvature cascade does (mycNormal -> plicAlpha -> plicPolygon -> polygonAreaCentroid). | |
| void | measure (VofBlock &b, double dt) |
| Volume, centroid, centroid velocity and the central second moments over the inner box. | |
| bool | csfBatchEligible () const |
The batched cascade applies where the container step is batched and every master block's cascade runs in worklist mode without its per-pass timers (the configuration whose tier 3 was already batched, VofCurvature::fallbackBatch). | |
| void | computeCsfBatched () |
Stage 6 of §5.9: the curvature cascade (compaction, planes, tiers 1-2, tier 3, the clip, the census) and the CSF face force of every master block, each pass one launch per chunk of kVofBlockBatch blocks, the interfacial counts on the device (consumers launch over the region and exit past the count). | |
| bool | batchEligible () const |
The batched path applies to the plain advect() configuration: every master block an uncut all-fluid advector (no cut-cell geometry), the worklist on, no debugRecomputeDilation, no per-kernel timing, no all-reduce hook (a block is its own domain). | |
| VofBlockJob | makeJob (VofBlock &b, double dt) const |
| The raw-pointer job of one master block for the batched launches. | |
| void | batchGhostFill (VofBlockTable T) |
fillBlockGhosts of every job of T, pass by pass in the per-block pass order: zero, the in-block periodic wrap (axis by axis, only the jobs spanning that axis), the clamp. | |
| void | ensureRead1 (std::size_t len) |
Grow read #1's packet to len doubles, KEEPING its contents (deferred statistics may wait in the front of it). | |
| void | measureBatched (double dt) |
C2 (§5.10): measure() for every master block in one launch (vofBatchStats), with NO host read – the values stay in the front of read #1's packet and reach the blocks' st_ at the next container step's read #1, or at flushStats() (statsAll, blocks(), the seeding paths, assignMasters), whichever comes first; nothing reads them in between. | |
| void | applyStats (const double *hs) |
Apply the deferred statistics in hs (host, kVofStats doubles per pending block) exactly as measure() applies its reductions, and clear the pending list. | |
| void | flushStats () |
| Bring deferred statistics to the host now (a separate read; the step itself folds it into read #1). | |
| void | advectBatched (double dt) |
Stages 1-3 of §5.9 for every master block: the Courant numbers in one launch and ONE host read (the throw needs it), the frozen dilation flag, then the three sweeps – worklist scan, PLIC over the device count, fluxes, update, ghost fill – each one launch per chunk of kVofBlockBatch blocks. | |
| void | debrisBatched (std::vector< VofBlock * > &bs) |
Stage 4 of §5.9, the debris/residue pass of debrisPassBatchImpl on every block of bs in batched launches: the mark scans (D, R, A) over the concatenated inner regions with their counts on the device, the per-block sums (one thread per block, list order), the act kernels over the upper bound with device guards – so "nothing marked" is a device no-op – and one batched ghost fill. | |
| void | applyDebrisLedger (std::vector< VofBlock * > &bs, bool doDebris) |
The host half of the debris pass: the ledger of debrisPassBatchImpl, from the packet. | |
| void | ensurePacket (std::size_t nb) |
| void | recentreBatched (bool ranDebris) |
| Stage 5 of §5.9 on the batched path: every master block's bubble box in one launch, then read #2 – the boxes, the debris sums and the WO-R ledger in ONE device->host copy – then the debris ledger, the WO-R ledger and the recentre decisions, exactly as the per-block path takes them. | |
Static Public Member Functions | |
| static VofCurvature | blockCurvProto () |
The block prototype: the class defaults, plus the admissibility clip ON at 1/Delta_min (doc/vof_overlap_design.md §5.1, §11 – the clip is a BLOCK-path rule: a marker's debris inside another marker is the one place the cascade meets arbitrary degenerate fits). | |
| static double | tick_ () |
| static VofBlockTable | batchTable (const std::vector< VofBlockJob > &jobs, std::size_t j0) |
Public Attributes | |
| int | recentrePad = 2 |
Cells of slack added beyond the margin when a block is re-centred, so a translating bubble re-allocates every pad + 1 steps instead of every step. | |
| double | cflLimit = 0.25 |
| The Weymouth-Yue cap of every block advector. | |
| bool | batched = true |
C1 (doc/vof_step_performance_design.md §4.6, §5.9): run each stage of the container step for ALL master blocks in one launch (vof/block_batch.hpp) instead of block by block. | |
| VofMasterAssign | assignMode = VofMasterAssign::RoundRobin |
| Rung W1 item (a): how masters are chosen, and how often the choice is revisited. | |
| long | reassignEvery = 0 |
| bool | usePool = true |
| Rung W1 item (c): recycle the advectors a re-centring retires, keyed by the EXACT extent. | |
| int | poolCapacity = 8 |
| advectors kept per extent; beyond it the retired one is freed | |
| bool | csfEnabled = false |
| Rung W2: form the CSF face force on each block (its own curvature cascade, the V4 balanced -force rule on the block's faces) and SUM it into the caller's global face-force fields. | |
| double | sigma = 0.0 |
| surface-tension coefficient of the block CSF (cell units) | |
| VofCurvature | curvProto = blockCurvProto() |
The curvature cascade's TUNABLES for every block, copied into each block's own VofCurvature when it is allocated. | |
| double | bubbleEps = 1e-12 |
| The colour threshold that defines the BUBBLE EXTENT (and hence the box). | |
| double | wispEps = 0.0 |
The Weymouth-Yue wisp tolerance of every block advector (WyAdvector::wispEps); the solver sets it to its own global advector's value (doc/vof_overlap_design.md §12.1: a block run at 0 reconstructs 1e-33 residue into NaN). | |
| double | areaEps = 1e-8 |
Wisp guard on the INTERFACE-AREA predicate (VofBlockStats::area), the same threshold and the same reason as the curvature's interfaceEps. | |
| bool | allowShrink = true |
| Let a block SHRINK when it has grown much larger than the bubble needs. | |
| bool | debrisCensus = true |
Run the debris pass in advect() (only while the block CSF is on – a kinematic block run never pays for it). | |
| bool | debrisRemove = false |
| Remove the debris and return its volume (§5.3). | |
| bool | timingOn = false |
Instrument: fence-bounded wall time of the debris/residue pass (all blocks, all calls) while timingOn; debrisCalls counts block-passes. | |
| double | debrisSeconds = 0.0 |
| long | debrisCalls = 0 |
Static Public Attributes | |
| static constexpr double | kDebrisMaxC = 0.5 |
Debris predicate threshold (doc/vof_overlap_design.md §11): an interfacial cell is debris when NO cell of its 5^3 stencil holds more than half a cell of the marker's colour – TBFsolver's fragment rule with "full" read as C > 1/2. | |
| static constexpr double | kDebrisMinAttached = 1.0 |
Guard of the volume return (§5.3 step 3): a marker whose attached interface holds less than this much colour (cell volumes) keeps its debris (counted in debrisUnresolved). | |
| static constexpr int | kDebrisBatch = 16 |
| static constexpr int | kPkBox = kDbSlots |
The per-job packet of read #2 (§5.9): the debris slots (VofDebrisSlot), the bubble box, the WO-R ledger. | |
| static constexpr int | kPkBcv = kDbSlots + 6 |
| static constexpr int | kPk = kDbSlots + 12 |
The container: a replicated table of blocks, the per-step orchestration (gather → advect → re-centre → scatter/union) and the per-bubble statistics.
Definition at line 428 of file block_container.hpp.
|
inline |
| gs | global grid size in cells |
| per | periodicity per axis (an axis with a domain BC on either face is NOT periodic) |
| rank,size | this rank's id and the communicator size (1 single-rank) |
| h | cell size (flow works in cell units, h = 1; the standalone scenes use 1/N so they can reuse the structured V1 scene builders verbatim) |
Definition at line 435 of file block_container.hpp.
The anisotropic cell metric (Phase 3).
Pushed into every block's advector and its curvature cascade; {1,1,1} — the default and every isotropic run — is the pre-Phase-3 arithmetic. h_ above stays 1: a block's bounding box is index-space bookkeeping (V1).
Definition at line 449 of file block_container.hpp.
References curvProto, and peclet::flow::vof::VofCurvature::metric.
|
inline |
Definition at line 457 of file block_container.hpp.
Referenced by gateSolverMetric().
|
inline |
Definition at line 459 of file block_container.hpp.
|
inline |
Definition at line 460 of file block_container.hpp.
|
inline |
Definition at line 462 of file block_container.hpp.
|
inline |
Definition at line 463 of file block_container.hpp.
|
inlinestatic |
The block prototype: the class defaults, plus the admissibility clip ON at 1/Delta_min (doc/vof_overlap_design.md §5.1, §11 – the clip is a BLOCK-path rule: a marker's debris inside another marker is the one place the cascade meets arbitrary degenerate fits).
Definition at line 511 of file block_container.hpp.
Set wispEps on the set AND on every live advector (pooled ones take it on reuse).
Definition at line 530 of file block_container.hpp.
References curvProto, peclet::flow::vof::VofCurvature::pureEps, and wispEps.
Definition at line 567 of file block_container.hpp.
References peclet::flow::vof::WyAdvector::wallSeconds().
Referenced by debrisPassBatch().
|
inline |
Definition at line 574 of file block_container.hpp.
|
inline |
Definition at line 576 of file block_container.hpp.
|
inline |
The block table.
The non-const accessor first applies any deferred statistics (C2), so a caller reading blocks()[i].stats() sees the last step's values; the const one does not.
Definition at line 579 of file block_container.hpp.
References flushStats().
Referenced by gateSolverMetric().
Definition at line 583 of file block_container.hpp.
|
inline |
Definition at line 584 of file block_container.hpp.
Definition at line 585 of file block_container.hpp.
|
inline |
Master assignment: round robin by block id (VOF_PLAN §10 W0; the weighted-ORB assignment is W1).
Deliberately independent of where the bubble's cells live, which is the property gate G4 exercises — with more blocks than ranks at least one block's master owns none of its cells.
Definition at line 590 of file block_container.hpp.
Referenced by seedBoxWithColour(), and seedSphere().
|
inline |
Seed a spherical bubble (centre and radius in CELL units, global).
The block box is the sphere's cell extent grown by margin; the master fills the colour with the same exact sphereCellFraction the structured scenes use, so a seeded block and a seeded global field agree bit for bit.
| extraPad | cells added to the box beyond the margin (0 for production; a large value makes a block that never has to re-centre, which is the G3 reference). |
Definition at line 598 of file block_container.hpp.
References fillBlockGhosts(), flushStats(), peclet::flow::vof::VofBox::grown(), peclet::flow::L3(), masterOf(), measure(), and peclet::flow::vof::vofClampBox().
One kinematic block step: gather the face velocity, advect every local block, re-centre, replicate the table, and union the colour back into cLocal.
| cLocal | the caller's colour patch (the same extended block the local face velocity lives on); the INNER region is overwritten with the union. |
Definition at line 644 of file block_container.hpp.
References advectBatched(), assignMasters(), batchEligible(), csfEnabled, debrisCensus, debrisPassBatch(), flushStats(), measure(), measureBatched(), reassignEvery, recentre(), recentreBatched(), and wispEps.
|
inline |
Blocks that changed master at the last advect() (rung W1 item a).
Definition at line 700 of file block_container.hpp.
Turn on the block CSF.
Each master block then carries its OWN VofCurvature on its own extended box and forms the V4 balanced-force face force there; computeCsf scatters the three face fields into the caller's patches with UNPACK_SUM.
Definition at line 707 of file block_container.hpp.
References allocateCsf(), csfEnabled, and sigma.
Per-block curvature cascade + the CSF face force, summed into the caller's three face-force patches.
fx/fy/fz are ZEROED first (the force is a per-step quantity, never accumulated).
Definition at line 717 of file block_container.hpp.
References buildCsfForce(), peclet::flow::vof::VofCurvature::Stats::clipped, computeCsfBatched(), csfBatchEligible(), peclet::flow::vof::VofCurvature::fallbackBatch(), peclet::flow::vof::VofCurvature::Stats::hf, peclet::flow::vof::VofCurvature::Stats::hfFit, peclet::flow::vof::VofCurvature::Stats::hfMixed, peclet::flow::vof::VofCurvature::Stats::interfacial, peclet::flow::vof::VofCurvature::Stats::noEstimate, peclet::flow::vof::VofCurvature::Stats::pv, and peclet::flow::vof::VofCurvature::Stats::pvReduced.
|
inline |
Definition at line 758 of file block_container.hpp.
Set the curvature admissibility clip (VofCurvature::kappaMax, index units) on the prototype AND on every block's live cascade, so a change mid-run takes effect at the next step.
Definition at line 762 of file block_container.hpp.
References curvProto, and peclet::flow::vof::VofCurvature::kappaMax.
|
inline |
Definition at line 768 of file block_container.hpp.
References curvProto.
Referenced by enableCsf(), and recentreTo().
The V4 balanced-force CSF on the BLOCK's faces — the same csfFaceCurvature + csfFaceForce pair Solver::addCsfRhs applies to the global field, on the block's own colour and curvature.
Formed over the inner box; the low face of an inner cell at local index 0 reads the block's ghost, which the margin guarantees carries C = 0 (the continuous phase), so the force is exactly zero there and the block's force has compact support inside its own box.
Definition at line 788 of file block_container.hpp.
References peclet::flow::vof::csfFaceCurvature(), peclet::flow::vof::csfFaceForce(), peclet::flow::L3(), and sigma.
Referenced by computeCsf().
S = sum_k C_k of the CURRENT (replicated) table into sLocal's inner region (§5.6).
Definition at line 821 of file block_container.hpp.
Union the current colour into cLocal without advecting (used right after seeding).
Definition at line 828 of file block_container.hpp.
|
inline |
The master each block WOULD get under assignMode, from the current block cell counts.
A pure function of the replicated table, so every rank computes the same vector without an exchange — which is what lets a re-assignment happen mid-run without breaking a bitwise gate.
Definition at line 840 of file block_container.hpp.
References assignMode, peclet::flow::vof::Lpt, peclet::flow::vof::RoundRobin, peclet::flow::vof::vofAssignLpt(), peclet::flow::vof::vofAssignOrb(), and peclet::flow::vof::WeightedOrb.
Referenced by assignMasters().
|
inline |
Apply plannedMasters(): allocate on the gaining ranks, migrate the colour, free on the losing ranks.
Returns the number of blocks that changed master. A no-op — and no message — when the assignment is unchanged, which is the common case once the swarm has settled.
Definition at line 865 of file block_container.hpp.
References fillBlockGhosts(), flushStats(), peclet::flow::vof::VofBlock::kAuxLen, measure(), and plannedMasters().
Referenced by advect().
Seed one block on the global index box bb (the BUBBLE extent; the inner box is bb grown by margin), with the colour gathered from the caller's colour patch.
This is the general seeding path — a sphere seed is only a convenience over it — and it is how a marker of any shape (a quasi-2-D cylinder, a Hysing bubble, a scanned geometry) enters the container. Call finishSeeding(cLocal) once after the last seedBox to perform the gather.
Definition at line 916 of file block_container.hpp.
References flushStats(), peclet::flow::vof::VofBox::grown(), and peclet::flow::vof::vofClampBox().
Gather the colour of every seedBox-seeded block from cLocal, fill its ghosts and measure.
Definition at line 934 of file block_container.hpp.
References clipToSeed(), fillBlockGhosts(), flushStats(), and measure().
|
inline |
One block's INNER colour, copied to the host in x-fastest order over blocks_[idx].box.
Empty on a rank that does not master the block (its state lives on the master).
Definition at line 959 of file block_container.hpp.
|
inline |
One marker's OWN curvature over its inner box, x-fastest (empty unless this rank masters it and the block CSF is on).
A diagnostic: which curvature each marker carries at a face.
Definition at line 979 of file block_container.hpp.
References csfEnabled.
|
inline |
Seed a block whose INNER box is EXACTLY bb (not grown by the margin: bb is what blockColourHost was paired with) and whose colour is the given host array, x-fastest over bb.
No seed clip runs – the colour is given, not gathered out of a union.
Definition at line 1000 of file block_container.hpp.
References colour(), fillBlockGhosts(), flushStats(), masterOf(), measure(), and peclet::flow::vof::vofClampBox().
A seeded block's colour is its OWN bubble's: the gather copies the whole INNER box (bubble extent + margin) out of the global field, and the margin ring belongs to no marker by the margin contract (it is what makes the block conservative), so anything the gather picked up there is a NEIGHBOURING marker's liquid and must not be adopted.
Without this clip two bubbles closer than 2 * margin would each seed with a slice of the other – measured on the rung-W2 MPI gate as marker volumes 491 and 528 against a seed volume of 382.
Definition at line 1042 of file block_container.hpp.
References peclet::flow::L3().
Referenced by finishSeeding().
The block's own colour ghost policy — see the file header.
Installed as the advector's exchange hook, so it also runs between the three sweeps.
Definition at line 1063 of file block_container.hpp.
References peclet::flow::vof::clampFill(), peclet::flow::L3(), peclet::flow::vof::periodicFill(), peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.
Referenced by assignMasters(), debrisPassBatchImpl(), finishSeeding(), recentreTo(), seedBoxWithColour(), and seedSphere().
|
inline |
Per-bubble census on the master (empty entries on a non-master).
Definition at line 1089 of file block_container.hpp.
References flushStats().
|
inline |
Load-balance census of the CURRENT master assignment: masters[r] = blocks mastered by rank r, cells[r] = the inner cells those blocks carry (the actual VoF work).
W0 assigns masters round-robin; W1 replaces this with the weighted ORB and these are the numbers to beat.
Definition at line 1114 of file block_container.hpp.
References peclet::flow::vof::VofBox::grown().
Referenced by cellImbalance().
|
inline |
max/mean of the per-rank block-cell load (1.0 = perfect). 0 blocks -> 1.0.
Definition at line 1123 of file block_container.hpp.
References masterCensus().
|
inline |
Definition at line 1136 of file block_container.hpp.
|
inline |
Definition at line 1137 of file block_container.hpp.
|
inline |
Definition at line 1138 of file block_container.hpp.
Referenced by init().
|
inline |
Definition at line 1139 of file block_container.hpp.
Referenced by init().
|
inline |
Definition at line 1223 of file block_container.hpp.
|
inline |
Definition at line 1224 of file block_container.hpp.
|
inline |
Definition at line 1225 of file block_container.hpp.
Tight bounding box of C > 0 over the inner region, in GLOBAL indices.
Computed in the block's LOCAL frame first, so a bubble straddling a periodic seam stays contiguous.
Definition at line 1234 of file block_container.hpp.
References bubbleEps, peclet::flow::L3(), and wispEps.
Referenced by recentre().
|
inline |
Move / resize the block when the bubble has spent its margin (or when the box has grown wastefully large).
The colour is copied by GLOBAL index — exact, no interpolation.
Definition at line 1276 of file block_container.hpp.
References bubbleBox(), and recentreTo().
Referenced by advect().
recentre for a bubble box already measured (the batched path's read #2).
Definition at line 1283 of file block_container.hpp.
References allocateCsf(), allowShrink, cflLimit, csfEnabled, fillBlockGhosts(), peclet::flow::vof::VofBox::grown(), peclet::flow::L3(), outOfBoxSum(), recentrePad, peclet::flow::vof::vofClampBox(), peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.
Referenced by recentre(), and recentreBatched().
Debris + residue pass on one master block (doc/vof_overlap_design.md §5.2-5.3, predicate of §11, residue of §13).
parallel_scans in inner-box index order -> listD_ (debris cells: interfacial, no cell of the marker at or above 1/2 within two cells; only while the block CSF is on), listR_ (RESIDUE: 0 < |C| <= wispEps; only while wispEps > 0) and, only when there is something to return, listA_ (attached: interfacial with a cell >= 1/2 within two). The 5^3 stencil reads the ghost ring as advect() left it – the PV fit's view – and every predicate reads the colour BEFORE any change (mark, then act).Definition at line 1372 of file block_container.hpp.
References debrisPassBatch().
|
inline |
The pass on several master blocks at once.
Per block it is exactly debrisPass's sequence; what is batched is step 2: the sums of every block that has something to act on run in ONE launch (one thread per block, each summing its own lists in list order – the same single-thread order, so the same bits) and reach the host in ONE copy, instead of a single-thread kernel plus a device->host sync per block. The lists live at per-block offsets of the shared scratch, so no block's lists overwrite another's before the sums read them.
| deferLedger | batched path only: leave the per-block packet on the device – the caller reads it with the boxes (read #2 of §5.9) and applies the ledger then. |
Definition at line 1384 of file block_container.hpp.
References applyDebrisLedger(), batchEligible(), csfEnabled, debrisBatched(), debrisCalls, debrisCensus, debrisPassBatchImpl(), debrisSeconds, tick_(), and timingOn.
Referenced by advect(), and debrisPass().
Definition at line 1412 of file block_container.hpp.
References csfEnabled, curvProto, debrisCensus, debrisRemove, fillBlockGhosts(), peclet::flow::vof::VofCurvature::interfaceEps, kDebrisBatch, kDebrisMaxC, kDebrisMinAttached, peclet::flow::L3(), peclet::flow::vof::vofAttachedCell(), peclet::flow::vof::vofDebrisCell(), peclet::flow::vof::vofResidueCell(), and wispEps.
Referenced by debrisPassBatch().
|
inline |
Sum of the block's colour over inner cells whose GLOBAL index falls outside nb.
Definition at line 1673 of file block_container.hpp.
References outOfBoxSum().
Referenced by outOfBoxSum(), and recentreTo().
|
inline |
... where an axis flagged in wrap spans the whole periodic domain in nb and is copied with the wrap: every old cell lands in nb on that axis, so it drops nothing there.
Definition at line 1679 of file block_container.hpp.
References peclet::flow::L3().
Definition at line 1705 of file block_container.hpp.
References peclet::flow::L3().
Rung W1 item (d): the marker's interface area, in CELL units squared (the same convention volume uses: cell volumes, NOT the physical length units centroid carries) — the sum over the inner box of the PLIC polygon area of every mixed cell, reconstructed from the MYC normal exactly as the curvature cascade does (mycNormal -> plicAlpha -> plicPolygon -> polygonAreaCentroid).
A reconstructed area, not a fit: a sphere reads 4 pi R^2 to the PLIC discretization error.
Definition at line 1725 of file block_container.hpp.
References areaEps, and peclet::flow::L3().
Referenced by measure().
Volume, centroid, centroid velocity and the central second moments over the inner box.
Definition at line 1761 of file block_container.hpp.
References interfaceArea(), and peclet::flow::L3().
Referenced by advect(), assignMasters(), finishSeeding(), seedBoxWithColour(), and seedSphere().
|
inline |
The batched cascade applies where the container step is batched and every master block's cascade runs in worklist mode without its per-pass timers (the configuration whose tier 3 was already batched, VofCurvature::fallbackBatch).
Definition at line 1836 of file block_container.hpp.
References batchEligible().
Referenced by computeCsf().
|
inline |
Stage 6 of §5.9: the curvature cascade (compaction, planes, tiers 1-2, tier 3, the clip, the census) and the CSF face force of every master block, each pass one launch per chunk of kVofBlockBatch blocks, the interfacial counts on the device (consumers launch over the region and exit past the count).
Each cell reads only its own block's fields and writes only its own, so this is the per-block computeBegin / fallbackBatch / computeEnd / buildCsfForce sequence reordered, bit for bit. The census and clip counters are integer atomics (order-free) and reach the host in ONE copy.
Definition at line 1855 of file block_container.hpp.
References peclet::flow::vof::VofCurvature::Stats::clipped, peclet::flow::vof::VofCurvature::Stats::hf, peclet::flow::vof::VofCurvature::Stats::hfFit, peclet::flow::vof::VofCurvature::Stats::hfMixed, peclet::flow::vof::VofCurvature::Stats::interfacial, peclet::flow::vof::kVofBlockBatch, peclet::flow::vof::VofCurvature::Stats::noEstimate, peclet::flow::vof::VofCurvature::Stats::pv, peclet::flow::vof::VofCurvature::Stats::pvReduced, sigma, peclet::flow::vof::vofCsfForceBatch(), peclet::flow::vof::vofCurvCompact(), peclet::flow::vof::vofCurvGrown(), peclet::flow::vof::vofCurvHfReset(), peclet::flow::vof::vofCurvInner(), peclet::flow::vof::vofCurvListPasses(), peclet::flow::vof::vofCurvPlanesList(), peclet::flow::vof::vofCurvPlanesZero(), and peclet::flow::vof::vofSetOffsets().
Referenced by computeCsf().
|
inline |
The batched path applies to the plain advect() configuration: every master block an uncut all-fluid advector (no cut-cell geometry), the worklist on, no debugRecomputeDilation, no per-kernel timing, no all-reduce hook (a block is its own domain).
Anything else runs the per-block path, unchanged.
Definition at line 1960 of file block_container.hpp.
References batched.
Referenced by advect(), csfBatchEligible(), and debrisPassBatch().
|
inline |
The raw-pointer job of one master block for the batched launches.
Definition at line 1975 of file block_container.hpp.
References peclet::flow::I3::x, peclet::flow::I3::y, and peclet::flow::I3::z.
Referenced by advectBatched(), debrisBatched(), measureBatched(), and recentreBatched().
|
inlinestatic |
Definition at line 2003 of file block_container.hpp.
References peclet::flow::vof::kVofBlockBatch.
Referenced by advectBatched(), debrisBatched(), measureBatched(), and recentreBatched().
|
inline |
fillBlockGhosts of every job of T, pass by pass in the per-block pass order: zero, the in-block periodic wrap (axis by axis, only the jobs spanning that axis), the clamp.
Definition at line 2014 of file block_container.hpp.
References peclet::flow::vof::VofBlockTable::base, peclet::flow::vof::VofBlockTable::job, peclet::flow::vof::VofBlockTable::nj, peclet::flow::vof::vofBatchClamp(), peclet::flow::vof::vofBatchGhostZero(), peclet::flow::vof::vofBatchPeriodic(), peclet::flow::vof::vofJobLen(), and peclet::flow::vof::vofSetOffsets().
Referenced by advectBatched(), and debrisBatched().
|
inline |
Grow read #1's packet to len doubles, KEEPING its contents (deferred statistics may wait in the front of it).
Definition at line 2039 of file block_container.hpp.
Referenced by advectBatched(), and measureBatched().
C2 (§5.10): measure() for every master block in one launch (vofBatchStats), with NO host read – the values stay in the front of read #1's packet and reach the blocks' st_ at the next container step's read #1, or at flushStats() (statsAll, blocks(), the seeding paths, assignMasters), whichever comes first; nothing reads them in between.
The table fields (id, master, box, cells) are set now, as measure() sets them. The previous centroid rides in the launch by value from the host copy, which is current: the last packet was applied at this step's read #1.
Definition at line 2056 of file block_container.hpp.
References areaEps, batchTable(), peclet::flow::vof::VofStatsPrev::c, ensureRead1(), flushStats(), peclet::flow::vof::kVofBlockBatch, peclet::flow::vof::kVofStats, makeJob(), peclet::flow::vof::VofStatsPrev::valid, and peclet::flow::vof::vofBatchStats().
Referenced by advect().
Apply the deferred statistics in hs (host, kVofStats doubles per pending block) exactly as measure() applies its reductions, and clear the pending list.
Definition at line 2094 of file block_container.hpp.
References peclet::flow::vof::kVofStats.
Referenced by advectBatched(), and flushStats().
|
inline |
Bring deferred statistics to the host now (a separate read; the step itself folds it into read #1).
No-op when nothing is pending.
Definition at line 2122 of file block_container.hpp.
References applyStats(), and peclet::flow::vof::kVofStats.
Referenced by advect(), advectBatched(), assignMasters(), blocks(), finishSeeding(), measureBatched(), seedBox(), seedBoxWithColour(), seedSphere(), and statsAll().
Stages 1-3 of §5.9 for every master block: the Courant numbers in one launch and ONE host read (the throw needs it), the frozen dilation flag, then the three sweeps – worklist scan, PLIC over the device count, fluxes, update, ghost fill – each one launch per chunk of kVofBlockBatch blocks.
Blocks share no cells, so running stage k of every block before stage k + 1 reorders nothing any block reads: each block's colour is what its own advect() gives.
Definition at line 2136 of file block_container.hpp.
References applyStats(), batchGhostFill(), batchTable(), ensurePacket(), ensureRead1(), flushStats(), kPk, kPkBcv, peclet::flow::vof::kVofBlockBatch, peclet::flow::vof::kVofStats, peclet::flow::vof::kWySweepPerm, makeJob(), perm(), peclet::flow::vof::vofBatchBcLedger(), peclet::flow::vof::vofBatchCfl(), peclet::flow::vof::vofBatchFlux(), peclet::flow::vof::vofBatchFreeze(), peclet::flow::vof::vofBatchPlic(), peclet::flow::vof::vofBatchUpdate(), peclet::flow::vof::vofBatchWorklist(), peclet::flow::vof::vofJobFaces(), peclet::flow::vof::vofJobGrown1(), peclet::flow::vof::vofJobInner(), peclet::flow::vof::vofJobLen(), and peclet::flow::vof::vofSetOffsets().
Referenced by advect().
Stage 4 of §5.9, the debris/residue pass of debrisPassBatchImpl on every block of bs in batched launches: the mark scans (D, R, A) over the concatenated inner regions with their counts on the device, the per-block sums (one thread per block, list order), the act kernels over the upper bound with device guards – so "nothing marked" is a device no-op – and one batched ghost fill.
The ghost fill runs for every block: a block that did not act has the inner colour its last sweep's fill saw, and the block ghost policy is a function of the inner colour alone, so re-filling it rewrites the same doubles. The ledger is applied on the host from one read of the per-block packet, with the per-block path's logic verbatim.
Definition at line 2208 of file block_container.hpp.
References batchGhostFill(), batchTable(), csfEnabled, curvProto, debrisCensus, debrisRemove, peclet::flow::vof::VofDebrisFlags::doDebris, ensurePacket(), F, peclet::flow::vof::VofCurvature::interfaceEps, kDebrisMaxC, kDebrisMinAttached, kPk, peclet::flow::vof::kVofBlockBatch, makeJob(), peclet::flow::vof::vofBatchDebrisLost(), peclet::flow::vof::vofBatchDebrisSums(), peclet::flow::vof::vofBatchDebrisWrite(), peclet::flow::vof::vofBatchMark(), peclet::flow::vof::vofJobInner(), peclet::flow::vof::vofSetOffsets(), and wispEps.
Referenced by debrisPassBatch().
|
inline |
The host half of the debris pass: the ledger of debrisPassBatchImpl, from the packet.
Definition at line 2264 of file block_container.hpp.
References debrisRemove, peclet::flow::vof::kDbActed, peclet::flow::vof::kDbDV, peclet::flow::vof::kDbND, peclet::flow::vof::kDbPending, peclet::flow::vof::kDbSumD, peclet::flow::vof::kDbSumR, and kPk.
Referenced by debrisPassBatch(), and recentreBatched().
|
inline |
Definition at line 2300 of file block_container.hpp.
References kPk.
Referenced by advectBatched(), debrisBatched(), and recentreBatched().
Stage 5 of §5.9 on the batched path: every master block's bubble box in one launch, then read #2 – the boxes, the debris sums and the WO-R ledger in ONE device->host copy – then the debris ledger, the WO-R ledger and the recentre decisions, exactly as the per-block path takes them.
The recentre copies themselves are rare and stay per block.
Definition at line 2311 of file block_container.hpp.
References applyDebrisLedger(), batchTable(), bubbleEps, csfEnabled, debrisCensus, ensurePacket(), kPk, kPkBcv, kPkBox, peclet::flow::vof::kVofBlockBatch, makeJob(), recentreTo(), peclet::flow::vof::vofBatchBox(), and wispEps.
Referenced by advect().
| int peclet::flow::vof::VofBlockSet::recentrePad = 2 |
Cells of slack added beyond the margin when a block is re-centred, so a translating bubble re-allocates every pad + 1 steps instead of every step.
Pure bookkeeping: the transported colour is copied by GLOBAL index and is therefore bit-exact whatever the padding.
Definition at line 467 of file block_container.hpp.
Referenced by recentreTo().
| double peclet::flow::vof::VofBlockSet::cflLimit = 0.25 |
The Weymouth-Yue cap of every block advector.
On the BATCHED path (batched, C1) the Courant numbers of all master blocks are measured in one launch and checked before ANY block advects, so a violation throws from an untouched state; the per-block path had already advected the blocks earlier in the list when a later one threw (doc/vof_step_performance_design.md §9 R4: a successful step is identical either way, and a caller that catches the throw and retries with a smaller dt now retries from the state it started from).
Definition at line 474 of file block_container.hpp.
Referenced by recentreTo().
C1 (doc/vof_step_performance_design.md §4.6, §5.9): run each stage of the container step for ALL master blocks in one launch (vof/block_batch.hpp) instead of block by block.
Bitwise on the state; taken only where batchEligible() holds (uncut all-fluid blocks, the worklist on, no per-kernel timing, no debug switch) and the per-block path is kept beside it. false is the per-block path verbatim – the A/B switch of the ctests, not a user knob.
Definition at line 480 of file block_container.hpp.
Referenced by batchEligible().
| VofMasterAssign peclet::flow::vof::VofBlockSet::assignMode = VofMasterAssign::RoundRobin |
Rung W1 item (a): how masters are chosen, and how often the choice is revisited.
reassignEvery = 0 never re-assigns (W0's behaviour). A re-assignment MIGRATES the block's colour to the new master — nothing else in a block is state — so it is exact by construction and the bitwise gate holds ACROSS re-assignment events.
Definition at line 485 of file block_container.hpp.
Referenced by plannedMasters().
| long peclet::flow::vof::VofBlockSet::reassignEvery = 0 |
Definition at line 486 of file block_container.hpp.
Referenced by advect().
Rung W1 item (c): recycle the advectors a re-centring retires, keyed by the EXACT extent.
A translating bubble keeps its box SIZE and only moves its origin, so the hit rate is ~100 % and the ten Views of the new box are not allocated at all. A recycled advector has its colour and its three face-velocity fields zeroed on acquisition, which is exactly the state a freshly inited one is in (Kokkos value-initializes), so usePool is BITWISE inert — the ctest gates that rather than asserting it.
Definition at line 493 of file block_container.hpp.
| int peclet::flow::vof::VofBlockSet::poolCapacity = 8 |
advectors kept per extent; beyond it the retired one is freed
Definition at line 494 of file block_container.hpp.
Rung W2: form the CSF face force on each block (its own curvature cascade, the V4 balanced -force rule on the block's faces) and SUM it into the caller's global face-force fields.
Definition at line 497 of file block_container.hpp.
Referenced by advect(), blockKappaHost(), debrisBatched(), debrisPassBatch(), debrisPassBatchImpl(), enableCsf(), recentreBatched(), and recentreTo().
| double peclet::flow::vof::VofBlockSet::sigma = 0.0 |
surface-tension coefficient of the block CSF (cell units)
Definition at line 498 of file block_container.hpp.
Referenced by buildCsfForce(), computeCsfBatched(), enableCsf(), and anderson_synthetic_maps.LinearMapSolver::step().
| VofCurvature peclet::flow::vof::VofBlockSet::curvProto = blockCurvProto() |
The curvature cascade's TUNABLES for every block, copied into each block's own VofCurvature when it is allocated.
This is not decoration: interfaceEps (the wisp guard on the interfacial predicate) is what makes a block's curvature a function of the INTERFACE rather than of the Weymouth-Yue round-off residue, and without it a 1e-16 colour difference between two decompositions flips a cascade branch and moves the CSF face force by O(1e-3) – measured, on the rung-W2 MPI gate, before this was propagated. The solver sets it from its own set_vof_interface_eps / set_surface_tension, so the block and structured paths run the SAME estimator.
Definition at line 507 of file block_container.hpp.
Referenced by allocateCsf(), debrisBatched(), debrisPassBatchImpl(), gateSolverMetric(), setKappaMax(), setMetric(), and setWispEps().
| double peclet::flow::vof::VofBlockSet::bubbleEps = 1e-12 |
The colour threshold that defines the BUBBLE EXTENT (and hence the box).
Weymouth-Yue leaves round-off residue in every cell its sweeps touch — measured down to 1e-35 and of either sign (the same residue that made the V4 curvature cascade need interfaceEps = 1e-8) — so a literal C != 0 extent grows along the bubble's whole WAKE and the block degenerates into the global field. 1e-12 is 12 orders below any physical colour and ~5 orders above the residue; what it drops is accumulated into VofBlockStats::discarded.
Definition at line 522 of file block_container.hpp.
Referenced by bubbleBox(), and recentreBatched().
| double peclet::flow::vof::VofBlockSet::wispEps = 0.0 |
The Weymouth-Yue wisp tolerance of every block advector (WyAdvector::wispEps); the solver sets it to its own global advector's value (doc/vof_overlap_design.md §12.1: a block run at 0 reconstructs 1e-33 residue into NaN).
It also floors the box threshold (§12.2): residue below it is frozen in place by the advector and must never define the bubble extent. Default 0 = the W0 container verbatim (the standalone gates).
Definition at line 528 of file block_container.hpp.
Referenced by advect(), bubbleBox(), debrisBatched(), debrisPassBatchImpl(), recentreBatched(), and setWispEps().
| double peclet::flow::vof::VofBlockSet::areaEps = 1e-8 |
Wisp guard on the INTERFACE-AREA predicate (VofBlockStats::area), the same threshold and the same reason as the curvature's interfaceEps.
A Weymouth-Yue round-off wisp satisfies 0 < C < 1, its MYC normal is degenerate (the stencil is all zeros, so the kernel returns (1,0,0)) and plicAlpha(1,0,0,1e-15) puts a plane just inside the face: the polygon is the FULL unit square and the cell contributes an area of 1. Measured: three such cells made the reported area of a marker differ by 3.0 cells^2 between np = 1 and np = 4, off a colour that agreed to 1e-14.
Definition at line 546 of file block_container.hpp.
Referenced by interfaceArea(), and measureBatched().
Let a block SHRINK when it has grown much larger than the bubble needs.
Off gives a block that only ever grows — the G3 reference (a block large enough that it never has to move).
Definition at line 549 of file block_container.hpp.
Referenced by recentreTo().
Debris predicate threshold (doc/vof_overlap_design.md §11): an interfacial cell is debris when NO cell of its 5^3 stencil holds more than half a cell of the marker's colour – TBFsolver's fragment rule with "full" read as C > 1/2.
A discretization constant, not a knob. (The §5.2 size rule, sum_{5^3} C < 1, was measured not to separate debris from attached fringe cells: fragments 0.10-1.24 against attached >= 1.19 on the channel_18 dumps.)
Definition at line 555 of file block_container.hpp.
Referenced by debrisBatched(), and debrisPassBatchImpl().
Run the debris pass in advect() (only while the block CSF is on – a kinematic block run never pays for it).
With debrisRemove off it only COUNTS: nothing in the state moves.
Definition at line 558 of file block_container.hpp.
Referenced by advect(), debrisBatched(), debrisPassBatch(), debrisPassBatchImpl(), and recentreBatched().
Remove the debris and return its volume (§5.3).
Solver default: ON under enable_vof_block_csf, via diagnostics.set_vof_block_debris.
Definition at line 561 of file block_container.hpp.
Referenced by applyDebrisLedger(), debrisBatched(), and debrisPassBatchImpl().
Instrument: fence-bounded wall time of the debris/residue pass (all blocks, all calls) while timingOn; debrisCalls counts block-passes.
Diagnostic only.
Definition at line 564 of file block_container.hpp.
Referenced by debrisPassBatch().
| double peclet::flow::vof::VofBlockSet::debrisSeconds = 0.0 |
Definition at line 565 of file block_container.hpp.
Referenced by debrisPassBatch().
| long peclet::flow::vof::VofBlockSet::debrisCalls = 0 |
Definition at line 566 of file block_container.hpp.
Referenced by debrisPassBatch().
Guard of the volume return (§5.3 step 3): a marker whose attached interface holds less than this much colour (cell volumes) keeps its debris (counted in debrisUnresolved).
Definition at line 573 of file block_container.hpp.
Referenced by debrisBatched(), and debrisPassBatchImpl().
|
staticconstexpr |
Definition at line 1407 of file block_container.hpp.
Referenced by debrisPassBatchImpl().
The per-job packet of read #2 (§5.9): the debris slots (VofDebrisSlot), the bubble box, the WO-R ledger.
One row of kPk doubles per master block, in block order.
Definition at line 2299 of file block_container.hpp.
Referenced by recentreBatched().
Definition at line 2299 of file block_container.hpp.
Referenced by advectBatched(), and recentreBatched().
Definition at line 2299 of file block_container.hpp.
Referenced by advectBatched(), applyDebrisLedger(), debrisBatched(), ensurePacket(), and recentreBatched().