You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
349 lines
11 KiB
349 lines
11 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-03-21 10:15:52
|
|
% @LastEditTime: 2021-04-22 13:29:41
|
|
|
|
% plot error curves by micro % macro size
|
|
%--------------------------
|
|
|
|
% micro_size();
|
|
|
|
% material_differ();
|
|
|
|
% add_dofs();
|
|
|
|
% bending();
|
|
|
|
obj_curves()
|
|
|
|
function obj_curves()
|
|
% datapath = "data/mat/cvt_mesh_cantilever_v0.4.mat";
|
|
datapath = "F:\project\7-current_opt\model-paper\CVE\tree\tree 0.1\C.txt";
|
|
load(datapath);
|
|
|
|
datapath = "F:\project\7-current_opt\model-paper\CVE\tree\tree 0.1\E.txt";
|
|
load(datapath);
|
|
|
|
figure;
|
|
axes1 = gca;
|
|
|
|
yyaxis(axes1, 'left');
|
|
plot(1:100, C, 'LineWidth',2, 'Color',[0,0,0]);
|
|
% yticks(linspace(100,400,4));
|
|
% set(axes1,'YColor',[0 0 0],'Ylim',[100,400]);
|
|
ylabel('Compliance C', 'Color','k', 'FontSize',14, 'FontWeight','bold');
|
|
|
|
hold on;
|
|
yyaxis(axes1, 'right');
|
|
right_color = [0,0,1];
|
|
|
|
plot(1:100, E,':', 'LineWidth',2, 'Color',right_color);
|
|
% yticks(linspace(0,600,4));
|
|
% set(axes1,'YColor',right_color,'Ylim',[0,600]);
|
|
ylabel('CVT energy E_s','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
|
|
set(gca,'FontSize',14,'FontWeight','bold');
|
|
set(gca,'XColor',[0 0 0],'Xlim',[0, 100]);
|
|
xlabel('Iteration','Color','k','FontSize',14);
|
|
|
|
box(gca,'on');
|
|
grid(gca,'on');
|
|
|
|
% set(axes1,'FontSize',14,'FontWeight','bold');
|
|
legend(gca,'show');
|
|
set(gca, 'YMinorGrid','off');
|
|
end
|
|
|
|
function bending()
|
|
idx = 1;
|
|
xsize(idx) = idx; % 1,10
|
|
PBC_err(idx) = 0.69;
|
|
FE2_err(idx) = 0.77;
|
|
CMCM_err(idx) = 0.25;
|
|
linear_err(idx) = 0.04;
|
|
bezier_err(idx) = 0.01;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 2,20
|
|
PBC_err(idx) = 0.59;
|
|
FE2_err(idx) = 0.26;
|
|
CMCM_err(idx) = 0.008;
|
|
linear_err(idx) = 0.03;
|
|
bezier_err(idx) = 0.005;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 4,80
|
|
PBC_err(idx) = 0.27;
|
|
FE2_err(idx) = 0.004;
|
|
CMCM_err(idx) = 0.16;
|
|
linear_err(idx) = 0.02;
|
|
bezier_err(idx) = 6e-5;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 8,160
|
|
PBC_err(idx) = 0.66;
|
|
FE2_err(idx) = 0.02;
|
|
CMCM_err(idx) = 0.09;
|
|
linear_err(idx) = 4e-3;
|
|
bezier_err(idx) = 2e-6;
|
|
idx = idx+1;
|
|
|
|
figure;
|
|
|
|
% subplot(1,5,1);
|
|
semilogy(xsize, PBC_err, 'LineWidth',2, 'Color',[0.717647058823529 0.274509803921569 1]);
|
|
% set(gca,'YColor',[0 0 0],'Ylim',[0,0.8], 'YGrid','on','XTick',zeros(1,0));
|
|
set(gca,'FontSize',14,'FontWeight','bold');
|
|
xlabel(['Homoge- ';'nization'],'Color','k','FontSize',14);
|
|
ylabel('Displacement error r_U', 'Color','k','FontSize',14);
|
|
|
|
hold on;
|
|
|
|
% subplot(1,5,2);
|
|
semilogy(xsize, FE2_err, 'LineWidth',2, 'Color',[0.074509803921569 0.623529411764706 1]);
|
|
% set(gca,'YColor',[0 0 0],'Ylim',[0,0.8], 'YGrid','on', 'YTickLabel',...
|
|
% {'','','','','',''}, 'XTick',zeros(1,0));
|
|
% set(gca,'FontSize',14,'FontWeight','bold');
|
|
% xlabel('FE2','Color','k','FontSize',14);
|
|
|
|
% subplot(1,5,3);
|
|
semilogy(xsize, CMCM_err, 'LineWidth',2, 'Color',[0.392156862745098 0.831372549019608 0.074509803921569]);
|
|
% set(gca,'YColor',[0 0 0],'Ylim',[0,0.8], 'YGrid','on', 'YTickLabel',...
|
|
% {'','','','','',''}, 'XTick',zeros(1,0));
|
|
% set(gca,'FontSize',14,'FontWeight','bold');
|
|
% xlabel('CMCM','Color','k','FontSize',14);
|
|
|
|
% subplot(1,5,4);
|
|
semilogy(xsize, linear_err, 'LineWidth',2, 'Color',[1 0.074509803921569 0.650980392156863]);
|
|
% set(gca,'YColor',[0 0 0],'Ylim',[0,0.8], 'YGrid','on', 'YTickLabel',...
|
|
% {'','','','','',''}, 'XTick',zeros(1,0));
|
|
% set(gca,'FontSize',14,'FontWeight','bold');
|
|
% xlabel('Linear-itp','Color','k','FontSize',14);
|
|
|
|
% subplot(1,5,5);
|
|
semilogy(xsize, bezier_err, 'LineWidth',2, 'Color',[1 0 0]);
|
|
% set(gca,'YColor',[0 0 0],'Ylim',[0,0.8], 'YGrid','on', 'YTickLabel',...
|
|
% {'','','','','',''}, 'XTick',zeros(1,0));
|
|
set(gca,'FontSize',14,'FontWeight','bold');
|
|
% xlabel('Our','Color','k','FontSize',14);
|
|
|
|
set(gca,'XColor',[0 0 0],'XTick',[1:4],'XTickLabel',["1\times 10","2\times 20",'4\times 40','8\times 80'],'Xlim',[1, 4]);
|
|
xlabel('Macro-size','Color','k','FontSize',14);
|
|
|
|
box(gca,'on');
|
|
grid(gca,'on');
|
|
|
|
% set(axes1,'FontSize',14,'FontWeight','bold');
|
|
legend(gca,'show');
|
|
end
|
|
|
|
function [xsize, e_err, u_err] = add_dofs()
|
|
idx = 1;
|
|
xsize(idx) = idx; % add 0
|
|
e_err(idx) = 0.0098;
|
|
u_err(idx) = 0.01;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % add 1
|
|
e_err(idx) = 4.4e-4;
|
|
u_err(idx) = 4.8e-4;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % add 4
|
|
e_err(idx) = 4.2e-7;
|
|
u_err(idx) = 4.7e-5;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % add 8
|
|
e_err(idx) = 1.2e-28;
|
|
u_err(idx) = 6.6e-30;
|
|
|
|
figure;
|
|
axes1 = gca;
|
|
|
|
set(axes1,'XColor',[0 0 0],'XTick',[0:3],'XTickLabel',["2","5","10","22"],'Xlim',[-0, 3]);
|
|
xlabel('The number of coarse bridge nodes on one edge','Color','k','FontSize',14);
|
|
|
|
yyaxis(axes1, 'left');
|
|
semilogy([0:3], e_err,'-o','Color', 'k','MarkerFaceColor',[1,1,1],'MarkerEdgeColor', 'k',...
|
|
'DisplayName','r_e','LineWidth',2);
|
|
|
|
yticks([10e-30, 10e-23, 10e-16, 10e-9, 10e-2 ]);
|
|
yticklabels({'10e^{-30}', '10e^{-23}', '10e^{-16}', '10e^{-9}', '10e^{-2}'});
|
|
set(axes1,'YColor',[0 0 0],'Ylim',[10e-30,10e-2]);
|
|
% set(axes1,'YColor',[0 0 0],'Ylim',[10e-31,10e-1]);
|
|
ylabel('Energy error r_e', 'Color','k', 'FontSize',14, 'FontWeight','bold');
|
|
|
|
yyaxis(axes1, 'right');
|
|
right_color = [0,0,1];
|
|
|
|
semilogy([0:3], u_err,'->','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
'DisplayName','r_U','LineWidth',2);
|
|
yticks([10e-30, 10e-23, 10e-16, 10e-9, 10e-2 ]);
|
|
yticklabels({'10e^{-30}', '10e^{-23}', '10e^{-16}', '10e^{-9}', '10e^{-2}'});
|
|
set(axes1,'YColor',right_color,'Ylim',[10e-30,10e-2]);
|
|
% set(axes1,'YColor',right_color,'Ylim',[10e-31,10e-1]);
|
|
ylabel('Displacement error r_U','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
|
|
box(axes1,'on');
|
|
grid(axes1,'on');
|
|
set(axes1,'FontSize',14,'FontWeight','bold');
|
|
legend(axes1,'show');
|
|
grid minor
|
|
grid minor
|
|
end
|
|
|
|
|
|
function [xsize, e_err, u_err] = material_differ()
|
|
idx = 1;
|
|
xsize(idx) = idx; % 1:1
|
|
e_err(idx) = 9.8e-4;
|
|
u_err(idx) = 9.9e-4;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 1:5
|
|
e_err(idx) = 6.2e-4;
|
|
u_err(idx) = 7.8e-4;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 1:100
|
|
e_err(idx) = 7.4e-4;
|
|
u_err(idx) = 8.8e-4;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 1:1000
|
|
e_err(idx) = 7.9e-4;
|
|
u_err(idx) = 9.1e-4;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx; % 1:1e6
|
|
e_err(idx) = 7.9e-4;
|
|
u_err(idx) = 9.2e-4;
|
|
|
|
figure;
|
|
axes1 = gca;
|
|
|
|
set(axes1,'XColor',[0 0 0],'XTick',[0:4],'XTickLabel',["1:1","1:5","1:100","1:1e3","1:1e6"],'Xlim',[0, 4]);
|
|
xlabel('The ratios of Youngs modulus of the inclusions and matrices','Color','k','FontSize',14);
|
|
|
|
yyaxis(axes1, 'left');
|
|
plot([0:4], e_err,'-o','Color', 'k','MarkerFaceColor',[1,1,1],'MarkerEdgeColor', 'k',...
|
|
'DisplayName','r_e','LineWidth',2);
|
|
|
|
set(axes1,'YColor',[0 0 0],'YTick',linspace(5e-4,1e-3,3),'Ylim',[5e-4,1e-3]);
|
|
ylabel('Energy error r_e', 'Color','k', 'FontSize',14, 'FontWeight','bold');
|
|
|
|
|
|
yyaxis(axes1, 'right');
|
|
right_color = [0,0,1];
|
|
|
|
plot([0:4], u_err,'->','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
'DisplayName','r_U','LineWidth',2);
|
|
set(axes1,'YColor',right_color,'YTick',linspace(5e-4,1e-3,3),'Ylim',[5e-4,1e-3]);
|
|
ylabel('Displacement error r_U','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
|
|
box(axes1,'on');
|
|
grid(axes1,'on');
|
|
set(axes1,'FontSize',14,'FontWeight','bold');
|
|
legend(axes1,'show');
|
|
end
|
|
|
|
|
|
function [xsize, e_err, u_err] = micro_size()
|
|
idx = 1;
|
|
xsize(idx) = idx;
|
|
e_err(idx) = 0.0098;
|
|
u_err(idx) = 0.01;
|
|
linear_e(idx) = 0.087;
|
|
linear_u(idx) = 0.075;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx;
|
|
e_err(idx) = 0.0045;
|
|
u_err(idx) = 0.0043;
|
|
linear_e(idx) = 0.074;
|
|
linear_u(idx) = 0.065;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx;
|
|
e_err(idx) = 0.0012;
|
|
u_err(idx) = 0.0013;
|
|
linear_e(idx) = 0.024;
|
|
linear_u(idx) = 0.023;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx;
|
|
e_err(idx) = 1.7e-4;
|
|
u_err(idx) = 1.9e-4;
|
|
linear_e(idx) = 0.0085;
|
|
linear_u(idx) = 0.0079;
|
|
idx = idx+1;
|
|
|
|
xsize(idx) = idx;
|
|
e_err(idx) = 3.1e-6;
|
|
u_err(idx) = 3.4e-6;
|
|
linear_e(idx) = 0.0017;
|
|
linear_u(idx) = 0.0017;
|
|
|
|
% % plots u_err of bezier & linear
|
|
% figure;
|
|
% axes1 = gca;
|
|
% yyaxis(axes1, 'left');
|
|
% right_color = 'k'; % bezier color
|
|
% semilogy([0:4], e_err,'-o','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
% 'DisplayName','r_e','LineWidth',2);
|
|
% % set(gca,'YColor',right_color,'YTick',linspace(0,0.02,4),'YTickLabel',[0 0.007 0.013 0.02],'Ylim',[0, 0.02]);
|
|
% ylabel('Energy error r_e','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
%
|
|
% hold on
|
|
% yyaxis(axes1, 'right');
|
|
% right_color = 'b'; % linear color
|
|
% % semilogy([0:4], linear_u,'->','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
% % 'DisplayName','Linear-itp','LineWidth',2);
|
|
% semilogy([0:4], u_err,'->','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
% 'DisplayName','r_u','LineWidth',2);
|
|
% ylabel('Displacement error r_U','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
%
|
|
% set(gca, 'YMinorGrid','off');
|
|
% % set(gca,'YColor','k','YTick',linspace(1e-6, 1e-1,6),'Ylim',[1e-6, 1e-1]);
|
|
% % ylabel('Displacement error r_U','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
%
|
|
% set(gca,'XColor',[0 0 0],'XTick',[0:4],'XTickLabel',["2\times 4","4\times 8",'8\times 16','16\times 32','32\times 64'],'Xlim',[0, 4]);
|
|
% xlabel('Size of coarse mesh','Color','k','FontSize',14);
|
|
|
|
% The bellowing plots beizer e_err & u_err
|
|
figure;
|
|
axes1 = gca;
|
|
|
|
set(gca,'XColor',[0 0 0],'XTick',[0:4],'XTickLabel',["2\times 4","4\times 8",'8\times 16','16\times 32','32\times 64'],'Xlim',[0, 4]);
|
|
xlabel('Size of coarse mesh','Color','k','FontSize',14);
|
|
% set(axes1,'XColor',[0 0 0],'XTick',[0:4],'XTickLabel',['2\times 4','4\times 8','8\times 16','16\times 32','32\times 64'],'Xlim',[0, 4]);
|
|
% xlabel('Micro-size','Color','k','FontSize',14);
|
|
|
|
yyaxis(axes1, 'left');
|
|
semilogy([0:4], e_err,'-o','Color', 'k','MarkerFaceColor',[1,1,1],'MarkerEdgeColor', 'k',...
|
|
'DisplayName','r_e','LineWidth',2);
|
|
|
|
set(axes1,'YColor',[0 0 0]);
|
|
ylabel('Energy error r_e','Color','k','FontSize',14,'FontWeight','bold');
|
|
|
|
|
|
yyaxis(axes1, 'right');
|
|
right_color = [0,0,1];
|
|
|
|
semilogy([0:4], u_err,'->','Color',right_color,'MarkerFaceColor',[1,1,1],'MarkerEdgeColor',right_color,...
|
|
'DisplayName','r_U','LineWidth',2);
|
|
set(axes1,'YColor',right_color);
|
|
ylabel('Displacement error r_U','Color',right_color,'FontSize',14, 'FontWeight','bold');
|
|
|
|
% % ax = gca;
|
|
% % ax.YAxis(1).Color = 'k';
|
|
% % ax.YAxis(2).Color = right_color;
|
|
|
|
box(gca,'on');
|
|
grid(gca,'on');
|
|
set(gca,'FontSize',14,'FontWeight','bold');
|
|
legend(gca,'show');
|
|
grid minor
|
|
grid minor
|
|
end
|