%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Copyright (C) 2005-2007 Anurag Singh %%
%% %%
%% This program/code snippet/file (hence forth refered as "library") %%
%% is free software; you can redistribute it and/or %%
%% modify it under the terms of the GNU Lesser General Public %%
%% License as published by the Free Software Foundation; either %%
%% version 2.1 of the License, or (at your option) any later version. %%
%% %%
%% This library is distributed in the hope that it will be useful, %%
%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %%
%% Lesser General Public License for more details. %%
%% %%
%% You should have received a copy of the GNU Lesser General Public %%
%% License along with this library; if not, write to the Free Software %%
%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA %%
%% %%
%% FILENAME: %%
%% incores.m %%
%% %%
%% AUTHOR: %%
%% %%
%% Anurag Singh, %%
%% MS, 2007 %%
%% Aerospace Engineering & Mechanics %%
%% University of Minnesota - Twin Cities. %%
%% Minneapolis, MN 55455 (USA) %%
%% %%
%% (currently working at: Exa Corporation, Burlington, MA 01803) %%
%% %%
%% CONTACT/EMAIL: %%
%% %%
%% anurag@aem.umn.edu %%
%% anurag9@gmail.com %%
%% %%
%% SOURCE CONTROL INFORMATION: %%
%% None (since I was planning on putting it under source control since it has %%
%% reached the critical file system size. Would be a good thing to put it under %%
%% source control while making changes. %%
%% %%
%% DESCRIPTION: %%
%% %%
%% Need to add %%
%% %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
%frame = 1;
trial = squeeze(sw2D(frame,:,:));
trial2 = squeeze(vort2D(frame,:,:));
trial3 = (trial > 0) .* sign(trial2) .* (cores > 0); % use cores identified by findcores_new previously
trial3 = sign(trial2) .* cores; % use cores identified by findcores_new previously
trial4 = trial .* (trial >= 0.1*getswmax);
trial5 = trial .* (cores > 0);
trial6 = trial3 .* cores;
caxlim = [0 3*stdsw2d];
colormap(hsvmap(30,5,[1 0 0],[0 0 1]));
% pcolor(x*u_tau/nu, y*u_tau/nu, squeeze(u_norm(frame,:,:))); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
% caxis([-3*piv_ustd 3*piv_ustd]) % i am setting the colorbar based on the rms of the signal
pcolor(x*u_tau/nu, y*u_tau/nu, squeeze(u_normplus(frame,:,:))); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
caxis([-3*piv_ustdplus 3*piv_ustdplus]) % i am setting the colorbar based on the rms of the signal
shading interp; % interpolated shading
lighting phong; % nice spline fit to the shading
hold on;
% quiver(x*u_tau/nu,y*u_tau/nu,squeeze(u_norm(frame,:,:)), squeeze(v(frame,:,:)),'k');
% [c h]=contour(x*u_tau/nu,y*u_tau/nu,(trial3 > 0), 1, '-k' ); set(h,'linewidth',2);
% [c h]=contour(x*u_tau/nu,y*u_tau/nu,(trial3 < 0), 1, '-.k'); set(h,'linewidth',2);
% for m=1:max(max(cores))
% [c h]=contour(x*u_tau/nu,y*u_tau/nu,(trial3 > 0).*(abs(trial3)==m),[1 1],'-k' ); set(h,'linewidth',2);
% [c h]=contour(x*u_tau/nu,y*u_tau/nu,(trial3 < 0).*(abs(trial3)==m),[1 1],'-.k' ); set(h,'linewidth',2);
% end
for m=1:max(max(cores))
trial7 = sign(trial2).*(cores==m);
if(sum(sum(trial7))>0)
% disp('+')
[c h]=contour(x*u_tau/nu,y*u_tau/nu,trial7,[0.1 0.1],'-k' ); set(h,'linewidth',2);
else
[c h]=contour(x*u_tau/nu,y*u_tau/nu,abs(trial7),[0.1 0.1],'-.k' ); set(h,'linewidth',2);
end
end
%[c h]=contour(x*u_tau/nu,y*u_tau/nu,trial3,[3 3],'-k' ); set(h,'linewidth',2); clabel(c);
%[c h]=contour(x*u_tau/nu,y*u_tau/nu,trial3,[5 5]'-.k'); set(h,'linewidth',2);
%IN = inpolygon(trial,[1000 1200],[1000 1200]);
%clabel(c,h);
%contlevels = [0.01*maxsw:0.05*maxsw:max(max(trial))];
%contlevels = [0.1*maxsw:0.015*maxsw:max(max(trial))];
%contourf(x*u_tau/nu,y*u_tau/nu,trial4,contlevels);
%contourf(x*u_tau/nu,y*u_tau/nu,trial5);
%surfc(x*u_tau/nu,y*u_tau/nu,trial5);
%caxis(caxlim) % i am setting the colorbar based on the rms of the signal
%axis([0 1500 0 1500 -100 600]);
%caxis([contlevels(1) contlevels(end)]);
cb = colorbar('vert'); % display the colorbar
set(get(cb,'YLabel'),'String',['Normalized, streamwise fluctuating velocity, u^{+}']);
title(['Image frame # ',num2str(frame),' at time ', num2str(frame/vecimfreq, '%.5f'), ' s',...
[sprintf('\n') '(Solid line contours are CCW cores, dashed lines are CW), z^{+} = ', num2str(round(piv_zplus))]])
xlabel('x^{+} ->');
ylabel('y^{+} ->');
zlabel('Swirl Values ->');
daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
hold off;
% pcolor(x*u_tau/nu, y*u_tau/nu, squeeze(u_norm(frame,:,:))); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
% caxis([-3*piv_ustd 3*piv_ustd]) % i am setting the colorbar based on the rms of the signal
% cb = colorbar('vert'); % display the colorbar
% shading interp; % interpolated shading
% lighting phong; % nice spline fit to the shading
%
% hold on;
%
% contour(x*u_tau/nu,y*u_tau/nu,trial3, 21);
%
% title(['Swirl contours & Velocity Vectors at z^{+}=',num2str(round(piv_zplus)) ,' (buffer region); Swirl threshold(> 100), total cores=',num2str( numcores)])
% xlabel('x^{+}');
% ylabel('y^{+}');
% daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)