VEL Procedure
Standard Library procedure that draws a graph of a velocity field with arrows pointing in the direction of the field. The length of an arrow is proportional to the strength of the field at that point.
Usage
VEL, u, v
Input Parameters
u—The x-component of the velocity field at each point. This parameter must be a two-dimensional array.
v—The y-component of the velocity field at each point. This parameter must have the same dimensions as u.
Keywords
Length—The length of each arrow segment, expressed as a fraction of the longest arrow divided by Nsteps. Length is used to calculate the proportional length of each arrow segment. (Default: 0.1)
Nsteps—The number of segments in each arrow. (Default: 10)
Nvecs—The number of arrows to draw. (Default: 200)
Xmax—The aspect ratio (the x-axis size as a fraction of the y-axis size). (Default: 1.0)
Discussion
VEL selects Nvecs random points within the boundary of the (u, v) arrays. At each point, the field is bilinearly interpolated from the (u, v) arrays and a vector of the correct proportional length is drawn.
The field is recalculated at the endpoint of this vector and a new vector is iteratively drawn, until an arrow with Nsteps number of segments is drawn.
An arrowhead is drawn at the end of this arrow, and the procedure moves on to another random point to initiate the loop again. The graph is plotted with the title “Velocity Field”.
Examples
; Create the arrays.
u = FLTARR(21, 21)
v = FLTARR(21, 21)
; Type .RUN, the WAVE prompt changes to a dash (-) to indicate 
; that you may enter a complete program unit.
.RUN
; This procedure stuffs values into arrays; the last END exits the
; programming mode, compiles and executes the procedure, and
; then returns you to the WAVE> prompt.
   FOR j=0L, 20 DO BEGIN
      FOR i=0L, 20 DO BEGIN
         x=0.05 * FLOAT(i)
         z=0.05 * FLOAT(j)
         u(i, j) = -SIN(!Pi*x) * COS(!Pi*z)
         v(i, j) = COS(!Pi*x) * SIN(!Pi*z)
      ENDFOR      
   ENDFOR
END
; Display the velocity field with default values.
VEL, u, v
; Display the velocity field using 400 arrows.
VEL, u, v, Nvecs=400
; Display the velocity field with individual modifications.
VEL, u, v, Nvecs=40, Xmax=.7, Length=.4, Nsteps=20
 
Figure 18-2: Velocity Field (Default Values)
 
Figure 18-3: Velocity Field (400 Arrows)
 
Figure 18-4: Velocity Field (Various Keywords)
See Also