Plot over line does not work with Cell Data or "CellDataToPointData"

Hello,

I developed a lid-driven cavity Navier-Stokes solver using a collocated grid and finite volume method. Later, I added a VTK module to the code to store the velocity and pressure fields at the mesh centers as cell data. The VTK output section of the code and an example output file is in the attachments

The problem is: I cannot extract data along the centerline using “Plot Over Line”. If the issue is related to it being cell data, I tried converting it to point data using “Cell Data to Point Data”, but “Plot Over Line” still doesn’t work. When I use “Resample to Image”, it works, and I can plot the data. However, I suspect that “Resample to Image” does not perform correct interpolation because it produces the same points as “Cell Data to Point Data” but assigns different values to the same points.

Exporting to CSV or copying data from “Spreadsheet View” is a workaround, but I want to plot the data properly within ParaView.
vtkPartOfTheCode.txt (1.9 KB)
colocated_results.vtk (3.8 KB)

After days of trying different approaches, I finally got Plot Over Line to work with cell data on my 2D geometry. The solution was simpler than I expected - just applying a Transform Filter fixed everything.

What’s interesting:

  • It works even with tiny transformations (like moving the geometry by 0.001 units)
  • You don’t need to convert cell data to point data anymore
  • Even applying the filter without changing any transform values makes it work

I think there might be a bug here because the geometry’s actual position doesn’t seem to matter - just having the transform filter in the pipeline makes Plot Over Line work properly.

I’m planning to bring this up at the next ParaView Office Hours meeting. It’s one of those weird quirks that might need looking into.

It looks like PlotOverLine does not work on RectilinearGrid, please open an issue: https://gitlab.kitware.com/paraview/paraview/-/issues

just applying a Transform Filter fixed everything.

A transform make you rectilinear grid a unstructured grid, on which plot over line works.
The “canonical” way to do that would be to use AppendDataset filter instead.

When I apply AppendDataset filter, it only plots with “Sampling Uniformly” selection. When I select “Sample at Segment Centers” or “Sample at Cell Boundaries”, it does not work.

Your unstructured grid contains only “Pixel” cells, which are not well supported by the PlotOverLine filter, please open an issue: https://gitlab.kitware.com/paraview/paraview/-/issues

Use Tetrahedralize filter to convert these pixels Into triangles to make the filter work as expected.

Tetrahedralize is a such a cool filter. But it does not make any difference compared to transform. Also, since my work is an academical study and generating a mesh is an important part of it, I cant work with Tetrahedralize filter because when I need tetrahedrals, I need to code it by myself. But still, such a cool filter.

I think I will continue with transform. I will open an issue soon.

Thank you for your help Mathieu!

Ha right, transforming with an angle also convert the pixel into quad, which works too, good point.