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)
October 20, 2020
October 20, 2020
Press Releases
October 20, 2020
Games Press

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 5 of 5

## Vorticity

You can readily imagine a vortex or multiple vortices, because they appeal to intuition. Anybody who has watched a tornado, water flowing down a drain, or milk stirred into coffee has seen vortices. Smoke rings are also really just vortex rings-vortices that loop back on themselves. In fluid dynamics, we call these loops coherent structures, because they seem to have a persistent life of their own. The "vorticity" equation describes how these structures evolve.

Vorticity, (the curl of velocity) describes how fluid rotates. By taking the curl of the momentum equation, you derive the vorticity equation:

By solving this equation, you can obtain a complete description of fluid motion. Vorticity gives fluid its characteristic swirling motion. Figure 9 shows examples of simple vortical flows.

Figure 9. Vortices and their flows: (a) a line vortex (purple dashed line) and the circular flow around it (black solid line), and (b) a ring vortex and the "jet" flow through it

The stress term, , describes the stretching and tilting of vortices, as shown in Figure 10. Vortex stretching is an important process in the turbulent cascade of energy from larger to smaller scales in the flow and only occurs in 3D flows.

Figure 10. Vortex stretching: (a) A vortex tube with a bulge with velocity flowing outward from the bulge causes the bulge to shrink. (b) After the bulge squirted away, the tube shrank: The amount of mass rotating there decreased, so to conserve angular momentum, vorticity increased. In other words, the tube rotates faster where it initially rotated more slowly.

The viscous term, , describes the diffusion of vorticity—that is, how vorticity spreads as a result of friction.

The final term expresses buoyancy, which (as shown in Figure 11) creates regions of overturning, where fluids with density out of equilibrium (for example, heavy fluid above light fluid) form rolling currents that tend toward bringing the fluid into equilibrium (that is, putting heavy fluid below light fluid).

Figure 11. Keeping fluid right-side up. Where the pressure gradient and the density gradient are not parallel, vorticity forms to bring fluid layers into equilibrium. Fluid will try to rotate to push down the bulge.

The momentum equation uses pressure, so this approach to solving the fluid dynamics equations is sometimes called the velocity-pressure formulation, or primitive variable formulation. In contrast, the vorticity equation does not require pressure, but it does require velocity, so this approach to solving the fluid dynamics equations is sometimes called the vorticity-velocity formulation.

The vorticity equation is redundant with the momentum equation: You only need to solve one or the other, as they are equivalent. Once you get used to the idea of vorticity, it becomes easier to work with than momentum, especially because you can readily and intuitively identify a vortex and follow its motion.

# Boundary Conditions

Fluids interact with their containers, with objects embedded in the fluid, and with other, distinct fluids that do not mix (for example, air and water). You express these interactions as boundary conditions, which have two components:

No-through. Fluid cannot flow into or out of a body.

No-slip. Fluid cannot move across a body. (Alternatively, you can use free-slip boundaries, which are not perfectly realistic but apply for fluids without viscosity.)

Boundary conditions express how a body influences fluid flow as well as how fluid flow influences the motion of a body. This problem has multiple solutions. For example, you can ask about the pressure field on the boundary or use conservation laws (like linear and angular momentum) to exchange impulses between the fluid and the body.

# Summary

Adding fluid simulations to video games can make the games more immersive and compelling. This article introduced fluid dynamics properties and equations in preparation for a description of algorithms used to simulate fluid motion. Because it includes more degrees of freedom and nonlinear motion, fluid dynamics is more complicated than other, familiar forms of physical phenomena such as rigid body dynamics. Fluid dynamics employs partial differential equations (in contrast to ordinary differential equations) and has boundary conditions (in addition to initial conditions). Simulation techniques suitable for fluids have a corresponding delicacy and complexity that subsequent articles in this series will explore. The next article will survey fluid simulation techniques, including grid-based, grid-free, and hybrid methods. The final article will provide a vortex particle fluid simulation, which you can use to augment an existing particle system in a game.

Page 5 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]