The Next Level
Getting the Same Result 12x Faster

March 16, 2021
Andreas Henne and Max Flamm

In the article, Adaptive Particle-based Simulation in PreonLab, we showed that a simulation with two particle levels can accurately reproduce the results of a simulation with higher uniform resolution. But delivering a good result is not enough – for the system to be useful it must also deliver this result faster than the uniform simulation. The adaptive simulation will always have fewer particles, but this does not necessarily mean that it will be more efficient overall. Splitting, merging and correction (see the last article) represent a significant effort and can outweigh the reduction in particles. Is the cost worth it?


The cost of splitting and merging

In PreonLab 4.x, our approach to this problem was to limit the number of splitting and merging events that can occur in a simulation. This was achieved by refining not only in the region of interest, but also in a buffer zone around it. Additionally, we limited the adaptivity to only two particle levels. Unsurprisingly, feedback related to adaptive simulations usually included these two points:

  • “Why am I getting fine particles outside my region of interest?”
  • “I need more than two particle sizes to really speed up my application!”

In PreonLab 5.0, the splitting and the subsequent sampling correction is fast enough that it can run in every simulation step (see the article Adaptive Particle-based Aimulation in PreonLab for some details). This eliminates the need to split outside the regions of interest and reduces the overall number of particles. Merging still happens at discrete steps, but in our experience this is acceptable for most applications. We also added the option to use three instead of two particle sizes in a simulation, so that the coarsest particles have four times the diameter of the finest particles. Going from two to three particle levels does not seem like much, but it makes a big difference. If the coarsest particle has two times the diameter of the finest particle, we can reduce the number of particles by up to 8 times (in three dimensions). By adding a third particle size with four times the diameter of the finest particle, this factor increases by almost an order of magnitude to 64.

Accelerating a classic CFD benchmark with PreonLab 5.0

Figure 1: Torricelli benchmark after 3 seconds. Left: Adaptive simulation with particle diameters ranging from 1.25 mm to 5 mm. Particles near the outflow are refined to 1.25 mm. Right: Uniform simulation with 1.25 mm particle diameter. Both simulations deliver almost identical results in terms of fluid height, outflow velocity and fluid volume (see figure 2). To compute 14 physical seconds of the benchmark, the adaptive simulation required 3 hours while the uniform simulation required 25 hours. This benchmark was performed with a beta version of PreonLab 5.0. In the final release, the time was reduced further to 2 hours.

Figure 1 shows a simple setup in which a box with a hole at the bottom is filled with fluid. According to Torricelli’s law, the speed of the outflow is related to the height of the fluid above. This is a great benchmark for CFD solvers because it is possible to compute the speed of the outflow analytically. We will compare three setups: Two will use a uniform particle size with 5 mm and 1.25 mm respectively. Another setup will use three particle sizes with diameters ranging from 1.25 mm to 5 mm. To this end, a refinement domain is placed around the outflow, so that a particle size of 1.25 mm is used there. PreonLab automatically refines the particle layer between the 1.25 mm and 5 mm particles to 2.5 mm.

Figure 1 shows the high-resolution uniform simulation and the adaptive simulation side by side for a visual comparison. Figure 2 shows how the volume inside the box changes over time. The adaptive simulation produces almost the same result as the simulation with a uniform particle diameter of 1.25 mm. Both are much closer to the analytical solution than to the coarse simulation with 5 mm particle diameter.

The adaptive simulation ran more than 12 times faster than the uniform simulation with 1.25 mm particle size. This is a very promising result and shows that the adaptive solver can speed up some applications by an order of magnitude. This speed-up will vary from case to case, but we expect that all applications which simulate large fluid volumes (such as water wading) can be accelerated significantly.

Reduced computation time is the most obvious advantage of the adaptive simulation, but it is not the only one. In the Torricelli scene, the average number of particles and the disk space consumption decreases by a factor of 22. Fewer particles mean that transferring data from a cluster is much faster, viewing the results on a laptop is smoother and archiving the results requires less hard drives.

Figure 2: Fluid volume over time in Torricelli scene. The adaptive simulation (blue) matches the high-resolution uniform simulation (red) very well (in fact their plots are almost indistinguishable). Both match the analytical solution (black) much better than the coarse uniform simulation with 5 mm particle diameters.



How to get started with
Preonlab CFD software?
Get in Touch