Using VTK API in CFD code

I am Suman Vajjala and I am developing a parallel, high order, unstructured grid based CFD code in C++ for LES/DNS. As I will be using high order mesh elements, I decided to use Paraview as my main visualization software.

I’m new to the VTK API and I tried to find resources/articles on how to use them but I could not find any. I have, infact, written a VTK writer for my CFD code as a result. Could you please direct me to an example where the VTK library is used for writing CFD data using the VTK API? I plan to replace my code with it.

@danlipsa @berkgeveci

Thanks,

Regards
Suman

Hi Suman,
There is a lot of VTK documentation out there.
https://examples.vtk.org/
https://book.vtk.org
https://vtk.org/documentation/

I suggest finding the examples that create unstructured meshes from scratch as well as ones that use writers. Having said that, there is not a writer for every format VTK supports. For example, there is not writer for the VTKHDF5 format. The assumption there is that the simulation would write VTKHDF5 directly using the HDF5 API.

Thanks @berkgeveci for the links. I’ll follow the WriteVTU.cxx example.

Regards
Suman

Hi Suman,

You could also consider to write your solution in CGNS format, which is much more common than the VTK format. In fact, the VTK file documentation itself rightly suggests to use something else, unless… (cite from VTK File Formats - VTK documentation: “Whenever possible, we recommend that you use formats that are more widely used.”). We use CGNS as output (and input, by the way) and find that it works well with Paraview, as well as with other postprocessing tools. Benefit is also that you can easily exchange the files with other parties.

Good luck and best regards,
Serge

@Tox Thank you for the suggestion. Does CGNS support high order mesh element based solution visualization? Can you please suggest a reference for easy implementation of solution output to CGNS?

Thanks and Regards
Suman

Here you can find all the info on CGNS: CGNS Documentation

I am not familiar with higher order elements, but from CGNS Standard Interface Data Structures - Conventions it seems it is possible.

Good luck,
Serge