Unstructured Grid Individual Face Areas

I am trying to extract the individual area of each face on an unstructured surface grid from OpenFOAM. I have tried using both the PythonCalculator (area(input[0])) and Quality features but this seems to be limited to just quad and tri elements. All the elements with 5 or more sides are just given an area of -1 (see figure). Is there away to calculate the area of the irregular polygons within paraview?

Thanks in advance,
Ian

I’m afraid area is only implemented for quad and tri. This could be implemented though.
https://vtk.org/doc/nightly/html/classvtkMeshQuality.html

Alternatively, you could triangulate your dataset first.

Thank you for your reply Mathieu.

I was curious how the integrate variables command works when you can’t extract the areas to integrate over.

What do you mean ?

As an example, if you have a body and want to integrate the pressure over the whole surface and multiply by normals to get lift and drag (not what I am doing in this case but an example). I assumed it was calculating:

Lift = sum of (face pressure * face area * Normal.z)
Drag = sum of (face pressure * face area * Normal.x)

If ParaView doesn’t currently extract the face area, does it use some other algorithm to do the integration?

Which filter are you using to perform this integration ?

Filters > Data Analysis > Integrate Variables

Looks like vtkIntegrateAttributes and vtkMeshQuality both contains area computation code.
vtkIntegrateAttributes implementation seems more complete:
https://gitlab.kitware.com/vtk/vtk/-/blob/master/Filters/Parallel/vtkIntegrateAttributes.cxx

IMO, this should be fixed the this method of cell computation should be added to vtkCell.

Mathieu,
Looking at the IntegratePolygon it looks like it is just breaking each polygon down in to triangles to calculate the areas. I have used this functionality in the past to get an idea whether my lift and drag calculations were close and was concerned that it was missing out all the polygons.

I am using v5.2.0 currently and I saw this post, and wondered if the cellsize was a feature in a newer version that solves this problem.

Thank you for your help, Ian

I have used 5.2.9 now and the cellSize variable works well.

The function should probably be included in the area(inputs[0]) function in the python calculator too.

1 Like