include/pops/amr/regridding/regrid.hpp File ReferenceΒΆ

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

Dynamic regrid: (re)builds a fine level from the tagging of a coarse level. More...

+ Include dependency graph for regrid.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::RegridParams
 Regrid parameters (configuration object). More...
 

Namespaces

namespace  pops
 

Functions

template<class Crit >
TagBox pops::tag_cells (const MultiFab &mf, const Box2D &domain, Crit crit)
 Marks the valid cells where the predicate is true, on a TagBox covering the domain.
 
TagBox pops::grow_tags (const TagBox &in, int n, const Box2D &domain)
 Grows the tags by n cells (square neighborhood), staying within the domain.
 
template<class Crit >
void pops::regrid_level (AmrHierarchy &h, int coarse_lev, Crit crit, const RegridParams &rp={})
 (Re)builds level coarse_lev+1 from the tagging of level coarse_lev.
 

Detailed Description

Dynamic regrid: (re)builds a fine level from the tagging of a coarse level.

Layer: include/pops/amr (AMR geometric primitives). Role: tags a level, clusters the tagged cells into boxes (Berger-Rigoutsos), refines into the BoxArray of the next level, rebuilds its MultiFab and fills it (interpolation from the coarse level, then a copy of the old fine level where it existed to preserve accuracy). Contract: the tagging criterion is a generic predicate on (ConstArray4, i, j); we stay agnostic of the physics. For a gradient criterion, the caller fills the ghosts beforehand.

Invariants:

  • conservative regrid = common hierarchy, co-located cells, regrid by union of tags;
  • the fine level lives in the refined index space of the coarse level (refine(ref_ratio));
  • without any tag, the fine level (and the finer ones) is removed.