-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotStreamtubes2d.m
58 lines (48 loc) · 1.49 KB
/
plotStreamtubes2d.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
function FigureH = plotStreamtubes2d(Nodes, Tubes, Mask)
%PLOTSTREAMTUBES plot map of surface streamtubes for a single flow
% plotStreamtubes2d(Nodes, Tubes) plots streamtubes defined by Nodes and
% Tubes.
%
% Richard Measures, NIWA, 2016
%
% See also plotStreamtubes delft3d_streamtubes streamtubeXS
FigureH = figure;
NoOfNodes = size(Nodes{1,1},1);
NoOfVerts = size(Tubes{1,1},2);
NoOfLayers = size(Tubes{1,1},1);
% Plot streamlines
NodeCoords = Nodes(:);
NodeCoords = permute(cell2mat(permute(NodeCoords,[2,3,1])),[3,1,2]);
for NodeNo = 1:NoOfNodes
if NodeCoords(1,NodeNo,3) == 0 %this plots only the first layer
plot(NodeCoords(:,NodeNo,1),NodeCoords(:,NodeNo,2),'k-');
hold on
end
end
clear NodeCoords
% Plot cross-sections
for XsNo = 1:size(Tubes,1)
Tube=Tubes{XsNo,1};
MaskTube = Mask{XsNo,1};
LayerNo = 1; %use only the first
for VertNo = 1:NoOfVerts
NodeNumber = Tube{LayerNo,VertNo}; % %Node number (4 values that define one tube
MaskValue = MaskTube{LayerNo,VertNo};
if(MaskValue==1)
plot(Nodes{XsNo,1}(NodeNumber,1),...
Nodes{XsNo,1}(NodeNumber,2),...
'b-');
else
plot(Nodes{XsNo,1}(NodeNumber,1),...
Nodes{XsNo,1}(NodeNumber,2),...
'r-');
end
end
hold on
end
hold off
% adjust formatting
axis equal
xlabel('Easting [m]')
ylabel('Northing [m]')
end