You are on page 1of 40

Advanced ParaView Visualisation

Tips and tricks beyond GMV-like operations

Graduate Class Numerical Simulation / IANUS Technische Universitt Dortmund


Sven Buijssen sven.buijssen@tu-dortmund.de

November, 5th 2009

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
2

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
3

Choosing a suitable module


ParaView is a big package and can be congured and compiled against numerous third-party libraries, e.g.: without FFMPEG: create sequence of PNGs, TIFs or JPGs from GUI with FFmpeg: additionally create AVIs directly from GUI with Python: possible to write small lters in GUI, no need to code C++ without MPI: Only 1 ParaView data server possible. with MPI: Arbitrary number of ParaView data/render servers possible (clusters with/without GPUs) with OpenGL: Use GPU on compute server (if not careful: GPU on display host!) with Mesa: Use software rendering for hosts without GPUs

Why compiling ParaView yourself?


Kitware Inc. provides ready-to-use binaries for Linux, Mac OS and Windows. Why bother compiling ParaView yourself? ParaView is a big package and as such contains numerous minor and major bugs. New releases are issued every 46 months. Find a bug, report it and a x may be available in CVS/Git long before a new binary release is available. Both developing plugins and compile-time changes (e.g. Postscript export for rendered objects) require self-compilation. Provided binaries are without MPI support. Because MPI is implemented with dierent (internal) APIs by dierent vendors. Kitware Inc. would have to create a dierent binary for cross product of operating system and MPI implementation.

Choosing a suitable module at TU Dortmund (1)


The workstations & servers at Institute of Applied Mathematics and on LiDOng clusters have multiple ParaView installations:
Ocial ParaView releases (version 3.4.0 and 3.6.1) Multiple CVS builds. Main dierence there: with OpenGL or with Mesa.

Why care? Because running an unsuitable version may result in slower performance than possible
(Mesa means software rendering, Open GL implies hardware rendering)

segfault on startup Youre lucky segfault (because of invalid GL command) any time when building a You loose a pipeline and have wasted your time. pipeline in GUI
(Segfault may happen for gmvgl, too, when run in context without OpenGL support.)

Choosing a suitable module at TU Dortmund (1)


Choices at one of the workstations & servers at Institute of Applied Mathematics: Linux 32 bit workstations (most of them have GPUs):
User sits in front of the workstation feasible and recommended to use OpenGL version, e.g. % module load \ paraview/3.7.0-gl-cvs2009-10-28-postscriptexport-gmvimport User is connected to workstation via ssh (e.g. in a NX session) or uses one of the 32 bit compute servers without a GPU use Mesa version!! E.g. % module load \ paraview/3.7.0-mesa-cvs2009-10-28-postscriptexport-gmvimport

Linux 64 bit workstation and servers (only a few have GPUs, but those are reserved for GPU computing, not visualisation):
use Mesa version, e.g. % module load \ paraview/3.7.0-mesa-cvs2009-10-28-postscriptexport-gmvimport

Choosing a suitable module at TU Dortmund (4)


Choices at one of the workstations & servers at Institute of Applied Mathematics: Solaris SPARC servers, i.e. SunRay users:
Sun Solaris 10s OpenGL has a bug that causes PV to segfault and typically crashes the Xserver, too ( immediate logout!) use Mesa version, e.g. % module load \ paraview/3.7.0-mesa-cvs2009-10-28-postscriptexport-gmvimport

64 bit Itanium server: no ParaView installed Windows terminal server: no ParaView installed

Choosing a suitable module at TU Dortmund (5)


Choices on LiDOng cluster: Linux 64 bit gateway servers and compute nodes (neither one has GPU(s)): use Mesa version, e.g. % module load \ paraview/3.7.0-mesa-cvs2009-10-28-postscriptexport-gmvimport

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
10

Choosing a suitable module for client/server setup (1)


ParaView supports separating the tasks of data display, reading of data and rendering of data. By default, ParaView uses builtin mode: reading, rendering and display on one machine Via Connect method ParaView client can connect to local or remote ParaView server processes
In case of a remote server log in via ssh and create a tunnel for ParaView connection. Example: % ssh lidong1.hrz.tu-dortmund.de \ -L<client port>:localhost:<server port> Caution: ensure that ports are not already in use! Check this beforehand e.g. with % netstat -an | grep <client-side port number> on host where ssh is invoked and % netstat -an | grep <server-side port number> on host you are connecting to. In case of a local multi-core machine (that noone else uses) skip this step and use default ports 11111 in the following

11

Choosing a suitable module for client/server setup (2)


Example (continued):
2 3

Load suitable module % module load paraview/3.7.0-cvs2009-10-28 Start ParaView data+render server processes
Start 1 process % pvserver \ server-port=<server port> use-oscreen-rendering Start multiple processes % mpirun -np 16 pvserver \ server-port=<server port> use-oscreen-rendering

Run paraview client (GUI) locally and choose Connect to local port <client port> % paraview
File - Connect Add server. Name: LiDOng via ssh tunnel Server Type: Client/Server Host: localhost Port: <client port> Ok Select entry and press Connect
12

Choosing a suitable module for client/server setup (3)


Example (continued):
5 6 7

Test with e.g. Sources - Cone - Apply Distribute data to parallel processes (aka partition) by applying D3 lter Visualise partitioning by applying Process Id Scalars lter

13

Choosing a suitable module for client/server setup (3)


Caution: When running ParaView in client/server mode, do not mix versions! Never use e.g. ParaView 3.6.1 in combination with ParaView 3.7 In general do not mix ParaView 3.7 <some date> with ParaView 3.7 <some later date>, either.

14

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
15

Exporting vector graphics


By default, ParaView supports screenshots in le formats PNG, BMP, TIFF, PPM, JPG and PDF. All are bitmap based formats. True vector graphics (PS, EPS and SVG) export is only available in self-compiled ParaView, not in ocial binary releases
(Not sure whether it is possible to convert the required changes into a plugin)

Compile time requirements: my Postscript patch plus old versions of class vtkPVScalarBarActor (pre-November 2008) Run time requirement: Disable Interpolate Colors checkbox in Object Inspector, Display tab. Otherwise object will be exported with greyscale colormap! Works only for 3D view (i.e. not for 2D view nor bar char/xy plot/spreadsheet view...) Works only in built-in mode, not in server mode Does support all types of source objects (sole exception: Mandelbrot source) and mesh types Live demonstration
16

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
17

Converting data to fulll lters input requirement


Most lters require certain types of mesh as input To convert your data set to required format apply one of
Clean to Grid lter Delaunay 2D lter Delaunay 3D lter Extract Surface lter Triangulate lter Tetrahedralize lter Tesselate lter

Live demonstration: 2D data set from level 7, Extract Surface, Triangulate, Decimate data set on level 2. Use case: reduce memory imprint of large le series, create animation scene with reduced dataset ( faster prototyping), save state le, edit it to use the original le series, nally use ParaView GUI or pvpython script to create high-resolution animation
18

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
19

Emulate gmvdi in ParaView


Jens Acker has written gmvdi, a command line tool that imports two (2D/3D) gmv les (possibly using dierent meshes) and creates a new gmv le containing data arrays being the dierence of data arrays in the input les. Use case: How did velocity and pressure change between T=3.0 and T=3.5?

Realisation in ParaView: Load both data sets Apply Calculator lter on each of them to give eld of interest a unique name (e.g. velocity vel1 / vel2) Apply Append Attributes lter to both Calculator objects Apply Calculator and compute dierence between the two eld using their unique names (operation: vel1 - vel2) In case of dierent meshes, apply a Resample with dataset lter before using Append Attributes lter.

20

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
21

Emulate gmvpt in ParaView (1)


Jens Acker has written gmvpt, a command line tool that imports a sequence of (2D/3D) gmv les providing velocity data arrays, performs particle tracing based on a ASCII conguration le and creates a sequence of new gmv les containing tracers.

Realisation in ParaView for steady state data set: Load data set Apply Stream Tracer lter Position Point Source or Line Source somewhere inside of the geometry

22

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
23

Emulate gmvpt in ParaView (2)


Jens Acker has written gmvpt, a command line tool that imports a sequence of (2D/3D) gmv les providing velocity data arrays, performs particle tracing based on a ASCII conguration le and creates a sequence of new gmv les containing tracers.

Realisation in ParaView for transient data: Load in a time-dependent le series


In case of GMV les possibly convert them to ExodusII le format rst: 1 Loading of ExodusII les faster due to smarter le format (no need to parse all les for time information, see previous tutorial on GMV reader plugin) 2 ParticleTracer lter will cause GMV reader plugin to raise (harmless) warnings of kind vtkFileSeriesReader: vtkTemporalDataSet not fully supported.

Apply Temporal Cache lter rst (mandatory!), set to cache 2 time steps Create Point Source somewhere inside of the geometry Apply ParticleTracer lter
(Input: TemporalCache object, Source: PointSource)

Toggle visibility of TemporalCache object in Pipeline browser Optional: Apply Pathlines lter
24

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
25

Equivalent of gmvmpeg3 / gmvmpeg4


gmvmpeg is a script of mine that automates the process of applying a given attribute le to a gmv le series, creating snapshots and converting them into a movie.

ParaView supports loading and saving of state les (equivalent to GMVs attribute les), from GUI and in plain Python scripts Manipulation of state les from within Python possible, but tricky: Following scenario as replacement for gmvmpeg4 in principle possible, but not mastered yet:
Load a single le or a small le series, set up a pipeline, save state Load state le from Python script and let script replace le series from state le with a dierent (complete) le (series) Let Python script generate snapshot/animation

Easier: Edit state le (plain XML le) and alter le name references. Automate this in a custom shell script. Additionally: ParaView supports generation of AVIs as well as saving sequences of PNGs, TIFs and JPGs directly from GUI. No replacement for my gmvmpeg scripts available nor planned
Bitmap le series can be converted to movie by means of, e.g., Unix command line mencoder "mf://animation*.png" -mf type=png:w=1280:h=444:fps=25 -nosound \ 26 -ovc lavc -lavcopts vcodec=wmv2:vbitrate=1200 -o wmv2.avi

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
27

Examples Programmable lter


Problem: Export data as CSV le, but only some of the data, not all. No ready-to-use solution in ParaView Possible with the following pipeline:
Apply Extract Block and Merge Blocks lter for multi-block data set Apply Programmable Filter with the following Python source code:
inp = self.GetInput() filename = "foo.csv" FILE = open(filename, "w") FILE.write("x,y,z, x-velocity\n") numPoints = inp.GetNumberOfPoints() vel = inp.GetPointData().GetArray("velocity") for i in xrange(0, numPoints): coords = inp.GetPoint(i)[:3] FILE.write(str(coords[0]) + ",") FILE.write(str(coords[1]) + ",") FILE.write(str(coords[2]) + ",") FILE.write(str(vel.GetValue(i * 3)) + "\n") FILE.close()
28

Examples Programmable lter (cont.)


Problem: Node and cell numbers should start at 1, not 0.
VTK always starts counting at 0, so does ParaView.

No ready-to-use solution in ParaView Possible with the Programmable Filter


(apply Extract Block + Merge Blocks lter for multi-block data sets rst) inp = self.GetInput() out = self.GetOutput() # Provide all input data sets ourselves out.ShallowCopy(inp) offset = +1 # Shift point number by 1 numPoints = inp.GetNumberOfPoints() newData = vtk.vtkIdTypeArray() newData.SetName(Point IDs (shifted by 1)) newData.SetNumberOfComponents(1) for i in xrange(0, numPoints): newData.InsertNextValue(i+offset) out.GetPointData().AddArray(newData) # (continued in next column) # (continued from left column) # Shift cell number by 1 numCells = inp.GetNumberOfCells() data = inp.GetCellData().GetArray("IDs")

newData = vtk.vtkIdTypeArray() newData.SetName(Cell IDs (shifted by 1)) newData.SetNumberOfComponents(1) for i in xrange(0, numCells): newData.InsertNextValue(i+offset) out.GetCellData().AddArray(newData)

29

Examples Programmable lter (cont.)


Problem: Plot number of nodes and cell numbers over time. No ready-to-use solution in ParaView Possible with the Programmable Filter
(apply Extract Block + Merge Blocks lter for multi-block data sets rst) inp = self.GetInput() out = self.GetPolyDataOutput() newPoint = vtk.vtkPoints() newPoint.InsertPoint(0,0,0,0) out.SetPoints(newPoint) numPoints = inp.GetNumberOfPoints() numCells = inp.GetNumberOfCells() newData = vtk.vtkUnsignedLongArray() newData.SetName("numPoints") newData.SetNumberOfComponents(1) newData.InsertNextValue(numPoints) out.GetPointData().AddArray(newData) # (continued in next column) # (continued from left column) newData1 = vtk.vtkUnsignedLongArray() newData1.SetName("numCells") newData1.SetNumberOfComponents(1) newData1.InsertNextValue(numCells) out.GetPointData().AddArray(newData1)

Select newly created point Apply Plot Selection over Time lter
30

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
31

Custom lters
Provide a means of grouping and saving a set of lters (a sub-pipeline) for future use as a new lter. Can be exported and imported easily (shareable, XML-based format) Live demonstration (Save last Programmable Filter example as Custom lter, store it as Demo - Plot Number of Points & Cells over Time)

32

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
33

Lookmarks
Are (more or less) custom lters plus stored color by settings and (optionally) stored camera positions Facilitate reproduction of pipeline for another source (e.g. reader source) Are created via Tools - Create Lookmarks Persist through sessions if saved A lookmarks camera settings are restored if the corresponding check box is enabled in the Lookmarks Inspector (accessible via View menu or by selecting edit in a lookmarks context menu) Live demonstration

34

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
35

Live Data
GMV supports auto-read of new les (through busy-wait 100 % cpu load discouraged use case) Dicult to realise in VTK and ParaView and not available for default ParaView readers
Reason: No means in general to guarantee consistency of new le, i.e. has it been written completely yet by external application such that it is safe to read the le?

Has been discussed frequently in the past (see e.g. discussion http://markmail.org/message/734wfelphy3uepjr) and realised at least once (by Takuya Oshima for his parallel OpenFOAM reader plugin, accepting the fact of the mentioned race conditions). No plans to incorporate this into the GMV reader plugin.

36

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
37

Stability of ParaView
2,000,000 million lines of code (non-blanks, non-comments) (see http://www.ohloh.net/p/3249/analyses/latest) rule of thumb in computer science: 1 critical error per 1,000 lines of code many bugs in ParaView! Public bug tracker: http://www.paraview.org/Bug/
(Note: Just dont upload any GMV les as GMV reader plugin is neither yet known nor available outside our department. Try converting to one of VTK le formats if necessary to reproduce bug.)

Evaluation of Stability
Very stable for standard GMV-like operations Expect frequent segmentation faults when trying to create high gloss animations. Save state les often! Better: Make sure to activate "Crash Recovery" checkbox in Edit Settings - General. Ocial releases more stable than CVS HEAD versions. The latter have nice new features, though. (Ocial release cycle: 46 months)

38

Outline
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Choosing suitable ParaView module Client/Server setup Exporting vector graphics (PS, EPS, SVG) Converting data to fulll lters input requirement Emulate gmvdi in ParaView Emulate gmvpt for steady state data set / Stream Tracer Emulate gmvpt for transient data / Particle Tracer Equivalent of gmvmpeg Examples Programmable lter Custom lters Lookmarks Live Data Stability of ParaView Learn more about ParaView
39

Learn more about ParaView


http://www.paraview.org/Wiki/The_ParaView_Tutorial http://www.paraview.org/Wiki/IEEE_Vis08_ParaView_Tutorial (mirror: http://vgtc.org/wpmu/vis08/2008/11/03/advancedparaview-visualization/) http://www.paraview.org/Wiki/SNL_ParaView_3_Tutorials http://www.paraview.org/Wiki/ParaView ParaView mailing list

Thank you for your attention.

40

You might also like