| 1 |
|
| 2 |
function plotFlow(name) |
| 3 |
|
| 4 |
adj = load('cell_to_node_quad.txt') + 1; %% load node adjacency, increment by 1 for 1-based indexing |
| 5 |
nodes = load('nodes.txt'); %% load node coordinates |
| 6 |
N = 3*length(nodes); %% determine number of nodes |
| 7 |
|
| 8 |
%% Read in state |
| 9 |
state = importdata([name,'.txt']); |
| 10 |
[M,nt] = size(state); |
| 11 |
map = importdata(['map_',name,'.txt']); |
| 12 |
map = map(1:2:end)+1; |
| 13 |
[tmp, perm] = sort(map); |
| 14 |
state = state(perm,:); %% we need to permute the state according to parallel maps |
| 15 |
|
| 16 |
Ux = state(1:3:N,:); |
| 17 |
Uy = state(2:3:N,:); |
| 18 |
P = state(3:3:N,:); |
| 19 |
Um = sqrt(Ux.^2 + Uy.^2); |
| 20 |
|
| 21 |
minUx = min(min(Ux)); maxUx = max(max(Ux)); |
| 22 |
minUy = min(min(Uy)); maxUy = max(max(Uy)); |
| 23 |
minUm = min(min(Um)); maxUm = max(max(Um)); |
| 24 |
minP = min(min(P)); maxP = max(max(P)); |
| 25 |
|
| 26 |
axsize = 400; |
| 27 |
figure('Position', [100 100 4*axsize 4*axsize]); |
| 28 |
for i=1:nt |
| 29 |
subplot(3,2,[1 2]) |
| 30 |
quiver(nodes(:,1), nodes(:,2), Ux(:,i), Uy(:,i)); |
| 31 |
axis('equal','tight'); |
| 32 |
xlabel('x'); |
| 33 |
ylabel('y'); |
| 34 |
title(['Time/T = ',num2str((i-1)/(nt-1))],'fontsize',16); |
| 35 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 36 |
|
| 37 |
subplot(3,2,3) |
| 38 |
trisurf(adj, nodes(:,1), nodes(:,2), Ux(:,i)); |
| 39 |
shading interp; |
| 40 |
view(0,90) |
| 41 |
axis('equal','tight'); |
| 42 |
xlabel('x'); |
| 43 |
ylabel('y'); |
| 44 |
caxis([minUx,maxUx]) |
| 45 |
colormap(bone) |
| 46 |
title('x-Velocity','fontsize',16); |
| 47 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 48 |
|
| 49 |
subplot(3,2,4) |
| 50 |
trisurf(adj, nodes(:,1), nodes(:,2), Um(:,i)); |
| 51 |
shading interp; |
| 52 |
view(0,90) |
| 53 |
axis('equal','tight'); |
| 54 |
xlabel('x'); |
| 55 |
ylabel('y'); |
| 56 |
caxis([minUm,maxUm]) |
| 57 |
colormap(bone) |
| 58 |
title('Velocity Magnitude','fontsize',16); |
| 59 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 60 |
|
| 61 |
subplot(3,2,5) |
| 62 |
trisurf(adj, nodes(:,1), nodes(:,2), Uy(:,i)); |
| 63 |
shading interp; |
| 64 |
view(0,90) |
| 65 |
axis('equal','tight'); |
| 66 |
xlabel('x'); |
| 67 |
ylabel('y'); |
| 68 |
caxis([minUy,maxUy]) |
| 69 |
colormap(bone) |
| 70 |
title('y-Velocity','fontsize',16); |
| 71 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 72 |
|
| 73 |
subplot(3,2,6) |
| 74 |
trisurf(adj, nodes(:,1), nodes(:,2), P(:,i)); |
| 75 |
shading interp; |
| 76 |
view(0,90) |
| 77 |
axis('equal','tight'); |
| 78 |
xlabel('x'); |
| 79 |
ylabel('y'); |
| 80 |
caxis([minP,maxP]) |
| 81 |
colormap(bone) |
| 82 |
title('Pressure','fontsize',16); |
| 83 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 84 |
|
| 85 |
drawnow |
| 86 |
end |