Updated Tue. Apr. 23
Using Plot3d
If you haven't used plot3d, here is a short
demonstration you can do to become familiar with it.
You'll be plotting data from the "
TestA2" case; routine
'putfield' names your program output
RunHistory.dat;
I moved this file and renamed it to be:
~tg457444/502/Pgm6/plot3d_testA2.dat
- To use the latest version of plot3d, create a
link from my directory to yours (so you are always
running the latest version of the code):
cd your-directory-for-testing
ln -s ~tg457444/502/Tools/plot3d plot3d
You will run plot3d normally with this
link. If you prefer, you can simply copy the
program, but the link ("ln")
approach means you are always using my latest
version. After copying or making the above link,
just type plot3d to run it.
- Run plot3d on one of the program #6
test cases; I have put output from my program 6 run
there.
To see my TestA2 results, do the following
plot3d ~tg457444/502/Pgm6/plot3d_testA2.dat (if
you don't give a name - i.e. just type plot3d -
it looks for file "RunHistory.dat")
- For this demo you can take the defaults to the first
three questions, i.e. hit return three times when you
start the program.
- To get help, type help
or a question mark.
- In my calls to putfield,
I named my output T, U, V, W, and P.
To plot a 3d view of T, do the
following:
You are asked: "Enter
fields to plot"
... type: T
(this is the name I gave theta when
calling 'putfield' from my program)
You are asked: "Enter list
of types of plots" ... type: 3d
(one of four plot types described below)
You are asked:
"Enter x,y,z eye position" ...
type: <hit
return to take the default viewing angle>
You are asked: "Enter
isosurface value(s)" ... type: -10 (the TestA2 initial thermal is
-20˚; you will plot regions colder than -10˚)
An idt window
should appear if you have X-windows running;
step through the 3d plots (until T=800
for my TestA2.dat data set)
- When done viewing with idt, simply close the idt
window, or return to your ssh window and type
control-C. You are then asked:
"To rename gmeta enter
name now, or hit return to just continue" <just hit return to skip this
and continue>
- "3d" is one of four plot types available to
you. The plot types include:
- 3d (simple
wireframe view; you are asked for position ("eye")
of the viewer; default
is northeast of the domain 'box');
- xy
(horizontal slice; you are asked for what "K" index
to use; default
is K=1, i.e. the surface ... for no-slip, you may
prefer K=2);
- xz
(vertical "east-west" slice; you are asked for a "J"
index; default is
ny/2 or (ny-1)/2, i.e. a XZ slice through the
domain center);
- yz
(vertical "north-south" slice; you are asked for an
"I" index; default
is nx/2 or (nx-1)/2, i.e. a YZ slice through the
domain center)
- To plot a XY slice of theta for TestA2, try typing:
You are asked: "Enter fields to plot"
...
type: T
You are asked: "Enter list
of types of plots" ... type: xy
You are asked:
"Enter K for xy
plots"
... type: 9
(level k=9 is the center of the
cold thermal at time 0)
You are asked: "Enter
contour interval(s)" ... type:
1
(draws
theta contours every 1˚)
An idt window should appear;
step through the plots; close the window when
done, and hit return to skip the "To rename.."
question.
- To plot a YZ slice of theta for TestA2, try typing:
You are asked: "Enter fields to plot"
...
type: T
You are asked: "Enter list
of types of plots" ... type: yz
You are asked:
"Enter I for yz
plots"
... type: <hit return to take the
default YZ slice in the middle of the domain>
You are asked: "Enter contour
interval(s)" ... type: 1
(draws
theta contours every 1 meter/second)
An idt window should appear;
step through the plots; close the window when
done, and hit return to skip the "To rename.."
question.
Saving up plots for printing
If you know you want specific plots, you can run plot3d
for particular times and plot types.
To do so ...
- Say you want Theta, xy, level 5, contour interval
1˚, followed by Theta YZ slices also with a contour
interval of 1˚:
Start plot3d.
"Should this program call
IDT?" batch
(this
setting will not call IDT and will accumulate all
plots until you quit)
"Enter title for all
plots" <enter title, or hit
return>
"Enter dx (meters),
[return=50]:" <hit
return>
"Enter
fields to plot"
... type: T
"Enter list of types of
plots" ... type: xy
"Enter K
for xy plots"
... type: 5
"Enter contour
interval(s)" ... type: 1
(with the
'batch' setting chosen above, you will not be asked
to "rename gmeta" - you are just prompted for new
plot choices)
"Enter fields to plot"
... type: T
"Enter list of types of
plots" ... type: yz
"Enter I
for yz plots"
... type: <hit
return for default vertical slice in domain
middle>
"Enter contour
interval(s)" ... type: 1
"Enter fields to plot"
...
type: exit
- Your plots are in the
file gmeta;
run ~tg457444/bin/metagif if you wish.
Settings
The defaults for most things should be fine. You do
have these choices, at present: (type these at the "Enter
fields" prompt)
- set
(just
typing "set" produces the help listing, including
the "set" options)
- set
HL (to
choose H/L settings including min/max numerical
values, etc)
- set
max (not
stats! This plots a XY map of a given field
showing the max at each grid point over all times
in your file)
- set
times (to
choose a starting and ending time to plot from
your data; default is plot all times)
- set
track ("tracks"
the theta min (or max if you wish) & prints a
3x3 block of values for all fields at this
location, for all times)
- set
vis5d (to
choose vis5d settings)
Producing a data set for plot3d
A demo program shows you how. In
~tg457444/502/Pgm6[/C or /Fortran - pick the appropriate
subdirectory] there are files
demo-write.f90 and
putfield.f (and
similar files for C); compile using the
Makefile in each [C
or Fortran] directory.
Run it by typing
demo-write
... it will create a file RunHistory.dat - recall
this is the default for plot3d, so to plot this
file, type
plot3d
(with no
arguments, it looks for RunHistory.dat)
In your program, put in calls to
putfield where you
previously had
contr()
calls. You will probably want to average u, v, and w
to the common (theta) points and pass (theta-thetabar),
and in each case put these fields in an array dimensioned
(nx,ny,nz) - pass that to
putfield. Each call to
putfield accumulates
data in the file
RunHistory.dat.
When
your
program
finishes,
you can plot your data with
plot3d.
Data tracking
It can be useful to 'track' data near your theta min (or
theta max) for the first 10 time steps or so.
Tracking asks if you want to track (follow) the theta
minimum or theta maximum in your domain; you then choose
to produce xy, xz, or yz data centered on your theta
min/max. For example, tracking data might look like:
These are 3x3 blocks of numbers for a test I
ran.
The variable name (T, P, U, V, W) appears at left;
the K index runs top-to-bottom, and the I index
runs left-to-right. They are all centered on (in
this case) the theta min perturbation, which is
still -20.0000 at this time at grid location
(17,17,9).
You can read the I, J, and K locations from the
text. At the theta min location (T'=-20), P' is
-0.48489, U=V=0, and W=-0.64155.
|
|
=============== Time: 1.000 ============== (j= 17) I = 16 17 18 K= 10: -18.49710 -19.23880 -18.49710 T: K= 9: -19.23880 -20.00000 -19.23880 K= 8: -18.49710 -19.23880 -18.49710 ------------------------------------------------ (j= 17) I = 16 17 18 K= 10: -1.14819 -1.18482 -1.14819 P: K= 9: -0.46632 -0.48489 -0.46632 K= 8: 0.32119 0.32350 0.32119 ------------------------------------------------ (j= 17) I = 16 17 18 K= 10: 0.00000 0.00000 0.00000 U: K= 9: 0.00000 0.00000 0.00000 K= 8: 0.00000 0.00000 0.00000 ------------------------------------------------ (j= 17) I = 16 17 18 K= 10: 0.00000 0.00000 0.00000 V: K= 9: 0.00000 0.00000 0.00000 K= 8: 0.00000 0.00000 0.00000 ------------------------------------------------ (j= 17) I = 16 17 18 K= 10: -0.59366 -0.61761 -0.59366 W: K= 9: -0.61698 -0.64155 -0.61698 K= 8: -0.59366 -0.61761 -0.59366
|
Vis5d a
very old visualization tool that is still in limited use
To make a
Vis5D file
from your data, I suggest the following: from within
plot3d,
enter
set
vis5d
2.0
(stretches
vertical
dimension
2x;
makes nicer looking plots)
<return>
(takes
default
(maximum)
compression
of your data)
<return>
(skips
showing
info
on
your final Vis5D file; enter "y" if you want it)
then type (still from within plot3d)
vis5d
You are asked first for the name of the vis5d file (hit return for
the default
run.v5d),
and
for a range of times to include in your file, and an interval
(e.g.
"5 300 5" to plot
times 5 to 300 at 5 second intervals).
Then you are prompted
"Run
Vis5D now?" - hit return if so (return = yes).
You
are
given
a
chance
to change vis5d options; hit return to take the default, or enter
your own.
If you get an error message "connection refused by server ...
Invalid MIT-MAGIC-COOKIE" etc, login out and back in and return.
To avoid this annoying message, starting "xclock &" when you
start your X-window session may keep it 'valid'.
If you have other problems getting the display to work, try
connecting with "ssh -Y" instead of "ssh -X" to disable some
security restrictions on X.
Final note: it is much, much faster to download the vis5d file
(e.g.
run.v5d) to your
workstation/laptop and run vis5d locally, than it is to run over
X-windows to Stampede. Some very old links to precompiled
binaries are available
here;
you might also build a new version of vis5d from the
Vis5d+
web site.
NetCDF and VisIt
VisIt is a
powerful multi-platform visualization tool. See the
Program
6 Vis page for more information on using it.
• Use
plot3d to create
data sets for VisIt. The needed data format is
NetCDF.
Here
is an example of creating a NetCDF file from inside
plot3d:
(already
running plot3d)
Enter fields to plot,
"all" for all fields, "?" for help, or "exit" to quit: netcdf
(tells plot3d we want to
create a netcdf file)
Creating
NetCDF data set; enter name of NetCDF file [return=run.nc]:
(I hit return, taking
the default file name 'run.nc')
5 times available;
range: 0.00 800.00
Enter
first time, last time, and interval: 0
800 200
(time
min, max and interval for which my data was available)
5 times found
-- range: 0 800
Opening NCAR
graphics
Reading data
Storing to run.nc:
T T= 0.0
Storing to run.nc:
P T= 0.0
Storing to run.nc:
U T= 0.0
Storing to run.nc:
V T= 0.0
Storing to run.nc:
W T= 0.0
Storing to run.nc: vort
T= 0.0
Storing to run.nc:
T T= 200.0
Storing to run.nc:
P T= 200.0
(...omitted some lines
here...)
Storing to run.nc:
T T= 800.0
Storing to run.nc:
P T= 800.0
Storing to run.nc:
U T= 800.0
Storing to run.nc:
V T= 800.0
Storing to run.nc:
W T= 800.0
Storing to run.nc: vort T=
800.0
Closing NetCDF file.
The resulting file was about 2 MB in size.
Other visualization tools
you might consider for this class, or your research:
- Paraview
- NCAR's VAPOR
- A number of other tools are available (e.g. MayaVi, OpenDX
etc).
- If you are aware of other vis tools that are multi-platform
(e.g. Linux and Windows-or-Mac), please let me know.