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

flow — the sharp conservative viscous stress at a VoF interface on the staggered MAC grid: band geometry (interfacial cells, virtual planes, edge owner sets), the per-sample PLIC fractions, the kinked least-squares fit of the interface state (τ̂, D̂_nn), the implicit face viscosity of the band edges and the explicit band terms. More...

#include <cstdint>
#include <Kokkos_Core.hpp>
#include <limits>
#include "face_props.hpp"
#include "mac_cutcell.hpp"
#include "peclet/core/vof/plic_regions.hpp"
#include "policy.hpp"
#include "vof/curvature_field.hpp"
#include "vof/plic.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::vof::SharpGeom
 The band geometry and the closure constants, by value into every kernel. More...
struct  peclet::flow::vof::SharpFaceProps
 The face viscosity under the sharp interface (§5.4 a, §6): a band edge across a (a ≠ c) takes μ̄_c,E = μ(F̄_c(E)), F̄_c the owner-set mean of the u_c row's own PLIC face fraction (§5.8); the time diagonal is VarFaceProps'. More...
struct  peclet::flow::vof::SvFitScratch
struct  peclet::flow::vof::SharpCensus
 The census of the band (§9, G-SV10) over [lo, hi), LOCAL to this block: interfacial cells, the virtual-plane cells among them, the film cells among those (both a-neighbours pure and of the other phase), and the fit fallbacks. More...

Namespaces

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

Typedefs

using peclet::flow::vof::SvByte = Kokkos::View<std::uint8_t*, CCMem>
 Per-cell byte fields on the solver block: the band class and the fit-fallback flag.
using peclet::flow::vof::SvByteConst = Kokkos::View<const std::uint8_t*, CCMem>
using peclet::flow::vof::SvList = Kokkos::View<long*, CCMem>
 The compacted interfacial cells of a fit (local linear indices), the device fit's worklist.
using peclet::flow::vof::SvScrD = Kokkos::View<double*, CCExec::scratch_memory_space, Kokkos::MemoryUnmanaged>
 Team scratch of the device fit, one team per interfacial cell: per row of the current chunk its 9 coefficients, its datum and whether it is present, and the 54 running entries (8 KB).
using peclet::flow::vof::SvScrI = Kokkos::View<int*, CCExec::scratch_memory_space, Kokkos::MemoryUnmanaged>

Enumerations

enum class  peclet::flow::vof::SvRole : int { peclet::flow::vof::kImplicit = 0 , peclet::flow::vof::kExplicit = 1 }
 Which half of the time split a SharpFaceProps feeds (§6.1, WO-5b): the implicit band (ibmBuildDiffusionVar) or the explicit transpose (addFullStressRhs). More...

Functions

static double peclet::flow::vof::ownerWeight (double g)
 The owner weight of a candidate whose plane distance exceeds the closest by g (§5.9 a): 1 on the plateau g ≤ τ₀, s²(3 − 2s) with s = (τ₁ − g)/(τ₁ − τ₀) on the ramp, 0 from τ₁ on and for NaN.
void peclet::flow::vof::sharpClassify (const SharpGeom &gg, SvByte cls)
 The band classes over the WHOLE solver block (§5.2, §5.7 Q-B).
constexpr int peclet::flow::vof::svItemRow (int it)
 The first row of item it (row order of SharpGeom::fitItem); kSvItems gives kSvRows.
template<class Member>
void peclet::flow::vof::sharpFitTeam (const Member &tm, const SvFitScratch &sc, const SharpGeom &g, const int K[3], const CCConst(&v)[3], long i, CCField t0, CCField t1, CCField t2, CCField dnn, SvByte fb)
 SharpGeom::fitCell of cell K on a whole team (the shape of curvFallbackTeam), per chunk of items in item order: (1) the lanes map the chunk's items to their rows' coefficients and data (fitItem, fitCoef); (2) ENTRY-PARALLEL accumulation: lane e continues the running sum of normal-equation entry e (from 0.0 before the first chunk) over the chunk's present rows in row order, with fitRow's expression; then (3) one lane solves (fitSolve) and stores.
void peclet::flow::vof::sharpFit (const SharpGeom &gg, const CCConst(&v)[3], CCField t0, CCField t1, CCField t2, CCField dnn, SvByte fb, C3 lo, C3 hi, SvList list)
 The τ̂/D̂_nn fit (§5.3) over the cells [lo, hi) of the solver block: interfacial cells get their fit (τ̂ = D̂ = 0 and fb = 1 on a fallback), every other cell τ̂ = D̂ = 0, fb = 0.
void peclet::flow::vof::sharpFit (const SharpGeom &gg, const CCConst(&v)[3], CCField t0, CCField t1, CCField t2, CCField dnn, SvByte fb, C3 lo, C3 hi)
 sharpFit with its own worklist (the unit tests; the solver keeps one per block).
void peclet::flow::vof::addSharpViscousRhs (int c, CCField bb, CCConst rs, const CCConst(&v)[3], const SharpGeom &gg, const CCConst(&tau)[3], CCConst dnn, int g, double wc, bool skipLoC, SvList list, long nl)
 The explicit band terms of the u_c rows over the inner cells [g, e−g)³ (§5.4): the τ-terms of the four (a, c) edges and the cell midsection + τ-terms at i and i − s_c, bb_c(i) += rs(i) · [ w_c (X(i) − X(i−s_c)) + Σ_a (Y(E_ac(i+s_a)) − Y(E_ac(i))) / (ℓ_a ℓ_c) ], a1 < a2 in that association order.
long peclet::flow::vof::sharpRhsCompact (const SharpGeom &gg, int g, SvList list)
 The cells of the inner box [g, e−g)³ whose band terms (addSharpViscousRhs) can be nonzero for some component: those with an interfacial cell in their 3×3×3 block (the cells i, i − s_c and the eight further cells of the four edges all lie in it).
void peclet::flow::vof::addSharpViscousRhs (int c, CCField bb, CCConst rs, const CCConst(&v)[3], const SharpGeom &gg, const CCConst(&tau)[3], CCConst dnn, int g, double wc, bool skipLoC)
 addSharpViscousRhs with its own worklist (the unit and MPI tests).
SharpCensus peclet::flow::vof::sharpCensus (const SharpGeom &gg, SvByteConst fb, C3 lo, C3 hi)

Variables

constexpr std::uint8_t peclet::flow::vof::kSvNone = 0
 Band class of a cell.
constexpr std::uint8_t peclet::flow::vof::kSvPlane = 1
constexpr std::uint8_t peclet::flow::vof::kSvVirtual0 = 2
constexpr int peclet::flow::vof::kSvNormalItems = 27
 The fit (§5.3) as items and rows (SharpGeom::fitItem): 27 block cells of 3 normal links, then 144 edges of 2 shear links; 369 rows; 45 + 9 normal-equation entries (upper triangle + rhs).
constexpr int peclet::flow::vof::kSvItems = 27 + 144
constexpr int peclet::flow::vof::kSvRows = 81 + 288
constexpr int peclet::flow::vof::kSvEntries = 45 + 9
constexpr double peclet::flow::vof::kSvOwnerTieTol = 1e-6
 The owner-set tolerance τ_own (§5.8), index units, absolute: the candidates of an edge whose plane distance is within τ_own of the closest form its owner set.
constexpr double peclet::flow::vof::kSvOwnerRampTol = 1e-5
 The end of the owner-weight ramp τ₁ (§5.9), index units, absolute: a candidate whose distance exceeds the closest by g ∈ (τ₀, τ₁) takes a partial weight, by g ≥ τ₁ none.
constexpr int peclet::flow::vof::kSvChunkItems = 32
 The device fit walks its items in chunks of kSvChunkItems (rows of a chunk: at most 91, the first chunk's 27 block cells x 3 + 5 edges x 2).
constexpr int peclet::flow::vof::kSvChunkRows = 3 * kSvNormalItems + 2 * (kSvChunkItems - 27)

Detailed Description

flow — the sharp conservative viscous stress at a VoF interface on the staggered MAC grid: band geometry (interfacial cells, virtual planes, edge owner sets), the per-sample PLIC fractions, the kinked least-squares fit of the interface state (τ̂, D̂_nn), the implicit face viscosity of the band edges and the explicit band terms.

Design: doc/vof_sharp_viscous_stress.md (§2, §5, §5.7, §7). Selected by set_vof_viscous_interface, whose default "auto" resolves to it in scope (§9); "averaged" never reaches this header, so it is bitwise the operator before it.

Coordinates. Solver block (ghost G), cell index i = x + y·e.x + z·e.x·e.y, cell i spanning [x, x+1] × [y, y+1] × [z, z+1] in index space; u_c(i) sits on the −c face of cell i. The colour and its PLIC planes live on the colour block (ghost G + d); a solver cell (x, y, z) is colour cell (x+d, y+d, z+d). Fractions are computed in index space (affine invariant); normals, strains and stresses are physical in the solver's internal units, with ℓ_a = h_a/h_ref and index velocity v_a = ũ_a/ℓ_a (doc/full_viscous_stress.md §3).

Edge E_ac(k). The edge along b (the third axis) at (x_a, x_c) = (k_a, k_c), in the b-layer k_b: the edge shared by cells k, k−s_a, k−s_c, k−s_a−s_c. It is the −a edge of the u_c control volume of cell k and the −c edge of the u_a control volume of cell k.

Owner set and weighted mean; plateau τ₀, C¹ ramp to τ₁; offset order for sums only (§5.7, §5.8, §5.9). An edge has no single owner: every interfacial cell t of the edge takes the weight w(d_t − d_min) (ownerWeight: 1 on the plateau g ≤ τ₀ = kSvOwnerTieTol, a C¹ smoothstep down to 0 at τ₁ = kSvOwnerRampTol; the closest cell always 1), its owner set is {w > 0}, and each output at the edge (face and link fractions, the interface-traction term) is the weighted mean Σ w G / Σ w of the single-owner outputs over that set. The fixed offset order – lexicographic in (dz, dy, dx), x fastest; on a block with ghost layers the order of the LOCAL linear index, translation-invariant across a periodic seam and a rank boundary (never the global index) – orders every sum over the cells of an edge (the owner-set means, τ̂); it never decides a winner.

The physical domain. A cell beyond a non-periodic global face (a domain ghost) is never interfacial: no rank owns it, so it has no fit (the fit runs on owned interfacial cells, §7) and is in no edge's owner set (§5.2: the owner set lies in the τ̂ set). Its neighbour's face is no virtual-plane face (§5.7 Q-B), and a link whose sample lies beyond the face is left out of the fit (§5.3); a sample ON the face is kept, its ghost velocity is data.

Definition in file sharp_viscous.hpp.