plot_riftvel

PURPOSE ^

PLOT_RIFTVEL - plot rift velocity

SYNOPSIS ^

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

DESCRIPTION ^

PLOT_RIFTVEL - plot rift velocity

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

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_riftvel(md,options_structure,width,i);
0002 %PLOT_RIFTVEL - plot rift velocity
0003 %
0004 %   Usage:
0005 %      plot_riftvel(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         segments=md.rifts(i).segments(:,1:2);
0063         h3=quiver(md.x(segments),md.y(segments),md.vx(segments),md.vy(segments));
0064         set(h3,'Color',[1 0 0]);
0065     end
0066     if isp1 & isp2
0067         legend([h1,h2,p1,p2,h3],'mesh boundaries','rift tips',' rifts closing','rifts opening','velocities')
0068     elseif isp1
0069         legend([h1,h2,p1,h3],'mesh boundaries','rift tips',' rifts closing','velocities')
0070     elseif isp2
0071         legend([h1,h2,p2,h3],'mesh boundaries','rift tips','rifts opening','velocities')
0072     else
0073         legend([h1,h2,h3],'mesh boundaries','rift tips','velocities')
0074     end
0075 else
0076     error('plot error message: no rifts available!');
0077 end
0078 
0079 %apply options
0080 if isnan(options_structure.title)
0081     options_structure.title='Rift Velocities';
0082 end 
0083 if isnan(options_structure.colorbar)
0084     options_structure.colorbar=0;
0085 end
0086 applyoptions(md,[],options_structure);

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