-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlotMesh_show.m
81 lines (64 loc) · 2.54 KB
/
PlotMesh_show.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function PlotMesh_show(U,coordinatesFEM,elementsFEM,varargin)
%PLOTDISP_SHOW: to plot DIC solved displacement components
% Plotdisp_show(U,coordinatesFEM,elementsFEM)
% ----------------------------------------------
%
% INPUT: U Displacement vector:
% U = [Ux_node1, Uy_node1, Ux_node2, Uy_node2, ... , Ux_nodeN, Uy_nodeN]';
% coordinatesFEM FE mesh coordinates
% elementsFEM FE mesh elements
% DICpara chosen DIC parameters
% EdgeColorOrNot show edge color or not
%
% OUTPUT: Plots of x-displacement field and y-displacement field.
%
% TODO: users could change caxis range based on their own choices.
%
% ----------------------------------------------
% Author: Jin Yang.
% Contact and support: [email protected] -or- [email protected]
% Last date modified: 2020.12
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Initialization
warning off; U = full(U);
%%%%% Parse Inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[DICpara,EdgeColorOrNot] = parseargs(varargin);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% convert pixel unit to the physical world unit %%%%%
try um2px = DICpara.um2px;
catch um2px = 1;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try EdgeColorOrNot = EdgeColorOrNot;
catch EdgeColorOrNot = 'EdgeColor';
end
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure; show([],elementsFEM(:,1:4),coordinatesFEM,U(1:1:end),EdgeColorOrNot);
title('Mesh geometry','FontWeight','Normal','Interpreter','latex');
view(2); set(gca,'fontsize',18); axis tight; axis equal; colorbar; % view([90 -90])
if um2px==1, xlabel('$x$ (pixels)','Interpreter','latex'); ylabel('$y$ (pixels)','Interpreter','latex');
else, xlabel('$x$','Interpreter','latex'); ylabel('$y$','Interpreter','latex');
end
set(gcf,'color','w'); colormap jet; box on;
a = gca; a.TickLabelInterpreter = 'latex';
b = colorbar; b.TickLabelInterpreter = 'latex';
colorbar off;
%%%%%% TODO: manually modify colormap and caxis %%%%%%
% colormap(jet); % D Sample
% caxis([-0.1,0.1]) % foam
% caxis([-0.004,0.004]); % Sample 12
% caxis([0,0.1]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [DICpara,EdgeColorOrNot] = parseargs(vargin)
DICpara=[]; EdgeColorOrNot=[];
try
DICpara=vargin{1};
try
EdgeColorOrNot=vargin{2};
catch
end
catch
end
end