Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
Sponsored Feature: Fluid Simulation for Video Games (Part 1)
View All     RSS
October 20, 2020
arrowPress Releases
October 20, 2020
Games Press
View All     RSS

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Sponsored Feature: Fluid Simulation for Video Games (Part 1)

October 15, 2009 Article Start Previous Page 4 of 5 Next


Consider Newton’s second law, , for a block. Remembering that acceleration is the rate of change of velocity -- that is, , -- and dividing each side by mass, you can write . Now, imagine that block in contact with another block, as shown in Figure 6(b), and that the two blocks move relative to each other, as shown in Figure 6(c). Each block now has multiple forces acting on it: a normal force, a friction force, and a body force (gravity). Expanding the force term, , you get:

Figure 6. Force diagrams for a block; (a) without contact, (b) resting contact, and (c) sliding contact

Similar to Newton's laws of motion, the Navier-Stokes equation expresses how velocity changes as a result of forces:

Here, is the velocity at a point in time and space, t is time, p is pressure at a point, p is the density of the fluid at a point, µ is viscosity, and are external forces, such as gravity, acting on the fluid.

Note the similarities and differences to the equation for the block. Both express how velocity changes over time. Both include forces resulting from contact as well as external forces. But the fluid equation has an extra term on the left, , that takes some effort to understand.

The terms on the left express acceleration and have a special meaning. You can rewrite them as a new operator, :

This formula is called by many names, including the substantive derivative, advective derivative, Lagrangian derivative, and particle derivative. These names give a clue to its unusual meaning, and this is, in some sense, the heart of fluid motion. So, let's break it down, because to understand fluid motion, you must understand this derivative.

The term expresses how fluid velocity at a fixed location changes over time. Note the qualifier "at a fixed location," which brings us back to the Eulerian view, shown in Figure 7, where you represent a fluid as a field and ask questions about how fluid properties at fixed locations in that field change over time. So, this term simply expresses the change in velocity over time (that is, the acceleration) of a point in a fluid field.

Figure 7. Eulerian acceleration: velocity at a fixed location changes over time.

The term is tricky: It is called the advective term (see Figure 8) and expresses how velocity of a fluid parcel changes as that fluid parcel moves around—basically, velocity changes as a result of moving around in a velocity field. Again imagine that a fluid is a field in which every point in the field has a velocity. This would be like walking around in an airport that has slidewalks (moving sidewalks) everywhere. And these are unusual slidewalks that move in different directions and different speeds at different places, but the direction and speed remain the same at each location. Imagine wandering around in this crazy airport: Depending on where you stood, the slidewalks would carry you in different directions and speeds. By standing—without walking—on this crazy network of slidewalks, you would change speed and direction. You would accelerate simply as a result of following the flow field.

Figure 8. Advective acceleration: Velocity at each point remains constant, but a tracer following the field causes the tracer to accelerate.

Notice that the advective term, , has velocity in it twice: That repetition makes the motion nonlinear. When people refer to the nonlinear motion of fluids, they refer to this term -- advective acceleration. This term is the main reason why fluids have such complicated motion. When writing a simulation, a good deal of your effort goes into handling this term.

When you combine these two terms, you ask how a fluid parcel accelerates both as it follows the flow field and as a result of the flow field itself changing in time. When you ask about these together, you adopt the Lagrangian view -- that is, you think of the fluid as a collection of particles. So, the difference between Eulerian and Lagrangian views effectively boils down to where you put the advective term, : on the right side or on the left side of the momentum equation.


When pressure applies to a parcel of fluid, the fluid can compress or expand. You express this compression or expansion mathematically simply by stating that an influx of fluid changes the amount of fluid at that location:

For visual effects, you can usually neglect compressibility, so simplify this equation to . In that case, the pressure becomes coupled to velocity and we can drop the pressure term from the momentum equation (but as we will see in the second article, pressure reappears in another form). Any vector field with zero divergence is called "solenoidal". This condition ends up causing some complication in fluid simulations, which the second article in this series will revisit.

Mass can also advect and diffuse, in which case the form of its governing equations resemble the momentum equation given above, except without the pressure term. In other words, density follows the flow and diffuses.

Article Start Previous Page 4 of 5 Next

Related Jobs

innogames — Hamburg, Germany

Mobile Software Developer (C++) - Video Game: Forge of Empires
Johnson County Community College
Johnson County Community College — Overland Park, Kansas, United States

Assistant Professor, Game Development
Insomniac Games
Insomniac Games — Burbank, California, United States

Lead Gameplay Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States

Lead Engine Programmer

Loading Comments

loader image