Tokamaks and ParaView
Tokamaks, visualization, ParaView, high performance computing (HPC) and parallelism. Phew! It’s been a whirlwind of a month as I wind up the first half of my project “ParaView plugin for fusion data structures”.
ParaView, ubiquitously used in HPC, has the ability to produce complex visualizations using a lot of in-built techniques to process the input data, modify it and display it to understand and uncover hidden details. The general workflow within ParaView involves loading data using: ParaView readers, which read custom or standard data formats; or Sources, which create data formats of a particular user specification. The data is then processed using ParaView filters that modify the data according to the user specification and display the final visualization. Readers, writers and sources all fall under the category of plugins, which are all described based on libraries in the Visualization Toolkit (VTK). Developing a ParaView plugin for fusion data involves the following workflow shown in figure 1.
That’s a lot of complicated jargon for some visualization! Let me break down each step. Fusion data is organised in data structures that describe various physical aspects of fusion experiments called Consistent Physical Objects (CPOs). The data is extracted at different time steps using the Universal Access Layer protocol for databases based on different users, tokamaks for a particular shot and run number. The data is then analysed and converted into a ParaView Unstructured Grid using VTK libraries. The Unstructured Grid consists of points contained within the mesh and the associated cell data to form the connections. Along with the C++ code for the plugin, the Graphics User Interface is written in XML in order to obtain the various parameters that are required to extract the data. The C++ code and the XML based GUI are compiled into shared libraries (*.so on Unix, *.dylib on Mac, *.dll on Windows etc), which can be loaded into ParaView, when it is compiled from source. My effort during this month led to the creation of the first version of the plugin prototype, which automatically reads the fusion data into ParaView based on user in- putted parameters like username, tokamak, shot, run, etc and displays the resulting mesh/visualization.
Building the initial prototype of the plugin has acclimatised me to the visualization workflow within ParaView , along with improving my programming and debugging skills that have prepared me to add advanced features such as dynamic display of possible CPOs for a particular user and tokamak, integrating the plugin within the scientific workflow, etc. None of them are small tasks, but I am up for the challenge! Now your question must be, “Where is the HPC bit of the project?” Using the NX client to interact with the HPC cluster, all the computation is run remotely,which has given me the experience of using the tools within the cluster ranging from word-processors to scripting languages for automating tasks. I was also exposed to different aspects of Parallel programming on HPCs during the HPC Campus school between the 7th and the 11th of July. We explored programming on OpenMP and MPI working out examples and case-studies to firm the theories associated with parallel computing. This will help me a great deal in performing the advanced tasks and in using ParaView to handle larger and complex data sets in parallel, peforming simultaneous computation on its various bits and producing the final visualization.
This should help me a big deal with my PhD thesis as well, as I work in the realm of hair visualization. Using ParaView and HPC, I can split my visualization tasks amongst many processors in order to simplify my task and well as achieve quite a speedup. This will allow me to create more accurate hair visualization models without having to worry about the computational or time overhead.
All work and no play makes Jack a dull boy!
Having never been to Slovenia and central Europe before and also being an inquisitive Indian wanting to make use of a Schengen visa, I have managed to do quite a bit of travelling in beautiful Slovenia. Thankfully, the people within the faculty have been extra nice and suggested some beautiful places to visit during the weekends. From beautiful lake Bled, the picturesque coast side of Piran, the breathtakingly still waters within the huge caves of Skocjanske jame to the modern quaint little city of Ljubljana, I have completely fallen in love with beautiful Slovenia! I have been told that I have only seen the tip of the iceberg as fast as Central Europe is concerned, so I hope to do much more exploring along with the hard hours that I put in at the faculty
View outside our beautiful accommodation during the month ahead. Until then!
Beautiful seaside of Piran
Rainbows and Waterfalls in Vintgar Gorge
The SoHPC Experience
Developing Custom Plugins in ParaView
by Girish Ramesh
After a month of exploration, it was time to dig deeper into the capabilities of ParaView.
Plugins in ParaView enable the addition of user-defined functionality to ParaView through filters, readers and sources. In order to create a custom plugin for browsing through the list of Consistent Physical Objects and its data, a thorough understanding of the plugin mechanism needs to be developed. The Plugin workflow consists of different parts, which I briefly touched upon in my previous blog. It is further illustrated in detail in figure 1.
Figure 1: Framework for ParaView Plugin Development
The main functionality of the plugin is handled by defining a VTK class using C++, which specifies the type of data created or read by the plugin along with any processing of the data. The VTK class inherits from different vtkAlgorithm classes depending on the kind of data the plugin outputs. For example, a plugin that outputs an Unstructured Grid inherits from vtkUnstructuredGridAlgorithm. The VTK Algorithm adds on to the ParaView source and becomes a part of the reader, writer or source workflow. The GUI and input components are defined using a ServerManager XML description that defines the default Qt widgets used for various input properties along with any custom ones. One such example is shown in listing 1
command=” SetShot ” number_of_elements=” 1 ” default_values=”17151″>
command=”SetRun” number_of_elements=” 1 ” default_values=”9999″>
command=” SetRefRun ” number_of_elements=” 1 ” default_values=”0″>
command=” SetUser ” number_of_elements=” 1 ”
Listing 1: “Sample ServerManager XML”
The corresponding input GUI is shown in figure 2.
Using customised Qt Widgets, one can create a plugin to browse the list of CPOs and process the data within each of the fields. The browser can output the values of each field as a table or a spreadsheet as shown in figure 3. The plugin can also be used to output visualizations based on the meshes contained within the CPOs. This functionality is shown in the figure.
Using these features, one can explore the CPOs in order to obtain a concrete understanding of the data contained within each of its fields. The two months have helped hone my understanding of the powerful features of ParaView and also it’s shortcomings, which will hold me in good stead if I want to use the tool in my PhD project as well.
The experiences of the wandering Indian!
Along with my work, I continued to explore the length and breadth of central Europe, choosing to venture outside Slovenia and make my acquaintance with Austria and Croatia during the weekends. I visited the cities of Graz and Vienna in Austria, and chilled by the sea on the island of Krk in Croatia. Vienna took my breath away with its mix of culture, art and natural beauty especially the museums, the beautiful Schoenbrunn palace and St. Stephen’s church. Graz, on the other hand, was much quieter and offered the pleasures of a small town with the Muir Island and the lovely trek up to the clock tower, offering spectacular views above Graz. My last week- end, spent on the island of Krk, offered a much-relaxed ending to a hectic 2 months of work and traveling. I basked in the sun, gazing upon the dreamy waters of the Adriatic Sea and promised myself that I will definitely be back to this part of Europe again as both the internship and the experience has offered me so much!