RemappedFFTSolver Class ReferenceΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
DIRECT periodic Poisson solver (spectral FFT) under MPI, presenting the SYSTEM LAYOUT, models EllipticSolver (ADC-287). More...
#include <poisson_fft_solver.hpp>
Collaboration diagram for pops::RemappedFFTSolver:Public Member Functions | |
| RemappedFFTSolver (const Geometry &geom, const BoxArray &ba, const BCRec &=BCRec{}, std::function< bool(Real, Real)>={}, bool spectral=false) | |
spectral: Laplacian symbol forwarded to PoissonFFT (false = discrete 5-point stencil, bit-identical default; true = continuous symbol -(kx^2+ky^2)). | |
| MultiFab & | rhs () |
| MultiFab & | phi () |
| const Geometry & | geom () const |
| void | solve () |
| Real | residual () |
Detailed Description
DIRECT periodic Poisson solver (spectral FFT) under MPI, presenting the SYSTEM LAYOUT, models EllipticSolver (ADC-287).
Role: let System.set_poisson(..., "fft"|"fft_spectral") run on n_ranks() > 1 WITHOUT touching the system field solver. Unlike DistributedFFTSolver (slabs, DistributionMapping(np, np)), this solver allocates rhs()/phi() on the System's own BoxArray/DistributionMapping (the single round-robin box, DistributionMapping(1, np) -> box on one owner rank). The whole box<->slab transpose is HIDDEN inside solve(): the System path (RHS assembly via add_poisson_rhs, the phi->aux derivation loop aligned on fab(li), fill_boundary, the device_fence ordering) keeps reading rhs()/phi() on the SAME layout as the aux, so system_field_solver.hpp needs no change beyond selecting this type.
Remap mechanics (the box lives ENTIRELY on the owner rank, so this is a scatter/gather, NOT a symmetric alltoall): solve() (1) the owner packs its full Nx*Ny rhs fab into per-slab contiguous buffers (slab r = global rows [r*nyl, (r+1)*nyl), full x); (2) MPI_Scatter -> each rank gets nyl*Nx row-major rho_local; (3) every rank calls the proven PoissonFFT::solve (its internal MPI_Alltoall does the y<->x transpose); (4) MPI_Gather phi_local -> owner; (5) owner unpacks into phi's valid cells; (6) owner fill_boundary fills the periodic ghosts (a pure intra-box wrap since only the owner has a fab -> no inter-rank messages, deadlock-free) so the centered grad phi reads correct halos.
Preconditions / constraints:
- the System box: ba.size() == 1 (the round-robin single box); rejected otherwise (collective throw);
- geom.domain.ny() % n_ranks() == 0 (equal slabs for the internal transpose); collective throw, no deadlock since ensure_elliptic is called collectively and every rank constructs the object;
- periodic BCs, constant coefficient (the BCRec and wall predicate are ignored; the System guards wall / variable-eps / anisotropic-eps / kappa BEFORE selecting this solver);
- Nx, Ny powers of two for the fast radix-2 path; otherwise PoissonFFT's correct O(n^2) DFT fallback.
Conservation / gauge: the scatter/gather is a pure permutation of doubles (no FP arithmetic, exact), so the charge integral is preserved bit-exactly through the remap; PoissonFFT zeroes the k=0 mode, so phi has zero mean. The only FP difference vs the single-rank PoissonFFTSolver is PoissonFFT's internal alltoall reassociation, already characterised at machine zero by test_mpi_fft_distributed (np=1/2/4).
NOTE: STRUCTURAL change pending the ADC-273 design vote (new EllipticSolver type in the System ell_ variant, new MPI collective pattern). Behind the existing "fft"/"fft_spectral" tokens; geometric_mg stays the MPI default and the only option for walls / variable-eps / kappa.
Constructor & Destructor Documentation
◆ RemappedFFTSolver()
|
inline |
spectral: Laplacian symbol forwarded to PoissonFFT (false = discrete 5-point stencil, bit-identical default; true = continuous symbol -(kx^2+ky^2)).
Same constructor shape as PoissonFFTSolver (BCRec and wall predicate accepted but ignored: periodic constant coefficient).
Member Function Documentation
◆ geom()
|
inline |
◆ phi()
|
inline |
◆ residual()
|
inline |
Here is the call graph for this function:◆ rhs()
|
inline |
◆ solve()
|
inline |
Here is the call graph for this function:The documentation for this class was generated from the following file:
- include/pops/numerics/elliptic/poisson/poisson_fft_solver.hpp
Generated by