[Paraview] Gradient filter: boundary effects
Moreland, Kenneth
kmorel at sandia.gov
Tue Sep 27 17:41:50 EDT 2016
As far as VTK/ParaView are concerned, lines and triangles are just different types of cells. The filters treat each cell uniformly. That is, the gradient filter is treating triangles and lines the same and mixing the results together in the same way as if the data contained triangles and quadrilaterals.
In many ways, the problem is that the mesh and boundary cells are not properly distinguished in the data. The lines in the data are really a “face set” or “edge set” that has different properties that the interior triangle cells (in addition to the difference in dimentionality). Although this is not specifically supported in VTK’s data structures, we typically manage it by creating a multiblock data set with the interior and boundary cells in different blocks.
However, although I don’t think the gradient filter’s treatment of the data is fundamentally wrong, I cannot think of a viable use case for computing gradients over cells of different dimensionality. So it would probably be a reasonable feature request to ask that the gradient filter only average gradients from cells of the highest dimension. That said, I don’t think it would be correct to change the behavior of cell data to point data as that is used for plenty of use cases other than gradients.
-Ken
From: "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com>
Date: Tuesday, September 27, 2016 at 11:43 AM
To: "Moreland, Kenneth" <kmorel at sandia.gov>
Cc: "'paraview at paraview.org'" <paraview at paraview.org>
Subject: [EXTERNAL] AW: [Paraview] Gradient filter: boundary effects
Hi again,
I have examined my mesh (which you can find in the attachment) with Salome and gmsh – there are no flat faces at the boundaries. But there are line elements! So I am relieved as far as my worried questions in the last mail are concerned – mesher and the FEM solver are doing their work as they should.
But IMO it makes no sense to compute the derivatives over the line elements and average it with the derivatives over the face elements. Is it possible that this is exactly what happens in the gradient filter (and in the computederivative + celldatatopointdata filters)? If so, why? And can that be switched off, as IMO it should?
Or, to put it differently: Apparently ParaView does not make a difference between a line and a face. Why is this so? Shouldn’t it do that?
Thanks for a clarification,
Matthias
Von: Zenker, Dr. Matthias
Gesendet: Dienstag, 27. September 2016 17:00
An: 'Moreland, Kenneth'
Cc: paraview at paraview.org
Betreff: AW: [Paraview] Gradient filter: boundary effects
Hi Ken,
thank you for pointing this out! I was not aware that boundary lines are also inifinitely flat cells. This seems true for all boundaries, also the internal boundaries between the two faces.
The question for me is now: Is this normal, or does that mean that the whole FEM simulation is corrupt? Should I have a mesh that does not have those line cells? The mesh has been calculated by the Salome mesher, which uses netgen. The boundaries were declared as groups. The mesh has then been exported as unv, imported by Elmer which has done the FEM calculations, and saved the results as vtu. If those line cells represent a problem, where in this chain do I have to look for the mistake?
Matthias
Von: Moreland, Kenneth [mailto:kmorel at sandia.gov]
Gesendet: Dienstag, 27. September 2016 16:41
An: Zenker, Dr. Matthias
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Betreff: Re: [Paraview] Gradient filter: boundary effects
Matthias,
As I suspected, your data has some boundary elements that are throwing off the gradient calculation. The data you sent me has line cells around the boarder of the data. The easiest way to see these line cells is to go to the Properties panel and change the “Line Width” parameter to something large. (Attached is an image that shows the boundary cells by setting the line width to 20.)
So in the example you gave, the gradient is computed correctly in the triangles, but the finite differences computation for the line cells can only compute the gradient in the direction of the line. Thus, there is no y component for the gradient in these line cells. Because the line cells share the points of the triangles along the bottom, the gradient average becomes incorrect.
-Ken
From: "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com<mailto:Matthias.Zenker at erbe-med.com>>
Date: Tuesday, September 27, 2016 at 9:51 AM
To: "Moreland, Kenneth" <kmorel at sandia.gov<mailto:kmorel at sandia.gov>>
Cc: "paraview at paraview.org<mailto:paraview at paraview.org>" <paraview at paraview.org<mailto:paraview at paraview.org>>
Subject: [EXTERNAL] AW: [Paraview] Gradient filter: boundary effects
Hi Ken,
if you want to have a look – here is a simple test file. At the bottom side, there are 4 adjacent cells having grad(y)~7900 from computederivatives, but all 3 nodes on the bottom side have grad(y) ~ 5300 from celldatatopointdata.
Thanks,
Matthias
Von: Moreland, Kenneth [mailto:kmorel at sandia.gov]
Gesendet: Dienstag, 27. September 2016 15:40
An: Zenker, Dr. Matthias
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Betreff: Re: [Paraview] Gradient filter: boundary effects
Matthias,
If values are being pulled from 7900 units down to 5300 units, there must be some neighbor with lower values. Why that is happening for you I cannot say without looking at your data. Perhaps on the boundary there are some malformed or 2D cells with invalid gradients.
-Ken
From: "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com<mailto:Matthias.Zenker at erbe-med.com>>
Date: Tuesday, September 27, 2016 at 9:06 AM
To: "Moreland, Kenneth" <kmorel at sandia.gov<mailto:kmorel at sandia.gov>>
Cc: "paraview at paraview.org<mailto:paraview at paraview.org>" <paraview at paraview.org<mailto:paraview at paraview.org>>
Subject: [EXTERNAL] AW: [Paraview] Gradient filter: boundary effects
Hi Ken,
what I don’t understand is that the cell gradients are correct, but their average at the border is not. (Example: All cell gradients adjacent to one node at the border have approx. 7900 units in y direction, the node has approx. 5300)
So it seems I cannot determine the gradient in the postprocessing step, but have to calculate it in the FEM solver (where I do get correct results now – I didn’t initially, which was the reason why I tried it with ParaView).
Thank you anyway, I have learned new bits of ParaView again (which is great software BTW)!
Have a nice holiday (if I interpret your autoreply correctly)!
Matthias
Von: Moreland, Kenneth [mailto:kmorel at sandia.gov]
Gesendet: Dienstag, 27. September 2016 14:36
An: Zenker, Dr. Matthias; paraview at paraview.org<mailto:paraview at paraview.org>
Betreff: Re: [Paraview] Gradient filter: boundary effects
You could run the results through the point to cell filter, but that would give you the same answer as the gradient of unstructured dataset filter with the faster approximation option on.
-Ken
From: "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com<mailto:Matthias.Zenker at erbe-med.com>>
Date: Tuesday, September 27, 2016 at 8:28 AM
To: "Moreland, Kenneth" <kmorel at sandia.gov<mailto:kmorel at sandia.gov>>, "paraview at paraview.org<mailto:paraview at paraview.org>" <paraview at paraview.org<mailto:paraview at paraview.org>>
Subject: [EXTERNAL] AW: [Paraview] Gradient filter: boundary effects
Hi Kenneth,
thank you for the quick answer!
So it seems not that trivial to calculate an electrical field between a rod and a plane given the potential…
The compute derivatives filter does not give me the problem at the boundary indeed. Instead it gives a value per cell, not per node, which does not look nice.
Is there a friendly filter or switch which would give me the smoothed surface representation back?
Thanks,
Matthias
Von: Moreland, Kenneth [mailto:kmorel at sandia.gov]
Gesendet: Dienstag, 27. September 2016 14:14
An: Zenker, Dr. Matthias; paraview at paraview.org<mailto:paraview at paraview.org>
Betreff: Re: [Paraview] Gradient filter: boundary effects
Matthias,
The gradient is estimated with finite differences. Thus, it is not wholly unexpected that there could be differences at the boundaries. However, the algorithm does not assume zero for adjacent cells at the boundaries.
The way the unstructured gradient filter works is that it computes the local gradient in each cell at each of the cell’s points. Then for every point it averages the gradient from all incident cells at that point. (If you have the Faster Approximation option on, then the filter only computes one gradient per cell in the center and averages those. Faster, but more artifacts, particularly at the edges.)
If this averaging is causing you an issue, you might try the Compute Derivatives filter. This does a wholly local operation within each cell, so you should not see any artifacts (unless the field itself has artifacts at the boundaries).
-Ken
From: ParaView <paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>> on behalf of "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com<mailto:Matthias.Zenker at erbe-med.com>>
Date: Tuesday, September 27, 2016 at 5:45 AM
To: "paraview at paraview.org<mailto:paraview at paraview.org>" <paraview at paraview.org<mailto:paraview at paraview.org>>
Subject: [EXTERNAL] [Paraview] Gradient filter: boundary effects
Hi,
when I use the gradient filter (unstructured dataset), I observe edge effects which are IMO unphysical. For the nodes on the outer boundary of my domain, the gradient magnitude is smaller than I would expect. The behavior is like the filter tries to use the adjacent nodes to calculate the gradient, and since there are none outside the domain, it assumes zero and finds a lower result.
If so, I would consider this a bug – is there a fix or workaround?
Thanks,
Matthias
________________________________
Erbe Elektromedizin GmbH Firmensitz: 72072 Tuebingen Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede Registergericht: Stuttgart HRB 380137
________________________________
Erbe Elektromedizin GmbH Firmensitz: 72072 Tuebingen Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede Registergericht: Stuttgart HRB 380137
________________________________
Erbe Elektromedizin GmbH Firmensitz: 72072 Tuebingen Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede Registergericht: Stuttgart HRB 380137
________________________________
Erbe Elektromedizin GmbH Firmensitz: 72072 Tuebingen Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede Registergericht: Stuttgart HRB 380137
________________________________
Erbe Elektromedizin GmbH Firmensitz: 72072 Tuebingen Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede Registergericht: Stuttgart HRB 380137
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160927/6afcfc5c/attachment.html>
More information about the ParaView
mailing list