ParaView

From Elmer Wiki
Jump to: navigation, search

ParaView is a parallel visualization software developed by Kitware, Inc. and based on the Visualization ToolKit (VTK). You can download it freely at http://www.paraview.org/paraview/resources/software.html .

It is supported by Elmer using the old .vtk and the newer .vtu or .pvtu formats.

Contents

Generating Paraview output

Paraview output is generated by the ResultOutputSolver which is documented in the Elmer Models Manual.

.vtk

Making ParaView use Mesh.Update

VTK files contain the full set of variables (like the ElmerPost files). This often generates unnecessarily large files which slow ParaView down. They can only be used in serial runs.

To generate .vtk output include the following section in your Solver Input File:

Solver NUMBER ! Set the correct solver number here.
              ! Usually you want to use the highest number so the results are saved at the end of a timestep.
  Exec Solver = String "after timestep"	
  exec interval = 1
  Equation = String "ResultOutput"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = String "paraver." !or any other output file name of your choice
  Output Format = String "vtk"
  Vtk Format = Logical True
End


To make paraview use the Mesh.Update variable, create a calculator filter and set the variable to Mesh.Update+coords (from the Vectors drop down menu). Then activate Coordinate Results and press apply.

.vtu

VTU is the new VTK Format for unstructured grids. To use it with Elmer, you have to specify each variable, that you want to save, separately.

Solver NUMBER !Set the correct solver number here.
              ! Usually you want to use the highest number so the results are saved at the end of a timestep.
  Exec Solver = String "after timestep"	
  exec interval = 1
  Equation = String "ResultOutput"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = String "paraver." !or any other output file name of your choice
  Output Format = String "vtu"
  Vtu Format = Logical True
  Scalar Field 1 = Freesurfgrad1
  Scalar Field 2 = Freesurfgrad2
  Scalar Field 3 = Height
  Scalar Field 4 = Depth
  Scalar Field 5 = Pressure
  Vector Field 1 = Velocity
End

If paraview fails to read your .vtu files and complains about something like

vtkXMLUnstructuredGridReader (0x9749468): Cannot read point data array
"velocity" from PointData in piece 0.  The data array in the element may be too
short.

This might be, because there are 64 bit floats declared as 32 bit floats in your .vtu files. In this case, the best help is to change all occurences of Float32 to Float64 in ResultOutputSolve.src and ResultOutputSolve.f90 and recompile. Alternatively, you can do this substitution on all .vtu files. Under Linux/...

sed -i s/Float32/Float64/ *.vtu

will do the job. Some versions of paraview have this problem, some don't.


parallel runs

When Elmer is run in parallel, it generates one .vtu file per partition and time step and a .pvtu file per time step that contains references to all partitions. If ParaView refuses to display the pvtu files as a time series, a .pvd (ParaViewData) file can help.

This python script will print out a .pvd file containing references to all .pvtu files in a directory. And sets the time to be the number of the file.

#!/usr/bin/python

import glob

files = glob.glob('*.pvtu')
files.sort()

print """<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
<Collection>
"""


for (num,name) in enumerate(files):
        print '<DataSet timestep="'+str(num+1)+'" group="" part="0" file="'+name+'"/>'


print """</Collection>
</VTKFile>"""


Using ParaView

Node Numbering

ParaView uses C-Style numbering, beginning at 0 and ending at Number_of_nodes-1. Thus, the node numbers in ParaView are always one below the numbers in Elmer.

Personal tools