include/pops/coupling/schur/core/schur_condensation.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
|
schur_condensation.hpp
Go to the documentation of this file.
224 // 1) -Lap phi^n: apply_laplacian WITHOUT coefficient = div(grad phi^n) (canonical Laplacian), negated.
235 // 2) EXPLICIT flux F = rho B^{-1} v^n = B^{-1} (mx, my), at the center (1 ghost for the centered div).
Owning MPI rank of each box, indexed by GLOBAL box index (parallel to a BoxArray).
Definition distribution_mapping.hpp:19
GENERIC builder of the condensed source stage for the electrostatic + Lorentz source (kind="electrost...
Definition schur_condensation.hpp:153
void assemble_operator(const MultiFab &state, const MultiFab &bz, const Geometry &geom, const BCRec &bc, MultiFab &eps_x, MultiFab &eps_y, MultiFab &a_xy, MultiFab &a_yx) const
Assembles ONLY the coefficients of the tensor operator A_op = I + c rho B^{-1} into MultiFab eps_x/ep...
Definition schur_condensation.hpp:185
int density_comp() const
Definition schur_condensation.hpp:174
SchurCondensationOperator assemble(MultiFab &phi_n, const MultiFab &state, const MultiFab &bz, const Geometry &geom, const BCRec &bc) const
COMPLETE assembly (operator + RHS) into one SchurCondensationOperator object allocated on the layout ...
Definition schur_condensation.hpp:262
Real c_coeff() const
c = theta^2 dt^2 alpha
Definition schur_condensation.hpp:173
int momentum_y_comp() const
Definition schur_condensation.hpp:176
ElectrostaticLorentzCondensation(const VariableSet &vars, Real alpha, Real theta, Real dt)
vars: descriptor of the fluid block; MUST expose the roles Density / MomentumX / MomentumY.
Definition schur_condensation.hpp:160
void assemble_rhs(MultiFab &phi_n, const MultiFab &state, const MultiFab &bz, const Geometry &geom, const BCRec &bc, MultiFab &rhs) const
Assembles ONLY the condensed right-hand side -Lap phi^n - theta dt alpha div(rho B^{-1} v^n).
Definition schur_condensation.hpp:216
int momentum_x_comp() const
Definition schur_condensation.hpp:175
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 DistributionMapping & dmap() const
GLOBAL distribution (owner rank per box).
Definition multifab.hpp:58
const BoxArray & box_array() const
GLOBAL decomposition of the level (all boxes, all ranks).
Definition multifab.hpp:56
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
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...
LorentzEliminator: 2x2 operator B of the Schur scheme for implicit velocity elimination.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
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 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
@ Density
@ MomentumX
@ MomentumY
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),...
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
LorentzEliminator: operator B = [[1,-w],[w,1]] and its analytic inverse.
Definition lorentz_eliminator.hpp:55
POPS_HD void apply_Binv(Real vx, Real vy, Real &vxp, Real &vyp) const
apply_Binv: applies B^{-1} = (1/det)*[[1,w],[-w,1]] to (vx, vy), writes (vxp, vyp)....
Definition lorentz_eliminator.hpp:73
Result of the Schur assembly: the coefficient MultiFab of the tensor operator A_op and the condensed ...
Definition schur_condensation.hpp:141
MultiFab a_xy
cross A_xy = c rho binv_12
Definition schur_condensation.hpp:144
MultiFab a_yx
cross A_yx = c rho binv_21
Definition schur_condensation.hpp:145
MultiFab eps_y
diagonal A_yy = 1 + c rho binv_22
Definition schur_condensation.hpp:143
MultiFab eps_x
diagonal A_xx = 1 + c rho binv_11
Definition schur_condensation.hpp:142
MultiFab rhs
condensed right-hand side -Lap phi^n - theta dt alpha div(rho B^{-1} v^n)
Definition schur_condensation.hpp:146
A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; ...
Definition variables.hpp:58
neg(i,j) = -src(i,j) (negation of component 0). Device-clean NAMED functor.
Definition schur_condensation.hpp:126
POPS_HD void operator()(int i, int j) const
Definition schur_condensation.hpp:129
EXPLICIT flux F = rho B^{-1} v^n (v = (mx,my)/rho) ASSEMBLED per cell, WRITTEN at the center into fx/...
Definition schur_condensation.hpp:91
Real th_dt
theta * dt (w = th_dt * B_z)
Definition schur_condensation.hpp:95
POPS_HD void operator()(int i, int j) const
Definition schur_condensation.hpp:97
ConstArray4 bz
B_z field at the center.
Definition schur_condensation.hpp:93
int c_my
MomentumX / MomentumY components.
Definition schur_condensation.hpp:96
Array4 fy
output: components of the flux F = B^{-1} (mx, my)
Definition schur_condensation.hpp:94
ConstArray4 s
fluid state (mx, my read at components c_mx, c_my)
Definition schur_condensation.hpp:92
Coefficients of the tensor operator A_op = I + c rho B^{-1} ASSEMBLED per cell from the fluid state a...
Definition schur_condensation.hpp:67
ConstArray4 s
fluid state
Definition schur_condensation.hpp:68
POPS_HD void operator()(int i, int j) const
Definition schur_condensation.hpp:75
int c_rho
Density component.
Definition schur_condensation.hpp:74
Array4 ey
output: eps_x, eps_y (diagonal of A)
Definition schur_condensation.hpp:70
Real th_dt
theta * dt (for LorentzEliminator: w = th_dt * B_z, and binv depends only on w)
Definition schur_condensation.hpp:73
Array4 ayx
output: cross terms a_xy, a_yx
Definition schur_condensation.hpp:71
Real c
c = theta^2 dt^2 alpha
Definition schur_condensation.hpp:72
ConstArray4 bz
B_z field at the center.
Definition schur_condensation.hpp:69
rhs(i,j) = lap(i,j) (= -Lap phi^n, already negated by the caller) - g * div F, second-order centered ...
Definition schur_condensation.hpp:112
ConstArray4 neg_lap
-Lap phi^n (already negated)
Definition schur_condensation.hpp:113
Real half_idy
1/(2 dx), 1/(2 dy)
Definition schur_condensation.hpp:117
POPS_HD void operator()(int i, int j) const
Definition schur_condensation.hpp:118
ConstArray4 fy
flux F at the center (ghosts filled)
Definition schur_condensation.hpp:114
Array4 rhs
output: condensed right-hand side
Definition schur_condensation.hpp:115
Base scalar types and the POPS_HD macro (host+device portability).
Descriptor of a model's variables (Vars).
Generated by