| 1 |
adj = load('cell_to_node_quad.txt') + 1; %% load node adjacency, increment by 1 for 1-based indexing |
| 2 |
nodes = load('nodes.txt'); %% load node coordinates |
| 3 |
n = length(nodes); |
| 4 |
N = 3*length(nodes); %% determine number of nodes |
| 5 |
|
| 6 |
%% Read in state |
| 7 |
state = importdata('initial_condition_Re200.txt',' ',2); |
| 8 |
state = state.data; |
| 9 |
map = importdata('map_initial_condition_Re200.txt',' ',9); |
| 10 |
map = map.data; |
| 11 |
map = map(1:2:end)+1; |
| 12 |
[tmp, perm] = sort(map); |
| 13 |
state = state(perm); %% we need to permute the state according to parallel maps |
| 14 |
|
| 15 |
Ux = state(1:3:N); |
| 16 |
Uy = state(2:3:N); |
| 17 |
P = state(3:3:N); |
| 18 |
Um = sqrt(Ux.^2 + Uy.^2); |
| 19 |
|
| 20 |
minUx = min(Ux); maxUx = max(Ux); |
| 21 |
minUy = min(Uy); maxUy = max(Uy); |
| 22 |
minUm = min(Um); maxUm = max(Um); |
| 23 |
minP = min(P); maxP = max(P); |
| 24 |
|
| 25 |
axsize = 400; |
| 26 |
figure('Position', [100 100 4*axsize 4*axsize]); |
| 27 |
subplot(3,2,[1 2]) |
| 28 |
quiver(nodes(:,1), nodes(:,2), Ux, Uy); |
| 29 |
axis('equal','tight'); |
| 30 |
xlabel('x'); |
| 31 |
ylabel('y'); |
| 32 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 33 |
|
| 34 |
subplot(3,2,3) |
| 35 |
trisurf(adj, nodes(:,1), nodes(:,2), Ux); |
| 36 |
shading interp; |
| 37 |
view(0,90) |
| 38 |
axis('equal','tight'); |
| 39 |
xlabel('x'); |
| 40 |
ylabel('y'); |
| 41 |
caxis([minUx,maxUx]) |
| 42 |
colormap(bone) |
| 43 |
title('x-Velocity','fontsize',16); |
| 44 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 45 |
|
| 46 |
subplot(3,2,4) |
| 47 |
trisurf(adj, nodes(:,1), nodes(:,2), Um); |
| 48 |
shading interp; |
| 49 |
view(0,90) |
| 50 |
axis('equal','tight'); |
| 51 |
xlabel('x'); |
| 52 |
ylabel('y'); |
| 53 |
caxis([minUm,maxUm]) |
| 54 |
colormap(bone) |
| 55 |
title('Velocity Magnitude','fontsize',16); |
| 56 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 57 |
|
| 58 |
subplot(3,2,5) |
| 59 |
trisurf(adj, nodes(:,1), nodes(:,2), Uy); |
| 60 |
shading interp; |
| 61 |
view(0,90) |
| 62 |
axis('equal','tight'); |
| 63 |
xlabel('x'); |
| 64 |
ylabel('y'); |
| 65 |
caxis([minUy,maxUy]) |
| 66 |
colormap(bone) |
| 67 |
title('y-Velocity','fontsize',16); |
| 68 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 69 |
|
| 70 |
subplot(3,2,6) |
| 71 |
trisurf(adj, nodes(:,1), nodes(:,2), P); |
| 72 |
shading interp; |
| 73 |
view(0,90) |
| 74 |
axis('equal','tight'); |
| 75 |
xlabel('x'); |
| 76 |
ylabel('y'); |
| 77 |
caxis([minP,maxP]) |
| 78 |
colormap(bone) |
| 79 |
title('Pressure','fontsize',16); |
| 80 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 81 |
|
| 82 |
printFig = true; |
| 83 |
if printFig |
| 84 |
addpath ~/research/export_fig-master |
| 85 |
|
| 86 |
figure, |
| 87 |
quiver(nodes(:,1), nodes(:,2), Ux, Uy, 0.5); |
| 88 |
axis equal |
| 89 |
axis tight |
| 90 |
xlim([-2,6]) |
| 91 |
ylim([-2,2]) |
| 92 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 93 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 94 |
set(gca,'Visible','off') |
| 95 |
set(gcf,'color','white') |
| 96 |
print('-depsc2','initial_velocity_quiver.eps') |
| 97 |
|
| 98 |
figure, |
| 99 |
trisurf(adj, nodes(:,1), nodes(:,2), Ux); |
| 100 |
shading interp; |
| 101 |
view(0,90) |
| 102 |
axis equal |
| 103 |
axis tight |
| 104 |
xlim([-5,15]) |
| 105 |
ylim([-5,5]) |
| 106 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 107 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 108 |
set(gca,'Visible','off') |
| 109 |
set(gcf,'color','white') |
| 110 |
colormap(bone) |
| 111 |
export_fig('initial_velocity_x','-png','-painters','-m3','-a3'); |
| 112 |
|
| 113 |
figure, |
| 114 |
trisurf(adj, nodes(:,1), nodes(:,2), Uy); |
| 115 |
shading interp; |
| 116 |
view(0,90) |
| 117 |
axis equal |
| 118 |
axis tight |
| 119 |
xlim([-5,15]) |
| 120 |
ylim([-5,5]) |
| 121 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 122 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 123 |
set(gca,'Visible','off') |
| 124 |
set(gcf,'color','white') |
| 125 |
colormap(bone) |
| 126 |
export_fig('initial_velocity_y','-png','-painters','-m3','-a3'); |
| 127 |
|
| 128 |
figure, |
| 129 |
trisurf(adj, nodes(:,1), nodes(:,2), Um); |
| 130 |
shading interp; |
| 131 |
view(0,90) |
| 132 |
axis equal |
| 133 |
axis tight |
| 134 |
xlim([-5,15]) |
| 135 |
ylim([-5,5]) |
| 136 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 137 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 138 |
set(gca,'Visible','off') |
| 139 |
set(gcf,'color','white') |
| 140 |
colormap(bone) |
| 141 |
export_fig('initial_velocity_mag','-png','-painters','-m3','-a3'); |
| 142 |
|
| 143 |
figure, |
| 144 |
trisurf(adj, nodes(:,1), nodes(:,2), P); |
| 145 |
shading interp; |
| 146 |
view(0,90) |
| 147 |
axis equal |
| 148 |
axis tight |
| 149 |
xlim([-5,15]) |
| 150 |
ylim([-5,5]) |
| 151 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 152 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 153 |
set(gca,'Visible','off') |
| 154 |
set(gcf,'color','white') |
| 155 |
colormap(bone) |
| 156 |
export_fig('initial_pressure','-png','-painters','-m3','-a3'); |
| 157 |
|
| 158 |
x = linspace(-30,30,500).'; |
| 159 |
y = linspace(-15,15,250).'; |
| 160 |
[X,Y] = meshgrid(x,y); |
| 161 |
Fx = scatteredInterpolant(nodes(:,1), nodes(:,2), Ux, 'natural'); |
| 162 |
Fy = scatteredInterpolant(nodes(:,1), nodes(:,2), Uy, 'natural'); |
| 163 |
Vx = Fx(X,Y); |
| 164 |
Vy = Fy(X,Y); |
| 165 |
[cz,~] = curl(X, Y, Vx, Vy); |
| 166 |
Cz = interp2(X, Y, cz, nodes(:,1), nodes(:,2)); |
| 167 |
figure, |
| 168 |
trisurf(adj, nodes(:,1), nodes(:,2), Cz) |
| 169 |
%contour(X, Y, Cz, 30) |
| 170 |
shading interp; |
| 171 |
view(0,90) |
| 172 |
axis equal |
| 173 |
axis tight |
| 174 |
xlim([-5,15]) |
| 175 |
ylim([-5,5]) |
| 176 |
set(gca,'XTickLabelMode','manual','XTickLabel',[]) |
| 177 |
set(gca,'YTickLabelMode','manual','YTickLabel',[]) |
| 178 |
set(gca,'Visible','off') |
| 179 |
%box on |
| 180 |
set(gcf,'color','white') |
| 181 |
%print('-depsc2','initial_vorticity.eps') |
| 182 |
colormap(bone) |
| 183 |
export_fig('initial_vorticity','-png','-painters','-m3','-a3'); |
| 184 |
end |
| 185 |
|