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.
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

