source:
issm/oecreview/Archive/15392-16133/ISSM-15611-15612.diff@
16134
Last change on this file since 16134 was 16134, checked in by , 12 years ago | |
---|---|
File size: 5.3 KB |
-
../trunk-jpl/src/m/plot/plot_icefront.m
11 11 12 12 %process mesh and data 13 13 [x y z elements is2d isplanet]=processmesh(md,[],options); 14 icefront=md.diagnostic.icefront; 14 ice=(md.mask.icelevelset>0); 15 noice=(md.mask.icelevelset<=0); 16 zeroice=(md.mask.icelevelset==0); 17 elementice=sum(ice(md.mesh.elements),2); 18 elementnoice=sum(noice(md.mesh.elements),2); 19 elementzeroice=sum(zeroice(md.mesh.elements),2); 20 icefront=(elementice & elementnoice) & ~(elementice==2 & elementzeroice); 15 21 16 22 if (md.mesh.dimension==2), 17 23 … … 21 27 hold on; 22 28 23 29 %highlight elements on neumann 24 pos=find(icefront(:,end)==1); 25 pos=icefront(pos,end-1); 30 pos=find(icefront); 26 31 A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 27 32 h2=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black'); 28 pos=find(icefront(:,end)==0); 29 pos=icefront(pos,end-1); 30 A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 31 h3=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','green','EdgeColor','black'); 33 hold on; 32 34 33 pos=find(icefront(:,end)==2); 34 pos=icefront(pos,end-1); 35 A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 36 h3bis=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','cyan','EdgeColor','black'); 35 %Plot zero icelevelset line 37 36 38 %display arrows pointing outward 39 xstart=mean(x(icefront(:,1:end-2)),2); 40 ystart=mean(y(icefront(:,1:end-2)),2); 41 length=sqrt((x(icefront(:,1))-x(icefront(:,2))).^2 + (y(icefront(:,1))-y(icefront(:,2))).^2 ); 42 normal(:,1)=cos(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1))))); 43 normal(:,2)=sin(atan2((x(icefront(:,1))-x(icefront(:,2))) , (y(icefront(:,2))-y(icefront(:,1))))); 44 xend=xstart+length.*normal(:,1); 45 yend=ystart+length.*normal(:,2); 46 q=quiver(xstart,ystart,xend-xstart,yend-ystart); hold on; 47 h4=plot(xstart,ystart,'r*'); 37 48 38 else 49 39 50 40 %plot mesh … … 57 47 hold on; 58 48 59 49 %highlight elements on neumann 60 pos=find(icefront(:,end)==1); 61 pos=icefront(pos,end-1); 50 pos=find(icefront); 62 51 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 52 h2=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black'); 64 53 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black'); 65 54 patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black'); 66 55 patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black'); 67 56 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 outward86 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 57 end 97 58 98 59 %legend (disable warnings) 99 60 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')61 legend([h2],'element on ice front') 101 62 warning on 102 63 103 64 %apply options
Note:
See TracBrowser
for help on using the repository browser.