# How to calculate depth averages in ParaView

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 3, 2019, 11:40 How to calculate depth averages in ParaView #1 Senior Member   Join Date: Jul 2013 Posts: 117 Rep Power: 10 Hi All, Suppose I have output velocity/pressure from an OpenFOAM simulation. Is it possible to use ParaView to calculate the depth-averaged velocities? I do not have any experience with the custom filters. For example, suppose I modify the cavity tutorial to be 3D, and then I want to look at the depth-averaged velocity profile. How can I do that with ParaView? Thanks so much Edit: I'm sorry, I just saw that there is a separate ParaView forum, but I am unable to delete or move this thread.

 October 29, 2020, 17:14 #2 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 4 I am wondering if you found the way. Thanks.

 October 29, 2020, 20:31 #3 Senior Member   Join Date: Jul 2013 Posts: 117 Rep Power: 10 I never found a way to do this. I'm guessing with a simple regular grid you could just program it in the python filter.

 October 29, 2020, 21:02 #4 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 4 Thanks for the reply. I have been looking into this for a while and could not get any useful answer. In my case, I have 2D domain (x-y plane) and I want to average the phase fraction at every y and repeat the process at each time step. The mesh I am using is rectangular, but it is non-uniform. I normally do my postprocessing with MATLAB; however, I find it difficult to do the area weighted average on the interpolated data which I extract from OpenFOAM (i.e. no information on the area of each cell).

 October 30, 2020, 08:36 #5 Senior Member   Join Date: Jul 2013 Posts: 117 Rep Power: 10 One thing you could possibly try is to use a slice filter at each x value, and use the integrate variables filter to find the average for that x. Then you can write a macro that changes the x values of the slice filter and records the corresponding average.

October 30, 2020, 08:47
#6
Senior Member

Join Date: Jul 2019
Posts: 148
Rep Power: 4
Quote:
 Originally Posted by wildfire230 One thing you could possibly try is to use a slice filter at each x value, and use the integrate variables filter to find the average for that x. Then you can write a macro that changes the x values of the slice filter and records the corresponding average.
Thank you for the suggestion. Right, I did it for one slice. Unfortunately, I do not know how to write programmable macros (i.e. I am not a python user). I should look into that. I would appreciate any references if you are aware of any useful ones.

 October 30, 2020, 09:18 #8 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 4 Thank you for your time. Much appreciated.

 Tags depth-averages, paraview