By Hamed “Kay” Khandan, Dr. Eng.
Kobe University
ParaView is one of the most widely used visualisation tools. The software is completely written using the Visualisation Tool Kit (VTK) in C++. Both VTK and ParaView are available as free open source software to download at www.paraview.org.
In this tutorial, we are going to learn about the data-flow model used in ParaView and how to use some common filters to visualise data.
The dataset used here is the result of a CFD simulation on a model of Toyota IQ car.
This tutorial is made for ParaView ver. 3.14.1.
The architecture of VTK is based a programming paradigm called data-flow. Data-flow is extensively used in 3D modelling, animation, visualisation and image processing software. The particular advantage of data-flow is that, it can be easily represented in GUI and users without programming skills can easily understand and start to use it. Being based on VTK, ParaView also enjoys this advantage.
There are two basic elements involved in data-flow paradigm: process and data. Let’s have a closer look at each.
Each process can have zero or more inputs and outputs. Processes can be connected to each other by connecting the output of some to the input of some others. This will crate a directed graph formation between processes. The nodes with zero inputs are called sources. The ones with zero outputs are called sinks. And, the one with both inputs and outputs are called filters.
Sources can be input read from files, or data that is produced algorithmically. ParaView provides sources for variety of file formats, and also algorithmic ones that produce primitive objets like sphere, box, etc. With ParaView open, you can insert sources by selecting “Sources” sub-menu in the main menu.
Sinks are subprograms that render data into a visual representation. ParaView implicitly chooses the most appropriate sink according to the given data. However, some of the appearance parameters can be set in “Display” tab that is usually located at the bottom left corner of ParaView window.
Filters convert data from one representation to another. In ParaView you can select the “Filters” sub-menu in the main menu to see the list of all available filters.
The output of a node can be connected to the input of another one only the data type (format) of the output channel is compatible with the input of the target node.
In ParaView, the type of the data that is exchanged between the nodes are all based on a general data-type called DataSet. A DataSet can contain an array of cells data an array of point data. The way these points and cells are used to represent data further devices DataSet into various subtypes: Image Data, Rectilinear Grid, Structured Grid, Unstructured Points, Polygonal Data, and Unstructured Grid.
ParaView support various types of cells, including Triangle, Triangle Strip, Quadrilateral Pixel, Polygon, Tetrahedron, Hexahedron, and Voxel.
The dataset used in this tutorial is of Image Data type, and that implies the cells of type voxel. Each cell and pixel can be supplemented with various data. Each pixel obviously has a position, but also supplied with a normal vector that is used for rendering. In the data set used here, each cell is associated with a pressure value “p”, temperature “t”, and a velocity vector “u”.
Lets start by a simple tasks to help getting familiar with ParaView environment.
Open ParaView. You will have your toolbar on the top. On the left, you have a pane divided in two. The upper part is pipeline, when you can see and edit connections between sources and filters. And the lower part you can see and edit different attributed for each node. The bigger part of ParaView is taken up by the renderer viewport where you see the output for your visualised data.
Select “Cone” from “Sources”. Nothing will appear in the view port. Instead, a new node, Cone1, will appear in the Pipeline Browser, and the contents of properties pane changes accordingly. Click “Apply”. Now you see a cone in the viewport pointing to the left. Every time you make a change to the pipeline, or any of its nodes, you will have to click “Apply” to see the changes.
Lets make the cone to point upwards. In the properties pane, enter 0, 1, 0 in order for “Direction”, and then click “Apply”. You can change other properties as well. For example set “Resolution” to 12 and click “Apply”.
Lets change the appearance of the cone. Click on “Display” to bring on the Display tab. In the “Color” section, notice that “Solid Color” is selected for “Color By” attribute. Click on “Set Solid Color…”. A color selection window will be opened. Choose a color of your choice, and clock “OK”.
Now, lets see how filters work. In the main menu, click “Filters”, then from “Alphabetical” sub-menu, choose “Elevation”. A new node, Elevation1, will appear right below Cone1 one the Pipeline Browser, and the contents of Properties pane will change accordingly. Go to the Propertied pane, click on “Y Axis” button, and then click “Apply”. The result may not look very meaningful at this point. We need to perform one more step. Go to the Display pane, and notice in the color section, in front of “Color By”, the selection is changed to “Elevation” instead of perviously selected “Solid Color”. Click on “Rescale to Data Range” button. Now, we can see the colouring of the cone reflects the elevation of each point on it.
Close your current ParaView session and open a new one. If you have not done so already, download the sample dataset from the following link and decompress it. You will end up with a directory called CFDData with some files and sub-directories in it.
https://www.dropbox.com/s/aloiiutmwads4fn/CFDData.zip?dl=0
Now go to your ParaView window, click on “File” menu and click “Open”. Locate the file IQ-mod.stl under the CFDData sub directory. This file contains the geometry of the subject for our CFD data which is a car. Click “Ok”. A new source node called “IQ-mod.stl” will appear in the Pipeline Browser. In the Properties pane, click “Apply” to make it visible.
We will now add the CFD data to the scene. Click “Open” in the “File” menu again. Go to VTK sub-directory under CFDData directory, and locate the item “data-flow-..vthb” in the files list. Before you open it, please notice that it is not a real file. Click on the little triangle on the left side of this item to the a list of actual file names. Each one of these files contain one tilmestep of the simulation. This dataset provides 50 of them. ParaView recognises files with successively numbered file names and can opens them together.
Now click “OK” to open the dataset. Click “Apply” on the Properties pane. You will see the car model is now surrounded by the hollow of a cube. Click on the “Reset” button on the toolbar as shown in the following picture to see the entire cube. This is the area where CFD results are available. But we still need a way to visualise it. Go to the information tab on the bottom left. In the “Data Hierarchy” section select “Level 1”. In the “Data Arrays” part, you will see three items, “p” stands for pressure, “t” is for temperature, and “u” refers to velocity vectors. The first two are scalar, while the last one is a vector of size 3. Below in the “Time” section you will see a list of numbers from 0 to 50.
One way to visualise a 3D data is to view at a 2D slice of it. Make sure “data-flow-00000*” is selected in the Pipeline Browser, and then click on “Slice” icon on the tool bar as shown in the figure. “Slice1” will appear as a child node in the Pipeline Browser. In the Properties pane, enter 4.5, 0, 1 for Origin, and 0, 0, 1 for Normal. Click “Apply”. You will see a slid coloured plane. We need one more step to do after this.
Bring up the Display pane, open the combobox in from of “Color by” and select “p”. Now you will see the pressure values are visible on the slice you just made. Click on “Play” button on the toolbar to see all the timesteps.
If you want to see which color corresponds to which value, click on “Edit Color Map…” button. Bring up the “Color Legend” tab, and check the box labeled “Show Color Legend”. Click “Close”.
One other way of visualising spacial data is by removing less important parts of it using a treshold value.
Select “Slice1” in the Pipeline Browser and press delete button on the keyboard to remove it. Select “data-flow-00000*” again and click on “Threshold” button on the toolbar. In the Properties pane, select “p” in the “Scalars” combobox. Leave “Lower Threshold” with its original value, but enter -70 for the “Upper Threshold”. Click apply. You will see all the voxels with pressure values lower than -70 appear in the viewport. Click “Apply”. Now go to “Display” pane, in the “Style” section, enter 0.5 for “Opacity”.
The rest of the filters used in this tutorial operate on point data rather than cell data. Since provided in our dataset is cell data, we need to convert it to point data. Doing so is very straight forward. But first, please delete the “Threshold1” node we just made in the Pipeline Browser. Make sure “data-flow-00000*” node is selected. In the main menu, select “Filters”, open “Alphabetical” sub-menu, and click on “Cell Data to Point Data”. Click “Apply”.
Nothing changes in the viewport, but a new node, “CellDatatoPointData1” appears in the Pipeline Browser.
Glyphes are small three- or two-dimensional figures that are positioned at each point and helps visualizing the value associated with that point.
With “CellDatatoPointData1” selected, click on “Glyph” icon in the toolbar. Scroll down in the Properties pane and enter 1000 as the value for “Maximum Number of Points”. Click “Apply”. The arrows appearing in the viewport show the direction of the velocity of fluid (air) at a series of selected points.
Another way of visualising CFD data is via streamlines. Each streamline shows the path that a hypothetical fluid particle would follow given a particular velocity field.
First, delete the “Glyph1” node we just produced. With “CellDatatoPointData1” node selected, click on “Stream Tracer” in the toolbar. Click “Apply”. You will a set of streamlines. However the do not cover the entire volume. Scroll down in the Properties pane and enter 3 for “Radius”. Click “Apply” again to get the desired result.
You may want to make the colouring more meaningful. Go to the “Display” tab, in “Color By” combobox, select “u”, and then click on “Rescale to Data Range” button. Now the coloring of streamlines correspond to the magnitude of velocity.
One way of visualising scalar values like pressure and temperature is via iso-surfaces. An iso-surface is a surface that every point of it has the save value of the given parameter. There are two filters that can be used to get iso-surfaces in ParaView: “Iso Volume” and “Contour”. In this section we use the Contour filter.
Fist, delete the “StreamTracer1” node created in the last step. With “CellDatatoPointData1” selected, click on “Countour” icon in the toolbar. Scroll down in the Properties pane and click on “Delete All” button. Click on “New Range” button. A new dialog will be opened. Click “OK”. Then, click “Apply”. You will see a set of iso-surfaces being displayed in the viewport.
To make the visualisation more appealing, go to the “Display” tab, select “p” in the “Color By” combobox, and click “Reset to Data Range”. Then, scroll down and change Opacity to 0.6.
Another way of studying iso-surfaces is to look at them slice-by-slice. With the “Contour1” selected, click on “Slice” button in the toolbar. In the Properties pane, enter 4.5, 0, 0.2 for Origin, and 0, 0, 1 for Normal. Slick “Apply”. You may want to hid the iso-surfaces produced in the last step by clicking on the eye icon on the left of “Contour1”, or set its opacity to a low value like 0.1.
Below Slice and Contour filters are applied in reverse order.
Delete the Slice and Contour filters we just used. Now with “CellDatatoPointData1” selected, create a new Slice filter. Click “Apply” without changing any properties. Now with the new Slice filter selected in the Pipeline Browser, click “Wrap By Vector” icon in the toolbar. Enter 0.02 as the value for “Scale Factor”, and click “Apply”.
What happens here is that, the surface of the slice we just made is deformed according to the value of “u” (velocity) vector. You can apply a more meaningful colouring to it by going to “Display" tab and select “u” in the “Color By” combobox.
Below multiple instances of this filter are combined with streamlines.
This tutorial was made for SIGGRAPH Asia Open Data Visualisation contest.
Special thanks to Dr. Junya Ōnishi for producing the dataset used here.
Next: Read the VTK Tutorial