CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

depth average quantities in 3D free-surface flow (e.g. interFoam)

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By alexj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2021, 12:33
Default depth average quantities in 3D free-surface flow (e.g. interFoam)
  #1
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 33
Rep Power: 11
alexj is on a distinguished road
Dear FOAMers and post-processing experts,


I simulate 3D free-surface flows with interFoam on top of complex bottom geometries (e.g. river flows or such). In the attempt to compare to depth-averaged models I look for a method to calculate depth averaged fields (mainly velocity) and integrated fields (e.g. height of the interface) out of the 3D fields interFoam is producing.


To me this is a post-processing step as I imagine the calculation of such fields would significantly slow down a solver which does this on the fly. However if one can calculate such depth averaged/integrated quantities within the solver I would be very interested in learning how to do so. Thus at the moment I post this question on the post-processing sub-forum.



A method for the creation of depth averaged/integrated fields has been asked for on the forum several times, however I did not find a satisfying solution yet. I know swak4foam can create such fields in 2D but I am not aware of this feature for 3D fields.


The create of depth averaged/integrated fields has to me two levels of complexity:
  1. average/integrate for each bottom grid cell along a line oriented parallel to a coordinate axis (e.g. vertical along z) and store the averaged/integrated value in the bottom cell to create a 2D field.
  2. add complexity by first calculating the surface normal at the bottom grid cell bottom facet and integrate along a line oriented parallel to that face normal. Then store the averaged/integrated value in the bottom cell to create a 2D field.
Currently I know how to do version 1) and 2) in a very slow (!) post-processing step with the help of pyvista and converting interFoam fields to VTK. pyvista can then iterate for each bottom cell and do the line sampling. This is however prohibitively slow as one bottom cell processing takes about a second (2.2 GHz Xeon), leading to massive post-processing times.


I am wondering if anybody has a faster/more efficient way of doing such processing. Any help is highly appreciated.


best regards,
Alex
alexj is offline   Reply With Quote

Old   June 23, 2021, 03:54
Default update
  #2
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 33
Rep Power: 11
alexj is on a distinguished road
Hi all,


in case anyone faces the same post-processing challenge, here is a fast solution you can implement in pyvista.
  1. Re-project the irregular (possibly) refined grid to a regular-spaced 3D grid of sufficiently high grid size.
  2. convert that pyvista point data array to a regular 3D numpy array.
  3. Do your statistics on the numpy array with Python.
You can also align the coordinate system axes differently when you create the regular grid in step 1, so you can possibly rotate the z-axis (in my case) with respect to the original OpenFOAM dataset.


Might be helpful for others and happy post-processing.


Alex
David* and Wenhao Dong like this.
alexj is offline   Reply With Quote

Reply


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
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
Scaling up a wave energy converter - free surface flow mark_l CFX 3 February 17, 2010 17:57
Problem with capturing water-spreading for free surface flow devesh.baghel OpenFOAM 2 December 10, 2009 02:21
Multiphase flow. Dispersed and free surface model Luis CFX 8 May 29, 2007 19:13
incompressible free surface flow past cylinder vineet FLUENT 2 April 1, 2002 06:56


All times are GMT -4. The time now is 17:23.