image thumbnail
from Kirchhoff Vortex Contour Dynamics Simulation by Travis Mitchell
Contour dynamics simulation of an elliptical vortex in 2D inviscid and incompressible flow

ReadAndPlotResults.m
%  ReadAndPlotResults.m
%  Version: 1.0, 19 March 2008
%
%  Sample post-simulation reading and plotting routines


%  ********************************  READ FIT RESULTS   ******************************
dir_string = 'I:\Andor\2008\0319\FZ_';

file_read       = [dir_string,'out_vector',file_ext];
in_vector       = LoadAscii(file_read);
%   alpha_m_0   beta_m_0    a   b   zeta    m_1     m_2     m_3
%   1           2           3   4   5       6       7       8
file_read       = [dir_string,'out_matrix',file_ext];
in_matrix       = LoadAscii(file_read);
in_matrix       = in_matrix';
    %  t,   t/T_R,  a,  b,  phi,    alpha_1,    beta_1, alpha_2,    beta_2, alpha_3,    beta_3, min_r,  max_r,  chi             in_matrix
    %  1,   2,      3,  4,  5,      6,          7,      8,          9,      10,         11,     12,     13,     14 

%  ********************************  PLOT FIT RESULTS   ******************************
cax = newplot;
i_amp_log = 1;
min_amp = 1e-8; max_amp = 1.; max_chi = 2.;              % amp, chi limits to define points to plot
i_1 = find((in_matrix(6,:) > min_amp) & (in_matrix(6,:) < max_amp) & (in_matrix(14,:) < max_chi )) ; %& ratio_vec < amp_ratio_cap);
corr_matrix = in_matrix;
corr_matrix(6,:) = abs(corr_matrix(6,:)); corr_matrix(8,:) = abs(corr_matrix(8,:)); corr_matrix(10,:) = abs(corr_matrix(10,:));

subplot(4,1,1); 
plot(corr_matrix(2,i_1), corr_matrix(5,i_1), '-+', 'color', 'g')           % ellipse phase
ylabel('ellipse phase (rad)');
title(['m=',num2str(in_vector(6)),'   a/b = ',num2str(in_vector(3)/in_vector(4)),'  \alpha_0 = ',num2str(in_matrix(6,1)),...
    '   T = ', num2str(max(corr_matrix(2,i_1)))], 'FontSize', 16);
hold on
plot(corr_matrix(2,i_1), repmat(corr_matrix(5,1),length(i_1)), 'k');
hold off
xlim([0 max(corr_matrix(2,i_1))]);

subplot(4,1,2);                                                             % amplitudes
if i_amp_log
    semilogy(corr_matrix(2,i_1), corr_matrix(6,i_1), '-+')
    title(['  max amp = ',num2str(max(corr_matrix(6,i_1))), '                      mode order: blue, red, black']);
    ylim([1e-4 5e-2]);
else
    plot(corr_matrix(2,i_1), corr_matrix(6,i_1), '-+')
end
ylabel('amplitude \alpha_m');
hold on
if m_2 > 0
    plot(corr_matrix(2,i_1), corr_matrix(8,i_1), '-o', 'color', 'r')
end
if m_3 > 0
    plot(corr_matrix(2,i_1), corr_matrix(10,i_1), '-x', 'color', 'k')
end
xlim([0 max(corr_matrix(2,i_1))]);

subplot(4,1,3);                                                             % phases
plot(corr_matrix(2,i_1), corr_matrix(7,i_1), '-+')
ylabel('mode phase \beta_m');
hold on
if m_2 > 0
    plot(corr_matrix(2,i_1), corr_matrix(9,i_1), '-o', 'color', 'r')
end
if m_3 > 0
    plot(corr_matrix(2,i_1), corr_matrix(11,i_1), '-x', 'color', 'k')
end
xlim([0 max(corr_matrix(2,i_1))]);

subplot(4,1,4);                  
plot(corr_matrix(2,i_1), corr_matrix(14,i_1), '-+')
ylabel('fit chi');
xlabel('time (rotation periods)');
xlim([0 max(corr_matrix(2,i_1))]);

Contact us at files@mathworks.com