Lesson 16 of 18

Curl of a 2D Vector Field

Curl in 2D

For a 2D vector field F(x,y)=(Fx(x,y),Fy(x,y))\mathbf{F}(x,y) = (F_x(x,y),\, F_y(x,y)), the curl (scalar curl, or zz-component of the 3D curl) measures rotation:

curlF=FyxFxy\text{curl}\,\mathbf{F} = \frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}

Interpretation

  • curl>0\text{curl} > 0: counterclockwise rotation (like a whirlpool)
  • curl<0\text{curl} < 0: clockwise rotation
  • curl=0\text{curl} = 0: irrotational — no net rotation (potential fields, conservative fields)

Examples

F=(y,x)\mathbf{F} = (-y, x) (perfect rotation field):

  • Fy/x=1\partial F_y/\partial x = 1, Fx/y=1\partial F_x/\partial y = -1
  • curl=1(1)=2\text{curl} = 1 - (-1) = 2 (constant, everywhere)

F=(x,y)\mathbf{F} = (x, y) (radial outward field):

  • Fy/x=0\partial F_y/\partial x = 0, Fx/y=0\partial F_x/\partial y = 0
  • curl=0\text{curl} = 0 (irrotational — no rotation, just expansion)

F=(y2,x2)\mathbf{F} = (y^2, x^2) at (1,1)(1, 1):

  • Fy/x=2x=2\partial F_y/\partial x = 2x = 2, Fx/y=2y=2\partial F_x/\partial y = 2y = 2
  • curl=22=0\text{curl} = 2 - 2 = 0

Stokes' Theorem (2D)

The curl is related to circulation via Green's theorem:

RFdr=RcurlFdA\oint_{\partial R} \mathbf{F} \cdot d\mathbf{r} = \iint_R \text{curl}\,\mathbf{F} \, dA

Numerical Implementation

Use central differences to approximate the partial derivatives:

double curl_2d(double (*Fx)(double, double), double (*Fy)(double, double),
               double x, double y, double h) {
    double dFy_dx = (Fy(x+h,y) - Fy(x-h,y)) / (2.0*h);
    double dFx_dy = (Fx(x,y+h) - Fx(x,y-h)) / (2.0*h);
    return dFy_dx - dFx_dy;
}

Your Task

Implement double curl_2d(Fx, Fy, x, y, h) using central differences.

TCC compiler loading...
Loading...
Click "Run" to execute your code.