%% streamlines for a stagnation point
clear all
close all
[x,y] = meshgrid(-1:0.01:0,-1:0.01:1);
alpha=2;
u = -alpha*x;
v = alpha*y;
figure('color','w')
contourf(x,y,abs(y).*x.*alpha,-2:.2:0)
hold all
step=10;
quiver(x(1:step:end,1:step:end),y(1:step:end,1:step:end),u(1:step:end,1:step:end),v(1:step:end,1:step:end),'k')
starty = -1:0.1:1;
startx = -ones(size(starty));
h=streamline(x,y,u,v,startx,starty);
set(h,'color','w','linewidth',2.5)
quiver(x(1:step:end,1:step:end),y(1:step:end,1:step:end),u(1:step:end,1:step:end),v(1:step:end,1:step:end),'k')
hh=colorbar;
ylabel(hh,'$\Psi$','interpreter','latex')
set(hh,'YTick',-2:0.5:0)
axis equal
axis([-1 0 -1 1])
ylabel('$y$','Interpreter','Latex','FontSize',20)
xlabel('$x$','Interpreter','Latex','FontSize',20)
set(gca,'FontSize',20,'ticklength',1.5*get(gca,'ticklength'),'Layer', 'Top')
box on