-
Notifications
You must be signed in to change notification settings - Fork 5
/
main_solve_plot.m
174 lines (157 loc) · 6.61 KB
/
main_solve_plot.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
% clear
% load('main_solve_sm_case12.mat')
% load('main_solve_sm_k=8_Proj.mat')
% load('main_solve_sm_k=2_ROM.mat')
% load('main_solve_sm_k=12_ROM')
% kM = 14;%:2:10%:2:12;
% load('main_solve.mat')
%%
fig1 = figure();
fields = fieldnames(error.Eul_Proj);
for filecount = 1:1:numel(fields)
subplot(1,numel(fields),filecount)
title(fields{filecount})
hold on
loglog(kM, error.Eul_Proj.(fields{filecount}), '.-k', 'DisplayName','$\| U_{w_{Eul}} V_{w_{Eul}} - {w}_{Eul} \|$')
loglog(kM, error.Eul_ROM.(fields{filecount}), 'o--k', 'DisplayName','$\| U_{w_{Eul}} a_{w_{Eul}} - {w}_{Eul} \|$')
loglog(kM, error.ALE_Proj_PALE_2_Eul.(fields{filecount}), 'o-m', 'DisplayName','$\| P(U_{w_{ALE}}) V_{w_{ALE}} - {w}_{Eul} \|$')
loglog(kM, error.ALE_ROM_PALE_2_Eul.(fields{filecount}), 'o--c', 'DisplayName','$\| P(U_{w_{ALE}}) a_{w_{ALE}} - {w}_{Eul} \|$')
% loglog(kM, error.ALE_Proj_ALE2ALE, '.-r', 'DisplayName','$\| U_{w_{ALE}} V_{w_{ALE}} - {w}_{ALE} \|$')
% loglog(kM, error.ALE_Proj_PALE_2_PALE, '*-r', 'DisplayName','$\| P(U_{w_{ALE}}) V_{w_{ALE}} - P({w}_{ALE}) \|$')
% loglog(kM, error.ALE_ROM_PALE_2_PALE, '*--g', 'DisplayName','$\| P(U_{w_{ALE}}) a_{w_{ALE}} - P({w}_{ALE}) \|$')
set(gca, 'XScale', 'log')
set(gca, 'YScale', 'log')
lgd = legend('Location','northeast');
set(lgd,'Interpreter','latex','FontSize',14);
xlabel('$k_w$','Interpreter','latex','FontSize',20);
ylabel('$error$','Interpreter','latex','FontSize',20);
% xlim([0 10])
grid on
end
pause(5.005)
%%
% fields = fieldnames(M_Eulerian);
nnt = size(M_Eulerian.p,2);
for filecount = 1:numel(fields)
M_Eulerian_XY.(fields{filecount}) = reshape( M_Eulerian.(fields{filecount}), [Nx,Ny,nnt]);
M_Eulerian_Proj_XY.(fields{filecount}) = reshape( M_Eulerian_Proj.(fields{filecount}), [Nx,Ny,nnt]);
M_ALE_Proj_on_stationary_grid_XY.(fields{filecount}) = reshape( M_ALE_Proj_on_stationary_grid.(fields{filecount}), [Nx,Ny,nnt]);
end
for filecount = 1:numel(fields)
M_Eulerian_XY.(fields{filecount}) = reshape( M_Eulerian.(fields{filecount}), [Nx,Ny,nnt]);
M_Eulerian_ROM_XY.(fields{filecount}) = reshape( M_Eulerian_ROM.(fields{filecount}), [Nx,Ny,nnt]);
M_ALE_ROM_on_stationary_grid_XY.(fields{filecount}) = reshape( M_ALE_ROM_on_stationary_grid.(fields{filecount}), [Nx,Ny,nnt]);
end
%%
size_t_plot = 10;
fig2 = figure();
Ax = zeros(1,size_t_plot);
tcouner = 1;
filecount = 3;
for tcount = floor(linspace(1,Nt,size_t_plot))
Ax(tcouner) = subplot(5,2,tcouner);
plot(diag(M_Eulerian_XY.(fields{filecount})(:,:,tcount)) ,' -k'); hold on
plot(diag(M_ALE_Proj_on_stationary_grid_XY.(fields{filecount})(:,:,tcount)) ,'.:r');
plot(diag(M_Eulerian_Proj_XY.(fields{filecount})(:,:,tcount)) ,'.-b');
% hold off
drawnow
% pause(0.001)
tcouner=tcouner+1;
ylabel(fields{filecount})
end
xlabel('Nx')
linkaxes(Ax,'xy')
% ylim([-1 1])
%% M_Eulerian_ROM_XY
tcount = Nt;
fig3 = figure();
for varcount = 1:numel(fields)
subplot(3, numel(fields), varcount);
surf(X, Y, M_Eulerian_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t:',num2str(tcount),'/',num2str(Nt)] )
subplot(3, numel(fields), numel(fields)+varcount);
surf(X, Y, M_Eulerian_Proj_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t:',num2str(tcount),'/',num2str(Nt)] )
subplot(3, numel(fields), 2*numel(fields)+varcount);
surf(X, Y, M_ALE_Proj_on_stationary_grid_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t:',num2str(tcount),'/',num2str(Nt)] )
end
%%
saveas(fig1,[num2str(1),'.png'])
saveas(fig2,[num2str(2),'.png'])
saveas(fig3,[num2str(3),'.png'])
%%
tcount = nnt;
fig3 = figure();
colorbar_show='on';% 'on' / 'off'
for varcount = 1:numel(fields)
top1 = -10;
bottom1 = 10;
subplot(3, numel(fields), varcount);
surf(X, Y, M_Eulerian_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t: ',num2str(tcount),'/',num2str(Nt)] )
subplot(3, numel(fields), numel(fields)+varcount);
surf(X, Y, M_Eulerian_ROM_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t: ',num2str(tcount),'/',num2str(Nt)] )
subplot(3, numel(fields), 2*numel(fields)+varcount);
surf(X, Y, M_ALE_ROM_on_stationary_grid_XY.(fields{varcount})(:,:,tcount) )
axis square, shading flat
view([0 90])
title( [(fields{varcount}),', t: ',num2str(tcount),'/',num2str(Nt)] )
bottom = min( min( min(min(min(M_Eulerian_XY.(fields{varcount})))),...
min(min(min(M_Eulerian_XY.(fields{varcount})))) ),...
min(min(min(M_Eulerian_XY.(fields{varcount})))) );
bottom = min(bottom1, bottom);
top = max( max( max(max(max(M_Eulerian_XY.(fields{varcount})))),...
max(max(max(M_Eulerian_XY.(fields{varcount})))) ),...
max(max(max(M_Eulerian_XY.(fields{varcount})))) );
top = max(top1, top);
subplot(3, numel(fields), varcount);
colorbar('Visible',colorbar_show,'Limits',[bottom top]);
subplot(3, numel(fields), numel(fields)+varcount);
colorbar('Visible',colorbar_show,'Limits',[bottom top]);
subplot(3, numel(fields), 2*numel(fields)+varcount);
colorbar('Visible',colorbar_show,'Limits',[bottom top]);
end
%%
size_t_plot = 10;
fig2 = figure();
Ax = zeros(1,size_t_plot);
tcouner = 1;
varcount = 1;
top1 = -10;
bottom1 = 10;
tcount = Nt;
% bottom = min( min( min(min(min(M_Eulerian_XY.(fields{varcount})))),...
% min(min(min(M_Eulerian_ROM_XY.(fields{varcount})))) ),...
% min(min(min(M_Eulerian_ROM_XY.(fields{varcount})))) );
% bottom = min(bottom1, bottom);
% top = max( max( max(max(max(M_Eulerian_XY.(fields{varcount})))),...
% max(max(max(M_Eulerian_ROM_XY.(fields{varcount})))) ),...
% max(max(max(M_Eulerian_ROM_XY.(fields{varcount})))) );
% top = max(top1, top);
for tcount = floor(linspace(1,Nt,size_t_plot))
Ax(tcouner) = subplot(5,2,tcouner);
plot(diag(M_Eulerian_XY.(fields{varcount})(:,:,tcount)) ,' -k'); hold on
plot(diag(M_ALE_ROM_on_stationary_grid_XY.(fields{varcount})(:,:,tcount)) ,'.:r');
plot(diag(M_Eulerian_ROM_XY.(fields{varcount})(:,:,tcount)) ,'.-b');
% hold off
drawnow
pause(0.1)
tcouner=tcouner+1;
ylabel(fields{varcount})
% ylim([floor(bottom*10)/10 ceil(top*10)/10])
xlim([0 Nx])
end
xlabel('Nx')
% linkaxes(Ax,'xy')