# Unstructured Grid Individual Face Areas

**URL:** https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606
**Category:** ParaView Support
**Created:** [March 3, 2021, 8:11pm UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606 "2021-03-03T20:11:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 3, 2021, 8:11pm UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/1 "2021-03-03T20:11:24Z")

</div>

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

 ![grid](https://discourse.paraview.org/uploads/default/original/2X/1/1a35a4a358e2c6748f0742abefd3cdc61feaa987.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 4, 2021, 8:33am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/2 "2021-03-04T08:33:46Z")

</div>

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

Alternatively, you could triangulate your dataset first.

---

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 4, 2021, 8:46am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/3 "2021-03-04T08:46:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 4, 2021, 8:52am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/4 "2021-03-04T08:52:12Z")

</div>

What do you mean ?

---

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 4, 2021, 9:10am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/5 "2021-03-04T09:10:59Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 4, 2021, 9:18am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/6 "2021-03-04T09:18:05Z")

</div>

Which filter are you using to perform this integration ?

---

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 4, 2021, 9:23am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/7 "2021-03-04T09:23:01Z")

</div>

Filters \> Data Analysis \> Integrate Variables

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 4, 2021, 9:34am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/8 "2021-03-04T09:34:34Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 4, 2021, 9:42am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/9 "2021-03-04T09:42:49Z")

</div>

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](https://discourse.paraview.org/t/how-to-get-force-distribution-on-body/5815) post, and wondered if the cellsize was a feature in a newer version that solves this problem.

Thank you for your help, Ian

---

<div class="post-metadata">

### Author: ![Ian\_Roberts](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ian_roberts/32/6047_2.png) [@Ian\_Roberts](https://discourse.paraview.org/u/Ian_Roberts)
#### Post date: [March 4, 2021, 10:21am UTC](https://discourse.paraview.org/t/unstructured-grid-individual-face-areas/6606/10 "2021-03-04T10:21:11Z")

</div>

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.
