Visualization

Export VTK files

You can export particle data as VTK files by using the SolutionSavingCallback. All our predefined examples are already using this callback to export VTK files to the out directory (relative to the directory that you are running Julia from). VTK files can be read by visualization tools like ParaView and VisIt.

ParaView

Follow these steps to view the exported VTK files in ParaView:

  1. Click File -> Open.
  2. Navigate to the out directory (relative to the directory that you are running Julia from).
  3. Open both boundary_1.pvd and fluid_1.pvd.
  4. Click "Apply", which by default is on the left pane below the "Pipeline Browser".
  5. Hold the left mouse button to move the solution around.

You will now see the following: image

To now view the result variables first make sure you have "fluid_1.pvd" highlighted in the "Pipeline Browser" then select them in the variable selection combo box (see picture below). Let's, for example, pick "density". To now view the time progression of the result hit the "play button" (see picture below). image

API

TrixiParticles.trixi2vtkMethod
trixi2vtk(vu_ode, semi, t; iter=nothing, output_directory="out", prefix="",
          write_meta_data=true, max_coordinates=Inf, custom_quantities...)

Convert Trixi simulation data to VTK format.

Arguments

  • vu_ode: Solution of the TrixiParticles ODE system at one time step. This expects an ArrayPartition as returned in the examples as sol.u[end].
  • semi: Semidiscretization of the TrixiParticles simulation.
  • t: Current time of the simulation.

Keywords

  • iter=nothing: Iteration number when multiple iterations are to be stored in separate files. This number is just appended to the filename.
  • output_directory="out": Output directory path.
  • prefix="": Prefix for output files.
  • write_meta_data=true: Write meta data.
  • max_coordinates=Inf The coordinates of particles will be clipped if their absolute values exceed this threshold.
  • custom_quantities...: Additional custom quantities to include in the VTK output. Each custom quantity must be a function of (v, u, t, system), which will be called for every system, where v and u are the wrapped solution arrays for the corresponding system and t is the current simulation time. Note that working with these v and u arrays requires undocumented internal functions of TrixiParticles. See Custom Quantities for a list of pre-defined custom quantities that can be used here.

Example

trixi2vtk(sol.u[end], semi, 0.0, iter=1, output_directory="output", prefix="solution")

# Additionally store the kinetic energy of each system as "my_custom_quantity"
trixi2vtk(sol.u[end], semi, 0.0, iter=1, my_custom_quantity=kinetic_energy)
source
TrixiParticles.trixi2vtkMethod
trixi2vtk(coordinates; output_directory="out", prefix="", filename="coordinates",
          custom_quantities...)

Convert coordinate data to VTK format.

Arguments

  • coordinates: Coordinates to be saved.

Keywords

  • output_directory="out": Output directory path.
  • prefix="": Prefix for the output file.
  • filename="coordinates": Name of the output file.
  • custom_quantities...: Additional custom quantities to include in the VTK output.

Returns

  • file::AbstractString: Path to the generated VTK file.
source
TrixiParticles.trixi2vtkMethod
trixi2vtk(initial_condition::InitialCondition; output_directory="out",
          prefix="", filename="initial_condition", custom_quantities...)

Convert InitialCondition data to VTK format.

Arguments

Keywords

  • output_directory="out": Output directory path.
  • prefix="": Prefix for the output file.
  • filename="coordinates": Name of the output file.
  • custom_quantities...: Additional custom quantities to include in the VTK output.

Returns

  • file::AbstractString: Path to the generated VTK file.
source