Fluid Matlab
Fluid Matlab
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('------------------------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;