Wiki

Clone wiki

jCODE-public / Visualizing_with_VisIt

Visualization with VisIt

About VisIt

VisIt is an open source visualization software package produced and maintained by Lawrence Livermore National Laboratory. It is also fully parallelized, making it a powerful tool, especially in the context of heavy simulation data files.

Installation

Since VisIt is open source, you can install a local version on your machine using the files found here.

VisIt uses h5 data type. That said, jCODE outputs EnSight Gold format, which can be read by ViSit.

Getting Started with VisIt

A brief tour of VisIt

The most commonly used buttons and features in VisIt are summarized in the figure below:

120698802-TourofVisit.png

Opening a Dataset

After launching the VisIt GUI, click the "open" button and navigate to your data file. jCODE will generate a folder called "ensight-3D," inside of which you will find a folder for each time step at which data was output (this frequency can be modified in your input file), as well as a "jcode.case" file.

Click on jcode.case, then "OK". This loads the dataset into VisIt.

453482807-OpenFile.png

Common Visualization Techniques ###

The following visualizations are given as examples:

Plotting a velocity field

In this example, we will plot the x-component of velocity (variable name: Ui) as a color plot. After the dataset has been loaded, click "Open>Psuedocolor>Ui" as shown. 966201946-Open.png

Now, you will see the color plot shown in the field below the control buttons. It will be in a green font until you click "Draw". It turns to yellow font while it is processing, then black font once it is finished. At this point, you will see it displayed in the active window. After moving the time slider to a later time step, we can now visualize the flow.

Notice that the initial plot VisIt produces is a bit cluttered. In order to clean this up a bit, go to "Controls>Annotation." It is typically cleaner to turn off the dataset name, user information, and axes. Using the settings shown here:

1710971692-Settings.png

Once you have made your desired annotation selections, click "Apply" (you will see the changes take effect) and then "Dismiss" to close the window. The cleaner image looks like this:

1772965672-cleanPlot.png

In this example, gravity is directed in the negative x-direction, so it is helpful to rotate the plot such that the positive x-direction (presently oriented to the right by default) is directed upward. This is accomplished by "Controls>View" and then typing (1 0 0) in the field for "Up Vector". This will orient the positive x-direction to the vertical upward direction. Click "Apply" then "Dismiss".

1742297630-Rotate 9.06.51 PM.png

Finally, in order to make modifications to how the color plot appears (i.e. the scaling, the colors, etc.) either double click on Pseudocolor in the plot list, or click "Plot Attributes>Pseudocolor" (if you choose the later option, be sure the plot you want to edit is highlighted in the plot list).

3835946295-colormodifications.png

Plotting Particles

Now, to add particles to the plot discussed in the previous example, we click "Add>Molecule>Diam" and make the following selections (left window). Next, on the colors tab, we can change the color of particles to be reds under the "Color table for scalars" field (right window)

3828635522-ParticleColors.png

With this, we now have our particles added to the image. But, if we click "Draw", nothing will be displayed. This is because the velocity data is in 3D and the particles are immersed in that field. So, we need to section our velocity field in order to expose the particles.

We will use the "clip" operator to do this. First, highlight the Psuedocolor plot under the main plot operator toolbar. Then, click the operator button, and choose "Selection>Clip". This now adds a feature to the Ui variable.

715338790-Clipping.png

In order to specify the clipping action we desire, click the left arrow next to "Ui" to expand the drop down. Double click on "Clip". We want the normal of our section to be in the z-direction, so we choose Plane 3. Additionally, specify the origin of the clipping plane based on the thickness of the z dimension. In this case, 1e-9. Click "Apply" then "Dismiss."

1240690311-ClipSettings.png

Finally, click "Draw." Now the window displays the fluid velocity as well as the particles in the flow.

4101016517-ParticleClean.png

Modifying Data It is often useful to normalize data as a post processing operation. In this example, we will plot the velocity normalized by terminal velocity. This is accomplished by creating a new variable in VisIt by modifying an existing one with the Expression feature.

In order to add new variables to be accessible for visualization, go to "Controls>Expressions." This will open a new window where we can create expressions. Click "New" on the left hand side of the window. Name the expression in the field "Name." For example, here we choose the name "Ui_Normalized_Re1.0." Since the x-component of velocity is a scalar mesh variable, we leave Type as such. Now, click "Insert Variable" and in the drop down menu select "Scalars>Ui". This puts Ui in the definition. Now, we want to divide by the terminal velocity (for example 0.2), so we click "Insert Function" and in the drop down menu select "Math>/" to choose division. Finally type 0.2 in the Definition line. Then click "Apply." Now "Ui_Normalized_Re1.0" will appear as a variable in the plotting menus. Click "Dismiss to close the window.

234144023-Expressions.png

Exporting Images Once you are satisfied with your plot, you may want to export it as an image. You can do this by clicking "File>Set save options." This will open the following window:

4199329641-SaveImages.png

Generating Movies Generating an animation/movie of a plot you have created takes two main steps. First is generating the individual frames of the movie in VisIt (basically, this just generates a an image for each time step). Next, these images need to be combined into a movie format, which is done using a simple unix script.

In order to generate the frames of the movie in VisIt, click "File>Save Movie". This opens a "Save Movie Wizard". Make the following selections: 232311553-Makemovie.png

Depending on the size of your data files and number of time steps (and available processors you are using to generate the movie), this process can take quite a while. Once it is finished, VisIt will display an error message. (This is the reason for needing a separate script to generate the movie.) Close the error message and navigate to the folder with the movie output in terminal.

In the output folder for the movie, you will find a number of files with the naming convention movie0001.ppm, movie0002.ppm, etc. (as well as mpeg-link files, please remove these files by typing rm mpeg_link* in terminal). Inside of this folder, open a new text document using your preferred editor of choice (vim, emacs, etc.) and copy the following:

#!unix
for i in *.ppm; do sips -s format jpeg $i --out $i.jpg;done
/Applications/ffmpeg -r 1 -i "movie%04d.ppm.jpg" movie.mp4

Save it as movieScript. Then, type the following into terminal:

#!unix

chmod +x movieScript

This makes the file an executable. Now you can run the script by typing:

#!unix

./movieScript

After it runs, you will find the resulting movie in the same folder.

Running on Flux (or other high performance clusters)

Coming soon...

What if I already have data, but it's Ensight data?

Generally speaking, this is not an issue (unless you have particle data. VisIt isn't capable of plotting Ensight data for particles).

For all other data from Ensight, you just need to ensure you tell VisIt the correct file type to look for when you open your dataset (see previous section on opening datasets) and instead of selecting "visit.arts", you will select, for example, "jcode.case".

Citing VisIt

When using VisIt to generate images or animations for publication, please use the following citation to acknowledge the use of this open-source software:

#!latex
@InCollection{HPV:VisIt,
author = {Hank Childs and Eric Brugger and Brad Whitlock and Jeremy Meredith and Sean Ahern and David Pugmire and Kathleen Biagas and Mark Miller and Cyrus Harrison and Gunther H. Weber and Hari Krishnan and Thomas Fogal and Allen Sanderson and Christoph Garth and E. Wes Bethel and David Camp and Oliver R\"{u}bel and Marc Durant and Jean M. Favre and Paul Navr\'{a}til},
title = {{VisIt: An End-User Tool For Visualizing and Analyzing Very Large Data}},
year = "2012",
pages = "357-372",
month = "Oct",
booktitle = {{High Performance Visualization--Enabling Extreme-Scale Scientific Insight}},
} 

Updated