I have two sets of 300 VTK files and I want to get a graph comparing the average difference of the two sets. All files have a structured grid containing a scalar value named phi. At the end, I need a graph showing the average difference of each grid for every grid.
I have computed the difference at each cell using a Programmable Filter with the following code, from a previous question(here):
phi0 = inputs[0].PointData['phi']
phi1 = inputs[1].PointData['phi']
output.PointData.append(phi1-phi0, 'difference')
However, I do not understand how can I compute the average value of the whole grid(sum all differences and divide by the number of cells) and then plot that for every grid I have.
Any suggestions?