disp('------------------------uniform + source------------------------')
xx=linspace(-0.5,0.5,50);
yy=linspace(-0.5,0.5,50);
alpha = input('enter the angle \n');
U = input('please enter the velocity \n');
[x,y]=meshgrid(xx,yy);
r=sqrt((x.^2)+(y.^2));
theta = atan2(y./r,x./r);
m=input('enter the strength m (postive if source and negative if sink) \
n');
streamline = (y.*U*cosd(alpha)-x.*U*sind(alpha))+((m.*theta)./(2.*pi));
[dx,dy]=gradient(streamline);
contourf(x,y,streamline,50)
hold on
quiver(x,y,dx,dy);
streamslice(x,y,dx,dy,2)
colorbar
if m>=0
title('source')
else
title('sink')
end
hold off
disp('------------------------uniform + free vortex------------------------')
xx=linspace(-0.5,0.5,50);
yy=linspace(-0.5,0.5,50);
[x,y]=meshgrid(xx,yy);
alpha = input('enter the angle \n');
U = input('please enter the velocity \n');
r=sqrt((x.^2)+(y.^2));
teta = atan2(y./r,x./r);
k=input('enter the vorticity strength (positive if counter clockwise and
negative if clockwise) \n');
streamline = (-k.*log(r)) + (y.*U*cosd(alpha)-x.*U*sind(alpha));
[dx,dy]= gradient(streamline);
contourf(x,y,streamline,50)
hold on
quiver(x,y,dx,dy);
streamslice(x,y,dx,dy,2)
colorbar
if k>0
title('Counter clockwise')
else
title('clockwise')
end
hold off
disp('------------------------source + free vortex------------------------')
xx=linspace(-0.5,0.5,50);
yy=linspace(-0.5,0.5,50);
[x,y]=meshgrid(xx,yy);
r=sqrt((x.^2)+(y.^2));
theta = atan2(y./r,x./r);
m=input('enter the strength m (positive) \n');
k=input('enter the vorticity strength \n');
streamline = -k.*log(r) + ((m.*theta)./(2.*pi));
[dx,dy]= gradient(streamline);
contourf(x,y,streamline,50)
streamslice(x,y,dx,dy,2)
hold on
quiver(x,y,dx,dy);
colorbar
if k>0
title('Counter clockwise')
else
title('clockwise')
end
hold off
disp('------------------------sink + free vortex------------------------')
xx=linspace(-0.5,0.5,50);
yy=linspace(-0.5,0.5,50);
[x,y]=meshgrid(xx,yy);
r=sqrt((x.^2)+(y.^2));
theta = atan2(y./r,x./r);
m=input('enter the strength m (negative) \n');
k=input('enter the vorticity strength \n');
streamline = -k.*log(r) + ((m.*theta)./(2.*pi));
[dx,dy]= gradient(streamline);
contourf(x,y,streamline,50)
hold on
quiver(x,y,dx,dy);
streamslice(x,y,dx,dy,2)
colorbar
if k>0
title('Counter clockwise')
else
title('clockwise')
end
hold off
disp('------------------------source + sink------------------------')
xx=linspace(-0.5,0.5,50);
yy=linspace(-0.5,0.5,50);
[x,y]=meshgrid(xx,yy);
r=sqrt((x.^2)+(y.^2));
theta = atan2(y./r,x./r);
m=input('enter the strength (positive) \n');
g=input('enter the strength (negative) \n');
streamline = ((m.*theta)./(2.*pi)) + ((g.*theta)./(2.*pi)) ;
[dx,dy]=gradient(streamline);
contourf(x,y,streamline,50)
hold on
quiver(x,y,dx,dy);
streamslice(x,y,dx,dy,2)
colorbar
hold off
clc;
clear all;
disp('------------------------flow over rotating
cylinder------------------------')
U = input('please enter the velocity \n');
k = input('please enter k');
M=input('enter the vorticity strength \n');
[X1,Y1] = meshgrid(-30:0.1:30,-30:0.1:30);
streamline = U*Y1-k*Y1./(X1.^2+Y1.^2)-(M/(2*pi))*log(sqrt(X1.^2+Y1.^2));
figure (1)
A='on';
B=2;
C=10;
contourf(X1,Y1,streamline,'k','textstep',B,'levelstep',C);
clc;
clear all;
disp('------------------------flow over cylinder------------------------')
U = input('please enter the velocity \n');
k = input('please enter k');
[X1,Y1] = meshgrid(-30:0.1:30,-30:0.1:30);
streamline = U*Y1-k*Y1./(X1.^2+Y1.^2);
figure (1)
A='on';
B=2;
C=10;
contourf(X1,Y1,streamline,'k','textstep',B,'levelstep',C);