include/pops/coupling/schur/source/polar_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
|
polar_condensed_schur_source_stepper.hpp
Go to the documentation of this file.
5#include <pops/coupling/schur/core/schur_source_kernels.hpp> // shared geometry-free kernels + validate_krylov_params (#263)
11#include <pops/numerics/elliptic/polar/polar_tensor_operator.hpp> // PolarTensorKrylovSolver, apply_polar_tensor (#210)
203// The geometry-free extrapolate / energy / extract-velocity / copy-Bz kernels are shared with the
204// Cartesian stepper via <pops/coupling/schur/schur_source_kernels.hpp> (#263): detail::SchurExtrapolateScalarKernel,
205// SchurExtrapolateVelocityKernel, SchurEnergyKernel, ExtractVelocityKernel, CopyBzKernel. Their member
206// fields are named vx/vy but hold the polar velocity (vr/vtheta): the math is frame-independent. Only the
207// metric-bearing kernels above (operator-coeff, explicit-flux, RHS-assemble, reconstruct) stay local.
249 PolarCondensedSchurSourceStepper(const VariableSet& vars, int c_rho, int c_mx, int c_my, int c_E,
340 // periodic, radial Foextrap. PolarTensorKrylovSolver::set_coefficients also fills these ghosts, but
348 // 1b) ASSEMBLE the condensed right-hand side rhs_polar = Lap_polar phi^n + g div_polar(rho B^{-1} v^n).
349 // Lap_polar phi^n: apply_polar_tensor with A = I (coefficients at 1), SAME stencil as the solve.
ConstArray4 const_array() const
READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
Definition fab2d.hpp:96
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
SOURCE STAGE condensed by Schur in POLAR geometry, STANDALONE (transport frozen), GENERIC over any po...
Definition polar_condensed_schur_source_stepper.hpp:230
int momentum_x_comp() const
Definition polar_condensed_schur_source_stepper.hpp:434
void step(MultiFab &state, MultiFab &phi, const MultiFab &bz_field, int c_bz, Real theta, Real dt)
POLAR condensed SOURCE STAGE, IN-PLACE on state and phi.
Definition polar_condensed_schur_source_stepper.hpp:304
void set_krylov(Real tol, int max_iters)
Tolerance / iteration budget of the polar Krylov solve.
Definition polar_condensed_schur_source_stepper.hpp:427
PolarCondensedSchurSourceStepper(const VariableSet &vars, int c_rho, int c_mx, int c_my, int c_E, const PolarGeometry &geom, const BoxArray &ba, const BCRec &bcPhi, Real alpha, PolarPrecond precond=PolarPrecond::RadialLine)
EXPLICIT-COMPONENT variant (audit wave 3, parity with the Cartesian stepper): the caller DESIGNATES t...
Definition polar_condensed_schur_source_stepper.hpp:249
int density_comp() const
Definition polar_condensed_schur_source_stepper.hpp:433
const PolarKrylovResult & last_solve() const
Diagnostic of the last solve (BiCGStab iterations, relative residual, convergence).
Definition polar_condensed_schur_source_stepper.hpp:423
PolarCondensedSchurSourceStepper(const VariableSet &vars, const PolarGeometry &geom, const BoxArray &ba, const BCRec &bcPhi, Real alpha, PolarPrecond precond=PolarPrecond::RadialLine)
vars: descriptor of the fluid block; MUST expose Density / MomentumX / MomentumY (Energy optional).
Definition polar_condensed_schur_source_stepper.hpp:238
bool has_energy() const
true if the model carries an Energy role (energy update active).
Definition polar_condensed_schur_source_stepper.hpp:298
int energy_comp() const
Definition polar_condensed_schur_source_stepper.hpp:436
int momentum_y_comp() const
Definition polar_condensed_schur_source_stepper.hpp:435
MATRIX-FREE BiCGStab Krylov solver for the FULL-tensor POLAR elliptic operator L_int(phi) = div(A gra...
Definition polar_tensor_operator.hpp:332
void set_coefficients(MultiFab *a_rr, MultiFab *a_tt, MultiFab *a_rt=nullptr, MultiFab *a_tr=nullptr)
Sets the tensor A coefficients.
Definition polar_tensor_operator.hpp:391
Parallel seam: minimal MPI abstraction (rank/size + collectives) with serial fallback.
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 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
void apply_polar_tensor(const MultiFab &phi, const PolarGeometry &geom, MultiFab &lap, const MultiFab *a_rr, const MultiFab *a_tt, const MultiFab *a_rt, const MultiFab *a_tr)
Applies L_int(phi) = div(A grad phi) in polar over the whole MultiFab.
Definition polar_tensor_operator.hpp:259
PolarPrecond
Choice of the SIMPLE BiCGStab PRECONDITIONER (NO MG V-cycle – stagnation on polar 1/r^2,...
Definition polar_tensor_operator.hpp:319
@ RadialLine
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).
Iterative POLAR elliptic operator with anisotropic TENSOR coefficient (cross terms).
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
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
Definition geometry.hpp:59
Box2D domain
nx() = nr (radial cells), ny() = ntheta (azimuthal cells)
Definition geometry.hpp:60
Result of a polar BiCGStab solve: iterations, relative residual, convergence.
Definition polar_tensor_operator.hpp:304
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
dst <- src (component 0).
Definition polar_condensed_schur_source_stepper.hpp:211
Array4 d
Definition polar_condensed_schur_source_stepper.hpp:212
POPS_HD void operator()(int i, int j) const
Definition polar_condensed_schur_source_stepper.hpp:214
ConstArray4 s
Definition polar_condensed_schur_source_stepper.hpp:213
EXPLICIT flux F = rho B^{-1} v^n = B^{-1}(mr, mtheta) at the center (physical components (e_r,...
Definition polar_condensed_schur_source_stepper.hpp:132
int c_my
MomentumX (= radial), MomentumY (= azimuthal) components.
Definition polar_condensed_schur_source_stepper.hpp:137
Real th_dt
theta * dt (w = th_dt * B_z)
Definition polar_condensed_schur_source_stepper.hpp:136
ConstArray4 bz
B_z field at the center.
Definition polar_condensed_schur_source_stepper.hpp:134
ConstArray4 s
fluid state (mr, mtheta read at components c_mx, c_my)
Definition polar_condensed_schur_source_stepper.hpp:133
int c_mx
Definition polar_condensed_schur_source_stepper.hpp:137
POPS_HD void operator()(int i, int j) const
Definition polar_condensed_schur_source_stepper.hpp:138
Array4 ft
output: F_r, F_theta = B^{-1}(mr, mtheta)
Definition polar_condensed_schur_source_stepper.hpp:135
Array4 fr
Definition polar_condensed_schur_source_stepper.hpp:135
POLAR condensed tensor coefficients A = I + c rho B^{-1} at cell centers.
Definition polar_condensed_schur_source_stepper.hpp:110
ConstArray4 s
fluid state (read rho)
Definition polar_condensed_schur_source_stepper.hpp:111
int c_rho
Density component.
Definition polar_condensed_schur_source_stepper.hpp:117
Array4 att
output: a_rr, a_tt (diagonal of A)
Definition polar_condensed_schur_source_stepper.hpp:113
Array4 art
Definition polar_condensed_schur_source_stepper.hpp:114
ConstArray4 bz
B_z field at the center.
Definition polar_condensed_schur_source_stepper.hpp:112
POPS_HD void operator()(int i, int j) const
Definition polar_condensed_schur_source_stepper.hpp:118
Array4 arr
Definition polar_condensed_schur_source_stepper.hpp:113
Real c
c = theta^2 dt^2 alpha
Definition polar_condensed_schur_source_stepper.hpp:115
Array4 atr
output: cross terms a_rt, a_tr
Definition polar_condensed_schur_source_stepper.hpp:114
Real th_dt
theta * dt (w = th_dt * B_z, binv depends only on w)
Definition polar_condensed_schur_source_stepper.hpp:116
Reconstructs v^{n+theta} = B^{-1}(v^n - theta dt grad_polar phi^{n+theta}) and writes mom = rho^n v^{...
Definition polar_condensed_schur_source_stepper.hpp:176
ConstArray4 vt
v^n (components 0: velocity, NOT momentum)
Definition polar_condensed_schur_source_stepper.hpp:178
Real th_dt
theta * dt (w = th_dt * B_z, and gradient factor)
Definition polar_condensed_schur_source_stepper.hpp:182
int c_my
Density / MomentumX (radial) / MomentumY (azimuthal) components.
Definition polar_condensed_schur_source_stepper.hpp:185
Real r_min
Definition polar_condensed_schur_source_stepper.hpp:184
Real half_idr
Definition polar_condensed_schur_source_stepper.hpp:183
Array4 nvt
output: v^{n+theta} (component 0) for the energy / the diagnostic
Definition polar_condensed_schur_source_stepper.hpp:181
ConstArray4 vr
Definition polar_condensed_schur_source_stepper.hpp:178
int c_mx
Definition polar_condensed_schur_source_stepper.hpp:185
ConstArray4 phi
phi^{n+theta} (ghosts filled: centered grad reads i+-1, j+-1)
Definition polar_condensed_schur_source_stepper.hpp:177
Real half_idth
1/(2 dr), 1/(2 dtheta)
Definition polar_condensed_schur_source_stepper.hpp:183
ConstArray4 bz
B_z field at the center.
Definition polar_condensed_schur_source_stepper.hpp:179
Array4 nvr
Definition polar_condensed_schur_source_stepper.hpp:181
Array4 st
fluid state (WRITE mr, mtheta; READ rho)
Definition polar_condensed_schur_source_stepper.hpp:180
Real dr
for r_cell(i) (azimuthal metric 1/r)
Definition polar_condensed_schur_source_stepper.hpp:184
POPS_HD void operator()(int i, int j) const
Definition polar_condensed_schur_source_stepper.hpp:186
int c_rho
Definition polar_condensed_schur_source_stepper.hpp:185
rhs_polar(i,j) = lap_polar(i,j) (= Lap_polar phi^n) + g * div_polar F, second-order centered POLAR di...
Definition polar_condensed_schur_source_stepper.hpp:153
ConstArray4 lap
Lap_polar phi^n (positive sign, A=I)
Definition polar_condensed_schur_source_stepper.hpp:154
Real half_idth
1/(2 dr), 1/(2 dtheta)
Definition polar_condensed_schur_source_stepper.hpp:158
POPS_HD void operator()(int i, int j) const
Definition polar_condensed_schur_source_stepper.hpp:160
ConstArray4 fr
Definition polar_condensed_schur_source_stepper.hpp:155
Real r_min
Definition polar_condensed_schur_source_stepper.hpp:159
Real dr
for r_cell(i), r_cell(i+-1)
Definition polar_condensed_schur_source_stepper.hpp:159
Real half_idr
Definition polar_condensed_schur_source_stepper.hpp:158
Real g
theta dt alpha
Definition polar_condensed_schur_source_stepper.hpp:157
ConstArray4 ft
flux F at the center (ghosts filled)
Definition polar_condensed_schur_source_stepper.hpp:155
Array4 rhs
output: condensed right-hand side (L_int sign)
Definition polar_condensed_schur_source_stepper.hpp:156
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
Base scalar types and the POPS_HD macro (host+device portability).
Descriptor of a model's variables (Vars).
Generated by