|
core 0.5.0
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
|
#include <momentum.hpp>
Classes | |
| struct | Result |
Public Member Functions | |
| void | setJacobi (int preSweeps, double omega) |
| void | setDistributed (std::function< void(View< double >)> refresh, std::function< double(double)> dotReduce, Index nExt) |
Distributed solve (docs/amr_distributed_flow.md, rung 2): refresh re-fills the ghost tail [op.n, nExt) of a vector from its owners (LeafHaloExchange::exchange) and is called before EVERY read of a vector's neighbour entries — the initial residual, each preconditioner Jacobi sweep, each matvec of a preconditioned direction. | |
| void | setPreconditioner (std::function< void(View< const double >, View< double >)> fn) |
Set a generic preconditioner z = M⁻¹ r (a host callable that launches device kernels) — the multigrid V-cycle gives the smooth-mode coverage Jacobi lacks, so the momentum iteration count stops growing with N. | |
| double | solveJacobi (const MomentumOp &op, View< double > u, View< const double > b, int sweeps) |
Plain weighted-Jacobi solve (the simple parallel mirror of the host GS smoother): sweeps damped-Jacobi sweeps of A u = b in place. | |
| Result | solveDefectCorrection (const MomentumOp &op, View< double > u, View< const double > b, int maxIters=200, double tol=1e-8) |
| MG-preconditioned defect-correction (Richardson) solve of A u = b in place: u ← u + M⁻¹(b − A u), M = the preconditioner (velocity-MG if set, else Jacobi sweeps). | |
| Result | solveBiCGStab (const MomentumOp &op, View< double > u, View< const double > b, int maxIters=500, double tol=1e-10) |
| Jacobi-preconditioned BiCGStab solve of A u = b in place. | |
Definition at line 443 of file momentum.hpp.
|
inline |
Definition at line 445 of file momentum.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
Distributed solve (docs/amr_distributed_flow.md, rung 2): refresh re-fills the ghost tail [op.n, nExt) of a vector from its owners (LeafHaloExchange::exchange) and is called before EVERY read of a vector's neighbour entries — the initial residual, each preconditioner Jacobi sweep, each matvec of a preconditioned direction.
dotReduce folds a local dot into the global one (an MPI_Allreduce lambda — kept as a callable so this header stays MPI-free; local rows only, ghosts are never summed). Scratch vectors are allocated at nExt so they can carry ghost tails. Jacobi preconditioning reads only the previous iterate, so the distributed iterate sequence matches the single-rank one bit-for-bit up to the dots' reduction order. Unset (default): the single-rank behaviour, bit-identical.
Definition at line 459 of file momentum.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
Set a generic preconditioner z = M⁻¹ r (a host callable that launches device kernels) — the multigrid V-cycle gives the smooth-mode coverage Jacobi lacks, so the momentum iteration count stops growing with N.
Decoupled from the MG type (Galerkin MomentumMG or rediscretized VelocityMG) via std::function, so the two coarse-operator strategies are interchangeable (and the solver carries no MG type). Pass an empty function to revert to damped-Jacobi. The preconditioner never changes the converged solution (the matvec is the exact operator).
Definition at line 472 of file momentum.hpp.
References peclet::core::amr::transferFieldGradients().
|
inline |
Plain weighted-Jacobi solve (the simple parallel mirror of the host GS smoother): sweeps damped-Jacobi sweeps of A u = b in place.
Returns the final residual L2.
Definition at line 478 of file momentum.hpp.
References peclet::core::amr::jacobiMom(), peclet::core::amr::MomentumOp::n, peclet::core::amr::residualMom(), and peclet::core::amr::transferFieldGradients().
|
inline |
MG-preconditioned defect-correction (Richardson) solve of A u = b in place: u ← u + M⁻¹(b − A u), M = the preconditioner (velocity-MG if set, else Jacobi sweeps).
Unlike BiCGStab it cannot break down — robust for the strongly non-symmetric momentum operator with implicit-FOU advection, where the velocity-MG (built from the viscous base) is only an approximate inverse. Converges when the advection is a perturbation of the viscous+reaction operator (low–moderate cell Reynolds number). maxIters caps the iterations; tol is relative to ||b−Au₀||.
Definition at line 502 of file momentum.hpp.
References peclet::core::amr::axpy(), peclet::core::amr::MomentumOp::n, peclet::core::amr::residualMom(), and peclet::core::amr::transferFieldGradients().
|
inline |
Jacobi-preconditioned BiCGStab solve of A u = b in place.
maxIters caps the outer iterations; tol is relative to ||b−Au0||. Returns {iters, final residual L2}.
Definition at line 532 of file momentum.hpp.
References peclet::core::amr::applyMom(), peclet::core::amr::axpy(), peclet::core::amr::bicgPUpdate(), peclet::core::amr::MomentumOp::n, peclet::core::amr::residualMom(), and peclet::core::amr::transferFieldGradients().