clearvars
close all

load('array_simb1.mat');
load('array_exp.mat');



%% Tracé

colormax_k = 0.08;
colormin_k = 0;
colormax_W = 0.15;
colormin_W = -0.15;

y_lim = [0 4];     
x_lim = [-2.1 25];
aspect1 = 1.2;


% v_U=linspace(colormin_U,colormax_U);
% v_W=linspace(colormin_W,colormax_W);

l_st=1.2;%epaisseur de la streamline


F = figure('rend','painters','pos',[10 10 1150 1000],'DefaultAxesFontName','cmr10','defaulttextinterpreter','latex')
ha = tight_subplot(8,2,[0.01 0.01],[.07 .08],[.1 .2])

pos_letter_x = 8;
% pos_letter_y = 5.4;
pos_letter_y = 4.8;

fontsize = 15;



axes(ha(1));

k_exp_modifnan=[array_exp(5).k(1:5,904:1094);array_exp(5).k(24:end,904:1094);array_exp(5).k(1:18,904:1094)];
k_exp_hill=[array_exp(5).k(254:255,430:644);array_exp(5).k(1:253,430:644)];
k_exp=[k_exp_hill array_exp(5).k(:,772:889) k_exp_modifnan];


W_exp_modifnan=[array_exp(5).W(1:5,904:1094);array_exp(5).W(24:end,904:1094);array_exp(5).W(1:18,904:1094)];
W_exp_hill=[array_exp(5).W(254:255,430:644);array_exp(5).W(1:253,430:644)];
W_exp=[W_exp_hill array_exp(5).W(:,772:889) W_exp_modifnan];

x_exp_modifnan=[array_exp(5).x(1:5,904:1094);array_exp(5).x(24:end,904:1094);array_exp(5).x(1:18,904:1094)];
x_exp_hill=[array_exp(5).x(254:255,430:644);array_exp(5).x(1:253,430:644)];
x_exp=[x_exp_hill array_exp(5).x(:,772:889) x_exp_modifnan];

z_exp_modifnan=[array_exp(5).z(1:5,904:1094);array_exp(5).z(24:end,904:1094);array_exp(5).z(1:18,904:1094)];
z_exp_hill=[array_exp(5).z(254:255,430:644);array_exp(5).z(1:253,430:644)];
z_exp=[z_exp_hill array_exp(5).z(:,772:889) z_exp_modifnan];



mapmaskmanuel(x_exp,z_exp,k_exp,k_exp,k_exp,colormin_k,colormax_k,0,20)
hold on
h1=plot(array_exp(5).xst,array_exp(5).zst);
set(h1,'Color','black')
h1.LineWidth=l_st;


caxis([colormin_k colormax_k]) 
hy = ylabel('$z/H_{1}$','FontSize',15);
set(hy,'interpreter','Latex','FontSize',15)
set(gca, 'FontSize',15);
yticks([0 2 4])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [])
% letter = {'exp $\lambda$/H=$\infty$'};
letter = {'$\lambda/H_{1}=\infty$'};

text(pos_letter_x,pos_letter_y,letter(1),'Interpreter','latex','FontSize',fontsize)


letter1 = {'experiment'};
% letter1 = {'exp\''erience'};
pos_letter_x1 = 7;
pos_letter_y1 = 8;

text(pos_letter_x1,pos_letter_y1,letter1(1),'Interpreter','latex','FontSize',20,'FontWeight','normal')



n_cas=[0 27 0 13 4 11 3 9 0 7 2 5 0 3 0 0];


for ii=[5 7 11]
    
axes(ha(ii));

mapmaskmanuel(array_exp(n_cas(ii)).x,array_exp(n_cas(ii)).z,array_exp(n_cas(ii)).k,array_exp(n_cas(ii)).k,array_exp(n_cas(ii)).k,colormin_k,colormax_k,0,20)


hold on
h1=plot(array_exp(n_cas(ii)).xst,array_exp(n_cas(ii)).zst);
set(h1,'Color','black')
h1.LineWidth=l_st;



caxis([colormin_k colormax_k]) 
hy = ylabel('$z/H_{1}$','FontSize',15);
set(hy,'interpreter','Latex','FontSize',15)
set(gca, 'FontSize',15);
yticks([0 2 4])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [])

letter = {'nothing',...
'$\lambda/H_{1}=\infty$',...  
'nothing',...
'$\lambda/H_{1}=19.2$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=9.2$',...
'$\lambda/H_{1}=9.2$',...
'nothing',...
'$\lambda/H_{1}=8.5$',...
'$\lambda/H_{1}=6.9$',...
'$\lambda/H_{1}=6.9$',...
'nothing',...
'$\lambda/H_{1}=5.8$',...
'$\lambda/H_{1}=4.6$',...
'$\lambda/H_{1}=4.6$'};
text(pos_letter_x,pos_letter_y,letter(ii),'Interpreter','latex','FontSize',fontsize)




end



for iv=[3 9 13]
    
axes(ha(iv));
% plot([);
set(gca,'Visible','off');


end


for iiv=2
    
axes(ha(iiv));

mapmaskmanuel(array_sim(n_cas(iiv)).x(:,1:end),array_sim(n_cas(iiv)).z(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),colormin_k,colormax_k,0,0.5)



hold on
h1=plot(array_sim(13).xst,array_sim(13).zst);
set(h1,'Color','black')
h1.LineWidth=l_st;

caxis([colormin_k colormax_k]) 
% hy = ylabel('$z/H$','FontSize',30);
% set(hy,'interpreter','Latex','FontSize',18)
set(gca, 'FontSize', 15);
yticks([])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [])

letter = {'nothing',...
'$\lambda/H_{1}=\infty$',...  
'nothing',...
'$\lambda/H_{1}=19.2$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=9.2$',...
'$\lambda/H_{1}=9.2$',...
'nothing',...
'$\lambda/H_{1}=8.5$',...
'$\lambda/H_{1}=6.9$',...
'$\lambda/H_{1}=6.9$',...
'nothing',...
'$\lambda/H_{1}=5.8$',...
'$\lambda/H_{1}=4.6$',...
'$\lambda/H_{1}=4.6$'};
text(pos_letter_x,pos_letter_y,letter(iiv),'Interpreter','latex','FontSize',fontsize)

letter2 = {'simulation'};
pos_letter_x2 = 7;
pos_letter_y2 = 8;

text(pos_letter_x2,pos_letter_y2,letter2(1),'Interpreter','latex','FontSize',20)

end


for iiv=[4 6 8 10 12 14]
    
axes(ha(iiv));

mapmaskmanuel(array_sim(n_cas(iiv)).x(:,1:end),array_sim(n_cas(iiv)).z(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),array_sim(n_cas(iiv)).k(:,1:end),colormin_k,colormax_k,0,0.5)



hold on
h1=plot(array_sim(n_cas(iiv)).xst,array_sim(n_cas(iiv)).zst);
set(h1,'Color','black')
h1.LineWidth=l_st;

caxis([colormin_k colormax_k]) 
% hy = ylabel('$z/H$','FontSize',30);
% set(hy,'interpreter','Latex','FontSize',18)
set(gca, 'FontSize', 15);
yticks([])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [])

letter = {'nothing',...
'$\lambda/H_{1}=\infty$',...  
'nothing',...
'$\lambda/H_{1}=19.2$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=9.2$',...
'$\lambda/H_{1}=9.2$',...
'nothing',...
'$\lambda/H_{1}=8.5$',...
'$\lambda/H_{1}=6.9$',...
'$\lambda/H_{1}=6.9$',...
'nothing',...
'$\lambda/H_{1}=5.8$',...
'$\lambda/H_{1}=4.6$',...
'$\lambda/H_{1}=4.6$'};
text(pos_letter_x,pos_letter_y,letter(iiv),'Interpreter','latex','FontSize',fontsize)



end









axes(ha(length(n_cas)-1));
mapmaskmanuel(array_exp(1).x,array_exp(1).z,array_exp(1).k,array_exp(1).k,array_exp(1).k,colormin_k,colormax_k,0,20)
   
hold on
h1=plot(array_exp(5).xst(1:1350)+0.3,array_exp(5).zst(1:1350)-0.2);
set(h1,'Color','black')
h1.LineWidth=l_st;


caxis([colormin_k colormax_k]) 
hy = ylabel('$z/H_{1}$','FontSize',15);
set(hy,'interpreter','Latex','FontSize',15)
hx = xlabel('$x/H_{1}$','FontSize',15);
set(hx,'interpreter','Latex','FontSize',15)
set(gca, 'FontSize',15);
yticks([0 2 4])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [-4 0 4 8 12 16 20 24 26 28])

letter = {'nothing',...
'$\lambda/H_{1}=\infty$',...  
'nothing',...
'$\lambda/H_{1}=19.2$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=9.2$',...
'$\lambda/H_{1}=9.2$',...
'nothing',...
'$\lambda/H_{1}=8.5$',...
'$\lambda/H_{1}=6.9$',...
'$\lambda/H_{1}=6.9$',...
'nothing',...
'$\lambda/H_{1}=5.8$',...
'$\lambda/H_{1}=4.6$',...
'$\lambda/H_{1}=4.6$'};

pos_letter_x_down = 8;
pos_letter_y_down = 4.8;

text(pos_letter_x_down,pos_letter_y_down,letter(length(n_cas)),'Interpreter','latex','FontSize',fontsize)






axes(ha(length(n_cas)));

mapmaskmanuel(array_sim(1).x(:,1:end),array_sim(1).z(:,1:end),array_sim(1).k(:,1:end),array_sim(1).k(:,1:end),array_sim(1).k(:,1:end),colormin_k,colormax_k,0,0.5)

hold on
h1=plot(array_sim(13).xst(1:2670)+0.3,array_sim(13).zst(1:2670)-0.1);
set(h1,'Color','black')
h1.LineWidth=l_st;


caxis([colormin_k colormax_k]) 
% hy = ylabel('$z/H$','FontSize',30);
% set(hy,'interpreter','Latex','FontSize',30)
hx = xlabel('$x/H_{1}$','FontSize',15);
set(hx,'interpreter','Latex','FontSize',15)
set(gca, 'FontSize', 15);
yticks([])
ylim([y_lim(1) y_lim(2)])
xlim([x_lim(1) x_lim(2)])
set(gca,'TickLabelInterpreter', 'Latex');
pbaspect([aspect1 1 1])  
set(gca, 'xTick', [-4 0 4 8 12 16 20 24 26 28])

letter = {'nothing',...
'$\lambda/H_{1}=\infty$',...  
'nothing',...
'$\lambda/H_{1}=19.2$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=12.9$',...
'$\lambda/H_{1}=9.2$',...
'$\lambda/H_{1}=9.2$',...
'nothing',...
'$\lambda/H_{1}=8.5$',...
'$\lambda/H_{1}=6.9$',...
'$\lambda/H_{1}=6.9$',...
'nothing',...
'$\lambda/H_{1}=5.8$',...
'$\lambda/H_{1}=4.6$',...
'$\lambda/H_{1}=4.6$'};
text(pos_letter_x_down,pos_letter_y_down,letter(length(n_cas)),'Interpreter','latex','FontSize',fontsize)



axes('Position',[.58 .33 .28 .38])
caxis([colormin_k colormax_k]); 
c = colorbar('vertical'); 
colormap jet
axis off
set(gca, 'FontSize', 30);
ylabel(c, '$k/U_{flow}^2$','interpreter','Latex', 'FontSize', 30)
    