Depth-averaged quantities in ParaView (interFOAM simulation)

Hi,

How can one generate maps of depth-averaged velocity in ParaView.
I am post-processing a VOF simulation (air/water) done in interFOAM.
What I am looking for is a 2D map of depth-averaged quantities such as velocity in the entire domain. Just integrating/averaging over a vertical line won’t work (I need this done in the entire domain).

Thanks

ProgrammableFilter should be able to do this.

you will have to implement the algorithm in Python though.

Thanks for your response.
Could you please provide some more info (e.g. sample code)?
That will be greatly helpful.
Thanks.

https://www.paraview.org/Wiki/Python_Programmable_Filter

First use calculator on results dataset to get vel=mag(U)
Then use ResampleToImage with default 100x100x100
The select programmableFilter, click “Copy Arrays” and paste in following code (but you may have to sort out identation - it doesn’t seem to show up properly):

# Code for 'Script'.
#Note click "Copy Arrays" option to keep alpha.water to plot surface contour later
import numpy as np
#RequestData (First calc mag(U)-> vel, then ResampleToImage 100x100x100)
input0=inputs[0]
#set up variables
dp = input0.PointData["p"]/9810
dv = input0.PointData["vel"]
da = input0.PointData["alpha.water"]

#Loop through x,y directions
for i in range(0, 100):
      for j in range(0, 100):
      #vertical averaging
                dmax=0
                vsum=0
                asum=0
                for k in range(0, 100):
                        id=(k*10000)+(j*100)+i
                        vsum=vsum+dv[id]*da[id]
                        asum=asum+da[id]
                        if dp[id]>dmax:
                              dmax=dp[id]
                #assign vertical averages throughout depth
               vAv = 0
                if dmax>0:
                       vAv = vsum/asum
                for k in range(0, 100): 
                        id=(k*10000)+(j*100)+i 
                        dp[id]=dmax
                        dv[id]=vAv

output.PointData.append(dp,"depth")
output.PointData.append(dv,"avVel")

#Now can use calculator to get Froude Number :-)