forked from eX-Mech/pipeMeshNek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotMesh.m
51 lines (43 loc) · 1.05 KB
/
plotMesh.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
%close all
clear
clc
r = load('plotElements');
R = 0.5;
nR = 5;
nVe = size(r,1);
nEl = nVe/8;
% plot front view
figure(1)
hold off
% outer circle
%
x = linspace(-R,R,100);
plot(x, (R^2 - x.^2).^0.5,'-k','linewidth',2)
hold on
plot(x,-(R^2 - x.^2).^0.5,'-k','linewidth',2)
% inner round circles
%
%for i = 1 : nR
% x = linspace(-R/nR*i,R/nR*i,100);
% plot(x, ((R/nR*i)^2 - x.^2).^0.5,'-k','linewidth',1)
% plot(x,-((R/nR*i)^2 - x.^2).^0.5,'-k','linewidth',1)
%end
% mesh
%
for i = 1:8:nVe
plot([r(i, 2) r(i+1,2)], [r(i, 1) r(i+1,1)], '-b')
plot([r(i+1,2) r(i+2,2)], [r(i+1,1) r(i+2,1)], '-b')
plot([r(i+2,2) r(i+3,2)], [r(i+2,1) r(i+3,1)], '-b')
plot([r(i+3,2) r(i, 2)], [r(i+3,1) r(i, 1)], '-b')
plot(r(i, 2), r(i, 1), '.k')
plot(r(i+1,2), r(i+1,1), '.k')
plot(r(i+2,2), r(i+2,1), '.k')
plot(r(i+3,2), r(i+3,1), '.k')
elLoc = 0.25*(r(i, [1:2]) + r(i+1, [1:2]) + r(i+2, [1:2]) + r(i+3, [1:2]));
text(elLoc(2),elLoc(1),num2str(r(i,4))) % Element number
end
grid on
axis equal
%axis([-0.05 .55 -0.05 .55])
xlabel('y')
ylabel('x')