%Plot script for Sudden Expansion Test Case
clf
colormap(mk_colmap)

%Plot Pressure
PP = P;
PP(1:Nbcs)=NaN;
subplot(4,1,1);
surf(XP,YP,PP(NodeP(2:app.Ny+1,2:app.Nx+1)),'LineStyle','none') 
%xlim([min(xp) max(xp)]);ylim([min(yp) max(yp)]);
axis tight
TT(1)=xlabel('x(m)');TT(2)=ylabel('y(m)');TT(3)=zlabel('T(^oC)');
pdrop=1/3*2/3;
TT(4)=title(sprintf('Pressure, (app.Nx=%g, app.Ny=%g)\n Analytically calculated Pressure drop: %0.2g',app.Nx,app.Ny,pdrop));
formatplot([],gca,TT);view(2),colorbar,shading interp

%Plot centreline pressure
subplot(4,1,2);
plot([0,XP(1,:),a],PP(NodeP(round((app.Ny+3)/2),:)),'+-') 
%xlim([min(xp) max(xp)]);
axis tight
ylim([min(PP(NodeP(round((app.Ny+3)/2),:))) max([eps;PP(NodeP(round((app.Ny+3)/2),:))])]);
TT(1)=xlabel('x(m)');TT(2)=ylabel('P');
TT(4)=title(sprintf('Centreline (y=0) Pressure,  app.nu = %g',app.nu));%caxis([-1 1]*0.5);
formatplot([],gca,TT);view(2),colorbar,shading interp

%Quiver Plot
subplot(4,1,3:4)
tmp1 = 0.5*(u(Nodeu(2:app.Ny+1,1:app.Nx))+u(Nodeu(2:app.Ny+1,2:app.Nx+1)));
tmp2 = 0.5*(v(Nodev(2:app.Ny+1,2:app.Nx+1))+v(Nodev(1:app.Ny,2:app.Nx+1)));
quiver(XP(:),YP(:),(tmp1(:)),(tmp2(:)),2,'g') 
hold on
streamline(XP,YP,tmp1,tmp2,[a/app.Nx a/app.Nx a/app.Nx a/4 a/4],[b/2 5*b/8 3*b/8 b/4 3*b/4])
surf(XP,YP,sqrt(tmp1.^2+tmp2.^2),'FaceAlpha',0.2,'EdgeAlpha',0.0), colorbar

hold off
xlim([0 a]), ylim([0 b])
TT(1)=xlabel('x(m)');
TT(2)=ylabel('y(m)');
TT(3)=zlabel('T(^oC)');
TT(4)=title(sprintf('\nVelocity, time =%03.03g',T));
formatplot([],gca,TT);view(2)

drawnow;
