Skip to content

ParaView

Default outputs

All the default ParaView outputs (particles, drivers and contact network) are defined in config_paraview.msp. They are written every simulation_paraview_frequency steps by the dump_data_paraview batch, which calls:

  • particle_write_paraview_generic: the particles, i.e. write_paraview with spheres, and write_paraview_polyhedra
  • write_paraview_obb_particles with polyhedra;
  • paraview_driver: the drivers;
  • contact_network_paraview: the contact network, only if enable_contact_network is true.

To change the particle outputs, redefine particle_write_paraview_generic in your deck (see the examples below). To add an operator to the ParaView outputs, append it to dump_data_paraview:

+dump_data_paraview:
  - stats_interactions

Spheres

With spheres, the particles are written as points with their fields:

1
2
3
4
5
6
write_paraview_generic_fields:
  - write_paraview:
     binary: true
     write_ghost: false
     write_box: true
     fields: ["processor_id", "radius", "type", "velocity", "id", "orient", "stress"]

To display them in ParaView, use the "Point Gaussian" representation and adjust the radius (one size), or select "Use Scale Array" with radius as "Gaussian Scale Array", unselect "Use Scale Transfer Function" and set "Gaussian Radius" to 1.

Polyhedra

There are two ways to display polyhedra in ParaView:

  1. write the actual geometry of every polyhedron (vertices and faces) in parallel VTK unstructured grid files (.pvtu/.vtu), with per-particle fields such as the velocity, the mass or the stress. This is the default with config_polyhedra.msp (operator write_paraview_polyhedra);
  2. use the generic output (one point per particle) with the orientation and (optionally) the homothety fields, and associate a mesh with each point in ParaView, such as the octahedron.vtk written by read_shape_file.

Note

ParaView does not include the Minkowski layer of the shapes: faces are displayed from the vertex centers.

write_paraview_polyhedra

Writes, for each MPI process, one .vtu file with the polyhedra it owns (ghost particles are not written), and a .pvtu file gathering the pieces. With filename: "ParaviewOutputFiles/exadem_0000010000":

ParaviewOutputFiles/exadem_0000010000.pvtu          # file to open with ParaView
ParaviewOutputFiles/exadem_0000010000/000000.vtu    # data of MPI process 0
ParaviewOutputFiles/exadem_0000010000/000001.vtu    # data of MPI process 1
...

Each polyhedron is a cell of the unstructured grid, so fields are cell data (one value per polyhedron).

Parameter Type Default Description
filename string output basename of the files; set by the default graph to ParaviewOutputFiles/exadem_%010d
fields list of string [".*"] regular expressions selecting the fields: id, type, velocity, vrot, arot, mass, radius, inertia, stress, group, cluster (if the particles have a cluster field) and mpi_rank (if mpi_rank is enabled)
mpi_rank bool false adds a field with the MPI rank
binary_mode bool true binary (zlib-compressed, base64-encoded) or ascii data arrays
compression string default zlib level in binary mode: default (level 6), min (0, no compression), max (9), or a digit in [0-9]

Note

Binary files are much smaller and faster to read than ascii files, which are mostly useful for debugging. A higher compression level reduces the size of the files but increases the writing time.

1
2
3
4
5
# Default: binary files with a medium compression level, all fields
particle_write_paraview_generic:
  - write_paraview_polyhedra:
     mpi_rank: true
  - write_paraview_obb_particles
1
2
3
4
5
# Highest compression level and only a few fields
particle_write_paraview_generic:
  - write_paraview_polyhedra:
     fields: ["id", "type", "velocity"]
     compression: max
1
2
3
4
# Human-readable ascii files
particle_write_paraview_generic:
  - write_paraview_polyhedra:
     binary_mode: false

850,000 octahedra:

850k polyhedra

Generic output with glyphs

Parameter Description
binary_mode binary format, default true
compression compression level, default default (vtkZLibDataCompressor)
filename basename of the parallel files, default output
write_ghost writes the ghost particles, default false
write_box writes the box in a box.vtp file, default true
write_external_box writes the external box (ghost area), default false
1
2
3
4
write_paraview_generic:
  binary: false
  write_ghost: false
  fields: ["vx", "vy", "vz", "id", "orient"]

In ParaView:

  1. load the reference mesh (Octahedron.vtk here);
  2. load the particle files;
  3. choose the "3D Glyphs" representation and the coloring;

    Step 1

  4. in the Glyph Parameters, choose "Orient" with the orientation mode "Quaternion" and orient as orientation vectors. To change the size, check Scaling and select a Scale Array. In the Glyph Type menu, select "Pipeline Connection" and choose Octahedron.vtk as Input.

    Step 2

1000 octahedra falling in a cylinder, colored by their id:

Result

OBBs

write_paraview_obb_particles writes the OBBs of the polyhedra, in separate files: by default <dir_name>/ParaviewOutputFiles/obb_%010d.pvtp, with the id and type of each polyhedron.

Parameter Description
basedir output directory
basename basename of the files, default obb
timestep current step

Note

It is called after write_paraview_polyhedra (see config_polyhedra.msp), every simulation_paraview_frequency steps.

Warning

This operator does not work with spheres.

- write_paraview_obb_particles

Drivers

paraview_driver writes the drivers. RShape drivers are written as shape_name_iteration.vtk files; cylinders are also written. For analytical drivers, you can also use the ParaView sources ("Sources" → "Geometric Shapes" → "Cylinder" / "Plane" / "Sphere").