# Calculate volume of tetrahedral mesh regions

**URL:** https://discourse.paraview.org/t/calculate-volume-of-tetrahedral-mesh-regions/2609
**Category:** ParaView Support
**Created:** [September 24, 2019, 1:34am UTC](https://discourse.paraview.org/t/calculate-volume-of-tetrahedral-mesh-regions/2609 "2019-09-24T01:34:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [September 25, 2019, 9:27pm UTC](https://discourse.paraview.org/t/calculate-volume-of-tetrahedral-mesh-regions/2609/2 "2019-09-25T21:27:19Z")

</div>

You can do this with the **Programmable Filter** and a fairly short script. Assume the name of your scalars that label the regions is called ‘RegionId’, then your script would look like:

```python
# Find unique region IDs
regionArray = inputs[0].CellData['RegionId']
regions = unique(regionArray)

v = volume(inputs[0])
for regionValue in regions:
  regionVolume = sum(v[regionArray == regionValue])
  print(regionValue, regionVolume)

```

This will print the volume of each region value and region.

---

_[View the full topic](https://discourse.paraview.org/t/calculate-volume-of-tetrahedral-mesh-regions/2609)._
