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

flow — OPT-IN forensics for the ghost-projection overlay (PECLET_FLOW_GP_DEBUG). More...

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <Kokkos_Core.hpp>
#include <string>
#include <vector>
#include "ghost_projection.hpp"

Go to the source code of this file.

Classes

struct  peclet::flow::GpRowCensus
 Row/face census of the overlay: face-state counts, the theta and rho histograms and the max |closure weight| per row (QUAD/LIN faces only, both weight sets). More...
struct  peclet::flow::GpRhoMismatch
 Neighbour rho mismatch: the row scaling is a LEFT diagonal scaling of a nonsymmetric operator, so a row whose rho differs sharply from its neighbours' has coefficients a_ij / a_ji differing by that ratio. More...

Namespaces

namespace  peclet
namespace  peclet::flow

Typedefs

template<class Real>
using peclet::flow::GpOverlayHost = GpOverlayT<Kokkos::HostSpace, Real>
 The report's host view of an overlay: the first nRows rows of every array it reads (w_bc is not read and stays empty).

Functions

int peclet::flow::gpDebugLevel ()
 0 = off (default). Read once per call; cheap enough, and keeps the flag hot-swappable in tests.
template<class Real>
GpOverlayHost< Real > peclet::flow::gpOverlayRowsToHost (const GpOverlayReal< Real > &ov, int nRows)
template<class Real>
float peclet::flow::gpRowFaceCensus (const GpOverlayHost< Real > &h, int s, GpRowCensus &c)
 Face census of row s into c; returns the row's max |closure weight|.
template<class Real>
GpRowCensus peclet::flow::gpRowCensus (const GpOverlayHost< Real > &h, int nRows)
template<class Real>
GpRhoMismatch peclet::flow::gpRhoMismatch (const GpOverlayHost< Real > &h, int nRows, C3 nn, Kokkos::View< int *, Kokkos::HostSpace > hId)
void peclet::flow::gpPrintCensus (int rank, int nRows, long nInner, const GpRowCensus &c, const GpRhoMismatch &m)
template<class Real>
void peclet::flow::gpPrintWorstRows (const GpOverlayHost< Real > &h, int nRows, C3 nn, const GpRowCensus &c, const GpRhoMismatch &m)
 The 20 worst rows by rho, with their full face anatomy.
template<class Real>
void peclet::flow::gpDumpRows (const GpOverlayHost< Real > &h, int nRows, C3 nn, int rank)
 PECLET_FLOW_GP_DEBUG=2: every overlay row to <PECLET_FLOW_GP_DEBUG_FILE>_rank<r>.bin (record layout in the file header).
template<class Real>
void peclet::flow::gpDebugReport (const GpOverlayReal< Real > &ov, int nRows, C3 nn, Kokkos::View< int *, CCMem > idMap, int rank=0)
 Census + optional per-row dump of the built overlay.

Variables

constexpr const char * peclet::flow::gpStateName [5] = {"COUPLED", "QUAD", "LIN", "BC_ONLY", "EXPLICIT"}
 Face-state names, indexed by GpOverlayT::state (GP_COUPLED .. GP_EXPLICIT).

Detailed Description

flow — OPT-IN forensics for the ghost-projection overlay (PECLET_FLOW_GP_DEBUG).

PRECISION-EXEMPT (whole file, QUALITY_PLAN G.6): opt-in debug forensics that never feeds a solve (see below); its float census/dump precision is unrelated to operator correctness. gpDebugReport is templated on Real only so it compiles against whatever GpOverlayReal<Real> IbmSolver::gpOv_ uses (ghost_projection.hpp) – its own locals stay float deliberately.

Analysis-only instrumentation, in the style of PECLET_FLOW_AGMG_DEBUG: nothing here runs unless the environment variable is set, and nothing here feeds the solve. It answers phase-A2 of doc/ghost_hardening_plan.md — "is the divergence seeded by a handful of identifiable pathological rows, and which branch of the face cascade produces them?".

PECLET_FLOW_GP_DEBUG=1 print the row/face census: per-state face counts, theta histogram (incl. the EXTENDED sliver band theta in (1,2)), the row rescale rho histogram, max |closure weight| per row, and the neighbour rho-MISMATCH histogram (max_nb |log10(rho_r / rho_nb)|, the row scaling's contribution to operator asymmetry), plus the 20 worst rows by rho with their full face anatomy. PECLET_FLOW_GP_DEBUG=2 additionally dump every overlay row to PECLET_FLOW_GP_DEBUG_FILE (default gp_rows_rank<r>.bin) as fixed-width records, for offline correlation against the packing (see tests/study/ghost_projection_apriori.py –forensics).

Record layout (little-endian, one per overlay row), matching the numpy dtype in the reader: int32 x, y, z inner-grid coordinates of the row's cell float32 rho row rescale = min(1, min_f D_f) over the MATRIX weights int8 coupled 1 if the row has any phi coupling int8 state[6] face cascade state, slot k = 2*axis + (0 = plus, 1 = minus) float32 th[6] theta per face float32 wm1[6], wm2[6] matrix (implicit phi) closure weights float32 w1[6], w2[6] rhs/diagnostic closure weights

Definition in file ghost_projection_debug.hpp.