Simulating complex dynamics with Smooth Particle Hydrodynamics (SPH) technique

In this post, we will talk about how we used the Smooth Particle Hydrodynamics (SPH) method to simulate the complex dynamics of dragging a Christmas tree through a narrow cylinder. It is not an easy task as you may think, as the movement of the tree and the friction with the cylinder can be difficult to accurately model. That’s where the SPH method can be helpful.

What are the SPH method and its advantages?

Smoothed particle hydrodynamics (SPH) is a computational technique for modelling the mechanics of continuum media, including solid mechanics and fluid flows. In the SPH method, the media is discretized into a group of particles, and the mechanics of the system are generally represented as the interactions between these particles using a Kernel function.

The flexibility of the SPH approach in managing intricate boundary dynamics is one of its main benefits. It doesn’t require a fixed mesh to function because it is mesh-free, allowing it to adapt to significant surface distortions and deformations without having to update it frequently. This makes it appropriate for issues like solid mechanics contact difficulties, in which surfaces can move and deform significantly.

The SPH approach has several other benefits in addition to its capacity to manage complex boundary dynamics. As a result of its ability to accurately capture surface movement and deformation, it is particularly helpful for simulating free-surface fluxes, such as those involving liquids. Additionally, it works well for modeling issues involving high rates of deformation, such as those involving high-velocity strikes or explosions.

The SPH method‘s capacity to manage large degrees of complexity and irregularities in the system’s initial geometry is another benefit. This makes it handy for modeling issues involving several interacting bodies or particles as well as issues involving random or chaotic motion.

Overall, the SPH approach is an effective tool for simulating the dynamics of continuum media, particularly when the boundary dynamics are complex, or the initial geometry is asymmetrical. Its adaptability and flexibility make it suitable for a wide range of issues, from modeling the deformation of solids under high rates of modification to simulating the movement of liquids.

How did we simulate the Christmas Tree with the SPH method?

The simulation of the Christmas tree was done using the open-source SPH code SPHinXsys, which is a C++ API for SPH simulations. We have used this code because it has shown to be very stable also for simulations with extremely high deformations when we compare it to other commercial options. Moreover, because this code is available as a set of C++ tools and libraries, it is extremely easy to extend and use it also for very specific needs. In one of those specific needs, we developed an algorithm where particles can be attached through a spring to a moving point following a defined path. Internally we called this approach “spring on a train”.

So in this Christmas tree simulation, a subset of the particles in the star at the top of the Christmas tree is attached to such a spring, that again is attached to a point moving along a path through the “O”. We developed this specific approach, as we needed a way to push (or in the simulation actually pull) an object into a narrow region, giving it most freedom to find equilibrium along the path into the confinement and also controlling the maximum force being used.

Using open-source-based codes for this kind of research/development work gives full transparency of what is happening in every aspect of the simulation, and moreover, the ability to implement very specific tailored solutions at the core level of the simulation with no added overhead.

In the visualizations, every node point is shown as a particle with an arbitrarily defined radius. This gives the impression that interactions are “particles-to-particle” given these “particle walls”, but in reality interactions and properties are everywhere as a “smudged” interpolated function in between these visualized node points.

Challenges of using the SPH Method

The Smooth Particle Hydrodynamics (SPH) method has several limitations that can emerge. The choice of a suitable kernel function presents a hurdle. The kernel function is crucial to the SPH method since it estimates the forces acting on each particle as well as the effect each particle has on its surroundings. The simulation may experience errors and instability because of the inappropriate kernel function selection.

The selection of the simulation’s particle population and distribution presents another difficulty. The number of particles utilized influences how accurate the SPH method is and utilizing too few particles can produce results with low resolution. On the other hand, employing an excessive number of particles can make the simulation significantly more expensive to run. It might be difficult to strike the correct balance between computing efficiency and precision.

The SPH approach may also be sensitive to the simulation’s beginning. The simulation may yield unreliable or unstable findings if the initial circumstances are poorly defined or incompatible with the mechanics of the situation.

The SPH method can also be less accurate when there is major media movement or stress or when the material behaves in a nonlinear manner. To obtain sufficient accuracy in these circumstances, more complex approaches, including adaptive mesh size or higher-order kernel functions, may be required.


In conclusion, the SPH method is a mesh-free approach that models the continuum media as a collection of discrete particles, with the mechanics of the system being approximated as the interactions between these particles using a kernel function. It has several benefits, including the capacity to handle free-surface flows and high deformation rates. It is ideally suited for issues with complex boundary dynamics or irregular beginning geometry. It can be further developed and used in the future and has a wide range of applications, including fluid dynamics, solid mechanics, and astrophysics.


'Day-to-day scripting in Simulation'

by Tore Findsen

By entering your email you get download access as well as subscription to our newsletter

Download .pdf 


Lene Gottrup Barfod

Contact us to discuss your next project


Your information will be handled in accordance with our Privacy Policy.