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

# Review of Partial Differentials

This section presents a very brief review of differential calculus.

First, some terminology: A scalar value has a single component, e.g. height. In contrast, a vector value has multiple components. For example, a 2-vector has 2 components (e.g. x and y) and a 3-vector has 3 components. A similar but distinct notion is the dimensionality of the function, which is how many variables the function depends on. So a 1D function is a function of a single variable, e.g. f(u), and a 2D function is a function of 2 variables, e.g. f(u,v). You can combine these notions. You're familiar with scalar function of 1 variable, often written f(x). But you can also have scalar functions of multiple variables (e.g. a single value is defined at every point on a 2D surface, such as a height-field) and vector functions of multiple variables (e.g. multiple values are defined at every point in a 3D volume, such as the components of velocity in a flow field).

You'll likely recall the notion that a derivative is the slope of a line tangent to a curve. You can extend that notion of a derivative to scalar and vector functions of higher dimension. The resulting operators include the gradient, divergence and curl, detailed below.

Recall that the derivative of a 1D scalar function (i.e. a function of a single variable, which has a single value) is the slope of the line tangent to the function at a given point, as shown in Fig. X(a). Likewise, the gradient of a scalar function of more variables is a combination of partial derivatives - one for each variable - combined to create a vector which points along the slope of that function, as Fig. X(b) depicts.

Figure X: Derivatives of scalar functions.
(a) Ordinary derivative of a 1D scalar function is the slope of the line tangent to the curve. (b) Gradient of a 2D scalar function (e.g. terrain height) points up the slope of the "terrain".

## Divergence

The divergence of a vector function indicates how much of the field flows outward from a given point. Figure Y(a) shows a function that has divergence. Note that the divergence of a vector field is itself a scalar. If the vector field is a velocity field then a positive divergence implies the mass at the point decreases. Think of a tank of compressed gas emptying out; the volume of the container remains constant but the amount of gas inside the tank diminishes as gas flows outward.

Figure Y: Derivatives of vector functions.
(a) An irrotational vector field has only divergence (no curl). (b) A solenoidal vector field has only curl (no divergence).

## Curl

The curl of a vector field indicates the amount of circulation about each point. Figure Y(b) shows a vector field that has curl. The curl of a velocity field is called the vorticity. Note that the curl is itself a vector; to find its direction, we use the "right-hand rule": Curl the fingers of your right hand along the direction of the vectors and your thumb will point along the direction of the curl. In Fig. Y(b), the curl points out of the page

## Helmholtz Decomposition

The fundamental theorem of vector calculus states that you can represent a vector field as the sum of an irrotational part (which has no curl) and a solenoidal part (which has no divergence).

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