CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Info on Volume of Fluid Algorithum

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

Like Tree1Likes
  • 1 Post By hilllike

Reply
 
LinkBack Thread Tools Display Modes
Old   July 20, 2012, 07:53
Default Info on Volume of Fluid Algorithum
  #1
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Hello,

I am trying to write a code on VOF Model in C++ using Finite Volume Method. Previously i used FVM and success fully write a code for Lid Driven Cavity and Natural Convection now i want to write it for 2D Dam Breaking like openFoam. Now i am trying it for some time but i am not getting the logic behind VOF.

Please give you suggestions, recommend books, or paper, and most importantly governing equations and algorithm.

My brain is not moving in any direction on that problem.

Please Help.

Junaid
JunaidAhmad is offline   Reply With Quote

Old   July 24, 2012, 02:26
Default
  #2
Member
 
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 7
hilllike is on a distinguished road
Dear Junaid,
I wrote a VOf code based on CICSAM (Ubbink, you could find his doctoral thesis online). This is an easy method based on original D-A VOF method, similar with FAC-VOF.

There are some other VOF methods like PLIC-VOF, which are different in surface Reconstruction. Maybe you can find something you need in a review (Volume-of-fluid interface tracking with smoothed surface stress methods for three-dimensional flows) written by Denis Gueyffier.

Ren
hilllike is offline   Reply With Quote

Old   July 25, 2012, 14:12
Default
  #3
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Hi, Thanks for your reply.

I have lots of questions for you.
First is,
as mentioned in the thesis that First solve "alpha" equation. and then momentum equation. As i have mentioned in my post that i have code the lid driven cavity. in that i did not use densities. kindly tell me how to handle density in momentum equation.
Problem i am working on is vertical column of water, so the source term is gravity, give me some tips to solve momentum eq and tips for the boundary conditions of volume fraction (alpha) equation.

Regards,
Junaid
JunaidAhmad is offline   Reply With Quote

Old   July 25, 2012, 16:03
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by JunaidAhmad View Post

As i have mentioned in my post that i have code the lid driven cavity. in that i did not use densities. kindly tell me how to handle density in momentum equation.
first of all you should change your solver in a variable density , and variable viscosity navier-stokes solver
Then you have to solve alpha equation, which is I guess the volume fraction.
One you got the distribution of alpha, ro=alpha*ro1 + (1-alpha)* ro2
where ro1 is the density of the first fluid, ro2 is the density of the second fluid
Do the same with the viscosity
Then solve your navier-stokes equation with new ro and new viscosity.
once you got your velocity distribution you can advect alpha for the next time step, and so on...

Quote:
Problem i am working on is vertical column of water, so the source term is gravity, give me some tips to solve momentum eq and tips for the boundary conditions of volume fraction (alpha) equation.
Junaid
generally Neumann boundary condition for alpha should be ok.
leflix is offline   Reply With Quote

Old   July 26, 2012, 01:51
Default
  #5
Member
 
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 7
hilllike is on a distinguished road
Quote:
Originally Posted by JunaidAhmad View Post
Hi, Thanks for your reply.

I have lots of questions for you.
First is,
as mentioned in the thesis that First solve "alpha" equation. and then momentum equation. As i have mentioned in my post that i have code the lid driven cavity. in that i did not use densities. kindly tell me how to handle density in momentum equation.
Problem i am working on is vertical column of water, so the source term is gravity, give me some tips to solve momentum eq and tips for the boundary conditions of volume fraction (alpha) equation.

Regards,
Junaid
Leflix gives a good answer of your questions.

In my code I use a smoothed matrix to smooth the VOF function to make sure the density calculated from VOF function as smoothed as possible according to a master thesis.That is a good thesis can give you a quick understand of numerical method for two phase flow named'' A navier stokes solver for single and two phase flow'' by Kim Motoyoshi Kalland and you could find a source code used by the author in that thesis.


hope that can help you.

Ren
ebrahim27 likes this.
hilllike is offline   Reply With Quote

Old   July 26, 2012, 09:05
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Thanx Ren for this interesting reference ! It will definitely help
leflix is offline   Reply With Quote

Old   July 29, 2012, 04:44
Default
  #7
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Thanks guys,

how can we handle the boundary condition regarding Atmospheric pressure in a simple vertical column of water or dam break problem.

Domain is surrounded with three walls and an open surface.

at the wall can we use dp/dx or dp/dy equal to zero. by using p[0,j]=p[1,j] where j=0 to ny for zero wall gradiant. and similarly u and v both equal to zero at walls.

now the question is what would be the condition at the open surface for both pressure and velocity.

and most importantly what would be the boundary condition for the volumn fraction (alpha ) on walls and the open surface.

Kindly correct me if i am wrong. because when i run the simulation the volumn fraction or the phase contours shows that water phase disappears or sometimes it blows up when it disappears it moves downwards not sidewise.
please comment.
JunaidAhmad is offline   Reply With Quote

Old   July 29, 2012, 05:09
Default
  #8
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by JunaidAhmad View Post

how can we handle the boundary condition regarding Atmospheric pressure in a simple vertical column of water or dam break problem.

Domain is surrounded with three walls and an open surface.

at the wall can we use dp/dx or dp/dy equal to zero. by using p[0,j]=p[1,j] where j=0 to ny for zero wall gradiant. and similarly u and v both equal to zero at walls.

now the question is what would be the condition at the open surface for both pressure and velocity.
it depends on you velocity-pressure algorithm. If you use SIMPLE like algorithm or projection method neumann boundary condition for the pressure is a good choice. Your implementaion saying p[0,j]=p[1,j] is right.
For velocity BC instead of no slip use rather free slip.


Quote:
and most importantly what would be the boundary condition for the volumn fraction (alpha ) on walls and the open surface.
check my previous answer I already answered to you on that issue


Quote:
Kindly correct me if i am wrong. because when i run the simulation the volumn fraction or the phase contours shows that water phase disappears or sometimes it blows up when it disappears it moves downwards not sidewise.
please comment.
To identify from where the problem could arise:
First verify your Navier-Stokes solver in a pure monophase case, but with a given distribution of density and viscosity.
Then check your solver for the transport equation of the mass fraction alone with a constant velocity field.
Then couple the both
leflix is offline   Reply With Quote

Old   July 29, 2012, 06:06
Default
  #9
Member
 
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 7
hilllike is on a distinguished road
Quote:
Originally Posted by JunaidAhmad View Post
Thanks guys,
Kindly correct me if i am wrong. because when i run the simulation the volumn fraction or the phase contours shows that water phase disappears or sometimes it blows up when it disappears it moves downwards not sidewise.
please comment.
Leflix is really kind.

I don't know what kind of VOF you used.
When the water phase disappeared, you should check your volume convection equation.
for example in one dimensional problem, inside the water phase (not the surface) Ap*Fp(n+1)=b0*Fp(n)+Ae*Fe+Aw*Fw, if Ap>b0+Ae+Aw then the water phase will disappear quickly.
hilllike is offline   Reply With Quote

Old   August 3, 2012, 04:21
Default
  #10
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Hi Guys,

As leflix suggested to use it for mono phase . So i use it on lid driven cavity.
Now the eq i used is
dF/dt+d(uF)/dx+d(vF)/dy=0

discritize Form

fn[col][row]=f[col][row]-(ue*(f[col+1][row]+f[col][row])-uw*(f[col-1][row]+f[col][row])+vnn*(f[col][row-1]+f[col][row])-vs*(f[col][row]+f[col][row+1]))/apo

where
apo=(dx*dy)/dt

i am using uniform grid 5 x 5

i started with initializing the fn field by
0 1 2 3 4 5
-------------
0| 0 0 0 0 0 0
1| 0|0 0 0 0| 0
2| 0|1 1 0 0| 0
3| 0|1 1 0 0| 0
4| 0|1 1 0 0| 0
5| 0 0 0 0 0 0

the outer nodes are the ghost nodes.

the above discretize form is solved using explict formulation only for the internal nodes.

Now the problem is that the total volume with in the cavity reduces and become negtive. for the above grid the total volume is 6. as i iteration increase the total volume decrease.

So any suggestion to solve this problem.
(The problem is that the mass with in the system is not conserved. is it due to some boundary condition or anything else. the code i am using for lid driven cavity is working fine and the velocity profiles are compared with ghia et al. for this problem i am using 81 x 81 grid).
JunaidAhmad is offline   Reply With Quote

Old   August 3, 2012, 04:28
Default
  #11
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Hi Guys,

As leflix suggested to use it for mono phase . So i use it on lid driven cavity.
Now the eq i used is
dF/dt+d(uF)/dx+d(vF)/dy=0

discritize Form

fn[col][row]=f[col][row]-(ue*(f[col+1][row]+f[col][row])/2-uw*(f[col-1][row]+f[col][row])/2+vnn*(f[col][row-1]+f[col][row])/2-vs*(f[col][row]+f[col][row+1])/2)/apo

ue =u velocity at east face
uw =u velocity at west face
vnn =v velocity at north face
vs =v velocity at south face

where
apo=(dx*dy)/dt

i am using uniform grid

i started with initializing the "f" (volume fraction) field by let say we have grid 5 x 5
0 1 2 3 4 5
-------------
0| 0 0 0 0 0 0
1| 0|0 0 0 0| 0
2| 0|1 1 0 0| 0
3| 0|1 1 0 0| 0
4| 0|1 1 0 0| 0
5| 0 0 0 0 0 0

the outer nodes are the ghost nodes.

the above discretize form is solved using explict formulation only for the internal nodes i.e. from 1 to 4 in this case and calculate new f field and copy new field in the old field by copying the values.

Now the problem is that the total volume with in the cavity reduces and become negtive. for the above grid the total volume is 6. as iteration increases the total volume decreases.

So any suggestion to solve this problem.
(The problem is that the mass with in the system is not conserved. is it due to some boundary condition or anything else. the code i am using for lid driven cavity is working fine and the velocity profiles are compared with ghia et al. for this problem i am using 81 x 81 grid).

Last edited by JunaidAhmad; August 3, 2012 at 04:49.
JunaidAhmad is offline   Reply With Quote

Old   August 8, 2012, 03:50
Default
  #12
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
Will some body give some input.
JunaidAhmad is offline   Reply With Quote

Old   August 9, 2012, 08:46
Default
  #13
Member
 
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 7
hilllike is on a distinguished road
Quote:
Originally Posted by JunaidAhmad View Post
Hi Guys,

As leflix suggested to use it for mono phase . So i use it on lid driven cavity.
Now the eq i used is
dF/dt+d(uF)/dx+d(vF)/dy=0

discritize Form

fn[col][row]=f[col][row]-(ue*(f[col+1][row]+f[col][row])/2-uw*(f[col-1][row]+f[col][row])/2+vnn*(f[col][row-1]+f[col][row])/2-vs*(f[col][row]+f[col][row+1])/2)/apo

ue =u velocity at east face
uw =u velocity at west face
vnn =v velocity at north face
vs =v velocity at south face

where
apo=(dx*dy)/dt


i am using uniform grid

i started with initializing the "f" (volume fraction) field by let say we have grid 5 x 5
0 1 2 3 4 5
-------------
0| 0 0 0 0 0 0
1| 0|0 0 0 0| 0
2| 0|1 1 0 0| 0
3| 0|1 1 0 0| 0
4| 0|1 1 0 0| 0
5| 0 0 0 0 0 0

the outer nodes are the ghost nodes.

the above discretize form is solved using explict formulation only for the internal nodes i.e. from 1 to 4 in this case and calculate new f field and copy new field in the old field by copying the values.

Now the problem is that the total volume with in the cavity reduces and become negtive. for the above grid the total volume is 6. as iteration increases the total volume decreases.

So any suggestion to solve this problem.
(The problem is that the mass with in the system is not conserved. is it due to some boundary condition or anything else. the code i am using for lid driven cavity is working fine and the velocity profiles are compared with ghia et al. for this problem i am using 81 x 81 grid).
I think you should read some papers about vof.
You can't discretize the volume convection in this form. VOF method is not easy like that.
hilllike is offline   Reply With Quote

Old   August 9, 2012, 14:51
Default
  #14
Member
 
JunaidAhmad's Avatar
 
Junaid Ahmad Khan
Join Date: Mar 2010
Location: Islamabad
Posts: 33
Rep Power: 7
JunaidAhmad is on a distinguished road
any recommendation for papers?
JunaidAhmad is offline   Reply With Quote

Reply

Tags
multiphase flow, vof model

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[DesignModeler] Creating Fluid Volume willis ANSYS Meshing & Geometry 4 February 24, 2012 01:15
mass flow in is not equal to mass flow out saii CFX 2 September 18, 2009 08:07
There is no fluid volume in the project Giron FloEFD, FloWorks & FloTHERM 4 June 12, 2009 17:05
Volume of Fluid help please! Gareth Uglow FLUENT 8 February 13, 2008 13:15
fluid hot volume in fluid cold volume zahid FLUENT 4 June 1, 2002 09:11


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