include/pops/coupling/schur/source/condensed_schur_source_stepper.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
|
condensed_schur_source_stepper.hpp
Go to the documentation of this file.
5#include <pops/coupling/schur/core/schur_condensation.hpp> // ElectrostaticLorentzCondensation (builder #124)
6#include <pops/coupling/schur/core/schur_source_kernels.hpp> // shared geometry-free kernels + validate_krylov_params (#263)
110// The 5 geometry-free source kernels (extrapolate-scalar/velocity, energy, extract-velocity, copy-Bz)
111// live in <pops/coupling/schur/schur_source_kernels.hpp> and are shared with the polar / AMR steppers (#263).
112// Only SchurReconstructKernel stays local: it carries the discretization-specific centered gradient.
194 // -1) freeze phi^n (for the final extrapolation; op_'s phi() will be overwritten by the solve).
197 // 0) extract v^n = (mx, my)/rho and copy B_z into the internal buffer (1 ghost filled afterwards).
223 // per call): solve() recomputes the entirety of its state per solve (prepare_solve, r0, directions),
224 // so the result is BIT-IDENTICAL to the old per-call construction of a local TensorKrylovSolver here.
244 // 5) EXTRAPOLATE phi and v from the theta-stage to the full step: f^{n+1} = f^n + (1/theta)(f^{n+theta}-f^n).
338 // PERSISTENT Krylov solver (BiCGStab + MG precond). Allocates its buffers (r/rhat/p/v/s/t/phat/
340 // op_/precond_/n_precond_ (which it references): init order (after them) and destruction order (before them)
Schur-condensed SOURCE STAGE, STANDALONE (transport frozen), GENERIC over any fluid block that expose...
Definition condensed_schur_source_stepper.hpp:126
void set_krylov(Real tol, int max_iters)
Tolerance / iteration budget of the stage Krylov solve (BiCGStab).
Definition condensed_schur_source_stepper.hpp:277
int density_comp() const
Definition condensed_schur_source_stepper.hpp:283
CondensedSchurSourceStepper(const VariableSet &vars, const Geometry &geom, const BoxArray &ba, const BCRec &bcPhi, Real alpha, int n_precond_vcycles=1)
vars: descriptor of the fluid block; MUST expose Density / MomentumX / MomentumY (Energy optional).
Definition condensed_schur_source_stepper.hpp:133
int momentum_x_comp() const
Definition condensed_schur_source_stepper.hpp:284
CondensedSchurSourceStepper(const VariableSet &vars, int c_rho, int c_mx, int c_my, int c_E, const Geometry &geom, const BoxArray &ba, const BCRec &bcPhi, Real alpha, int n_precond_vcycles=1)
Variant with EXPLICIT COMPONENTS (audit 2026-06, wave 2: roles/fields carried in the ABI).
Definition condensed_schur_source_stepper.hpp:146
bool has_energy() const
true if the model carries an Energy role (energy update active).
Definition condensed_schur_source_stepper.hpp:183
int energy_comp() const
Definition condensed_schur_source_stepper.hpp:286
const KrylovResult & last_solve() const
Diagnostic of the last solve (BiCGStab iterations, relative residual, convergence).
Definition condensed_schur_source_stepper.hpp:272
void step(MultiFab &state, MultiFab &phi, const MultiFab &bz_field, int c_bz, Real theta, Real dt)
Condensed SOURCE STAGE, IN-PLACE on state and phi.
Definition condensed_schur_source_stepper.hpp:190
int momentum_y_comp() const
Definition condensed_schur_source_stepper.hpp:285
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
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
ConstArray4 const_array() const
READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:96
void set_epsilon_anisotropic(std::function< Real(Real, Real)> eps_x_fn, std::function< Real(Real, Real)> eps_y_fn)
Definition geometric_mg.hpp:274
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
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...
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...
TensorKrylovSolver: MATRIX-FREE Krylov solver (BiCGStab) with MG preconditioning, for the FULL-TENSOR...
LorentzEliminator: 2x2 operator B of the Schur scheme for implicit velocity elimination.
MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
void validate_krylov_params(Real tol, int max_iters, const char *who)
Validates the Krylov tolerance / iteration budget shared by the Schur source steppers (historical con...
Definition schur_source_kernels.hpp:103
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 device_fence()
Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory.
Definition kokkos_env.hpp:43
@ Energy
@ 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).
BUILDER (NOT solver) of the Schur-condensed source stage of the implicit source coupling potential / ...
Geometry-INDEPENDENT device kernels shared by the Schur SOURCE-STAGE steppers: the Cartesian condense...
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
Outcome of a Krylov solve: iterations performed, final relative residual, convergence flag.
Definition krylov_result.hpp:16
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
A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; ...
Definition variables.hpp:58
Copies the B_z field (aux channel) into an internal scalar MultiFab (0 ghost is enough,...
Definition schur_source_kernels.hpp:93
Extracts the velocity v = (mx, my) / rho from the state (Density / MomentumX / MomentumY roles) into ...
Definition schur_source_kernels.hpp:79
Energy update: E^{n+1} = E^n + (1/2) rho^n (|v^{n+1}|^2 - |v^n|^2).
Definition schur_source_kernels.hpp:62
Linear extrapolation of a SCALAR field from the theta-stage to the full step: f^{n+1} = f^n + (1/thet...
Definition schur_source_kernels.hpp:32
Linear extrapolation of the VELOCITY (vx, vy) from the theta-stage to the full step,...
Definition schur_source_kernels.hpp:43
Reconstructs v^{n+theta} = B^{-1}(v^n - theta dt grad phi^{n+theta}) and writes mom = rho^n v^{n+thet...
Definition condensed_schur_source_stepper.hpp:85
ConstArray4 phi
phi^{n+theta} (ghosts filled: centered grad reads i+-1, j+-1)
Definition condensed_schur_source_stepper.hpp:86
ConstArray4 vy
v^n (component 0 of their MultiFab: velocity, NOT momentum)
Definition condensed_schur_source_stepper.hpp:87
Real half_idx
Definition condensed_schur_source_stepper.hpp:92
ConstArray4 vx
Definition condensed_schur_source_stepper.hpp:87
Array4 st
fluid state (WRITE mx, my; READ rho)
Definition condensed_schur_source_stepper.hpp:89
POPS_HD void operator()(int i, int j) const
Definition condensed_schur_source_stepper.hpp:94
int c_rho
Definition condensed_schur_source_stepper.hpp:93
Array4 nvy
output: v^{n+theta} (component 0) for the energy / the diagnostic
Definition condensed_schur_source_stepper.hpp:90
ConstArray4 bz
B_z field at the center.
Definition condensed_schur_source_stepper.hpp:88
Real half_idy
1/(2 dx), 1/(2 dy) (centered gradient)
Definition condensed_schur_source_stepper.hpp:92
Real th_dt
theta * dt (w = th_dt * B_z, and gradient factor)
Definition condensed_schur_source_stepper.hpp:91
int c_my
Density / MomentumX / MomentumY components.
Definition condensed_schur_source_stepper.hpp:93
Base scalar types and the POPS_HD macro (host+device portability).
Descriptor of a model's variables (Vars).
Generated by