forked from xtong5/FireSpreadModel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_streamline.m
102 lines (86 loc) · 2.58 KB
/
plot_streamline.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
clear
close all
filename = 'ember_wash_withVort_MoreStream1_Sec300';
Setname = sprintf('DataSets/dataset_%s.mat',filename);
load(Setname)
save_plot_inter_streams = 1;
save_plot_final_streams = 1;
%% stream lines start location
xstart1 = linspace(22,179,50);
ystart1 = 22*ones(size(xstart1));
ystart2 = linspace(22,179,20);
xstart2 = 22*ones(size(ystart2));
ystart3 = linspace(22,179,20);
xstart3 = 179*ones(size(ystart3));
xstart = [xstart1 xstart2 xstart3];
ystart = [ystart1 ystart2 ystart3];
%% streamlines at a specified time/step
i = 10; %time step
time = prams.dt*(i-1);
fprintf('Stream lines at %g step, %f seconds.\n', i, time)
indicator = zeros(size(cx));
indicator(state(:,:,i) == 2) = 1;
indicator(state(:,:,i) == 1) = 2;
figure(1); clf; hold on
titleStr = ['Time = ' num2str(time,'%4.2e')];
title(titleStr,'fontsize',20)
surface(prams.dx*(cx-0.5)*prams.L,prams.dx*(cy-0.5)*prams.L,indicator);
view(2);
shading flat;
colormap([[0 0 0];[1 0 0];[0.6 1 0.6]])
axis equal
axis([0 prams.dx*prams.N*prams.L 0 prams.dx*prams.N*prams.L])
set(gca,'fontsize',15)
xlabel('meters','fontsize',16)
ylabel('meters','fontsize',16)
xticks([0 50 100 150 200])
yticks([0 50 100 150 200])
h = streamline(cy,cx,vely(:,:,i),velx(:,:,i),ystart,xstart);
for k=1:numel(h)
XData = h(k).XData;
YData = h(k).YData;
h(k).XData = YData;
h(k).YData = XData;
h(k).ZData = 10*ones(size(XData));
h(k).Color = [0 0 1];
end
set(h,'LineWidth',0.2)
if save_plot_inter_streams
name = sprintf('%s_streamlines_at_step%g',filename,i);
saveas(1,name,'png')
end
% streamlines at final step/state
i = size(state,3);
time = prams.dt*(i-1);
fprintf('Stream lines at %g (final)step, %f seconds.\n', i, time)
indicator = zeros(size(cx));
indicator(state(:,:,i) == 2) = 1;
indicator(state(:,:,i) == 1) = 2;
figure(2); clf; hold on
titleStr = ['Time = ' num2str(time,'%4.2e')];
title(titleStr,'fontsize',20)
surface(prams.dx*(cx-0.5)*prams.L,prams.dx*(cy-0.5)*prams.L,indicator);
view(2);
shading flat;
colormap([[0 0 0];[1 0 0];[0.6 1 0.6]])
axis equal
axis([0 prams.dx*prams.N*prams.L 0 prams.dx*prams.N*prams.L])
set(gca,'fontsize',15)
xlabel('meters','fontsize',16)
ylabel('meters','fontsize',16)
xticks([0 50 100 150 200])
yticks([0 50 100 150 200])
h = streamline(cy,cx,vely(:,:,i),velx(:,:,i),ystart,xstart);
for k=1:numel(h)
XData = h(k).XData;
YData = h(k).YData;
h(k).XData = YData;
h(k).YData = XData;
h(k).ZData = 10*ones(size(XData));
h(k).Color = [0 0 1];
end
set(h,'LineWidth',0.2)
if save_plot_final_streams
name = sprintf('%s_streamlines_final_step%g',filename,i);
saveas(2,name,'png')
end