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

How interfaceHeight works?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By simrego

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2020, 03:16
Default How interfaceHeight works?
  #1
New Member
 
Malyadeep Bhattacharya
Join Date: Nov 2020
Posts: 5
Rep Power: 6
Malyadeep is on a distinguished road
Hi!


I want to track an interface with time and came across interfaceHeight function object. I am wondering how it calculates the interface position. Does the position it calculate has anything to do with the direction of gravity?



Thanks!
Malyadeep is offline   Reply With Quote

Old   November 17, 2020, 08:48
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


You can check the code here: https://openfoam.com/documentation/g...8C_source.html
You are interested in the writePositions() function starting from line 54.


As I see it is using the gravity.


But you can do some similar stuff on your own. For example write out the alpha value along a line for each time, and with a single python script for example you can run through the times, and in every time you just have to find the position where alpha = 0.5 for example.


As i see this code does something like integrating the alpha value through this line which will be your height.
simrego is offline   Reply With Quote

Old   November 17, 2020, 09:08
Default
  #3
New Member
 
Malyadeep Bhattacharya
Join Date: Nov 2020
Posts: 5
Rep Power: 6
Malyadeep is on a distinguished road
Hi!


Thanks for your reply. I considered using the approach you suggested but haven't tried it yet. Will give it a try.



Quote:
Originally Posted by simrego View Post
As i see this code does something like integrating the alpha value through this line which will be your height.
Could you explain the concept behind this? I am confused after seeing the results if there are more than one interfaces present.


Thanks!
Malyadeep is offline   Reply With Quote

Old   November 17, 2020, 10:31
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
If there are more then one interface it won't work. But I just ran through the code and for me it seems like it is just integrating the alpha.
So imagine you have a line where you are looking for the interface. You divide it into segments. For each segment you have a p0 starting, and a p1 end point. So for every segment you calculate the segmengLenght*(a0+a1)/2, where a0 and a1 are the alpha values at the two ends of the segment. And if you add these values for all the segments, you numerically integrated the alpha through the line. And since alpha must be between 0 and 1, you can also imagine alpha as a weight, so you add up all the lengths where alpha is 1, and you won't add anything to this sum where alpha is 0. So this will gives you the length along a line where alpha is 1, which is your interface height.
At least from the code I think this is what's happening, and for me it makes sense.



But If you have for example water, air, water, and air "regions" from bottom to top, with this method the height will be the sum of the two water "regions" height, which will be incorrect(?). But for example if you have a really small bubble in your water column compared to the water column height, it will be still fairly accurate.



But if you write the alpha along a line, then you can find all of the interfaces with some simple programming. You only have to look for the heights where alpha changes from zero to one, or one to zero, and these will be your interface heights so you can find all of them.
M.W.G. likes this.
simrego is offline   Reply With Quote

Old   November 17, 2020, 11:18
Default
  #5
New Member
 
Malyadeep Bhattacharya
Join Date: Nov 2020
Posts: 5
Rep Power: 6
Malyadeep is on a distinguished road
Thank you so much for the explanation. It cleared a lot. I will consider writing alpha along a line to get the interface position.
Malyadeep is offline   Reply With Quote

Reply

Tags
interface height, openfoam, openfoam post processing


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
Homogeneous reaction works fine alone but not with diffusion and/or convection Anderson2019 Main CFD Forum 1 October 5, 2019 10:12
Viscosity UDF works when interpreted, Doesn't when compiled? bloodflow Fluent UDF and Scheme Programming 4 April 11, 2019 10:06
My UDF works well with Fluent 16 but not with Fluent 19 Ahmed A. Serageldin Fluent UDF and Scheme Programming 3 October 19, 2018 12:38
Why renumbering works for LduMatrix? chengdi OpenFOAM 4 July 31, 2017 19:54
Parallel runs with sonicDyMFoam crashes (works fine with sonicFoam) jnilsson OpenFOAM Running, Solving & CFD 0 March 9, 2012 07:45


All times are GMT -4. The time now is 02:34.