core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::solver::detail::anderson Namespace Reference

Classes

struct  MixColumns
 The window columns the mix reads, oldest first. More...
 
struct  ScaledEig
 The Jacobi-scaled eigendecomposition of a Gram block G: A = D⁻¹ G D⁻¹, D = diag(G)^{1/2} (design §4.4 steps 1–3). More...
 
struct  SumN
 N independent double sums in one reduction. More...
 

Typedefs

using InnerPolicy = Kokkos::MDRangePolicy< ExecSpace, Kokkos::IndexType< Index >, Kokkos::Rank< 3, Kokkos::Iterate::Left, Kokkos::Iterate::Left > >
 Inner-region policy, x (the first index) fastest in tiles and within a tile on every backend (suite CONVENTIONS §1; the same policy as flow's MDRange3).
 
template<class T >
using DeviceScalar = Kokkos::View< T, MemSpace >
 A reduction result held on the device: a reduction into it does not synchronise the host, so a phase's reductions queue back to back and are read back behind one fence (design §6.1).
 
using Mat = double[kMaxWindow][kMaxWindow]
 

Functions

InnerPolicy innerPolicy (const IVec< 3 > &e, int g)
 
void countChanged (View< const double > buf, View< const double > prev, const IVec< 3 > &e, int g, const DeviceScalar< Index > &out)
 COUNT: inner entries where buf != prev, into out (no host synchronisation).
 
void mix (View< double > buf, View< double > xOut, View< const double > rPrev, const MixColumns &cols, double beta)
 MIX (design §4.3 step 1, §4.5): x = buf − ΔG γ − (1−β)(Rprev − ΔR γ); buf = X = x. Padded.
 
void diff (View< const double > buf, View< double > x, View< const double > rPrev, View< const double > gPrev, View< double > dRs, View< double > dGs)
 DIFF (step 3): r = buf − X; dR_s = r − Rprev; dG_s = buf − Gprev; X = r. Padded.
 
void residual (View< const double > buf, View< double > x)
 R (step 3, first evaluation): X = buf − X. Padded.
 
void selfSums (View< const double > x, View< const double > buf, const IVec< 3 > &e, int g, const DeviceScalar< SumN< 2 > > &out)
 Pass 2, residual part: {Σ X², Σ buf²} over the inner entries of one Velocity field, into out (no host synchronisation).
 
void columnSums (View< const double > dRs, View< const double > dRj, View< const double > x, const IVec< 3 > &e, int g, const DeviceScalar< SumN< 2 > > &out)
 Pass 2, one window column j against the new column s, over the inner entries of one Velocity field: {⟨dR_s,dR_j⟩, ⟨dR_j,X⟩}, into out (no host synchronisation).
 
void jacobiEigen (int n, Mat &a, Mat &v, double(&lam)[kMaxWindow])
 Cyclic Jacobi eigendecomposition of the symmetric n×n a (overwritten), fixed sweep order p < q row-major; stops when the off-diagonal Frobenius norm is ≤ 1e-15·‖A‖_F or after 50 sweeps (design §4.4 step 3).
 
ScaledEig scaledEigen (int n, const Mat &gram)
 
void truncatedSolve (const ScaledEig &se, const double *b, double condMin, double *x)
 x = D⁻¹ Σ_i v_i (v_iᵀ D⁻¹ b)/λ_i over the eigenvalues λ_i ≥ condMin·λ_max (and > 0): the truncated solve of design §4.4 step 5 (after the caller's column drops, nothing is truncated).
 

Variables

constexpr int kMaxWindow = 8
 

Typedef Documentation

◆ InnerPolicy

using peclet::core::solver::detail::anderson::InnerPolicy = typedef Kokkos::MDRangePolicy<ExecSpace, Kokkos::IndexType<Index>, Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left> >

Inner-region policy, x (the first index) fastest in tiles and within a tile on every backend (suite CONVENTIONS §1; the same policy as flow's MDRange3).

Definition at line 77 of file anderson.hpp.

◆ DeviceScalar

A reduction result held on the device: a reduction into it does not synchronise the host, so a phase's reductions queue back to back and are read back behind one fence (design §6.1).

Definition at line 118 of file anderson.hpp.

◆ Mat

Function Documentation

◆ innerPolicy()

InnerPolicy peclet::core::solver::detail::anderson::innerPolicy ( const IVec< 3 > &  e,
int  g 
)
inline

Definition at line 81 of file anderson.hpp.

Referenced by columnSums(), countChanged(), and selfSums().

◆ countChanged()

void peclet::core::solver::detail::anderson::countChanged ( View< const double >  buf,
View< const double >  prev,
const IVec< 3 > &  e,
int  g,
const DeviceScalar< Index > &  out 
)
inline

COUNT: inner entries where buf != prev, into out (no host synchronisation).

Definition at line 121 of file anderson.hpp.

References innerPolicy().

Referenced by peclet::core::solver::AndersonCore::prepare().

◆ mix()

void peclet::core::solver::detail::anderson::mix ( View< double >  buf,
View< double >  xOut,
View< const double >  rPrev,
const MixColumns &  cols,
double  beta 
)
inline

MIX (design §4.3 step 1, §4.5): x = buf − ΔG γ − (1−β)(Rprev − ΔR γ); buf = X = x. Padded.

Definition at line 143 of file anderson.hpp.

Referenced by peclet::core::solver::AndersonCore::prepare().

◆ diff()

void peclet::core::solver::detail::anderson::diff ( View< const double >  buf,
View< double >  x,
View< const double >  rPrev,
View< const double >  gPrev,
View< double >  dRs,
View< double >  dGs 
)
inline

DIFF (step 3): r = buf − X; dR_s = r − Rprev; dG_s = buf − Gprev; X = r. Padded.

Definition at line 161 of file anderson.hpp.

◆ residual()

void peclet::core::solver::detail::anderson::residual ( View< const double >  buf,
View< double >  x 
)
inline

R (step 3, first evaluation): X = buf − X. Padded.

Definition at line 174 of file anderson.hpp.

◆ selfSums()

void peclet::core::solver::detail::anderson::selfSums ( View< const double >  x,
View< const double >  buf,
const IVec< 3 > &  e,
int  g,
const DeviceScalar< SumN< 2 > > &  out 
)
inline

Pass 2, residual part: {Σ X², Σ buf²} over the inner entries of one Velocity field, into out (no host synchronisation).

Definition at line 183 of file anderson.hpp.

References innerPolicy().

◆ columnSums()

void peclet::core::solver::detail::anderson::columnSums ( View< const double >  dRs,
View< const double >  dRj,
View< const double >  x,
const IVec< 3 > &  e,
int  g,
const DeviceScalar< SumN< 2 > > &  out 
)
inline

Pass 2, one window column j against the new column s, over the inner entries of one Velocity field: {⟨dR_s,dR_j⟩, ⟨dR_j,X⟩}, into out (no host synchronisation).

Reads dR_s, dR_j and X only (design §6.1, rev 2: no reduction reads a dG column; dG is read by MIX alone).

Definition at line 199 of file anderson.hpp.

References innerPolicy().

◆ jacobiEigen()

void peclet::core::solver::detail::anderson::jacobiEigen ( int  n,
Mat &  a,
Mat &  v,
double(&)  lam[kMaxWindow] 
)
inline

Cyclic Jacobi eigendecomposition of the symmetric n×n a (overwritten), fixed sweep order p < q row-major; stops when the off-diagonal Frobenius norm is ≤ 1e-15·‖A‖_F or after 50 sweeps (design §4.4 step 3).

Eigenvalue i is lam[i], its eigenvector the column v[·][i].

Definition at line 220 of file anderson.hpp.

Referenced by scaledEigen().

◆ scaledEigen()

◆ truncatedSolve()

void peclet::core::solver::detail::anderson::truncatedSolve ( const ScaledEig &  se,
const double *  b,
double  condMin,
double *  x 
)
inline

x = D⁻¹ Σ_i v_i (v_iᵀ D⁻¹ b)/λ_i over the eigenvalues λ_i ≥ condMin·λ_max (and > 0): the truncated solve of design §4.4 step 5 (after the caller's column drops, nothing is truncated).

Definition at line 296 of file anderson.hpp.

References kMaxWindow, and peclet::core::solver::detail::anderson::ScaledEig::n.

Variable Documentation

◆ kMaxWindow

constexpr int peclet::core::solver::detail::anderson::kMaxWindow = 8
inlineconstexpr

Definition at line 73 of file anderson.hpp.

Referenced by truncatedSolve().