% Plots for StokesPoiseuilleSetup
clf
colormap(mk_colmap)

subplot(311)
surf(XP,YP,P(NodeP(2:app.Ny+1,2:app.Nx+1)),'LineStyle','none') 
xlim([min(xp) max(xp)]);ylim([min(yp) max(yp)]);
TT(1)=xlabel('x(m)');TT(2)=ylabel('y(m)');TT(3)=zlabel('T(^oC)');
TT(4)=title(sprintf(['Pressure time=',num2str(T)],app.Nx,app.Ny));
formatplot([],gca,TT);view(2),colorbar,shading interp

subplot(312)
surf(xu,yu,u(Nodeu(2:app.Ny+1,2:app.Nx)),'LineStyle','none') 
xlim([min(xu) max(xu)]);ylim([min(yu) max(yu)]);
TT(1)=xlabel('x(m)');TT(2)=ylabel('y(m)');TT(3)=zlabel('T(^oC)');
TT(4)=title(sprintf('U velocity',app.Nx,app.Ny));
formatplot([],gca,TT);view(2),colorbar,shading interp

umax = (mean(P(NodeP(round(app.Ny/2),2))) ...
       -mean(P(NodeP(round(app.Ny/2),end-2))))*b^2/4/app.nu/a;
U = @(y) umax*(1-y.^2/b^2);

subplot(313)
plot(U(yu),yu)
hold on;FACT=1;
plot(u(Nodeu(:,max(round(FACT*0.25/dx),1))),[b,yu,-b],'go')
plot(u(Nodeu(:,max(round(FACT*0.5/dx),1))),[b,yu,-b],'bx')
plot(u(Nodeu(:,max(round(FACT*0.75/dx),1))),[b,yu,-b],'r+')
plot(u(Nodeu(:,max(round(FACT*1/dx),1))),[b,yu,-b],'m<')
plot(u(Nodeu(:,max(round(FACT*1.25/dx),1))),[b,yu,-b],'b.')
plot(u(Nodeu(:,[round(app.Nx/2)])),[b,yu,-b],'k*')
legend('Analytical','0.25','0.5','0.75','1','1.25','half-way','Location','Best');
TT(1)=xlabel('U velocity');TT(2)=ylabel('y');
TT(4)=title(sprintf('U velocity profile',app.Nx,app.Ny));
formatplot([],gca,TT);view(2),colorbar,shading interp
