Skip to content

Projection on a Cartesian Grid

quantities_cell_projection projects the sum of one or several fields onto a Cartesian grid matching the cells of the DEM grid. The grid can then be written for ParaView with write_grid_vtklegacy.

Parameter Type Default Description
fields list of string regular expressions selecting the fields to project, e.g. [vx, ay, stress]
grid_subdiv double 1 number of subdivisions of each grid cell (1: no subdivision)
splat_size int ≥ 1 1.0 smoothing factor controlling the spatial influence of each projected value

The simplest way is to set simulation_analyses_frequency and add the operator to the analyses batch (see example/polyhedra/analyses/particle_cell_projection.msp):

global:
  simulation_analyses_frequency: 1000

analyses:
  - timestep_paraview_file: "ParaviewOutputFiles/quantities_%010d.vtk"
  - message: { mesg: "Write ", endl: false }
  - print_dump_file:
      rebind: { mesg: filename }
      body:
      - message: { endl: true }
  - resize_grid_cell_values
  - quantities_cell_projection:
     splat_size: 0.99
     grid_subdiv: 2
     fields: [count, vnorm, vx, vy, vz, stress]
  - write_grid_vtklegacy

Left: relative velocity (surface plot); middle: glyphs of the grid (arrows); right: zoom on the octahedra.

Cell projection

Predefined projections

data/config/config_cell_projection.msp provides ready-to-use projections:

Block Description Output
all_cell_proj all the available fields ParaviewOutputFiles/quantities_XXX.vtk
vnorm_cell_proj sum of the velocity norms per cell ParaviewOutputFiles/vnorm_XXX.vtk
velocity_cell_proj velocity norm and components ParaviewOutputFiles/velocity_proj_XXX.vtk
stress_cell_proj stress ParaviewOutputFiles/stress_proj_XXX.vtk
count_cell_proj number of particles per cell ParaviewOutputFiles/count_proj_%010d.vtk

Note

These blocks also output count, to compute averages of the projected quantities. They do not use the grid subdivision.

Full example: example/polyhedra/analyses/particle_cell_projection_count_vnorm_v_stress.msp:

1
2
3
4
5
6
7
8
global:
  simulation_analyses_frequency: 1000

analyses:
  - vnorm_cell_proj
  - count_cell_proj
  - stress_cell_proj
  - velocity_cell_proj
Cell projection v2