include/pops/numerics/elliptic/poisson/poisson_fft_solver.hpp Source FileΒΆ
|
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
|
poisson_fft_solver.hpp
Go to the documentation of this file.
171 // Solve lap(phi) = rhs in place: local slab -> flat array -> PoissonFFT (internal MPI transpose)
187 // Discrete residual ||lap(phi) - rhs|| reduced over all ranks (~round-off: direct solve exact).
260 // single-box Cartesian layout, where box 0 is owned by rank dm_[0] (= owner_rank_) and every other
261 // rank holds an empty fab. It presents that layout outward (rhs()/phi() on ba/dm) and hides the
282 // Solve lap(phi) = rhs in place. THREE MPI collectives, in order: (1) MPI_Scatter the owner's box-major
283 // rhs into per-rank nyl_ x Nx_ slabs; (2) PoissonFFT::solve runs its internal MPI_Alltoall (y<->x
284 // transpose) + FFT on each slab; (3) MPI_Gather the phi slabs back onto the owner. Then the owner fills
285 // periodic ghosts on the System layout (intra-box wrap, no messages -> deadlock-free). The caller's
286 // device_fence() after ell_solve() (system_field_solver.hpp) covers the GPU read of the centered grad
342 // Periodic ghosts on the System layout: only the owner has a fab -> pure intra-box wrap (self-copy),
343 // no inter-rank messages, deadlock-free. SAME role as in PoissonFFTSolver::solve() (the centered grad
346 // PR #254 managed-buffer / device-ordering discipline: owner-only device_fence so the host gather +
348 // ell_solve() (system_field_solver.hpp) already brackets the grad-phi read, so this is belt-and-
355 // Discrete residual ||lap(phi) - rhs|| reduced over all ranks (~round-off: direct solve exact). The
356 // box is owner-only, so poisson_residual runs on the owner's fab and is 0 elsewhere; the all_reduce_max
BoxArray: the set of boxes tiling a level (disjoint, covering).
DIRECT periodic Poisson solver (spectral FFT) DISTRIBUTED, models EllipticSolver.
Definition poisson_fft_solver.hpp:143
DistributedFFTSolver(const Geometry &geom, const BCRec &=BCRec{}, std::function< bool(Real, Real)>={})
Definition poisson_fft_solver.hpp:145
Owning MPI rank of each box, indexed by GLOBAL box index (parallel to a BoxArray).
Definition distribution_mapping.hpp:19
ConstArray4 const_array() const
READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:96
Array4 array()
WRITE handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:91
Field distributed over a level: decomposition (BoxArray) + distribution (DistributionMapping) + ncomp...
Definition multifab.hpp:33
Fab2D & fab(int li)
Local fab at index li (0 <= li < local_size()), for writing.
Definition multifab.hpp:67
const Box2D & box(int li) const
VALID box of local fab li.
Definition multifab.hpp:71
Definition poisson_fft_solver.hpp:51
PoissonFFTSolver(const Geometry &geom, const BoxArray &ba, const BCRec &=BCRec{}, std::function< bool(Real, Real)>={}, bool spectral=false)
spectral: Laplacian symbol (false = discrete 5-point stencil, bit-identical default; true = continuou...
Definition poisson_fft_solver.hpp:55
Definition poisson_fft.hpp:101
void solve(const std::vector< double > &rho_local, std::vector< double > &phi_local)
Definition poisson_fft.hpp:126
DIRECT periodic Poisson solver (spectral FFT) under MPI, presenting the SYSTEM LAYOUT,...
Definition poisson_fft_solver.hpp:241
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,...
Definition poisson_fft_solver.hpp:246
Parallel seam: minimal MPI abstraction (rank/size + collectives) with serial fallback.
DistributionMapping: maps each box (by global index) to its owning MPI rank.
EllipticSolver concept: common contract for elliptic solvers at the MultiFab level (solve D phi = f),...
fill_boundary: INTRA-level halo exchange (fills ghosts from neighbors).
Geometry: index-space (Box2D) <-> Cartesian physical-space mapping; PolarGeometry: SIBLING for a glob...
MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
Definition amr_hierarchy.hpp:29
void device_fence()
Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory.
Definition kokkos_env.hpp:43
void fill_boundary(MultiFab &mf, const Box2D &domain, Periodicity per={})
BLOCKING halo exchange: begin then end immediately (no overlap).
Definition fill_boundary.hpp:333
void poisson_residual(MultiFab &phi, const MultiFab &f, const Geometry &geom, const BCRec &bc, MultiFab &res, const MultiFab *mask=nullptr, const MultiFab *coef=nullptr, const MultiFab *eps=nullptr, const MultiFab *kappa=nullptr, const MultiFab *eps_y=nullptr, const MultiFab *a_xy=nullptr, const MultiFab *a_yx=nullptr)
Definition poisson_operator.hpp:271
Real norm_inf(const MultiFab &mf, int comp=0)
Infinity norm max |f(.,.,comp)| over the valid cells (LOCAL, without MPI all_reduce).
Definition mf_arith.hpp:123
PHYSICAL boundary conditions at the domain edge (BCType, BCRec, fill_physical_bc, fill_ghosts).
Low-level FFT brick: PoissonFFT (spectral periodic Poisson solver, slab-distributed) plus 1D radix-2 ...
Free functions of the elliptic operator: apply_laplacian (matvec), poisson_residual (residual),...
WRITE POD handle (raw pointer + strides) over a Fab2D buffer, indexed by (i, j, c) IN GLOBAL INDICES ...
Definition fab2d.hpp:29
Boundary conditions for the FOUR faces of the domain (type + associated Dirichlet value).
Definition physical_bc.hpp:29
POPS_HD int nx() const
Width (direction 0). POPS_HD (called from Geometry::dx() in a device kernel).
Definition box2d.hpp:50
POPS_HD int ny() const
Height (direction 1). POPS_HD (called from Geometry::dy() in a device kernel).
Definition box2d.hpp:52
READ-only handle (const counterpart of Array4): same layout and same contract (POD device-copyable,...
Definition fab2d.hpp:44
Cartesian geometry of a level: index domain + physical bounds [xlo, xhi] x [ylo, yhi].
Definition geometry.hpp:20
Per-direction periodicity: halo wrapping in x and/or y during the exchange (false = open edge,...
Definition fill_boundary.hpp:37
Generated by