# Programmable filter using paraview

**URL:** https://discourse.paraview.org/t/programmable-filter-using-paraview/1054
**Category:** ParaView Support
**Tags:** python
**Created:** [December 17, 2018, 1:33pm UTC](https://discourse.paraview.org/t/programmable-filter-using-paraview/1054 "2018-12-17T13:33:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fedecaccia](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fedecaccia/32/949_2.png) [@fedecaccia](https://discourse.paraview.org/u/fedecaccia)
#### Post date: [December 17, 2018, 1:33pm UTC](https://discourse.paraview.org/t/programmable-filter-using-paraview/1054/1 "2018-12-17T13:33:41Z")

</div>

I have a surface with field values (.vtk), which is an output of an openfoam postprocessing (I have made it using a cutting plane on my geometry). I need to calculate the average field value on the surface and I don’t know how to do it.

I was trying to do it using the programmable filter in paraview, but I couldn’t. I have found some examples on how to use the tool here [https://www.paraview.org/Wiki/Python\_Programmable\_Filter](https://www.paraview.org/Wiki/Python_Programmable_Filter), but I still don’t know how to get the cell areas, and how to average the integral. Can somebody provide me a useful script to compute an average field? Thanks!

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 17, 2018, 6:08pm UTC](https://discourse.paraview.org/t/programmable-filter-using-paraview/1054/2 "2018-12-17T18:08:18Z")

</div>

You may want to look at either the _Integrate Variables_ filter or the _Cell Size_ filter along with the _Calculator_ filter. You can use the _Calculator_ filter with a value of 1 to find the global area of your surface for your _Integrate Variables_ filter or the _Cell Size_ filter to calculate the area of each cell individually and then continue on from there with your calculations. As a side note, I think the _Cell Size_ filter was introduced in ParaView 5.5.
