include/pops/coupling/amr/amr_diagnostics.hpp File ReferenceΒΆ

adc_cpp: include/pops/coupling/amr/amr_diagnostics.hpp File Reference
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
amr_diagnostics.hpp File Reference

Diagnostics extracted from the AMR couplers: mass and max drift speed (responsibility c). More...

#include <pops/core/foundation/types.hpp>
#include <pops/mesh/index/box2d.hpp>
#include <pops/mesh/execution/for_each.hpp>
#include <pops/mesh/storage/multifab.hpp>
#include <algorithm>
#include <cmath>
+ Include dependency graph for amr_diagnostics.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  pops
 

Functions

Real pops::amr_mass_mb (const MultiFab &coarse, Real dx, Real dy)
 LOCAL mass: sum of u(.,.,0) * dx * dy over the valid cells of ALL local fabs, WITHOUT MPI reduction (the caller decides whether to all_reduce).
 
Real pops::amr_max_drift_speed_mb (const MultiFab &aux0, Real B0)
 LOCAL max drift speed: max of |grad phi| / B0 (aux comp 1, 2 = grad phi) over the valid cells, WITHOUT floor (applied by the caller) nor MPI reduction.
 
Real pops::amr_mass (const MultiFab &coarse, const Box2D &dom, Real dx, Real dy)
 Mono-box mass: degenerate case of amr_mass_mb (bit for bit). dom is ignored (kept for the API).
 
Real pops::amr_max_drift_speed (const MultiFab &aux0, const Box2D &dom, Real B0)
 Mono-box max drift speed + floor 1e-12 (CFL guard). dom ignored (kept for the API).
 

Detailed Description

Diagnostics extracted from the AMR couplers: mass and max drift speed (responsibility c).

Namespace-scope free functions (same reason as detail:: in coupler.hpp: GPU seam, an extended lambda cannot live in a private method). amr_mass_mb goes through the reducer seam (for_each_cell_reduce_sum: a real Kokkos reduction, Kokkos::Sum reassociated per tile – deterministic/idempotent). amr_max_drift_speed_mb stays a host loop (std::hypot not confirmed device-callable under nvcc; routing it would change the last bit). The mono-box variants (...) reduce to the _mb variants (a single fab covering the domain, bit for bit). NO MPI reduction here: the coupler decides whether to all_reduce according to its ownership policy.