You are on page 1of 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/323267659

Lattice Gas Cellular Automata for Fluid Simulation

Chapter · February 2018


DOI: 10.1007/978-3-319-08234-9_184-1

CITATIONS READS

4 962

1 author:

Sicilia Judice
The University of Calgary
34 PUBLICATIONS 52 CITATIONS

SEE PROFILE

All content following this page was uploaded by Sicilia Judice on 19 February 2018.

The user has requested enhancement of the downloaded file.


L

Lattice Gas Cellular Automata Introduction


for Fluid Simulation
In recent decades, techniques based on physical
Sicilia Ferreira Judice models for the animation of natural elements, such
FAETERJ, Petropolis, Brazil as fluids (gas or liquid), have drawn the attention
of the researchers in computer graphics. The moti-
vation lies in the potential in the applications of
Synonyms these techniques as well as in the complexity and
beauty of the natural phenomena involved. In
Cellular automata; Fluid simulation; Lattice particular, techniques in the field of computational
methods; Numerical methods; Physics simulation fluid dynamics (CFD) have been implemented for
fluid animation.
Numerical methods in DFC for fluid simula-
tion, such as finite differences and finite elements
Definitions
(Hughes 1987), try to describe a continuous sys-
tem through the discretization of the equations
• Cellular automata
that represent it. However, such methods have a
Mathematical models based on simple and
high computational cost. Another alternative in
local rules capable of generating complex
this area is the use of techniques based on cellular
behaviors.
automata (Wolfram 1994; Sarkar 2000; Kari
• Computational fluid dynamics (CFD)
2005). Such methods seek to obtain the macro-
Area of knowledge that studies computa-
scopic dynamics of the fluid through the collective
tional methods to solve problems in fluid
behavior of numerous microscopic particles. The
dynamics.
specific cellular automata to simulate fluids are
• FHP
called lattice gas cellular automata (LGCA) and
A specific cellular automata model to sim-
follow this idea by simplifying the dynamics
ulate fluid dynamics.
through simple local rules for the interactions
• Lattice gas cellular automata (LGCA)
and displacement of the microscopic particles.
Cellular automata that simulates specifi-
While traditional CFD modeling attempts to
cally fluid problems.
represent a continuous medium starting from mac-
roscopic variables and partial differential equa-
tions (PDE), the LGCA modeling follows the
inverse path, that is, from the microscopic
# Springer International Publishing AG 2018
N. Lee (ed.), Encyclopedia of Computer Graphics and Games,
https://doi.org/10.1007/978-3-319-08234-9_184-1
2 Lattice Gas Cellular Automata for Fluid Simulation

description based on simple rules, it tries to obtain


the macroscopic behavior (bottom up) without,
however, explicitly solving any system of PDE
(Chopard and Droz 1998). The macroscopic
behavior is obtained through computational sim-
ulation, based on the set of rules governing the
system, and simple interpolations.
LGCA can be seen as a simplified universe.
Space is represented by a uniform lattice, where
each cell contains Boolean data, the time step is
discrete, and the laws governing that universe are
expressed by simple rules of local collisions. They
are discrete models, based on particles whose
movement is restricted to the directions of the
lattice edges. These methods have a lower com-
putational cost and are more stable compared to
the traditional ones used in fluid simulation, due to
the fact that it is not necessary to calculate PDE to
obtain the desired level of physical realism
(Rothman and Zaleski 1997). Lattice Gas Cellular Automata for Fluid Simulation,
Among the varieties of automata of the LGCA Fig. 1 The lattice of FHP model
type, this article will talk about the FHP model for
its simplicity and computational efficiency (Chen et al. 1991) and granular media (Krolyi
(Chopard and Droz 1998). FHP was developed and Kertsz 1994), among others (Boghosian
to simulate two-dimensional fluids. The space is et al. 1996). In addition, from the analysis of
discretized in a hexagonal lattice, that is, in each FHP microdynamics, through multiscale tech-
lattice node, there are six possible directions of niques, it is possible to obtain the traditional
movement. In addition, a multiscale technique fluid dynamics equations (Appendix A) on a mac-
was applied in order to demonstrate that the FHP roscopic scale (Frisch et al. 1986). These facts
model is capable of reproducing Navier-Stokes motivate the study of FHP as an alternative meth-
behaviors for two-dimensional fluids (Frisch odology for fluid simulation.
et al. 1986). FHP is a two-dimensional model and can be
seen as an abstraction, on a microscopic scale, of a
fluid. The FHP describes the motion/interaction of
FHP Model particles in a discretized space in a hexagonal
lattice, as seen in Fig. 1.
The FHP model was introduced by Frisch, The microdynamics of FHP are given in terms
Hasslacher, and Pomeau (Frisch et al. 1986), of Boolean variables that describe the number of
where FHP represents the name initials of their occupancy at each node of the lattice at each
authors. It is a specific cellular automaton for fluid interaction step (i.e., the presence or not of parti-
simulation, known as lattice gas cellular automata. cle). The particles move in discrete time steps,
Although the LGCAs cannot compete with tradi- with a constant velocity in modulus, pointing
tional techniques of computational fluid dynam- along one of the six directions of the lattice. No
ics, particularly for high Reynolds numbers, more than one particle can move to the same
several authors have succeeded in using such lattice node, at a given instant, in a given direc-
models to simulate complex systems, for which tion. Such a constraint is called the exclusion
traditional techniques are difficult to apply principle, which ensures that six Boolean
(Chopard et al. 1998), such as porous media
Lattice Gas Cellular Automata for Fluid Simulation 3

Lattice Gas Cellular


Automata for Fluid
Simulation,
Fig. 2 Particle collisions in
the FHP model

variables for each lattice node are sufficient to The FHP Microdynamic
represent the microdynamics. The complete microdynamics of the FHP model
Each particle moves at a constant velocity in can be expressed by an evolution equation for the
modulus, in such a way that, in each interaction it occupation numbers, defined as the number ni(x,t)
traverses one edge of the lattice and reaches the of particles entering the node x at instant t with
neighboring node. In the absence of collisions, the velocity in the direction ci (Chopard and Droz
particles keep moving along the direction speci- 1998):
fied by their velocity vector. Collisions occur
    
when particles enter the same node at the same 2pði  1Þ 2pði  1Þ
ci ¼ cos , sin ,
instant, resulting in a new local distribution of 6 6
particle velocities. (1)
When exactly two particles are incident on the
same node with opposite velocities, both are where i = 1,. . .,6 represents the six possible direc-
deflected by an angle of 60 so that after the tions for each lattice node, as shown in Fig. 3.
collision a new configuration is also made with The numbers ni can be 0 or 1, that is, presence
zero momentum. Such a deviation may occur or not of particle in the ci direction of the lattice.
clockwise or counterclockwise, as shown in Also defined is the time step as Dt and the dis-
Fig. 2. For reasons of symmetry, the two possibil- placement between lattice nodes as Dx. Thus, the
ities are chosen randomly, with equal probability. six possible velocities vi of the particles are related
When exactly three particles with velocities at an to their directions of motion by:
angle of 120 collide, each of them returns,
toward the initial edge, as shown in Fig. 2. In Dx
vi ¼ ci : (2)
this way, the moment remains null and is therefore Dt
preserved. For other configurations, the particles
continue their movement as if there was no If there is no interaction between particles, the
collision. evolution equation for ni can be written as
(Chopard et al. 1998):
4 Lattice Gas Cellular Automata for Fluid Simulation

number of resultant particles in the ci direction due


to a collision of two particles along this direction.
However, when ni = 0, a new particle may
appear in direction ci, as a result of a collision
between ni + 1 and ni + 4 or a collision between
ni  1 and ni + 2. At this point, it is convenient to
introduce a random Boolean variable q(x, t),
whose value is used to decide whether a particle
will be reflected to the right (q = 1) or to the left
(q = 0). Thus, the number of particles created in ci
direction is given by:

Lattice Gas Cellular Automata for Fluid Simulation, qDi1 þ ð1  qÞDiþ1 : (5)
Fig. 3 Directions of movement in FHP lattice

For the case shown in Fig. 2 of a collision


ni ðx þ Dx ci , t þ Dt Þ ¼ ni ðx, tÞ: (3)
between three particles, they can be scattered,
with one of them occupying the direction ci. The
The Eq. 3 says that a particle entering the node
amount (T) expressing the occurrence of a colli-
x with velocity along ci will continue in a straight
sion between three particles ni, ni + 2, and ni + 4 can
line, in such a way that at the next instant it will
be obtained by following the same principles
enter the node x + Dxci with the same direction of
above, given by:
motion (Chopard et al. 1998). However, when a
collision occurs, one particle may be removed
T i ¼ ni niþ2 niþ4 ð1  niþ1 Þð1  niþ3 Þð1  niþ5 Þ:
from its original direction or may be diverted to
another. Let us look at the example of the collision (6)
described in Fig. 2, where exactly two particles
compete for the same node with opposite veloci- Analogous to the previous case, the result of a
ties (top of the figure). In this case, before the collision between three particles is modify the
collision, only n2 and n5 has 1 value in the number of particles in the direction ci. Thus, the
x node. After the collision, we have two possibil- number of resulting particles in ci direction, con-
ities: n1 and n4 or n3 and n6 will have 1 value. sidering the disappearance of a particle due to
Generalizing for the collision between two collision at position i or the appearance of a par-
particles with opposite velocities, the particle ticle due to collision at position i + 3 can be
moving with velocity vi before the collision will expressed by:
move with velocity vi  1 or vi + 1, after the
collision, where i = 1,. . .,6 (note that operations ni  T i þ T iþ3 : (7)
on the index i must return values between 1 and 6).
The binary quantity: Once the collision rules have been stipulated,
we can rewrite the Eq. 3 to the microdynamics of
Di ¼ ni niþ3 ð1  niþ1 Þð1  niþ2 Þð1  niþ4 Þ the FHP as:
ð1  niþ5 Þ
ni ðx þ Dx ci , t þ Dt Þ ¼ ni ðx, tÞ
(4)
þ Oi ðnðx, tÞÞ, (8)
indicates that a collision will occur when Di = 1.
In fact, if there is a particle in direction ci and where Oi is the collision term, defined from
one in direction ci + 3, the term nini + 3 will be 1. expressions (5) and (7):
Thus it suffices that there is no particle in the other
directions to ensure Di = 1. Thus ni  Di is the
Lattice Gas Cellular Automata for Fluid Simulation 5

Oi ¼ Di þ qDi1 þ ð1  qÞDiþ1  T i X


z
rðx, tÞuðx, tÞ ¼ vi N i ðx, tÞ: (12)
þ T iþ3 : (9)
i¼1

The Eq. 8 can be easily implemented, and the From these definitions and conservation laws,
FHP model can be efficiently simulated in a com- it is possible to estimate the macroscopic behavior
puter. More elaborate collision operators can be of the system. For this, the multiscale expansion
created by including collisions between four par- of Chapman-Enskog is used. The details of this
ticles or even by inclusion of a resting particle technique can be found in the work of (Frisch et al.
(Frisch et al. 1987). In general, the only constraint 1986). The result is the obtaining of mass and
imposed is that the collision operator Oi preserves Navier-Stokes conservation equations from the
P6 P6
microscopic dynamics of the FHP described in
the mass Oi ¼ 0 and the moment vi Oi ¼ 0:.
i¼1 i¼1 this section.

The Macroscopic Quantities


The physical quantities of interest are not the Cross-References
Boolean variables but the macroscopic quantities
or the mean values, such as density and linear ▶ Cascade Interactive Rendering for Water
momentum at a point in the system (Chopard ▶ Fluid Simulation
and Droz 1998). The distribution below corre-
sponds to the probability of having a particle in
the node x, at instant t, with velocity vi defined by Appendix A
the Eq. 2 (Chopard et al. 1998).
Mathematical Foundations
N i ðx, tÞ ¼ hni ðx, tÞi, i ¼ 1, . . . , 6: (10)
Conservation Laws
In general, an LGCA model is characterized by The most general conservation principles are the
the z number of directions for each node of the laws of mass conservation, moment, and the first
lattice and the spatial dimension d. For a rectan- and second laws of thermodynamics. Assuming
gular lattice with d = 2, we have z = 4, whereas that matter cannot be destroyed or created and
for a hexagonal lattice we have z = 6. In some despising sources, the amount entering a volume
models there is the addition of a direction (c0), element equals the quantity that exits plus the
where n0  {0, 1} will be the number of particles amount accumulated in the element. This princi-
at rest (v0 = 0) (Chopard and Droz 1998). ple can be expressed in terms of transfer rates:
Following the usual definition of statistical
mechanics, the local density of particles is the Input rate ¼ output rate þ accumulation rate:
sum of the means of microscopic variables
(expression 10): The following is a review of the principles of
mass conservation and movement. Initially, the
X
z
general expressions of these laws will be devel-
rðx, tÞ ¼ N i ðx, tÞ: (11)
i¼1
oped for scalar and vector fields and then applied
to the specific case of fluid mechanics.
Similarly, the linear momentum (ru) is given
by (Chopard and Droz 1998): Conservation Laws for Scalar Fields
Let U be a scalar quantity per unit volume, defined
in an arbitrary volume O, fixed in space, and
bounded by a closed surface S. The variation of
the local intensity of U occurs due to the flow
6 Lattice Gas Cellular Automata for Fluid Simulation

acting which expresses the contribution of the becomes a vector QV. Equations 15 and 16,
external medium to O and the Q sources. The respectively, assume the form (Hirsch 1988):
general form of the conservation law for the scalar
ð þ
quantity U can be written as (Hirsch 1988): @U
dO þ ∇  FdO
ð þ ð þ @t
@ O
ð
O
þ
UdO þ F  dS ¼ QV dO þ QS  dS: (13)
@t ¼ QV dO þ ∇  QS dO, (17)
O O S
O O
In Eq. 13, the first term to the left of the equal-
@U  
ity sign represents the U variation within the vol- þ ∇  F  QS ¼ QV : (18)
ume O per unit time. Such variation must be equal @t
to the contribution of external medium due to the
flow through the surface S, given by: Mass Conservation Equation
The partial differential equation that expresses
þ conservation of mass is also known as the conti-
 F  dS, (14) nuity equation. Applying the conservation law
given by the Eq. 15 for the particular case where
plus the contributions of volumetric (QV) and U is the mass density density (r), we have:
surface (QS) sources of U, expressed, respectively, ð þ
by the terms to the right of the equal sign in the @r
dO þ ∇  ðrvÞ
Eq. 13. @t
O O
Assuming continuity of flow and surface ð þ
sources, one can use the Gaussian theorem, also ¼ QV dO þ ∇  QS dO, (19)
known as the divergence theorem, and rewrite the O O
expression (13) as:
ð þ ð þ where v is fluid velocity. In the differential form,
@U we have:
dO þ ∇  F ¼ QV dO þ ∇
@t
O O O O
@r
 QS dO: (15) þ ∇  ðrvÞ ¼ QV þ ∇  QS : (20)
@t

Equation 15 is in the integral form of the con- In the absence of sources, the continuity equa-
servation law. The differential form is obtained tion takes into account only the density and veloc-
directly from this, assuming any volume, and is ity of the fluid. It can be applied to all fluids,
given by: compressible and incompressible and Newtonian
and non-Newtonian (Shaughnessy et al. 2005).
@U For incompressible fluids, the density is constant,
þ ∇  F ¼ QV þ ∇  QS )
@t (16) that is, it is not a function of the spatial coordinates
@U nor of the time. The Eq. 20 results in:
þ ∇  ðF  QS Þ ¼ QV :
@t
∇  v ¼ 0: (21)
Conservation Laws for Vector Fields
For the case where the conserved amount is Another particular case occurs when the den-
described by a vector quantity U, then the flow sity is independent only of time, resulting in:
and the term relative to the surface sources
become tensors, F and QS , respectively, and the
term corresponding to the volumetric sources
Lattice Gas Cellular Automata for Fluid Simulation 7

0 1
∇  ðrvÞ ¼ 0: (22) v1 v1 v1 v2 v1 v3
v  v ¼ @ v2 v1 v2 v2 v 2 v 3 A, (26)
Moment Conservation Equation v3 v1 v3 v2 v3 v3
The linear momentum, defined by (rv), is a vector
quantity, and therefore its conservation law has with v = (v1,v2,v3).
the general form given by Eqs. 17 and 18. The Thus, the expression (17) takes the form:
central issue now is to determine the tensors F and ð þ
QS and the vector QV that appear in these @ ðrvÞ
dO þ ∇  ðrv  vÞdO
equations. @t
O O
By Newton’s second law, it is known that the ð þ
agents responsible for the linear momentum of a ¼ rf e dO þ sdS: (27)
physical system are the forces acting on it. Such O S
forces may be external or internal. Let us then
consider a portion of fluid bounded by a surface S. Substituting s with the expression (23) gives
As external forces, we can have force fields the integral form of the conservation law of linear
such as the gravitational field and electromagnetic momentum for a Newtonian fluid. The
field. Let fe be the volumetric density of the resul- corresponding differential expression is obtained
tant of these forces. In addition to external forces directly from the integral form, given by (Hirsch
to the system, we also have internal forces due to 1988):
deformations and internal tensions of the same. In
this text, it is assumed that the fluid is Newtonian, @ ðrvÞ  
that is, that the internal stresses are given by the þ ∇  rv  v þ pI  t ¼ rf e : (28)
@t
expression (Hirsch 1988):
Subtracting the Eq. 20 from the left side of the
s ¼ pI þ t, (23) Eq. 28, multiplied by r, and assuming the source
terms are null, we find:
where I is a unit tensor, p is the hydrostatic
Dv  
pressure, and t is the tensor of tensions whose r ¼ ∇p þ ∇  t þ rf e , (29)
components are given by (Hirsch 1988): Dt

 where Dv/Dt is the material derivative, given by:


  2
tij ¼ v @ i vj þ @ j vi  ð∇  vÞdij , (24)
3 Dv @v
¼ þ v  ∇v: (30)
Dt @t
where n is the kinematic viscosity.
By integrating (23) along S, we have the resul- When the expression (24) for the tensor of
tant of the internal forces to the fluid that act on the tensions of a viscous Newtonian fluid is replaced
volume O. As for the tensor F, this will be given in Eq. 29, we obtain what we call Navier-Stokes
by (Hirsch 1988): equations. For constant viscosity coefficients,
this equation reduces to:
F ¼ rv  v, (25) 
Dv 1
r ¼ ∇p þ v Dv þ ∇ð∇  vÞ
where: Dt 3
þ rf e : (31)

For incompressible fluids (∇  v = 0), the


Eq. 31 reduces to:
8 Lattice Gas Cellular Automata for Fluid Simulation

Dv Chen, S., Diemer, K., Doolen, G.D., Eggert, K., Fu, C.,
r ¼ ∇p þ vDv þ rf e : (32) Gutman, S., Travis, B.J.: Lattice gas automata for flow
Dt
through porous media. In: Proceedings of the NATO
Advanced Research Workshop on Lattice Gas Methods
In the case of an ideal fluid without internal for PDEs: Theory, Applications and Hardware,
stresses, and therefore without viscosity n = 0, the pp. 72–84. North-Holland Publishing Co, Amsterdam
Eq. 32 reduces to the call Euler equation: (1991)
Chopard, B., Droz, M.: Cellular Automata Modeling of
Physical Systems. Cambridge University Press,
Dv @v
r ¼ r þ rðv  ∇Þv ¼ ∇p þ rf e : (33) Cambridge (1998)
Dt @t Chopard, B., Dupuis, A., Masselot, A., Luthi, P. Cellular
Automata and Lattice Boltzmann Techniques: An
Therefore, we find the equations of mass con- Approach to Model and Simulate Complex Systems. In:
Advances in Complex Systems (ACS), 5, 103–246 (2002)
servation and Navier-Stokes, given, respectively,
Frisch, U., Hasslacher, B., Pomeau, Y.: Lattice-gas autom-
by: ata for the navier-stokes equation. Phys. Rev. Lett.
56(14), 1505–1508 (1986)
@r Frisch, U., D’Humières, D., Hasslacher, B., Lallemand, P.,
þ ∇  ðrvÞ ¼ QV þ ∇  QS (34) Pomeau, Y., Rivet, J.-P.: Lattice gas hydrodynamics in
@t two and three dimension. Complex Syst. 1, 649–707
 (1987)
Dv 1 Hirsch, C.: Numerical Computation of Internal and Exter-
r ¼ ∇p þ v Dv þ ∇ð∇  vÞ
Dt 3 nal Flows: Fundamentals of Numerical Discretization,
vol. 1. Wiley, New York (1988)
þ rf e : (35) Hughes, T.J.R.: The Finite Element Method: Linear Static
and Dynamic Finite Element Analysis. Prentice-Hall,
Inc., Englewood Cliffs (1987)
Such equations form the basis for describing
Kari, J.: Theory of cellular automata: a survey. Theor.
the behavior of a fluid, particularly for computer Comput. Sci. 334(1–3), 3–33 (2005)
graphics animations. Krolyi, A., Kertsz, J.: Cellular Automata Models for Gran-
ular Media. In: Herrmann, H.J., Hovi, J.-P., Luding, S
(eds) Physics of Dry Granular Media, pp. 687–696.
Springer Netherlands, Dordrecht (1998). https://doi.
Cross-References org/10.1007/978-94-017-2653-5_53
Rothman, D., Zaleski, S.: Lattice-Gas Cellular Automata:
▶ Cascade Interactive Rendering for Water Simple Models of Complex Hydrodynamics. Cambridge
University Press, Cambridge (1997)
▶ Fluid Simulation
Sarkar, P.: A brief history of cellular automata. ACM
Comput. Surv. 32(1), 80–107 (2000)
Shaughnessy, E.J., Katz, I.M., Schaffer, J.P.: Introduction
References to Fluid Mechanics. Oxford University Press, Oxford
(2005)
Wolfram, S.: Cellular Automata and Complexity: Collected
Boghosian, B., Coveney, P., Emerton, A.: A lattice-gas
Papers, 1st edn. AddisonWesley (1994). http://www.
model of microemulsions. Proc. R. Soc. Lond. A. 452
stephenwolfram.com/publications/books/ca-reprint/
(1948), 1221–1250. (1996). https://doi.org/10.1098/
rspa.1996.0063

View publication stats

You might also like