CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Permeability filling of container outlet condition (

unoder November 30, 2005 06:02

Hi, I have 2 phases with in

I have 2 phases with interFoam. I suppose they're both incompressible so I need an outlet in order to fill the container entirely with water. The shape is U-formed, so the problem is that the container will not be filled completely since now both phases are led out from outlet-section, *before* the container is entirely filled with water.

I want only to allow air to be led out, trapping the water inside the container. It's like applying permeability to the surrounding walls and I want to compare flow result with another program in which the permeability around the container is 250 cm^3/min. Perhaps it's not possible to apply a condition like this to Foam but any suggestions that will give comparable results are most welcome.

How do I do this? My outlet boundary condition so far is:

type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);

type inletOutlet;
inletValue uniform 0;
value uniform 0;

type fixedValue;
value uniform 0;

unoder November 30, 2005 15:27

Well, question asked in anothe
Well, question asked in another way: What would you do to simulate filling of a container completely? Don't tell me it can't be done in Foam...

sergei December 1, 2005 06:56

Well, a primitive suggestion.
Well, a primitive suggestion. Make some few short outlets in walls of a container. Walls of those outlets should be hydrophobic (consult Henry, whether you can set the contact angle to 180).
Dimensions of the outlet you may want to compute from capillary pressure.

unoder December 1, 2005 11:37

Thanks Sergei, Henry, what
Thanks Sergei,

Henry, what are your comments on this problem?

look April 12, 2006 22:40

Hi, I am also curious about t
I am also curious about this question. Does anyone have any idea?
Thank you.

billy August 14, 2006 13:15

I am interested in this issue.
I am interested in this issue. Any developments?

francesco_b January 18, 2008 10:18

Hi all, I would like to si
Hi all,

I would like to simulate the filling of a container, but don't know which boundary conditions to choose.

I've put inflow on the left side of my box, wall on the upper, lower and right side, empty on the front and back side (since i want to simulate a 2D domain).

I initialize the first cell on the left side to gamma = 1 and the other to gamma = 0.

My simulation fail to start, probably for the BC, How can I solve this issue? Does anyone have any suggestions?

Thanks in advance


lillberg January 18, 2008 10:53

Hi Francesco, if you want t
Hi Francesco,

if you want to fill something with something which allready contains something, you need to let that something out or compress it really much.



francesco_b January 18, 2008 12:45

Hi Eric, I've put an outlet
Hi Eric,

I've put an outlet at the right side of my box and now I succeed in filling it
Now the problem is that the outlet surface doesn't behave as a wall for the fluid I have let in (gamma = 1). I'd like this surface to behave as a filter letting pass only the fluid with gamma = 0. How could I reach this aim?

Thank you in advance


lillberg January 18, 2008 15:15

Hmm... That would mean a BC

That would mean a BC which has zeroGradient for the volocity for gamma=0 and wall for gamma > 0. Could be implemented but doesn't exist to my knowledge.

Try drilling a hole in the upper wall to let the air out. Or change the upper wall BC to atmospheric.

Good luck


francesco_b January 21, 2008 10:15

Hi Eric, I cannot drill a h
Hi Eric,

I cannot drill a hole or put atmospheric BC since it is an injection molding process; this kind of BC would change the behaviour of the fluid. Any hint about how to implement my condition? Or about how to solve my problem?

Thanks in advance


gschaider January 21, 2008 13:36

Hi Francesco! I think the s
Hi Francesco!

I think the solution to your problem would be to implement a boundary condition that is based on the mixed-condition and changes the valueFraction according to gamma. There are conditions in the sources that do similar things (have a look at inletOutlet) and use them as a template


francesco_b January 22, 2008 04:45

Hi Bernhard, I could implem
Hi Bernhard,

I could implement this boundary condition as you suggest but I think this would not solve my problem since the flow is modified by the presence of the outflow and the result is not as I wish.

I've discuss about this problem also in the thread: "Injection of a fluid into a cavity"

You can see there my opinion about the whole problem. I appreciate any comments

Thanks in advance


gschaider January 22, 2008 06:23

Hi Francesco! The question
Hi Francesco!

The question is: where does the air get out in "real life"? Through the inlet (as some backflow in the gamma=0 part you were describing above)? And what kind of condition are you using for the velocity there (propably fixedValue)?

Maybe a "gamma"-switched boundary conditon for the velocity (fixedValue for the parts with gamma=1, zeroGradient for the rest) would be the solution


PS: the "simple"=="no programming needs to be done" solution would be to split the inlet condition in two parts - a "lower" one with gamma=1, velocity fixedValue and a "upper" with gamma=0, velocity zeroGradient. But maybe I misunderstand your problem completely - could you provide us with a sketch?

francesco_b January 22, 2008 10:27

Hi Bernhard, I'd like to us
Hi Bernhard,

I'd like to use OF to simulate the injection of a fluid into a cavity which is empty, this is what molding softwares actually do. The presence of air makes the simulation more expensive and complicated. I've chosen the interFoam solver for the interface tracking, but I've had outlet problems, this seems to be the wrong way.
Probably it could better to use a single fluid solver, but I don't know which solver could perform this tasks:

1) Computation of the interface of fluid
2) Computation of the flow behind the interface

some important issues are:
A) Domain change every time-step
B) Flow is compressible and termodynamical effects are to be considered

I think the most difficult problem is A. Any hints about which solver could be the starting point?

Thanks in advance


francesco_b January 31, 2008 10:09

Hi Bernhard, as I said in
Hi Bernhard,

as I said in a different thread. after many tries I think that interFoam could be a good start point, the problem of the outlet could be fixed with your suggestion. I'm trying now to realize this kind of "gamma-switched" BC.

Thank you for your help, I'll tell you if it works


francesco_b February 6, 2008 05:00

Hi all, I've tried to creat
Hi all,

I've tried to create the new boundary condition, but I've got some issues. I tell what I've done, so maybe someone could tell me which is my error.

I've copied the folder "outletInlet" which is in $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived to $FOAM_SRC/, renamed it "filterFvPatchField" and I've replaced the word "outletInlet" with "filter" inside the files. Than I've typed

cp -r $WM_PROJECT_DIR/src/filter $WM_PROJECT_USER_DIR/applications
cd $WM_PROJECT_USER_DIR/applications/filter

In the Make folder I've changed files and options to:



LIB = $(FOAM_USER_LIBBIN)/libfilterFvPatchField


-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

-ltriSurface \
-lmeshTools \
-lfiniteVolume \

When I use the command

wmake libso

It gives me errors. I think that there's something wrong in the "files" and/or "options" but I cannot find what. Is it what I'm doing correct?

Thanks in advance


francesco_b February 6, 2008 05:28

Ok, I think I've found the err
Ok, I think I've found the errors:

- in Make/files it should be filterFvPatchFields.C with the final "s".

- in Make/options I've add -L$(FOAM_USER_LIBBIN) to -lfilterFvPatchField

I've typed wmake libso and now it gave me the "up to date" message

francesco_b February 7, 2008 12:19

Hi all, now I'm having tro
Hi all,

now I'm having trouble with the boundary condition. I've copied outletInlet and I've tried to write valueFraction as a function of gamma, but when I compile I get some issues about gamma.

The file filterFvPatchField.C has

const fvPatch& p,
const DimensionedField<type,>& iF,
const volScalarField& gamma
mixedFvPatchField<type>(p, iF),
this->refValue() = *this;
this->refGrad() = pTraits<type>::zero;
this->valueFraction() = 0.0;

and the updateCoeffs is

void filterFvPatchField<type>::updateCoeffs()
if (this->updated())

this->valueFraction() = 1.0 - gamma_();



I know that there are some errors, but I'm new to C++ and it is hard to understand this kind of code for me.

Can someone explain me which are the errors and how to fix them?

Thanks in advance


francesco_b February 8, 2008 12:36

I think I've fixed some issues
I think I've fixed some issues but still now I got some errors

on line 131 I have:

const volScalarField& gammap = gamma().mesh().lookupObject<volscalarfield>

and on line 138:

this->valueFraction() = 1.0 - gammap();

I got this errors:

In file included from filterFvPatchField.H:142,
from filterFvPatchFields.H:30,
from filterFvPatchFields.C:29:
/usr/include/bits/mathcalls.h: In member function 'virtual void Foam::filterFvPatchField<type>::updateCoeffs()':
/usr/include/bits/mathcalls.h:265: error: too few arguments to function 'double gamma(double)'
filterFvPatchField.C:131: error: at this point in file
filterFvPatchField.C:131: error: expected primary-expression before '>' token
filterFvPatchField.C:138: error: no match for call to '(const Foam::GeometricField<double,>) ()'

Can someone explain me how to fix them? Pls

Thanks in advance


All times are GMT -4. The time now is 20:30.