ParaView is free andadvanced software with many options for visualization, especially when doing 3D calculations.
- Download and install ParaView. It is available for many platforms and can run in parallel (hence the name) if installed on a multiprocessor system or cluster of computers.
- Run from NairnMPM calculations that use the VTKArchive Custom Task to save results as VTK legacy files. Save the quantties you might want to plot and one of them should be mass (because it is used in many plot options)
- 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 "MPM_#.vtk" where "MPM" is the root name you used for the calculation's archived files and "#" 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.
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:
- Run the TwoDisks.fmcmd example in
nairn-mpm-fea/NairnMPM/input/Scripted_Inputusing its #analysis$="3D MPM" option.
- Use ExtractMPM in the create subfolder in the Results folder with the following command line:
ExtractMPM -V -q sxx -q velx -q dispx -s -o TwoSpheres USAVG-uGIMP.*
where USAVG-uGIMP. 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 "TwoSpheres_#.vtk" where "#" is the step number. The -s option is needed to get the step number in the file name, which ParaView uses to correctly order the results.
- 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.
You now have two options for particle plots: plot point sprites or plot glyphs at each material point. Point sprites seem best for general use and are much faster. Glyphs may have more options for problems with relatively few number of material points.
Particle Plots using Point Gaussians
To plot using point sprites, do the following:
- In the opened file, choose "Point Gaussian" from the "Representation" menu.
- For best results, set the radius to a constant radius and enter particle size (usually half the background grid element length)..
- Also set opacity to constant value of one (or to some customn value if desired). By editing the color map, you can enable opacity mapping to threshold various points based on their plotted value.
- Set coloring to the calculation result you want to visualize.
Particle Plots using Glyphs
To plot particles with glyphs, do the following:
- To see the particles, click or use menu command to add Glyphs. Then in its object inspector, enter Radius = 1.25 (which is 1/4 of the 5 mm cell size, use a different Glyph size if you have changed the cell size of this example).
- Scroll down, click to "Edit Scale" and edit it to be 1.
- Scroll down and change "Maximum Number of Points" to be 10000 (or some number larger than the number of material points in the simulation).
- Click "Apply" to get the particle plot.
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.