Flow Lab

Syllabus / Module 2: Multivariable & Vector Calculus

Lesson 2.8

Curl & Vorticity

Curl measures local rotation: the paddle-wheel picture, the formula ∇×F, 2D scalar curl, and vorticity in flows.

Written byClaude Opus

🌊
Why this matters for simulation: Vorticity is the swirl you see in smoke; Stam-style solvers add 'vorticity confinement' to keep it alive.

By the end of this lesson you can…

  • Explain curl as circulation per unit area and as twice the spin rate of a tiny paddle wheel.
  • Derive the 2D scalar curl $\partial v/\partial x - \partial u/\partial y$ from the circulation around a small square, and compute the 3D curl vector by hand.
  • Distinguish rotation of fluid elements from curved streamlines, using shear flow and the free vortex as test cases.
  • Prove that the curl of a gradient and the divergence of a curl are always zero, and interpret both identities physically.
  • Compute the vorticity of a velocity field on a grid with central differences, and describe how vorticity confinement keeps simulated smoke swirly.
On this page
·
  1. The paddle-wheel picture
  2. Circulation around a small loop
  3. Deriving the 2D curl
  4. Worked example: solid-body rotation
  5. Worked example: shear flow
  6. Worked example: the free vortex
  7. Curl in three dimensions
  8. Worked example: a 3D curl
  9. Irrotational fields and the two identities
  10. Vorticity
  11. Computing vorticity on a grid
  12. Vorticity confinement: a preview
  13. Practice
  14. Key Takeaways

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.

▶ Video Curl, circulation and vorticitycaptions only
Transcript
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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?
  13. 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.
  14. 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.
  15. 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?
  16. 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.
  17. 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.
  18. A flow with zero curl is called irrotational. Curl is about the spin of tiny fluid elements, not about whether the streamlines curve.
  19. 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.
  20. 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.
  21. Notice the last component, Q x minus P y. That is our two dimensional curl. A flat flow spins only about the z axis.
  22. 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.
  23. 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.
  24. 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.
  25. 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.
  26. 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.
  27. 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.
  28. 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.
  29. 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 u⃗\vec u 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:

  1. 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.
  2. Circular streamlines can have zero curl. In a whirlpool whose speed falls off like 1/r1/r, 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.

◆ Interactive Drop paddle wheels into flows and watch them spin

Loading simulation…

Things to try:

  1. 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).
  2. 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 2π2\pi.
  3. Try the Rankine vortex. Wheels inside the red core rotate along with the fluid. Wheels outside orbit without spinning.
  4. 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 ∮CF⃗⋅dr⃗\oint_C \vec F\cdot d\vec r. For now, a small square is all we need.)

Deriving the 2D curl

Let F⃗=(u,v)\vec F = (u, v) be a smooth 2D field, and take a small square with lower-left corner (x,y)(x, y) and side hh. Walk around it counterclockwise, the standard positive direction. On each edge, the component of F⃗\vec F along the direction of travel is nearly constant, so we approximate each edge’s contribution by the value at its midpoint times its length hh:

EdgeDirection of travelTangential componentContribution
bottom, at height yy+x+xuu+h u(x+h2, y)+h\,u(x+\tfrac h2,\, y)
right, at x+hx+h+y+yvv+h v(x+h, y+h2)+h\,v(x+h,\, y+\tfrac h2)
top, at height y+hy+h−x-x−u-u−h u(x+h2, y+h)-h\,u(x+\tfrac h2,\, y+h)
left, at xx−y-y−v-v−h v(x, y+h2)-h\,v(x,\, y+\tfrac h2)

Add them up and group the vv terms and the uu terms:

Γ≈h[v(x+h, y+h2)−v(x, y+h2)]  −  h[u(x+h2, y+h)−u(x+h2, y)].\Gamma \approx h\Big[v(x+h,\, y+\tfrac h2) - v(x,\, y+\tfrac h2)\Big] \;-\; h\Big[u(x+\tfrac h2,\, y+h) - u(x+\tfrac h2,\, y)\Big].

Each bracket is the change in a function over a distance hh, which is hh times a partial derivative (plus higher-order terms you met in 2.4 Taylor Series in One and Several Variables):

Γ≈h⋅h ∂v∂x−h⋅h ∂u∂y=h2(∂v∂x−∂u∂y).\Gamma \approx h\cdot h\,\frac{\partial v}{\partial x} - h\cdot h\,\frac{\partial u}{\partial y} = h^2\left(\frac{\partial v}{\partial x} - \frac{\partial u}{\partial y}\right).

The circulation is proportional to the area h2h^2. Divide by the area and shrink the square:

The two terms have clean physical readings. ∂v/∂x>0\partial v/\partial x \gt 0 means the fluid on the right is moving up faster than the fluid on the left, which twists counterclockwise. ∂u/∂y>0\partial u/\partial y \gt 0 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 Ω\Omega: u⃗=Ω(−y,x)\vec u = \Omega(-y, x). Find its curl.

Here u=−Ωyu = -\Omega y and v=Ωxv = \Omega x, so

∂v∂x−∂u∂y=Ω−(−Ω)=2Ω.\frac{\partial v}{\partial x} - \frac{\partial u}{\partial y} = \Omega - (-\Omega) = 2\Omega.

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 Ω\Omega of counterclockwise twist. A paddle wheel at any location turns at Ω\Omega, exactly with the turntable, which is what the video showed.

Worked example: shear flow

Find the curl of the shear flow u⃗=(y,0)\vec u = (y, 0).

Now u=yu = y and v=0v = 0:

∂v∂x−∂u∂y=0−1=−1.\frac{\partial v}{\partial x} - \frac{\partial u}{\partial y} = 0 - 1 = -1.

The curl is −1-1 everywhere: uniform clockwise rotation, and paddle wheels turn at −12-\tfrac12 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:

[0100]=[012120]⏟strain: stretch along (1,1), squash along (1,−1)+[012−120]⏟rotation at rate −12.\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} = \underbrace{\begin{bmatrix} 0 & \tfrac12 \\ \tfrac12 & 0 \end{bmatrix}}_{\text{strain: stretch along }(1,1)\text{, squash along }(1,-1)} + \underbrace{\begin{bmatrix} 0 & \tfrac12 \\ -\tfrac12 & 0 \end{bmatrix}}_{\text{rotation at rate } -\frac12}.

A shear is a pure strain plus a rigid rotation. The rotation part is exactly half the curl.

✅ Concept check

A river flows in the $+x$ direction with speed $u = 2 - y^2$ for $-1 \le y \le 1$ (fastest in the middle, slowest at the banks), and $v = 0$. What is the curl at a point near the bank $y = 1$?

Worked example: the free vortex

Show that the whirlpool u⃗=k(−y,x)x2+y2\vec u = \dfrac{k(-y, x)}{x^2 + y^2} has zero curl away from the origin, but nonzero circulation around any circle centered at the origin.

With r2=x2+y2r^2 = x^2 + y^2, we have u=−ky/r2u = -ky/r^2 and v=kx/r2v = kx/r^2. Using the quotient rule and ∂(r2)/∂x=2x\partial(r^2)/\partial x = 2x:

∂v∂x=k r2−x⋅2xr4=k y2−x2r4,∂u∂y=−k r2−y⋅2yr4=k y2−x2r4.\frac{\partial v}{\partial x} = k\,\frac{r^2 - x\cdot 2x}{r^4} = k\,\frac{y^2 - x^2}{r^4}, \qquad \frac{\partial u}{\partial y} = -k\,\frac{r^2 - y\cdot 2y}{r^4} = k\,\frac{y^2 - x^2}{r^4}.

They are equal, so the curl is 00 at every point except the origin, where the field is undefined. The fluid moves in circles with speed k/rk/r, but fluid elements don’t spin.

Now the circulation around a circle of radius RR. The velocity is tangent to the circle with constant magnitude k/Rk/R, so the circulation is speed times circumference:

Γ=kR⋅2πR=2πk,\Gamma = \frac{k}{R}\cdot 2\pi R = 2\pi k,

independent of RR. 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 1/r1/r flow.

✅ Concept check

A tiny paddle wheel floats in the free vortex $\vec u = k(-y,x)/(x^2+y^2)$, two meters from the center. What does it do?

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 zz-component of the curl measures circulation per area in the xyxy-plane, where the field components are PP and QQ; that’s our 2D formula, Qx−PyQ_x - P_y. The xx-component measures circulation in the yzyz-plane, built from QQ and RR, and the yy-component uses the zxzx-plane. For F⃗=(P,Q,R)\vec F = (P, Q, R):

∇×F⃗=∣ı^ȷ^k^∂∂x∂∂y∂∂zPQR∣=(∂R∂y−∂Q∂z,    ∂P∂z−∂R∂x,    ∂Q∂x−∂P∂y).\nabla\times\vec F = \begin{vmatrix} \hat\imath & \hat\jmath & \hat k \\ \dfrac{\partial}{\partial x} & \dfrac{\partial}{\partial y} & \dfrac{\partial}{\partial z} \\ P & Q & R \end{vmatrix} = \left( \frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z},\;\; \frac{\partial P}{\partial z} - \frac{\partial R}{\partial x},\;\; \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right).

The determinant is only a mnemonic: expand it along the top row, as in 1.4 Determinants as Volume Scaling, treating ”∂/∂x\partial/\partial x times QQ” as "∂Q/∂x\partial Q/\partial x". The notation ∇×F⃗\nabla\times\vec F reads as “del cross F⃗\vec F”, the cross product of the operator ∇=(∂x,∂y,∂z)\nabla = (\partial_x, \partial_y, \partial_z) with F⃗\vec F.

The precise, coordinate-free definition is the 3D version of what we derived: for any unit vector n^\hat n,

(∇×F⃗)⋅n^=lim⁡area→01area∮CF⃗⋅dr⃗,(\nabla\times\vec F)\cdot\hat n = \lim_{\text{area}\to 0}\frac{1}{\text{area}}\oint_{C}\vec F\cdot d\vec r,

where CC is a small loop in the plane perpendicular to n^\hat n, traversed counterclockwise as seen from the tip of n^\hat n. The curl’s component along any axis is the circulation per area around that axis. A 2D flow (u(x,y),v(x,y),0)(u(x,y), v(x,y), 0) has curl (0,0,vx−uy)(0, 0, v_x - u_y): it can only spin about the zz-axis, which is why 2D curl is a single number.

Worked example: a 3D curl

Compute ∇×F⃗\nabla\times\vec F for F⃗=(y2,  xz,  xyz)\vec F = (y^2,\; xz,\; xyz).

Identify P=y2P = y^2, Q=xzQ = xz, R=xyzR = xyz. Then

  • xx-component: Ry−Qz=xz−x=x(z−1)R_y - Q_z = xz - x = x(z - 1)
  • yy-component: Pz−Rx=0−yz=−yzP_z - R_x = 0 - yz = -yz
  • zz-component: Qx−Py=z−2yQ_x - P_y = z - 2y

So ∇×F⃗=(x(z−1),  −yz,  z−2y)\nabla\times\vec F = \big(x(z-1),\; -yz,\; z - 2y\big). As a sanity check, take its divergence: ∂x[x(z−1)]+∂y[−yz]+∂z[z−2y]=(z−1)−z+1=0\partial_x[x(z-1)] + \partial_y[-yz] + \partial_z[z-2y] = (z - 1) - z + 1 = 0. That zero is not a coincidence, as the next section shows.

✅ Concept check

For the 2D field $\vec F = (x^2 y,\; x y^2)$, what is the scalar curl at the point $(1, 2)$?

✏️ Pen & paperCurls by hand●○○

Compute the curl of each field.

  1. F⃗=(yz,  xz,  xy)\vec F = (yz,\; xz,\; xy)
  2. G⃗=(−y,  x,  z)\vec G = (-y,\; x,\; z)
  3. The 2D field H⃗=(sin⁡y,  xcos⁡y)\vec H = (\sin y,\; x\cos y). Where does a paddle wheel spin counterclockwise?
Show worked solution
  1. Ry−Qz=x−x=0R_y - Q_z = x - x = 0, Pz−Rx=y−y=0P_z - R_x = y - y = 0, Qx−Py=z−z=0Q_x - P_y = z - z = 0. So ∇×F⃗=0⃗\nabla\times\vec F = \vec 0. In fact F⃗=∇(xyz)\vec F = \nabla(xyz), a gradient, and gradients always have zero curl.
  2. P=−yP = -y, Q=xQ = x, R=zR = z. Then Ry−Qz=0−0=0R_y - Q_z = 0 - 0 = 0, Pz−Rx=0−0=0P_z - R_x = 0 - 0 = 0, Qx−Py=1−(−1)=2Q_x - P_y = 1 - (-1) = 2. So ∇×G⃗=(0,0,2)\nabla\times\vec G = (0, 0, 2): solid-body rotation about the zz-axis with angular velocity 1 (the zz-component of G⃗\vec G just moves fluid up and down without spinning it).
  3. ∂v/∂x−∂u/∂y=cos⁡y−cos⁡y=0\partial v/\partial x - \partial u/\partial y = \cos y - \cos y = 0. The curl is zero everywhere, so a paddle wheel never spins. (Check: H⃗=∇(xsin⁡y)\vec H = \nabla(x\sin y).)

Irrotational fields and the two identities

A field with ∇×F⃗=0⃗\nabla\times\vec F = \vec 0 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 ∇f=(fx,fy,fz)\nabla f = (f_x, f_y, f_z), the xx-component of the curl is ∂y(fz)−∂z(fy)=fzy−fyz\partial_y(f_z) - \partial_z(f_y) = f_{zy} - f_{yz}, 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 ∇×F⃗=0⃗\nabla\times\vec F = \vec 0, then F⃗=∇ϕ\vec F = \nabla\phi for some potential ϕ\phi. 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 2πk2\pi k. Locally it is the gradient of kθk\theta, the polar angle times kk, but θ\theta jumps by 2π2\pi 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:

∂∂x(Ry−Qz)+∂∂y(Pz−Rx)+∂∂z(Qx−Py)=Ryx−Qzx+Pzy−Rxy+Qxz−Pyz.\frac{\partial}{\partial x}\big(R_y - Q_z\big) + \frac{\partial}{\partial y}\big(P_z - R_x\big) + \frac{\partial}{\partial z}\big(Q_x - P_y\big) = R_{yx} - Q_{zx} + P_{zy} - R_{xy} + Q_{xz} - P_{yz}.

The six terms cancel in pairs by Clairaut: Ryx=RxyR_{yx} = R_{xy}, Qzx=QxzQ_{zx} = Q_{xz}, Pzy=PyzP_{zy} = P_{yz}. ∎

Physically: the vorticity field ω⃗=∇×u⃗\vec\omega = \nabla\times\vec u 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.

✅ Concept checkselect all that apply

Select every expression that is zero for all smooth $f$ and $\vec F$.

✏️ Pen & paperProving the identities for a specific field●●○

Let f(x,y,z)=x2y+sin⁡(yz)f(x, y, z) = x^2 y + \sin(yz) and F⃗=(xy,  yz,  zx)\vec F = (xy,\; yz,\; zx).

  1. Compute ∇f\nabla f and verify directly that ∇×∇f=0⃗\nabla\times\nabla f = \vec 0.
  2. Compute ∇×F⃗\nabla\times\vec F and verify directly that its divergence is zero.
Show worked solution
  1. ∇f=(2xy,  x2+zcos⁡(yz),  ycos⁡(yz))\nabla f = \big(2xy,\; x^2 + z\cos(yz),\; y\cos(yz)\big). Call these P,Q,RP, Q, R.
    • xx-component: Ry−Qz=[cos⁡(yz)−yzsin⁡(yz)]−[cos⁡(yz)−zysin⁡(yz)]=0R_y - Q_z = [\cos(yz) - yz\sin(yz)] - [\cos(yz) - zy\sin(yz)] = 0.
    • yy-component: Pz−Rx=0−0=0P_z - R_x = 0 - 0 = 0.
    • zz-component: Qx−Py=2x−2x=0Q_x - P_y = 2x - 2x = 0.
  2. With P=xyP = xy, Q=yzQ = yz, R=zxR = zx: Ry−Qz=0−y=−yR_y - Q_z = 0 - y = -y, Pz−Rx=0−z=−zP_z - R_x = 0 - z = -z, Qx−Py=0−x=−xQ_x - P_y = 0 - x = -x. So ∇×F⃗=(−y,−z,−x)\nabla\times\vec F = (-y, -z, -x), and its divergence is ∂x(−y)+∂y(−z)+∂z(−x)=0\partial_x(-y) + \partial_y(-z) + \partial_z(-x) = 0. ✓

Vorticity

For a fluid velocity u⃗\vec u, the curl is the vorticity:

ω⃗=∇×u⃗,in 2D: ω=∂v∂x−∂u∂y.\vec\omega = \nabla\times\vec u, \qquad \text{in 2D: } \omega = \frac{\partial v}{\partial x} - \frac{\partial u}{\partial y}.

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 ω⃗\vec\omega 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 hh. Replace each derivative with a central difference:

ωi,j≈vi+1,j−vi−1,j2h−ui,j+1−ui,j−12h.\omega_{i,j} \approx \frac{v_{i+1,j} - v_{i-1,j}}{2h} - \frac{u_{i,j+1} - u_{i,j-1}}{2h}.

Here ii counts along xx and jj along yy. 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.

🧪 Coding exerciseExercise: discrete curl on a grid
⌘/Ctrl + Enter

With the analytic gradient, the discrete curl is small but not zero: it is the O(h2)O(h^2) truncation error of the stencil (halve the spacing and it drops by about 4). With the discrete gradient it is around 10−1410^{-14}, 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:

🐍 PythonCurl and the identities, symbolically
⌘/Ctrl + Enter

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:

  1. Compute the vorticity ω⃗=∇×u⃗\vec\omega = \nabla\times\vec u with central differences.
  2. Compute the gradient of its magnitude, η⃗=∇∣ω⃗∣\vec\eta = \nabla|\vec\omega|. This points toward vortex cores, where ∣ω⃗∣|\vec\omega| is largest.
  3. Normalize it: N^=η⃗/∥η⃗∥\hat N = \vec\eta / \|\vec\eta\|.
  4. Add the force
f⃗conf=ε h (N^×ω⃗),\vec f_{\text{conf}} = \varepsilon\, h\, (\hat N \times \vec\omega),

where hh is the grid spacing and ε>0\varepsilon \gt 0 is a tuning knob.

In 2D, ω⃗=(0,0,ω)\vec\omega = (0, 0, \omega) and N^=(Nx,Ny,0)\hat N = (N_x, N_y, 0), so N^×ω⃗=ω (Ny, −Nx)\hat N \times \vec\omega = \omega\,(N_y,\, -N_x). Check the direction for a counterclockwise vortex (ω>0\omega \gt 0) centered at the origin. At the point (r,0)(r, 0) to its right, N^\hat N points toward the core, N^=(−1,0)\hat N = (-1, 0), so the force is ω (0,1)\omega\,(0, 1): 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 hh makes the force vanish as the grid is refined, so the correction disappears exactly when the numerical dissipation it compensates for does.

🐍 PythonThe vorticity-confinement force around a smeared vortex
⌘/Ctrl + Enter

Try flipping the sign of w (a clockwise vortex). The force arrows reverse with it, because N^\hat N depends only on ∣ω∣|\omega| while the force is proportional to ω\omega. You’ll put this force into a working smoke solver in 11.11 Stam's Stable Fluids, Step by Step.

Practice

✏️ Pen & paperThe Rankine vortex●●○

A Rankine vortex with core radius aa has purely circular velocity with speed

uθ(r)={Ωr,r≤a,Ωa2/r,r>a.u_\theta(r) = \begin{cases} \Omega r, & r \le a, \\ \Omega a^2 / r, & r \gt a. \end{cases}
  1. Find the vorticity inside and outside the core. (Use what you know about solid-body rotation and the free vortex.)
  2. Find the circulation Γ(r)\Gamma(r) around a circle of radius rr, for r≤ar \le a and for r>ar \gt a.
  3. Check that Γ(r)\Gamma(r) equals the vorticity integrated over the disk of radius rr, i.e. the total “circulation per area” times area.
Show worked solution
  1. Inside, the flow is solid-body rotation with angular velocity Ω\Omega, so ω=2Ω\omega = 2\Omega. Outside, it is a free vortex k(−y,x)/r2k(-y,x)/r^2 with k=Ωa2k = \Omega a^2 (speed k/rk/r), so ω=0\omega = 0.
  2. Speed is constant on each circle and tangent to it, so Γ=2πr uθ\Gamma = 2\pi r\,u_\theta. For r≤ar \le a: Γ=2πr⋅Ωr=2πΩr2\Gamma = 2\pi r\cdot\Omega r = 2\pi\Omega r^2. For r>ar \gt a: Γ=2πr⋅Ωa2/r=2πΩa2\Gamma = 2\pi r\cdot\Omega a^2/r = 2\pi\Omega a^2, the same for every circle outside the core.
  3. For r≤ar \le a, the vorticity is 2Ω2\Omega over a disk of area πr2\pi r^2, giving 2Ω⋅πr2=2πΩr22\Omega\cdot\pi r^2 = 2\pi\Omega r^2. ✓ For r>ar \gt a, only the core contributes: 2Ω⋅πa2=2πΩa22\Omega\cdot\pi a^2 = 2\pi\Omega a^2. ✓ 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.
✏️ Pen & paperRotation hiding in a linear flow●●○

Consider the linear 2D flow u⃗=Ax⃗\vec u = A\vec x with A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}.

  1. Show that the curl is c−bc - b and the divergence is a+da + d, at every point.
  2. Split A=S+WA = S + W into a symmetric matrix SS and an antisymmetric matrix WW. Show that W=12(c−b)[0−110]W = \tfrac12(c - b)\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, a pure rotation at rate 12curl⁡\tfrac12\operatorname{curl}.
  3. The flow with A=[122−1]A = \begin{bmatrix} 1 & 2 \\ 2 & -1 \end{bmatrix} has curved streamlines (hyperbolas). Is it rotational? What do its paddle wheels do?
Show worked solution
  1. u=ax+byu = ax + by and v=cx+dyv = cx + dy. Then ∂v/∂x−∂u/∂y=c−b\partial v/\partial x - \partial u/\partial y = c - b and ∂u/∂x+∂v/∂y=a+d\partial u/\partial x + \partial v/\partial y = a + d, constants.
  2. S=12(A+AT)=[ab+c2b+c2d]S = \tfrac12(A + A^T) = \begin{bmatrix} a & \tfrac{b+c}{2} \\ \tfrac{b+c}{2} & d \end{bmatrix} and W=12(A−AT)=[0b−c2c−b20]=c−b2[0−110]W = \tfrac12(A - A^T) = \begin{bmatrix} 0 & \tfrac{b-c}{2} \\ \tfrac{c-b}{2} & 0 \end{bmatrix} = \tfrac{c-b}{2}\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}. The matrix [0−110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} generates rotation (the flow Ω(−y,x)\Omega(-y, x) from the worked example), so WW rotates at angular velocity c−b2\tfrac{c-b}{2}. The symmetric part SS has real, orthogonal eigenvectors (1.5 Eigenvectors & Eigenvalues): it stretches along one and squashes along the other, with no rotation.
  3. Here b=c=2b = c = 2, so the curl is c−b=0c - b = 0. The flow is irrotational: AA 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 a+d=0a + d = 0. It is the potential flow into a corner, the gradient of ϕ=12x2+2xy−12y2\phi = \tfrac12 x^2 + 2xy - \tfrac12 y^2.)
✏️ Pen & paperIs it a gradient?●●●

Let F⃗=(2xy+z3,  x2+2yz,  y2+3xz2)\vec F = \big(2xy + z^3,\; x^2 + 2yz,\; y^2 + 3xz^2\big).

  1. Show that ∇×F⃗=0⃗\nabla\times\vec F = \vec 0.
  2. Find a potential ϕ\phi with ∇ϕ=F⃗\nabla\phi = \vec F.
  3. 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
  1. P=2xy+z3P = 2xy + z^3, Q=x2+2yzQ = x^2 + 2yz, R=y2+3xz2R = y^2 + 3xz^2.
    • Ry−Qz=2y−2y=0R_y - Q_z = 2y - 2y = 0
    • Pz−Rx=3z2−3z2=0P_z - R_x = 3z^2 - 3z^2 = 0
    • Qx−Py=2x−2x=0Q_x - P_y = 2x - 2x = 0
  2. Integrate ϕx=2xy+z3\phi_x = 2xy + z^3 in xx: ϕ=x2y+xz3+g(y,z)\phi = x^2 y + xz^3 + g(y, z). Then ϕy=x2+gy\phi_y = x^2 + g_y must equal x2+2yzx^2 + 2yz, so gy=2yzg_y = 2yz and g=y2z+h(z)g = y^2 z + h(z). Finally ϕz=3xz2+y2+h′(z)\phi_z = 3xz^2 + y^2 + h'(z) must equal y2+3xz2y^2 + 3xz^2, so h′=0h' = 0. Hence ϕ=x2y+xz3+y2z+C\phi = x^2 y + xz^3 + y^2 z + C. Check: ∇ϕ=(2xy+z3,  x2+2yz,  3xz2+y2)\nabla\phi = (2xy + z^3,\; x^2 + 2yz,\; 3xz^2 + y^2). ✓
  3. 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 kθk\theta works locally, but θ\theta increases by 2π2\pi around any loop enclosing the origin, so it can’t be a single-valued function. Equivalently, the circulation 2πk2\pi k around such a loop would have to be zero for a gradient field, and it isn’t.
✅ Concept check

A cup of coffee is spun so it rotates as a solid body at 3 radians per second. What is the vorticity of the coffee (in 1/s)?

Key Takeaways

  • Curl measures local rotation. A tiny paddle wheel in a 2D flow spins with angular velocity 12curl⁡F⃗\tfrac12\operatorname{curl}\vec F.
  • Curl is circulation per unit area. Shrinking a square loop gives the 2D formula curl⁡F⃗=∂v/∂x−∂u/∂y\operatorname{curl}\vec F = \partial v/\partial x - \partial u/\partial y, the tangential sibling of divergence.
  • In 3D, curl is a vector, ∇×F⃗=(Ry−Qz,  Pz−Rx,  Qx−Py)\nabla\times\vec F = (R_y - Q_z,\; P_z - R_x,\; Q_x - P_y), pointing along the spin axis. Its component along n^\hat n is the circulation per area around n^\hat n.
  • 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: ∇×∇f=0⃗\nabla\times\nabla f = \vec 0 and ∇⋅(∇×F⃗)=0\nabla\cdot(\nabla\times\vec F) = 0, both from Clairaut. Irrotational fields on regions without holes are gradients.
  • Vorticity ω⃗=∇×u⃗\vec\omega = \nabla\times\vec u 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 εh(N^×ω⃗)\varepsilon h(\hat N\times\vec\omega) to spin smeared vortices back up, compensating for the numerical diffusion of semi-Lagrangian advection.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: