Plotting with mb_cont

If the data dumped by mb_post is in GENERIC format, the contouring program mb_cont can be used to produce a picture of the data in either postscript or GIF format.

% mb_cont.exe [-fi data_file] 
              [-fo output_file] [-gif|-ps|-hpgl] 
              [-var index] 
              [-levels vmin vmax dv]
              [-xrange xmin xmax dx] 
              [-yrange ymin ymax dy]
              [-mirror] [-notrueshape] [-fill]
              [-nolabel] [-noaxes] [-notable] 
              [-edge] [-mesh] [-ixskip i] [-iyskip i] 
The command-line options include...
-fi data_file
Input data file. Default is "default.gen".
-fo output_file
Output (plot) file. The default name is "default.ps".
-gif|-ps|-hpgl
Select one of these for the plot format. The default is postscript.
-var index
Specify the index of the variable to be plotted. For a complete list, see the head of the GENERIC data file. Each of the variables is listed, starting with x and y as variables 0 and 1. The default index is 2 which is usually density.
-levels vmin vmax dv
Specify the minimum, maximum and increment for the plotted contours. If not specified by the user, the program will search the data for appropriate values and will plot 16 contours between the minimum and maximum values.
-xrange xmin xmax dx
Specify the minimum, maximum and increment for the plotted range of the x-coordinate. If not specified by the user, the program will search the data for appropriate values.
-yrange ymin ymax dy
Specify the minimum, maximum and increment for the plotted range of the y-coordinate. If not specified by the user, the program will search the data for appropriate values.
-nolabel
Suppress the addition of labels to the top of the plot. The default action is to write the data file name, the variable name, the title of the simulation and the ranges of the variables above the plot.
-noaxes
Suppress the drawing of x and y-axes.
-notable
Do not draw the table of colour values for colour contour and filled plots.
-mirror
As well as plotting the original data, plot the mirror image of the data in the y-axis. Default action is to not mirror the data.
-notrueshape
Suppress rescaling of the data to achieve a true-shape plot. The default action is to plot the x and y scales with a 1:1 ratio so that geometric shapes are true.
-colour
Use colour scale to indicate magnitudes of the displayed variable. The default action is to plot black/greyscale on a white background.
-fill
Use filled cells rather than contours to indicate the magnitude of the plotted variable. The default action is to use contours.
-edge
Plot a line denoting the edges of each block.
-mesh
Plot the mesh for each block. The mesh displayed is constructed by joining cell centres rather than (correctly) joining the cell vertices. Despite this flaw, it gives a fair idea of the shape and distribution of the true mesh.
-ixskip i
Plot every i-th grid line counting in the ix direction.
-iyskip i
Plot every i-th grid line counting in the iy direction.


Format for the data file

The format for the data file can be inferred from the code fragment which reads the data. This code looks like:

/* The first contains a title string. */
fgets (title, NCHAR, dfp);
printf ("\nTitle: %s\n", title);

/* The second line contains the number of variables. */
fgets (txt, NCHAR, dfp);
sscanf (txt, "%d", &nvar);

/* The variable names follow, one per line. */
for (ivar = 0; ivar < nvar; ++ivar) {
   fgets (txt, NCHAR, dfp);
   sscanf (txt, "%s", VarName[ivar]);
   }

/* NOTE : from this point on,
 * we start reading file without discarding line ends.
 * After the variable names, read the number of blocks. */
fscanf (dfp, "%d", &nblock);

/* For each block... */
for (jb = 0; jb < nblock; ++jb) {
   /* Read the number of points in the y- and x-index directions. */
   fscanf (dfp, "%d %d", &nny[jb], &nnx[jb] );

   /* Read the data for all points. */
   for (ix = 0; ix < nnx[jb]; ++ix)
      for (iy = 0; iy < nny[jb]; ++iy) {
         /* For each point, read all of the variables. */
         for (ivar = 0; ivar < nvar; ++ivar) {
	    fscanf (dfp, "%lf", &Var[jb][ivar][ix][iy]);
	    } /* end of ivar loop */
         } /* end of iy loop */
   }  /* end of jb loop */


MB_CNS (C) P. A. Jacobs
Last Updated 24-Feb-2000.