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

CutLine=get_cutline();

% extract fcm data

%----------------------------plate_1
for i=2:3:8
    eval(['load plate_05_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_U5,'k-.');

hold on
plot(CutLine(:,1).*sqrt(2),norm_U8,'r:');
legend({'pFEA','FCM, p=2','FCM, p=5','FCM, p=8'},'Location',"east");
xlabel('cut line A-B: r')
ylabel('movement norm')
[t,s]=title("Movement norm along cut-line A–B","mesh = 8x8x1, 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_8x8');

    %------------------------rela_U
    figure
semilogy(CutLine(:,1).*sqrt(2),rela_U2,'k--');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_U5,'k-.');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_U8,'r:');
legend({'FCM, p=2','FCM, p=5','FCM, p=8'},'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 = 8x8x1, 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_8x8');
%-------------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_S5,'k-.');

hold on
plot(CutLine(:,1).*sqrt(2),von_S8,'r:');
legend({'pFEA','FCM, p=2','FCM, p=5','FCM, p=8'},'Location',"best");
xlabel('cut line A-B: r')
ylabel('von Mises stress')
[t,s]=title("Von Mises stress along cut-line A–B","mesh = 8x8x1, 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_8x8');
    %------------------------rela_S
    figure
semilogy(CutLine(:,1).*sqrt(2),rela_S2,'k--');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_S5,'k-.');
hold on
semilogy(CutLine(:,1).*sqrt(2),rela_S8,'r:');
legend({'FCM, p=2','FCM, p=5','FCM, p=8'},'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 = 8x8x1, 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_8x8');