CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Dynamic bc (http://www.cfd-online.com/Forums/openfoam-pre-processing/113001-dynamic-bc.html)

 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,
Regards,
Andreas

 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 http://openfoamwiki.net/index.php/Contrib_groovyBC and you might have a solution.

Regards,

Duong

 andreas February 10, 2013 11:25

1 Attachment(s)

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.

Regards,
Andreas

 andreas February 10, 2013 13:11

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

Code:

```        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,
Regards,
Andreas

 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.

Duong

 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…