CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Depth-averaged quantities in ParaView (interFOAM simulation)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By KateBradbrook

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2019, 15:19
Default Depth-averaged quantities in ParaView (interFOAM simulation)
  #1
New Member
 
Ali Habibzadeh
Join Date: Apr 2009
Location: Vancouver, Canada
Posts: 15
Rep Power: 17
arhabib is on a distinguished road
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
arhabib is offline   Reply With Quote

Old   May 2, 2023, 12:32
Default
  #2
New Member
 
Kate Bradbrook
Join Date: Nov 2015
Posts: 12
Rep Power: 11
KateBradbrook is on a distinguished road
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 (also in attachment):


# 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 also use calculator to get Froude Number :-)
Attached Files
File Type: txt paraView_DepthAveraging.txt (920 Bytes, 11 views)
Wenhao Dong likes this.

Last edited by KateBradbrook; May 4, 2023 at 10:11. Reason: indents for code didn't copy properly so file added too
KateBradbrook is offline   Reply With Quote

Reply

Tags
depth-averages, paraview, velocity map, vof


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
interFoam simulation blowing up mgdenno OpenFOAM 55 November 2, 2018 21:20
depth averaged velocity from a CFX free surface flow bolus13 EnSight 8 November 21, 2016 11:22
paraview installation woes vex OpenFOAM Installation 15 January 30, 2011 08:11
Interfoam... free surface simulation urgent lostin4ever Main CFD Forum 4 October 12, 2010 09:29
Averaged quantities otrebla CFX 0 April 11, 2008 11:03


All times are GMT -4. The time now is 11:58.