In this tutorial you’ll get a brief introduction to EDEMpy. EDEMpy is a Python library for post-processing and analyzing EDEM simulation data that takes advantage of the open source hdf5 file format which has been used to store EDEM data since EDEM 2017. Using the library, it is easy to extract specific data from a simulation deck and process that data in a customizable and reusable way. Using EDEMpy you can, for example, extract force acting on a specific geometry over time and compare results back-to-back between multiple simulation decks, track particles residence time over the course of a simulation, visualize DEM data as a continuum or use EDEM data to calculate post processing properties for simulations such as segregation index.
In many applications it is necessary to know the total mass of particles inside an equipment in order to determine if the process has reached a steady state. In this tutorial we’ll learn how to access particles’ ids and position and we’ll use a cylinder bin to represent our equipment. We’ll then use this information to determine the total mass of particles inside of our equipment.
The script included explains how to read the simulation deck, create the cylinder bin and read the particles’ positions and ids. Now we’ll go through the most important parts of it.
import edempy.Deck as Deck
from edempy import CylinderBin
my_simulation_deck = Deck("Tutorial_Simulation.dem")
This first line of code gives us access to the function that will let us read our simulation deck. With the second line we’ll be able to set the cylinder bin. In the third line we read the simulation deck and assign it to a variable called my_simulation_deck
mixer = CylinderBin([-0.4924039, 0.0, 0.08682409], [0.4924039, 0.0, -0.08682409], 0.3)
We then create the cylinder bin to represent our mixer by specifying a start point (center of the top circle), an end point (center of the bottom circle) and the cylinder radius (in meters). To determine the total mass inside the mixer at each timestep in the simulation first we need the ids and the positions of every particle in the simulation. We the use these values as inputs to the getBinnedObjects function. This function uses the particles’ position to determine whether a particle is inside the cylinder bin and returns the ids of those particles that are inside the mixer. After that, we determine the mass of a particle by using the getMass function, then all that’s left is add up the values of all particles’ masses. Finally, Figure 1 shows the evolution of the total mass of particles inside the mixer after 30 seconds of simulation run time.
Figure 1- Total mass of particles inside the mixer over time
To run the script, go to the Analyst tab then click on File then Run EDEMpy Script. On the dialog box click on the button and choose tutorial_script.py
To know more about EDEMpy and all its functions check out the documentation and the Getting Started guide inside the installation folder. Also, there are several examples in the Altair community which is a good place to look for inspiration for your own EDEMpy scripts.