CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Dynamic bc (

andreas February 9, 2013 13:33

Dynamic bc
Dear foamers,

I am quite a beginner in OF and CFD, that's why I need your help :-)

My problem is as follow:
I have a multiphase flow. And I want to impose the pressure on a plane depending on the phase fraction which is in touch with the plane.

It would be like this: PressureBC = x1*p1 +x2*p2

with x1 and x2 the linear fraction (I work in 2D) of both phases on the patch. p1 and p2 would be the two pressures I want to impose.
e.g. if there is only air on the patch, the pressure would be 1atm. If there is only water, the pressure would be inferior so the fluid would get away.

Thank you all for your help,

duongquaphim February 10, 2013 04:10

In your formulation, are x1 and x2 the cell coordinate or the volume fraction? Anyway, I think groovyBC is definitely worth for a try. Look at this and you might have a solution.



andreas February 10, 2013 11:25

1 Attachment(s)
Thank you for your reply,

x1 and x2 are the volume fraction of both phases on the boundary patch.
Here is an image of the simulation for a better understanding.

The pressure on the inlet is fixed, p=1atm. Only air can come in from the inlet. And the pressure on the outlet would depend on the phase fraction on the patch.
If there is only air, p=1atm and so there no flow anymore. If it is water on the patch, p<1atm and so the flow would expel the fluid.

I think groovyBC or swak4foam are good solutions for my problem.

But I don't know how to express the surface fraction of both phases on the outlet patch.

Thanks for any advice,

andreas February 10, 2013 13:11

1 Attachment(s)
The boundary conditions would be like this:


        type            groovyBC;
        valueExpression        "x1*100000 + x2*88229";
        variables        "x1 = 1-alpha1; x2 = alpha1";
        value                uniform 88229;

-> When alpha1 = 1, there is water and I want p = 88229 [Pa]
-> When alpha1 = 0, there is only air and p = 100000 [Pa]

Can somebody tell me how can I do to do this calculation only on the outlet patch? I could deduce the alpha1 average on the patch too.

Thanks for the help,

duongquaphim February 11, 2013 07:54

Hi Andreas,

Looking at your geometry, I think the easiest way is to create a mesh with four blocks:
- top left: with outlet
- top right: with inlet
- bottom left and right: box

In that sense, you also can specify the wall at the patch between two blocks (top right and left). And with that mesh, you can easily apply that BC to the outlet only.


andreas February 11, 2013 11:01

Thank you for your quick response,

I did a patch for the outlet, inlet and walls. I can impose a value (let's say pressure or velocity), but don't know how to extract information (let's say phase fraction) for a given patch.

Alpha1 is a folder containing numbers between 0 and 1 for all the "pixels" in the mesh. I don't know how to collect information only for a part of the geometry; outlet patch in this case…

Thanks for any advice,

duongquaphim February 13, 2013 09:24

Hi Andreas,

I think if you use the BC as shown in the picture for the outlet patch, it will certainly take the value for that patch (outlet in this case). I do not think you have to do anything else.


All times are GMT -4. The time now is 18:49.