source: issm/oecreview/Archive/15392-16133/ISSM-15611-15612.diff@ 16134

Last change on this file since 16134 was 16134, checked in by Mathieu Morlighem, 12 years ago

Added Archive/15392-16133

File size: 5.3 KB
RevLine 
[16134]1Index: ../trunk-jpl/src/m/plot/plot_icefront.m
2===================================================================
3--- ../trunk-jpl/src/m/plot/plot_icefront.m (revision 15611)
4+++ ../trunk-jpl/src/m/plot/plot_icefront.m (revision 15612)
5@@ -11,7 +11,13 @@
6
7 %process mesh and data
8 [x y z elements is2d isplanet]=processmesh(md,[],options);
9-icefront=md.diagnostic.icefront;
10+ice=(md.mask.icelevelset>0);
11+noice=(md.mask.icelevelset<=0);
12+zeroice=(md.mask.icelevelset==0);
13+elementice=sum(ice(md.mesh.elements),2);
14+elementnoice=sum(noice(md.mesh.elements),2);
15+elementzeroice=sum(zeroice(md.mesh.elements),2);
16+icefront=(elementice & elementnoice) & ~(elementice==2 & elementzeroice);
17
18 if (md.mesh.dimension==2),
19
20@@ -21,30 +27,14 @@
21 hold on;
22
23 %highlight elements on neumann
24- pos=find(icefront(:,end)==1);
25- pos=icefront(pos,end-1);
26+ pos=find(icefront);
27 A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
28 h2=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
29- pos=find(icefront(:,end)==0);
30- pos=icefront(pos,end-1);
31- A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
32- h3=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
33+ hold on;
34
35- pos=find(icefront(:,end)==2);
36- pos=icefront(pos,end-1);
37- A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
38- h3bis=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
39+ %Plot zero icelevelset line
40
41- %display arrows pointing outward
42- xstart=mean(x(icefront(:,1:end-2)),2);
43- ystart=mean(y(icefront(:,1:end-2)),2);
44- length=sqrt((x(icefront(:,1))-x(icefront(:,2))).^2 + (y(icefront(:,1))-y(icefront(:,2))).^2 );
45- normal(:,1)=cos(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1)))));
46- normal(:,2)=sin(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1)))));
47- xend=xstart+length.*normal(:,1);
48- yend=ystart+length.*normal(:,2);
49- q=quiver(xstart,ystart,xend-xstart,yend-ystart); hold on;
50- h4=plot(xstart,ystart,'r*');
51+
52 else
53
54 %plot mesh
55@@ -57,47 +47,18 @@
56 hold on;
57
58 %highlight elements on neumann
59- pos=find(icefront(:,end)==1);
60- pos=icefront(pos,end-1);
61+ pos=find(icefront);
62 A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
63 h2=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
64 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
65 patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
66 patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
67 patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
68- pos=find(icefront(:,end)==0);
69- pos=icefront(pos,end-1);
70- A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
71- h3=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
72- patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
73- patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
74- patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
75- patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black');
76- pos=find(icefront(:,end)==2);
77- pos=icefront(pos,end-1);
78- A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
79- h3bis=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
80- patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
81- patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
82- patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
83- patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black');
84-
85- %display arrows pointing outward
86- xstart=mean(x(icefront(:,1:end-2)),2);
87- ystart=mean(y(icefront(:,1:end-2)),2);
88- zstart=mean(z(icefront(:,1:end-2)),2);
89- length=sqrt((x(icefront(:,1))-x(icefront(:,2))).^2 + (y(icefront(:,1))-y(icefront(:,2))).^2 );
90- normal(:,1)=cos(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1)))));
91- normal(:,2)=sin(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1)))));
92- xend=xstart+length.*normal(:,1);
93- yend=ystart+length.*normal(:,2);
94- q=quiver3(xstart,ystart,zstart,xend-xstart,yend-ystart,zeros(numel(xstart),1)); hold on;
95- h4=plot3(xstart,ystart,zstart,'r*');
96 end
97
98 %legend (disable warnings)
99 warning off
100-legend([h2,h3,h3bis,q],'element on ice front (Water)','element on ice front (Air)','element on ice front (Ice)','normal vectors')
101+legend([h2],'element on ice front')
102 warning on
103
104 %apply options
Note: See TracBrowser for help on using the repository browser.