In my previous post on writing VTK output files I described how mesh data can be output in VTK XML format. In this article I will talk about how I output particle data from my simulations.
These simulations use a number of techniques depending on the requirements. I use the MPM (Material Point Method) and RBD (Rigid body dynamics) with the occasional DEM (Discrete/Distict element method) and Peridynamics simulation. When I am running RBD or DEM simulations, the particles may have not spherical shapes and the shape and orientation information have to be encoded into the output data in addition to other physical state variables.
We will assume that the particles are ellipsoids. The particle data that we will output in this example are:
The particle ID
The particle radii in the three principal axis directions
The three principal axis orientations
The particle position
The particle velocity
Writing the particle data
To write the particles data to the disk, we follow the same approach as we did for the grid/mesh data in the previous post. The writeParticles function has the form
We have already seen the addTimeToVTKDataSet method in the previous post. The main difference in this case is the new addParticlesToVTKDataSet method:
You can see a working example of this approach in the Matiti code.
Displaying the output
The VTK XML file output to disk using this approach can be visualized in Visit or ParaView. Notice that we are not able to use the particle geometry and orientation information in either of these tools without extra work. The plot below shows the output of a rigid body dynamics simulation in the presence of Coriolis forces.
If you have questions/comments/corrections, please contact banerjee at parresianz dot com dot zen (without the dot zen).