Elementary flows

Choose a flow, change one setting, and watch what happens.

Flow view

Running
Your browser needs Canvas to draw the flow. The project notes are available below.
Tracer speed0 → 2.0 m/s (clipped)

Move to probe · click or tap to pin. Keyboard: focus the plot, use arrows to move, Enter to pin, Esc to clear.

Point probe

Move over the field
x, y (m)
—
u, v (m/s; horizontal, vertical)
—
Speed (m/s)
—

This is an ideal 2D flow model, not CFD. Tracers move with the flow; streamlines follow its direction. Their count and spacing do not measure how much fluid passes through.

Try this: Turn the uniform flow to 90° and check the velocity.

Project notes

A few ideas to help explain the drawing.

What the five flows represent

A velocity field gives the speed and direction of flow at each point. These are ideal mathematical building blocks:

Uniform
The same speed and direction everywhere.
Source
Flow spreads outward from a point.
Sink
Flow moves inward toward a point.
Vortex
Flow goes around a point. Positive strength turns counterclockwise; negative turns clockwise.
Doublet
The ideal limit of an equal source and sink brought very close together. It is useful for bending a flow.

The point-like flows become singular at their centers. We leave out a small core rather than draw an infinite speed.

How flows combine, and why the circle works

At each point, add the horizontal velocities together, then add the vertical velocities together. This is called superposition.

total velocity = velocity₁ + velocity₂ + …

For the cylinder, a uniform flow and a matching doublet cancel the part of the velocity that would go through the circle. Change the speed or radius and the doublet updates automatically. This is why the circle remains a boundary.

Our flows are two-dimensional, incompressible and inviscid: the model leaves out changes in volume and the effects of fluid friction. It is not a full CFD calculation. The elements stay fixed, and each change selects a new steady flow.

How the code makes the animation
  1. physics.js gives the velocity at a point and adds elementary flows. It also checks whether a point is inside a circle or an excluded core.
  2. renderer.js draws the flow. It moves tracers using small midpoint steps (RK2) and draws streamlines along the velocity direction.
  3. app.js reads the controls, loads presets, and updates the point probe. Editing a flow restarts the tracer history so two different settings are not mixed.
  4. tests\physics.test.js checks the elementary velocities, superposition, circle boundary and tracer steps.

The playback slider changes how fast the animation runs, not the velocity shown by the probe. Tracers that leave the view or reach an excluded region are replaced.

A connection to flapping wings

An insect wing moves back and forth and turns between strokes. This changes the surrounding airflow and can leave swirls behind, called vortices. A later stroke can meet air disturbed by an earlier one.

In FlowLab, start with Uniform flow, add a vortex, and reverse its strength. Watch how the forward motion and swirl combine. This helps you practise reading a velocity field; it is not a model of a flapping wing.

Real flapping-wing flow changes with time and involves viscosity and three-dimensional wings. Our flows are fixed, idealised and two-dimensional. They do not simulate a moving wing, the viscous vortices at its leading edge, or predict wing forces.

Further reading: Dickinson, Lehmann & Sane (1999), on insect wing motion. The source link opens the paper online.