You can export particle data as VTK files by using the SolutionSavingCallback.
All predefined examples already use this callback to export VTK files to the out
directory relative to the current working directory.
VTK files can be opened in visualization tools such as ParaView
and VisIt.
Follow these steps to view the exported VTK files in ParaView:
- Click
File -> Open. - Navigate to the
outdirectory (relative to the directory that you are running Julia from). - Open both
boundary_1.pvdandfluid_1.pvd. - Click "Apply", which by default is on the left pane below the "Pipeline Browser".
- Hold the left mouse button to move the solution around.
You will now see the following:
It is useful to make the dot size dependent on the actual particle size. For this, first make sure you have "fluid_1.pvd" highlighted in the "Pipeline Browser". Then, in the Properties panel (bottom left), adjust the following settings:
- "Representation" to "Point Gaussian".
- Choose the right "Shader Preset": "Plain Circle" for 2D and "Sphere" for 3D.
- Activate "Scale by Array" and select "
particle_spacing" in "Gaussian Scale Array". - Deactivate "Use Scale Function".
- Set the "Gaussian Radius" to "
0.5".
To simplify visualization of particle data in ParaView, you can use a macro. It reduces the manual steps from the previous section to a single click. Install the macro as follows.
- Save the macro code (see below) as a
.pyfile, e.g.PointGaussianMacro.py. - Open ParaView and go to the top menu:
Macros → Import New Macro... → Select the saved
.pyfile. - The macro will now appear in the Macros menu and can optionally be pinned to the toolbar.
- Load your dataset into ParaView.
- Select the dataset in the Pipeline Browser.
- Click on the macro name in the Macros menu (or toolbar, if pinned) to run it.
- The Point Gaussian representation with
particle_spacingscaling will be applied automatically.
# trace generated using paraview version 5.13.1
#from paraview
#paraview.compatibility.major = 5
#paraview.compatibility.minor = 13
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
# get active source
source = GetActiveSource()
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# get display properties
sourceDisplay = GetDisplayProperties(source, view=renderView1)
# change representation type
sourceDisplay.SetRepresentationType('Point Gaussian')
# modified display properties
sourceDisplay.ShaderPreset = 'Plain circle' # for 2D, change to 'Sphere' for 3D
sourceDisplay.ScaleByArray = 1
sourceDisplay.SetScaleArray = ['POINTS', 'particle_spacing']
sourceDisplay.UseScaleFunction = 0
sourceDisplay.GaussianRadius = 0.5To view the result variables, first make sure that "fluid_1.pvd" is highlighted in the "Pipeline Browser", then select a variable in the variable-selection combo box (see the image below). For example, choose "density". To view the time evolution, press the play button (also shown below).
Modules = [TrixiParticles]
Pages = map(file -> joinpath("io", file), readdir(joinpath("..", "src", "io")))


