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

ctest pcg_breakdown: the breakdown exits of the device-resident single-rank MG-PCG driver (doc/vof_step_performance_design.md §5.6, WO-5 / A6). More...

#include <cmath>
#include <cstdio>
#include <cstring>
#include <Kokkos_Core.hpp>
#include <limits>
#include <vector>
#include "mac_cutcell_mg.hpp"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

ctest pcg_breakdown: the breakdown exits of the device-resident single-rank MG-PCG driver (doc/vof_step_performance_design.md §5.6, WO-5 / A6).

A6 keeps the Krylov scalars on the device and reads one packet {pAp, |r|inf, stop} per iteration, so a non-finite r^T z is flagged on the device and only reported by the NEXT iteration's packet (or, after the last iteration, by one read after the loop). The contract is that every exit returns the same iteration count and sets the same failure flag as the host-scalar loop, with x the pre-breakdown iterate. No healthy problem reaches these exits, so the solver's test hook setDebugBreakdown poisons one scalar with a NaN:

  • pAp at iteration k -> k iterations reported, failed, x == the iterate of a maxit = k solve
  • r^T z at iteration k -> k iterations reported, failed, x == the iterate of a maxit = k+1 solve (the host loop broke AFTER that iteration's x update)
  • r^T z at the LAST iteration (k = maxit-1) -> the same, through the post-loop read. x is compared bitwise over the whole array. The problem: a single-rank periodic 16^3 box with a smoothly varying face coefficient in [0.5, 1.5] (ratio 3) and a mean-free rhs; rtol 1e-30 so the solve never converges inside the window.

A second case needs no poisoning: a round-off constant rhs on the agglomerated bottom, whose own CG broke down on 0/0 (see roundoffBottom).

Definition in file test_pcg_breakdown.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 166 of file test_pcg_breakdown.cpp.