Amr Source Code
The source code in amrex/Src/Amr contains a number of classes, most notably
Amr, AmrLevel, and LevelBld.
These classes provide a more well-developed set of tools for writing AMR codes
than the classes created for the AdvectionAmrCore tutorial.
The
Amrclass is derived fromAmrCore, and manages data across the entire AMR hierarchy of grids.The
AmrLevelclass is a pure virtual class for managing data at a single level of refinement.The
LevelBldclass is a pure virtual class for defining variable types and attributes.
Many of our mature, public application codes contain derived classes that
inherit directly from AmrLevel. These include:
The
Castroclass in our compressible astrophysics code, CASTRO, (available in the AMReX-Astro/Castro github repository)The
Nyxclass in our computational cosmology code, Nyx (available in the AMReX-Astro/Nyx github repository).Our incompressible Navier-Stokes code, IAMR (available in the AMReX-codes/IAMR github repository) has a pure virtual class called
NavierStokesBasethat inherits fromAmrLevel, and an additional derived classNavierStokes.Our low Mach number combustion code PeleLM (available in the AMReX-Combustion/PeleLM github repository) contains a derived class
PeleLMthat also inherits fromNavierStokesBase(but does not useNavierStokes).
The tutorial code in amrex-tutorials/AMR/WaveAmrLevel gives a simple
example of a class derived from AmrLevel that solves the wave
equation on a subcycling-in-time AMR hierarchy, and
amrex-tutorials/Applications/CNS is a complete compressible flow code
built on these classes. Compare them with the AdvectionAmrCore tutorial
and the chapter on AmrCore Source Code, which build the same kind of
simulation directly on AmrCore without the classes in amrex/Src/Amr.
The tutorial codes also contain a class derived from LevelBld (in
amrex/Src/Amr). This class is used to define
variable types (how many, nodality, interlevel interpolation stencils, etc.).