Programmable filter using paraview

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, 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!

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.