|
IPPL (Independent Parallel Particle Layer)
IPPL
|
Introduction to handling particles in IPPL.
IPPL provides a flexible and efficient framework for handling particles in parallel computing environments.
The core components are ParticleBase and ParticleAttrib classes, which provide the base functionality and attributes for particles.
ParticleBase acts as the abstract base class for a set of particles, requiring a derived class to specify data attributes (e.g., mass, charge).
ParticleAttrib<T> represents a single particle attribute, with T indicating the data type.
The user must define a class derived from 'ParticleBase' which describes what specific data attributes the particle has (e.g., mass or charge). 'ParticleBase' is the abstract base class for a set of particles. Each attribute is an instance of a ParticleAttribute<T> class; 'ParticleBase' keeps a list of pointers to these attributes, and performs particle creation and destruction.
'ParticleBase' is templated on the 'ParticleLayout' mechanism for the particles. This template parameter should be a class derived from 'ParticleLayout'. 'ParticleLayout'-derived classes maintain the info on which particles are located on which processor, and performs the specific communication required between processors for the particles. The 'ParticleLayout' is templated on the type and dimension of the atom position attribute, and 'ParticleBase' uses the same types for these items as the given 'ParticleLayout'.
'ParticleBase' and all derived classes have the following common characteristics:
The spatial positions of the N particles are stored in the particle_position_type variable R
The global index of the N particles are stored in the particle_index_type variable ID
A pointer to an allocated layout class. When you construct a 'ParticleBase', you must provide a layout instance, and 'ParticleBase' will delete this instance when it (the 'ParticleBase') is deleted.
To use this class, the user defines a derived class with the same structure as in this example:
This example defines a user class with 3D position and two extra attributes: a radius rad (double), and a velocity vel (a 3D Vector).
These classes form the foundation for all particle attribute classes within the framework.
ParticleAttrib is a templated class designed to represent a single particle attribute, such as mass or charge. It encapsulates an attribute as a data element within a particle object, stored using a Kokkos::View for efficient parallel computation. This class is essential for handling the type information of the attribute and provides a suite of methods for creating, destroying, and performing operations on particle attributes.
ParticleAttribBase serves as the generic base class for the templated ParticleAttrib class. It provides a common interface for all particle attribute classes, including virtual methods for creating and destroying elements of the attribute array. By encapsulating data for a variable number of particles in a Kokkos::View, it facilitates operations on this data.
ParticleLayout manages particle distribution and serves as a base class for ParticleSpatialLayout.
ParticleSpatialLayout is a derivative of ParticleLayout, ParticleSpatialLayout specifically handles particle distribution based on spatial positions relative to a predefined grid. It ensures particles are processed on the same MPI rank as their corresponding spatial region, defined by 'FieldLayout'. It requires periodic updates to adjust particle locations.
Here's how you can define a simple particle bunch in IPPL:
This example demonstrates how to extend ParticleBase to create a Bunch class that includes common particle attributes and how to perform a single timestep.
Consider bunch a pointer to a derived class 'Bunch' from 'ParticleBase' and has attributes 'R', 'V', 'mass', 'charge'
A collection of essential functions for particle manipulation and attribute management, such as creation, deletion, and data operations.
Setting up boundary conditions (e.g., periodic, reflective) for particle simulations.
Methods for data transfer between particles and grid, supporting operations like scatter and gather for efficient particle-field interaction.