include/pops/numerics/elliptic/polar/polar_poisson_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
|
polar_poisson_solver.hpp
Go to the documentation of this file.
85// counterpart of the Cartesian concept: a future polar coupler (Phase 2b) would depend on this CONCEPT, not
126 // may have been filled by a device kernel (for_each_cell) possibly still in flight. We make the
128 // of the repo (cf. the sync_host()/device_fence() seam of for_each.hpp / MultiFab). Under Kokkos
129 // Cuda = a targeted device_fence() (otherwise: stale data -> cudaErrorIllegalInstruction). Under
130 // Kokkos Serial/OpenMP (host execution, unified memory) = a fence with no observable effect (no device
141 // We store per radial row i a vector of ntheta complex values (the azimuthal spectrum of the row).
152 // a_i (sub-diag), c_i (super-diag), and the radial part of the diagonal d_rad_i = -(a_i + c_i).
167 // Radial BC: Dirichlet (face) -> reflection ghost = 2 v - interior; Foextrap -> homogeneous Neumann
168 // (ghost = interior). We fold the boundary coefficient into the diagonal and, for Dirichlet, we
178 // matrix (Thomas on complex values: a/b/c real, complex right-hand side). phat[i][m] receives the
179 // radial spectrum of mode m. We loop m on the outside (matrix fixed for this m), i on the inside.
188 // eigenvalue of d_theta^2 = -k^2 (exact, not the 2-point stencil). dtheta does not appear here.
209 // r_max (i = nr-1): ghost phi_{nr}. Dirichlet -> phi_{nr} = 2 vhi - phi_{nr-1}, Neumann -> = phi_{nr-1}.
250 // of the RHS valid before reading (device kernel possibly in flight). phi_ is written host-side by
251 // solve(), but we also fence for symmetry/robustness if residual() is called independently. Under
344 // COMPLEX right-hand side. a[i] = sub-diag (couples i-1), b[i] = diag, c[i] = super-diag (couples i+1).
345 // a[0] and c[n-1] are NOT used (boundaries). @p pin0: if true, pins x[0] = 0 (gauge for mode 0,
BoxArray: the set of boxes tiling a level (disjoint, covering).
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
void sync_host()
Makes the HOST residence valid (before a host access: operator(), loop, set_val).
Definition multifab.hpp:79
const Box2D & box(int li) const
VALID box of local fab li.
Definition multifab.hpp:71
int local_size() const
Number of fabs OWNED by this rank (bound on local indices).
Definition multifab.hpp:65
Definition polar_poisson_solver.hpp:97
Real residual()
Discrete residual ||L_h phi - rhs|| (inf norm), reduced over the ranks.
Definition polar_poisson_solver.hpp:246
const PolarGeometry & geom() const
Definition polar_poisson_solver.hpp:117
void solve()
Solves (1/r) d_r(r d_r phi) + (1/r^2) d_theta^2 phi = rhs in place, by FFT-in-theta then a tridiagona...
Definition polar_poisson_solver.hpp:121
PolarPoissonSolver(const PolarGeometry &geom, const BoxArray &ba, const BCRec &bc=BCRec{})
Definition polar_poisson_solver.hpp:103
Parallel seam: minimal MPI abstraction (rank/size + collectives) with serial fallback.
Definition polar_poisson_solver.hpp:89
DistributionMapping: maps each box (by global index) to its owning MPI rank.
Fab2D: single-grid data on a Box2D (in-house equivalent of AMReX's FArrayBox); Array4 / ConstArray4: ...
Geometry: index-space (Box2D) <-> Cartesian physical-space mapping; PolarGeometry: SIBLING for a glob...
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
Definition amr_hierarchy.hpp:29
@ Dirichlet
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 ...
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
Definition geometry.hpp:59
POPS_HD Real r_face(int i) const
Radius at radial FACE i (face between cells i-1 and i; i = 0 -> r_min, i = nr -> r_max).
Definition geometry.hpp:75
POPS_HD Real r_cell(int i) const
Radius at the CENTER of radial cell i (i = 0 -> r_min + dr/2).
Definition geometry.hpp:73
Box2D domain
nx() = nr (radial cells), ny() = ntheta (azimuthal cells)
Definition geometry.hpp:60
Base scalar types and the POPS_HD macro (host+device portability).
Generated by