Abstract
The magnetohydrodynamics with embedded particle-in-cell (MHD-EPIC) model
has been successfully applied to global magnetospheric simulations in
recent years. However, the PIC region was restricted to be one or more
static boxes, which is not always sufficient to cover the whole physical
structure of interest efficiently. The FLexible Exascale Kinetic
Simulator (FLEKS), which is a new PIC code and allows a dynamic PIC
region of any shape, is designed to break this restriction. FLEKS is
usually used as the PIC component of the MHD with adaptively embedded
particle-in-cell (MHD-AEPIC) model. FLEKS supports dynamically
activating or deactivating cells to fit the regions of interest during a
simulation. An adaptive time-stepping scheme is also introduced to
improve the accuracy and efficiency of a long simulation. The particle
number per cell may increase or decrease significantly and lead to load
imbalance and large statistical noise in the cells with fewer particles.
A particle splitting scheme and a particle merging algorithm are
designed to limit the change of the particle number and hence improve
the accuracy of the simulation as well as load balancing. Both particle
splitting and particle merging conserve the total mass, momentum, and
energy. FLEKS also contains a test-particle module to enable tracking
particle trajectories due to the time-dependent electromagnetic field
that is obtained from a global simulation.