Gradients and boundaries

Hello,

I am a relatively new Paraview user, and I have a question about how the Gradient filter operates (or how to correct its operation) on periodic boundaries.

In my application I have an unstructured mesh that I load from an Exodus file. The mesh is a cube, and in my problem, I have periodic boundaries connecting the x=0 and x=L faces, and connecting the y=0 and y=L faces.

As discussed in [1], Paraview doesn’t know that my boundaries are periodic. This creates problems when I use the Gradient filter to compute the divergence. While the divergence looks reasonable in the volume of my mesh, it suddenly takes crazy and unphysical values on the boundaries. This problem has been seen by others (for example, see [1] and [2]), but I don’t see a full solution documented on the forums.

Therefore, for my benefit, and the benefit of all other Paraview newbies with the same issue, can someone please tell me:

  1. In my case, how do I implement the Gradient filter to get the derivatives to properly calculate on the boundaries for my case?
  2. Perhaps connected to question #1, how do I tell Paraview that my boundaries are periodic? As discussed in [1], Paraview probably doesn’t recognize periodic and symmetric boundaries with exodus files. Is this is not true, please let me know.

Thank you in advance,
Chris

Links to other related discussions:
[1] How does Paraview compute spatial derivatives at boundaries
[2] https://www.paraview.org/pipermail/paraview/2016-September/038126.html

It could be considered to add a “periodir boundary computation” property in the gradient filter associated with a field to identify which boundary is periodic, but if the actual computation require to recover information on the other side, through the periodicity, then it may not be trivial to recover the correct data.

In any case, this would need to be implemented in C++ and added in the vtkGradientFilter in VTK.

Perhaps connected to question #1, how do I tell Paraview that my boundaries are periodic?

There is no concept of periodic boundaries in ParaView, so you cant.

This is absolutely true.

But that said, there is something in ParaView that is kinda similar: ghost cells. You can use ghost cells to add a layer (or two or three) of cells at the boundaries of partitions to capture information in cells in different partitions or different ranks of an MPI job.

It is conceivable that you could do something similar for periodic boundaries. You could write out your Exodus data where you write an extra layer of cells on each side of the periodic boundary providing the repeated information. That would make the gradient correct everywhere except in these repeated cells, which you would then remove after computing the divergence.

You could mark these repeated cells at the boundary as ghost cells to get ParaView to automatically remove them. However, that might not be a great idea because, as @mwestphal pointed out, ParaView does not understand periodic boundaries and will likely do weird things. For example, when you try to render surfaces with periodic ghost cells, ParaView will not render anything because it will expect another partition to be drawn on top of that boundary (not repeated on the other side). I would recommend creating a cell field of your own name to identify your ghost cells and remove them with the Threshold filter.

2 Likes

This is very smart!

To all,

I’ve tried a couple work arounds.

First, I tried using Transform to translate and create copies of my domain at each boundary. My thought was that I could combine my original domain with its transforms to mimic the correct boundaries, perform the Gradient filter, and then chop the domain down to its initial size (or interpolate the divergences onto my original mesh points). However, after trying this for more time than I care to admit, I couldn’t figure out how to get it to work.

Second, I did play around with the ghost zone idea. However, the documentation doesn’t really tell me how to create a ghost zone with values taken from a specific region of the mesh, or how to apply those zones to a specific face. For this reason, I didn’t pursue it strongly. Is there an example you can provide, or some walkthrough on how to do it?

Thank you,
-Chris

You will have to share your data to get better direction on that.

My guess is that even though the cells are drawn next to each other, the connection information is missing over the boundary. After you do the Transform, you will probably have to merge the datasets together (usually with Append Datasets) and then merge coincident points with Clean to Grid.

This is not something that ParaView can do. I was suggesting that whatever is writing out your data write an extra layer of cells across the periodic boundary.

1 Like