From the preface:
This book is designed to give the reader a practical introduction
to fluid simulation for graphics. The field of fluid dynamics, even
just in animation, is vast and so not every topic will be covered,
and many wonderful papers will sadly be passed over in the hope of
distilling the essentials; this is far from a thorough survey.
The focus of this book is animating fully three-dimensional
incompressible flow---from understanding the math and the algorithms
to actual implementation. However, there is also a small amount of
material on height field simplifications which are important for
efficiently modeling large bodies of water.
From the back cover:
"My colleagues and I have an alternate name for Bridson's 'Fluid Simulation
for Computer Graphics' book; we like to call it 'How to Write a Production
Quality Fluid Simulator'. I've been a huge fan of this text since it was
SIGGRAPH course notes a couple of years ago. This book has amplified and
improved on the work started back then. For a practitioner in this field,
it provides everything needed: a good foundation in the theory of
finite difference fluid simulation, practical working advice on how to deal with
the mathematics of simulation, and clear explanations of advanced techniques
(like solid/fluid coupling). All of this and it's very well written and a
pleasure to read."
-- Doug Roble, Creative Director of Software, Digital
Domain, Scientific and Technical Academy Award 2007
From the back cover:
"This book pulls together the essence of fluid simulation into a single
volume, presenting it in a fashion that is both useful to researchers and
accessible to implementers. I highly recommend it for anyone interested
in fluid simulation for computer graphics."
-- Ron Fedkiw, Stanford University, Scientific and Technical Academy Award 2007
Errata and Extra Comments
Here are a few issues I didn't correct in time; please email me
at rbridson@cs.ubc.ca
if you find more problems or sources of confusion!
- 4.5.3 (p. 70): Note that in the right-hand-side of the equation, the coefficients
in front of the solid velocities (differences of volume fractions) drop to zero away
from the solid boundaries---thus in practice, you never need to worry about extrapolating
solid velocities more than a grid cell width from the solid boundary.
- 6.1 (p. 85): The Zhu and Bridson formula is only well-defined near particles (where
the denominator in the fraction is nonzero), and should default to some reasonable positive
value such as the maximum particle radius elsewhere. Note this region should always be well outside the
fluid (you don't want the particle radius to be larger than the support of the kernel function!),
so the default value chosen doesn't matter too much as long as it's greater than zero, particularly
if you subsequently reinitialize to signed distance on a grid. However, for a higher quality
approach see Further Developments below.
- 6.2.4 (p. 93): For more details on allowing water drops to separate reasonably gracefully
from solid surfaces, refer to [Rasmussen et al. 04]. For example, in semi-Lagrangian advection
if phi is being interpolated inside a solid, if the fluid velocity dotted with the solid normal is
greater than some positive tolerance---i.e. the fluid looks like it's separating from the wall---then
phi should be set to the negative of the solid's level set function (a positive quantity); otherwise
it's interpolated as usual, from the typically negative extrapolated liquid phi.
- 6.3 (p. 94): Missing from the fluid simulation loop are the details on moving solids and the
adjustments to the liquid phi inside those solids. Conceptually the solids should be moved simultaneously
in step 4 as the fluid variables are advected, so the semi-Lagrangian boundary condition handling will use the
time n solid positions but the pressure solve will use the time n+1 solid positions.
If you adjust the liquid phi from the solid level sets, do it between steps 4 and 5: after advection
but before pressure projection.
- 6.3 (p. 94): The technique of using the normal component of the solid velocity but the tangential
component extrapolated from the fluid should cite the technical sketch [Houston et al. 03]. However, as long
as the linear system for pressure is solved reasonably accurately, this generally proves unnecessary.
- 6.4 (p. 97): The phrase "we can set p=0 in the grid cells that have no water at all" is ambiguous;
we've seen fairly good results by specifying p=0 whenever one or more of the adjoining u-,
v- or w-cells has zero liquid but isn't entirely occupied by solid. This is in fact consistent
with the ghost fluid approach, which sets p=0 where the liquid level set function phi is postive.
- 7.2 (p. 104): In the definition of alpha, all the occurences of i+1,j,k should be subscripts of phi.
- 11.1 (p. 156): Note that the force of gravity should also be applied to
particles with mass; the book only discusses the forces due to the fluid.
- 11.5 (p. 167): In the second paragraph, discussing the additional matrix term,
the word density is referring to the large number of nonzeros in the
matrix, not a physical ratio of mass to volume.
- 12.1.4 (p. 174): At the end of the section, the statement "the depth is zero (h=b)" should instead be
"the height is constant". See section 12.3 where in the discretization we extrapolate height h, not
depth. For an upward sloping beach, the depth will be considered negative in the dry areas.
- 13.1 (p. 180): The first momentum equation has the term grad phi instead of grad p: phi
should only substitute in the velocity terms, not the pressure term. This is fixed in subsequent equations.
- 13.3 (p. 189): The second equation for h_pq is missing a factor of A_ij in the second
term. This is corrected in the line below.
- A.1.3 (p. 197): The last formula on the page for curl should
have the partial derivatives dz/du and dx/dv in
place of "pdzu" and "pdxv" respectively.
- A.1.7 (p. 201): The free index in the matrix-vector product A_ij x_j
is i, not j.
- A.1.7 (p. 202): The third expression in the list of examples is a slight abuse
of notation: it would be better to write it as f(x_i) + df/dx_j dx_j, i.e.
change the repeated i in the second term to a j.
You will probably also find an occasional spelling mistake or error in punctuation: I apologize for
them, but will leave them off this list.
Further Developments
This book covers much of the state-of-the-art in graphics, concentrating
on grid-based 3D incompressible flow solvers, up to about January 2008.
However, there were a few extra developments since then I'd ideally want
included in the book:
- Fluid surface reconstruction from particles,
MSc thesis by my past student Brent Williams, based on research also with Marcus Nordenstam: this covers a new
method for generating high quality smooth surfaces from volumetric particle clouds. This can give significantly
better results than the methods discussed in section 6.1 in the book: it's worked well on the big screen
in a number of recent feature films such as Hell Boy II: The Golden Army.
- Accurate viscous
free surfaces for buckling, coiling, and rotating liquids, C. Batty and R. Bridson, SCA 2008. This
finally treats the free surface condition in viscous flow correctly, resolving phenomena such as honey coiling
as it pours, slime properly oozing, etc. This mostly resolves the open questions in section 8.5.
- Evolving sub-grid
turbulence for smoke animation, H. Schechter and R. Bridson, SCA 2008. This develops
further quasi-procedural methods for adding turbulent detail to smoke, but perhaps even more
importantly takes a first step at reducing the first order time splitting error that plagues virtually
all grid-based fluid solvers in graphics, left as an open question in section 9.1.
Please note that, just like the book, this is not an attempt to reference all the great work
being done in the area: it's again my personal view of some particularly useful starting points
for advanced development in one approach to a practical high quality grid-based fluid solver.
In general, it's worth checking out papers
at graphics conferences for continuing advances---try the list maintained by Ke-Sen Huang at
kesen.huang.googlepages.com.
Course Notes
This book grew out of my part of a set of notes for SIGGRAPH courses
held in 2006 and 2007, available at
www.cs.ubc.ca/~rbridson/fluidsimulation.
The book has well more than double the material I provided and has corrected several small errors in
the notes, but if you want a preview of the style of the text or a quick introduction to some of
the basics of fluid simulation, you should take a look. The notes also have coverage of a few
different algorithms, notably SPH, and on the web site there are are also some slides and a bit of code.
Robert Bridson - August 19, 2008