2012particle Packing Algorithm For SPH Schemes
2012particle Packing Algorithm For SPH Schemes
a r t i c l e i n f o a b s t r a c t
Article history: Using some intrinsic features of the Smoothed Particle Hydrodynamics (SPH) schemes, an innovative
Received 26 August 2011 algorithm for the initialization of the particle distribution has been defined. The proposed particle packing
Received in revised form 7 February 2012 algorithm allows a drastic reduction of the numerical noise due to particle resettlement during the
Accepted 27 February 2012
early stages of the flow evolution. Moreover, thanks to its structure, it can be easily derived starting
Available online 8 March 2012
from whatever SPH scheme and applies under the hypotheses that the fluid is weakly-compressible or
Keywords: incompressible as well. A broad range of numerical test cases proved this tool to be fast, robust and
Meshless methods reliable also for complex geometrical configurations.
Smoothed particle hydrodynamics © 2012 Elsevier B.V. All rights reserved.
Particle initialization
Lagrangian systems
0010-4655/$ – see front matter © 2012 Elsevier B.V. All rights reserved.
doi:10.1016/j.cpc.2012.02.032
1642 A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653
Fig. 2. Left panel: sketch of the vector w = −∇Γ in the neighborhood of a spatial anisotropy. Right panel: sketch of the solid and fluid particles in the packing algorithm
framework.
∇ · u = u − u · ∇ W r − r dV , (1.7) assumed to be smaller than O (h). Under this assumption and us-
ing the results obtained in Appendix A, the following expansions
Ω
hold true:
∇ p = p + p · ∇ W r − r dV . (1.8)
∇ · u i = (u j − u i ) · ∇i W i j V j = Γi (∇ · u )i + O(h), (1.11)
Ω j
When the SPH scheme is written at the discrete level, the fluid ∇ p i = ( p j + p i )∇i W i j V j
domain is represented through Lagrangian fluid particles carrying j
the main fluid properties (e.g. the velocity, pressure, density, etc.).
In this framework, the integrals in (1.7) and (1.8) are replaced by
= Γi (∇ p )i + 2p i ∇Γi + O(h). (1.12)
summations over the fluid particles and the discrete SPH scheme Here, both Γi and ∇Γi are responsible for a deviation from the
reads: exact differential operators. As shown in the following example,
⎧ Dρ the greatest issue is caused by the pressure gradient.
⎪
⎪
i
= −ρi ( u j − u i ) · ∇i W i j V j , Let us assume we want to start a SPH simulation with hydro-
⎪
⎪
⎪
⎪
Dt static conditions. Then, we assign u i = 0, ρi = ρ (r i ) at t = t 0 and
⎪
⎪
j
⎪
⎪ try to find the hydrostatic pressure. The continuity equation is sat-
⎨ Du i = g − 1 ( p j + p i )∇i W i j V j + T i , isfied exactly while, as a consequence of (1.12), the momentum
Dt ρi j (1.9)
⎪
⎪
equation gives:
⎪
⎪ p i = F (ρi ),
⎪
⎪
⎪
⎪ Γi (∇ p )i + 2p i ∇Γi − ρi ∇Φ = O(h), (1.13)
⎪
⎪
⎩ Dr i = u .
i where Φ is the gravitational potential. This expression clearly
Dt
shows that, unless Γi = 1 and ∇Γi = 0, it is not possible to at-
Here, the subscripts indicate the quantities associated with the i-th tain any hydrostatic solution. In this context, Γi plays only a minor
and j-th fluid particle. In the specific, V i is the particle volume, role since it just causes an increase/decrease of the intensity of the
ρi = mi / V i , mi is the particle mass and ∇i indicates differentiation correct pressure gradient. On the contrary, ∇Γi is responsible for
with respect to the position r i . The term T i indicates an artificial an unbalance in both the intensity and the direction of the SPH
viscous force per unit of mass. This term is generally implemented differential operator. Further, ∇Γi diverges like 1/h when the par-
in the SPH schemes for stability reasons (see, for example, [4]). ticle distribution is strongly irregular. Then, the only way to get a
The main difference with the continuous framework is that the good initialization of the SPH scheme is to reduce the magnitude
relation (1.3) is only approximately satisfied inside the fluid do- of ∇Γi as much as possible and recover the consistency of the SPH
main. This is due to local unevenness in the particle distribution. pressure operator. This is the principal idea at the basis of the Par-
For the analysis which follows, it is convenient to introduce the ticle Packing Algorithm described in the next section.
following variables:
2. Particle Packing Algorithm
Γi = W ij V j, ∇Γi = ∇i W i j V j . (1.10)
j j The Particle Packing Algorithm is built on a simple idea: to
use the SPH features highlighted in the previous section to ini-
Variables Γi and ∇Γi give a “measure” of the unevenness in the tialize the particle distribution and minimize ∇Γ . This is made
particle distribution. In fact, if the particle distribution is perfectly by observing that the vector w = −∇Γ always points in the di-
uniform, Γi = 1 and ∇Γi = 0 otherwise Γi < 1 and ∇Γi = 0. rection of the maximum lack of “mass” and maximum anisotropy
Further, the use of Γi and ∇Γi helps understand the conver- (see Fig. 2). Now, lets assume to use it to move particles during
gence of the discrete differential operators. In fact, two different the initialization. If the fluid domain is bounded and particles are
kinds of errors are made when the exact differential formulas are not allowed to escape from the boundaries, w tends to fill all the
substituted with the discrete smoothed formulas. One kind is due asymmetries in the particle distribution and, at the same time,
to the interpolation procedure (errors proportional to the smooth- decreases as a consequence of the more regular distribution of par-
ing length, h) while the other is caused by the approximation ticles themselves. Then, the final distribution would be the most
of continuous integrals with finite summations (see, for example, regular possible and w (that is, ∇Γ ) would be minimized as
[10]). In the latter case the error decreases as the number of parti- requested.
cles inside the kernel domain increases. Then, if the mean number The first step to build the Particle Packing Algorithm is to close
of particles in the kernel domain is large enough, this error can be the domain boundaries. As a consequence, this implies that the
1644 A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653
free surface has to be treated as a solid boundary. The domain the particle masses are kept constant while the densities and the
boundary is modeled through fixed solid particles, that is, par- volumes are updated using the continuity equation and the rela-
ticles with zero velocity and fixed positions. This approach can tion V i = mi /ρi .
be regarded as a special use of the frozen particles (for details
see [11]) or as a straightforward application of the fixed ghost 2.1. The particle packing system as a Lagrangian system
particle technique proposed by Marrone et al. [7]. A sketch of
this procedure is displayed in the right panel of Fig. 2. In prin- (ζ )
Let us consider (2.14) and neglect the damping force T i . Un-
ciple, the proposed packing algorithm may be modified to include der this hypothesis, the particle packing system is a Lagrangian
different techniques for the solid profile modeling (e.g., repellent system and its Lagrangian function is L = T − V where:
particles [12] or boundary surface forces [13]). However, the use of
fixed solid particles is straightforward and leads to important the- ∗ u i 2 β ∗ ∗ ∗
oretical results (see Section 2.1). Note that particles do not need T = , V = W ij V 0 + β W i j V 0.
2 2
any specific rule to be positioned inside the fluid domain nor in- i i j i j
side the solid bodies. (2.18)
The second step consists in assuming the density, the pressure
and the volumes constant all over the fluid domain. We indicate Here the starred series indicates the summation over the fluid par-
them through symbols ρ0 , p 0 and V 0 respectively. Since volumes ticles while the barred one denotes the summation over the fixed
are constant and the packing algorithm has to converge toward a solid particles. Symbols T and V are the specific kinetic energy
static solution, we neglect the continuity equation. Conversely, the and specific potential energy respectively. According to the theory
momentum equation of system (1.9) becomes: of dynamical systems, the total energy (that is, E = T + V ) keeps
constant during the evolution and the system has stable equilib-
⎧ Du
⎪ i (ζ ) ria at the points where the potential attains its local minima. The
⎨ = −β∇Γi + T i ,
Dt addition of any dissipative term (like, for example, that in (2.15))
(2.14)
⎪
⎩ Dr i = u forces the dynamical system to converge toward the static (and
i stable) solution u i = 0, ∇Γi = 0. This is a fundamental point since
Dt
it proves that for a given arbitrary geometry (modeled through
where β = 2p 0 /ρ0 and Γi = j W i j V 0 . The damping force can be fixed ghost particles), the packing algorithm always converges to-
(ζ )
chosen independently from the adopted SPH scheme since T i is ward a stable particle configuration. All details on the Lagrangian
just used to ensure the convergence of the Particle Packing Algo- structure of the packing algorithm are given in Appendix B.
rithm (more details are given in Section 2.1 and in Appendix B).
Similarly to Monaghan [1], we choose a linear damping term: 2.2. Stability and equilibria in R2
√
(ζ ) β Let us consider the system (2.16) in the two-dimensional
Ti = −ζ u i with ζ = α (2.15)
1/d
V0 plane, R2 . In this case, there are no boundaries and, therefore,
for ζ = 0, the system has stable equilibria at the points where the
where d is the spatial dimension and α is a free dimensionless potential attains its local minima.
parameter. By numerical simulations, we heuristically found that a If the number of particles is finite, their spatial distribution can-
good choice for α ranges between 1 · 10−3 and 5 · 10−3 . Then, the not be homogeneous nor isotropic and, therefore, ∇Γ = 1 some-
particle packing system becomes: where in R2 . Since w = −∇Γ points outward the fluid domain
⎧ Du in the direction of maximum anisotropy, particles start going away
⎪
⎨
i
= −β∇Γi − ζ u i , one from the other and their reciprocal distance grows. This im-
Dt plies a decrease of W (r j − r i ) and, consequently, a decrease of
(2.16)
⎪
⎩ Dr i = u . the potential energy. The final configuration predicts particles es-
i
Dt caping at infinity and corresponds to zero potential energy (that is,
The initial conditions for the Particle Packing Algorithm are ob- a local and absolute minimum for the potential energy).
tained by setting all the particle velocities to zero and V 0 = If the particle number is infinite, there exist only three regu-
V tot / N part where V tot is the total fluid volume and N part is the lar tessellations of R2 which ensure ∇Γ = 0. These configurations
total number of particles. The time-step adopted for the present (which corresponds to local extrema for the potential energy and,
algorithm is: therefore, to equilibria of the particle system) are the triangular,
square and hexagonal tessellation of the plane. Note that they are
1/d all invariant for rigid rotations and translations which, therefore,
V
t = CFL √0 , (2.17) represent “directions” of neutral stability.
β
From a practical and theoretical point of view, it is interest-
where CFL = 1. ing to study the stability of such equilibria. Since the theoretical
As discussed in detail in the following sections, system (2.16) analysis is very prohibitive, this is made through numerical sim-
tends to converge as much as possible toward a steady state char- ulations. The first step consists in the construction of a bounded
acterized by u i = 0 and ∇Γi = 0. When the fluid system is suf- fluid domain Ω using one of the tessellations mentioned above.
ficiently close to this state, the packing algorithm is stopped and Such a domain has to be large enough to assume that the most in-
the particle positions are used to initialize the SPH simulations. ner particles are not influenced by ∂Ω . The boundary is fixed and
Since the spatial distribution is very regular, the particle volumes modeled through fixed solid particles. Note that the presence of a
can be assumed to be identical. Then, the volume used for the ini- fixed boundary automatically eliminates the “directions” of neu-
tialization of the SPH is V ∗ = V 0 . The initial particle pressure, p ∗i , tral stability (that is, rigid rotations and translations). After the
is assigned by using the analytical expression for the hydrostatic domain Ω and its boundary have been built, particles are per-
pressure and the particle positions. Then, inverting the state equa- turbed from their equilibrium positions. Specifically, we put ζ = 0,
tion, the initial density ρi∗ is computed and, finally, the particle since we do not want the viscosity to influence the stability of
mass is obtained through m∗i = ρi∗ V ∗ . During the SPH simulations, the tessellations under consideration. Under this hypothesis, sys-
A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653 1645
Fig. 3. Cartesian, triangular and hexagonal tessellations (left column, from top to bottom) and some snapshots of their evolution (right column, from top to bottom) for
h/dx = 1.4. The circumferences indicate the domains of the adopted kernel functions.
tem (2.16) is Lagrangian (that is, it preserves the total energy, E ) other configurations. In the former case the equilibrium (and the
and, therefore, only two cases are possible: particles keep oscil- related tessellation) is said to be Liapunov stable (see, for exam-
lating around the equilibrium configuration or they move toward ple, [14]) otherwise the equilibrium is unstable.
1646 A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653
Table 1
Stability of the tessellations. ‘S’ = Liapunov stable, ‘U’ = unstable.
h/dx = 0.8 h/dx = 1.4 h/dx = 2.0 h/dx = 2.6 h/dx = 3.2
Cartesian U S S U U
Triangular S U S S U
Hexagonal U U U U U
Fig. 5. Trapezoidal tank (H /dx = 25). Initialization using a Cartesian grid (left) and through the particle packing algorithm (right).
Fig. 6. Trapezoidal tank. Evolution of the specific kinetic energy during the initialization through the particle packing algorithm.
Fig. 7. Hydrostatic solution for the trapezoidal tank (H /dx = 50). Evolution using a Cartesian grid (left) and after the initialization through the particle packing algorithm
(right).
time to make particle self-resettle in equilibrium positions. The ties, the physical meaning of the damping coefficient used in the
actual numerical simulation starts after the equilibrium configu- SPH simulations is slightly different from that of the ζ coefficient
ration is attained. Here, we show that such a procedure (that is, adopted in the particle packing algorithm. In the latter case, the
the initialization using the SPH scheme itself) only leads to minor
damping term has to be regarded as an “inter-particle” dissipation
improvements.
while in the former case it represents artificial dissipations. For
Following Monaghan [1], we use the standard SPH scheme
with a linear damping term. By definition, this is identical to the this reason, the ζ coefficient of the SPH simulations has been made
damping term adopted in the packing algorithm and, consequently, dimensionless using physical variables (specifically, the sound ve-
its coefficient has been denoted by ζ . Apart from these similari- locity c 0 and the filling height H ).
1648 A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653
Fig. 8. Hydrostatic solution for the trapezoidal tank (H /dx = 50): time evolution of Fig. 11. Sketch of the complex tank geometry.
the maximum intensity of velocity.
Fig. 12. Hydrostatic solution for a complex tank geometry. Top: evolution after initialization on a Cartesian grid. Middle: evolution after initialization through packing
algorithm. Bottom: time history of the kinetic energy.
(see [1] and [17] for details). This domain is initialized using flow evolution after the use of the packing algorithm displays a
a Cartesian grid (left panel of Fig. 15) and the proposed parti- more uniform particle distribution and, consequently, leads to a
cle packing algorithm (right panel of the same figure). Since the better agreement with the analytical solution (bottom panel of
SPH is a Lagrangian scheme, particles move along stream lines. Fig. 16).
Consequently, when particles are initially set on a Cartesian grid,
the flow evolution given by (3.19) leads particles to clump along 4. Conclusions
straight lines (see top panel of Fig. 16). This partially prevents
the SPH solution to match with the analytical solution for the Using some intrinsic features of the SPH scheme, a novel pack-
domain boundary (dashed lines in Fig. 16). On the contrary, the ing algorithm has been derived for the particle initialization. The
1650 A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653
Fig. 13. Freely floating of a ship hull section after initialization on a Cartesian grid (left column) and with the particle packing algorithm (right column).
Fig. 14. Freely floating of a ship hull. Top panels: motion of the mass center (left panel) and a detail of its evolution (right panel). Bottom panel: roll motion.
proposed algorithm has been validated against several test cases ∇ f = ∇ f W dV (A.21)
proving to be robust, fast and reliable also for complex geometri-
Ω
cal configurations. As shown for the evolution of the elliptical drop,
the particle distribution obtained through the packing algorithm where, for the ease of notation, f = f (r ) and W = W (r − r ).
may even avoid the formation of those filamentous structures that Integrating by parts and using the divergence theorem, we get:
are caused by the Lagrangian nature of the SPH.
Acknowledgements ∇ f = ∇ f W dV − f ∇ W dV
Ω Ω
The research leading to these results has received funding
from the European Community’s Seventh Framework Programme = f W n dV + f ∇ W dV ,
(FP7/2007–2013) under grant agreement No. 225967 “NextMuSE”. ∂Ω Ω
This work was also partially supported by the Centre of Excel-
lence for Ship and Ocean Structures of NTNU Trondheim (Norway) where n is the normal to ∂Ω . Note that the last integral has been
within the “Violent Water–Vessel Interactions and Related Struc- obtained using the identity ∇ W (r − r ) = −∇ W (r − r ). Now, con-
tural Loads”. sider the following expansion:
f = f + ∇ f · r − r + O r − r .
2
Appendix A. Interpolation formulas (A.22)
Let us consider a generic scalar function f and the following Then, substituting into the first integral and noting that r − r =
convolution integral: O(h), we find:
A. Colagrossi et al. / Computer Physics Communications 183 (2012) 1641–1653 1651
Fig. 15. Evolution of an elliptical drop. Initialization using a Cartesian grid (left) and the particle packing algorithm (right).
Fig. 16. Evolution of an initially circular patch of fluid using a Cartesian grid (top) and the particle packing algorithm (bottom). Dashed lines indicate the analytical solution
for the domain boundary.
∇ f = f W n dV + (∇ f )k r − r k W n dV = − f ∇Γ + Γ ∇ f − ∇ f r − r ⊗ ∇ W dV
∂Ω ∂Ω Ω
+ f ∇ W dV + O (h). + f ∇ W dV + O (h).
Ω Ω
Now, applying the divergence theorem once again and the property This formula can be rewritten as follows:
∇ W (r − r ) = −∇ W (r − r ), it follows:
∇ f = f − f ∇ W dV + Γ ∇ f
∇ f = − f ∇Γ + (∇ f )k ∇ r − r k W dV Ω
Ω −∇ f r − r ⊗ ∇ W dV + O (h). (A.23)
+ f ∇ W dV + O (h) Ω
Then, using the expansion (A.22) once again, we finally obtain:
Ω
∇ f = Γ ∇ f + O(h).
= − f ∇Γ + ∇ f W dV + ∇ f r − r ⊗ ∇ W dV (A.24)
Now, basing on (A.23), we can write: The velocity inside the first double summation is rewritten as u i =
(u i + u j )/2 + (u i − u j )/2. Conversely, the velocity inside the second
∇ f = f ∇ W dV = ∇ f + f ∇Γ − Γ ∇ f double summation can be rewritten as u i = u i − u j , since the solid
particles have null velocity (that is, u j = 0). Then, we obtain:
Ω
∗ ∗ ∗ (u i + u j)
+∇f r − r ⊗ ∇ W dV + O (h). u i · ∇i W i j V 0 = · ∇i W i j V 0
2
Ω i j i j
[11] M. Liu, G. Liu, Smoothed particle hydrodynamics (SPH): An overview and re- [15] M. Antuono, A. Colagrossi, S. Marrone, C. Lugni, Propagation of gravity waves
cent developments, Arch. Comput. Methods Eng. 17 (1) (2010) 25–76. through an SPH scheme with numerical diffusive terms, Comput. Phys. Com-
[12] J.J. Monaghan, J.B. Kajtar, SPH particle boundary forces for arbitrary boundaries, mun. 182 (2011) 866–877.
Comput. Phys. Commun. 180 (10) (2009) 1811–1820. [16] M. Ferrand, D. Laurence, B.D. Rogers, D. Violeau, Improved time scheme in-
tegration approach for dealing with semi analytical boundary conditions with
[13] J.C.M. Marongiu, Méthode numérique lagrangienne pour la simulation d’écoule- SPARTACUS2D, in: 5th International Spheric Workshop, Manchester, 22–25 June
ments à surface libre – Application aux turbines Pelton, PhD thesis, École 2010.
Central de Lyon, 2007. [17] A. Colagrossi, A meshless Lagrangian method for free-surface and interface
[14] M. Vidyasagar, Nonlinear Systems Analysis, second ed., SIAM, 2002. flows with fragmentation, PhD thesis, Università “Sapienza”, Rome.