Difference between revisions of "VisIt"

From OSUPDOCS
Jump to navigation Jump to search
Line 30: Line 30:
== Mesh Plots ==
== Mesh Plots ==


By saving simulations results using [[VTKArchive Custom Task]], you can get grid plot in ParaView. One type of mesh plot is to create contours based on one output variable and color the surface by another one.
By saving simulations results using [[VTKArchive Custom Task]], you can get grid plot in VisIt. Unfortunatley, VisIt currently is not able to open the VTK files created by the [[VTKArchive Custom Task]] even though the appear valid and can be read by [[ParaView]]. This situation might change in the future. For now, use [[ParaView]] for grid plots.
 
# Open the VTK files save by a [[VTKArchive Custom Task]]. If you did not include this custom task when running the simulation, you will have to add it and run again. If cannot be exported from prior simulations. Once opened, you should get a wire frame showing extent of the grid.
# Choose icon to add a "Contour" in the tool bar (it is also in the "Filters" menu along with many more options)
# In the "Contour Properties" window make the following settings
## Set "Contour By" to mass.
## In the isosurfaces section, set the contour value to some number less than the maximum mass. The optimal value will depend on the structure of your model. You need a lower number to visualize porous objects or a higher number for solid objects. You can also add several numbers to create contours at several values of mass.
# Once all settings are made, click "Apply" to get the plot (often ParaView does nothing when you change something until you click "Apply"). Once you have a plot, you can click and drag with mouse to change the viewing position.
# Choose simulation result to plot from menu in second row of tool bars. (for [[#Vector and Tensor Plotting|tensor or vector quantities]], choose the component to plot from the second menu).


== Using Expressions ==
== Using Expressions ==

Revision as of 16:01, 28 January 2022

VisIt is free and advanced software with many options for visualization, especially when doing 3D calculations.

Getting Started

This section gives the basic steps needed to start using VisIt to visualize material point method output from NairnMPM.

  1. Download and Install VisIt. It is available for many platforms and can run in parallel. The recent Mac versions, however, do not appear to work as advertised.
  2. Run someNairnMPM calculations. You have two options for visualizing results in ParaView:
    1. After a simulation is done, use the "Export Particle VTKs..." option to extract results of any simulation to particle VTK files. Include the data you want to visualize. it works best if you include "meansize" which means the simulation included "size" in the archived results. These VTK files can be used create particle plots.
    2. Include the VTKArchive Custom Task to save results as VTK legacy files. Save the quantities you might want to plot and one of them should be mass (because it is used in many plot options). These VTK files can be used to create grid plots.
  3. To open either type of VTK files in VisIt, choose the "Open File..." command (or click the "Open" icon) and select a block of VTK legacy files. Those exported as particle VTKs will be in the the archived results folder for your simulation and will have the root name you choose when exporting the files. Those created by a VTKArchive Custom Task will also be in the archived results folder with the naming style "MPM_#.vtk" where "MPM" is the root name you used for the calculation's archived files and "#" is the step number. If you used VTKArchive Custom Task to archive results for a single material type, the fille name will change to "MPM_mat_#_#.vtk" where the first number ia a material number. VisIt will let you select such files as a block and will open them all at once. Alternatively, you can expand the block and select a single file. You need to open as a block to get movies of results. If asked, choose to open and use "Serial" or "Parallel" methods.

Once opened, you have many plotting options available. The available options will depend of if you opened particle VTK files or grid-based VTK files. The following sections gives to steps to get started with plotting. Once have one of these plots visible, you can explore all the VisIt options for more ways to visualize the results. You can browse the User Manual for help on other options.

Particle Plots in VisIt

By extracting particle data to VTK files (either using the "Export Particle VTKs..." option in NairnFEAMPM or in NairnFEAMPMViz or by running ExtractMPM on a command line), you can use VisIt to view particle-based plots.

  1. Open the export=ed particle VTK files in VisIt (as described above)
  2. Choose icon to add "Glyph" in the tool bar (it is also in the "Filters" menu along with many more options)
  3. In the "Add" icon menu, choose scalar component to plot for the "Pseudocolor..." submenu (only scalar quantities are in the menu; see below to convert components of tensors and vectors into expressions).
  4. You can click "Draw" icon to get an initial plot, but next step is need to make it look better.
  5. Choose "Pseudocolor..." from the "PlotAtts" menu and:
    1. Click on the "Geometry" Tab
    2. Set "Point Type" to box or sphere (others make less sense)
    3. Check "Scale point size by variable" and choose "meansize" from "Scalars" submenu in the button to right of the check box. Set the "Point size" to 2 (because archived mean size is particle radius). If you did not archive particle size and export it to the particle VTK files, the "meansize" option will not be available. In this case, uncheck the "Scale point size by variable" box and set the "Point size" to half the grid size. This approach only works when all particles are the same size.
  6. Once all settings are made, click "Draw" icon to get the plot. Once you have a plot, you can click and drag with mouse to change the viewing position.
  7. Choose simulation result to plot from "Variables" icon popup menu (see below to convert components of tensors into variables that can be plotted).

Mesh Plots

By saving simulations results using VTKArchive Custom Task, you can get grid plot in VisIt. Unfortunatley, VisIt currently is not able to open the VTK files created by the VTKArchive Custom Task even though the appear valid and can be read by ParaView. This situation might change in the future. For now, use ParaView for grid plots.

Using Expressions

When first started, VisIt only plots scalar values in the VTK files. You can use "Expressions" to plot components of vectors and tensors or even use more complicated expression to plot any function of simulations results. For example, to plot xx component of stress:

  1. Choose "Expressions..." from the "Controls" menu
  2. Click "New" to add a new expression
  3. Set the name to "stress_xx" and keep as "Scalar Mesh Variable" (a component of stress is a scalar)
  4. Edit the expression to be "stress[0][0]" where "stress" is name NairnMPM assigns to exported stress tensors and "[0][0]" is index into the second-rank stress tensor with indices 0, 1, and 2 for the 3X3 tensor.
  5. Click "Apply" to accept the expression

You can now select and plot "stress_xx" from the "Variables" menu. You can repeat the above steps to create expressions to create other components of any tensors or vectors or some function of them (such as traces on the stress tensor). To avoid having to enter the expression every time, you can choose "Save Settings" from the "Options" menu. Now the clicking "Apply" to create a expression lets you use, but it will not be available the next to you run VisIt unless you save the settings.