| 1 |
|
| 2 |
a = dir('control.*.txt'); |
| 3 |
nt = numel(a); |
| 4 |
|
| 5 |
adj = load('cell_to_node_quad.txt') + 1; %% load node adjacency table, increment by 1 for 1-based indexing |
| 6 |
|
| 7 |
nodes = load('nodes.txt'); %% load node coordinates |
| 8 |
|
| 9 |
axsize = 400; |
| 10 |
|
| 11 |
figure('Position', [100 100 2*axsize 2*axsize]); |
| 12 |
for i=0:nt-1 |
| 13 |
ctrl = importdata(['control.',int2str(i),'.txt'], ' ', 2); %% we need to skip the first two lines |
| 14 |
trisurf(adj, nodes(:,1), nodes(:,2), ctrl.data); |
| 15 |
shading interp; |
| 16 |
view(2); |
| 17 |
axis equal; |
| 18 |
axis tight; |
| 19 |
title(['Time t = ',num2str(i/(nt-1))],'fontsize',16); |
| 20 |
xlabel('x'); |
| 21 |
ylabel('y'); |
| 22 |
colorbar |
| 23 |
caxis([0,10]) |
| 24 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 25 |
drawnow |
| 26 |
end |
| 27 |
|
| 28 |
figure('Position', [100 100 2*axsize 2*axsize]); |
| 29 |
for i=0:nt-1 |
| 30 |
state = importdata(['state.',int2str(i),'.txt'], ' ', 2); %% we need to skip the first two lines |
| 31 |
trisurf(adj, nodes(:,1), nodes(:,2), state.data); |
| 32 |
shading interp; |
| 33 |
view(2); |
| 34 |
axis equal; |
| 35 |
axis tight; |
| 36 |
title(['Time t = ',num2str(i/(nt-1))],'fontsize',16); |
| 37 |
xlabel('x'); |
| 38 |
ylabel('y'); |
| 39 |
colorbar |
| 40 |
caxis([0,1.25]) |
| 41 |
set(gca, 'FontSize', 16); set(gcf, 'Color', 'White');% tightfig; |
| 42 |
drawnow |
| 43 |
end |