-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathanimate.m
80 lines (75 loc) · 1.76 KB
/
animate.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
source('lib/myconfig.m');
source('lib/form.m');
source('lib/abaqus.m');
source('lib/flc.m');
model_inp = 'abaqus.inp';
rpt_dir = './frame/';
frame_dir = './gif/';
cache_start();
part = abaqus_load(model_inp);
blank = part.blank;
clear part;
meshgrid = abaqus_mesh(blank.element);
[x0,y0,z0] = qshell(blank.node, meshgrid);
n = 0.10;
flc = [-n 2*n; 0 n; flc_mk(n,0.995)];
flcolor = fld_colormap();
cache_stop();
%figure (1, 'visible', 'off');
report = readdir (rpt_dir);
for frame = 3:length(report)
tic();
[~,name,~] = fileparts(report{frame});
png = strcat(frame_dir,name,'.png');
if(file_exist(png)) continue; endif;
clf;
%close all;
rpt = strcat(rpt_dir,report{frame})
r = abaqus_report(rpt, 7);
le = [r(:,6) r(:,4)];
u = [r(:,1), r(:,2) r(:,3)];
%
U = meshgrid_apply(meshgrid, u);
[u1,u2,u3] = deal(U(:,:,1), U(:,:,2), U(:,:,3));
[x,y,z] = deal(x0+u1, y0+u2, z0+u3);
%
fld = fld_create(le, n, flc, 0.2);
FLD = meshgrid_apply(meshgrid, fld);
printf('report %.2f\n', toc())
%
% MESH
tic();
subplot(1,2,2)
hsurf = surf(x,y,z,FLD);
set(hsurf, 'edgecolor',[.5 .5 .5], 'linewidth',.1, 'linestyle',':')
xlabel('{\it x}');
ylabel('{\it y}');
zlabel('{\it z}');
z = zlabel('{\it z}');
set(z, 'units', 'normalized', 'position', [-0.15 0.44 0]);
grid off
colormap(flcolor);
caxis([1,10]);
view([30 45]);
set (gca (), 'xlim', [0, 30])
set (gca (), 'ylim', [0, 30])
set (gca (), 'zlim', [-5, 15])
pbaspect([1 1 1]);
daspect([1 1 1]);
% FLD
subplot(1,2,1)
hold on
scatter(le(:,1),le(:,2),100, flcolor(fld,:),'.');
fld_plot(n, flc);
caxis([1,10]);
axis tight
set (gca (), 'ylim', [0, 0.4])
pbaspect([1 1 1]);
daspect([1 1 1]);
hold off
%%%
png
print('-dpng', png, '-r300','-Ftimes:2', '-S780,360')
%
printf('print %.2f\n', toc())
endfor