include/pops/numerics/elliptic/poisson/poisson_operator.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_operator.hpp
Go to the documentation of this file.
46// Weights of the FOUR faces (xm, xp, ym, yp) at (i,j) for the FACE permittivity path (he), with or
49// permittivity, otherwise 1/h^2 (idx2 / idy2) is applied. Free POPS_HD functor (device-clean) shared
74// Divergence of the CROSS FLUXES of the full tensor at (i,j): d_x(Axy d_y phi) + d_y(Ayx d_x phi),
103// NAMED FUNCTORS (and not POPS_HD lambdas) for the Poisson operator and Gauss-Seidel smoother kernels.
105// first-instantiated from the MG V-cycle pulled from an external TU (harness / native loader); an extended
106// lambda there breaks the device kernel emission under nvcc (null kernel-stub -> Cuda segfault in
107// Release -O without -g). Body STRICTLY identical to the former lambdas (same he/hc/hk branches,
125 int c; // component the matvec acts on; 0 for the scalar Poisson path (bit-identical 2-arg access)
127 if (he) { // face permittivity (harmonic), with or without cut-cell (coefficient path: comp 0 only)
135 else // bare 5-point stencil, applied PER COMPONENT (c); c==0 => the scalar path, bit-identical.
148// hx => FULL tensor: ADDITIVE cross fluxes (cf. ApplyLaplacianKernel). hx=false => bit-identical.
247// div = d fx/dx + d fy/dy, centered (the matching inverse of the centered gradient). The x-flux is
248// read from component @p cx of @p fx and the y-flux from component @p cy of @p fy, so the 2-component
249// output of the centered gradient (field_postprocess: d/dx in component 0, d/dy in component 1) can be
250// fed back as a SINGLE field passed for both arguments (apply_divergence(g, g, geom, out, 0, 1)) to
251// recover the 5-point Laplacian, or two distinct single-component fluxes with cx = cy = 0. Ghosts (1
252// layer) assumed filled by the caller. Mirrors apply_laplacian's structure (one local-fab loop, named
254// schur_condensation.hpp SchurRhsAssembleKernel, which fuses it with -Lap phi^n -- not refactored to
309// Red-black Gauss-Seidel smoother on one color (gs_color). p is WRITTEN in place. Body identical to
310// the former lambda -> bit-identical. See the comment of the other kernels (#93) for the motivation
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
int local_size() const
Number of fabs OWNED by this rank (bound on local indices).
Definition multifab.hpp:65
Fab2D: single-grid data on a Box2D (in-house equivalent of AMReX's FArrayBox); Array4 / ConstArray4: ...
for_each_cell and reductions: the parallelism SEAM over the cells of a Box2D; sync_host / sync_device...
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).
void gs_color(MultiFab &phi, const MultiFab &f, const Geometry &geom, int color, const MultiFab *mask, const MultiFab *coef, const MultiFab *eps, const MultiFab *kappa=nullptr, const MultiFab *eps_y=nullptr)
Definition poisson_operator.hpp:351
POPS_HD void face_weights(const ConstArray4 &ep, const ConstArray4 &ey, int i, int j, Real idx2, Real idy2, bool hc, const ConstArray4 &cf, Real &wxm, Real &wxp, Real &wym, Real &wyp)
Definition poisson_operator.hpp:52
POPS_HD Real cross_div(const ConstArray4 &p, bool hxy, const ConstArray4 &axy, bool hyx, const ConstArray4 &ayx, int i, int j, Real idx, Real idy)
Definition poisson_operator.hpp:79
Definition amr_hierarchy.hpp:29
void for_each_cell(const Box2D &b, F f)
Applies f to EACH cell (i, j) of box b (bounds inclusive), via Kokkos::parallel_for (Serial / OpenMP ...
Definition for_each.hpp:138
void zero_conductor(MultiFab &phi, const MultiFab &mask)
Definition poisson_operator.hpp:410
void apply_laplacian(const MultiFab &phi, const Geometry &geom, MultiFab &lap, 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:191
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 gs_smooth(MultiFab &phi, const MultiFab &f, const Geometry &geom, const BCRec &bc, int nsweeps, const MultiFab *mask=nullptr, const MultiFab *coef=nullptr, const MultiFab *eps=nullptr, const MultiFab *kappa=nullptr, const MultiFab *eps_y=nullptr)
Definition poisson_operator.hpp:389
void gs_rb_sweep(MultiFab &phi, const MultiFab &f, const Geometry &geom, const BCRec &bc, const MultiFab *mask=nullptr, const MultiFab *coef=nullptr, const MultiFab *eps=nullptr, const MultiFab *kappa=nullptr, const MultiFab *eps_y=nullptr)
Definition poisson_operator.hpp:377
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
void apply_divergence(const MultiFab &fx, const MultiFab &fy, const Geometry &geom, MultiFab &div_out, int cx=0, int cy=0)
Definition poisson_operator.hpp:256
void fill_ghosts(MultiFab &mf, const Box2D &domain, const BCRec &bc)
COMPLETE ghost filling: fill_boundary (interior + periodic, periodicity deduced from bc) THEN fill_ph...
Definition physical_bc.hpp:227
PHYSICAL boundary conditions at the domain edge (BCType, BCRec, fill_physical_bc, fill_ghosts).
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
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
POPS_HD Real dy() const
Grid spacing in y (= (yhi - ylo) / domain.ny()). POPS_HD.
Definition geometry.hpp:33
POPS_HD Real dx() const
Grid spacing in x (= (xhi - xlo) / domain.nx()). POPS_HD.
Definition geometry.hpp:31
Definition poisson_operator.hpp:113
POPS_HD void operator()(int i, int j) const
Definition poisson_operator.hpp:126
Definition poisson_operator.hpp:234
POPS_HD void operator()(int i, int j) const
Definition poisson_operator.hpp:239
Definition poisson_operator.hpp:312
POPS_HD void operator()(int i, int j) const
Definition poisson_operator.hpp:325
Definition poisson_operator.hpp:149
POPS_HD void operator()(int i, int j) const
Definition poisson_operator.hpp:163
Definition poisson_operator.hpp:399
POPS_HD void operator()(int i, int j) const
Definition poisson_operator.hpp:402
Base scalar types and the POPS_HD macro (host+device portability).
Generated by