CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   interFoam and cyclic boundary condition issue (http://www.cfd-online.com/Forums/openfoam-solving/79300-interfoam-cyclic-boundary-condition-issue.html)

General_Gee August 19, 2010 05:07

interFoam and cyclic boundary condition issue
 
4 Attachment(s)
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

michielm December 13, 2011 10:46

1 Attachment(s)
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.

chegdan December 14, 2011 11:23

@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.

General_Gee December 14, 2011 11:45

Why didn't I see this :cool:

Good spot and major props to you for coming back to this, fixing it and updating your old posts too.

chegdan December 14, 2011 12:02

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!

joris.hey February 14, 2012 12:14

cyclic boundaries in interFoam
 
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

michielm February 18, 2012 12:41

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.

joris.hey February 19, 2012 06:05

Nice done !
I explain how I did in the other post I cited before. it seems to work well.

Cheers,
joris

chai May 9, 2012 05:50

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

chegdan May 9, 2012 11:23

Quote:

Originally Posted by chai (Post 360069)
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.

kmooney May 10, 2012 14:35

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.

chai May 14, 2012 09:29

Hello kmooney,
it will be very nice if you can share your paper and source code. My email is chaixiang2011@gmail.com .

chai

flexi182 February 13, 2013 13:37

Source Code
 
1 Attachment(s)
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 ;-)

liquidspoon March 11, 2013 11:18

Flexi: Thank you for providing the code! Compiled and ran fine for my cases.

flexi182 June 10, 2013 06:45

1 Attachment(s)
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 :)

flexi182 July 15, 2013 07:01

1 Attachment(s)
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


All times are GMT -4. The time now is 00:59.