Lesson 16 of 18
Curl of a 2D Vector Field
Curl in 2D
For a 2D vector field , the curl (scalar curl, or -component of the 3D curl) measures rotation:
Interpretation
- : counterclockwise rotation (like a whirlpool)
- : clockwise rotation
- : irrotational — no net rotation (potential fields, conservative fields)
Examples
(perfect rotation field):
- ,
- (constant, everywhere)
(radial outward field):
- ,
- (irrotational — no rotation, just expansion)
at :
- ,
Stokes' Theorem (2D)
The curl is related to circulation via Green's theorem:
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.