PLOT_FIELD Procedure

Standard Library procedure that plots a two-dimensional velocity field.

Usage

PLOT_FIELD, u, v 

Input Parameters

u — A 2D array giving the field vector at each point along the x-axis.

v — A 2D array giving the field vector at each point along the y-axis.

Keywords

Aspect — The aspect ratio of the final plot; that is, the ratio of the length of x-axis to the length of the y-axis. (Default: 1)

Length — The length of the longest field vector, expressed as a fraction of the plotting area. (Default: 0.1)

N — The number of arrows to draw. (Default: 200)

Title — A string containing the title of the plot. The default title is “Velocity Field”.

YLabelCenter — Controls whether the top and bottom major tick labels on a Y axis will be positioned within the boundaries of the axis box or centered across from the corresponding major tick.

Discussion

PLOT_FIELD picks N points at random and traces a path from each point along the field. The length of the path is proportional to Length and the field vector magnitude at that point.

Example

; Create the arrays.
u = FLTARR(21, 21)
v = FLTARR(21, 21)
; After you type .RUN, the WAVE> prompt changes to a dash (-)
; to indicate that you may enter a complete program unit.
.RUN
; This FOR loop puts values into array. The last END exits you
; from 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 as shown in 
; the Figure: Velocity Field with Default Values.
PLOT_FIELD, u, v, Title = 'Velocity Field'
WAIT, 1
; Display the velocity field using 400 arrows as shown in 
; the Figure: Velocity Field with 400 Arrows.
PLOT_FIELD, u, v, N = 400, Title = 'Velocity Field'
WAIT, 1
; Display the velocity field with individual modifications as
; shown in the Figure: Modified Velocity Field.
PLOT_FIELD, u, v, Aspect = .7, Length = .4, $
   N = 20, Title = 'Example of PLOT_FIELD'

Velocity Field with Default Values

 

Velocity Field with 400 Arrows

Modified Velocity Field

See Also

VEL,  VELOVECT