Fast Multiple-Fluid Simulation
Fast Multiple-Fluid Simulation
Tao Yang1 , Jian Chang2 , Bo Ren3 , Ming C. Lin1,4 , Jian Jun Zhang2 , and Shi-Min Hu1
1
Tsinghua University 2 Bournemouth University 3 Nankai University 4 University of North Carolina at Chapel Hill
Figure 1: Egg Mixture. In simulating the stirring of 3 eggs by a blender, the resulting simulation presents visually plausible mixing results.
This mixing effect is achieved using our novel “extended mobility” formulation of the Navier-Stokes-Cahn-Hilliard Model.
Abstract 1 Introduction
nomenon commonly observed in industrial environments, partial it less effective for real-time simulations. Unlike previous work-
dissolution due to saturation and (oil spill) cleaning) based on this s, we adopt an energy-based method that is both computationally
principle. In contrast to previous works, we adopt an energy-based efficient and easy to integrate with the PBD method, which more
model and integrate the Cahn-Hilliard equation into the multiple- effectively brings incompressibility into the simulation.
fluid simulation. Our method can be potentially used to simulate
a wide range of common daily phenomena related to mixing and Park et al. [2008] also adopted the Cahn-Hilliard equation to sim-
unmixing, such as the mixture of oil and water. From an energy ulate multiple fluids using the Lattice Boltzmann method (LBM).
point of view, this work provides an alternative approach that ex- They provide a unified approach to handle both immiscible and mis-
pands the capability of multiple-fluid simulation and is flexible and cible fluids and show its feasibility with various examples. Howev-
stable. We further extend the original Cahn-Hilliard equation rather er, their method simply follows the original Cahn-Hilliard equation
than just follow it [Park et al. 2008] to make it capable of simulating without any modification. They simply set the bulk energy, i.e., the
more complex and richer visual phenomena such as egg-mixture Helmholtz free energy as the sum of the pair-wise fluid miscibility
and gray/colored patterns. which can be a convex function or zero. This formulation substan-
tially limits the targets of multi-fluid simulation to only basic misci-
The main contributions of our work are summarized below: ble and immiscible fluids. The LBM they adopted incurs significant
memory cost and is difficult to modify for simulating phenomena
• An energy-based approach to multiple-fluid simulation, ex- such as chemical reactions. Our work expands the capability of the
tending the capability of multiple-fluid simulation to create original model to handle a much wider field of multiple-fluid phe-
new effects such as extraction and partial dissolution. nomena and is based on the popular particle frameworks, SPH and
• An expanded view of the Cahn-Hilliard equation for phase PBD.
separation, making it possible to simulate complex fluid-fluid
interaction and rich visual phenomena by generalizing the for- In fluid simulation, enforcing incompressibility has always been a
mulation and introducing innovative applications of the ex- crucial problem. Standard SPH uses a stiff equation, originating
tended model. in ideal gas theory. Compared to the standard approach, weak-
ly compressible SPH (WCSPH) [Becker and Teschner 2007] pro-
• Practical integrations of the multiple-fluid method into both vides a more precise pressure estimate. Both methods require lim-
traditional SPH and PBD frameworks, achieving real-time ited time steps. Using an iterative Jacobi-style method to accu-
multiple-fluid simulation, at least 4 times faster than the state- mulate pressure changes, predictive-corrective incompressible SPH
of-the-art multiple-fluid simulation method. (PCISPH) [Solenthaler and Pajarola 2009] achieves good incom-
pressibility with large time steps. Local poisson SPH (LPSPH) [He
Our paper is organized as follows. First we review related works et al. 2012] accumulates position and velocity instead of pressure.
in Section 2. We then introduce the models and theories in Section Ihmsen et al. [2013] introduce the implicit incompressible SPH (I-
3 and 4. Details of implementation can be found in Section 5. We ISPH) to overcome the incapability of imcompressible SPH (ISPH)
illustrate our work with examples in Section 6. Finally, limitations (e.g., [Commins and Rudman 1999; Shao and Lo 2003]) in large-
and future works are discussed in Section 7. scale scenarios. Hybrid methods, like fluid implicit-particle (FLIP)
[Brackbill and Ruppel 1986] combine the advantages of grid and
2 Related Work particle based methods by using a grid for pressure and particles
for advection. Zhu et al. [2005] extend FLIP to simulate incom-
pressible fluids and Raveendran et al. [2011] solve an approximate-
Multiple-fluid simulation has been extensively investigated during
ly divergence-free velocity field using a coarse grid. Cornelis et al.
the last decade. To simulate immiscible fluids, Premǒze et al.
[2014] combined IISPH and FLIP to inherit from their advantages.
[2003] adopted the moving-particle semi-implicit (MPS) approach.
Solenthaler and Pajarola [2008] improved the standard SPH method The position based dynamics framework was first introduced to
to deal with density contrast more precisely. Amongst Eulerian ap- computer graphics by Müller in [2007]. This method operates on
proaches, the level-set method, the volume-of-fluid (VOF) method, vertices or particles’ positions directly via constraints. It accumu-
and the finite element method are widely used for interface tracking lates position changes via a Gauss-Seidel iteration to ensure its sta-
between phases or components [Hong and Kim 2005; Losasso et al. bility. Macklin and Müller [2013] have shown that PBD can be used
2006; Kim 2010; Boyd and Bridson 2012; Misztal et al. 2012]. to simulate fluids. Borrowing the idea of a density estimator from
As for miscible fluids, Müller et al. [2005] introduced the concept SPH ([Monaghan 1992; Monaghan 1994]), fluid incompressibility
of volume fraction to represent the spatial distribution of different is enforced with a density constraint [Bodin et al. 2012]. Position
phases or components. Kang et al. [2010] and Bao et al. [2010] based fluids (PBF) provides another choice for fluid simulation via
applied volume fractions to a grid-based solver to achieve desired a particle system. Compared to plain SPH, it enforces incompress-
mixing effects. Liu et al. [2011] and Ren et al. [2014] proved ibility achieving similar performances of modern SPH solvers e.g.,
that the concept of volume fraction can be integrated into an SPH PCISPH, IISPH. Most recently, Macklin et al. [2014] established a
solver. Nielsen and Østerby [2013] borrowed the concept of vol- unified dynamic framework, which can be used to simulate a wide
ume fraction to simulate spray in the Eulerian domain. Kang et al. range of physical phenomena, including immiscible multi-fluids, in
[2010], Bao et al. [2010] and Liu et al. [2011] took cells or particles a universal manner. However, their methods cannot be directly ap-
composed of different phases or components as a whole mixture plied to miscible fluid simulations.
moving at the same bulk velocity, and therefore mixing due to con-
centration differences only. To capture the underlying interactions 3 Particle Based Solvers
between phases due to flow motions and force distributions, Ren
et al. [2014] took the drift velocity of different phases or compo-
nents into consideration. This approach captures a wider range of 3.1 The Smoothed Particle Hydrodynamics Method
multiple-fluid phenomena and can be easily set up. However, their
method is not energy-driven and cannot handle many real-world SPH is an interpolation method which is widely used in particle
phenomena as illustrated in our work. They also use WCSPH, and systems. According to standard SPH, a scalar quantity Ai of i-th
minimizing compressibility will in turn limit the time-steps, making particle at position ri is interpolated by the weighted sum of known
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
Fast Multiple-Fluid Simulation Using Helmholtz Free Energy • 201:3
The PBD method has been adopted in many simulation fields since To overcome particle under-sampling, which is a common problem
the work by Müller et al. [2007]. Maclin and Müller [2013] extend- in SPH simulation, an artificial pressure term [Monaghan 2000] is
ed this method to fluid simulation. Following the work by Bodin et introduced. This additional term improves the simulation perfor-
al. [2012], the density constraint on the i-th particle is defined as mance while not being purely physical. Undesired damping can
follows: also be introduced to the PBD framework too. To deal with this
ρi problem, the vorticity confinement method introduced by Fedkiw
Ci = − 1. (5)
ρ0 et al. [2001] and extended by Hong et al. [2008] and Lentine et al.
The position of the i-th particle is iteratively adjusted to satisfy the [2011] is adopted. The XSPH method [Monaghan 1989; Schechter
density constraint. The i-th particle’s position change in one iter- and Bridson 2012] is also adopted to provide better particle distribu-
ation ∆ri lies along the direction of constraint gradient, and the tions in the simulation. We refer readers to the literature [Macklin
position change follows: and Müller 2013] for more information on position based fluids.
∂c
+ ∇ · (cu) = ∇ · (M ∇µ), (10)
∂t
where c is the order parameter that represents the relative concen-
tration of one of the phases or components. We take this to be the
mass ratio of one of the phases or components in a heterogeneous
mixture. M is the degenerate mobility, which can be constant or
may vary according to the value of c. In our implementation, we
define M in a way that does not rely on c. µ is the chemical poten-
tial. In the case of two-phase flows, it can be calculated as:
∂ε(c) Figure 2: The effect of surface tension force. The surface tension
µ= , (11) coefficient is set to be a large value in order to obtain notable re-
∂c
sults. Left: initial state; Right: final state after driven by SF .
where ε(c) is the so-called Ginzburg-Landau free energy density:
The β(c) term can be taken according to Garcke et al. [1998] as:
2 2
ε(c) := F (c) + ∇c , (12)
2 1 X ∂F
β(c) = − . (19)
n ∂ck
k
where Ω is the domain occupied by the system. F (c) is the
Helmholtz free energy. The form of F (c) plays a key role in simula-
As M does not rely on c, it is not difficult to verify that the ex-
tions of various multiple-fluid phenomena, which we will discuss in
istence of β(c) makes the summed change of ck zero, ensuring
detail in §4.2. is associated with diffuse-interfaces and can be van-
physical meaningfulness during the fraction change process. How-
ishingly small describing immiscible fluids. The Ginzburg-Landau
ever, in our experiments, Eqn (18) cannot always be satisfied due to
free energy is the sum of two distinct parts: bulk part, which is inde-
numerical errors and discretization. We adopt a correction process
pendent of the spatial derivatives of phase quantities; and interfacial
according to the work by Ren et al. [2014].
part, which depends on the spatial gradient of the phase variable. In
L2 space, combining Eqn (11) and Eqn (12), the formulation of The reactive stress term can be set according to Kim [2009] as:
chemical potential can be expressed as: X σk,l
SF = sf (ck ) + sf (cl ) χ(ck , cl ), (20)
dF (c) 2
µ= − 2 ∇2 c. (13) k,l(l>k)
dc
where σk,l is the
√ surface tension coefficient between phase k and l.
∇ck
Cahn-Hilliard equation is well-known for its properties of energy sf (ck ) = −6 2∇ · |∇c k |
|∇ck |∇ck and χ(ck , cl ) = 5ck cl .
dissipation and mass conservation when the natural no-flux bound- Eqn (20) is known as the generalized continuous surface tension
ary conditions are used. force proposed to avoid the solvability problem imposed by the
over-determined system [Boyer and Lapuerta 2006]. The effect of
According to Badalassi et al. [2003], Jacqmin [2000], and Kim this surface tension term is illustrated in Fig.2, where the tension
[2005; 2007; 2012], the equations of NSCH for an n-phase fluid force minimizes the surface areas and slows the diffusion between
are: phases (resulting sharper interfaces).
5 Implementation
We introduced the ideas of particle based simulations (SPH and
PBF) and NSCH respectively in Sections 3 and 4. In this sec-
tion, we provide practical integration implementations. Inspired by
Macklin and Müller [2013] and Ren et al. [2014], we update every
particle’s mass ratio first in each time step and then apply the effects
Figure 3: Contour plot of the Helmholtz free energy on the Gibbs
of the extra reactive stress along with the viscosity. Our PBD based
triangle. Each point in this triangle relates to a state in which the
algorithm is outlined in Algorithm 1.
local fluid contains the corresponding fraction of each of the three
phases. Values of Helmholtz free energy in each state are color-
plotted (red for high energy and blue for low). The two minima in Algorithm 1 Simulation Loop
this plot correspond to the final stable states. 1: for all particles i do
2: apply external forces to predict position
3: end for
this energy plot. By setting s1 , s2 to different values, this energy 4: for all particles i do
function can be adopted to simulate different two-phase phenome- 5: find neighboring particles
na. For example, to generate the process of phase separation, s1 , s2 6: end for
are set to 0, while they are set to 0.5 in order to capture the opposite 7: for all fluid particles i do
phenomenon of complete dissolution. The liquid partial dissolu- 8: for each phase k do
tion (Fig.7) happens when two miscible fluids cannot be arbitrari- 9: apply Cahn-Hilliard equation
ly mixed and have fully-saturated fraction limits within each oth- 10: end for
er. This will lead to the formation of two separated fully-saturated 11: end for
mixtures with different phases as solvent. In our experiments, this 12: while iter<solverIterations do
phenomenon can be captured by placing two local minima in the 13: accumulate position changes via density constraint
energy plot at the corresponding saturation points, i.e., simply set- 14: end while
ting s1 = s2 = 0.4 in our example. 15: for all particles i do
16: update velocity
For three-phase fluids the energy plot becomes a Gibbs triangle. 17: apply vorticity confinement, viscosity and reactive stress
In Fig.3, each vertex represents the state in which the local fluid 18: update position
contains only a single phase, and each point in the triangle repre- 19: end for
sents a mixed state with corresponding fractions of each of the three
phases. The Helmholtz energy function defined on this triangle is
Most of our implementations are based on Algorithm 1 in order
color-plotted. In this case we use an energy equation describing
to take advantage of enforcing incompressibility and stability with
chemical extraction phenomena as follows:
large time steps. The accuracy of Algorithm 1 will be discussed in
§5.1.
F (c) = α c21 (c1 −0.3)2 +(c2 −0.7)2 (c2 −0.5)2 +c23 (c3 −0.5)2 .
(22) The NSCH model can also be readily integrated with standard SPH
solvers. In our experiments, we take this energy-driven Cahn-
The two minima of F (c) are (0.3, 0.7, 0), (0, 0.5, 0.5). As can be Hilliard equation as a phase diffusion process and apply it before
observed in Fig.3, the state with phase A dissolved in phase C has the main process of SPH in every time step. Ren et al. [2014] add
a lower energy minimum than the state with phase A dissolved in a pressure correction step after the update of volume fraction. It
phase B, so when C is added to the mixture of A and B, it will brings more physical basis during the volume fraction change pro-
extract A from B, resulting in a mixture of A and C separated from cess and can potentially provide better incompressibility. Since we
a nearly-pure phase B. do not consider phase-related drift velocity and pressure, and as a
result Eqn (15) can be applied to handle incompressibility, it is not
Some important principles should be followed when designing en- necessary to include such a correction step for achieving plausible
ergy functions: (1) The partial derivative of the chemical potential visual simulation.
with respect to a certain phase should be related to the mass ratio of
this phase only, otherwise mass conservation can be broken and un-
expected phases would appear at undesired places. (2) The minima 5.1 SPH Formulation
of energy functions should locate within the area of Gibbs triangle
to ensure the stability of the final states. Eqn (2) is commonly used in particle systems for density calcula-
tion of particles. Solenthaler and Pajarola [2008] provided a mod-
By placing minima at different positions in the Gibbs triangle and ification to simulate immiscible multiple-fluids with high density
adjusting their energy values, the interactive behavior of the three ratio. Their method uses the adapted density:
phases can be intuitively designed for flexible simulation. X
ρ̃i = mi Wij . (23)
For cases containing more than 4 phases, the basic idea of design- j
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
201:6 • T. Yang et al.
where k indexes the set of phases. It is not difficult to verify that where x, y indicate the components of vector. Following the work
the above average using mass fraction values is equivalent to linear by Monaghan [1992], the (x, y)’s component of D̃ of i-th parti-
average using the volume fraction values. cle can be computed in particle systems using standard SPH style
estimator:
The aggregate viscosity can be handled in a similar way as in the
original NSCH model. However, in our experiments, this method is
a simple but imperfect choice. To estimate the viscosity of a mix-
ture more precisely, we choose the Refutas method [Maples 2000] 1 X mj
(D̃x,y )i = (uij )x ∇y Wij + (uij )y ∇x Wij , (34)
which has been commonly used in engineering calculations instead. 2 j ρj
To calculate the viscosity of a mixture, a viscosity blending number
(VBN) of each phase should first be calculated as follows:
where (uij )x , ∇x Wij are the x’s components of uij and ∇Wij .
V BNk = 14.534 × log log(νk + 0.8) + 10.975, (28)
The extended mobility in Eqn (31) is related to the shear rate which
then the VBN of the mixture is: is rotationally invariant. In practice, we set the threshold in Eqn (31)
X
V BN = ck V BNk , (29) to a sufficiently large value, minimizing the value of mobility when
k
the magnitude of strain rate is (close to) zero to prevent unexpected
mixing under slight disturbance. There also exists a numerical up-
finally, the viscosity of the mixture is estimated below: per bound in Eqn (31), which is critical to ensure numerical stability
V BN − 10.975 especially when the shear rate is too high. Desired visual results are
ν = exp exp( ) − 0.8. (30) achieved when simulating motion-related mixing phenomena such
14.534
as egg-mixing shown in Fig.1.
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
Fast Multiple-Fluid Simulation Using Helmholtz Free Energy • 201:7
Using our energy driven multiple-fluid solver, the final stable states
can be intuitively designed by placing local minima of free ener-
gy functions at different positions in the energy plot or the Gibbs
triangle for two- or three-phase fluids respectively, as discussed in
§4.2. Helmhotz free energy functions are typically designed with
pre-settled final states which are user-defined constants. We extend
this design formulation to generate interesting visual patterns.
Since the stable states vary in space, this would bring some nu-
merical effects to the NSCH equations. Substituting Eqn (35) to Figure 5: Performance Comparison. From left to right, two liquids
Eqn (17), then Eqn (16) gives: (Red and Blue) mix and then unmix in a hourglass. All three im-
plements achieve similar results. Top: PBD based NSCH; Middle:
Dck WCSPH based NSCH; Bottom: [Ren et al. 2014].
= ∇ · (M ∇µ̃k ) − 2α∇ · (M ∇sk ), k ∈ {1, 2}, (36)
Dt
where µ̃k = 2αck −2 ∇2 ck +β(c), which is irrelevant to sk . If sk 5.5 Chemical Reaction
is constant, the second term of the right side of Eqn (36) vanishes.
If sk varies in space as discussed above, this term matters. The Visualization of a chemical reaction can also be a practical exten-
effect of this non-vanishing term in this section depends on how sk sion of our method. Owing to the convenience of the mass fraction
is set in space and it can accelerate or slow P the diffusion process representation, this phenomenon can be simply handled by adding
compared to previous vanishing cases. Since k sk = 1, this non- an in-particle re-balance step in every time step [Ren et al. 2014].
vanishing term accelerates the diffusion of some phases but slows Since Helmholtz free energy is associated with phase variables, it
that of others. All in all, it steers phases to the final result resting in matters how we label the newly generated phases. In our experi-
desired patterns. ments, phases that take part in a chemical reaction as reactants are
considered to be within the same group, and each newly generated
As shown in Fig.4, our extended method can also be used to ob-
phase is considered to be within a separate group. This labeling
tain colored patterns rather than just gray ones. To obtain colored
simplifies the designing work for energy functions and prevents the
patterns, we assume there exist 4 different phases. The RGB color
unexpected diffusions between reactants and products.
(R, G, B) of each pixel in the image is used to represent the target
mass fraction:
5.6 Boundary Condition
R G B R+G+B
s1 = , s 2 = , s 3 = , s 4 = 1 − , (37)
3 3 3 3 We use particles to represent anomalous boundaries. Thus, it is crit-
ical to prevent fluid particles penetrating and clustering. Akinci et
al. [2012] provided a versatile rigid-fluid coupling approach using
where R, G, B ∈ [0, 1]. With a generalization of Eqn (35), the per-particle correction. We adopt this method in our SPH based im-
energy function can be chosen as: plementation. However, as discussed in the work by Macklin et al.
X [2014], there are no explicit pressure forces existing in the original
F (c) = α (ck − sk )2 , k ∈ {1, 2, 3}. (38) PBF. To solve this problem, we treat the boundary-fluid pressure
k and friction forces computed according to Akinci et al. [2012] as
part of external forces in our implementations. Typical penetrat-
ing and clustering problems can be avoided in our experiments as
We only use c1 , c2 , c3 to represent colors. The numerical effects shown in all examples.
are just the same as discussed previously.
Boundary particles do not take part in the phase diffusion process.
Position based patterns are commonly observed phenomena e.g., No boundary particles are considered in line 9 of Alg.1 where E-
water eutrophication and electrolyte solution. We provide a flexible qn.(16) is applied. This no-flux boundary conserves both the total
and reasonable approach to artistically control their behaviors. and phases’ masses.
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
201:8 • T. Yang et al.
Implementation & Visual Comparison: Our method can be im- Hourglass PBD 2 134k 4 68.9
plemented with both SPH and PBD frameworks. Although the WCSPH 2 134k 16 133.3
work by Ren et al. [2014] can also be readily integrated into SPH [Ren et al. 2014] 2 132k 16 566.8
Fluid Extraction: Example 1 (Fig.6) shows that our model can In this paper, we have presented an energy based method to simu-
be used to simulate the energy-driven process of extraction. The late multiple-fluid phenomena. The results show that our method
energy function is set to Eqn (22). In the beginning, a blue liquid produces visually plausible results while expanding the capability
and a mixture of red and green liquids (shown as a yellow liquid) of existing models. Examples like fluid extraction and particle dis-
are initialized in a separating funnel. The green liquid has greater solution are beyond the capability of previous methods that we are
solubility in the blue liquid than in the red one. Thus, after vigorous aware of. Real-world phenomena like modeling and simulation of
mixing, the blue liquid extracts the green liquid out of the red liquid, mixtures of water and oil, visual simulation of mud sliding, sed-
resulting in a layer of red liquid on top of a cyan mixture. imentation processes, and avalanches due to natural disasters are
highly correlated with energy. These are real-world scenarios in
Partial Dissolution: Example 2 (Fig.7) is an example of partial which our work could be useful, offering several further possible
dissolution from chemistry. The energy function is set to Eqn (21) extensions. Our method can be readily integrated with state-of-
where s1 = s2 = 0.4. From left to right, the same volume of blue the-art SPH solvers, showing its potential for various applications.
liquid is used for each of the 3 cases while the volume of red liquid Offering practical integration with PBD framework, this approach
doubles each time. The results show that when the volume of one is more flexible and stable with larger time steps than traditional
of the liquids, either red or blue, is greater than the other, the two SPH-based methods.
liquids generate a homogeneous one-phase mixture at the end. If
both liquids are saturated with the other, they generate two separate As discussed in §5.1, our method suffers from slow convergence,
fully-saturated mixtures. which is the result of the bi-Laplacian formulation, discretization,
and PBD. Although our method can ensure stable simulations with
Egg Mixture: Example 3 (Fig.1) demonstrates that the capability large time steps, special attention is required to avoid the occur-
of the NSCH model can be expanded via extended mobility using rence of negative values of c as much as possible, i.e., the time
an everyday example of mixing egg white and egg yolk. Unlike steps and the Helmhotz free energy should be chosen in a way to
other examples where the mobilities are constant, we use the ex- ensure that the changes of c during a single step do not exceed the
tended mobility discussed in §5.3. And the energy function is set values of c. In our experiments, negative values of c do exist due
to Eqn (21) where s1 = s2 = 0.5. The mixture of egg white and to discretization, numerical errors, and casually chosen parameters.
egg yolk at any mass fraction remains stable when it is still. When The simulations can stay stable with our correction process as men-
slightly shaking or rotating the bowl as a whole, there is no obvious tioned in §4.1, althrough they will lose the capability of conserving
mixing. However, when stirring the mixture with a whisk, the local the masses of phases.
shear rate becomes significant, resulting in strong mixing.
Ignoring the drift velocity simplifies the implementation, analysis,
Multiple Liquids & Chemical Reaction: Example 4 (Fig.8) and control, enabling better performance, e.g., incompressibility as
demonstrates the ability of our approach to deal with simulations discussed in §5. However, without the drift velocity, our method
with more than 3 phases as well as to simulate the phenomena of inevitably loses some capabilities. For instance, in the process of
chemical reactions. There are 5 dambreaks at the beginning and 7 unmixing, different phases separate at every corner of the simula-
phases in total. We adopt the phase labeling method to divide them tion domain simultaneously and then form layers driven by gravity
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
Fast Multiple-Fluid Simulation Using Helmholtz Free Energy • 201:9
Figure 6: Fluid extraction. From left to right,(a) At the beginning, the blue liquid and yellow mixture are put in a separating funnel. (b) The
funnel is inverted. (c) Shaking vigorously mixes the fluids. (d) Turning the funnel upright results in a clear interface between a red liquid and
a cyan mixture. Due to greater solubility of the green liquid within the blue liquid, the blue liquid extracts the green liquid from the red liquid.
The whole process is driven by Helmholtz free energy and conserves volume.
Figure 7: Partial dissolution. From top to bottom, three different cases are initialized with the same volume of green liquid and different
volumes of red liquid. From left to right, all three cases illustrate the process of dambreak and mixing with a yellow stick. The final states
in the three cases are very different because of fully-saturated fraction limits. In the first case, there is more blue liquid, and the red liquid
dissolves into the blue liquid completely. In the second case, both the red and blue liquids are comparable in volume, and each partially
dissolves in the other. In the third case, there is more red liquid, and the blue liquid completely dissolves in the red liquid. Both first and third
cases result in homogeneous mixtures while the second produces two fully saturated mixtures.
Figure 8: Multiple-fluid simulation. Our model can easily be adopted to simulate fluids with an arbitrary number of phases as well as handle
phenomena of chemical reactions. From left to right in the first image: The first and second simulations of dambreaks with 3 phases are in
a group and present the process of extraction, the middle two simulations of dambreaks achieve the visual effects of chemical reaction and
generate a new green phase, and the last dambreak is independent with other phases.
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
201:10 • T. Yang et al.
and buoyancy with our method. This whole process differs from B OYD , L., AND B RIDSON , R. 2012. MultiFLIP for Energetic
real-world layering, e.g., sedimentation. Furthermore, with the drift Two-Phase Fluid Simulation. ACM Transactions on Graphics
velocity, different phases move at different velocities in the mixture. (Proceedings of SIGGRAPH 2012) 31, 2 (Apr.), 16:1–16:12.
These discrepant motions play a key role in the process of motion-
induced mixing, resulting in relative mass migration. However, this B OYER , F., AND L APUERTA , C. 2006. Study of a three component
motion-induced mixing cannot be well addressed without the drift Cahn-Hilliard flow model. ESAIM:M2AN 40, 4, 653–687.
velocity, and this points out the essential reason for the slow diffu- B RACKBILL , J. U., AND RUPPEL , H. M. 1986. FLIP: A method
sion with our method apart from the slow convergence as mentioned for adaptively zoned, particle-in-cell calculations of fluid flows
above. We hope to take the drift velocity into consideration in the in two dimensions. Journal of Computational Physics 65, 2,
future. 314–343.
The aggregate viscosity is crucial for real-world simulation. We C AHN , J. W., AND H ILLIARD , J. E. 1958. Free Energy of
have introduced the Refutas method, which is simple and plausi- a Nonuniform System. I. Interfacial Free Energy. Journal of
ble. However, this issue is much more complex than discussed, i.e., Chemical Physics 28, 2, 258–267.
the viscosities of non-Newtonian fluids are mostly shear-dependent,
however we haven’t taken this into account. It deserves more efforts C OMMINS , S., AND RUDMAN , M. 1999. An SPH Projection
and further research. Method. Journal of Computational Physics 152, 2, 584–607.
The PBD framework enables the use of large time steps which are C ORNELIS , J., I HMSEN , M., P EER , A., AND T ESCHNER , M.
critical for real-time simulation. Our method can offer simulation in 2014. IISPH-FLIP for incompressible fluids. Computer Graph-
real time but the results require computationally expensive volume ics Forum (Proceedings of Eurographics 2014) 33, 2, 255–262.
rendering. We hope to develop a real-time multiple-fluid rendering DA , F., BATTY, C., AND G RINSPUN , E. 2014. Multimaterial
technique in the future. Mesh-Based Surface Tracking. ACM Transactions on Graphics
(Proceedings of SIGGRAPH 2014) 33, 4, 112:1–112:11.
Nielsen and Østerby [2013] simulated spray in the Eulerian domain
using a two-continua approach, which treats mist in a miscible fluid F EDKIW, R., S TAM , J., AND J ENSEN , H. W. 2001. Visual Simu-
kind of way. It would be practical to combine their work with ours. lation of Smoke. ACM Transactions on Graphics (Proceedings
of SIGGRAPH 2001), 15–22.
We note that temperature plays important roles in multiple-fluid
simulation. We aim to take into consideration the further expan- G ARCKE , H., N ESTLER , B., AND S TOTH , B. 1998. On Anisotrop-
sion of the simulation range for multiple-fluid in the future. ic Order Parameter Models for Multi-Phase Systems and Their
Sharp Interface Limits. Physica D: Nonlinear Phenomena 115,
1-2, 87–108.
Acknowledgements
H E , X., L IU , N., WANG , H., AND WANG , G. 2012. Local Poisson
We would like to thank Sarah George-Waterfield and Ehtzaz SPH For Viscous Incompressible Fluids. Computer Graphics
Chaudhry for helping to proofread the final version of this pa- Forum 31, 6, 1948–1958.
per. We also thank the anonymous reviewers for their construc-
H IRSCHLER , M., H UBER , M., S ÄCKEL , W., K UNZ , P., AND
tive comments. This work is supported in part by the Ministry of
N IEKEN , U. 2014. An Application of the Cahn-Hilliard Ap-
Education of the People’s Republic of China, the EU project Dr.
proach to Smoothed Particle Hydrodynamics. Mathematical
Inventor (FP7-ICT-2013.8.1 611383), and the U.S. National Sci-
Problems in Engineering 2014(694894):10.
ence Foundation. The earlier research leading to this project al-
so received funding from the People Programme (Marie Curie Ac- H ONG , J.-M., AND K IM , C.-H. 2005. Discontinuous Fluids. ACM
tions) of the European Unions Seventh Framework Programme F- Transactions on Graphics (Proceedings of SIGGRAPH 2005)
P7 (2007-2013) under REA grant agreement No.612627-“AniNex”, 24, 3 (July), 915–920.
and University of North Carolina Arts & Sciences Foundation.
H ONG , J.-M., L EE , H.-Y., YOON , J.-C., AND K IM , C.-H. 2008.
Bubbles Alive. ACM Transactions on Graphics (Proceedings of
References SIGGRAPH 2008) 27, 3 (Aug.), 48:1–48:4.
A KINCI , N., I HMSEN , M., A KINCI , G., S OLENTHALER , B., AND I HMSEN , M., C ORNELIS , J., S OLENTHALER , B., H ORVATH , C.,
AND T ESCHNER , M. 2013. Implict Incompressible SPH. IEEE
T ESCHNER , M. 2012. Versatile Rigid-Fluid Coupling for In-
compressible SPH. ACM Transactions on Graphics (Proceed- Transactions on Visualization and Computer Graphics 20, 03
ings of SIGGRAPH 2012) 31, 4, 62:1–62:8. (July), 426–435.
I HMSEN , M., O RTHMANN , J., S OLENTHALER , B., KOLB , A.,
BADALASSI , V. E., C ENICEROS , H. D., AND BANERJEE , S. AND T ESCHNER , M. 2014. SPH Fluids in Computer Graphics.
2003. Computation of multiphase systems with phase field mod- In Eurographics 2014 - State of the Art Reports, The Eurograph-
els. Journal of Computational Physics 190, 2, 371–397. ics Association, 21–42.
BAO , K., W U , X., Z HANG , H., AND W U , E. 2010. Volume frac- JACQMIN , D. 1999. Calculation of Two-Phase Navier-Stokes
tion based miscible and immiscible fluid animation. Computer Flows Using Phase-Field Modeling. Journal of Computational
Animation and Virtual Worlds 21, 3-4 (May), 401–410. Physics 155, 1, 96–127.
B ECKER , M., AND T ESCHNER , M. 2007. Weakly compressible JACQMIN , D. 2000. Contact-line dynamics of a diffuse fluid inter-
SPH for free surface flows. In Proceedings of SCA ’07, 209–217. face. Journal of Fluid Mechanics 402, 01, 57–88.
B ODIN , K., L ACOURSI ÉRE , C., AND S ERVIN , M. 2012. Con- K ANG , N., PARK , J., N OH , J., AND S HIN , S. Y. 2010. A Hybrid
straint Fluids. IEEE Transactions on Visualization and Comput- Approach to Multiple Fluid Simulation using Volume Fractions.
er Graphics 18, 3 (Mar.), 516–526. Computer Graphics Forum 29, 2, 685–694.
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015
Fast Multiple-Fluid Simulation Using Helmholtz Free Energy • 201:11
K IM , J. 2005. A continuous surface tension force formulation for M ÜLLER , M., H EIDELBERGER , B., H ENNIX , M., AND R ATCLIF -
diffuse-interface model. Journal of Computational Physics 204, F, J. 2007. Position Based Dynamics. Journal of Visual Com-
2, 784–804. munication and Image Representation 18, 2 (Apr.), 109–118.
K IM , J. 2007. A numerical method for the Cahn-Hilliard equation N IELSEN , M. B., AND Ø STERBY, O. 2013. A Two-Continua
with a variable mobility. Communications in Nonlinear Science Approach to Eulerian Simulation of Water Spray. ACM Transac-
and Numerical Simulation 12, 8, 1560–1571. tion on Graphics (Proceedings of SIGGRAPH 2013) 32, 4 (July),
67:1–67:10.
K IM , J. 2009. A generalized continuous surface tension force for-
mulation for phase-field models for immiscible multi-component PARK , J., K IM , Y., W I , D., K ANG , N., S HIN , S. Y., AND N OH ,
fluid flows. Computer Methods in Applied Mechanics and Engi- J. 2008. A Unified Handling of Immiscible and Miscible Fluids.
neering 198, 37-40, 3105–3112. Computer Animation and Virtual Worlds 19, 3-4 (September),
455–467.
K IM , B. 2010. Multi-Phase Fluid Simulations Using Regional
Level Sets. ACM Transactions on Graphics (Proceedings of SIG- P REMO ŽE , S., TASDIZEN , T., B IGLER , J., L EFOHN , A., AND
GRAPH Asia 2010) 29, 6 (Dec.), 175:1–175:8. W HITAKER , R. T. 2003. Particle-Based Simulation of Fluids.
Computer Graphics Forum 22, 3, 401–410.
K IM , J. 2012. Phase-Field Models for Multi-Component Fluid
R AVEENDRAN , K., W OJTAN , C., AND T URK , G. 2011. Hybrid
Flows. Communications in Computational Physics 12, 3, 613–
Smoothed Particle Hydrodynamics. In Proceedings of SCA ’11,
661.
33–42.
L ENTINE , M., A ANJANEYA , M., AND F EDKIW, R. 2011. Mass R EN , B., L I , C., YAN , X., L IN , M. C., B ONET, J., AND H U ,
and Momentum Conservation for Fluid Simulation. In Proceed- S.-M. 2014. Multiple-fluid SPH Simulation Using a Mixture
ings of SCA ’11, 91–100. Model. ACM Transactions on Graphics (Proceedings of SIG-
L IU , S., L IU , Q., AND P ENG , Q. 2011. Realistic simulation of GRAPH Asia 2014) 33, 5 (Aug.), 171:1–171:11.
mixing fluids. The Visual Computer 27, 3 (Mar.), 241–248. S CHECHTER , H., AND B RIDSON , R. 2012. Ghost SPH for Ani-
L OSASSO , F., S HINAR , T., S ELLE , A., AND F EDKIW, R. 2006. mating Water. ACM Transactions on Graphics (Proceedings of
Multiple Interacting Liquids. ACM Transactions on Graphics SIGGRAPH 2012) 31, 4, 61:1–61:8.
(Proceedings of SIGGRAPH 2006) 25, 3 (July), 812–819. S HAO , S., AND L O , Y. 2003. Incompressible SPH method for sim-
ulating Newtonian and non-Newtonian flows with a free surface.
M ACKLIN , M., AND M ÜLLER , M. 2013. Position Based Fluid-
Advances in water resources 26, 7, 787–800.
s. ACM Transactions on Graphics (Proceedings of SIGGRAPH
2013) 32, 4 (July), 104:1–104:12. S OLENTHALER , B., AND PAJAROLA , R. 2008. Density contrast
SPH Interfaces. In Proceedings of SCA ’08, 211–218.
M ACKLIN , M., M ÜLLER , M., C HENTANEZ , N., AND K IM , T.-
Y. 2014. Unified Particle Physics for Real-Time Application- S OLENTHALER , B., AND PAJAROLA , R. 2009. Predictive-
s. ACM Transactions on Graphics (Proceedings of SIGGRAPH corrective incompressible SPH. ACM Transactions on Graphics
2014) 33, 4, 153:1–153:12. (Proceeding of SIGGRAPH 2009) 28, 3, 40:1–40:6.
M APLES , R. E. 2000. Petroleum Refinery Process Economics. Z HU , Y., AND B RIDSON , R. 2005. Animating Sand as a Flu-
PennWell Books. id. ACM Transactions on Graphics (Proceedings of SIGGRAPH
2005) 24, 3, 965–972.
M ISZTAL , M., E RLEBEN , K., BARGTEIL , A., F URSUND , J.,
C HRISTENSEN , B., BARENTZEN , J., AND B RIDSON , R. 2012.
Multiphase Flow of Immiscible Fluids on Unstructured Moving
Meshes. In Proceedings of SCA ’12, 97–106.
M ONAGHAN , J. J. 1989. On the problem of penetration in particle
methods. Journal of Computational Physics 82, 1, 1–15.
M ONAGHAN. 1992. Smoothed Particle Hydrodynamics. Annual
Review of Astronomy and Astrophysics 30, 1, 543–574.
M ONAGHAN. 1994. Simulating Free Surface Flows with SPH.
Journal of Computational Physics 110, 2 (Feb.), 399–406.
M ONAGHAN. 2000. SPH without a Tensile Instability. Journal of
Computational Physics 159, 2 (Apr.), 290–311.
M ORRIS , J., F OX , P., AND Z HU , Y. 1997. Modeling Low
Reynolds Number Incompressible Flows Using SPH. Journal
of Computational Physics 136, 1, 214–226.
M ÜLLER , M., C HARYPAR , D., AND G ROSS , M. 2003. Particle-
Based Fluid Simulation for Interactive Application. In Proceed-
ings of SCA ’03, 154–159.
M ÜLLER , M., S OLENTHALER , B., K EISER , R., AND G ROSS , M.
2005. Particle-Based Fluid-Fluid Interaction. In Proceedings of
SCA ’05, 237–244.
ACM Transactions on Graphics, Vol. 34, No. 6, Article 201, Publication Date: November 2015