1

I have tried looking for solutions to this both here and elsewhere on the web, but no place do I seem to find exactly what I want.

My problem is the following: I have a numerical simulator that solves a fluid flow problem in 2d or 3d using a radial (cylindrical) grid. The simulator uses a finite volume approach, whereby a single value of each variable of interest (e.g., pressure, concentrations) is calculated for each grid block.

I want to visualize the profiles in 2D (for the 3D case, I want to plot slices in the z-direction) using Python (matplotlib). However, I do not want a contour plot with a smooth profile, but rather a single colour coded value inside each grid cell. I would also like to have an option to plot the grid lines.

As an alternative, or as an additional approach, I wonder if the same problem can easily be solved by using Paraview? That is, how would one go about writing the necessary .vtk files, based on information about bounding radii, azimuth angles and z coordinates of the cells of the simulation mesh?

If anyone could help me with either of these questions, I would be very grateful!

1 Answer 1

0

For ParaView, the most straightforward solution I can think of is to write a VTK file. You can load that file, slice it in any direction, and view cell-centered data with and without the grid lines quite easily.

Your VTK file would contain xyz coordinates that you transform from the polar coordinate system in which I assume they are represented. Your cell type would be VTK_HEXAHEDRON cells. It sounds like you want to store your data as what VTK calls a "cell" data array (as opposed to a "point" data array, which is associated with the grid points). For more details on the VTK legacy file format, see http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.