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

flow — the device pressure bottom's direct preconditioner (doc/vof_step_performance_ design.md §13): a block-tridiagonal factorization of the agglomerated bottom operator, planes along one axis, each plane's Schur complement inverted explicitly (block Thomas), in FacReal arithmetic (float in production), applied as M inside the bottom's FP64 flexible CG. More...

#include <Kokkos_Core.hpp>
#include "mac_cutcell.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::BottomPlanes
 
struct  peclet::flow::BottomDirect< FacReal >
 
struct  peclet::flow::BottomFactorKernel< FacReal, OpV >
 

Namespaces

namespace  peclet
 
namespace  peclet::flow
 

Macros

#define PECLET_BOTTOM_UNROLL
 
#define PECLET_BOTTOM_HOST_SIMD   PECLET_FLOW_OMP_SIMD
 

Functions

double peclet::flow::bottomShift (int attempt)
 
BottomPlanes peclet::flow::bottomChoosePlanes (C3 inner, const int bc[6])
 

Variables

constexpr int peclet::flow::kBottomMaxPlane = 192
 
constexpr int peclet::flow::kBottomTile = 16
 
constexpr double peclet::flow::kBottomPivotTol = 1e-6
 
constexpr int peclet::flow::kBottomAttempts = 3
 

Detailed Description

flow — the device pressure bottom's direct preconditioner (doc/vof_step_performance_ design.md §13): a block-tridiagonal factorization of the agglomerated bottom operator, planes along one axis, each plane's Schur complement inverted explicitly (block Thomas), in FacReal arithmetic (float in production), applied as M inside the bottom's FP64 flexible CG.

Container-free (Views and PODs only), so it can move to core::solver later (§13.9 Q-D8).

The scheme (§13.4, normative):

  • the bottom operator A is the level's face form {AFX, AFY, AFZ}; its diagonal is RE-SUMMED in FP64, d_i = -(sum of the six face coefficients, -x, +x, -y, +y, -z, +z), so A*1 = 0 exactly per fluid component (GraphAMG's rule: a face that crosses a non-periodic domain face is excluded); s_i = 1/sqrt(d_i) on fluid cells with d_i > 0, else 0 (an identity row);
  • the factored matrix is the scaled A~ = S A S, assembled in FP64 and cast to FacReal: diagonal 1, off-diagonals s_i AF s_j accumulated over cell i's six faces in that order;
  • the null space is lifted by the exact plane-local augmentation: 1/m_c added to every pair of component c's cells in its last plane k_c (m_c = its cells there), so A' x = r exactly for a compatible r (§13.4.2);
  • factor (one team, at the first bottom solve after each operator change): Sigma_0 = A^_0, Sigma_k = A^_k - diag(e_k) Q_{k-1} diag(e_k), Q_k = Sigma_k^{-1} by a tiled right-looking Cholesky (tile kBottomTile), W = L^{-1}, Q = W^T W; a periodic slow axis with P >= 3 adds the border Y = T^{-1} B and Q_B = (A^_{P-1} - diag(e_0) Y_0 - diag(e_{P-1}) Y_{P-2})^{-1}; a pivot <= 1e-6 (or a non-finite one) restarts the whole factor with delta = 1e-4, then 1e-2 on every scaled diagonal; a third failure sets facOk = 0;
  • M(r) (inside the solve kernel): cast r~ = FacReal(s r), forward and backward block substitution, the border, uncast z = s x~ on the fluid cells.

Reproducibility (§13.2): every stored or output scalar is computed by ONE thread in an order fixed by the algorithm and kBottomTile, never by the team size – no team reductions here – so the factor and M(r) are bitwise independent of T.

On a HOST backend the factor runs a second schedule of the same arithmetic (§14 H-1, A(b); BottomFactorKernel::hostAssemble / hostInvert / hostBorder): every stored scalar is the team algorithm's expression with its operands in the same order, but the work is cut into a few barrier-free phases per tile (the team version publishes every column of every diagonal tile with a barrier: ~170 per plane) and each phase computes many independent outputs in a vectorizable lane loop instead of one serial dot product per thread. Its factor storage (Q, Y, e, s, stat) is bitwise identical to the team algorithm's on the same backend (ctest bottom_direct U8); only the scratch layouts of Sg, L and W differ.

Definition in file mg_bottom_direct.hpp.

Macro Definition Documentation

◆ PECLET_BOTTOM_UNROLL

#define PECLET_BOTTOM_UNROLL

Definition at line 53 of file mg_bottom_direct.hpp.

◆ PECLET_BOTTOM_HOST_SIMD

#define PECLET_BOTTOM_HOST_SIMD   PECLET_FLOW_OMP_SIMD

Definition at line 60 of file mg_bottom_direct.hpp.