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

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

Free functions of the elliptic operator: apply_laplacian (matvec), poisson_residual (residual), gs_color/gs_smooth (red-black Gauss-Seidel smoother), zero_conductor (embedded Dirichlet). More...

+ Include dependency graph for poisson_operator.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::detail::ApplyLaplacianKernel
 
struct  pops::detail::PoissonResidualKernel
 
struct  pops::detail::DivergenceKernel
 
struct  pops::detail::GsColorKernel
 
struct  pops::detail::ZeroConductorKernel
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Functions

POPS_HD Real pops::eps_harmonic (Real ec, Real ev)
 
POPS_HD void pops::detail::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)
 
POPS_HD Real pops::detail::cross_div (const ConstArray4 &p, bool hxy, const ConstArray4 &axy, bool hyx, const ConstArray4 &ayx, int i, int j, Real idx, Real idy)
 
void pops::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)
 
void pops::apply_divergence (const MultiFab &fx, const MultiFab &fy, const Geometry &geom, MultiFab &div_out, int cx=0, int cy=0)
 
void pops::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)
 
void pops::detail::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)
 
void pops::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)
 
void pops::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)
 
void pops::zero_conductor (MultiFab &phi, const MultiFab &mask)
 

Detailed Description

Free functions of the elliptic operator: apply_laplacian (matvec), poisson_residual (residual), gs_color/gs_smooth (red-black Gauss-Seidel smoother), zero_conductor (embedded Dirichlet).

Layer: include/pops/numerics/elliptic/poisson. Role: low-level bricks of the geometric multigrid (geometric_mg.hpp) and matvec of the Krylov solver (krylov_solver.hpp). The operator is provided as FREE FUNCTIONS (not a type): no concept constrains them. GLOBAL convention: we solve L(phi) = -div(A grad phi) + kappa phi = f_phys; internally the kernels assemble L_int = div(A grad phi) - kappa phi and poisson_residual returns res = f - L_int. Contract: all optional coefficients default to nullptr and THEN give back EXACTLY the bit-identical historical path – mask (embedded boundary, pins phi=0 in the conductor), coef (Shortley-Weller cut-cell weights, order 2 at the boundary), eps/eps_y (variable permittivity, isotropic or diagonal anisotropic, harmonic face mean), kappa (reaction term), a_xy/a_yx (FULL tensor, EXPLICIT cross terms, A possibly non-symmetric).

Invariants:

  • FACE permittivity = HARMONIC mean of the two adjacent centers (continuous normal flux, correct even for discontinuous eps); the cross term uses the ARITHMETIC mean (not a normal flux);
  • the gs_smooth smoother stays 5 POINTS (diagonal block): the cross terms a_xy/a_yx are EXPLICIT, carried only by the residual -> for strongly non-symmetric A the GS V-cycle may NOT converge (a Krylov solver is then required, cf. krylov_solver.hpp);
  • the kernels are NAMED FUNCTORS (and not POPS_HD lambdas) because they are first-instantiated from an external TU: an extended lambda would break the device kernel emission under nvcc;
  • the red-black sweep is parallelizable (a red cell depends only on black cells).