include/pops/coupling/schur/source/polar_condensed_schur_source_stepper.hpp Source File

adc_cpp: 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.
1#pragma once
2
5#include <pops/coupling/schur/core/schur_source_kernels.hpp> // shared geometry-free kernels + validate_krylov_params (#263)
7#include <pops/mesh/geometry/geometry.hpp> // PolarGeometry
11#include <pops/numerics/elliptic/polar/polar_tensor_operator.hpp> // PolarTensorKrylovSolver, apply_polar_tensor (#210)
12#include <pops/numerics/linalg/lorentz_eliminator.hpp> // B^{-1} closed form (#118)
14
15#include <stdexcept>
16
101
102namespace pops {
103
104namespace detail {
105
117 int c_rho;
118 POPS_HD void operator()(int i, int j) const {
119 const Real rho = s(i, j, c_rho);
120 const LorentzEliminator le(th_dt, Real(1), bz(i, j, 0)); // w = th_dt * B_z
121 const Real cr = c * rho;
122 arr(i, j, 0) = Real(1) + cr * le.binv_11();
123 att(i, j, 0) = Real(1) + cr * le.binv_22();
124 art(i, j, 0) = cr * le.binv_12();
125 atr(i, j, 0) = cr * le.binv_21();
126 }
127};
128
137 int c_mx, c_my;
138 POPS_HD void operator()(int i, int j) const {
139 const LorentzEliminator le(th_dt, Real(1), bz(i, j, 0));
140 Real Fr, Ft;
141 le.apply_Binv(s(i, j, c_mx), s(i, j, c_my), Fr, Ft); // B^{-1}(mr, mtheta) = rho B^{-1} v
142 fr(i, j, 0) = Fr;
143 ft(i, j, 0) = Ft;
144 }
145};
146
160 POPS_HD void operator()(int i, int j) const {
161 const Real ri = r_min + (i + Real(0.5)) * dr;
162 const Real rip = r_min + (i + Real(1.5)) * dr; // r_cell(i+1)
163 const Real rim = r_min + (i - Real(0.5)) * dr; // r_cell(i-1)
164 const Real inv_r = Real(1) / ri;
165 const Real div_r =
166 (rip * fr(i + 1, j, 0) - rim * fr(i - 1, j, 0)) * half_idr; // d_r(r F_r) centered
167 const Real div_t = (ft(i, j + 1, 0) - ft(i, j - 1, 0)) * half_idth; // d_theta(F_th) centered
168 const Real divF = inv_r * (div_r + div_t);
169 rhs(i, j, 0) = lap(i, j, 0) + g * divF;
170 }
171};
172
186 POPS_HD void operator()(int i, int j) const {
187 const Real ri = r_min + (i + Real(0.5)) * dr;
188 const Real gr = (phi(i + 1, j, 0) - phi(i - 1, j, 0)) * half_idr; // d_r phi
189 const Real gt = (phi(i, j + 1, 0) - phi(i, j - 1, 0)) * (half_idth / ri); // (1/r) d_theta phi
190 const Real rhsr = vr(i, j, 0) - th_dt * gr; // (v^n - theta dt grad_polar phi)_r
191 const Real rhst = vt(i, j, 0) - th_dt * gt;
192 const LorentzEliminator le(th_dt, Real(1), bz(i, j, 0)); // w = th_dt * B_z
193 Real nr, nt;
194 le.apply_Binv(rhsr, rhst, nr, nt); // v^{n+theta} = B^{-1}(v^n - theta dt grad_polar phi)
195 nvr(i, j, 0) = nr;
196 nvt(i, j, 0) = nt;
197 const Real rho = st(i, j, c_rho); // rho^n (frozen in the source)
198 st(i, j, c_mx) = rho * nr; // mom^{n+theta} = rho^n v^{n+theta}
199 st(i, j, c_my) = rho * nt;
200 }
201};
202
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.
208
214 POPS_HD void operator()(int i, int j) const { d(i, j, 0) = s(i, j, 0); }
215};
216
217} // namespace detail
218
231 public:
239 const BoxArray& ba, const BCRec& bcPhi, Real alpha,
242 vars, vars.index_of(VariableRole::Density), vars.index_of(VariableRole::MomentumX),
243 vars.index_of(VariableRole::MomentumY), vars.index_of(VariableRole::Energy), geom, ba,
244 bcPhi, alpha, precond) {}
245
249 PolarCondensedSchurSourceStepper(const VariableSet& vars, int c_rho, int c_mx, int c_my, int c_E,
250 const PolarGeometry& geom, const BoxArray& ba,
251 const BCRec& bcPhi, Real alpha,
253 : vars_(vars),
254 c_rho_(c_rho),
255 c_mx_(c_mx),
256 c_my_(c_my),
257 c_E_(c_E),
258 alpha_(alpha),
259 geom_(geom),
260 bcPhi_(bcPhi),
261 precond_(precond),
262 ba_(ba),
263 dm_(ba.size(), n_ranks()),
264 // condensed tensor coefficients A = I + c rho B^{-1} (1 ghost: operator faces)
265 a_rr_(ba, dm_, 1, 1),
266 a_tt_(ba, dm_, 1, 1),
267 a_rt_(ba, dm_, 1, 1),
268 a_tr_(ba, dm_, 1, 1),
269 // condensed RHS buffers
270 lap_(ba, dm_, 1, 0),
271 rhs_(ba, dm_, 1, 0),
272 fr_(ba, dm_, 1, 1),
273 ft_(ba, dm_, 1, 1),
274 // a MultiFab at 1 (A=I) for the scalar Lap_polar of the RHS
275 one_rr_(ba, dm_, 1, 1),
276 one_tt_(ba, dm_, 1, 1),
277 bz_(ba, dm_, 1, 1),
278 phi_n_(ba, dm_, 1, 1),
279 vr_n_(ba, dm_, 1, 0),
280 vt_n_(ba, dm_, 1, 0),
281 vr_t_(ba, dm_, 1, 0),
282 vt_t_(ba, dm_, 1, 0) {
283 // MULTI-RANK MPI (theta-only split): no more single-rank safeguard. The layout constraint
284 // (each box covers the full radial range, required by the RadialLine preconditioner of the elliptic
285 // solve) is checked by the PolarTensorKrylovSolver built in step() (check_radial_columns)
286 // -> a clear error is raised on all ranks if the split cuts r. Single-rank / single box:
287 // path unchanged (the check passes trivially, all_reduce = identity in serial).
288 if (c_rho_ < 0 || c_mx_ < 0 || c_my_ < 0)
289 throw std::runtime_error(
290 "PolarCondensedSchurSourceStepper: the fluid block must expose the roles Density, "
291 "MomentumX "
292 "(radial) and MomentumY (azimuthal).");
293 one_rr_.set_val(Real(1));
294 one_tt_.set_val(Real(1));
295 }
296
298 bool has_energy() const { return c_E_ >= 0; }
299
304 void step(MultiFab& state, MultiFab& phi, const MultiFab& bz_field, int c_bz, Real theta,
305 Real dt) {
306 const Real th_dt = theta * dt;
307 const Real c = theta * theta * dt * dt * alpha_; // c = theta^2 dt^2 alpha
308 const Real g = theta * dt * alpha_; // theta dt alpha
309 const Real dr = geom_.dr();
310 const Real dth = geom_.dtheta();
311 const Real half_idr = Real(1) / (Real(2) * dr);
312 const Real half_idth = Real(1) / (Real(2) * dth);
313
314 // -1) freeze phi^n (final extrapolation).
315 copy_comp0(phi_n_, phi);
316
317 // 0) extract v^n = (mr, mtheta)/rho and copy B_z into the internal buffer.
318 for (int li = 0; li < state.local_size(); ++li) {
319 const ConstArray4 s = state.fab(li).const_array();
320 for_each_cell(state.box(li),
321 detail::ExtractVelocityKernel{s, vr_n_.fab(li).array(), vt_n_.fab(li).array(),
322 c_rho_, c_mx_, c_my_});
323 for_each_cell(bz_.box(li), detail::CopyBzKernel{bz_field.fab(li).const_array(),
324 bz_.fab(li).array(), c_bz});
325 }
326 const BCRec ebc = coeff_bc(bcPhi_);
327 device_fence();
328 fill_ghosts(bz_, geom_.domain, ebc);
329
330 // 1a) ASSEMBLE the coefficients A = I + c rho B^{-1} at the center (4 fields).
331 for (int li = 0; li < state.local_size(); ++li) {
332 const ConstArray4 s = state.fab(li).const_array();
333 const ConstArray4 b = bz_.fab(li).const_array();
334 for_each_cell(a_rr_.box(li),
336 s, b, a_rr_.fab(li).array(), a_tt_.fab(li).array(), a_rt_.fab(li).array(),
337 a_tr_.fab(li).array(), c, th_dt, c_rho_});
338 }
339 // ghosts of the coefficients (the operator face average reads the neighbor at +-1): theta
340 // periodic, radial Foextrap. PolarTensorKrylovSolver::set_coefficients also fills these ghosts, but
341 // we fill them here for robustness (assemble_rhs reads fr/ft -> consistency).
342 device_fence();
343 fill_ghosts(a_rr_, geom_.domain, ebc);
344 fill_ghosts(a_tt_, geom_.domain, ebc);
345 fill_ghosts(a_rt_, geom_.domain, ebc);
346 fill_ghosts(a_tr_, geom_.domain, ebc);
347
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.
350 device_fence();
351 fill_ghosts(phi, geom_.domain, phi_bc()); // ghosts of phi^n for the boundary Laplacian
352 apply_polar_tensor(phi, geom_, lap_, &one_rr_, &one_tt_, nullptr,
353 nullptr); // lap_ = Lap_polar phi^n
354 // explicit flux F = B^{-1}(mr, mtheta) at the center (1 ghost for the centered div).
355 for (int li = 0; li < state.local_size(); ++li) {
356 const ConstArray4 s = state.fab(li).const_array();
357 const ConstArray4 b = bz_.fab(li).const_array();
358 for_each_cell(fr_.box(li),
359 detail::PolarSchurExplicitFluxKernel{s, b, fr_.fab(li).array(),
360 ft_.fab(li).array(), th_dt, c_mx_, c_my_});
361 }
362 device_fence();
363 fill_ghosts(fr_, geom_.domain, ebc); // centered div reads F(i+-1), F(j+-1)
364 fill_ghosts(ft_, geom_.domain, ebc);
365 // rhs_polar = Lap_polar phi^n + g div_polar F (sign L_int = -rhs_schur).
366 for (int li = 0; li < rhs_.local_size(); ++li)
368 lap_.fab(li).const_array(), fr_.fab(li).const_array(),
369 ft_.fab(li).const_array(), rhs_.fab(li).array(), g, half_idr,
370 half_idth, geom_.r_min, dr});
371
372 // 2) SOLVE L_int(phi) = div(A grad phi) = rhs_polar via PolarTensorKrylovSolver.
373 PolarTensorKrylovSolver kry(geom_, ba_, bcPhi_, precond_);
374 const bool cross =
375 (c != Real(0)); // non-trivial cross terms as soon as c != 0 (B_z != 0 -> binv_12 != 0)
376 if (cross)
377 kry.set_coefficients(&a_rr_, &a_tt_, &a_rt_, &a_tr_);
378 else
379 kry.set_coefficients(&a_rr_, &a_tt_);
380 copy_comp0(kry.phi(), phi); // warm start: phi^n -> kry.phi()
381 copy_comp0(kry.rhs(), rhs_);
382 last_result_ = kry.solve(krylov_tol_, krylov_max_iters_);
383 copy_comp0(phi, kry.phi()); // phi <- phi^{n+theta}
384
385 // 3) RECONSTRUCT v^{n+theta} = B^{-1}(v^n - theta dt grad_polar phi^{n+theta}); mom = rho v.
386 device_fence();
387 fill_ghosts(phi, geom_.domain, phi_bc()); // centered grad_polar reads phi(i+-1), phi(j+-1)
388 for (int li = 0; li < state.local_size(); ++li)
389 for_each_cell(state.box(li),
391 phi.fab(li).const_array(), vr_n_.fab(li).const_array(),
392 vt_n_.fab(li).const_array(), bz_.fab(li).const_array(),
393 state.fab(li).array(), vr_t_.fab(li).array(), vt_t_.fab(li).array(), th_dt,
394 half_idr, half_idth, geom_.r_min, dr, c_rho_, c_mx_, c_my_});
395 // vr_t_/vt_t_ carry v^{n+theta}.
396
397 // 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).
398 const Real inv_theta = Real(1) / theta;
399 for (int li = 0; li < phi.local_size(); ++li)
401 phi_n_.fab(li).const_array(), phi.fab(li).array(), inv_theta});
402 for (int li = 0; li < state.local_size(); ++li)
404 vr_n_.fab(li).const_array(), vt_n_.fab(li).const_array(),
405 vr_t_.fab(li).array(), vt_t_.fab(li).array(),
406 state.fab(li).array(), inv_theta, c_rho_, c_mx_, c_my_});
407
408 // 4) ENERGY (if role present): E^{n+1} = E^n + (1/2) rho (|v^{n+1}|^2 - |v^n|^2).
409 if (c_E_ >= 0)
410 for (int li = 0; li < state.local_size(); ++li)
412 vr_n_.fab(li).const_array(), vt_n_.fab(li).const_array(),
413 vr_t_.fab(li).const_array(), vt_t_.fab(li).const_array(),
414 state.fab(li).array(), c_rho_, c_E_});
415
416 // 6) FILL the ghosts of the state and the potential before returning.
417 device_fence();
418 fill_ghosts(state, geom_.domain, bcU_default());
419 fill_ghosts(phi, geom_.domain, phi_bc());
420 }
421
423 const PolarKrylovResult& last_solve() const { return last_result_; }
424
427 void set_krylov(Real tol, int max_iters) {
428 detail::validate_krylov_params(tol, max_iters, "PolarCondensedSchurSourceStepper::set_krylov");
429 krylov_tol_ = tol;
430 krylov_max_iters_ = max_iters;
431 }
432
433 int density_comp() const { return c_rho_; }
434 int momentum_x_comp() const { return c_mx_; }
435 int momentum_y_comp() const { return c_my_; }
436 int energy_comp() const { return c_E_; }
437
438 private:
441 BCRec bcU_default() const { return coeff_bc(bcPhi_); }
442
444 static BCRec coeff_bc(const BCRec& bc) {
445 auto fo = [](BCType t) { return t == BCType::Periodic ? t : BCType::Foextrap; };
446 BCRec b;
447 b.xlo = fo(bc.xlo);
448 b.xhi = fo(bc.xhi);
449 b.ylo = BCType::Periodic;
450 b.yhi = BCType::Periodic; // theta always periodic
451 return b;
452 }
453
464 BCRec phi_bc() const {
465 BCRec b = bcPhi_;
467 b.yhi = BCType::Periodic; // theta always periodic
468 b.ylo_val = Real(0);
469 b.yhi_val = Real(0);
470 return b;
471 }
472
474 void copy_comp0(MultiFab& dst, const MultiFab& src) {
475 for (int li = 0; li < dst.local_size(); ++li)
476 for_each_cell(dst.box(li), detail::PolarSchurCopyComp0Kernel{dst.fab(li).array(),
477 src.fab(li).const_array()});
478 }
479
480 VariableSet vars_;
481 int c_rho_, c_mx_, c_my_, c_E_;
482 Real alpha_;
483 PolarGeometry geom_;
484 BCRec bcPhi_;
485 PolarPrecond precond_;
486 BoxArray ba_;
487 DistributionMapping dm_;
488 MultiFab a_rr_, a_tt_, a_rt_, a_tr_;
489 MultiFab lap_, rhs_;
490 MultiFab fr_, ft_;
491 MultiFab one_rr_, one_tt_;
492 MultiFab bz_;
493 MultiFab phi_n_;
494 MultiFab vr_n_, vt_n_;
495 MultiFab vr_t_, vt_t_;
496 PolarKrylovResult last_result_;
497 Real krylov_tol_ = Real(1e-10);
498 int krylov_max_iters_ = 600;
499};
500
501} // namespace pops
Ordered list of boxes tiling a level.
Definition box_array.hpp:22
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
MultiFab & rhs()
Definition polar_tensor_operator.hpp:383
MultiFab & phi()
Definition polar_tensor_operator.hpp:384
void solve()
Definition polar_tensor_operator.hpp:409
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
double Real
Definition types.hpp:30
int n_ranks()
Definition comm.hpp:139
void device_fence()
Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory.
Definition kokkos_env.hpp:43
VariableRole
PHYSICAL role of a component.
Definition variables.hpp:27
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
BCType
Boundary condition type for a face: Periodic (handled by fill_boundary), Foextrap (zero gradient,...
Definition physical_bc.hpp:25
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
BCType ylo
Definition physical_bc.hpp:31
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 Real binv_11() const
Definition lorentz_eliminator.hpp:81
POPS_HD Real binv_21() const
Definition lorentz_eliminator.hpp:83
POPS_HD Real binv_12() const
Definition lorentz_eliminator.hpp:82
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
POPS_HD Real binv_22() const
Definition lorentz_eliminator.hpp:84
Definition geometry.hpp:59
POPS_HD Real dr() const
Definition geometry.hpp:70
Box2D domain
nx() = nr (radial cells), ny() = ntheta (azimuthal cells)
Definition geometry.hpp:60
POPS_HD Real dtheta() const
Definition geometry.hpp:71
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).
#define POPS_HD
Definition types.hpp:25
Descriptor of a model's variables (Vars).