%	Boundary layer flow
%	Compare velocity profile and drag coefficient with Blasius solution
clear all
clf reset
load blasius.dat;
load u.dat;
load tau.dat;
Re=input('Re = ');
alf=input('alf = Lx/Ly = ');
JMAX=size(u,1);
JM1=JMAX-1;
del=1/JM1;
eta=zeros(size(u));
for i=2:JM1
   for j=1:JMAX
      eta(j,i)=del*(j-1)/(alf*sqrt(del*(i-1)/Re));
   end
end
uplot=u(:,2:JM1);
etaplot=eta(:,2:JM1);
plot(etaplot,uplot,blasius(:,1),blasius(:,2),'ro')
axis([0 10 0 1.1])
ylabel('Velocity')
xlabel('eta=y/sqrt(nu x/U)=y*/(alf sqrt(x*/Re))')
title(['Boundary Layer Velocity Profiles, Re = ',num2str(Re),' alf = ', ...
      num2str(alf),' JMAX = ',num2str(JMAX)])
input('Press enter to continue');
clf reset
x=linspace(0,1,JMAX);
xplot=x(2:JM1);
tauplot=-tau(1,2:JM1);
Cf=0.332./sqrt(Re.*xplot);
plot(xplot,tauplot,'k-x',xplot,Cf,'r-')
xlabel('Distance Along Plate')
ylabel('Local Drag Coefficient')
title(['Boundary Layer Drag Coefficients, Re = ',num2str(Re),' alf = ', ...
      num2str(alf),' JMAX = ',num2str(JMAX)])
