plot_riftrelvel

PURPOSE ^

PLOT_RIFTRELVEL - plot rift relative velocities

SYNOPSIS ^

function plot_riftrelvel(md,options_structure,width,i);

DESCRIPTION ^

PLOT_RIFTRELVEL - plot rift relative velocities

   Usage:
      plot_riftrelvel(md,options_structure,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_riftrelvel(md,options_structure,width,i);
0002 %PLOT_RIFTRELVEL - plot rift relative velocities
0003 %
0004 %   Usage:
0005 %      plot_riftrelvel(md,options_structure,width,i);
0006 %
0007 %   See also: PLOTMODEL
0008 
0009 %plot mesh boundaries
0010 subplot(width,width,i); 
0011 
0012 %units
0013 if ~isnan(options_structure.unitmultiplier),
0014     md.x=md.x*options_structure.unitmultiplier;
0015     md.y=md.y*options_structure.unitmultiplier;
0016     md.z=md.z*options_structure.unitmultiplier;
0017 end
0018 
0019 for i=1:size(md.segments,1),
0020     plot(md.x(md.segments(i,1:2)),md.y(md.segments(i,1:2)),'k.-');hold on;
0021 end
0022 
0023 %plot rift velocities
0024 hold on;
0025 
0026 isp1=0;
0027 isp2=0;
0028 
0029 if isstruct(md.rifts),
0030     %plot mesh boundaries
0031     for i=1:size(md.segments,1),
0032         h1=plot(md.x(md.segments(i,1:2)),md.y(md.segments(i,1:2)),'b-');
0033     end
0034     for i=1:size(md.rifts,1),
0035         penaltypairs=md.rifts(i).penaltypairs;
0036 
0037         segments=md.rifts(i).segments;
0038         for j=1:size(segments,1),
0039             plot(md.x(segments(j,1:2)),md.y(segments(j,1:2)),'b-');
0040         end
0041 
0042         normal=zeros(2,1);
0043         for j=1:size(penaltypairs,1),
0044             normal(1)=penaltypairs(j,5);
0045             normal(2)=penaltypairs(j,6);
0046 
0047             vx1=md.vx(penaltypairs(j,1)); vx2=md.vx(penaltypairs(j,2)); vy1=md.vy(penaltypairs(j,1)); vy2=md.vy(penaltypairs(j,2));
0048             penetration=(vx2-vx1)*normal(1)+(vy2-vy1)*normal(2);
0049             %if penetration is negative, plot in black, positive, plot in red;: ie: if rift is closing, black, if rift is opening, red.
0050             if(penetration>0),
0051                 p2=plot(md.x(penaltypairs(j,1)) ,md.y(penaltypairs(j,1)),'r*');
0052                 isp2=1;
0053             else
0054                 p1=plot(md.x(penaltypairs(j,1)) ,md.y(penaltypairs(j,1)),'k*');
0055                 isp1=1;
0056             end
0057         end
0058 
0059         %point out the tips
0060         h2=plot(md.x(md.rifts(i).tips(1)),md.y(md.rifts(i).tips(1)),'g*');
0061         plot(md.x(md.rifts(i).tips(2)),md.y(md.rifts(i).tips(2)),'g*');
0062 
0063         %plot relative velocities
0064         h=quiver(md.x(penaltypairs(:,1)),md.y(penaltypairs(:,1)),md.vx(penaltypairs(:,2))-md.vx(penaltypairs(:,1)),md.vy(penaltypairs(:,2))-md.vy(penaltypairs(:,1)));
0065         set(h,'Color',[1 0 0]);
0066     end
0067     if isp1 & isp2
0068         legend([h1,h2,p1,p2,h],'mesh boundaries','rift tips',' rifts closing','rifts opening','relative velocities')
0069     elseif isp1
0070         legend([h1,h2,p1,h],'mesh boundaries','rift tips',' rifts closing','relative velocities')
0071     elseif isp2
0072         legend([h1,h2,p2,h],'mesh boundaries','rift tips','rifts opening','relative velocities')
0073     else
0074         legend([h1,h2,h],'mesh boundaries','rift tips','relative velocities')
0075     end
0076 else
0077     error('plot error message: no rifts available!');
0078 end
0079 
0080 %apply options
0081 if isnan(options_structure.title)
0082     options_structure.title='Rift relative velocities';
0083 end 
0084 if isnan(options_structure.colorbar)
0085     options_structure.colorbar=0;
0086 end
0087 applyoptions(md,[],options_structure);

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003