Visualizing Vector Fields

Vector fields are functions that assign each point in space a vector. Common examples are wind velocities and other fluid velocities. The simplest example is the space is 2 dimensional and time independent. In this case the vector field has an equation like F = <P(x,y), Q(x,y)>.

One of the early successes of visualization was ability to plot lots of 2-D vector field using the following algorithm:

  1. Pick delta.
  2. Use a 2D rectangular grid of points 2*delta apart in both x and y directions.
  3. For each grid point (x0,y0) compute F(x0,y0) and save the maximal length M.
  4. For each grip point (x0,y0) rescale the vector field and plot the "arrow" delta * F(x0,y0) / M at the point (x0,y0).
The rescaling has the effect that the arrows do not overlap.

This method can be used with time varying vector fields as well, but then the rescale function needs to take into account the maximum length at any time. This method can be used for higher space dimensions, but it is often hard to see what is going on for even 3D. If there are isolated vectors with relatively large vector lengths, then this method will wash away the details of the rest of the field into very small arrows.

Another way of visualizing the vector field is by watching "particle" animation of the fluid flow. Here are three relate terms.

Note that all three of these terms are same if the vector field does not vary with time. Sometimes a fourth kind is used. Physical experiments often have real particles which don't follow the mathematical particle traces due to effects like friction. At times, particle traces try to mimic these effects so that the visualization looks like the experiment.

All of these "curve" visualization vector fields is with ODE's. The vector field <P,Q> is the system of ODEs xdot = P, ydot = Q. Solutions of this ODE (in the time independent case) are called Streamlines. Since the vector field is constant, streamlines represent the flow of an idealize particle in this "fluid". If the vector field and hence the ODE are time varying, these curves are called Particle traces and the term streamlines are used for solutions for a fixed moment in time. Streaklines are found by solving for each s < now, the initial value problem with the curve C(t) which at time s is at (x0,y0), and ploting the one point C(now).

Before discussing algorithms to draw these curves, we note that similar "particle systems" are used in special effects by the film industry. Having a bunch of particles obey the laws of physics adds realism to computer graphics. A common use is with water droplets, the bleeding edge (1998) is with motion of clothing.

To draw all these curves one needs a ODE solver. There are lots of these, but everyone needs to try the simplest one and rejects its use because it is not very good. Unfortunately, this losy method is given the name of great mathematican, Euler. Eulers method is the simplest possible:

  1. Pick delta and a starting point p0 = <x0,y0>
  2. Repeat until tired, pi+1 is pi+delta*the-vector-field-at pi.
The problem with euler's method can be seen with the vector field <y,-x> whose integral curves are circles about the origin (clockwise rotation). Eulers method produces expanding spirals instead.

A better ODE solver which is still simple and usually good enough is the Runge-Kutta method outlined below:

  1. Pick delta and a starting vector p0, and repeat the following steps until done
  2. given pi, first compute Vi the vector field at pi and Vi+1 which is the vector field at the point pi+delta*Vi (which is where Euler would have gone).
  3. then pi+1 is pi + delta*(Vi + Vi+1)/2.
Rutte-Kutta is good enough to find the circle trajectories in the simple vector field <y, -x> that tripped up Euler's method.

Sometimes collections of these curves are used to visualize the vector field. A rake is a regular collection of starting points, usually on a line. Having several nearby streamlines gives a better "global" understanding of the field. A stream ribbon is a surface attaching two nearby streamlines. A stream tube follows the streamlines of a "circle" of initial points. Hyperstreamlines are streamlines of ellipical crosssection used with tensor visualization.

Displacement plots are an alternate way of visualizing movement. A surface which is transverse to the flow. The surface is distorted by an amount proportional to the dot product of the surface normal and the vector field. These are sometimes called momentum profiles.

A very recent technique involves convolution of a "white noise" texture along streamlines. Details to come.