Write a matlab code for a point vortex.
Write a Matlab code for a point vortex.
For a point vortex at origin,streamlines are concentric circles and velocity potential lines are radial lines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | gam = 1; % Vortex strength % GRID: x = -4:.02:4; y = -4:.02:4; for m = 1:length(x) for n = 1:length(y) xx(m,n) = x(m); yy(m,n) = y(n); % Velocity potential function : phi_Vortex(m,n) = (gam/2/pi)* atan2 (y(n)+.01,x(m)); % Stream function : psi_Vortex(m,n) = -(gam/4/pi)*log(x(m)^2+(y(n)+.01)^2); end end % Plots % Vortex at origin of coordinate system: contour(xx,yy,psi_Vortex,10, 'k' ),hold on contour(xx,yy,phi_Vortex,[-.5:.05:.5], 'r' ) legend( 'streamlines' , 'potential' ) title( ' Point vortex' ) axis image |