include/pops/numerics/elliptic/mg/composite_fac_poisson.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
|
composite_fac_poisson.hpp
Go to the documentation of this file.
13#include <pops/numerics/elliptic/poisson/poisson_operator.hpp> // apply_laplacian (residual, reads the already-filled ghosts)
14#include <pops/numerics/time/amr/levels/amr_patch_range.hpp> // PatchRange, CoverageMask (coarse footprint of a patch)
182 // Schur builder); eps_f C-F ghosts = bilerp of eps_c (consistency of the coefficient flux across
402 // r_c = f_c - div(A grad phi_c) (apply_laplacian reads the already-filled ghosts; eps + cross if active).
403 // The cross terms are read also on the COVERED cells (= fine average after average_down) -> the
404 // 9-point stencil stays consistent at the interface; only the NORMAL flux is explicitly joined C-F
423 // coarse-fine join; the test !cov_.covered(I, J) defensively skips a bordering cell that would be
Named types of the multi-patch coarse-fine interface: PatchRange (coarse footprint of a fine patch),...
Box2D: the integer index space of a 2D cell-centered Cartesian grid.
BoxArray: the set of boxes tiling a level (disjoint, covering).
2-level COMPOSITE FAC Poisson solver (scalar).
Definition composite_fac_poisson.hpp:87
void use_variable_coefficient(bool v)
Definition composite_fac_poisson.hpp:154
void set_two_way(bool v)
true: iterate the FAC two-way coupling (C-F flux correction + coarse correction).
Definition composite_fac_poisson.hpp:175
int n_fine_patches() const
Number of fine patches (size of the fine BoxArray).
Definition composite_fac_poisson.hpp:170
CompositeFacPoisson(const Geometry &geom_c, const BoxArray &ba_c, const BCRec &bc, const Box2D &fine_box, int ratio=2)
MONO-PATCH CTOR (Phase 1): DELEGATES to the multi-patch ctor with a fine BoxArray of a single box,...
Definition composite_fac_poisson.hpp:95
MultiFab & rhs_fine()
fine right-hand side f_f (div(eps grad phi_f) = f_f)
Definition composite_fac_poisson.hpp:146
void set_verbose(bool v)
Definition composite_fac_poisson.hpp:172
void use_cross_terms(bool v)
Definition composite_fac_poisson.hpp:164
MultiFab & a_xy_coarse()
Cross terms a_xy / a_yx (at cell centers) PER LEVEL: FULL tensor A = diag(eps,eps) + [[0,...
Definition composite_fac_poisson.hpp:160
CompositeFacPoisson(const Geometry &geom_c, const BoxArray &ba_c, const BCRec &bc, const BoxArray &fine_boxes, int ratio=2)
MULTI-PATCH CTOR (Phase 4a).
Definition composite_fac_poisson.hpp:102
MultiFab & a_yx_coarse()
Definition composite_fac_poisson.hpp:161
Real solve(int max_iters=30, int fine_sweeps=400, Real tol=1e-9)
Solves the composite system.
Definition composite_fac_poisson.hpp:179
MultiFab & phi_coarse()
Definition composite_fac_poisson.hpp:147
MultiFab & rhs_coarse()
coarse right-hand side f_c (div(eps grad phi_c) = f_c)
Definition composite_fac_poisson.hpp:143
Real last_residual() const
Definition composite_fac_poisson.hpp:234
const Box2D & patch_coarse(int g) const
Coarse footprint of fine patch g (0 <= g < n_fine_patches()).
Definition composite_fac_poisson.hpp:168
const Box2D & patch_coarse() const
Coarse footprint of the FIRST fine patch (mono-patch compat). Multi-patch: see patch_coarse(g).
Definition composite_fac_poisson.hpp:166
MultiFab & eps_coarse()
VARIABLE permittivity eps (at cell centers) PER LEVEL.
Definition composite_fac_poisson.hpp:152
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
int solve(Real rel_tol, int max_cycles, Real abs_tol=Real(0))
Definition geometric_mg.hpp:407
void set_epsilon(std::function< Real(Real, Real)> eps_fn)
Definition geometric_mg.hpp:249
void set_cross_terms(std::function< Real(Real, Real)> a_xy_fn, std::function< Real(Real, Real)> a_yx_fn)
Definition geometric_mg.hpp:329
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
void set_val(Real v)
Fills all cells (valid + ghosts) of every local fab with v.
Definition multifab.hpp:85
int local_size() const
Number of fabs OWNED by this rank (bound on local indices).
Definition multifab.hpp:65
DistributionMapping: maps each box (by global index) to its owning MPI rank.
for_each_cell and reductions: the parallelism SEAM over the cells of a Box2D; sync_host / sync_device...
GeometricMG: in-house geometric multigrid (V-cycle) for the elliptic operator, Gauss-Seidel smoother ...
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).
POPS_HD Real fac_bilerp_coarse(const ConstArray4 &C, int i, int j, int r)
BILINEAR interpolation of the coarse potential (cell-centered, C with ghosts) at the CENTER of the fi...
Definition composite_fac_poisson.hpp:70
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 average_down(const MultiFab &fine, MultiFab &coarse, int r, MultiFab &cfine)
CONSERVATIVE average fine -> coarse (ratio r): coarse(I, J) = average of the r^2 fine cells of the bl...
Definition refinement.hpp:181
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
BCType
Boundary condition type for a face: Periodic (handled by fill_boundary), Foextrap (zero gradient,...
Definition physical_bc.hpp:25
@ Foextrap
@ Periodic
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).
Free functions of the elliptic operator: apply_laplacian (matvec), poisson_residual (residual),...
AMR inter-level transfer operators (integer ratio r) + parallel_copy.
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
static Box2D from_extents(int nx, int ny)
Box [0, nx-1] x [0, ny-1] covering nx*ny cells from the index origin.
Definition box2d.hpp:42
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 amr_patch_range.hpp:42
Base scalar types and the POPS_HD macro (host+device portability).
Generated by