CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

interFoam and cyclic boundary condition issue

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes
  • 6 Post By chegdan
  • 1 Post By kmooney
  • 5 Post By flexi182

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 19, 2010, 06:07
Default interFoam and cyclic boundary condition issue
  #1
New Member
 
Brian
Join Date: Aug 2010
Location: Southampton
Posts: 12
Rep Power: 16
General_Gee is on a distinguished road
Hi all,

Long time reader, you guys have solved a lot of my problems in FLUENT over the past few years. I have now moved onto openFOAM due to licensing issues and hope that someone can help me out with the following...

I am essentially modelling a bubble rising under gravity, in a 2D (one cell thick) tube with periodic boundary conditions top and bottom. Everything seems to work fine until the bubble hits the top boundary - see attached files. I am assuming that I have done something wrong with the boundary condition, but have been pulling my hair out for a week now.

blockMeshDict
Code:
vertices        
(
    (0 0 0)
    (2.5 0 0)
    (2.5 5 0)
    (0 5 0)

    (0 0 0.01)
    (2.5 0 0.01)
    (2.5 5 0.01)
    (0 5 0.01)
);

blocks          
(
    hex (0 1 2 3 4 5 6 7) (40 80 1) simpleGrading (1 1 1)
    
);

edges           
(
);

patches         
(
    wall leftWall 
    (
        (0 4 7 3)
       
    )
    wall rightWall 
    (
        (1 5 6 2)
        
    )
    cyclic top_bottom 
    (
        (0 1 5 4)
        (2 3 7 6)
    )
   
        
    empty frontandback
    (
        (0 1 2 3)
	(4 5 6 7)
    )
);

mergePatchPairs
(
);
/0/alpha0 before setFields to define the initial phase locations
Code:
dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    leftWall
    {
        type            zeroGradient;
    }

    rightWall
    {
        type            zeroGradient;
    }

    top_bottom
    {
        type            cyclic;
    }


    
    defaultFaces
    {
        type            empty;
    }
}
/0/p_rgh

Code:
dimensions      [1 -1 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    leftWall
    {
        type            buoyantPressure;
        value           uniform 0;
    }

    rightWall
    {
        type            buoyantPressure;
        value           uniform 0;
    }

   top_bottom
    {
        
	type cyclic;
	
    }

    

    defaultFaces
    {
        type            empty;
    }
}
and /0/U

Code:
dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    leftWall
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
    rightWall
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
    top_bottom
    {
        type cyclic;
	value uniform (0 0 0);

    }
    defaultFaces
    {
        type            empty;
    }
}
I have tried a similar setup on the cavity tutorial in icoFoam (cyclic left and right) and that appears to work and give me a constant couette flow.

Sorry for the long post, just wanted to give as much info as poss. Any help is greatly appreciated.

Cheers

Brian
Attached Images
File Type: png pic1.png (2.8 KB, 172 views)
File Type: png pic2.png (2.8 KB, 129 views)
File Type: png pic3.png (2.8 KB, 124 views)
File Type: png pic4.png (2.9 KB, 127 views)
General_Gee is offline   Reply With Quote

Old   December 13, 2011, 10:46
Default
  #2
Member
 
Michiel
Join Date: Oct 2010
Location: Delft, Netherlands
Posts: 97
Rep Power: 16
michielm is on a distinguished road
I am aware that this post is already a year old, but just wanted to reply on it because it is very similar to a problem I am facing and I know what it is coming from but do not know whether OF has a build in boundary condition to solve it.

To explain a bit more about my own case: I model a droplet running down an inclined plate where I actually incline the direction of gravity instead of my mesh itself. At the bottom of the plate I have a cyclic condition which enters the droplet at the top.

What happens is the following: the droplet (in your case the bubble) moves partially through the periodic boundary and then suddenly has a very different pressure head on the other side of the boundary. Being still in between boundaries, the pressure at the top is higher then at the bottom (reversed in your case) and the droplet will (logically) move down the pressure gradient, which seems to be uphill (see attached image for a crude drawing)

Does anybody know whether a BC is implemented that can handle this pressure jump? I am aware of the `fan BC' but this doesn't work out because the pressure jump for the gas and liquid phases is different.
Attached Images
File Type: png dP_issue_cartoon.png (9.8 KB, 297 views)
michielm is offline   Reply With Quote

Old   December 14, 2011, 11:23
Default
  #3
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
@General_Gee and @michielm
I had this same problem a few years ago and posted about the issue in the thread http://www.cfd-online.com/Forums/ope...nnel-flow.html I saw that I didn't reply to my thread and give the solution and its been seen by a few people. The issue is not the boundary condition, but the interFoam solver itself. Nothing wrong with it, since it is doing exactly what it was programmed to do. the issue is the dynamic pressure definition that lumps together gravity and pressure into pd. if you separate gravity from pd and add it back into the momentum equation in say

Code:
    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U)
      + fvm::div(rhoPhi, U)
      - fvm::laplacian(muEff, U)
      - (fvc::grad(U) & fvc::grad(muEff))
	==
	rho*g
    );
where g is defined as a vector. I have some old code, but have something running this morning and cannot give you a compiled version that I'm 100 percent certain will work.

After adding the explicit term on the UEqn, you should be able to used your periodic domain with cyclic boundary conditions. if you want channel flow with that one too....then have a look at

http://www.cfd-online.com/Forums/ope...interfoam.html

Hope this helps and I'm sure others have a better answer, but this is what I've got this morning.
zhernadi, Tobi, frantov and 3 others like this.
chegdan is offline   Reply With Quote

Old   December 14, 2011, 11:45
Default
  #4
New Member
 
Brian
Join Date: Aug 2010
Location: Southampton
Posts: 12
Rep Power: 16
General_Gee is on a distinguished road
Why didn't I see this

Good spot and major props to you for coming back to this, fixing it and updating your old posts too.
General_Gee is offline   Reply With Quote

Old   December 14, 2011, 12:02
Default
  #5
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Thanks! I totally raced to work this morning so I could find my old posts and reply to this one (since i actually knew the answer for once). Happy that I could help!

Last edited by chegdan; December 14, 2011 at 12:20.
chegdan is offline   Reply With Quote

Old   February 14, 2012, 12:14
Default cyclic boundaries in interFoam
  #6
New Member
 
Join Date: May 2011
Posts: 15
Rep Power: 15
joris.hey is on a distinguished road
I have a similar problem that I explain here.

michielm, did you manage to solve your problem with the dropplet on a slope ?

thanks
Joris
joris.hey is offline   Reply With Quote

Old   February 18, 2012, 12:41
Default
  #7
Member
 
Michiel
Join Date: Oct 2010
Location: Delft, Netherlands
Posts: 97
Rep Power: 16
michielm is on a distinguished road
Hi Joris,
In the end I resolved the issue in a different way, although I'm pretty sure chegdan's solution will work.

What I did is somewhat specific for my case: since it is a droplet running down a slope at some fixed velocity (after an initial period anyway) I shifted my reference frame to a slope with an upward velocity. In this way the droplet remains inside my mesh without a need for periodic boundaries.
michielm is offline   Reply With Quote

Old   February 19, 2012, 06:05
Default
  #8
New Member
 
Join Date: May 2011
Posts: 15
Rep Power: 15
joris.hey is on a distinguished road
Nice done !
I explain how I did in the other post I cited before. it seems to work well.

Cheers,
joris
joris.hey is offline   Reply With Quote

Old   May 9, 2012, 06:50
Default
  #9
New Member
 
xiang chai
Join Date: Aug 2009
Posts: 13
Rep Power: 17
chai is on a distinguished road
Hello, Daniel
Thank you for your shared information.
Besides the modification in the U equation, I think the pressure also needs a bit modification. Am I right?

Chai
chai is offline   Reply With Quote

Old   May 9, 2012, 12:23
Default
  #10
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
Originally Posted by chai View Post
Hello, Daniel
Thank you for your shared information.
Besides the modification in the U equation, I think the pressure also needs a bit modification. Am I right?

Chai
@Chai

You are correct, there is a definition of modified pressure with gravity included in there and you will need to change that. i don't have OF near me right now, but if you look for the P = Prgh + rho*gh....this is what I am referring to. I know in the newer versions of interfoam it is called several times throughout the solver. good luck.

Last edited by chegdan; May 9, 2012 at 12:25. Reason: added more info
chegdan is offline   Reply With Quote

Old   May 10, 2012, 15:35
Default
  #11
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18
kmooney is on a distinguished road
One option would be to use a moving mesh paradigm. The mesh could track the centroid of the bubble and move with it, avoiding the need to use periodic BCs. If you want I could send you a paper I wrote that talks a little about my implementation, I could even send you the source code if you want, its pretty simple.
anubis likes this.
kmooney is offline   Reply With Quote

Old   May 14, 2012, 10:29
Default
  #12
New Member
 
xiang chai
Join Date: Aug 2009
Posts: 13
Rep Power: 17
chai is on a distinguished road
Hello kmooney,
it will be very nice if you can share your paper and source code. My email is chaixiang2011@gmail.com .

chai
chai is offline   Reply With Quote

Old   February 13, 2013, 13:37
Default Source Code
  #13
New Member
 
Felix
Join Date: Aug 2012
Posts: 7
Rep Power: 14
flexi182 is on a distinguished road
Hey guys.
It cost some time to test your suggestions.
Please look also to the p equation. There is also then a term which must be commented.
For all others for OpenFoam 2.1.x my source code. I hope that helps you to save time and you could concentrate on other scientific things ;-)
Attached Files
File Type: zip interFoamBuoyancySeperated.zip (8.4 KB, 179 views)
flexi182 is offline   Reply With Quote

Old   March 11, 2013, 11:18
Default
  #14
Member
 
Alex
Join Date: Jun 2011
Posts: 33
Rep Power: 15
liquidspoon is on a distinguished road
Flexi: Thank you for providing the code! Compiled and ran fine for my cases.
liquidspoon is offline   Reply With Quote

Old   June 10, 2013, 07:45
Default
  #15
New Member
 
Felix
Join Date: Aug 2012
Posts: 7
Rep Power: 14
flexi182 is on a distinguished road
Here the interFoamBuoyancySeparated Solver with the correct name p instead of p_rgh

-> interFoamBuoyancySeparatedP

The correct name for the pressure in the source code should help that users won't become confused
Attached Files
File Type: zip interFoamBuoyancySeparatedP.zip (8.3 KB, 145 views)
flexi182 is offline   Reply With Quote

Old   July 15, 2013, 08:01
Default
  #16
New Member
 
Felix
Join Date: Aug 2012
Posts: 7
Rep Power: 14
flexi182 is on a distinguished road
The interFoamBuoyancySeparatedP Solver is used for an further improvement.
The user can add an impressed body force.
Therefore a vector must be inserted into the file userGradP (constant-dir).

The appropriate solver for this is

interFoamBuoyancySeparatedPUserGrad
Attached Files
File Type: zip interFoamBuoyancySeparatedPUserGrad.zip (9.5 KB, 155 views)
flexi182 is offline   Reply With Quote

Old   June 21, 2018, 07:37
Default Continuous acceleration with cyclic boundary
  #17
New Member
 
Assen Batchvarov
Join Date: May 2018
Posts: 1
Rep Power: 0
gutzaki is on a distinguished road
Hi All,

Thank you very much for posting a solution to having gravity with cyclic boundaries. Now that I have managed to compile the solver I have generated a falling film case which seems to accelerate well past the analytical values that I would expect. Any ideas why the flow does not want to slow down?
gutzaki is offline   Reply With Quote

Old   October 8, 2018, 10:33
Default
  #18
New Member
 
Kahlil Fredrick Cui
Join Date: Apr 2018
Posts: 29
Rep Power: 8
cuikahlil is on a distinguished road
Hi Assen!

I'm having the same problem. I think the velocities rapidly increase since the trailing end does not start slowly as it should be because of the entrant velocity which exits from the front. This just keeps going on until velocities become unreasonably high. I have no idea how to solve this though. Have you found a way around this?
cuikahlil is offline   Reply With Quote

Reply

Tags
boundary, bubble, cyclic, interfoam, periodic


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
Cyclic boundaries importing Gambit msh file and interFoam chegdan OpenFOAM Running, Solving & CFD 16 February 14, 2023 04:56
About interFoam solver zou_mo OpenFOAM Running, Solving & CFD 129 December 2, 2019 06:39
interFoam & cyclic condition Ingenierias2003 OpenFOAM 2 June 7, 2010 12:16


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