Altair_Blog_hero_1920x225

Featured Articles

The Smoothed Particle Hydrodynamics Method vs. Finite Volume Numerical Methods

Part one of this series covered the basics of the Smoothed Particle Hydrodynamics (SPH) method. In part two, we’ll take a look at some of the advantages and disadvantages over the more traditional Finite Volume Numerical Methods and describe the SPH implementation in nanoFluidX.

SPH vs. FV

We have covered some ground talking about the SPH basics, but why would anyone wish to switch from FV CFD to SPH? In the end, FV methods have been well established in the industry for decades at this point. Also, if SPH is so great, why didn’t it show up before?
First, there is no such thing as the “ultimate code.“ All codes, regardless of their origin and implementation, have limitations and pros and cons. SPH is no different in that regard, but also goes to show that not all that is FV is necessarily better.
Let’s summarize some of the key properties of the SPH method, as described by Price:
  • An exact, time-independent, solution to the continuity equation
  • Advection done perfectly
  • Zero intrinsic dissipation (all dissipation in SPH is added artificially, e.g. by adding the viscosity term)
  • Exact and simultaneous conservation of mass, momentum, angular momentum, energy and entropy
  • A guaranteed minimum energy state for the particles
  • Resolution that follows mass (instead of volume like in Eulerian methods)
While most of the above is self-explanatory, we will point out the second bullet and clarify the fifth.
The second bullet states that advection is done perfectly. How is that possible? SPH is a Lagrangian method where we discretize mass instead of control volume and SPH does not require calculation of such things as mass flux. Each particle has a mass and when we move the particle from point A to point B, the mass is still there and conserved perfectly.
The fifth bullet is not as important, but should be clarified. What it says is that particles will naturally arrange themselves in a state of minimum energy. They will tend to take a quasi-isotropic particle distribution such that there will be no motion unless forcing is poised from the outside.
The above characteristics show that SPH is a very suitable method for high-deformation type of flows, where interface tracking and convection are of importance. Furthermore, since there is no mesh and no need to calculate fluxes, so the method works easily with complex moving geometries, which is the main reason why nanoFluidX is so successful in simulating gearboxes and power-train components.
So, what are the drawbacks? While SPH algorithm in its basic form is very easy to program, dealing with boundary conditions is rather difficult, especially if one requires high accuracy. Implementation of inlets, outlets and pressure boundary conditions is not straightforward as it is in FV. Wall treatment is also a thing to be reckoned with and doing variable resolution in a Lagrangian method poises a set of difficulties which are not encountered in FV methods. This is why standard SPH is not suitable for problems which encompass large scale differences, e.g. simulating a large ship while trying to resolve small vortices around the propeller tips.
But why didn’t SPH show up before, you may ask? SPH was invented by Lucy, Gingold and Monaghan back in the late seventies, which is to say the method itself is about 40 years old. It was designed for a specific set of astrophysical problems and had no focus on the performance. In fact, when one compares computational effort of FV to SPH methods on a “per node“ (per particle) level – SPH is quite a bit more expensive, as it needs to perform computations for 60 to 150 neighboring particles. On the other hand, a typical 2nd order FV node interacts with about 12 nodes or so. However, there is a major twist in the story - SPH algorithm, due to its simplicity and structure, it is extremely easy to parallelize, which is not necessarily the case for FV algorithms. With the rise of parallel programming and especially scientific programming on Graphical Processing Units (GPU) in 2000’s, SPH was able to overtake FV in terms of performance for a number of problems. This is why it took so long for SPH to become of interest.
Overall, if you require a case with no or little moving parts, where you have the need to resolve large scale differences or have very complex inlet/outlet boundary conditions – I would recommend using a FV or a Finite Element (FE) code. If you have a complex moving geometry in an enclosure (e.g. a gearbox), the advantage of the SPH method over its more established counterparts is obvious: there are no meshes, no errors introduced due to interface diffusion or scheme corrections and the run times are an order of magnitude shorter. This is not to say that SPH cannot do the first set of problems, or that FV cannot do gearboxes – it is just that SPH is not a clear winner in the first case and FV is definitely not a winner in the second case.

SPH in nanoFluidX

Everything we have said so far is to serve as a very basic introduction to the SPH method. Motivated readers can read some more, starting with the suggested literature, since there are many more “flavors“ of SPH out there. Again, there is no ultimate SPH method, but all of them incorporate the basic idea of interpolation via kernel functions.
Among these flavors, the most common one is the weakly compressible SPH method, as already mentioned. This is also the approach that nFX is uses. nFX is a pure GPU-based code, which enables it to run industrial scale gearbox cases an order of magnitude faster than anything FV-based.
Besides the described basic features of SPH, nFX has a number of upgrades. Two most notable features that distinguish nFX from other Lagrangian competitors is the ability to run in multiphase and the implementation of the transport velocity correction scheme.
While multiphase is often quoted as “natural“ to the SPH method, due to inherent distinction between the phase particles and a sharp interface, some numerical care is necessary to ensure the stability of such formulation. To our knowledge, nanoFluidX is the only industrial SPH code that can stably handle multiphase flows with high density ratios (1000 to 1) and includes a physical surface tension models.
Going back all the way to the introductory chapter, we mentioned that maintaining good (uniform) particle distribution has a large impact on the overall accuracy of the SPH method. Transport velocity formulation is a numerical correction scheme developed by Adami [3] which dynamically corrects for particle positions without hurting the physics or accuracy. In his work Adami shows that including transport velocity in the SPH algorithm can greatly enhance method’s accuracy, diminish numerical diffusion, plus it further improves the convergence properties of the method. Furthermore, Adami goes to show that including transport velocity can even cause SPH method to start reproducing turbulent-like behavior in the fluid bulk flow, which was recently confirmed internally as well (see Figure 2).
Figure 2: Kinetic energy cascade for a Taylor-Green vortex at Re = 100,000. The upper image is a comparison between a Lattice-Boltzmann LES turbulent model and nanoFluidX with transport velocity turned on. The lower image is nanoFluidX simulations for the same case, but with and without transport velocity formulation. We see that without the transport velocity, the SPH method cannot reproduce the energy cascade. These results were first reported by Adami et al. [4] and the data is compared to the data of Kajzer et al. [7].
The basic SPH implementation cannot reproduce this turbulent-like behavior on its own. Finally, inclusion of the transport velocity prevents the infamous tensile instability of the SPH method and makes user’s life easier by taking out a number of numerical parameters that are required for normal SPH operation. Again, to our knowledge, nFX is the only industrial code that includes the transport velocity and is therefore likely to have an upper hand on the competition in terms of both speed and accuracy.

Summary

We hope that we have provided you with some information regarding the essence of the SPH method, its properties and its differences with respect to the more common FV methods. Ultimately, there are sets of problems where FV methods have a clear advantage, but it is important to keep in mind that the SPH method also has its strong points, such as simulations that involve complex moving geometries and high-deformation flows.
To learn more about nanoFluidX, please contact your nearest Altair office or visit: altairhyperworks.com/nanofluidx
 
This guest contribution is written by Milos Stanic, Ph.D., Product Manager – nanoFluidX (nFX) at FluiDyna GmbH. nanoFluidX is a cutting-edge industrial SPH code, developed by FluiDyna GmbH, Germany. Altair is an exclusive World-wide distributor of the nFX software and you can find more information here.

References

[1] D. J. Price, "Smoothed particle hydrodynamics and magnetohydrodynamics," Journal of Computational Physics , vol. 231, pp. 759-794, 2012.
[2] D. J. Price, "Smoothed Particle Hydrodynamics: Things I wish my mother taught me," 11 2011.
[3] S. Adami, Modeling and Simulation of Multiphase Phenomena with Smoothed Particle Hydrodynamics, Lehrstuhl für Aerodynamik und Strömungsmechanik, Technische Universität München, 2014.
[4] S. Adami, X. Hu and N. Adams, "Simulating three-dimensional turbulence with SPH," in Proceedings of the Summer Program 2012, Stanford Univeristy, Paolo Alto, 2012.
[5] L. Lucy, "A numerical approach to the testing of the fission hypothesis," Astronomical Journal, vol. 82, pp. 1013-1024, #dec# 1977.
[6] R. Gingold and J. Monaghan, "Smoothed particle hydrodynamics - Theory and application to non-spherical stars,"Monthly Notices of the Royal Astronomical Society, vol. 181, pp. 375-389, #nov# 1977.
[7] A. Kajzer, J. Pozorski and K. Szewc, "Large-eddy simulations of 3D Taylor-Green vortex: comparison of Smoothed Particle Hydrodynamics, Lattice Boltzmann and Finite Volume methods," Journal of Physics: Conference Series, vol. 530, p. 012019, 2014.