Retrieve Particle Data from EDEM

You can retrieve particle data from EDEM using the getParticleData method. This method will return the data for all the particles currently in the simulation. The operation is usually performed at the end of the EDEM simulation step, after the position of the particles has been updated.

To retrieve the particle data, you must first allocate an array of CDiscreteElement equal to the size of the total number of particles in the simulation at the current Time Step.

Note: You must delete the array of data when it is no longer required.

The particle data does not represent particles as mono or multi-spherical. Instead, their position is calculated at their centroid and volume is returned as a scalar value. More detailed information about particle shapes can be calculated from the particle sample points. A detailed explanation of their operation is available in Use the Sampling Point Method.

Particle data in the array is organized in order of particle type. Particle type data is structured in order of particle index. However, particle indices may change between simulation time steps and therefore the index cannot be relied upon as a method for persistent particle tracking. Instead, persistent tracking can be accomplished through the unique integer identifier (ID) found in each particle data set, which persists throughout the entirety of the simulation. If you want to perform operations on all of the particles of one type, independently of the particle ID, then it is more efficient to do so by accessing the array of particle data by index.

For ID-dependent operations, you must check the particle ID to ensure that the correct particle is being manipulated. Particle IDs can be managed between simulation-steps through implementation of a map structure. The following diagram represents the particle data array from a simulation with three types (0, 1 and 2).


The data of each type is organized such that particle data is accessible using the index. In this case, particles of Type 0 occupy array indices 0 to (n-1), while Type 1 particles occupy the indices n to (n+m-1) and finally particles of Type 2 occupy indices (n+m) to (n+m+p-1). The number of particle types and particles belonging to each type can be queried at any time using the getNumParticleTypes and getNumParticles methods from the EDEM CFD Coupling Interface.