Watch smoke rise from a candle, or the wake behind a car in a wind tunnel, and the thing your eye locks onto is swirl: little eddies that curl up, roll around each other, and slowly die. In 2.7 Divergence: Sources & Sinks we built a microscope for one kind of local behavior in a vector field, spreading out versus squeezing together. This lesson builds the second microscope, the one that measures local rotation. The quantity is called the curl, and when the field is a fluid velocity, its curl gets its own name: vorticity. Vorticity is so central to fluid dynamics that entire solvers are written in terms of it, and the smoke solver of Fedkiw, Stam and Jensen adds a special force just to stop numerical error from erasing it. By the end of this lesson you’ll know exactly what that force computes.
Transcript
- Divergence told us whether a flow spreads out or squeezes together. Today we measure the other thing a flow can do at a point: spin.
- Here is a fluid turning like a solid turntable. The velocity is minus y, x, scaled by the rotation rate omega. Drop a tiny paddle wheel into it.
- The wheel is carried around the center, and it also spins about its own axle, with the marked blade turning at the same rate as the whole fluid.
- A second wheel, placed anywhere else, spins at exactly the same rate. Rotation here is not about the center. It is a local property of every point. That local spin is the curl.
- To turn spin into a number, walk counterclockwise around a tiny square of side h, and add up the velocity component along each edge. That total is called the circulation.
- Along the bottom we move in plus x, so we pick up plus u times h. Up the right side, plus v times h. Along the top we go backwards, minus u. Down the left side, minus v.
- Group the terms. The v's differ because the right edge is h further along x. The u's differ because the top edge is h higher in y.
- Each difference is h times a partial derivative. So the circulation is h squared, the area of the square, times d v d x minus d u d y.
- Divide by the area and shrink the square. Circulation per unit area is the curl. In two dimensions it is a single number: d v d x minus d u d y.
- For the turntable, d v d x is omega and d u d y is minus omega, so the curl is two omega: twice the spin rate. A paddle wheel turns at half the curl.
- Now a surprise. Here is a shear flow: the fluid slides to the right on top and to the left on the bottom. Every streamline is a perfectly straight line. Nothing goes around in circles.
- Pin three paddle wheels on axles: one in the fast upper layer, one in the middle, one in the leftward lower layer. Do they spin?
- All three turn clockwise, at the same rate. The fluid above each axle moves faster to the right than the fluid below it, so the blades get pushed around.
- The formula agrees. d v d x is zero, d u d y is one, so the curl is minus one everywhere. Negative means clockwise. Straight streamlines, yet the flow is full of rotation.
- The opposite surprise. In this whirlpool the speed falls off like one over r. Every particle goes around in a circle. Surely a wheel here must spin?
- Watch the marked blade. The wheel travels all the way around the center, but it keeps pointing the same way, like a compass needle. It does not spin at all.
- Two effects cancel. The curved path tries to turn the wheel counterclockwise, but the inner fluid moves faster than the outer fluid, which turns it clockwise. Compute it and the curl is exactly zero, everywhere except the center.
- A flow with zero curl is called irrotational. Curl is about the spin of tiny fluid elements, not about whether the streamlines curve.
- In three dimensions a fluid element can spin about any axis, so curl becomes a vector. Each component is the circulation per area in the plane perpendicular to that axis.
- The direction of the curl vector is the axis of spin, by the right-hand rule, and its length is twice the local angular velocity. The formula looks like a determinant.
- Notice the last component, Q x minus P y. That is our two dimensional curl. A flat flow spins only about the z axis.
- Two identities come straight from the formula. First, the curl of any gradient is zero. Each component is a pair of mixed partials that cancel, thanks to Clairaut's theorem.
- So gradient flows never swirl. Second, the divergence of any curl is zero: the six terms cancel in pairs. Vorticity lines can never start or stop inside the fluid.
- In fluid dynamics the curl of the velocity has its own name: vorticity, written omega. It is the swirl you see in smoke. Here is a small vortex, shaded by its vorticity.
- Cheap numerical schemes smear it out. Each step averages neighbors a little, and the vortex spreads and fades long before a real one would. Smoke turns to mush.
- Fedkiw, Stam and Jensen's fix is vorticity confinement. The amber arrows, N, point toward the vortex core, up the gradient of the vorticity's size.
- A small force along N cross omega pushes the fluid around the core, spinning the vortex back up. You will build this into a real solver later in the course.
- To recap. Curl is circulation per unit area: the spin rate of a tiny paddle wheel, times two. Shear flows have it, free vortices do not, and gradients never do.
- Next time we stop shrinking the loop. Circulation and flux around whole curves and surfaces: line and surface integrals.
The paddle-wheel picture
Imagine dropping a tiny paddle wheel into a 2D flow, with its axle sticking out of the page. The wheel is so small that it doesn’t disturb the flow. Two things can happen to it:
- It gets carried along, because the fluid at its location is moving. That’s just the velocity at that point.
- It spins about its own axle, because the fluid pushes harder on blades on one side than on the other.
The curl measures the second effect only. It is a property of each point, not of the flow “as a whole”. This sounds obvious, but it overturns two strong intuitions, as the video showed:
- Straight streamlines can have curl. In a shear flow where the top layer slides right faster than the bottom layer, every particle moves in a straight line. Yet a paddle wheel spins, because the blade on top gets pushed harder to the right than the blade on the bottom.
- Circular streamlines can have zero curl. In a whirlpool whose speed falls off like , every particle goes around in a circle. Yet a paddle wheel carried around it never turns: its marked blade keeps pointing the same direction, like a compass needle.
Keep both of these in your head. Curl is about the spin of a tiny fluid element, not about whether the streamlines bend.
Things to try:
- Start with the shear flow. Tick Pin axles so the wheels stay put, and see that every wheel turns clockwise at the same rate, wherever you drop it. The heatmap is uniformly blue (negative curl).
- Switch to the irrotational vortex with the axles unpinned. The wheels orbit the center, but the amber blade never changes direction. Hover the dashed loop over the singular core and watch the circulation jump to about .
- Try the Rankine vortex. Wheels inside the red core rotate along with the fluid. Wheels outside orbit without spinning.
- Try potential flow past a cylinder. The streamlines bend sharply around the obstacle, and still no wheel ever spins.
Circulation around a small loop
To turn “spin” into a number, we need a measurement that a fluid element would feel. The right one is circulation: walk around a closed loop and add up the component of velocity along your direction of travel. If the fluid tends to push you around the loop, the circulation is large. If it pushes you forward on one side and backward on the other in equal amounts, it is zero. (In 2.9 Line Integrals, Circulation & Flux this becomes the line integral . For now, a small square is all we need.)
Deriving the 2D curl
Let be a smooth 2D field, and take a small square with lower-left corner and side . Walk around it counterclockwise, the standard positive direction. On each edge, the component of along the direction of travel is nearly constant, so we approximate each edge’s contribution by the value at its midpoint times its length :
| Edge | Direction of travel | Tangential component | Contribution |
|---|---|---|---|
| bottom, at height | |||
| right, at | |||
| top, at height | |||
| left, at |
Add them up and group the terms and the terms:
Each bracket is the change in a function over a distance , which is times a partial derivative (plus higher-order terms you met in 2.4 Taylor Series in One and Several Variables):
The circulation is proportional to the area . Divide by the area and shrink the square:
The two terms have clean physical readings. means the fluid on the right is moving up faster than the fluid on the left, which twists counterclockwise. means the fluid on top is moving right faster than the fluid below, which twists clockwise. Hence the minus sign.
Worked example: solid-body rotation
A fluid turns like a rigid turntable with angular velocity : . Find its curl.
Here and , so
The curl is the same at every point, including points far from the axis, and it is twice the rotation rate. That factor of 2 is not a quirk. Both terms contribute equally: the right side moving up and the top side moving left each add of counterclockwise twist. A paddle wheel at any location turns at , exactly with the turntable, which is what the video showed.
Worked example: shear flow
Find the curl of the shear flow .
Now and :
The curl is everywhere: uniform clockwise rotation, and paddle wheels turn at radian per unit time. The streamlines are horizontal straight lines, but each fluid element is being sheared, and shear contains rotation.
You can see this with the linear algebra from 1.5 Eigenvectors & Eigenvalues. The velocity gradient of the shear flow is a constant matrix, and we can split it into a symmetric part and an antisymmetric part:
A shear is a pure strain plus a rigid rotation. The rotation part is exactly half the curl.
Worked example: the free vortex
Show that the whirlpool has zero curl away from the origin, but nonzero circulation around any circle centered at the origin.
With , we have and . Using the quotient rule and :
They are equal, so the curl is at every point except the origin, where the field is undefined. The fluid moves in circles with speed , but fluid elements don’t spin.
Now the circulation around a circle of radius . The velocity is tangent to the circle with constant magnitude , so the circulation is speed times circumference:
independent of . Every circle around the origin has the same circulation, no matter how large. If curl is “circulation per area” and the curl is zero everywhere except the center, then all of that circulation must be concentrated in the single point at the origin. The free vortex is the idealized limit of a vortex whose rotating core has shrunk to nothing. Real vortices, like the Rankine vortex in the sim, have a core of finite size with nonzero vorticity, surrounded by an irrotational flow.
Curl in three dimensions
In 3D a fluid element can spin about any axis, so the curl becomes a vector. Its direction is the axis of spin (by the right-hand rule: curl your fingers along the rotation, and your thumb points along the curl), and its length is twice the local angular velocity.
To find its components, apply the 2D result in each coordinate plane. The -component of the curl measures circulation per area in the -plane, where the field components are and ; that’s our 2D formula, . The -component measures circulation in the -plane, built from and , and the -component uses the -plane. For :
The determinant is only a mnemonic: expand it along the top row, as in 1.4 Determinants as Volume Scaling, treating ” times ” as "". The notation reads as “del cross ”, the cross product of the operator with .
The precise, coordinate-free definition is the 3D version of what we derived: for any unit vector ,
where is a small loop in the plane perpendicular to , traversed counterclockwise as seen from the tip of . The curl’s component along any axis is the circulation per area around that axis. A 2D flow has curl : it can only spin about the -axis, which is why 2D curl is a single number.
Worked example: a 3D curl
Compute for .
Identify , , . Then
- -component:
- -component:
- -component:
So . As a sanity check, take its divergence: . That zero is not a coincidence, as the next section shows.
Compute the curl of each field.
- The 2D field . Where does a paddle wheel spin counterclockwise?
Show worked solution
- , , . So . In fact , a gradient, and gradients always have zero curl.
- , , . Then , , . So : solid-body rotation about the -axis with angular velocity 1 (the -component of just moves fluid up and down without spinning it).
- . The curl is zero everywhere, so a paddle wheel never spins. (Check: .)
Irrotational fields and the two identities
A field with everywhere in a region is called irrotational. Two of the problems above were irrotational because they were gradients, and that is a general fact.
Proof. With , the -component of the curl is , which is zero by Clairaut’s theorem from 2.1 Functions of Several Variables & Partial Derivatives: mixed partials don’t depend on the order of differentiation. The other two components cancel the same way. ∎
Physically: a flow that runs straight downhill on some potential, like the gradient flows of 2.3 Gradient & Directional Derivatives, never swirls. The converse is also true in a region with no holes (a simply connected region): if , then for some potential . You’ll see why in 2.9 Line Integrals, Circulation & Flux, where zero curl makes line integrals path-independent.
The free vortex shows why the “no holes” condition matters. Its curl is zero on the plane with the origin removed, but it is not a gradient there: if it were, the circulation around any closed loop would be zero, and we computed . Locally it is the gradient of , the polar angle times , but jumps by every time you go around the origin. The hole at the origin is where all the vorticity hides.
Proof. Write out the divergence of the curl:
The six terms cancel in pairs by Clairaut: , , . ∎
Physically: the vorticity field always has zero divergence. Its field lines, the vortex lines, can’t start or end inside the fluid. They form closed loops (smoke rings!), stretch off to infinity, or end on a boundary. This is one of Helmholtz’s vortex theorems, and it’s why a tornado has to touch the ground or bend back into the cloud. Both identities return, together with the Laplacian, in 2.11 The Laplacian & Vector Identities, where they lead to the Helmholtz–Hodge decomposition at the heart of Stam’s solver.
Let and .
- Compute and verify directly that .
- Compute and verify directly that its divergence is zero.
Show worked solution
- . Call these .
- -component: .
- -component: .
- -component: .
- With , , : , , . So , and its divergence is . ✓
Vorticity
For a fluid velocity , the curl is the vorticity:
Everything above applies: vorticity is twice the local angular velocity of fluid elements, it is circulation per area, and it has zero divergence. But in fluids, vorticity is more than a diagnostic. In 11.6 Vorticity Dynamics & Circulation you’ll derive an evolution equation for itself, and find that in an ideal fluid vorticity is carried along with the flow (Kelvin’s and Helmholtz’s theorems). Swirl doesn’t appear out of nowhere in the interior of an ideal fluid. It is born at boundaries.
Computing vorticity on a grid
A grid-based solver like the one in Stam’s Art of Fluid Animation stores velocity samples u[j, i] and v[j, i] on a grid with spacing . Replace each derivative with a central difference:
Here counts along and along . This is second-order accurate, as you derived in 2.4 Taylor Series in One and Several Variables, and it is exact for velocity fields that are quadratic polynomials.
With the analytic gradient, the discrete curl is small but not zero: it is the truncation error of the stencil (halve the spacing and it drops by about 4). With the discrete gradient it is around , pure round-off, exactly as the numerics callout predicted.
The symbolic version is even more direct. SymPy can check both identities for a completely general field:
Vorticity confinement: a preview
Here is the practical problem. A cheap, stable fluid solver like Stam’s Stable Fluids moves the velocity field around with semi-Lagrangian advection (10.7 Semi-Lagrangian Advection): to find the new velocity at a grid point, trace backwards along the flow and interpolate the old field there. Interpolation averages neighboring values, and averaging is a little bit of diffusion. Every step, small vortices get smeared out and weakened. After a few hundred steps, smoke that should curl into eddies looks like it’s moving through syrup.
Fedkiw, Stam and Jensen’s fix in Visual Simulation of Smoke (2001) is to find where the vortices are and push them back up. The recipe, in 3D:
- Compute the vorticity with central differences.
- Compute the gradient of its magnitude, . This points toward vortex cores, where is largest.
- Normalize it: .
- Add the force
where is the grid spacing and is a tuning knob.
In 2D, and , so . Check the direction for a counterclockwise vortex () centered at the origin. At the point to its right, points toward the core, , so the force is : straight up, which is the counterclockwise direction at that point. The force pushes fluid around the core in the direction it was already turning, spinning the vortex back up. The factor makes the force vanish as the grid is refined, so the correction disappears exactly when the numerical dissipation it compensates for does.
Try flipping the sign of w (a clockwise vortex). The force arrows reverse with it, because depends only on while the force is proportional to . You’ll put this force into a working smoke solver in 11.11 Stam's Stable Fluids, Step by Step.
Practice
A Rankine vortex with core radius has purely circular velocity with speed
- Find the vorticity inside and outside the core. (Use what you know about solid-body rotation and the free vortex.)
- Find the circulation around a circle of radius , for and for .
- Check that equals the vorticity integrated over the disk of radius , i.e. the total “circulation per area” times area.
Show worked solution
- Inside, the flow is solid-body rotation with angular velocity , so . Outside, it is a free vortex with (speed ), so .
- Speed is constant on each circle and tangent to it, so . For : . For : , the same for every circle outside the core.
- For , the vorticity is over a disk of area , giving . ✓ For , only the core contributes: . ✓ This is a first look at Stokes’ theorem (2.10 Green, Stokes & the Divergence Theorem): circulation around a loop equals the total curl inside it.
Consider the linear 2D flow with .
- Show that the curl is and the divergence is , at every point.
- Split into a symmetric matrix and an antisymmetric matrix . Show that , a pure rotation at rate .
- The flow with has curved streamlines (hyperbolas). Is it rotational? What do its paddle wheels do?
Show worked solution
- and . Then and , constants.
- and . The matrix generates rotation (the flow from the worked example), so rotates at angular velocity . The symmetric part has real, orthogonal eigenvectors (1.5 Eigenvectors & Eigenvalues): it stretches along one and squashes along the other, with no rotation.
- Here , so the curl is . The flow is irrotational: is symmetric, so it is pure strain. Paddle wheels are carried along the hyperbolic streamlines and stretched past, but they don’t spin. (It is also divergence-free, since . It is the potential flow into a corner, the gradient of .)
Let .
- Show that .
- Find a potential with .
- Explain why the free vortex passes the test of part 1 (away from the origin) but fails part 2 on the punctured plane.
Show worked solution
- , , .
- Integrate in : . Then must equal , so and . Finally must equal , so . Hence . Check: . ✓
- Zero curl only guarantees a potential on a region without holes. The free vortex is defined on the plane minus the origin, which has a hole. The candidate potential works locally, but increases by around any loop enclosing the origin, so it can’t be a single-valued function. Equivalently, the circulation around such a loop would have to be zero for a gradient field, and it isn’t.
Key Takeaways
- Curl measures local rotation. A tiny paddle wheel in a 2D flow spins with angular velocity .
- Curl is circulation per unit area. Shrinking a square loop gives the 2D formula , the tangential sibling of divergence.
- In 3D, curl is a vector, , pointing along the spin axis. Its component along is the circulation per area around .
- Curl is not streamline curvature. Shear flow has straight streamlines and nonzero curl; the free vortex has circular streamlines and zero curl (except at its singular core, which holds all of its circulation).
- Identities: and , both from Clairaut. Irrotational fields on regions without holes are gradients.
- Vorticity is the swirl in a flow. It is born in boundary layers, and its field lines can’t end inside the fluid.
- On a grid, central differences give a second-order vorticity estimate, and the discrete curl of a discrete gradient vanishes to round-off.
- Vorticity confinement adds the force to spin smeared vortices back up, compensating for the numerical diffusion of semi-Lagrangian advection.