|
core 0.5.0
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
|
#include <pcg.hpp>
Classes | |
| struct | Result |
Public Types | |
| using | MG = Multigrid< Dim, Bits > |
Public Member Functions | |
| void | setVcycle (int pre, int post, int bottom, double omega) |
| V-cycle parameters used for the preconditioner application. | |
| void | setCyclesPerPrec (int k) |
| Number of V-cycles per preconditioner application (default 1). | |
| void | setSingular (bool s) |
| Whether to project out the constant nullspace (default true; set false for the non-singular homogeneous-Dirichlet operator). | |
| void | setDistributed (std::function< void(View< double >)> refresh, std::function< double(double)> dotReduce, Index nExt) |
Distributed solve (docs/amr_distributed_flow.md, rung 3): refresh re-fills the ghost tail [n, nExt) of a vector before its neighbour entries are read (the CG direction ahead of every matvec); dotReduce folds a local sum into the global one (an MPI_Allreduce lambda — a callable so this header stays MPI-free), applied to every volume-weighted dot AND to the nullspace-projection mean sums. | |
| template<class MGT = MG> | |
| Result | solve (MGT &mg, View< double > x, View< const double > rhs, int maxIters=200, double tol=1e-10) |
Solve L x = rhs on mg's finest level into x (size n; nExt distributed). | |
| using peclet::core::amr::PCG< Dim, Bits >::MG = Multigrid<Dim, Bits> |
|
inline |
V-cycle parameters used for the preconditioner application.
Definition at line 139 of file pcg.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
|
inline |
Whether to project out the constant nullspace (default true; set false for the non-singular homogeneous-Dirichlet operator).
Definition at line 149 of file pcg.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
Distributed solve (docs/amr_distributed_flow.md, rung 3): refresh re-fills the ghost tail [n, nExt) of a vector before its neighbour entries are read (the CG direction ahead of every matvec); dotReduce folds a local sum into the global one (an MPI_Allreduce lambda — a callable so this header stays MPI-free), applied to every volume-weighted dot AND to the nullspace-projection mean sums.
Scratch (and the search direction) allocate at nExt so they carry ghost tails; the multigrid passed to solve() must size its finest x(0)/b(0) at the same nExt (DistributedFlowMultigrid does). Unset (default): the single-rank behaviour, bit-identical.
Definition at line 159 of file pcg.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
Solve L x = rhs on mg's finest level into x (size n; nExt distributed).
Returns iteration count and residual history. tol is relative to the initial residual; maxIters caps the CG iterations. The multigrid mg must already be built (operator + hierarchy); any type exposing op(0)/x(0)/b(0)/numLeaves(0)/vcycle works (Multigrid, DistributedFlowMultigrid).
Definition at line 172 of file pcg.hpp.
References peclet::core::amr::applyFv(), peclet::core::amr::axpy(), peclet::core::amr::buildFluidMask(), peclet::core::amr::dotVol(), peclet::core::amr::FvOp::invVol, peclet::core::amr::maskSolid(), peclet::core::amr::negate(), peclet::core::amr::removeMeanVolReduced(), peclet::core::amr::transferFieldGradients(), and peclet::core::amr::zpby().