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.

Sponsored Feature: Fluid Simulation for Video Games (Part 1)
View All     RSS
October 20, 2020
View All     Post     RSS
October 20, 2020
Press 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 Page 2 of 5

# Representations and Coordinate Systems

You can model fluids in at least two ways: as a field, or as a collection of interacting particles. Both views are useful, and you often switch between them and combine them.

## Field-based Systems

To each point in a region containing fluid, you can ascribe a set of properties: velocity, density, temperature, and pressure. The positions of the points never move. This treatment of fluids as a field is called an Eulerian view. Figure 4(a) shows a simple case: a box of gas.

Figure 4. Field-based and particle-based views of a fluid. (a) Grid based: Each point has fluid properties like velocity (arrows), density (box fill), pressure (arrow color), and temperature (box outline), and the grid points never move. (b) Particle based: Each particle has fluid properties in addition to position, and each particle can move.

## Particle-based Systems

You can also think of fluid in terms of a vast collection of particles (or parcels) that move around. Each parcel has properties such as position, velocity, density, and temperature. Note the addition of position here in contrast with the Eulerian view, where position is fixed to the grid. This treatment of fluids is called a Lagrangian view. Figure 4(b) shows a fluid as a collection of moving particles.

# Fluid Properties

At a microscopic level, fluids consist of a vast number of molecules whose principle interaction is collision. But the number of molecules is so large that you cannot pragmatically deal with them as such. Instead, you have to deal with them statistically, meaning that you pretend that clusters of particles act like a special substance that behaves differently than just a collection of particles. This special treatment entails (among other things) ascribing "bulk properties" to the fluid that characterize how the fluid interacts with itself.

The most common and important properties a fluid can have include these:

Pressure. Pressure refers to normal forces that apply to fluid parcels as well as the forces that fluid applies to its container and other solid objects embedded in the fluid, as Figure 5(a) shows.

Viscosity. Fluids also have shear forces, which act across the fluid, distorting it. Viscosity is the extent to which fluid resists that distortion, as Figure 5(b) shows. Thick fluids (like syrup) have high viscosity; thin fluids (like water) have low viscosity.

Density. Density expresses how much matter is in each small volume of space in the fluid.

Temperature. Temperature refers to how much heat resides in a fluid parcel. Temperature itself does not directly affect how the fluid moves, but it can affect pressure and density, which in turn affect motion.

Figure 5. Components of stress: (a) normal (pressure) and (b) shear

Fluids can have other, more sophisticated properties, such as more complex viscosity (for example, bouncing putty, blood or mucus) or composition (for example, fuel, oxygen, and exhaust), that you might want to include in your designs for more specialized fluid simulations (for example, combusting gas).

# Governing Equations

As with other physical phenomena like rigid bodies, systems of equations describe how a fluid evolves, or changes, over time. We call these equations governing equations. For a rigid body, the governing equations include Newton’s second law of motion, expressed as , where is the force acting on the body, m is its mass, and is its acceleration -- that is, how its velocity changes direction and speed over time. Fluids are more complicated and have more than one set of governing equations. In addition, each set of equations has multiple forms, which can vary depending on what kind of fluid you want to model. An early step in modeling fluid motion entails choosing which governing equations to use. This article chooses relatively simple forms.

Modeling a fluid entails more than just its motion: You can also model its internal state (pressure, density, and temperature), heat transport, and other properties. This and the other articles in the series assume that temperature and density remain constant throughout the fluid; but remember that if you want to model more sophisticated fluid flows, you should explore concepts like the equation of state (for example, ideal gas law) and thermal diffusion (for example, Fourier heat conduction).

Page 2 of 5

### Related Jobs

innogames — Hamburg, Germany
[10.20.20]

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

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

Lead Gameplay Programmer
Insomniac Games — Burbank, California, United States
[10.18.20]

Lead Engine Programmer