Overview of VisIt

Course Handout: (last update Wednesday, 20-Apr-2011 16:49:22 EDT)


These notes may be found at http://www.dartmouth.edu/~rc/classes/Totalview/src. The online version has many links to additional information and may be more up to date than the printed notes

VisIt Interactive Visualization  and Analysis Tool


Links:

VisIt Visualization Toolview Overview

VisIt User's Wiki

Topics Covered in This VisIt Class



(2)

Supported File Types


** provides a subroutine library and examples for writing a conversion program in C or Fortran
 to convert your data file into these formats






C Program to Write a Silo Data file

Visit Comes With Code and Instructions for Writing a C program for Making Silo/ VTK files  


#include "silo.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
// Program to make a silo file from the wind temperature and velocity data from OpenDX.
int
main(int argc, char *argv[])
{
#define NX 144
#define NY 73

#define MAXLINE 1024
char line[MAXLINE];
int i,j,k, index = 0;
int dims[] = {NX, NY};
int ndims=2;
int nvars = 2;
int vardims[] = {1, 3};
int centering[] = {1, 1};
char *varnames[] = {"velocity_x", "velocity_y"};
float temp[NY][NX], vel_x[NY][NX],vel_y[NY][NX];
float *velocity[2];
float *temperature;
float x[NX], y[NY];
float *coords[]={x,y};

velocity[0]=(float *)malloc(sizeof(float)*NX*NY);
velocity[1]=(float *)malloc(sizeof(float)*NX*NY);
temperature=(float *)malloc(sizeof(float)*NX*NY);
FILE *fp1;
if ((fp1 = fopen("temp.dat","r")) ==0)
{
fprintf(stderr,"Error opening temperature data file. exiting ... \n");
exit(-1);
}
/* read in the temerpature data */

for(j = 0; j < NX; ++j)
for(i = 0; i < NY; ++i )
{
fgets(line,MAXLINE,fp1);
sscanf(line,"%f",&temp[i][j]);
}

fclose(fp1);

if ((fp1 = fopen("wind_vel.dat","r")) ==0)
{
fprintf(stderr,"Error opening wind velocity data file. exiting ... \n");
exit(-1);
}
/* read in wind velocity data */
for(j = 0; j < NX; ++j)
for(i = 0; i < NY; ++i )
{
fgets(line,MAXLINE,fp1);
sscanf(line,"%f %f",&vel_x[i][j],&vel_y[i][j] );
}
fclose(fp1);

for(i = 0; i < NY; ++i)
for(j = 0; j < NX; ++j)
{
temperature[i*NX+j]=temp[i][j];
velocity[0][i*NX+j]= vel_x[i][j];
velocity[1][i*NX+j]= vel_y[i][j];
}
// create x axis coordinates
for (i=0; i< NX; i++)
x[i]= -178.75 + 2.5*i;

// create y axis coordinates
for (i=0; i< NY; i++)
y[i]= -90 + 2.5*i;

DBfile *dbfile = NULL;
/* Open the Silo file */
dbfile = DBCreate("wind_temp.silo", DB_CLOBBER, DB_LOCAL,
"2D wind temperature and velocity data", DB_HDF5);
if(dbfile == NULL)
{
fprintf(stderr, "Could not create Silo file!\n");
return -1;
}

/* write a 2D rectilinear mesh */
DBPutQuadmesh(dbfile,"quadmesh",NULL,coords,dims,ndims,DB_FLOAT,DB_COLLINEAR,NULL);
DBPutQuadvar1(dbfile,"temp","quadmesh",temperature,dims,ndims,NULL,0,DB_FLOAT,DB_NODECENT,NULL);
DBPutQuadvar(dbfile,"velocity","quadmesh",2,varnames,velocity,dims,ndims,NULL,0,DB_FLOAT,DB_NODECENT,NULL);
DBClose(dbfile);

return 0;
}






(4)

  VisIt Supported Mesh Types



Supported mesh types









(5)

How VisIt Works



(6)

Pseudocolor Contour Plot of 2D scalar data

Open file 'wind_temp.silo'
Select pseudocolor plot of variable temp
Select contour plot of variable temp
PlotAtts-Contour  select 10 contour levels
PlotAtts-Contour select single color (black) for contour colors
Controls- Annotation-2D-Xaxis-Custom title Longitude
Controls- Annotation-2D-Yaxis-Custom title Latitude




pseudocolor contour plot of 2D data

(7)

Pseudocolor Vector Plot of 2D scalar and vector data

Open file 'temp_wind.silo'
Select pseudocolor plot of variable temp
Select vector  plot of variable velocity
Vector attributes scale by 0.2 and reduce by a stride of 4
Controls- Annotation-2D-Xaxis-Custom title Longitude
Controls- Annotation-2D-Yaxis-Custom title Latitude

pseudocolor vector plot of 2D data



(8)

Pseudocolor Rubbersheet Vector Plot of 2D scalar and vector data

Open file 'temp_wind.silo'
Select pseudocolor plot of variable temp
Controls-Expressions : set up a new variable called temp-scaled=temp*.3
OpAtts-Transforms-Elevate : elevate by temp_scaled
Select vector plot of variable velocity
Vector attributes scale by 0.2 and reduce by a stride of 5

pseudocolor rubbersheet plot



(9)


Pick Configuration Example

Plot of Picked Data Points

(10)

Use Query to Get Information about the Data and the Mesh

Controls: Query

Query Window Image

(11)

line out example

line out example 2

(12)

Isosurface of 3D scalar data


Open file 'CThead_mid.silo'
Make a contour plot of variable head
PlotAtts-Contour select by 10 levels
Use rainbow color table
Rotate and Pan and Zoom
Use 2 windows to get different views of the head

Isosurfaces of Head CT





(13)

Pseudocolor Plot with Three Slice Plane Operator


Open 'CThead_mid.silo
Create a pseudocolor plot
In Pseudocolor plot attributes uses skew scaling with a factor of .005
Add a  ThreeSlice operator to the pseudocolor plot
Open the ThreeSlice operator attributes and enter 42,60,50 into the x,y,z y text fields
Click the draw button
Click the point tool in the Tools toolbar
Move the mouse into the point tool rectangle
You can manipulate the point tool to move the three slice plane
Shift key  and move mouse up moves backward in the axis most facing the camera
Shift key  and move mouse down moves forward in the axis most facing the camera
Ctrl key and mouse moves the point up and down
Shift and CTRL keys plus mouse moves point left and right
ThreeSlice Pseudocolor plot

(14)

Slice Operator and The Plane Tool


Open 'CThead_mid.silo'
Create a pseudocolor plot
In Pseudocolor plot attributes uses skew scaling with a factor of .005
Add a Slice operator to the pseudocolor plot
Open the Slice operator attributes and make it orthogonal to the X Axis
Click on the Point radio button and enter 50 50 50 into the point text field
Turn off project to 2D
Click the appy and draw buttons
Click on the Plane Tool in the Graphics Window
Move the mouse into one of the hot spots of the palne tools and move the mouse

Example of slicing with the plane tool

(15)

Animations in VisIt



List of files to be animated

Animation Controls Are Activated in VisIt Window


Image of Animation Controls

(16)

Animations in VisIt (cont.)


Do a pseudocolor plot of pressure
Control:Animation inputs

Animation inputs


Pseudocolor Plot of Pressure


Plot of Pressure



(17)


To save an animation as a movie:

File: Save Session - save the session
Use command line visit -movie to make a movie
Sample command
visit -movie -sessionfile wave.vses.session -geometry 800x800 -format mpeg

Use File:Save movie  (Windows)

 


VisIt Python Command Line Interface


Python Script to Produce a 2D Pseudocolor Contour Plot
# example of making a 2d pseudocolor and contour plot with VisIt CLI

OpenDatabase("wind_temp.silo")

AddPlot("Pseudocolor","temp")
AddPlot("Contour","temp")

# change Contour plot attributes
ContourAtts=ContourAttributes()
ContourAtts.colorType=ContourAtts.ColorBySingleColor
ContourAtts.singleColor=(0,0,0,255)
ContourAtts.legendFlag=0
SetPlotOptions(ContourAtts)

# change annotation attributes
AnotAtts=AnnotationAttributes()
AnotAtts.axes2D.xAxis.title.userTitle=1
AnotAtts.axes2D.xAxis.title.title="Longitude"
AnotAtts.axes2D.yAxis.title.userTitle=1
AnotAtts.axes2D.yAxis.title.title="Latitude"
SetAnnotationAttributes(AnotAtts)
InvertBackgroundColor()

DrawPlots()






Table of Contents

1.
2.VisIt Supported File Types
3.Source Code for Writing a Silo File
4.Supported Mesh Types
5.How VisIt works
6.2D Pseudocolor Contour Plot
7.2D Pseudocolor Vector Plot
8.2D Pseudocolor Rubersheet Plot
9.Pick Data Points Example
10.Query Data
11.Line Out example
12.Isosurface of 3D scalar data
13.Pseudocolor Plot with Three Slice Plane operator
14.Slice Operator and the Plane Tool
15.Animating Files in VisIt
16.Animations in VisIt (cont.)
17.Making Movies Using VisIt
18.Python Command Line Interface



Overview of VisIt: Course Handout
(last update   Wednesday, 20-Apr-2011 16:49:22 EDT)  ©Dartmouth College     http://www.dartmouth.edu/~rc/classes/Totalview/src