include/pops/numerics/elliptic/poisson/poisson_fft.hpp File ReferenceΒΆ

adc_cpp: include/pops/numerics/elliptic/poisson/poisson_fft.hpp File 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
poisson_fft.hpp File Reference

Low-level FFT brick: PoissonFFT (spectral periodic Poisson solver, slab-distributed) plus 1D radix-2 FFT primitives (fft1d) and a direct DFT fallback (dft1d_direct). More...

#include <pops/parallel/comm.hpp>
#include <cmath>
#include <complex>
#include <numbers>
#include <utility>
#include <vector>
+ Include dependency graph for poisson_fft.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pops::PoissonFFT
 

Namespaces

namespace  pops
 

Typedefs

using pops::cplx = std::complex< double >
 

Functions

bool pops::is_pow2 (int n)
 
void pops::dft1d_direct (cplx *a, int n, bool inv)
 
void pops::fft1d (cplx *a, int n, bool inv)
 

Detailed Description

Low-level FFT brick: PoissonFFT (spectral periodic Poisson solver, slab-distributed) plus 1D radix-2 FFT primitives (fft1d) and a direct DFT fallback (dft1d_direct).

Layer: include/pops/numerics/elliptic/poisson. Role: solve EXACTLY the discrete periodic Laplacian lap_h phi = rho with phi of zero mean, in ONE transform (no iteration, no tolerance). Works on slabs (flat per-rank vectors, NOT MultiFab): this is the brick wrapped by PoissonFFTSolver/DistributedFFTSolver (poisson_fft_solver.hpp). 2D FFT = local FFT-x -> parallel transpose (MPI_Alltoall) -> local FFT-y -> division by the Laplacian eigenvalue -> inverse. Contract: each rank owns Ny/np rows (full x); solve(rho_local, phi_local) with rho_local and phi_local of size nyl_ x Nx_ (row-major). The ctor takes spectral (false = DISCRETE 5-point stencil eigenvalue, bit-identical default; true = CONTINUOUS symbol -(kx^2+ky^2), signed frequencies).

Invariants:

  • the slab transpose requires Nx and Ny divisible by np (n_ranks);
  • power-of-two lengths use the radix-2 FFT; any other size falls back to the correct O(n^2) direct DFT (the radix-2 butterfly would overflow the buffer on an arbitrary n), so single-rank accepts any n;
  • mode kx=ky=0: zero eigenvalue -> phi_hat=0 (zero mean enforced);
  • alltoall is the identity when np==1 (and without MPI).