clear;close all;
%----------cut line of pFEA
load US_CL_pFEA_025.mat norm_U_CL_pFEA von_S_CL_pFEA

CutLine=get_cutline();

% extract fcm data

%----------------------------plate_1
for i=2:2:6
    eval(['load plate_025_p' num2str(i) 'd5.mat']);
end

%-------------plot movement contrast
figure
plot(CutLine(:,1).*sqrt(2),norm_U_CL_pFEA,'k-');

hold on
plot(CutLine(:,1).*sqrt(2),norm_U2,'k--');
hold on
% plot(CutLine(:,1).*sqrt(2),norm_U4,'k-.');
% hold on
plot(CutLine(:,1).*sqrt(2),norm_U4,'k-.');

hold on
plot(CutLine(:,1).*sqrt(2),norm_U6,'r:');
legend({'pFEA','FCM, p=2','FCM, p=4','FCM, p=6'},'Location',"east");
xlabel('cut line A-B: r')
ylabel('movement norm')
[t,s]=title("Movement norm along cut-line A–B","mesh = 16x16x1, depth=5");
t.FontSize = 13;
s.FontAngle = 'italic';
set(gcf, 'position', [0 0 700 700*0.618]);% set figure size
print(gcf,'-dpng','-r300','norm_U_16x16');

    %------------------------rela_U
    figure
semilogy(CutLine(:,1).*sqrt(2),rela_U2,'k--');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_U4,'k-.');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_U6,'r:');
legend({'FCM, p=2','FCM, p=4','FCM, p=6'},'Location',"best");
xlabel('cut line A-B: r')
ylabel('The relative error of movement norm (%)')
[t,s]=title("The relative error of movement norm along cut-line A–B","mesh = 16x16x1, depth=5");
t.FontSize = 11;
s.FontSize=t.FontSize-1;
s.FontAngle = 'italic';
set(gcf, 'position', [0 0 700 700*0.618]);% set figure size
print(gcf,'-dpng','-r300','rela_U_16x16');
%-------------plot von S contrast
figure
plot(CutLine(:,1).*sqrt(2),von_S_CL_pFEA,'k-');

hold on
plot(CutLine(:,1).*sqrt(2),von_S2,'k--');
hold on

plot(CutLine(:,1).*sqrt(2),von_S4,'k-.');

hold on
plot(CutLine(:,1).*sqrt(2),von_S6,'r:');
legend({'pFEA','FCM, p=2','FCM, p=4','FCM, p=6'},'Location',"best");
xlabel('cut line A-B: r')
ylabel('von Mises stress')
[t,s]=title("Von Mises stress along cut-line A–B","mesh = 16x16x1, depth=5");
t.FontSize = 13;
s.FontAngle = 'italic';
set(gcf, 'position', [0 0 700 700*0.618]);% set figure size
print(gcf,'-dpng','-r300','von_S_16x16');
    %------------------------rela_S
    figure
semilogy(CutLine(:,1).*sqrt(2),rela_S2,'k--');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_S4,'k-.');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_S6,'r:');
legend({'FCM, p=2','FCM, p=4','FCM, p=6'},'Location',"best");
xlabel('cut line A-B: r')
ylabel('The relative error of von Mises stress (%)')
[t,s]=title("The relative error of von Mises stress along cut-line A–B","mesh = 16x16x1, depth=5");
t.FontSize = 12;
s.FontAngle = 'italic';
set(gcf, 'position', [0 0 700 700*0.618]);% set figure size
print(gcf,'-dpng','-r300','rela_S_16x16');
