SPH Tutorial
SPH Tutorial
Puppo Tutorial
Disclaimer: This document is work-in-progress and will be maintained and updated over a longer period. Please find the
current version of the document under InteractiveComputerGraphics.github.io/SPH-Tutorial.
Abstract
Graphics research on Smoothed Particle Hydrodynamics (SPH) has produced fantastic visual results that are unique across the
board of research communities concerned with SPH simulations. Generally, the SPH formalism serves as a spatial discretization
technique, commonly used for the numerical simulation of continuum mechanical problems such as the simulation of fluids,
highly viscous materials, and deformable solids. Recent advances in the field have made it possible to efficiently simulate
massive scenes with highly complex boundary geometries on a single PC [Com16b, Com16a]. Moreover, novel techniques
allow to robustly handle interactions among various materials [Com18,Com17]. As of today, graphics-inspired pressure solvers,
neighborhood search algorithms, boundary formulations, and other contributions often serve as core components in commercial
software for animation purposes [Nex17] as well as in computer-aided engineering software [FIF16].
This tutorial covers various aspects of SPH simulations. Governing equations for mechanical phenomena and their SPH dis-
cretizations are discussed. Concepts and implementations of core components such as neighborhood search algorithms, pres-
sure solvers, and boundary handling techniques are presented. Implementation hints for the realization of SPH solvers for fluids,
elastic solids, and rigid bodies are given. The tutorial combines the introduction of theoretical concepts with the presentation
of actual implementations.
Keywords: Physically-based animation, Smoothed Particle Hydrodynamics, fluids, elastic solids, rigid bodies
Categories and Subject Descriptors (according to ACM CCS): Computer Graphics [I.3.7]: Three-Dimensional Graphics and
Realism—Animation
the simulation community, where we currently see a strong focus Variable Description Unit
on SPH within Lagrangian approaches with exclusive SPH confer-
ences and SPH initiatives. d Spatial dimension –
A Auxiliary function –
Still, simulation and computer science are different communi-
t Time s
ties, but there is a growing acceptance of advances across commu-
nities. Graphics papers use state-of-the-art kernel functions, rang- ρ Volumetric mass density kg m−3
ing from cubic spline to Wendland kernel types. The kernel gradient p Pressure Pa
correction is employed in a growing number of approaches. Vice m Mass kg
versa, the simulation community adopts efficient data structures for Ψ Pseudo-mass kg
neighborhood searches, concepts for non-uniformly boundary sam- µ Dynamic viscosity Pa s
plings, and efficient pressure solvers. ν Kinematic viscosity m2 s−1
This tutorial aims at a practical introduction of the SPH concept h Smoothing length m
and its application in the simulation of fluids, elastic solids, and ~ Kernel support radius m
rigid solids. It starts with a description of the SPH concept and its h̃ Particle size m
usage for the interpolation of field quantities and for the computa- σ Kernel normalization factor m−3
tion of spatial derivatives. Then, the governing equations for fluids x Position vector of material particle m
and solids are stated and the SPH concepts for the simulation of flu- r Distance vector between two material particles m
ids and solids are outlined. In the following, various aspects of SPH u Displacement of a material particle m
simulations are explained in more detail. One of these aspects is the
v Velocity vector of material particle m s−1
neighborhood search that is required for all SPH computations, as
a Acceleration vector of material particle m s−2
the interpolation of a quantity or a spatial derivative is always com-
ω Angular velocity vector of material particle rad s−1
puted as a sum over adjacent particles. Another important aspect
is incompressibility which is not only relevant for fluids, but also, f Body force N m−3
e.g., in the case of elastic solids. Next, boundary handling concepts F Force N
are explained, e.g., the interaction for fluid particles at solid walls, τ Body torque N m m−3
at free surfaces, i.e., at the interface between fluid and air, or the τ Torque Nm
interaction of particles from different fluids, i.e., multiphase fluids. Θ Microinertia m2 s−1
Other topics are viscosity, surface tension, and vorticity. Further, T Cauchy stress tensor N m−2
the SPH simulation of elastic solids and SPH-based contact han- P 1st Piola-Kirchhoff stress tensor N m−2
dling between rigid bodies is described. Moreover, the techniques J Deformation gradient –
for the usage of SPH discretizations in data driven fluid simulations
ε Strain tensor –
are presented. Finally, SPlisHSPlasH, an open-source library for
E Strain rate tensor s−1
the physically-based SPH simulation of fluids and solids, is intro-
duced. The most important quantities that will be used throughout
this tutorial are summarized in Tab. 1. Table 1: Table of notation.
2. Foundations
2.1. SPH Discretization
In this section, we introduce the fundamental concept of SPH for
the phenomenological simulation of fluids and solids. The section The concept of SPH can be generally understood as a method for
is primarily based on the excellent work of Price [Pri12] and Mon- the discretization of spatial field quantities and spatial differential
aghan [Mon05] but, moreover, includes important theoretical and operators, e.g., gradient, divergence, curl, etc. In order to under-
practical insights that we have gained over the years working on stand the basic idea, we first have to introduce the Dirac-δ distri-
SPH based techniques. bution and the corresponding Dirac-δ identity. δ is a generalized
function defined as
We first show how the SPH formalism discretizes spatial quan-
tities using a set of particles equipped with a kernel function. Sec- ∞ if r = 0
ondly, we discuss the approximation quality that can be expected δ(r) = (1)
0 otherwise
and provide practical examples to illustrate the consequences for
physics-based simulations targeting computer graphics applica-
and satisfies δ(r) dv = 1.
R
tions. Thirdly, we show how 1st - and 2nd -order differential oper-
ators are discretized and present specialized variants of the discrete To provide a physical intuition of what this distribution de-
operators tailored to specific circumstances. Finally, we give a brief scribes, consider the following example. In physics the mass of a
introduction of the conservation law of linear momentum and the body is usually defined as the spatial integral in the volumetric mass
density, i.e., m =: ρ(x) dv. However, if an idealized point mass is
R
concept of stress in order to derive the governing equations for
fluids and elastic solids and present a simple approach to simu- considered, the concept of a density function loses its meaning as
late weakly compressible fluids using the knowledge that we have the point mass has no spatial extents. In this case the density can
gained up to this point. not be described as a function, anymore, but collapses to the Dirac-
σ2 = 0
Z
W r0 , h dv0 = 1
(normalization condition)
Rd
1.0
W r, h0 = δ(r)
lim (Dirac-δ condition)
h →0
0
0.0
W(r, h) = W(−r, h) (symmetry condition)
−1.0 −0.5 0.0 0.5 1.0
x W(r, h) = 0 for krk ≥ ~, (compact support condition)
Figure 1: Gaussian bell function (normal distribution) N (0, σ2 ) ∀ r ∈ Rd , h ∈ R+ , where ~ denotes the support radius of the kernel
with varying variance σ2 . For σ2 → 0 the function approaches the function. Moreover, the kernel should be at least twice continuously
Dirac-δ distribution. The arrow indicates a function value of ∞. differentiable to enable a consistent discretization of 2nd -order par-
The function family has non-compact support. tial differential equations (PDEs). It is essential to use a kernel that
satisfies the first two conditions (normalization and Dirac-δ), in or-
der to ensure that the approximation in Eq. (3) remains valid. The
positivity condition is not strongly required (there are also kernels
δ distribution scaled using the point mass. Another intuition of in- that do not have this property). However, in the context of physical
terpreting the Dirac-δ distribution is to understand it as the limit of simulations kernels that take negative values may lead to physi-
the Gaussian normal distribution as the variance approaches zero cally inconsistent estimates of field quantities, e.g., negative mass
(see Fig. 1). density estimates, and should therefore be avoided. We will later
see that the symmetry condition ensures 1st -order consistency of
Now that we have understood the Dirac-δ distribution, we can
the continuous approximation. Finally, ensuring that the kernel is
apply the Dirac-δ identity as the basis for the discretization. The
compactly supported is a purely practical consideration that will
identity states that the convolution of a continuous compactly sup-
come into play after discretizing the continuous integral and will
ported function A(x) with the Dirac-δ distribution is identical to A
be discussed later. To keep this tutorial practical, we refrain from
itself, i.e.,
Z discussing how to construct SPH kernels and would like to refer the
A(x) = (A ∗ δ) (x) = A x0 δ x − x0 dv0 , reader to the review of Liu and Liu [LL10] for a discussion on ker-
(2)
nel construction and an overview over a range of smoothing kernels
where dv0 denotes the (volume) integration variable corresponding suitable for SPH.
to x0 . A typical choice for the smoothing kernel is the cubic spline ker-
nel
2.2. Continuous Approximation 3 2
6(q − q ) + 1 for 0 ≤ q ≤ 2
1
We will later approximate the integral of Eq. (2) using a sum for nu- W(r, h) = σd 2(1 − q)3 for 12 < q ≤ 1 (4)
merical quadrature. Since δ(r) is, however, neither a function nor
0 otherwise ,
can be discretized, we first make a continuous approximation to the
Dirac-δ distribution as a preparation to the discrete approximation with q = 1h krk. The kernel normalization factors for the respective
of the integral. A natural choice to approximate δ is to use a nor- 4 40 8
dimensions d = 1, 2, 3 are σ1 = 3h , σ2 = 7πh 2 , and σ3 = πh3 . Please
malized Gaussian since δ is equal to the normal distribution with
note that there exist different formulations of the cubic spline ker-
zero variance. Consequently, convolving a field quantity A with a
nel throughout SPH literature that are differently parametrized with
Gaussian effectively smoothes A. We will later see that the Gaus-
respect to h. This kernel fulfills all of the discussed kernel proper-
sian is, however, not an optimal choice due to its non-compact sup-
ties and has the particular advantage that its smoothing length is
port domain and will therefore consider more general smoothing
identical to the kernel support radius, i.e., h = ~, which helps to
functions W : Rd × R+ → R which we will refer to as kernel func-
avoid confusions in the implementation. For a graphical illustra-
tions or smoothing kernels. Formally the continuous approximation
tion please see Fig. 2. The plots demonstrate that the kernel is C2 -
to A(x) with W(r, h) is
continuous. Therefore, derivatives of order > 1 are not really useful
A(x) ≈ (A ∗W) (x) in practice due to the lack of smoothness. That is, however, not a
Z (3) major issue as there are more sophisticated approximations for 2nd -
= A x0 W x − x0 , h dv0 ,
order derivatives solely based on the kernel gradient. Otherwise, if
√1 1 0
8 h=
1 (x − x) · ∇∇A|x (x0 − x) + (5)
2
h= √1
2
O((x0 − x)3 ) W x − x0 , h dv0
6 h= √1
4
W(r, h)
h= √1
Z
= A(x) W x − x0 dv0 +
8
4
Z
(x − x0 )W x − x0 dv0 + (6)
2 ∇A|x ·
O((x − x0 )2 ) .
0
h= √1
8 16 It is trivial to see that the approximation of (A ∗W) to A is 1st -order
h= √1 accurate if the integral in the first term of Eq. (6) becomes 1, and if
32
4 the integral in the second term vanishes. The first condition is au-
· 10−1
2
2.3. Discretization
1 The remaining step to realize the SPH discretization is to replace
· 10−3
−1 A x0
∂r 2
Z
W x − x0 , h ρ x0 dv0
(A ∗W)(xi ) = 0
(7)
−2 ρ(x ) | {z }
dm0
mj
−3 ≈ ∑ Aj W xi − x j , h =: hA(xi )i ,
(8)
j∈F ρ j
−0.50 −0.25 0.00 0.25 0.50
r where F is the set containing all point samples and where all field
quantities indexed using a subscriptdenote the field evaluated at the
respective position, i.e., A j = A x j . For improved readability, we
Figure 2: Graph of the cubic spline kernel (see Eq. (4)) and its will drop the second argument of the kernel function and use the
derivatives. abbreviation Wi j = W xi − x j , h in the remainder of this tutorial.
The physical interpretation of this is that we keep track of a number
of points that "carry" field quantities. In this particular case, each
point j has a certain location x j and carries a mass sample m j and
a field sample A j . It is not mandatory that the particle keeps track
of its density ρ j as this field can be reconstructed from its location
and mass as explained later. Due to the analogy to physical particles
the term smoothed particle has been coined in the pioneering work
of Gingold and Monaghan [GM77]. Nevertheless, we would like
to stress the fact that a set of SPH particles must not be misunder-
stood as discrete physical particles but simply as a spatial function
discretization.
Analogously to the brief error analysis for the continuous ap-
proximation, a Taylor series expansion of hAi in x j about xi reveals
desired, kernels of higher regularity can be found in the literature, the accuracy of the discretization
e.g., in the work of [LL10]. mj
hA(xi )i = Ai ∑ Wi j +
j ρj
mj (9)
Let us consider the field A : Rd → R. In order to investigate the ∇A|xi · ∑ (x j − xi )Wi j + O((x j − xi )2 ).
accuracy of the continuous approximation, a Taylor series expan- j ρj
Approximation
conditions are highly dependent on the sampling pattern leading to 1
the fact that not even a 0th -order consistent discretization can be
guaranteed. In practice, however, the approximation is sufficiently
0
accurate to approximate physical field functions to obtain realistic
simulations. If desired, 0th -order consistency can be easily restored
m
by normalizing the SPH approximation with ∑ j ρ jj Wi j or even 1st - −1
order consistency can be restored by the cost of a small matrix in-
version (see [Pri12]). A1 − hA1 i
0.75 A2 − hA2 i
To give the reader a notion of the quality of the discrete approx- A2 − hA2 i
imation of functions, we have discretized a linear and a quadratic
polynomial as well as a trigonometric function using a fairly coarse
Error
SPH discretization equipped with the cubic spline kernel. The sam- 0.00
pling pattern is illustrated in Fig. 3 while the the function and ap-
proximation graphs are depicted in Fig. 4. In this example we have
−0.75
0 1 2 3 4
s
proximation
mj
∇Ai ≈ h∇Ai i − Ai h∇1i = ∑ (A j − Ai )∇iWi j . (17)
j ρj
estimates of the symmetric type when quantities are discretized that 2.6. Governing Equations for Fluids and Solids
directly affect particle trajectories, e.g., physical forces, impulses,
In order to simulate the dynamic behavior of fluids and solids, a
and to use the difference formula when 1st -order differentials are
mathematical model that describes physical phenomena and mo-
estimated for indirect use, e.g., the velocity divergence during pres-
tion of the matter is required. In computer graphics related research,
sure solves.
we are generally interested in the appearance of objects and flu-
ids in motion on humanly perceivable scales which is dominantly
2.5.1. Discretization of Laplace Operator
governed by the matter’s macroscopic behavior. An important class
Similar to the direct 1st -order derivatives (Eqs. (13)-(15)) the of mathematical models that describe the macroscopic mechanical
Laplace operator can be directly discretized, i.e., behavior of fluids and solids is based on continuum theory. Un-
mj fortunately, we can not cover an introduction to continuum me-
∇2 Ai ≈ ∑ A j ∇2i Wi j . (21) chanics as this is out of the scope of this tutorial. For a thorough
j ρ j
introduction we would like to refer the reader to the works of Abe-
This, however, leads again to a very poor estimate of the 2nd -order yaratne [Abe12] and Lai et al. [LKR09]. Nevertheless, we would
differential. A improved discrete operator for the Laplacian was like to informally describe the basic idea of continuum theoretical
presented by Brookshaw [Bro85]: models in the following.
mj 2k∇iWi j k Physics teaches us that all matter is formed out of discrete par-
∇2 Ai ≈ − ∑ Ai j . (22) ticles such as atoms, molecules, etc. Therefore, we know that the
j ρj kri j k
distribution of mass within matter is not continuous but can rather
The main idea leading to this particular formulation is to effectively be interpreted as a system of discrete mass points. Nonetheless, the
use solely a 1st -order derivative of the kernel function and to realize vast majority of macroscopic mechanical phenomena can be ac-
the second derivative using a finite-difference-like operation, i.e., curately described when the corresponding matter is idealized as a
dividing by the particle distance. continuum, i.e., a region of continuously distributed mass. This ide-
2nd -order derivatives of vectorial field quantities are realized alization then implies that a portion of matter can always be divided
analogously resulting in into smaller portions independent of the size of the regions. This in
turn confirms the theoretical existence of a material particle, i.e.,
mj 2k∇iWi j k a portion of matter contained in an infinitesimal volume. Contin-
∇2 Ai = − ∑ Ai j (23)
j ρj kri j k uum theory then aims to model macroscopic physical phenomena
and neglects effects that can be observed on microscales. In the
mj k∇iWi j k
∇(∇ · Ai ) = ∑ (d + 2)(Ai j · r̃i j )r̃i j − Ai j , (24) following, we will summarize the most important local conserva-
j ρj kri j k
tion laws required for the numerical simulation of (in)compressible
r fluids and solids.
where d and r̃ = kri j k denote the spatial dimension and the normal-
ij
ized distance vector between particles i and j, respectively. A prob-
Continuity Equation
lem of the discrete Laplace operator defined in Eq. (23) in the con-
text of physics simulations is that forces derived using this operator, The continuity equation describes the evolution of an object’s mass
e.g., viscosity forces, are not momentum conserving. Fortunately, density ρ over time, i.e.,
we get the following expression by adding together Eqs. (23) and Dρ
(24): = −ρ (∇ · v) , (27)
Dt
mj k∇iWi j k ∇(∇ · Ai ) ∇ Ai 2 D(·)
where Dt denotes the material derivative. This relation is espe-
∑ ρ j (Ai j · r̃i j )r̃i j kri j k
≈
d +2
−
2(d + 2)
. (25)
j cially important when incompressible materials are modelled. In
this particular case the constraint
This identity has the important consequence that in the case of a
divergence-free vector field, i.e., ∇ · A = 0, the Laplace operator Dρ
= 0 ⇔ ∇·v = 0 (28)
can be discretized using Dt
m j Ai j · ri j has to be fulfilled at every material point and at all times within the
∇2 Ai ≈ 2(d + 2) ∑ ∇iWi j , (26) described matter.
j ρ j kri j k2
resulting in forces composed of terms that solely act along the "line A note on the material derivative: The material derivative de-
of sight" between two interacting particles i and j. This particu- scribes the time rate of change of a field quantity at a material
lar choice has the advantage that derived physical forces recover point. It is important to understand that the explicit form of the
momentum conservation [Pri12]. Therefore, we recommend to use material derivative is dependent on the type of coordinates that are
Eq. (26) as discrete Laplace operator for divergence-free vector used to the describe the system. Eulerian coordinates describe a
fields. In order to improve readability, we will drop the differentia- field quantity at spatially fixed points in space, observing the mo-
tion index for differential operators in the remainder of this tutorial. tion of the continuum as time passes. This type of coordinates is
We will use the convention that the spatial operators always differ- usually employed for mesh-based simulation techniques for fluids.
entiate with respect to the variable according to the first index such In contrast, Lagrangian coordinates "track" the individual mate-
that e.g., ∇Wi j ≡ ∇iWi j . rial particles as they move through space and time. Lagrangian co-
ordinates are commonly employed for the particle based simula- 2.7. Mixed Initial-Boundary Value Problem
tion of fluids, such as SPH, or the mesh-based simulation of elastic
The previously introduced linear momentum conservation law
solids. Given the same field quantity once described in Eulerian
(Eq. (30)) in combination with a constitutive relation, e.g., Eq. (31),
coordinates AE (t, x) and Lagrangian coordinates AL (t) the material
is a PDE in time and space that describes the motion of any object
derivative has the following explicit forms
composed of the material modeled by the constitutive law. In or-
DAE ∂AE DAL ∂AL der to model a specific problem and to ensure a unique solution,
= + v · ∇x AE and = . (29) initial conditions, i.e., the initial shape and velocity of the object
Dt ∂t Dt ∂t
at every point, and boundary conditions constraining the position
The second term of the material derivative for Eulerian coordinates
and/or velocity field have to be specified. As there is, in general, no
is referred to as convection term or self-advection term. As opposed
known analytic solution to the mixed initial-boundary value prob-
to some people’s beliefs, the convection term is non-existent when
lem in arbitrary scenarios, numerical solving is inevitable and re-
a quantity is described in Lagrangian coordinates. In the remain-
quires discretization of the assiociated differential operators. In the
der of this tutorial, we will exclusively describe quantities using
previous sections, we have seen several discrete differential opera-
Lagrangian coordinates.
tors based on the SPH formalism that can be employed to discretize
the spatial differential operators. After spatial discretization, we are
2.6.1. Conservation Law of Linear Momentum left with a system of ordinary differential equations (this method-
The conservation law of linear momentum can be interpreted as a ology is often called method of lines) that is typically discretized
generalization of Newton’s second law of motion for continua and using standard time integration schemes such as the implicit or ex-
is also often called the equation of motion. It states that the rate of plicit Euler method, Runge-Kutta schemes, etc. In the remainder of
change of momentum of a material particle is equal to the sum of this tutorial, we will see several variations of these discretizations
all internal and external volume forces acting on the particle, i.e., tailored to specific problems in physics based simulation.
D2 x
ρ = ∇ · T + fext , (30) 2.8. Operator Splitting
Dt 2
where T denotes the stress tensor and fext body forces – we un- Before we will discuss a simple example of a complete simulation
derstand a body force as a force per unit volume. This equation is loop, the concept of operator splitting is introduced. Its importance
independent of the material of the underlying matter as the mate- is emphasized by the fact that the vast majority of today’s SPH
rial’s behavior is "encoded" in the stress tensor and described using based simulators follow the concept. The basic idea is to decom-
so-called constitutive laws. pose the underlying PDE, e.g., the Navier-Stokes equation in the
case of fluids, into several sequential subproblems and to employ
Navier-Stokes Equation A typical constitutive relation for incom- individual techniques for solving each subproblem. This simplifies
pressible flow is the complexity of the overall problem and sometimes also decou-
ples field variables such as velocity and pressure in the numeri-
T = −p1 + µ(∇v + ∇vT ) , (31) cal solver. It moreover allows us to use stable implicit updates for
stiff subproblems while cheap explicit updates for the remaining
where p and µ denote the pressure and dynamic viscosity of the
terms can be used. A potential operator split for the incompress-
fluid. If the incompressibility is intended to be strongly enforced,
ible Navier-Stokes equation (Eq. (32)) for low-viscous fluids with
the pressure p can be interpreted as a Lagrange multiplier that has
strong enforcement of the incompressibility constraint (Eq. (28))
to be chosen such that the Eq. (28) is fulfilled. If strong enforce-
might look as described in the following. Given the current geom-
ment of incompressibility is not required, the constitutive relation
etry of the continuum x(t) and its velocity field v(t) at time t, we
can be instead completed by a so-called state equation that relates
split the problem into a sequence of subproblems in order to obtain
geometric compression (changes in mass density) with the pres-
x(t + ∆t) and v(t + ∆t):
sure, i.e., p = p(ρ) (see Section 4.4). A simple example for a state
Dv
equation is a variation of the ideal gas equation that linearly penal- 1. Update v by solving Dt = ν∇2 v + ρ1 fext ,
izes deviations from a rest density ρ0 scaled by a positive stiffness 2. determine ∇p by enforcing Dρ
Dt = 0,
factor k resulting in p(ρ) = k ρρ0 − 1 . 3. update v by solving Dv = − 1
Dt ρ ∇p and
Dx
By plugging Eq. (31) into Eq. (30) we arrive at the incompress- 4. update x by solving Dt = v,
ible Navier-Stokes equation µ
where ν = ρ denotes the kinematic viscosity. In this way, the
Dv "weaker" forces could be handled using explicit time integration
ρ = −∇p + µ∇2 v + fext . (32) while we can solve for the pressure gradients using a more sophisti-
Dt
cated implicit solver in order to keep the simulation robust for large
Elasticity The stress tensor of elastic solids is solely dependent on time steps. It should further be noticed that the individual steps are
the geometric deformation of an object, e.g., T = T(J) , where J not performed in parallel but the updated fields (in this case v and
denotes the deformation gradient which will be later introduced in ∇p) are fed forward into the next substep resulting in a somewhat
Section 10. Obviously, the constitutive model can be augmented implicit handling which has demonstrated to improve stability in
accordingly, if viscoelastic, plastic, thermoelastic, or other defor- practice as also discussed by Bridson [Bri15] for grid-based fluid
mation inducing phenomena have to be modeled. simulation.
2.9. Time Integration dition typically leads to stable simulations [SP09, ICS∗ 14, BK17].
Although obvious from Eq. (33), we would like to stress the fact
As previously described, an SPH discretization of the underlying
that the maximally allowed time step decreases with higher veloci-
PDE leaves us with a system of ordinary differential equations
ties and spatial resolution. We would further like to point out that it
(ODEs) in time following the method of lines. This, of course,
is in practice useful to specify global bounds, i.e., a lower and upper
requires us to discretize the ODE in time. Due the operator split-
bound, for the time step as we want to produce a certain number of
ting approach, as introduced in the previous section, each indi-
frames per second and want to avoid that the simulation comes to
vidual subproblem has to be numerically integrated in time. The-
halt if a single particle moves with very high velocity.
oretically, a different time integration scheme can be employed
for each individual step. In, practice most methods mainly rely on
simple and efficient explicit time integration schemes. The, by far, 2.10. Example: Simple Fluid Simulator
most frequently used scheme is the semi-implicit Euler scheme, as
Based on the knowledge that we have acquired up to this point, we
e.g., employted in [BK17, IAAT12, SB12, ICS∗ 14]). The integra-
are now able to implement a simple state-equation based simulator
tion scheme is often also referred to as symplectic Euler or Euler-
for weakly compressible fluids with operator splitting using SPH
Cromer scheme. Sometimes it is useful to solve some of the indi-
and symplectic Euler integration.
vidual substeps using implicit time integration schemes to ensure
stability in the case of "stiff" forces. A typical example where this for all particle i do
strategy is employed is in the case of simulating highly viscous flu- Reconstruct density ρi at xi with Eq. (11)
ids. Here, the viscosity force is often integrated implicitly using the
for all particle i do
implicit Euler scheme as discussed in Section 6. viscosity
Compute Fi = mi ν∇2 vi , e.g., using Eq. (23)
Naturally, we aim for the best performance of our simulator and, ∗ ∆t
vi = vi + mi (Fi
viscosity
+ Fext
i )
therefore, try to use a very large time step width ∆t † . However,
we also understand that choosing an overly large time step width for all particle i do
pressure
results in decreased accuracy of the numerical approximation and Compute Fi = − ρ1 ∇p using state eq. and Eq. (19)
may lead to a less stable simulation which might ultimately result in for all particle i do
∆t pressure
a breakdown of the simulation. In the context of computer graph- vi (t + ∆t) = v∗i + m F
i i
ics research, we care most about carrying out a robust and stable xi (t + ∆t) = xi + ∆tvi (t + ∆t)
simulation in a resource-efficient manner while the numerical ac-
curacy is often of subordinate importance. This does not mean that Algorithm 1: Simulation loop for SPH simulation of weakly com-
we do not care about accuracy at all, as the realism of the resulting pressible fluids.
animations often improves with better accuracy of the numerical
approximation. We are simply putting a higher priority on main-
taining a robust and stable simulation under extreme conditions and The few lines in Algorithm 1 are already enough to implement
in highly complex scenarios than on achieving the highest possible a simple fluid solver. However, the algorithm does, unfortunately,
accuracy. not handle boundary conditions. A practical workaround to model
boundaries in the discrete model is to sample the boundary geome-
In order to find a "good" time step width ∆t that is as large as pos- try with static (non-moving) fluid particles. The pressure forces will
sible to achieve high performance but sufficiently small to maintain then "push away" particles that attempt to penetrate the boundary. A
stability, the vast majority of approaches adaptively estimate the more consistent handling of boundary conditions will be discussed
time step using a heuristic based on the Courant-Friedrichs-Lewy in Section 5.
(CFL) condition. The CFL condition is a necessary condition for
the convergence of numerical solvers for differential equations and,
as a result, provides an upper bound for the time step width, i.e., 3. Neighborhood Search
1
Secondary
2 structure
Hashtable
...
. . .
1 2 n-1 n
z-sorted
~
m-1 ...
1 1 1 1
m
. . .
k k ... k k
Cell-wise
| {z } particle indices
~
Figure 6: Uniform grid approach to efficiently find neighboring par- Figure 7: Hash table of size m pointing to secondary data struc-
ticles. Particles that are closer to the orange particle than the kernel ture (of n non-empty cells) to realize compact hashing. Each array
support radius ~ must lie within the one ring of the cell containing to store the particle index lists in the secondary structure preallo-
the orange particle if the grid size is ≥ ~. cates k entries to minimize the number of memory allocations in
the course of the simulation.
of particles in a cell. To summarize, the memory consumption now 4.1. Explicit Volume Deviation
scales linear with the number of particles and not with the volume
The volume deviation is typically deduced from the density devi-
of the simulation domain.
ation. Although SPH solvers can easily handle both formulations,
As it lies in the nature of spatial hash tables to scatter data ac- it is probably due to historical reasons that the density formula-
cording to spatially close cells, the indirection to the secondary data tion is preferred over the volume formulation. The SPH density at
structure allows us to optimize for spatial locality in memory. To a particle i is computed with ρi = ∑ j m jWi j and the deviation to
realize this, Ihmsen et al. suggest to sort the non-empty cells ac- the rest density ρ0 is considered for the pressure computation. Note
cording to a space-filling Z-curve. The cache hit-rate can further be that thedensity deviation
is often clamped, e.g., max(ρi − ρ0 , 0)
optimized by analogously sorting the per-particle data in the same or max ρρ0i − 1, 0 , as a simple solution to the particle deficiency
way. However, performing the actual sort (O(n log n)) causes com-
problem at the free surface (see Fig. 5).
putational overhead and since the particles are constantly moving
throughout space during the simulation, it is advised to update the
Z-sort in fixed intervals, e.g., after every 1000th time step. This is 4.2. Differential Volume Deviation
justified as the order is expected to be roughly maintained over a
small number of time steps due to temporal coherence. The continuity equation relates the time derivative of the density
to the velocity divergence: Dρ Dt = −ρ∇ · v. This fact can be used
Finally, several operations such as the hash table construction, to predict a particle density from its previous density and, e.g., the
updates and neighborhood queries can be (partially) parallelized to predicted velocity: ρ∗i = ρi (t) − ∆tρi (t)∇ · v∗i . Here, ρ∗i is a pre-
further optimize performance. For further details on the approach, diction of the particle density after advecting the particles with v∗i
we would like to refer the reader to the according original pa- for time ∆t. If it is assumed that the current density equals the rest
per [IABT11]. density, the predicted density is computed as ρ∗i = ρ0 − ∆tρ0 ∇ · v∗i
which means that ρ∗i − ρ0 = −∆tρ0 ∇ · v∗i can be used as a measure
for the density deviation. It can be seen that minimizing the den-
sity deviation is related to minimizing the velocity divergence. The
4. Pressure Solvers
term −∆tρ0 ∇ · v∗i is a density change at a particle if the particles
Incompressibility is an essential aspect in realistic fluid simula- are advected with v∗i for time ∆t.
tions. The fluid volume should not noticeably oscillate or generally
grow or shrink over time. Fluid solvers preserve the fluid volume by
4.3. Discussion – Explicit vs. Differential Volume Deviation
computing a pressure acceleration − ρ1 ∇p where the pressure p is
proportional to the volume deviation. Then, the term − ρ1 ∇p accel- Both forms imply challenges. If pressure accelerations are derived
erates particles from high pressure, i.e., regions with large volume from the explicit form of the volume deviation, the fluid volume
deviations, to low pressure, i.e., regions with small volume devi- oscillates due to an over-correction of the pressure acceleration.
ations. If there would be no volume deviation everywhere in the These oscillations have to minimized. At least, they should not be
fluid, the pressure would be zero and the pressure gradient and the perceivable. Using the differential form to compute the volume de-
pressure acceleration would also be zero. viation results in a drift of the fluid volume, typically a volume
loss. The differential form assumes that the current density is cor-
Solver implementations typically distinguish pressure acceler- rect. It minimizes density changes between simulation steps, but
ation ap = − ρ1 ∇p and all other non-pressure accelerations anonp potentially existing density deviations are not detected or corrected.
which improves the intuition of the incompressibility concept. Here, the challenge is to minimize the volume drift. Although vol-
First, a predicted velocity is computed with, e.g., v∗ = v(t) + ume drift often occurs in Eulerian pressure solvers and volume os-
∆tanonp (t). Then, pressure is computed from the volume deviation cillations often occur in Lagrangian solvers, both issues are not re-
after advecting the fluid with v∗ . Finally, the respective pressure lated to the Eulerian or Lagrangian perspective. If an SPH solver
acceleration would be applied as, e.g., v(t + ∆t) = v∗ + ∆tap (t) to was using the differential form to compute the density deviation, it
minimize the volume deviation. This final velocity update is often would suffer from volume drift. If a Eulerian solver, e.g., FLIP, was
referred to as pressure projection which is related to the fact that using the explicit form for the density computation, it would suffer
the velocity change ∆tap (t) should be minimal. I.e., the pressure from oscillations.
acceleration should change the velocity field as little as possible.
Conceptually, pressure is proportional to the volume deviation. 4.4. State Equation SPH (SESPH)
However, there exist various alternatives to actually compute the
State equations are used to compute pressure from density devi-
pressure. First, the volume deviation can be explicitly computed
ations. The density deviation can be computed explicitly or from
from the density or the velocity divergence can be used to compute
a differential form. The deviation can be represented as a quo-
a differential update of the volume deviation. Second, pressure can
tient or a difference of actual and rest density. One or more stiff-
be computed locally with a state equation or it can be computed
globally by solving a Pressure Poisson Equation (PPE). The first ness constants are involved. Some examples are: pi = k ρ0 − 1 ,
ρi
ρi k2
aspect determines whether the fluid volume oscillates or continu-
pi = k(ρi − ρ0 ) or pi = k1 ρ0
− 1 . As ρi < ρ0 is not consid-
ously changes, while the second aspect influences the solver per-
formance. ered to solve the particle deficiency problem at the free surface, the
Dρ(t+∆t)
computed pressure is always non-negative. SPH fluid simulations v(t + ∆t) = Dt . The time derivative of the density is approx-
that use a state equation to compute pressure are often referred to as imated with
Dρ(t+∆t)
=
ρ(t+∆t)−ρ(t)
. The velocity is written as
Dt ∆t
compressible or weakly compressible. In contrast, fluid implemen- ∗ 1
v(t + ∆t) = v −∆t ρ(t+∆t) ∇p(t + ∆t) using an implicit update with
tations that solve a PPE to compute pressure are known as incom-
pressible. These terms basically indicate that it is more challenging the pressure acceleration at time t + ∆t. Imposing the constraint
ρ0 −ρ(t)
to minimize compression with a state equation than with a PPE. ρ(t + ∆t) = ρ0 , we get −ρ0 ∇ · v∗ + ∇ · (∆t∇p(t + ∆t)) = ∆t
and finally
It might look confusing that arbitrary pressure values can be
computed for a given density ρi > ρ0 dependent on the state equa- ρ0 − (ρ(t) − ∆tρ0 ∇ · v∗ )
∆t∇2 p(t + ∆t) = . (36)
tion and the stiffness constant(s). Here, it is interesting to note that ∆t
the parameters do not govern the pressure, but the compressibility If compared carefully, there are very minor differences between
of the SPH fluid. This can be seen in a simple example with a fluid Eqs. (35) and (36) in the computation of the predicted density and
at rest under gravity. In this case, the pressure acceleration at all the pressure acceleration. As ρ(t) ≈ ρ0 , however, these differences
particles cancels gravity, i.e., g − ρ1i ∇pi = 0. Discretizing the pres- are negligible. The biggest difference would actually be the SPH
p discretizations of the Laplacian. Eq. (35) works with the particle
sure gradient with SPH yields g = ∑ j m j ρp2i + ρ2j ∇W i j . Using,
neighborhood at time t, while Eq. (36) requires the neighborhood
i j
4.5. Pressure Poisson Equation (PPE) We search for pressure p such that the pressure acceleration
1 1
− ρ(t) ∇p(t) corresponds to a velocity change −∆t ρ(t) ∇p(t) whose
The general idea of the pressure computation is to end up with pres-
1
sure accelerations that cause velocity changes that in turn cause dis- divergence −∇ · ∆t ρ(t) ∇p(t) cancels the divergence of the pre-
placements such that all particles are uncompressed, i.e., have their
1
dicted velocity, i.e., −∇ · ∆t ρ(t) ∇p(t) + ∇ · v∗ = 0.
rest density or rest volume. PPE solvers or projection schemes solve
a linear system to compute the respective pressure field. SPH fluid solvers can easily employ any of the PPE forms. If the
density invariance is taken as source term, density oscillations oc-
4.5.1. Derivation cur and have to be minimized. If the predicted velocity divergence
is taken as source term, the fluid volume tends to drift. Volume or
We consider the predicted velocity after all non-pressure acceler- density oscillations are not a general SPH issue, but related to the
ations: v∗ = v(t) + ∆tanonp (t). If the particles would be advected pressure computation. In the same way, volume drift is not, e.g., a
with this velocity, we can use the continuity equation to estimate FLIP issue, but only due to the typically used velocity divergence
a predicted density ρ∗ = ρ(t) − ∆tρ(t)∇ · v∗ . Now, the goal of as source term in the PPE.
1
the pressure computation is a pressure acceleration − ρ(t) ∇p(t)
1
that corresponds to a velocity change −∆t ρ(t) ∇p(t) whose diver-
4.6. Discretization with Implicit Incompressible SPH (IISPH)
1
gence −∇ · ∆t ρ(t) ∇p(t) corresponds to a density change per
There exist various alternative discretizations with benefits and
1 drawbacks. Here, we discuss one option referred to as IISPH which
time −ρ(t)∇· ∆t ρ(t) ∇p(t) that cancels the predicted density de-
0 ∗
ρ0 −ρ∗
has been proposed in [ICS∗ 14]. We consider a slightly rewritten
viation per time ρ −ρ
∆t , i.e., ∆t − ρ(t)∇ · ∆t 1
ρ(t)
∇p(t) = 0. form of the PPE in Eq. (35) for particle i:
This is one form of a PPE, typically written as
∆t 2 ∇2 pi = ρ0 − ρ∗i . (38)
0 ∗
2 ρ −ρ
∆t∇ p(t) = . (35) If a quantity is considered at time t, e.g., pressure, the time index is
∆t
omitted. Using SPH, the source term is computed as
Note that ∇ · ∇p(t) = ∇2 p(t). In this equation, the pressure p is
ρ0 − ρ∗i = ρ0 − ρi − ∆t ∑ m j v∗i − v∗j · ∇Wi j
unknown. We have one equation per particle, resulting in a sys- (39)
j
tem with n equations and n unknown pressure values for n parti-
nonp
cles. Various similar PPE forms can be derived more formally, e.g., with v∗i = vi + ∆tai . The computation of the Laplacian is real-
starting with the continuity equation at time t + ∆t: −ρ(t + ∆t)∇ · ized as the computation of the divergence of the velocity change
predicted relative density error at particle i, if pressure accelera- and the constraint ρi (t + ∆t) = ρ0 , we can write
tions according to the pressure field p(l) would be applied. Typ-
ρ0 = ρ∗i + ∆t ∑ m j (∆tai − ∆ta j ) · ∇W i j .
p p
ically, the average of all ρerr,∗ is taken as a stop criterion, e.g., (52)
i j
avg_err,∗
ρi = 1n ∑i |ρerr,∗
i |. In [ICS∗
14], it is proposed to stop if, e.g.,
avg_err,∗
ρi < 0.1%, i.e., the oscillation of the overall fluid volume is When using the symmetric SPH formulation for the pressure accel-
p p
below 0.1%. In addition to the predicted average density error, the eration, the terms ai and a j are computed from unknown pressure
maximum of the predicted density errors could also be taken as a values at particle i, at neighbors of i and at neighbors of neigh-
stop criterion. bors of i. Now, PCISPH introduces approximations and simpli-
fications to end up with only one unknown pressure value pi in
Implementation Alg. 2 shows the implementation of IISPH. Eq. (52) [SP09]. Then, each pressure value pi can be computed
Source term si and diagonal element aii are computed once. In iter- from one equation. Solving a linear system is avoided.
ation l, the pressure Laplacian (Ap(l) )i = ∆t 2 ∇2 pi is computed in
p Simplifications The pressure acceleration is discretized with the
two steps. First, the pressure acceleration (ai )(l) is computed and
stored at the particles. Then, the divergence of the velocity change symmetric formulation. It is assumed that the pressure p j at neigh-
due to the pressure acceleration, i.e., (Ap(l) )i , is computed. Neigh- boring particles equals the pressure pi at particle i. Further, m j = mi
borhood search, the computation of the predicted velocity v∗i and for all neighbors and ρi = ρ j ≈ ρ0 . Then, the pressure acceleration
the advection of particles are omitted in Alg. 2. can be written as
!
p pi pj
for all particle i do ai = − ∑ m j + 2 ∇W i j (53)
j ρ2i ρj
compute diagonal element aii with Eq. (49)
compute source term si with Eq. (39) 2pi
≈ −mi ∑ ∇W i j . (54)
(0)
initialize pressure pi = 0 (ρ0 )2 j
Iterative refinement The locally optimized state equation is one compute stiffness constant kPCI with Eq. (58)
important property of the PCISPH concept. A second significant for all particle i do
characteristics is the iterative refinement of the pressure field. compute predicted density ρ∗i with Eq. (51)
While this sounds expensive, it is motivated by large time steps (1)
initialize pressure pi with Eq. (57)
compared to simple state-equation solvers. PCISPH computes a
(1) l=1
first estimate of the pressure pi with Eq. (57). This predicted
p
repeat
pressure field is used to compute (ai )(1) with Eq. (53). Then, the for all particle i do
p
pressure field is iteratively refined by compute pressure acceleration (ai )(l) with Eq. (53)
pi
(l+1)
=pi
(l) for all particle i do
p
compute density change (ρi )(l) with Eq. (60)
− ρ∗i − ∆t m j (∆t(ai )(l) − ∆t(a j )(l) ) · ∇W i j )
PCI 0 p p
+k (ρ ∑ (l+1)
j update pressure pi with Eq. (59)
(59) l = l +1
avg_err,∗
until ρi < 0.1%
in iteration l. The term
(ρi )(l) = ∆t ∑ m j (∆t(ai )(l) − ∆t(a j )(l) ) · ∇W i j
p p p
(60) Algorithm 3: Pressure computation with the PCISPH solver.
j
is one option to predict the density change due to the pressure accel-
erations. If this density change does not cancel the predicted den- which simplifies to the state equation
sity deviation ρ0 −ρ∗i , the predicted pressure is corrected. Similarly
p (1) ω ω
to IISPH, the process is stopped if (ρ0 − ρ∗i + (ρi )(l) )/ρ0 is suffi- pi = si = (ρ0 − ρ∗i ) (65)
ciently small, e.g., smaller than 0.1%. The original PCISPH depic- aii aii
p
tion proposes to compute ρi from particle displacements due to the (0)
for the first update if the pressure is initialized with pi = 0. I.e.,
pressure accelerations, i.e., if IISPH or PCISPH stop after one pressure update, they are state-
!
equation solvers.
(ρi )(l) = mi (∆xi )(l) · ∑ ∇W i j − ∑ ∇W i j · (∆x j )(l) .
p
(61)
j j Another remarkable aspect are the stiffness constants in PCISPH
p
(Eqs. (62) and (63)) and IISPH (Eqs. (64) and (65) ). The PCISPH
If (∆xi )(l) = ∆t 2 (ai )(l) and mi = m j , Eqs. (60) and (61) are identi- stiffness constant is
cal. We prefer Eq. (60) as it will also be used in the discussion of
0.5(ρ0 )2 1
the relation between PCISPH and IISPH. kPCI = − · .
∆t 2 m2i ∑ j ∇W i j · ∑ j ∇W i j + ∑ j (∇W i j · ∇W i j )
Implementation Alg. 3 shows the implementation of PCISPH. (66)
The stiffness constant kPCI is computed once at the beginning of ω
The IISPH constant is aii with ω = 0.5 and
the simulation. The same coefficient is used for all particles. The
pressure field is predicted with the state equation in Eq. (57). The
!
2 mj
effect of the respective pressure acceleration onto the density is es- aii = − ∆t ∑mj ∑ ρ2 ∇W i j · ∇W i j
timated. Remaining deviations from the rest density are used to j j j
!
compute pressure corrections with Eq. (59). Neighbor search and mi
the advection of the particles are omitted in Alg. 3. − ∆t 2 ∑ m j ∇W i j · ∇W i j . (67)
j ρ2i
4.8. Relations between SESPH, IISPH and PCISPH Applying the same assumptions as for PCISPH, i.e., ρi = ρ0 and
mi = m j , the diagonal element simplifies to
The PCISPH pressure solver updates the pressure with !
(l+1) (l) ∆t 2 m2i
pi =pi aii = − 0 2 ∑ ∇W i j · ∑ ∇W i j + ∑(∇W i j · ∇W i j ) . (68)
(ρ ) j j j
+ kPCI (ρ0 − ρ∗i − ∆t ∑ m j (∆t(ai )(l) − ∆t(a j )(l) ) · ∇W i j )
p p
j Thus,
(62) ω
kPCI = . (69)
which simplifies to the state equation aii
(1) Further,
pi = kPCI (ρ0 − ρ∗i ) (63)
∆t ∑ m j (∆t(ai )(l) − ∆t(a j )(l) ) · ∇W i j ) = (Ap(l) )i
p p
(70)
(0)
for the first update if the pressure is initialized with = 0. The pi j
same applies to IISPH. The solver updates pressure with
which means that the pressure update with Eq. (62) in the PCISPH
(l+1) (l) ω
pi = pi + si − (Ap(l) )i (64) solver is equal to the pressure update with Eq. (64) in the IISPH
aii solver. There might be insignificant differences in the computations
of ρ∗i and (Ap)i between PCISPH and IISPH, but both solvers are referred to as double summation scheme. This approximation is
essentially equal. used, e.g., in IISPH [ICS∗ 14]. It computes the divergence of the
Ihmsen et al. [ICS∗ 14] report significant performance differ- pressure accelerations. The third variant is
m ρi + ρ j
ences between PCISPH and IISPH. These differences are possibly 1
∇· ∇pi = i ∑ (p j − pi )∇2W i j , (74)
due to the fact that PCISPH computes one global stiffness constant ρi ρi j 2ρi ρ j
kPCI for a template particle, while IISPH computes aii for each par-
ticle. In particular, ∑ j ∇W i j · ∑ j ∇W i j + ∑ j (∇W i j · ∇W i j ) is as- referred to as second derivative scheme. All these options can be
sumed to be constant in PCISPH, while it is computed per parti- used to compute the left-hand side of the PPE that contains the
cle in IISPH. The respective difference affects the performance. If pressure Laplacian. If the PPE is solved with a Jacobi method, the
kPCI < aωii , the convergence of PCISPH is worse than with IISPH. required diagonal element aii varies accordingly.
If kPCI > aωii , PCISPH could be unstable. Such potential insta- The three discretizations result in different solutions for the ve-
bilities are difficult to deal with and might result in the require- locity field. It is difficult to come up with general conclusions, as
ment of significantly smaller time steps compared to IISPH. There all discretizations have benefits and drawbacks. E.g., the double-
are also other smaller differences between PCISPH and IISPH. summation approach used in IISPH seems to have an improved
E.g., PCISPH computes ρ∗i from advected samples without updated solver convergence compared to the finite-difference scheme and
neighborhood, while IISPH uses the velocity divergence to estimate the second-derivative scheme. On the other hand, the computed ve-
ρ∗i . Such differences, however, are probably less relevant for stabil- locity field suffers from high-frequency noise. This noise, however,
ity or convergence differences. is rather low and it depends on the application whether this is an
issue or not. In typical free-surface scenario, this noise is not an is-
4.9. PPE Variants sue and the double-summation discretization is just faster than the
other two options as less solver iterations are required for a speci-
In addition to PCISPH, there exist various other pressure solvers fied tolerated density deviation.
that are closely related to a PPE solver, e.g., Local Poisson SPH
[HLL∗ 12], Constraint Fluids (CF) [BLS12] and Position-based Another degree-of-freedom is the form of the source term. As
Fluids (PBF) [MM13]. It is beyond the scope of these course notes already shown and discussed in Section 4.5.1, the source term can
to provide a detailed analysis of the aforementioned solvers, but either represent the divergence of the predicted velocity or the de-
the close relation can be derived from three aspects. First, CF and viation of the predicted density to the rest density. The predicted
PBF compute constraint values at particles: Ci = ρρ0i − 1. The mag- velocity is the velocity after applying all non-pressure accelera-
nitudes of these constraints are equal tions. The predicted density is the estimated density after advecting
to pressure values computed
all samples with the predicted velocity. The equivalence of both
with a state equation pi = k ρ0 − 1 with stiffness constant k = 1.
ρi
formulations follows from the continuity equation. The PPE with
Second, CF and PBF compute forces or position changes that are density invariance as source term is
proportional to the negative of the constraint gradient. As constraint
and pressure are closely related, constraint gradient and pressure ∆t 2 ∇2 pi = ρ0 − ρ∗i (75)
gradient are related as well. Third, CF and PBF iteratively update
with source term
their solution like a Jacobi solver.
si = ρ0 − ρ∗i . (76)
In addition to these variants there exist publications that analyze
the discretizations of the pressure Laplacian and the source term in The PPE with velocity divergence as source term is
the PPE. The general idea is always the same, i.e., to compute pres-
sure such that the resulting pressure accelerations minimize density ∆t 2 ∇2 pi = ∆tρi ∇ · v∗i (77)
deviations or the divergence of the velocity field. Nevertheless, the with source term
computed velocity field depends on the employed discretizations.
E.g., Fürstenau et al. [FAW17] compare three discretizations of the si = ∆tρi ∇ · v∗i . (78)
pressure Laplacian. They consider the following form of the PPE ∗
The properties of both variants have been analyzed in [CBG 18].
with velocity divergence as source term: As already discussed, the density invariance results in an oscil-
∇ · v∗i lating density deviation over time, while the velocity divergence
1
∇· ∇pi = . (71) causes a continuous drift of the density, typically a growing density
ρi ∆t
over time. Another interesting aspect that is discussed in [CBG∗ 18]
Three variants to compute the pressure Laplacian are analyzed. The
is the artificial viscosity. Using the density invariance as source
first variant is
term causes more artificial viscosity than using the velocity di-
m ρi + ρ j (p j − pi )(xi − x j )
1
∇· ∇pi = i ∑ · ∇W i j , (72) vergence. Further, the velocity-divergence source term causes less
ρi ρi j ρi ρ j (xi − x j )2 + ε high-frequency or short-range noise in the velocity field.
referred to as finite difference scheme, where ε is a small constant Considering all properties has an interesting conclusion. What
which is added to avoid singularities. The second variant is about solving two PPEs, one with the density invariance as source
1
m
∇p j ∇pi
term and one with the velocity divergence as source term? We
∇· ∇pi = i ∑ − · ∇W i j , (73) would get two velocity changes due to pressure accelerations. Ac-
ρi ρi j ρj ρi
cording to the properties of the source terms, it can make sense to
Dρ avg
advect the particles with the velocity from the PPE with density 1: while > ηdiv ∨ (iter < 1) do
Dt
invariance as source term. This avoids the density drift. The ve-
2: for all particles i do
locity from the PPE with velocity divergence, however, could be Dρi ∗
used for the final velocities at the particles as these velocities have
3: Dt = −ρi ∇ · vi
less artificial viscosity and less noise. This has been actually done 4: for all particles i do
1 Dρi DFSPH 1 Dρ j DFSPH
by Bender and Koschier [BK15] who proposed to solve two PPEs 5: pvi = ∆t Dt ki , pvj = ∆t Dt k j
pvj
with different source terms and to use one solution to compute the pvi
6: v∗i := v∗i − ∆t ∑ j m j ρ2i
+ ρ2j
∇W i j
advected particle positions and one solution as the final velocity
field. Solving two PPEs is obviously more expensive than a simple
IISPH solver. However, each PPE solve typically requires very few Algorithm 4: Divergence-free solver
iterations, i.e., less than ten, and both PPEs share the same matrix
which can be exploited to get an efficient solver as shown in the
next section. Constant Density Solver The constant density solver uses the
PPE with density deviation as source term (see Eq. (75)). For this
4.10. Divergence-Free SPH (DFSPH) PPE we get a pressure of
DFSPH [BK17] is a variant of the idea to solve two PPEs with dif- 1
pi = (ρ∗i − ρ0 )kiDFSPH , (81)
ferent source terms. The original DFSPH solver does not compute ∆t 2
pressure, but some stiffness parameter κi per particle i. According where the predicted density is determined by
to the work of Band et al. [BGPT18], however, this stiffness param-
Dρi
eter is closely related to pressure with pi = κi ρi . In the following ρ∗i = ρi + ∆t = ρi + ∆t ∑ m j (v∗i − v∗j ) · ∇W i j . (82)
Dt j
we introduce DFSPH using a pressure formulation and replace the
stiffness parameter in order to get a formulation which is closer to Note that the factor kiDFSPH is used for both, the divergence-free
the ones of PCISPH and IISPH. In this way it is easier to see the and the constant density solver. Therefore, it has to be computed
similarities and the differences. only once per simulation step. Algorithm 5 demonstrates an imple-
DFSPH conceptually solves two PPEs, one with density invari- mentation of the constant density solver.
ance as source term, the other one with velocity divergence as
source term. Instead of using one solution for the position update 1: while (ρavg − ρ0 > η) ∨ (iter < 2) do
and one solution as the final velocity field, DFSPH combines both 2: for all particles i do
solutions to compute the final velocity field which is used to ad- 3: compute ρ∗i
vect the particles. This combination is motivated by the fact that a 4: for all particles i do
first PPE solve with density invariance computes particle positions ρ∗
i −ρ0 DFSPH
ρ∗ −ρ0
5: pi = ki , p = j∆t 2 kDFSPH
of an incompressible fluid state, but not necessarily a divergence- ∆t 2 j j
p
free velocity field. That’s why, a second PPE solve with velocity 6: v∗i := v∗i − ∆t ∑ j m j ρp2i + ρ2j ∇W i j
i j
divergence computes a divergence-free velocity field.
Divergence-Free Solver If we solve the PPE with velocity diver- Algorithm 5: Constant density solver
gence as source term (see Eq. (77)), we can derive the following
equation for the corresponding pressure value pvi of a particle i:
DFSPH Simulation Step Algorithm 6 shows a simulation step
1 Dρi ρ2i with DFSPH and how both solvers are integrated in the time step.
pvi = · , (79)
∆t Dt k ∑ j m j ∇W i j k + ∑ j km j ∇W i j k2
2 Note that the neighborhoods, the particle densities and the factor
| {z } kiDFSPH are computed once at the beginning of the simulation for
kiDFSPH the initial state and then updated once per time step. The algorithm
where the time derivative of the density is determined as first computes predicted velocities by integrating all non-pressure
Dρi accelerations. Then the density deviation is corrected using the con-
= ∑ m j (vi − v j ) · ∇W i j . (80) stant density solver which yields new particle positions. Hence,
Dt j the neighborhoods, the density values and the factors must be up-
Note that this formulation is similar to the pressure computation of dated. After correcting the density deviation the velocity field is
PCISPH (see Eqs. (57) and (58)). But in contrast to PCISPH the typically not divergence-free. This is corrected in the last step by
source term is the velocity divergence and not the density devia- the divergence-free solver which gives us the final velocities. Note
tion. Moreover, DFSPH does not use a global factor kPCI that is that the order of the steps is a bit different than the order of other
determined for a template particle but computes the actual factor solvers but in this way it is guaranteed that the density deviations
kiDFSPH for each particle i in each time step. and the divergence error are both corrected at the end of a time
step. Moreover, in this way we have to update the factor kiDFSPH
Algorithm 4 shows the divergence-free solver. In each iteration
only once per time step but are able to use it twice: for the constant
first the divergence is updated for all particles. Then the pressure
density solver and for the divergence-free solver.
values are determined and the predicted velocity is updated accord-
ingly. DFSPH solves two PPEs which is more expensive than solving
1: for all particles i do solver, they are more simple to handle than EOS solvers. In an EOS
nonp
2: compute non-pressure accelerations ai solver, the stiffness constant has to be found to realize a desired
3: adapt time step size ∆t according to CFL condition density deviation and the time step has to be found to get a stable
4: for all particles i do simulation. In a PPE solver, the desired density deviation is ex-
nonp
5: predict velocity v∗i = vi + ∆tai plicitly specified. The time step is also easier to estimate as it is
typically rather larger, corresponding to CFL numbers close to one.
6: correct density error using algorithm 5
7: for all particles i do
8: update position xt+∆t
i = xi + ∆tv∗i 5. Boundary Handling
9: update neighborhoods In order to complete the discretization of a mixed initial-boundary
10: for all particles i do value problem (see Section 2) the boundary of the simulation do-
11: update density ρi main has to be discretized and the corresponding boundary con-
12: update factor kiDFSPH using Eq. (79) ditions must be enforced. In recent years, a wide variety of ap-
13: correct divergence error using algorithm 4 proaches to represent boundary geometries and to enforce bound-
14: for all particles i do ary conditions has been presented. The approaches can be roughly
15: update velocity vt+∆t
i = v∗i categorized into particle-based approaches, e.g., [AIA∗ 12,IAGT10,
BT07, BGPT18, BGI∗ 18, GPB∗ 19], and implicit approaches, e.g.,
Algorithm 6: Simulation step with DFSPH [KB17, HKK07a, HKK07b, BLS12].
The particle based strategy is probably the most popular repre-
sentation type. The main idea is to sample the boundary geometry
just one like PCISPH or IISPH. However, the second solve is not using an additional set of so-called boundary particles equipped
that expensive since the costly computation of the factor kiDFSPH has with a (sometimes specialized) kernel function. The advantages
to be performed only once per step. Experiments have shown that here are that the representation is consistent with the discretiza-
solving both PPEs leads to a better stability which enables larger tion of the fluid or solid. Modeling, either explicit/implicit bound-
time steps and therefore a faster simulation [BK17]. The perfor- ary forces for weak satisfaction of boundary conditions or algo-
mance can be further improved by using a warm start. More details rithms to strongly satisfy the constraints is probably more straight-
about this can be found in [BK17]. forward than using implicit or mesh-based techniques. Most meth-
ods, however, have the constraint that the particle size used to sam-
4.11. The Best Pressure Solver ple the boundary has to be the same as the particle size of the con-
tinuum discretization. The disadvantages are that even the repre-
Iterative PPE solvers are more expensive to compute than EOS
sentation of simple geometries, such as a plane, requires a large
solvers. Their utility, however, is motivated by the fact that PPE
number of boundary particles that have to be accounted for dur-
solvers work with significantly larger time steps compared to EOS
ing the neighborhood search and in the evaluation of field quan-
solvers. Solenthaler and Pajarola [SP09] show an improved overall
tities, e.g., Eq. (11). Moreover, determining "good" samplings is
performance of PCISPH compared to the EOS solver in [BT07].
generally non-trivial. Too sparse samplings might not sufficiently
Ihmsen et al. [ICS∗ 14] show an improved performance of IISPH
cover the surface of the boundary leading to the issue of SPH par-
compared to PCISPH and Bender and Koschier [BK17] show a per-
ticles penetrating the boundary. Too dense samplings lead to an in-
formance gain of DFSPH compared to IISPH. So, DFSPH has the
creased computational effort and to higher memory requirements.
best overall performance of all discussed PPE variants.
Also a somewhat "bumpy" sampling might lead to a bias in the
Although PPE solvers work with big time steps, they do not particle trajectories as the discretized surfaces’ smoothness suffers
reach their best overall performance for the largest possible time from sampling noise leading to unwanted perturbations in the sim-
step as discussed in [ICS∗ 14] and [IOS∗ 14]. Although the number ulation (cf., [KB17]) if no additional considerations are made, such
of neighborhood searches decreases for larger time steps, the solver as proposed by Band et al. [BGPT18].
iterations increase for larger time steps.
Implicit boundaries use an implicit function – typically a signed
The reported performance gains of PPE solvers compared to distance field (SDF) – to represent the boundary geometry. Advan-
EOS solvers have been estimated for so-called complex scenar- tages of this type of approaches are that the boundary representa-
ios. The term complex refers basically to the height of a simulated tion is decoupled from the particle size. As a result, more flexible
fluid body under gravity. The higher the simulated fluid column, data structures, e.g., adaptive octrees with higher-order approxima-
the more complex the scenario, the bigger the performance gain of tions [KDBB17], can be used to memory-efficiently and accurately
a PPE solver. If a scenario is simple, e.g., one layer of fluid particles represent the boundary geometry. This circumstance also avoids
on a planar boundary, EOS solvers are faster. The overall number the problem of noisy boundary samplings, the resulting bias, and
of particles does not necessarily influence the solver performance. unwanted perturbations in the particle trajectories. Typical disad-
An EOS solver is more efficient than a PPE solver for one billion vantages are, that implicit representations do not directly integrate
fluid particles in one layer on a plane, while a PPE solver is more with particle based continuum discretizations. In order to couple
efficient than an EOS solver for one hundred particles on top of both discretization types, special considerations have to be made
each other in one column under gravity. and the corresponding implementation is rather involved.
Independent from whether there is a performance gain of a PPE In the remainder of this section, we will discuss approaches to
Kernel
support
Fluid
particle Fluid
Solid
Solid
particles
Figure 8: Idea of the particle-based boundary handling. The bound- Figure 9: Sample-based boundary representation with several lay-
ary is represented with particles xib . These particles are considered ers. The usage of several boundary layers avoids incomplete neigh-
in the computation of density ρi , pressure pi , and pressure force borhoods for fluid particles xi close to the boundary.
p
Fi of nearby fluid particles xi . If a fluid particle moves closer to
the boundary, its density increases. If a fluid particle is too close,
its density is larger than the rest density, i.e., ρi > ρ0 , which causes 5.1.1. Different Types of Boundary Samplings
p
pressure pi > 0 which in turn causes a pressure force Fi 6= 0 that
accelerates the fluid particle away from boundary particles. Please Several layers with boundary samples of uniform size: If a fluid
note that ib denote boundary neighbors of a fluid particle i. Accord- particle xi is close to a boundary, it generally has fluid neighbors
ingly, i f refer to indices of fluid neighbors of a fluid particle i. xi f and boundary neighbors xib as illustrated in Fig. 9. All these
neighbors contribute to the density computation, i.e.,
ρi = ∑ mi f Wii f + ∑ mib Wiib . (83)
if ib
handle non-penetration of rigid boundaries using particle sampling
approaches. We gradually develop a formulation starting with a All samples xi , xi f , xib have the same size and we take the boundary
simple dense, uniform multilayer sampling of the boundary and samples as static fluid samples resulting in the same rest density ρ0
show how the method can be simplified to a uniform single layer for all fluid and boundary particles. This also means that all masses
sampling and consequently even to a robust and consistent for- are equal: mi = mi f = mib . Thus, the density computation could also
mulation using non-uniformly sampled boundaries. We moreover be written as ρi = mi (∑i f Wii f + ∑ib Wiib ). If the boundary samples
discuss how the fluid-boundary coupling can be improved using belong to a rigid body, it is not perfectly intuitive to represent its
pressure mirroring or pressure extrapolation and how these tech- boundary with particles that have mass and rest density of a fluid
niques can be incorporated into the previously discussed pressure particle. This issue results from the fact that SPH formulations of-
solvers. For implicit or mesh-based boundary handling techniques ten prefer to weight the contribution of a particle i with mρii instead
we would like to refer the reader to the corresponding literature, of using its volume Vi = mρii . Now, in the boundary handling, one ac-
e.g., [KB17, HKK07a, HKK07b, BLS12, MFK∗ 15, FLR∗ 13, FM15] tually works with the volume of boundary particles. Nevertheless,
this volume is often represented with some rest density - typically
the fluid rest density - and the respective mass.
5.1. Particle-based Boundary Handling
If the density ρi in Eq. (83) is larger than the rest density ρ0 , a
In this concept, the boundary is represented with particles and these pressure pi is computed at fluid particles. We have pi can
seen that
boundary particles are incorporated into the computation of density
p be computed from a state equation, e.g., pi = k ρρ0i − 1 or from
ρi , pressure pi , and Fi at nearby fluid particles xi . This is illustrated
in Fig. 8. There are two main aspects to discuss. First: The bound- solving a PPE.
ary can be sampled in different ways. E.g., , the boundary can be Now, the pressure force at the fluid particle can be computed as
sampled with particles of uniform size corresponding to the size of !
a fluid particle. Or the boundary can be sampled with particles of p pi pi f
F i = − mi mi ∑ + ∇W ii f
non-uniform size. Also, the boundary can be sampled with several if ρ2i ρ2i f
layers of boundary particles as indicated in Fig. 8 or the boundary !
can be sampled with just one layer of particles. The second aspect pi pib
− mi mi ∑ + 2 ∇W iib . (84)
is the actual computation of density ρi , pressure pi , and pressure ib ρ2i ρib
p
force Fi of nearby fluid particles xi . Such computations require in-
It can be seen in Eq. (84) that we basically compute a pressure
formation from boundary samples, e.g., pressure. Such pressure at
force component with respect to fluid neighbors and a pressure
boundary samples can be estimated in different ways. Here, typical
force component with respect to boundary neighbors. Using sev-
examples are pressure mirroring, i.e., it is assumed that the pres-
eral layers of boundary particles guarantees that the neighborhood
sure at the boundary particles equals the pressure at adjacent fluid
of a fluid particle is completely sampled, even if this particle is very
particles. Alternatively, pressure can be extrapolated from the fluid
close to the boundary. Fully filled neighborhoods keep the errors
into the boundary. While the pressure extrapolation is theoretically
due to missing samples in Eqs. (83) and (84) small.
the correct choice, this concept is challenging to realize due to the
fact that the computation of the pressure gradient at a fluid particle The computation in Eq. (84) requires positions, densities and
close to the boundary is error-prone. In the following, we discuss pressures of adjacent fluid and boundary particles. While these
different combinations of the aforementioned variants. quantities are known for fluid particles, density and pressure at
Fluid
Solid
Missing
samples
1
Vi − ∑i f Wii f
γ1 = . (89) Figure 12: The boundary geometry is sampled with one layer of
∑ib Wiib
particles of non-uniform size. The sampling should be sufficiently
The corrected density computation is the basis for the pressure dense, i.e., each boundary particle should be equal or smaller than
computation which is typically not affected by missing boundary a fluid particle. Otherwise, leakage could occur.
samples. A state equation just works with the density of the fluid
particle itself. A PPE typically uses the densities of adjacent fluid
particles. So, boundary samples are not required in the pressure
computation.
In the subsequent computation of the pressure forces, however,
the missing samples have to be accounted for. Similar to the density
Arbitrary sampling with
computation, a correcting coefficient γ2 is introduced: missing samples
!
p pi pi f 2m2
Fi = −mi mi ∑ 2
+ 2 ∇W ii f − γ2 pi 2i ∑ ∇W iib . (90)
ρi ρi f ρ i ib Perfect sampling Perfect sampling with
if missing samples
fluid particle using Eq. 93. The pressure force is now computed Recent viscosity solvers either use a strain rate based formulation
with to compute viscous forces or they directly determine the Laplacian
pi f
! of the velocity field. While the Laplacian formulation ensures that
p pi 2m
Fi = −mi mi ∑ 2
+ 2 ∇W ii f − γ2 pi 2 i ∑ mib ∇W iib , the right term of the strain rate tensor vanishes by definition, ap-
if ρ i ρ if ρi ib proaches based on the strain rate have to enforce a divergence-free
(95) velocity field, otherwise ∇ · (∇v)T 6= 0 which leads to undesired
which is very similar to the pressure force for uniform samples. The bulk viscosity [Lau11,PICT15]. In the following we introduce both
only difference is the consideration of the individual masses mib of approaches and discuss the advantages and disadvantages.
the boundary particles instead of the standard mass mi for samples
of uniform size. The correcting factor γ2 is 6.2. Explicit Viscosity
∑i f ∇W ii f · ∑ib ∇W iib In the Navier-Stokes equations for incompressible fluids the vis-
γ2 = . (96)
∑ib ∇W iib · ∑ib ∇W iib cous force is defined by the Laplacian of the velocity field (see
Eq. (100)). The standard SPH discretization of this Laplacian is de-
The same factor has already been used, motivated, and derived in
termined as
the case of a one-layer boundary with uniform samples. mj
∇2 vi = ∑ v j ∇2W i j . (101)
j ρ j
6. Viscosity
However, this formulation has two major disadvantages. First, it
Modeling and simulating viscosity is often vital for physics simula- is sensitive to particle disorder [Mon05, Pri12]. Second, typically
tions as the phenomenon is responsible for various visually appeal- Gaussian-like kernel functions are used in SPH and their second
ing effects, such as buckling and coiling but also general energy derivatives changes the sign inside the support radius (see Fig. 2).
dissipation. In recent years, various methods for the realistic sim-
ulation of low viscous fluids like water as well as highly viscous Different approaches were proposed to avoid this problem. First,
fluids like honey, mud, or dough were proposed. Fig. 14 shows dif- instead of computing the second derivative directly, it can also be
ferent examples of highly viscous materials. determined taking two first SPH derivatives [FMH∗ 94, WBF∗ 96,
TDF∗ 15]. However, this method increases the computation time
In this section we first introduce the term for the viscous force in and memory consumption and introduces additional smoothing.
the Navier-Stokes equations. Then we discuss important methods Another approach, which was introduced by Brookshaw [Bro85],
for the simulation of low viscous flow and highly viscous materials. is to determine one derivative using SPH and the second one using
We present explicit approaches which are typically used for low finite differences. This method is very popular and has been used
viscous fluids and we discuss implicit methods for highly viscous for scalar quantities [Mon92, CM99, IOS∗ 14] and for vector quan-
materials. tities [ER03, JSD04, Mon05, Pri12, WKBB18]. In the following we
will discuss this approach in more detail.
6.1. Viscous Force In order to approximate the Laplacian of the velocity field we
combine an SPH derivative with a finite difference derivative which
In the Navier-Stokes equations for incompressible fluids, the vis-
yields the following equation [Mon05]:
cosity term is determined by a material parameter µ and the Lapla-
cian of the velocity field ∇2 v (see Eq. (32)). Before we discuss mj vi j · xi j
∇2 vi = 2(d + 2) ∑ 2 + 0.01h2
∇W i j , (102)
different approaches to compute this viscosity term, we first want j ρ j kx i j k
to show how this term is derived.
where xi j = xi − x j , vi j = vi − v j and d is the number of spatial
The stress tensor of a Newtonian fluid is defined as dimensions. Note that a term 0.01h2 is introduced in the denom-
T = −p1 + 2µE, (97) inator to avoid singularities. The approximation of the Laplacian
in Eq. (102) has some nice features. First, it is Galilean invariant.
where E is the strain rate tensor which is determined as Moreover, it vanishes for rigid body rotation. This is an important
1 property since there is no friction if all particles rotate uniformly.
E = (∇v + (∇v)T ). (98)
2 Finally, the introduced formulation conserves linear and angular
When substituting the stress tensor in the conservation law of lin- momentum [Mon92].
ear momentum (see Eq. (30)) and considering the incompressibility Instead of computing the Laplacian of the velocity field in or-
constraint ∇ · v = 0 (see Eq. (28)), we end up with the Navier- der to simulate viscosity, in some works XSPH is used as artificial
Stokes equations viscosity model (e.g., [SB12]). XSPH determines the smoothed ve-
Dv locity v̂i of a particle i as
ρ = −∇p + µ ∇ · ∇v} +µ ∇ · (∇v)T +fext , (99)
Dt | {z mj
v̂i = vi + α ∑ (v j − vi )Wi j , (103)
| {z }
∇2 v ∇(∇·v)=0
j ρj
where the right term of the strain rate tensor vanishes and the final
where 0 ≤ α < 1 is a user-defined parameter. The core idea of
viscosity force is determined as
smoothing the velocity field in this way is to reduce the particle dis-
fvisco = µ∇2 v. (100) order by reducing the velocity difference between a particle and its
Figure 14: Different examples for the simulation of viscous behavior. Left: The simulation of highly viscous fluids enables realistic buckling
effects [WKBB18]. Center: A viscous dough interacts with a fast moving solid [PICT15]. Right: A melting Eiffel tower is simulated (the
model is courtesy of Pranav Panchal) [PT16].
neighborhood. The advantage of this formulation is that no kernel Peer et al. [PICT15, PT16] Instead of using a classical implicit
derivative is required. The disadvantage is that α is not physically time integration scheme, Peer et al. propose to decompose and
meaningful. modify the velocity gradient ∇v. The goal of the authors is to
modify only the shear rate in order to simulate a viscous behav-
ior. Hence, they exploit the fact that the velocity gradient can be
6.3. Implicit Viscosity
decomposed as
Simulating the behavior of highly viscous materials implies that the
viscosity coefficient is large. However, in this case explicit viscos- ∇v = R + V + S, (106)
ity solvers tend to get unstable. Therefore, it is recommended to use 1 T 1
where R = 2 (∇v − (∇v) ) is the spin rate tensor, V = 3 (∇ · v)1
an implicit method in order to simulate highly viscous fluids. In this the expansion rate tensor and S = E − V the traceless shear rate
subsection we introduce some of the most important implicit vis- tensor. This decomposition enables to modify the traceless shear
cosity solvers [TDF∗ 15,PICT15,PT16,WKBB18]. We first present rate tensor without influencing the other components of the velocity
the concepts of these solvers in chronological order and then com- gradient. Therefore, the authors define a target velocity gradient
pare the different approaches.
∇vtarget = R + V + ξS (107)
∗
Takahashi et al. [TDF 15] As discussed in the previous subsec- which reduces the shear rate by a user-defined factor 0 ≤ ξ ≤ 1.
tion, one way to compute the second derivative of the velocity field This modified velocity gradient can be used to determine new par-
is to take two first SPH derivatives. This approach is used by Taka- ticle velocities by a Taylor approximation of first order
hashi et al. to formulate an implicit integration scheme for the vis- target target !
cosity term in the Navier-Stokes equations. The implicit integration 1 ∇vi + ∇v j
vi (t + ∆t) = ∑ m j v j (t + ∆t) + xi j Wi j .
enables a stable simulation of highly viscous fluids. In each simula- ρi j 2
tion step Takahashi et al. first determine the strain rate Ei for each (108)
particle i using Eq. (98). Following the Navier-Stokes equations This yields a linear system Av(t + ∆t) = b, where the matrix entries
(see Eq. (99)) the authors then compute the divergence of the strain and the right hand side vector are defined as
rate as
! Ai j = −m jWi j , (109)
T
2Ei 2E j
∇ · ∇vi + (∇vi ) = ∑ m j + 2 ∇W i j . (104) Aii = ρi − miWii , (110)
j ρ2i ρj target target
∇vi + ∇v j
Using this formulation the implicit integration scheme can be de- bi = ∑ m j xi jWi j . (111)
j 2
rived as
This system can be decomposed to get three smaller linear sys-
v(t + ∆t) = v∗ + µ∇ · ∇v(t + ∆t) + (∇v(t + ∆t))T , (105)
∆t
ρ tems for the x-, y- and z-component of the velocity. Finally, the
authors propose to solve the three systems using a conjugate gradi-
where v∗ is the predicted velocity which is determined by integrat-
ent method.
ing all non-pressure forces except viscosity. Takahashi et al. substi-
tute Eq. (104) in Eq. (105) and solve the resulting formula to get Later, Peer and Teschner [PT16] extended this method by sim-
the new velocities of the particles. The advantage of this implicit ulating vorticity diffusion in order to improve the rotational mo-
scheme is that highly viscous fluids can be simulated in a stable tion. The diffusion process in a viscous fluid is described by Dω
Dt =
way while the viscosity is independent of the temporal and spatial ν∇2 ω. The authors determine ω = (ωx , ωy , ωz )T from the spin rate
resolution. However, in this formulation all second-ring neighbors tensor as
of a particle have to be considered in order to compute one first-
order SPH derivative after the other. This leads to many non-zero 0 −ωz ωy
1
R = ωz −ωx . (112)
elements in the system matrix which decreases the performance 0
2
significantly. −ωy ωx 0
Bender and Koschier [BK17] The authors of this work also should be E = 0 since a rotation is a rigid body motion which does
reduce the strain rate by introducing a user-defined coefficient not deform the body. However, when using the SPH discretiza-
which is similar to the core idea of Peer et al. However, instead tion in Eq. (116), the strain rate is not zero at the free surface (see
of modifying the velocity gradient and reconstructing the veloc- Fig. 15, right). In this experiment we can observe a significant error
ity field, Bender and Koschier define a velocity constraint function at the boundary. The main problem is that the viscosity solver tries
Ci (v) = Ei − γEi with the user-defined coefficient 0 ≤ γ ≤ 1. The to counteract this erroneous strain rate which leads to ghost forces.
constraint is defined as six-dimensional vector function where the These forces causes severe visual artifacts and a loss of angular
vector contains the elements of the upper triangular part of the sym- momentum which is discussed later in more detail.
metric strain rate tensor. Finally, the constraint is enforced by first
solving the linear system To solve this problem, Weiler et al. developed an implicit viscos-
T T ! ity solver which directly determines the Laplacian of the velocity
1 ∂Ei ∂Ei 1 ∂Ei ∂Ei field instead of using the strain rate. Their approach is based on the
+∑ µi = Ei − γEi (114)
ρi ∂vi ∂vi j ρi ∂v j ∂v j implicit integration scheme
for the Lagrange multiplier µ by Jacobi iterations. The final veloci- v(t + ∆t) = v∗ +
∆t
µ∇2 v(t + ∆t). (117)
ties are then determined as ρ
m j ∂E j T
T !
1 mi ∂Ei This is similar to the one of Takahashi et al. [TDF∗ 15] but uses the
∗
vi (t + ∆t) = vi + µi + ∑ µj .
mi ρi ∂vi j ρj ∂vi Laplacian of the velocity field instead of the divergence of the strain
(115) rate. To compute the Laplacian, the approximation in Eq. (102) is
Details about the computation of ∂E/∂v can be found in [BK17]. used. Since this approximation vanishes for rigid body rotations
and conserves linear and angular momentum [Mon92], the pro-
The advantage of solving a constraint function instead of us- posed approach solves the problems of the methods above.
ing the velocity field reconstruction approach of Peer et al. is that
also low viscous fluids can be simulated. The disadvantages of the Eq. (117) is a linear system which has to be solved to get the
method are that solving six-dimensional constraints using Jacobi it- unknown new velocities v(t + ∆t). Using the SPH discretization of
erations is computationally expensive and the introduced viscosity the Laplacian in Eq. (102), we can rewrite this linear system as
coefficient depends on the temporal and spatial resolution. (1 − ∆tA)v(t + ∆t) = v∗ , (118)
Weiler et al. [WKBB18] All implicit viscosity methods intro- where the matrix A contains a 3 × 3 block Ai j for each pair of
duced so far, use a formulation based on the strain rate tensor E. neighboring particles i and j:
The strain rate is determined by Eq. (98), where the velocity gra-
µ mi j ∇W i j xTij
dient ∇v is computed using the following SPH discretization (see Ai j = −2(d + 2) , Aii = − ∑ Ai j . (119)
Section 2.5): ρi ρ j xi j 2 + 0.01h2 j
initial guess of v∗ + ∆v using the velocity difference of the last step An implicit viscosity solver is recommended for the simula-
∆v = v(t) − v∗ (t − ∆t) further improves the performance. tion of highly viscous fluids due to stability reasons. As discussed
above, the implicit strain rate based formulations suffer from an er-
Weiler et al. propose to extend this viscosity formulation also
ror in the SPH approximation that causes visual artifacts and leads
for the boundary in order to simulate materials that stick to solid
to a loss of angular momentum. The method of Weiler et al. avoids
objects. In SPH often a particle-based surface representation of the
the problem and therefore generates more realistic results. Finally,
boundary is used. For such a surface representation the diagonal
we think that it would be an interesting open problem for future re-
matrix blocks in Eq. (119) and the right hand side of the system in
search to find a better SPH approximation of the strain rate without
Eq. (118) have to be adapted as
problems at the free surface. Such an approximation would solve
µb mk ∇W ik xTik the problems of the strain rate based formulations.
Aii = − ∑ Ai j + 2(d + 2) ∑ 2 2
, (120)
2
j k ρi kxik k + 0.01h Note that all viscosity methods that were discussed in this
µ m vk · xik section are implemented in our open-source framework SPlisH-
bi = v∗i − 2(d + 2)∆t ∑ b 2 k 2
∇W ik , (121)
k ρi kxik k + 0.01h
2 SPlasH [Ben19b].
For the simulation of low viscous fluids an explicit viscosity for- where α is a coefficient to control the surface tension of the fluid.
mulation should be used since explicit methods are computation- This equation interpolates the position differences in the neighbor-
ally less expensive. We recommend to compute the viscous force hood of a particle i and computes an acceleration to attract the
in Eq. (100) by approximating the Laplacian of the velocity field neighboring particles. Note that adhesion can also be simulated by
using Eq. (102). An alternative, which is computationally less ex- Eq. (122) when using a sum over all neighboring boundary parti-
pensive but also less accurate, is to use XSPH as artificial viscosity. cles.
(a) Takahashi et al. [TDF∗ 15] (b) Peer & Teschner [PT16] (c) Bender & Koschier [BK17] (d) Weiler et al. [WKBB18]
Figure 16: The SPH approximation of the strain rate tensor is erroneous at the free surface due to particle deficiency which leads to artifacts
(a,b,c). The formulation of Weiler et al. avoids this strain rate computation by using the Laplacian of the velocity field which solves this
problem (d) [WKBB18].
(a) Takahashi et al. [TDF∗ 15] (b) Peer & Teschner [PT16] (c) Bender & Koschier [BK17] (d) Weiler et al. [WKBB18]
Figure 17: When simulating the rope coiling effect with the introduced implicit viscosity solvers, we can observe a loss of angular momentum
caused by errors in the SPH strain rate approximation (a,b,c). Using a formulation based on the Laplacian of the velocity field instead, solves
this problem and enables a uniform coiling (d) [WKBB18].
Figure 18: Different surface tension effects are realized by approximating intermolecular attractive forces in the fluid [AAT13].
where β is the adhesion coefficient and k denotes a neighboring 1. The vorticity ωi for each particle i is computed using a discrete
boundary particle. The computation of the mass mk of a boundary curl operator, e.g.,
particle is described in detail in Section 5. Akinci et al. propose to mj
use another specialized kernel function for the computation of the ωi = ∇ × vi = − ∑ vi j × ∇iWi j . (131)
j ρj
adhesion forces which is defined as
2. A corrective force is computed and applied that amplifies the
q
4 − 4r2 + 6r − 2h 2r > h ∧ r ≤ h
0.007 h already existing vortical motion, i.e.,
W adhesion (r) = 3.25
h 0 otherwise. η
vorticity
Fi = εvorticity ( × ωi ) (132)
(129) kηk
Note that only fluid particles with a distance between h/2 and h are mj
attracted by the boundary. η=∑ kω j k∇iWi j , (133)
j ρj
8. Vorticity where εvorticity denotes a small constant used to steer the amount
of amplification.
One of the most visually appealing phenomena in dynamic fluids 3. The velocity field is smoothed using XSPH (see Eq. (103)) in
is the evolution of chaotic structures due to turbulences. Turbulent order to enforce a coherent particle motion.
motions are largely caused by the interaction of many unsteady vor-
tices on various scales. A vortex is, moreover, defined as a local Algorithmically, this correction is applied just before the advection
spinning motion in the fluid – mathematically spoken the vorticity of the SPH particle positions.
is a vector field
While this approach is very simple and effectively amplifies ex-
ω = ∇×v. (130) isting vortices it has some drawbacks. It is hard to choose the
control parameter εvorticity such that overamplification is avoided.
In SPH fluid simulations turbulent details quickly get lost due Moreover, the method can, in the best case, only conserve existing
to numerical diffusion [dGWH∗ 15] or due to coarse sampling of vortices but does not facilitate the formation of new ones.
the velocity field [IOS∗ 14, CIPT14] which negatively influences
the visual liveliness of the flow. In order to facilitate the forma-
tion of vortices in the simulation and to counteract numerical dif- 8.2. Micropolar Model
fusion, a range of approaches has been proposed in the past. Most The most prominent mathematical model describing the dynam-
of these approaches originate from research concerning Eulerian, ics of Newtonian fluids is the Navier-Stokes model. As described
grid-based discretizations and can roughly be categorized into vor- in Section 2 the model can be derived from the conservation law
ticity confinement techniques, Lagrangian vortex methods, fluid of linear momentum (see Eq. (30)) and by presuming that the me-
up-sampling, and more recently micropolar models. In this section chanical stress is composed of isotropic pressure and a diffusing
we will discuss a simple vorticity confinement approach following viscous term. An important assumption of the model is that the in-
Macklin and Müller [MM13] and an SPH discretization of a mi- finitesimally small particles which compose a fluid continuum are
cropolar model that facilitates the formation of vortices as proposed not subject to rotational motion. This also implies that the law of
by Bender et al. [BKKW18]. angular momentum conservation is identically fulfilled if and only
if the stress tensor is symmetric.
8.1. Vorticity Confinement In this section we introduce the concept of micropolar fluids and
As already discussed, SPH discretizations tend to overly dissipate present a material model that generalizes the Navier-Stokes equa-
energy in turbulent flow. Therefore, Macklin and Müller [MM13] tions for the simulation of incompressible, inviscid turbulent flow
employ a method based on vorticity confinement in order to coun- as proposed by Bender at al. [BKKW18]. Following the defini-
teract the dissipation by amplifying existing vortices. The tech- tion of Łukaszewicz [Łuk99], a micropolar fluid follows constitu-
nique consists of three steps: tive laws modeled using a generally non-symmetric stress tensor.
Moreover, the definition includes that the fluid consists of rigid, and by applying the incompressibility condition (28), we arrive at
spherical (and therefore rotationally invariant) particles. Based on the following representation:
the non-symmetric stress measures, the micropolar model addition- Dv 1 fext
ally models rotating motions of the infinitesimal spherical parti- = − ∇p + νt ∇ × ω + (136)
Dt ρ ρ
cles using an angular velocity field. Due to the additional rotational
Dω τ
degrees of freedom, the generation of vortices is facilitated and a Θ = νt (∇ × v − 2ω) + , (137)
wider range of potential dynamic effects are captured by the model. Dt ρ
Please note, that for this section we will neglect any dissipation where νt denotes the kinematic transfer coefficient. Looking at
terms, such as viscosity, as the main goal is to generate undamped, Eq. (136), we quickly notice that it is identical to the inviscid
highly turbulent flows. For the complete model, we would like to Navier-Stokes equation (Euler equation) but augmented by the term
kindly refer the reader to the original paper [BKKW18]. νt ∇ × ω. A complementary term also governed by the transfer co-
efficient resides in Eq. (137), i.e., νt (∇ × v − 2ω). The terms ef-
Balance Law for Angular Momentum Conservation fectively convert angular accelerations into linear accelerations and
vice versa. Physically, they can be interpreted as dissipation-free
Similar to the conservation law of linear momentum (see Eq. (30)) friction or as a dissipation-free viscosity coupling linear and rota-
a balance law for angular momentum can be derived, i.e., tional motion.
Dω In order to realize the model in the implementation, it is required
ρΘ = T× + τ , (134)
Dt to discretize Eqs. (136) and (137). This means that additional to a
with [T× ]i = ∑ j ∑k εi jk T jk , where εi jk and τ denote the Levi-Civita discrete representation of x and v it is necessary to discretize the
tensor and external body torque. Further, Θ represents a scalar, vorticity ω. Please note, that due to the assumption in the micropo-
isotropic microinertia coefficient. A physical interpretation for this lar model, that the microstructure of the material particles is spher-
quantity is that each infinitesimal fluid particle has a certain inertial ical we do not have to discretize and track the rotational field (only
resistance against rotational accelerations. Bender et al. suggest to the angular velocity field) which makes the implementation less
choose Θ = 2m2 s−1 based on experimentation. We would further complicated and delivers better performance. The transfer forces
like to stress the fact that Θ is not at all related to the spatial extents and torques can then, following the splitting approach, simply be
of an SPH particle as it is defined in the continuous setting. applied in line with the non-pressure forces and integrated explic-
itly as they are considerably less stiff than the pressure forces. It is
further advised to "filter" the resulting velocity field using XSPH
Constitutive Model
(see Eq. (103)) in order to ensure coherent particle motion. Algo-
It is essential to understand that the classical model actually also re- rithm 7 shows an exemplary pseudocode of the resulting method.
spects angular momentum conservation (see Eq. (134)). It is in this
context, however, rarely explicitly mentioned as the balance law is for all particle i do
usually identically fulfilled based on two assumptions. Firstly, the Find neighbors
classical approach does not model external torques, i.e., τ ≡ 0. Sec- for all particle i do
ondly, stress tensor T is usually chosen as a symmetric tensor and Compute density ρi
such that T× ≡ 0 and, hence, Dω Dt ≡ 0. For this reason, the balance for all particle i do
law of angular momentum is not particularly useful for symmetric Compute non-pressure forces Fi
non-pressure
stress measures. transfer
Compute transfer forces Fi = mi νt ∇ × ωi
In order to account for the microstructured particles and to utilize Compute transfer torque τtransfer
i = mi νt (∇ × vi − 2ωi )
the balance law of angular momentum, Bender et al. propose to use Compute time step size ∆t according to CFL
the following constitutive relation: for all particle i do
non-pressure
v∗i = vi + m
∆t
(Fi + Ftransfer + Fext
i )
T = −p1 − µt ∇v + µt ω× , (135) i i
× for all particle i do
with ω = ∑i ε jik ωi , where µt denotes the "transfer coefficient". Enforce incompressibility using pressure solver
We will later discuss a physical interpretation of the term in the Update v∗i
final PDE that is controlled using µt . In order to ensure consistency
for all particle i do
with the second law of thermodynamics µt ≥ 0 must be satisfied.
vi (t + ∆t) = v∗i
Please note that this constitutive model allows for a non-symmetric
xi (t + ∆t) = xi + ∆tvi (t + ∆t)
stress resulting in the fact that we have to explicitly account for the
ωi (t + ∆t) = ωi (t) + m∆t (τtransfer
i + τext
i )
angular balance law in our simulation. i Θi
Figure 21: Velocity fields of the lid-driven cavity benchmark. Standard SPH (left) and vorticity confinement (middle) are only able to
produce one large central vortex. In contrast, the micropolar approach yields (right) the expected result, i.e., one central vortex and three
smaller vortices in the corners which are rotating in the opposite direction.
Similar derivations can be found in [TM05, HA06]. The viscosity requires higher-order time stepping schemes and careful consider-
force (and other force terms) can be derived analogously and is ations of time step sizes to avoid accumulation of integration errors
given as over time and thus drift from true mass conservation [SP08, SB12].
The density summation equation was also used in combination with
1 µi + µ j 1
Fvi = ∑ (v j − vi )∇2Wi j . (141) the Shepard kernel to accurately preserve the discontinuity at the
δi j 2 δj interface [GAC∗ 09]. The method considers the volume distribution
and the rate of change of the volume estimated by the continuity
Note that the above equations are identical to the standard SPH equation.
equations when applied to a single phase flow. For multiple flu-
ids, however, the adapted method eliminates any spurious tension 9.2. Complex Mixing Phenomena
effects and notably increases stability. The method has been ex-
tended with an incompressibility condition and solid-fluid cou- Fluid mixing can be simulated by solving the diffusion equation
pling [AIA∗ 12, GPB∗ 19], an example is shown in Fig. 22. More-
∂C
∂t
= α∇2C, which evolves the concentration C over time. With
over, the resolution at the interface has been increased using the SPH, this equation can be written as [MSKG05]
two-scale (or multi-scale) particle simulation method in [SG11, ∂Ci C j −Ci 2
HS13]. = α∑mj ∇ Wi j , (142)
∂t j ρj
The above described problems can be circumvented by replac-
where α defines the diffusion strength. Another SPH formulation
ing the summation density by the continuity equation that evolves
for computing the diffusion has been presented in [LLP11].
the density over time (Section 2.4) and hence does not suffer from
smoothing artifacts across fluid interfaces. However, this typically More complex mixing effects can be simulated by taking the
flow motion and force distributions into account as demonstrated The deformation of a solid is defined by the function
in the SPH-based mixture model of Ren et al. [RLY∗ 14]. The con-
tinuity equation of the mixture model is defined as Φ(X) = X + u = x (145)
Dρm ∂ρm which maps a point X in the reference configuration to its current
= + ∇ · (ρm vm ) = 0, (143) position x in the deformed configuration, where u = x − X is the
Dt ∂t
displacement vector. Differentiating this function with respect to
where ρm is the rest density of the mixture and vm is the mixture
the reference position X gives us the deformation gradient
velocity, averaged over all phases. ρm and vm are computed using
the volume fraction αk of a phase k with rest density ρk , i.e., ρm = ∂Φ(X) ∂x ∂u
J= = = 1+ . (146)
∑k αk ρk and vm = ρm ∑k 1αk ρk vk . The momentum equation for the ∂X ∂X ∂X
mixture is given as
This quantity can be used to measure the strain of a deformed body.
D(ρm , vm ) In computer graphics often a linear strain measure is used to avoid
= −∇p + ∇ · (τm + τDm ) + ρm g, (144)
Dt the solution of a non-linear system of equations. For the same rea-
where τm and τDm are the mixture’s viscous stress and diffusion son we introduce the linear infinitesimal strain tensor
tensors, respectively. 1
ε(J) = (J + JT ) − 1. (147)
2
In each simulation step, the drift velocity vmk = vk − vm is com-
puted, which represents the relative velocity of phase k to the mix- The next step is to define a constitutive model for linear elastic-
ture. The equation can be rewritten using individual terms for slip ity. We follow the work of Sifakis [Sif12] and define it in terms of
velocity due to body forces, pressure effects that cause fluid phases the strain energy density:
to move from high to low pressure regions, and a Brownian diffu-
sion term that represents phase drifting from high to low concentra- λ
Ψ(J) = µε : ε + tr2 (ε), (148)
tion regions. The drift velocity is then used to calculate the diffu- 2
sion tensor τDm and change in volume fraction Dαk /Dt. The SPH where µ and λ are the Lamé coefficients [Sif12]. The first Pi-
equations for the mixture model described above can be found in ola–Kirchhoff stress tensor is determined by differentiating the
the work of Ren et al. [RLY∗ 14]. They demonstrate complex mix- strain energy density with respect to the deformation gradient
ing effects including chemical reactions. The model uses WCSPH,
since a divergence-free velocity field cannot be directly integrated ∂Ψ
P(J) = . (149)
since neither the mixture nor phase velocities are zero, even if the ∂J
material is incompressible. For our linear elasticity model this yields
Yan et al. [YJL∗ 16] extended the mixture model to handle the in- P(J) = 2µε + λtr(ε)1. (150)
teraction between fluid and solid phases, and demonstrated various
effects including dissolution of solids, flows in porous media, and Note that the Lamé coefficients can be computed from Young’s
interaction with elastic materials. Another extension has been pre- modulus k and Poisson’s ratio ν by
sented by Yang et al. [YCR∗ 15] where an energy-based model was
k kν
used. The approach integrates the Cahn-Hilliard equation that de- µ= , λ= . (151)
scribes phase separation, expanding the capability of a multi-fluid 2(1 + ν) (1 + ν)(1 − 2ν)
solver and enabling incompressible flows. This is often more intuitive since Young’s modulus is a measure
of stretch resistance while Poisson ratio is a measure of incom-
pressibility. Finally, the elastic body forces are determined as the
10. Deformable Solids divergence of the stress tensor
The simulation of deformable solids is an active research topic in
f = ∇ · P. (152)
computer graphics. The most popular simulation approaches in this
area, like the finite element method (FEM) [KBT17, KKB18] and
Position-Based Dynamics (PBD) [BKCW14, BMM14, BMM17], In the following subsection we will discuss how this continuous
are mesh-based. However, also meshless methods were investigated elastic material model can be discretized using the SPH formula-
like the moving least squares (MLS) method [AW09]. In this sec- tion.
tion we show that SPH is also an interesting meshless method to
simulate deformable solids. An advantage of an SPH-based simu-
lation of deformables is that this enables a simple coupling between 10.2. SPH Discretization
fluids and solids in a unified framework. The deformation of an elastic body is determined with respect to its
reference configuration (see Eq. (145)). Typically the initial shape
of a body is used as reference configuration in an SPH simulation.
10.1. Linear Elasticity
Since the topology of an elastic body does not change during the
In this subsection we first introduce a continuum mechanical for- simulation, we store the neighborhood of each particle i in the ref-
mulation for linear elasticity. In the next subsection we then show erence configuration. In the following this reference neighborhood
how to discretize the resulting equations using SPH. is denoted by Ni0 .
Figure 23: Deformable solids simulated using an SPH formulation [PGBT17]. Left: An elastic bunny model is hit by a rigid capsule. Right:
A deformable hairball interacts with water.
Deformation Gradient A straightforward SPH discretization of The deformation gradient is used to compute the linear infinites-
the deformation gradient is given by imal strain tensor by Eq. (147). Note that we use a linear strain
T measure since in an implicit formulation it is more efficient to
Ji (x, X) = ∑ V j0 x ji ∇W Xi j , (153) solve a linear system than a non-linear one. However, the linear
j∈Ni0
strain tensor is not invariant under rotations. In computer graphics
where x ji = x j − xi and Xi j = Xi − X j . Since this SPH approxima- a common solution for this problem is to use a corotational ap-
tion is determined in the reference configuration, the rest volume proach [BIT09, KKB18]. The core idea of this approach is to ex-
V j0 has to be used in the sum. However, this formulation fails to tract the rotation and to compute the strain measure in an unrotated
capture rotational motion since it is not first-order consistent (see frame. In the following we will show how the rotation can be ex-
Section 2.3). tracted and introduce the computation of a corotated deformation
gradient.
Kernel Gradient Correction Bonet and Lok [BL99] have shown
that the gradient of the kernel has to fulfill the following condition The deformation gradient computed with the corrected kernel
to ensure that the computation is first-order consistent and therefore gradient (see Eq. (157)) is able to capture the rotation correctly.
correctly captures rotational motion: Hence, the per-particle rotation Ri can be directly extracted from
T Ji , e.g., by using the efficient and stable method of Müller et
∑ V j0 X ji ∇W Xi j = 1. (154) al. [MBCM16].
j∈Ni0
The extracted rotation matrix R is used to rotate the reference
Now we can formulate a corrected kernel gradient which satisfies
configuration so that the resulting displacement vector u = x − RX
the condition by construction:
contains no rotation. Since we rotate the reference configuration,
˜ i Xi j = Li ∇W Xi j ,
∇W (155) we also have to rotate the corrected kernel gradient as it depends
on the reference positions. This yields the rotated corrected kernel
where Li is a correction matrix that is defined as
−1 gradient
T ∗
0
Li = ∑ V j ∇W Xi j Xi j . (156) ∇W i Xi j = Ri Li ∇W Xi j . (158)
j∈Ni0
Putting all together gives us the corotated deformation gradient
Note that this correction matrix only depends on the rest volume
∗ T
and the particle positions in the reference configuration. Therefore, J∗i (x, X) = 1 + ∑ V j0 x ji − Ri X ji ∇W i Xi j . (159)
this matrix is precomputed at the beginning of the simulation. If the j∈Ni0
matrix in Eq. (156) is singular and cannot be inverted, e.g., due to
a collinear or coplanar particle configuration, the Moore–Penrose Now we compute the strain tensor ε(J∗ ) using Eq. (147) and the
inverse is used instead. stress tensor P(J∗ ) using Eq. (150). Finally, the force is determined
as the divergence of the stress tensor. In our SPH formulation this
Corotated Approach Using the corrected kernel gradient we get
yields [Gan15]:
a first-order consistent SPH formulation for the deformation gradi-
∗ ∗
ent:
Fi J∗ = ∑ Vi0V j0 Pi J∗i ∇W i Xi j − P j J∗j ∇W j Xi j .
T
Ji (x, X) = ∑ V j0 x ji ∇W
˜ Xi j . (157) j∈Ni0
j∈Ni0 (160)
Figure 25: The SPH-based rigid body solver enables a strong two-way coupling between fluids and rigid bodies. In this scenario 43.8M fluid
particles interact with 50M static and 2.3M dynamic rigid body particles. Up to 90k simultaneous rigid-rigid contacts were resolved.
Figure 26: Two creatures run in highly viscous mud, break through a wall of rigid bodies and collide with a deformable tree. This complex
simulation shows the power of a unified SPH solver.
the corresponding particle r. In this case our goal is to determine This velocity vector can be written as
contact forces Frr such that ρr = ρ0r .
vt+∆t
r = vt+∆t
R + ωt+∆t
R × rt+∆t
r , (168)
Now we will derive an implicit method to compute the unknown
contact forces. We start with the continuity equation where vt+∆t
R and ωt+∆t
R are the linear and angular velocity of the
rigid body R at time t +∆t, respectively, and rt+∆t
r is the vector from
Dρr the center of mass of the rigid body to the position of the particle r.
= −ρr ∇ · vr , (166)
Dt The new velocities are determined by an Euler integration step
where ρr and vr are the density and the velocity of a rigid body !
particle r, respectively. Then we use a backward difference time t+∆t 1 rr
vR = vR + ∆t FR + ∑ Fk (169)
discretization and introduce a constant density constraint ρt+∆t
r = mR k∈R
ρ0r to get !
ωt+∆t
R = ωR + ∆tI−1
R τR + (IR ωR ) × ωR + ∑ rk × Frr
k ,
ρ0r − ρr
= −ρr ∇ · vt+∆t
r , (167) k∈R
∆t (170)
where vt+∆t
r is the velocity of the rigid body particle r at time t +∆t. where IR is the inertia tensor of the rigid body. The vectors FR
and τR contain all forces and torques acting on the body except for all rigid particles. Note that the linear system contains one equa-
the unknown rigid-rigid contact forces Frr k . R denotes the set of all tion for each rigid particle. However, if a particle r has no contact
particles of rigid body R. Note that all quantities on the right hand to a particle of another rigid body, we can remove the correspond-
side are at time t. For improved readability we omitted the time ing equation from the system and set pr = 0 as no contact must be
parameter for all quantities at the current time t. resolved in this case.
In the next step we substitute Eqs. (168)-(170) in Eq. (167) to
get a linear system for the unknown rigid-rigid contact forces 11.2. Implementation
!
ρ0r − ρr
∆t ∆t rr In the following we describe how the quantities in the derived linear
= − ρr ∇ · vR + FR − ρr ∇ · ∑ Fk
∆t mR mR k∈R system are computed.
t+∆t The artificial rest volume of a rigid particle r is determined as
− ρr ∇ · ωR + ∆tI−1 R (τR + (IR ωR ) × ωR ) × rr
0.7
Vr0 = . (179)
! !
− ρr ∇ · ∆t I−1 rk × Frr × rt+∆t . (171) ∑k∈R Wrk
R ∑ k r
k∈R A detailed discussion about this computation can be found in the
To simplify this system we use the approximation rt+∆t = rr . More- work of Gissler et al. [GPB∗ 19]. Together with the artificial rest
r
over, we introduce the velocity vector density ρ0r = 1 the actual density of a rigid particle is computed
as ρr = ∑k Vr0 ρ0r Wrk , where the sum considers the particles k of all
vsr = vR +
∆t
FR + ωR + ∆tI−1 R (τR + (IR ωR ) × ωR ) × rr .
rigid bodies within the support radius of the kernel. Due to the sum
mR over the particles of neighboring rigid bodies, we get a density de-
(172)
viation of ρr − ρ0r > 0 in case of a contact. In this case we compute
This vector determines the new velocity of a particle r after a time ρ0r Vr0
step which considers all forces and torques except the unknown the actual volume of a rigid particle r as Vr = ρr .
contact forces. In this way we can write the right-hand side of our The divergence on the right-hand side of the linear system is
linear system in a compact form: determined as
ρ0r − ρr ∇ · vsr =
1
+ ρr ∇ · vsr . ∑ Vk ρk vsk − vsr · ∇W rk .
sr = (173) (180)
∆t ρr k∈R
The left-hand side contains all terms of Eq. (171) that depend on Finally, we solve the linear system using a relaxed Jacobi solver
the rigid-rigid contact forces Frr k . The resulting linear system has and update the pressure in iteration l + 1 as
the form !!
! !
l+1 l βRJ
r l
∆t rr −1 rr pr = pr + sr − ρr ∇ · ∆t ∑ Vk Krk ∇pk , (181)
−ρr ∇ · ∑ Fk + ∆tIR ∑ rk × Fk × rk = sr .
mR k∈R
br k∈R
k∈R
(174) where br is the diagonal element of the linear system and βRJ
r is the
The left-hand side can further be simplified by introducing the ma- relaxation coefficient which is set to βRJ 0.5
r = num_contacts .
trix
1
Krk = 1 − r̃r I−1
R r̃k , (175) 11.3. Conclusion
mR
where r̃r is the cross product matrix of rr to get The introduced SPH-based rigid body solver enables a strong cou-
! pling between fluids and rigid bodies. As shown in Fig. 27 the
solver is able to accurately handle complex scenarios with thou-
−ρr ∇ · ∆t ∑ Krk Frr
k = sr . (176)
k∈R sands of simultaneous contacts. It can be easily extended to sim-
ulate friction effects [GPB∗ 19]. Finally, together with the SPH-
Note that the matrix Krk is well-known in the area of rigid body based simulation of deformable solids (see Section 10), it can be
solvers [Mir96, BET14]. combined to a unified SPH solver which supports the coupling of
Our goal is to resolve the contacts by a pressure force. Therefore, fluids, rigid bodies, deformable solids and highly viscous materials
we define (see Fig. 26).
Frr
k = −Vk ∇pk , (177)
12. Data Driven Fluid Simulation
where Vk is an artificial volume of particle k and pk is an unknown
pressure which is used to resolve the collision. This yields the final Using machine learning for fluid simulations is a largely unex-
linear system plored research area, but first results are promising and indicate the
! potential of such data-driven approaches. In the Lagrangian con-
ρ0 − ρr text, the seminal work of Ladický et al. [LJS∗ 15] employed Re-
ρr ∇ · ∆t ∑ Vk Krk ∇pk = r + ρr ∇ · vsr . (178)
k∈R
∆t gression forests to infer particle accelerations (and velocities) us-
ing handcrafted, SPH-based features. We discuss this work in more
Solving the linear system gives us the unknown pressure values detail below. Um et al. [UHT18] presented a method to augment
Figure 28: The regression forest approach for SPH [LJS∗ 15] en-
Figure 27: Closeup of the water gate scene in Fig. 25. The single
ables real-time simulations of over a million particles. At runtime,
chain elements are connected only by rigid-rigid contacts.
additional external forces can be added to mimic different material
properties without retraining the model.
simulations with learned splashes from a high-resolution FLIP sim-
ulation, but included also an example where SPH training data was
used. Somewhat related to SPH, Schenk et al. [SF18] proposed a an explicit neighbor search step, context-based integral features are
differentiable PBF solver [MM13] for deep neural networks. They computed that are defined as flat-kernel sums of rectangular regions
have presented convolution layers for summing up contributions surrounding a particle. The different box sizes allow to capture the
from neighbors and for fluid-object interaction, which potentially behavior of both close and distant particles, and the features can
can be adapted to SPH fluids as well. Other work mainly focused be evaluated in constant time and are robust to small deviations.
on Eulerian simulations, for example to substitute the pressure More details on the computation of context-based integral features
projection step with a CNN [TSSP16], to synthesize flow simu- can be found in [LJS∗ 15]. Three different ways were considered
lations from a set of reduced parameters [KAT∗ 19], to compute for the learning strategy:
smoke super-resolution with GAN networks [XFCT18], or to pre-
dict pressure field changes for multiple subsequent time-steps with 1. Learning naïve prediction: The first approach directly learns
LSTM [WBT18]. particle accelerations a, given the evaluated features at state t. The
regression problem is formulated as
In the following, we give an overview of the regression forest ap- where Reg(.) is the learned regression function. Velocities and po-
proach for SPH presented by Ladický et al. [LJS∗ 15]. The work sitions are then integrated with
aimed at enabling real-time applications of millions of particles for
vi (t + ∆t) = vi (t) + ai (t)∆t (183)
games and virtual reality applications. The main idea is to formu-
v (t) + vi (t + ∆t)
late an SPH solver as a regression problem, where the acceleration xi (t + ∆t) = xi (t) + i ∆t. (184)
(or velocity) of each particle at time t + ∆t is efficiently estimated 2
given the state at time t. This formulation mimics standard SPH and hence does not consider
incompressibility.
As input to the regressor, a feature vector Φxi is evaluated for
each particle. The features are designed such that they represent 2. Learning prediction with hindsight: The second strategy first
the individual forces and constraints of the Navier-Stokes equa- computes external forces, advects particles, and applies collision
tions: the used features model pressure, incompressibility, viscos- handling. Then, this intermediate state with particle positions x∗i is
ity and surface tension. In order to evaluate features without using used to compute integral features. The regression learns a corrective
acceleration and is defined as ICS∗ 14, BK15, WKB16] which enable the simulation of incom-
pressible fluids with several million particles. Moreover, the ex-
ai (t) := Reg(Φx∗i ), (185) plicit [SB12, Mon92] and implicit viscosity methods [TDF∗ 15,
followed by advection as in Eqs. (183) and (184). Unlike the naïve PICT15, PT16, BK17, WKBB18] introduced in Section 6 are im-
approach, the regressor is able to predict compressions and hence to plemented. Hence, the library supports the simulation of low vis-
counteract those with a corrective acceleration. Conceptually, this cous flow and highly viscous materials. Surface tension effects
approach mimics PCISPH [SP09]. (see Section 7) can also be simulated using SPlisHSPlasH. The
framework currently implements microscopic and macroscopic ap-
3. Learning correction: The third approach starts similarly as the proaches [BT07, AAT13, HWZ∗ 14]. To simulate turbulent fluids,
second one, but instead of learning accelerations, corrective veloc- SPlisHSPlasH implements vorticity confinement [MM13] and the
ities are computed. The regression problem is defined as micropolar model [BKKW17] which were discussed in Section 8.
∆vcorr
i := Reg(Φx∗i ), (186) Aside from forces which act within the same phase, SPlisH-
and positions and velocities are updated with SPlasH also supports multiphase simulations [SP08] and provides
functionality to couple different materials. The interaction between
vi (t + ∆t) = v∗i (t) + ∆vcorr
i (187) air phase and fluid phase is realized using drag forces [MMCK14,
∆v corr GBP∗ 17]. The framework implements the approach of Akinci et
xi (t + ∆t) = x∗i (t) + i ∆t. (188) al. [AIA∗ 12] to simulate the coupling between rigid bodies and
2
fluids. The required surface sampling of the bodies is performed
This approach counteracts compressions as well, and conceptually
automatically using a Poisson disk sampling. For the simulation
mimics PBF [MM13]. Unlike PBF, the regressor takes into account
of dynamic rigid bodies SPlisHSPlasH uses the open-source Po-
information from a larger neighborhood, and hence does not require
sitionBasedDynamics library [Ben19a]. This library simulates the
several iterations to converge.
rigid bodies using a position-based approach [DCB14]. Collisions
For training the regression forest, 165 scenes consisting of 1- between the bodies are efficiently detected using signed distance
6 million particles and moving obstacles (sphere, box, cylinder) fields [KDBB17] while the contacts are resolved using a projected
were randomly generated and computed for 6 seconds. The training Gauss-Seidel method [BET14]. Finally, SPlisHSPlasH implements
time was 4 days on 12 CPUs, and the size of the resulting model different methods for the simulation of deformable solids [BIT09,
was about 40 MB. With the regression fluid approach it is possible PGBT17] using an SPH formulation (see Section 10). Since an SPH
to simulate 1 to 1.5 million particles in real-time, and hence this formulation is used, the two-way coupling between solids and flu-
approach represents an attractive alternative to traditional solvers ids is simply handled by the implemented multiphase method.
for games and virtual reality applications (Fig. 28).
SPlisHSPlasH uses a neighborhood search based on the com-
With the naïve prediction, strong compression artifacts are vis- pact hashing approach of Ihmsen et al. [IABT11]. This approach is
ible. The system cannot self-correct in the next frames since the discussed in more detail in Section 3. The neighborhood search is
model has never seen such distorted states during the training. Both implemented in our open-source library CompactNSearch [Kos19].
prediction with hindsight and learning corrections can handle in-
The SPlisHSPlasH framework has many more features like emit-
compressibility well, however the third approach seems to lead to
ters, adaptive time-stepping or the support of different kernel func-
smaller errors compared to the ground truth data. Additionally, with
tions. Moreover, the library has some useful tools like volume sam-
the second and third approaches, external forces can be added with-
pling of closed geometries or the export of particle data for Maya
out retraining the model. This allows adding surface tension, fric-
or Houdini. New simulation scenarios can be created easily using a
tion, or drag effects at runtime to mimic different material prop-
JSON-based scene file format. Finally, due to a modular concept it
erties as illustrated in Fig. 28. The disadvantage of the regression
is simple to extend the library and to integrate own SPH methods.
fluids approach - and in fact of all machine learning based strate-
Therefore, we think that SPlisHSPlasH is a good starting point for
gies - is that learning methods are not capable to extrapolate the
all beginners in the area of SPH-based simulations.
model far outside the training data (e.g., when domain size or fluid
resolution change).
14. Conclusion
13. SPlisHSPlasH This tutorial introduced state-of-the-art SPH techniques for the
physics based simulation of fluids and solids in graphics and pre-
In this section we want to introduce SPlisHSPlasH [Ben19b] which
sented practical guidelines for implementations. Various concepts
is an SPH-based open-source library for the physically-based sim-
that are particularly relevant for graphics applications were dis-
ulation of fluids (see Fig. 29). The SPlisHSPlasH framework con-
cussed. We showed that with the recent improvements SPH mod-
tains a reference implementation of many of the methods intro-
els have matured and ultimately emerged as a competitive alter-
duced in this tutorial and several simulations shown in the figures
native to Eulerian fluid simulations or hybrid approaches. Particu-
were performed using this library. Therefore, we think that our
lar challenges of SPH concerning neighborhood search algorithms,
open-source framework perfectly supplements these course notes.
pressure solvers, or versatile fluid-solid interaction techniques have
In the current version SPlisHSPlasH implements six of the most been overcome. With the improved robustness and efficiency, mil-
popular explicit and implicit pressure solvers [BT07, SP09, MM13, lions of particles can today be simulated on a single desktop com-
Figure 29: Screenshots of the SPlisHSPlasH fluid simulation framework. Left: Two-way coupling of dynamic rigid bodies and a color-coded
fluid. Center: Two-phase double dam break simulation. Right: Highly viscous bunny collides with a static dragon model.
puter. Accordingly, the Lagrangian SPH method reaches an un- [AIA∗ 12] A KINCI N., I HMSEN M., A KINCI G., S OLENTHALER B.,
precedented level of visual quality, where fine-scale surface effects T ESCHNER M.: Versatile rigid-fluid coupling for incompressible SPH.
and flow details are reliably captured. ACM Transactions on Graphics 31, 4 (July 2012), 1–8. 18, 20, 21, 25,
30, 37
The SPH community – in graphics as well as in other research [AMS∗ 07] AGERTZ O., M OORE B., S TADEL J., P OTTER D., M INIATI
disciplines – is very active and the field advances quickly. Each F., R EAD J., M AYER L., G AWRYSZCZAK A., K RAVTSOV A., M ON -
community contributes to different aspects of SPH simulations, and AGHAN J., N ORDLUND A., P EARCE F., Q UILIS V., RUDD D.,
S PRINGEL V., S TONE J., TASKER E., T EYSSIER R., WADSLEY J.,
the research often finds applications across disciplines. For graph-
WALDER R.: Fundamental differences between SPH and grid methods.
ics applications, it was especially important to efficiently enforce Mon. Not. R. Astron. Soc. 380, 3 (2007), 963–978. 29
incompressibility on unstructured particles and hence to eliminate
[AW09] A DAMS B., W ICKE M.: Meshless Approximation Methods and
the severe time step restrictions of standard SPH techniques. We Applications in Physics Based Modeling and Animation. In Proceedings
have presented a practical introduction to various SPH concepts of the Eurographics conference (2009), EG ’09, Eurographics Associa-
that enforce volume conservation and/or divergence-free velocity tion, pp. 213–239. 31
fields. A current difficulty is that these approaches render time step- [Ben19a] B ENDER J.: PositionBasedDynamics Library.
ping more challenging, since the largest possible time step does not https://github.com/InteractiveComputerGraphics/
necessarily result in the best overall performance. Future work is PositionBasedDynamics, 2019. 37
certainly necessary to establish a CFL condition for these methods, [Ben19b] B ENDER J.: SPlisHSPlasH Library.
as well as to overcome the current main performance bottleneck https://github.com/InteractiveComputerGraphics/
SPlisHSPlasH, 2019. 25, 37
which is still the time step restriction especially when using mil-
lions of particles. [BET14] B ENDER J., E RLEBEN K., T RINKLE J.: Interactive Simulation
of Rigid Body Dynamics in Computer Graphics. Computer Graphics
Using large particle numbers is one of the key components Forum 33, 1 (2014), 246–270. 35, 37
for high visual quality and production level results. Such high- [BGFAO17] BARREIRO H., G ARCÍA -F ERNÁNDEZ I., A LDUÁN I.,
resolution simulations pose new challenges and existing concepts OTADUY M. A.: Conformation constraints for efficient viscoelastic fluid
might need to be revisited. Especially speed, flexibility and con- simulation. ACM Transactions on Graphics 36, 6 (2017), 221.1–221.11.
24
trollability are core aspects, for which solutions are still largely
missing. This problem, however, affects not only the SPH field but [BGI∗ 18] BAND S., G ISSLER C., I HMSEN M., C ORNELIS J., P EER A.,
the entire fluid community in graphics likewise, and has triggered T ESCHNER M.: Pressure boundaries for implicit incompressible sph.
ACM Transactions on Graphics 37, 2 (Feb. 2018), 14:1–14:11. 18
research on pre- and post-processing methods or data-driven ap-
proaches. [BGPT18] BAND S., G ISSLER C., P EER A., T ESCHNER M.: MLS pres-
sure boundaries for divergence-free and viscous SPH fluids. Computers
Our tutorial introduced the SPH-based open-source library & Graphics 76 (nov 2018), 37–46. 17, 18
SPlisHSPlasH that contains reference implementations of many [BIT09] B ECKER M., I HMSEN M., T ESCHNER M.: Corotated SPH for
concepts that we discussed. This implementation is an excellent deformable solids. In Proceedings of Eurographics Conference on Nat-
starting point for students, researchers and practitioners, and may ural Phenomena (2009), pp. 27–34. 32, 37
serve as a valuable tool for future research. [BK15] B ENDER J., KOSCHIER D.: Divergence-Free Smoothed Parti-
cle Hydrodynamics. In ACM SIGGRAPH/Eurographics Symposium on
Computer Animation (2015), pp. 1–9. 17, 37
References [BK17] B ENDER J., KOSCHIER D.: Divergence-Free SPH for Incom-
pressible and Viscous Fluids. IEEE Transactions on Visualization and
[AAT13] A KINCI N., A KINCI G., T ESCHNER M.: Versatile surface ten-
Computer Graphics 23, 3 (2017), 1193–1206. 9, 17, 18, 24, 25, 26, 37
sion and adhesion for SPH fluids. ACM Transactions on Graphics 32, 6
(2013), 1–8. 25, 26, 27, 37 [BKCW14] B ENDER J., KOSCHIER D., C HARRIER P., W EBER D.:
Position-Based Simulation of Continuous Materials. Computers &
[Abe12] A BEYARATNE R.: Continuum Mechanics: Volume II of Lecture
Graphics 44, 1 (2014), 1–10. 31
Notes on The Mechanics of Elastic Solids. techreport, MIT Department
of Mechanical Engineering, 2012. 7 [BKKW17] B ENDER J., KOSCHIER D., K UGELSTADT T., W EILER M.:
A micropolar material model for turbulent sph fluids. In ACM SIG- [FLR∗ 13] F ERRAND M., L AURENCE D. R., ROGERS B. D., V IOLEAU
GRAPH/Eurographics Symposium on Computer Animation (July 2017), D., K ASSIOTIS C.: Unified semi-analytical wall boundary conditions
pp. 1–8. 37 for inviscid, laminar or turbulent flows in the meshless SPH method.
International Journal for Numerical Methods in Fluids 71, 4 (Feb. 2013),
[BKKW18] B ENDER J., KOSCHIER D., K UGELSTADT T., W EILER M.:
446–472. 19
Turbulent micropolar sph fluids with foam. IEEE Transactions on Visu-
alization and Computer Graphics (2018). 27, 28, 29 [FM15] F UJISAWA M., M IURA K. T.: An Efficient Boundary Handling
with a Modified Density Calculation for SPH. Computer Graphics Fo-
[BL99] B ONET J., L OK T.-S.: Variational and momentum preservation
rum 34, 7 (2015), 155–162. 19
aspects of smooth particle hydrodynamic formulations. Computer Meth-
ods in Applied Mechanics and Engineering 180, 1 (1999), 97 – 115. 32 [FMH∗ 94] F LEBBE O., M UENZEL S., H EROLD H., R IFFERT H.,
RUDER H.: Smoothed Particle Hydrodynamics: Physical viscosity and
[BLS12] B ODIN K., L ACOURSIÈRE C., S ERVIN M.: Constraint fluids. the simulation of accretion disks. The Astrophysical Journal 431 (Aug.
IEEE Transactions on Visualization and Computer Graphics 18 (2012), 1994), 754–760. 22
516–526. 16, 18, 19
[GAC∗ 09] G RENIER N., A NTUONO M., C OLAGROSSI A., T OUZÉ
[BMM14] B ENDER J., M ÜLLER M., M ACKLIN M.: A Survey on D. L., A LESSANDRINI B.: An Hamiltonian interface SPH formulation
Position-Based Simulation Methods in Computer Graphics. Computer for multi-fluid and free surface flows. Journal of Computational Physics
Graphics Forum 33, 6 (2014), 228–251. 31 228, 22 (2009), 8380 – 8393. 30
[BMM17] B ENDER J., M ÜLLER M., M ACKLIN M.: A survey on posi- [Gan15] G ANZENMÜLLER G. C.: An hourglass control algorithm for la-
tion based dynamics, 2017. In EUROGRAPHICS 2017 Tutorials (2017), grangian smooth particle hydrodynamics. Computer Methods in Applied
Eurographics Association. 31 Mechanics and Engineering 286 (apr 2015), 87–106. 32, 33
[Bri15] B RIDSON R.: Fluid Simulation for Computer Graphics, Second [GBP∗ 17] G ISSLER C., BAND S., P EER A., I HMSEN M., T ESCHNER
Edition. Taylor & Francis, 2015. 8 M.: Generalized drag force for particle-based simulations. Computers
[Bro85] B ROOKSHAW L.: A method of calculating radiative heat diffu- & Graphics 69 (dec 2017), 1–11. 37
sion in particle simulations. Publications of the Astronomical Society of [GM77] G INGOLD R. A ., M ONAGHAN J.: Smoothed Particle Hydrody-
Australia 6, 2 (1985), 207–210. 7, 22 namics: Theory and Application to Non-Spherical Stars. Monthly No-
[BT07] B ECKER M., T ESCHNER M.: Weakly compressible SPH for free tices of the Royal Astronomical Society, 181 (1977), 375–389. 4
surface flows. In ACM SIGGRAPH/Eurographics Symposium on Com- [GPB∗ 19] G ISSLER C., P EER A., BAND S., B ENDER J., T ESCHNER
puter Animation (2007), pp. 1–8. 18, 25, 26, 37 M.: Interlinked sph pressure solvers for strong fluid-rigid coupling. ACM
[CBG∗ 18] C ORNELIS J., B ENDER J., G ISSLER C., I HMSEN M., Transactions on Graphics 38, 1 (Jan. 2019), 5:1–5:13. 18, 30, 33, 35
T ESCHNER M.: An optimized source term formulation for incompress- [HA06] H U X., A DAMS N.: A multi-phase SPH method for macroscopic
ible SPH. The Visual Computer (Feb. 2018). 16 and mesoscopic flows. Journal of Computational Physics 213, 2 (2006),
[CIPT14] C ORNELIS J., I HMSEN M., P EER A., T ESCHNER M.: IISPH- 844–861. 29, 30
FLIP for incompressible fluids. Computer Graphics Forum 33, 2 (may [HKK07a] H ARADA T., KOSHIZUKA S., K AWAGUCHI Y.: Smoothed
2014), 255–262. 27 particle hydrodynamics in complex shapes. In Spring Conference on
Computer Graphics (2007), pp. 191–197. 18, 19
[CM99] C LEARY P. W., M ONAGHAN J. J.: Conduction modelling using
smoothed particle hydrodynamics. Journal of Computational Physics [HKK07b] H ARADA T., KOSHIZUKA S., K AWAGUCHI Y.: Smoothed
148, 1 (1999), 227 – 264. 22 Particle Hydrodynamics on GPUs. In Computer Graphics International
(2007), pp. 63–70. 18, 19
[Com16a] C OMPUTER A NIMATION , RWTH A ACHEN U NIVERSITY:
Divergence-free sph for incompressible and viscous fluids. www. [HLL∗ 12] H E X., L IU N., L I S., WANG H., WANG G.: Local Poisson
youtube.com/watch?v=tl4mx0TtaAc, 2016. 1 SPH for Viscous Incompressible Fluids. Computer Graphics Forum 31
(2012), 1948–1958. 16
[Com16b] C OMPUTER G RAPHICS , U NIVERSITY OF F REIBURG: Ter-
rain 2 - up to 500 million particles with PreonLab (FIFTY2). www. [Hoo98] H OOVER W.: Isomorphism linking smooth particles and embed-
youtube.com/watch?v=4y-VBLzA9Mw, 2016. 1 ded atoms. Physica A: Statistical Mechanics and its Applications 260, 3
(1998), 244–254. 29
[Com17] C OMPUTER G RAPHICS , U NIVERSITY OF F REIBURG: Ship
under attack. www.youtube.com/watch?v=_O6fqLOCTew, [HS13] H ORVATH C. J., S OLENTHALER B.: Mass preserving multi-
2017. 1 scale SPH. Pixar Technical Memo 13-04, Pixar Animation Studios,
2013. 30
[Com18] C OMPUTER G RAPHICS , U NIVERSITY OF F REIBURG: An im-
plicit SPH formulation for incompressible linearly elastic solids. www. [HWZ∗ 14] H E X., WANG H., Z HANG F., WANG H., WANG G., Z HOU
youtube.com/watch?v=qd3gKVX89qo, 2018. 1 K.: Robust Simulation of Sparsely Sampled Thin Features in SPH-Based
Free Surface Flows. ACM Transactions on Graphics 34, 1 (2014), 7:1–
[DCB14] D EUL C., C HARRIER P., B ENDER J.: Position-based rigid- 7:9. 25, 37
body dynamics. Computer Animation and Virtual Worlds 27, 2 (Sept.
2014), 103–112. 37 [IAAT12] I HMSEN M., A KINCI N., A KINCI G., T ESCHNER M.: Uni-
fied spray, foam and air bubbles for particle-based fluids. The Visual
[dGWH∗ 15] DE G OES F., WALLEZ C., H UANG J., PAVLOV D., D ES - Computer 28, 6-8 (2012), 669–677. 9
BRUN M.: Power Particles: An incompressible fluid solver based on
power diagrams. ACM Transactions on Graphics 34, 4 (2015), 50:1– [IABT11] I HMSEN M., A KINCI N., B ECKER M., T ESCHNER M.: A
50:11. 27 Parallel SPH Implementation on Multi-Core CPUs. Computer Graphics
Forum 30, 1 (Mar. 2011), 99–112. 10, 11, 37
[ER03] E SPANOL P., R EVENGA M.: Smoothed dissipative particle dy-
[IAGT10] I HMSEN M., A KINCI N., G ISSLER M., T ESCHNER M.:
namics. Physical Review E 67, 2 (2003), 026705. 22
Boundary handling and adaptive time-stepping for PCISPH. In Virtual
[FAW17] F ÜRSTENAU J.-P., AVCI B., W RIGGERS P.: A comparative Reality Interactions and Physical Simulations (2010), pp. 79–88. 18
numerical study of pressure-Poisson-equation discretization strategies
[ICS∗ 14] I HMSEN M., C ORNELIS J., S OLENTHALER B., H ORVATH C.,
for SPH. In 12th International SPHERIC Workshop (2017). 16
T ESCHNER M.: Implicit incompressible SPH. IEEE Transactions on
[FIF16] FIFTY2 T ECHNOLOGY: PreonLab Promotion. www. Visualization and Computer Graphics 20, 3 (2014), 426–435. 9, 12, 13,
youtube.com/watch?v=giS2r5JPgy0, 2016. 1 14, 16, 18, 37
[IOS∗ 14] I HMSEN M., O RTHMANN J., S OLENTHALER B., KOLB A., [MSKG05] M ÜLLER M., S OLENTHALER B., K EISER R., G ROSS M.:
T ESCHNER M.: SPH Fluids in Computer Graphics. Eurographics (State Particle-based fluid-fluid interaction. In ACM SIGGRAPH/Eurographics
of the Art Reports) (2014), 21–42. 18, 22, 27 Symposium on Computer Animation (2005), p. 237. 29, 30
[JSD04] J UBELGAS M., S PRINGEL V., D OLAG K.: Thermal conduction [Nex17] N EXT L IMIT: RealFlow Showreel 2017. www.youtube.
in cosmological SPH simulations. Monthly Notices of the Royal Astro- com/watch?v=nnv-95w1d5A, 2017. 1
nomical Society 351, 2 (2004), 423–435. 22 [PGBT17] P EER A., G ISSLER C., BAND S., T ESCHNER M.: An im-
[KAT∗ 19] K IM B., A ZEVEDO V., T HUEREY N., G ROSS M., S OLEN - plicit sph formulation for incompressible linearly elastic solids. Com-
THALER B.: Deep fluids: A generative network for parameterized fluid puter Graphics Forum (2017), n/a–n/a. 32, 33, 37
simulations. Computer Graphics Forum (2019). 36 [PICT15] P EER A., I HMSEN M., C ORNELIS J., T ESCHNER M.: An
[KB17] KOSCHIER D., B ENDER J.: Density maps for improved sph Implicit Viscosity Formulation for SPH Fluids. ACM Transactions on
boundary handling. In ACM SIGGRAPH/Eurographics Symposium on Graphics 34, 4 (2015), 1–10. 22, 23, 25, 37
Computer Animation (July 2017), pp. 1–10. 18, 19 [Pri12] P RICE D. J.: Smoothed particle hydrodynamics and magneto-
[KBT17] KOSCHIER D., B ENDER J., T HUEREY N.: Robust eXtended hydrodynamics. Journal of Computational Physics 231, 3 (Feb. 2012),
Finite Elements for Complex Cutting of Deformables. ACM Transac- 759–794. 2, 5, 6, 7, 22
tions on Graphics 36, 4 (2017), 55:1–55:13. 31 [PT16] P EER A., T ESCHNER M.: Prescribed velocity gradients for
[KDBB17] KOSCHIER D., D EUL C., B RAND M., B ENDER J.: An highly viscous SPH fluids with vorticity diffusion. IEEE Transactions
hp-adaptive discretization algorithm for signed distance field genera- on Visualization and Computer Graphics (2016), 1–9. 23, 25, 26, 37
tion. IEEE Transactions on Visualization and Computer Graphics 23, [RL96] R ANDLES P., L IBERSKY L.: Smoothed particle hydrodynam-
10 (2017), 2208–2221. 18, 37 ics: Some recent improvements and applications. Computer Methods in
[KKB18] K UGELSTADT T., KOSCHIER D., B ENDER J.: Fast corotated Applied Mechanics and Engineering 139, 1 (1996), 375 – 408. 5
FEM using operator splitting. Computer Graphics Forum 37, 8 (2018). [RLY∗ 14] R EN B., L I C., YAN X., L IN M. C., B ONET J., H U S.-M.:
31, 32 Multiple-Fluid SPH Simulation Using a Mixture Model. ACM Transac-
tions on Graphics 33, 5 (2014), 1–11. 31
[Kos19] KOSCHIER D.: CompactNSearch Library.
https://github.com/InteractiveComputerGraphics/ [SB12] S CHECHTER H., B RIDSON R.: Ghost SPH for animating water.
CompactNSearch, 2019. 10, 37 ACM Transactions on Graphics 31, 4 (2012), 61:1–61:8. 9, 22, 30, 37
[Lau11] L AUTRUP B.: Physics of Continuous Matter. Taylor & Francis, [SF18] S CHENCK C., F OX D.: Spnets: Differentiable fluid dynamics for
2011. 22 deep neural networks. In CoRL (2018), vol. 87 of Proceedings of Ma-
chine Learning Research, PMLR, pp. 317–335. 36
[LJS∗ 15] L ADICKÝ L., J EONG S., S OLENTHALER B., P OLLEFEYS M.,
G ROSS M.: Data-driven fluid simulations using regression forests. ACM [SG11] S OLENTHALER B., G ROSS M.: Two-scale particle simulation.
Transactions on Graphics 34, 6 (Oct. 2015), 199:1–199:9. 35, 36 TOG 30, 4 (2011), 72:1–72:8. 30
[LKR09] L AI M., K REMPL E., RUBEN D.: Introduction to Continuum [Sif12] S IFAKIS E.: SIGGRAPH 2012 Course Notes FEM Simulation
Mechanics. Butterworth-Heinemann, 2009. 7 of 3D Deformable Solids Part 1. Tech. rep., University of Wisconsin-
Madison, 2012. 31
[LL10] L IU M., L IU G.: Smoothed Particle Hydrodynamics (SPH): an
Overview and Recent Developments. Archives of Computational Meth- [SP08] S OLENTHALER B., PAJAROLA R.: Density Contrast SPH In-
ods in Engineering 17, 1 (2010), 25–76. 3, 4 terfaces. In ACM SIGGRAPH/Eurographics Symposium on Computer
Animation (2008), pp. 211–218. 29, 30, 37
[LLP11] L IU S., L IU Q., P ENG Q.: Realistic simulation of mixing fluids.
The Visual Computer 27, 3 (2011), 241–248. 30 [SP09] S OLENTHALER B., PAJAROLA R.: Predictive-corrective incom-
pressible SPH. ACM Transactions on Graphics 28, 3 (2009), 40:1–40:6.
[Łuk99] Ł UKASZEWICZ G.: Micropolar Fluids. Modeling and Simula- 9, 14, 18, 37
tion in Science, Engineering and Technology. Birkhäuser Boston, 1999.
[TDF∗ 15] TAKAHASHI T., D OBASHI Y., F UJISHIRO I., N ISHITA T.,
27
L IN M.: Implicit Formulation for SPH-based Viscous Fluids. Computer
[MBCM16] M ÜLLER M., B ENDER J., C HENTANEZ N., M ACKLIN M.: Graphics Forum 34, 2 (2015), 493–502. 22, 23, 24, 25, 26, 37
A robust method to extract the rotational part of deformations. In Pro- [THM∗ 03] T ESCHNER M., H EIDELBERGER B., M ÜLLER M., P OMER -
ceedings of ACM SIGGRAPH Conference on Motion in Games (2016), ANTES D., G ROSS M. H.: Optimized spatial hashing for collision de-
MIG ’16, ACM. 32 tection of deformable objects. In Vmv (2003), vol. 3, pp. 47–54. 10
[MFK∗ 15] M AYRHOFER A., F ERRAND M., K ASSIOTIS C., V IOLEAU [TM05] TARTAKOVSKY A., M EAKIN P.: Modeling of surface tension
D., M OREL F.-X.: Unified semi-analytical wall boundary conditions and contact angles with smoothed particle hydrodynamics. Physical Re-
in SPH: analytical extension to 3-D. Numerical Algorithms 68, 1 (Jan. view E 72, 2 (2005), 026301. 29, 30
2015), 15–34. 19
[TSSP16] T OMPSON J., S CHLACHTER K., S PRECHMANN P., P ERLIN
[Mir96] M IRTICH B. V.: Impulse-based dynamic simulation of rigid K.: Accelerating Eulerian Fluid Simulation With Convolutional Net-
body systems. PhD thesis, University of California at Berkeley, 1996. works, jul 2016. 36
35
[UHT18] U M K., H U X., T HUEREY N.: Liquid splash modeling with
[MM13] M ACKLIN M., M ÜLLER M.: Position Based Fluids. ACM neural networks. CGF 37, 8 (2018), 171–182. 35
Transactions on Graphics 32, 4 (2013), 1–5. 16, 27, 36, 37
[WBF∗ 96] WATKINS S. J., B HATTAL A. S., F RANCIS N., T URNER
[MMCK14] M ACKLIN M., M ÜLLER M., C HENTANEZ N., K IM T.-Y.: J. A., W HITWORTH A. P.: A new prescription for viscosity in smoothed
Unified Particle Physics for Real-Time Applications. ACM Transactions particle hydrodynamics. Astron. Astrophys. Suppl. Ser. 119, 1 (1996),
on Graphics 33, 4 (2014), 1–12. 37 177–187. 22
[Mon92] M ONAGHAN J.: Smoothed Particle Hydrodynamics. Annual [WBT18] W IEWEL S., B ECHER M., T HUEREY N.: Latent-space
Review of Astronomy and Astrophysics 30, 1 (1992), 543–574. 9, 22, 24, Physics: Towards Learning the Temporal Evolution of Fluid Flow, feb
37 2018. 36
[Mon05] M ONAGHAN J. J.: Smoothed Particle Hydrodynamics. Reports [WKB16] W EILER M., KOSCHIER D., B ENDER J.: Projective fluids. In
on Progress in Physics 68, 8 (2005), 1703–1759. 2, 22 ACM Motion in Games (2016), pp. 1–6. 37