Difference between revisions of "VisIt"

From OSUPDOCS
Jump to navigation Jump to search
 
(20 intermediate revisions by the same user not shown)
Line 9: Line 9:
## 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.
## 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.
## 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.
## 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.
# 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.
# 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.
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 [https://visit-sphinx-github-user-manual.readthedocs.io/en/develop/index.html|VisIt User Manual] for help on other options.


== Particle Plots in ParaView ==
== Particle Plots in VisIt ==


By extracting particle 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 also use ParaView to view particle-based plots. This section gives to examples to get started with particle plots.
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 also use VisIt to view particle-based plots. This section gives examples to get started with particle plots.


=== Particle Plots using Glyphs ===
=== Particle Plot using "Cells" ===


The most advanced particle plots use glyphs. Here is an some steps to get started:
The preferred visualization is to export to an unstructured grid (<b>-U</b> option in [[ExtractMPM]]) where each material point becomes a cell in an a grid. Furthermore, the cells are transformed to reflect the particle deformation. Plotting such files is easy:


# Open the exports particle VTK files in ParView (as described above)
# Open the exported particle VTK files in VisIt (as described above).
# Choose icon to add "Glyph" in the tool bar (it is also in the "Filters" menu along with many more options)
# In the "Add" icon menu, choose simulation result to plot from the "Pseudocolor..." submenu (only scalar quantities are in the menu; see [[#Using Expressions|below]] to convert components of tensors and vectors into scalars for plotting).
# In the "Glyph Properties" window, make the following settings:
# Once you have a plot, you can click and drag with mouse to change the viewing position.
## Set "Glyph Type" to box or sphere (other options normally do not make sense)
# Choose simulation "Variable" submenu (see [[#Using Expressions|below]] to convert components of tensors and vectors into scalars for plotting).
## Set "Orientation Array" to "No Orientation Array" (otherwise boxes might rotate)
## Set "Scale Array" to "meansize" and "Scale Factor" to 2 (because archive mean size is particle radius). If you did not archive particle size and export it to the particle VTK files, the "meansize" will not be available. In this case, set "Scale Array" to "No Scale Array" and set "Scale Factor" to half the grid size. This approach only works when all particle are the same size.
## Set "Glyph Mode" to "All Points"
# Once all settings are made, click "Apply" to get the plot (often ParaView does nothing when you change something until you click "Apply"). Sometimes nothing appears (especially in Windows), but can be fixed by clicking view direction icon (right side of the second-row tool bar). 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).


=== Particle Plots using Point Gaussians ===
=== Particle Plots using Pseudocolor Attributes ===


To plot using point sprites (which might be faster than glyphs but has few options), do the following:
If you use the <b>-V</b> option in [[ExtractMPM]], the VTK files will have only point data. To plot such files as a particle-based plot:


# Open the exports particle VTK files in ParView (as described above)
# Open the exported particle VTK files in VisIt (as described above)
# In properties for the opened files
# In the "Add" icon menu, choose scalar quantity to plot from the "Pseudocolor..." submenu (only scalar quantities are in the menu; see [[#Using Expressions|below]] to convert components of tensors and vectors into scalars for plotting).
## Choose "Point Gaussian" from the "Representation" menu
# You can click "Draw" icon to get an initial plot, but next step is need to make it look better.
## Choose simulations result to plot from the "Coloring" menu (for [#Vector and Tensor Plotting|tensor or vector quantities]], choose the component to plot from the second menu)
# Choose "Pseudocolor..." from the "PlotAtts" menu and:
## Set the "Gaussian Radius" to about 2/3 the particle size (usually about 1/3 grid size). Note that this plot style only works when all particles have the same size. To handle variable size particles use [[#Particle Plots using Glyphs|glyph plots]] instead.
## Click on the "Geometry" Tab
# When settings are done, you should see a plot. Sometimes nothing appears (especially in Windows), but can be fixed by clicking view direction icon (right side of the second-row tool bar). Once you have a plot, you can click and drag with mouse to change the viewing position.
## Set "Point Type" to box or sphere (others make less sense)
## 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.
# 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.
# Choose simulation result to plot from "Variables" icon popup menu (see [[#Using Expressions|below]] to convert components of tensors into variables that can be plotted).


== Mesh Plots ==
A drawback of these plots is that geometry of the shapes plotted for each material point will not transform to reflect deformation of the material point. To get that feature, use [[#Particle Plot using "Cells"|particle cell plots]] instead.


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.
=== Combining Particle Plots with Crack 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.
By exporting crack data to VTK files (the <b>-C</b> with <b>-V</b> option in [[ExtractMPM]]), you can plot them both. Furthermore, VisIt will synchronize them to always plot particle and crack data for the same time step. After getting one the the above plots
# 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).


== Vector and Tensor Plotting ==
# Without closing particle files, open the exported crack VTK files in VisIt (as described above)
# In the "Add" icon menu, choose scalar quantity to plot for the "Pseudocolor..." submenu (only scalar quantities are in the menu; see [[#Using Expressions|below]] to convert components of tensors and vectors into scalars for plotting).
# Choose "Pseudocolor..." from the "PlotAtts" menu to customize the geometry as explain in [[#Particle Plots using Pseudocolor Attributes|above]]. You cannot, however, scale size to "meansize." Instead, set an absolute size slightly smaller the material point sizes (or whatever size looks best).
# You can toggle crack or particle data on and off to see them separately or together


Archived vectors will include all components of the vector and ParaView can view the magnitude or any single component for constructing graphics. Archived tensors will include all components of the tensor. In ParaView, the magnitude and components 0 through 8 of tensors will be listed. The numbers correspond to the following tensor components:
== Mesh Plots ==
 
( xx  xy  xz )  ( 0  1  2 )
| yx  yy  yz | = | 3  4  5 |
( zx  zy  zz ) = ( 6  7  8 )
 
The magnitude appears to square all terms, add, and take the square root. In is generalize of vector length to a second-rank tensor.
 
# Run some[[NairnMPM]] calculations. You have two options for visualizing results in [https://visit-dav.github.io/visit-website/ VisIt]:
## After a simulation is done, use the "Extract 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 include "size" in the archived results. These VTK files can be used create particle plots.
## 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 mesh plots.
# Run ParaView, choose the open command and select the block of VTK legacy files that were just created. The files will be found in the archived results folder with the naming stlye &quot;MPM_#.vtk&quot; where &quot;MPM&quot; is the root name you used for the calculation's archived files and &quot;#&quot; is the step number. ParaView will let you select these as a block to open them all at once, or expand the block and select a single file. You need to open as a block to get movies of results.
# ParaView does not actually read files when they are opened. To read them, click the "Apply" button in the object inspector. When it is done reading, a wire frame surroinding the analysis space should appear in the plot area, but still not plot.
# These are numerous types of plots you can create. To try one, click the "Contour" icon. In the object inspector, set it to countour by 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 lowed 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.
# Finally, use the "Coloring" menu (in tool bar or in object inspector) to choose archived component to apply color the the mass surface. If you pick a tensor or vector, you can pick which component to use in the second menu.
# If you loading the VTK files as a block, you can use the movies controls to animate the results.
 
These instructions gets just one type of plot. Once you have data in the ParaView, you can explore all its other options for plotting.
 
== Thresholded Plots ==
 
== Particle Plots in ParaView ==
 
Using the [[VTKArchive Custom Task]] always gets grid-based plots. By extracting particle data using [[ExtractMPM]], you can also use ParaView to view particle-based plots. Here is an example to get started with particle plots in ParaView:
 
<ol>
 
<li>Run the <tt>TwoDisks.fmcmd</tt> example in <code>nairn-mpm-fea/NairnMPM/input/Scripted_Input</code> using its <tt>#analysis$="3D MPM"</tt> option.
 
<li>Use <tt>ExtractMPM</tt> in the create subfolder in the <tt>Results</tt> folder with the following command line:
<pre>ExtractMPM -V -q sxx -q velx -q dispx -s -o TwoSpheres USAVG-uGIMP.*
</pre>
where <tt>USAVG-uGIMP.</tt> is the root for the archive files (and should be changed if you results are different).
This command will extract particle data (with the listed quantites) to a series of VTK files names "<tt>TwoSpheres_#.vtk</tt>" where "#" is the step number. The <tt>-s</tt> option is needed to get the step number in the file name, which ParaView uses to correctly order the results.
 
<li>Run ParaView, open the block of saved VTK files, and click "Apply" in the object inspector to load. The files will be read, but nothing will be plotted yet.
 
</ol>
 
You now have two options for particle plots: plot point sprites or plot glyphs at each material point. Point sprites are simple and fast. Glyphs are better and have more options.
 
=== Particle Plots using Point Gaussians ===
 
To plot using point sprites, do the following:
 
<ol>
 
<li>In the opened file, choose "Point Gaussian" from the "Representation" menu.
 
<li>For best results, set the radius to a constant radius and enter particle size (usually half the background grid element length)..
 
<li>Also set opacity to constant value of one (or to some custom value if desired). By editing the color map, you can enable opacity mapping to threshold various points based on their plotted value.
 
<li>Set coloring to the calculation result you want to visualize.
 
</ol>
 
=== Particle Plots using Glyphs ===
 
To plot particles with glyphs, do the following:


<ol>
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.


<li>To see the particles, click or use menu command to add Glyphs.</li>
== Using Expressions ==


<li>Then in the glyph object inspector:
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:
<ul>
<li>Set "Glyph Type" to box or sphere (whichever you prefer)</li>
<li>Set "Orientation Array" to "No Orientation Array" (otherwise boxes might rotate)</li>
<li>Set "Scale Array" to "meansize" and "Scale Factor" to 2 (because archive mean size is particle radius). If you did not archive particle size and extract it to the VTK file, the "meansize" will not be available. In this case, set "Scale Array" to "No Scale Array" and set "Scale Factor" to half the grid size. This approach only works when all particle are the same size.</li>
<li>Set "Glyph Mode" to "All Points"</li>
</ul>
<li>Click "Apply" to get the particle plot.


</ol>
# Choose "Expressions..." from the "Controls" menu
# Click "New" to add a new expression
# Set the name to "stress_xx" and keep as "Scalar Mesh Variable" (a component of stress is a scalar)
# 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.
# Click "Apply" to accept the expression


You should have gotten a plot of two spheres which each particle plotted as a small sphere. You can explore all the ParaView options for ways to visualize the results. For example, you can color by any of the properties extracted to the file, create cropping planes, animate the results with the movie controls, or plot different style Glyphs at each material point.
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.
[https://visit-sphinx-github-user-manual.readthedocs.io/en/develop/index.html|VisIt User Manual]

Latest revision as of 13:35, 1 February 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 also use VisIt to view particle-based plots. This section gives examples to get started with particle plots.

Particle Plot using "Cells"

The preferred visualization is to export to an unstructured grid (-U option in ExtractMPM) where each material point becomes a cell in an a grid. Furthermore, the cells are transformed to reflect the particle deformation. Plotting such files is easy:

  1. Open the exported particle VTK files in VisIt (as described above).
  2. In the "Add" icon menu, choose simulation result to plot from the "Pseudocolor..." submenu (only scalar quantities are in the menu; see below to convert components of tensors and vectors into scalars for plotting).
  3. Once you have a plot, you can click and drag with mouse to change the viewing position.
  4. Choose simulation "Variable" submenu (see below to convert components of tensors and vectors into scalars for plotting).

Particle Plots using Pseudocolor Attributes

If you use the -V option in ExtractMPM, the VTK files will have only point data. To plot such files as a particle-based plot:

  1. Open the exported particle VTK files in VisIt (as described above)
  2. In the "Add" icon menu, choose scalar quantity to plot from the "Pseudocolor..." submenu (only scalar quantities are in the menu; see below to convert components of tensors and vectors into scalars for plotting).
  3. You can click "Draw" icon to get an initial plot, but next step is need to make it look better.
  4. 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.
  5. 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.
  6. Choose simulation result to plot from "Variables" icon popup menu (see below to convert components of tensors into variables that can be plotted).

A drawback of these plots is that geometry of the shapes plotted for each material point will not transform to reflect deformation of the material point. To get that feature, use particle cell plots instead.

Combining Particle Plots with Crack Plots

By exporting crack data to VTK files (the -C with -V option in ExtractMPM), you can plot them both. Furthermore, VisIt will synchronize them to always plot particle and crack data for the same time step. After getting one the the above plots

  1. Without closing particle files, open the exported crack VTK files in VisIt (as described above)
  2. In the "Add" icon menu, choose scalar quantity to plot for the "Pseudocolor..." submenu (only scalar quantities are in the menu; see below to convert components of tensors and vectors into scalars for plotting).
  3. Choose "Pseudocolor..." from the "PlotAtts" menu to customize the geometry as explain in above. You cannot, however, scale size to "meansize." Instead, set an absolute size slightly smaller the material point sizes (or whatever size looks best).
  4. You can toggle crack or particle data on and off to see them separately or together

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.