source: issm/trunk/src/m/plot/plot_riftpenetration.m

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

merged trunk-jpl and trunk for revision 13974

File size: 2.4 KB
Line 
1function plot_rifpenetration(md,options,nlines,ncols,index)
2%PLOT_RIFTPENETRATION - plot rift penetration
3%
4% Usage:
5% plot_rifpenetration(md,options,width,i);
6%
7% See also: PLOTMODEL
8
9%process data and model
10[x y z elements is2d isplanet]=processmesh(md,[],options);
11
12subplot(nlines,ncols,index);
13hold on
14
15%plot mesh boundaries
16for i=1:size(md.mesh.segments,1),
17 plot(x(md.mesh.segments(i,1:2)),y(md.mesh.segments(i,1:2)),'k-');
18end
19
20isp1=0;
21isp2=0;
22
23if isstruct(md.rifts.riftstruct),
24 %plot mesh boundaries
25 for i=1:size(md.mesh.segments,1),
26 h1=plot(x(md.mesh.segments(i,1:2)),y(md.mesh.segments(i,1:2)),'b-');
27 end
28 for i=1:size(md.rifts.riftstruct,1),
29 penaltypairs=md.rifts.riftstruct(i).penaltypairs;
30
31 segments=md.rifts.riftstruct(i).segments;
32 for j=1:size(segments,1),
33 plot(x(segments(j,1:2)),y(segments(j,1:2)),'b-');
34 end
35
36 normal=zeros(2,1);
37 for j=1:size(penaltypairs,1),
38 normal(1)=penaltypairs(j,5);
39 normal(2)=penaltypairs(j,6);
40
41 vx1=md.initialization.vx(penaltypairs(j,1));
42 vx2=md.initialization.vx(penaltypairs(j,2));
43 vy1=md.initialization.vy(penaltypairs(j,1));
44 vy2=md.initialization.vy(penaltypairs(j,2));
45 penetration=(vx2-vx1)*normal(1)+(vy2-vy1)*normal(2);
46 %if penetration is negative, plot in black, positive, plot in red;: ie: if rift is closing, black, if rift is opening, red.
47 if(penetration>0),
48 p2=plot(x(penaltypairs(j,1)) ,y(penaltypairs(j,1)),'ro-','LineWidth',1);
49 set(p2,'MarkerSize',3);
50 isp2=1;
51 else
52 p1=plot(x(penaltypairs(j,1)) ,y(penaltypairs(j,1)),'ko-','LineWidth',1);
53 set(p1,'MarkerSize',3);
54 isp1=1;
55 end
56 end
57
58 %point out the tips
59 h2=plot(x(md.rifts.riftstruct(i).tips(1)),y(md.rifts.riftstruct(i).tips(1)),'g*');
60 plot(x(md.rifts.riftstruct(i).tips(2)),y(md.rifts.riftstruct(i).tips(2)),'g*');
61 end
62 if strcmpi(getfieldvalue(options,'legend','on'),'on'),
63 if isp1 & isp2
64 l=legend([h1,h2,p1,p2],'mesh boundaries','crack tips','faults','rifts');
65 elseif isp1
66 l=legend([h1,h2,p1],'mesh boundaries','crack tips','faults');
67 elseif isp2
68 l=legend([h1,h2,p2],'mesh boundaries','crack tips','rifts');
69 else
70 l=legend([h1,h2],'mesh boundaries','crack tips');
71 end
72 set(l,'Location',getfieldvalue(options,'legend_location','NorthEast'));
73 end
74else
75 error('plot error message: no rifts available!');
76end
77hold off
78
79%apply options
80options=addfielddefault(options,'title','Rift/Fault location');
81options=addfielddefault(options,'colorbar',0);
82applyoptions(md,[],options);
Note: See TracBrowser for help on using the repository browser.