  Efficient simulation of plasmas in various contexts often involves the use of
meshes that conform to the intrinsic geometry of the system under
consideration. We present here a description of a new magnetohydrodynamic code,
Gamera (Grid Agnostic MHD for Extended Research Applications), designed to
combine geometric flexibility with high-order spatial reconstruction and
constrained transport to maintain the divergence-free magnetic field. Gamera
carries on the legacy of its predecessor, the LFM (Lyon-Fedder-Mobarry), a
research code whose use in space physics has spanned three decades. At the time
of its initial development the LFM code had a number of novel features:
eighth-order centered spatial differencing, the Partial Donor Cell Method
limiter for shock capturing, a non-orthogonal staggered mesh with constrained
transport, and conservative averaging-reconstruction for axis singularities. A
capability to handle multiple ion species was also added later. Gamera
preserves the core numerical philosophy of LFM while also incorporating
numerous algorithmic and computational improvements. The upgrades in the
numerical schemes include accurate grid metric calculations using high-order
Gaussian quadrature techniques, high-order upwind reconstruction, non-clipping
options for interface values, and improved treatment of axis singularities. The
improvements in the code implementation include the use of data structures and
memory access patterns conducive to aligned vector operations and the
implementation of hybrid parallelism, using MPI and OMP. Gamera is designed to
be a portable and easy-to-use code that implements multi-dimensional MHD
simulations in arbitrary non-orthogonal curvilinear geometries on modern
supercomputer architectures.
