core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
anderson.hpp File Reference
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <exception>
#include <functional>
#include <limits>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "peclet/core/common/types.hpp"
#include "peclet/core/common/view.hpp"

Go to the source code of this file.

Classes

struct  peclet::core::solver::AndersonComm
 The collectives of a distributed run. More...
 
struct  peclet::core::solver::AndersonState
 The state descriptor (design §5.1): exactly what the caller's step reads across steps, as full padded x-fastest buffers over one box, with their roles. More...
 
struct  peclet::core::solver::detail::anderson::SumN< N >
 N independent double sums in one reduction. More...
 
struct  Kokkos::reduction_identity< peclet::core::solver::detail::anderson::SumN< N > >
 
struct  peclet::core::solver::detail::anderson::MixColumns
 The window columns the mix reads, oldest first. More...
 
struct  peclet::core::solver::detail::anderson::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...
 
class  peclet::core::solver::AndersonCore
 

Namespaces

namespace  peclet
 
namespace  peclet::core
 
namespace  peclet::core::solver
 
namespace  peclet::core::solver::detail
 
namespace  peclet::core::solver::detail::anderson
 
namespace  Kokkos
 

Typedefs

using peclet::core::solver::detail::anderson::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 peclet::core::solver::detail::anderson::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 peclet::core::solver::detail::anderson::Mat = double[kMaxWindow][kMaxWindow]
 

Enumerations

enum class  peclet::core::solver::AndersonRole : int { peclet::core::solver::Velocity = 0 , peclet::core::solver::Carried = 2 }
 What a state field is to the metric (design §3.1–3.2, rev 1: the metric is velocity only). More...
 

Functions

InnerPolicy peclet::core::solver::detail::anderson::innerPolicy (const IVec< 3 > &e, int g)
 
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)
 COUNT: inner entries where buf != prev, into out (no host synchronisation).
 
void peclet::core::solver::detail::anderson::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 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)
 DIFF (step 3): r = buf − X; dR_s = r − Rprev; dG_s = buf − Gprev; X = r. Padded.
 
void peclet::core::solver::detail::anderson::residual (View< const double > buf, View< double > x)
 R (step 3, first evaluation): X = buf − X. Padded.
 
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)
 Pass 2, residual part: {Σ X², Σ buf²} over the inner entries of one Velocity field, into out (no host synchronisation).
 
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)
 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 peclet::core::solver::detail::anderson::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 peclet::core::solver::detail::anderson::scaledEigen (int n, const Mat &gram)
 
void peclet::core::solver::detail::anderson::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 peclet::core::solver::detail::anderson::kMaxWindow = 8