1 | function plot_icefront(md,options,width,i,data)
|
---|
2 | %PLOT_ICEFRONT - plot segment on neumann BC
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % plot_icefront(md,options,width,i);
|
---|
6 | %
|
---|
7 | % See also: PLOTMODEL
|
---|
8 |
|
---|
9 | %plot mesh boundaries
|
---|
10 | subplot(width,width,i);
|
---|
11 |
|
---|
12 | %process mesh and data
|
---|
13 | [x y z elements is2d isplanet]=processmesh(md,[],options);
|
---|
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);
|
---|
21 |
|
---|
22 | if (md.mesh.dimension==2),
|
---|
23 |
|
---|
24 | %plot mesh
|
---|
25 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
---|
26 | h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
27 | hold on;
|
---|
28 |
|
---|
29 | %highlight elements on neumann
|
---|
30 | pos=find(icefront);
|
---|
31 | A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
|
---|
32 | h2=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
33 | hold on;
|
---|
34 |
|
---|
35 | %Plot zero icelevelset line
|
---|
36 |
|
---|
37 |
|
---|
38 | else
|
---|
39 |
|
---|
40 | %plot mesh
|
---|
41 | A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
|
---|
42 | h1=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
43 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
44 | patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
45 | patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
46 | patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
47 | hold on;
|
---|
48 |
|
---|
49 | %highlight elements on neumann
|
---|
50 | pos=find(icefront);
|
---|
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);
|
---|
52 | h2=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
53 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
54 | patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
55 | patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
56 | patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','blue','EdgeColor','black');
|
---|
57 | end
|
---|
58 |
|
---|
59 | %legend (disable warnings)
|
---|
60 | warning off
|
---|
61 | legend([h2],'element on ice front')
|
---|
62 | warning on
|
---|
63 |
|
---|
64 | %apply options
|
---|
65 | options=addfielddefault(options,'title','Neumann boundary conditions');
|
---|
66 | options=addfielddefault(options,'colorbar',0);
|
---|
67 | applyoptions(md,[],options);
|
---|