CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   New boundary condition (

alberto November 30, 2005 16:07

I need to implement Johnson an
I need to implement Johnson and Jacksnon boundary conditions in twoPhaseEulerFoam:

Is there something similar in OpenFoam to take as a starting point?


niklas December 1, 2005 04:04

Hi, We had a similar bc in

We had a similar bc in our version of the two-phase code, but I decided to remove it from the official version, since it makes the calculations
even more prone to crash/oscillate.

I will see if i can dig out the old code and send it to you.


alberto December 1, 2005 05:38

Hello, yes, I know these boun
yes, I know these boundary conditions can give such a kind of problems, but they're widely used in risers simulations.

It would be of great help if I could see your code :-)


niklas December 1, 2005 07:28

OK, with the help of Rasmus I
OK, with the help of Rasmus I got these particleSlip.tgz
The particleSlip bc.

To use this you just compile the library and add
the -lparticleSlip to the Make/options of your code and recompile that.

and to use it you set
type particleSlip
in the Ua bc's

If you want to postProcess the Ua variable you need to add the -lparticleSlip to the foamUser lib.

Its a partial slip conditions which is calculated in the .C file, a valueFraction() of 0 corresponds to the full slip condtion and 1 to a no-slip (or the fixedValue of (0 0 0))

The bc also needs some input from the transportProperties dictionary, da and phi0,
the diameter of the particles and their sphericity.

It's just possible to set the tangential component at the wall, since the normal should be zero.

...and of course you can rename it to something else then particleSlip, but it should be pretty straightforward to use you own equation for the 'slipperyness'.


alberto December 1, 2005 08:39

Thank you and Rasmus. I'll add
Thank you and Rasmus. I'll add the Theta condition and post back the code as soon as possible.


alberto December 2, 2005 10:52

Hello, if you consider the pa
if you consider the partial slip boundary condition in the form:

U - a*dU = 0

where dU is the gradient in the normal direction, and a in [0, +inf[, is valueFraction defined as:

valueFraction = a/(1-a)

If not, what's the definition of valueFraction?


niklas December 2, 2005 11:45

Hola, Not 100 percent sure,

Not 100 percent sure, but I'd say its like this:

valueFraction*U + (1-valueFraction)*dU = 0


alberto December 2, 2005 15:36

Hello, I'm a bit confused bec
I'm a bit confused because the user's guide, pag. 148, says we have a complete slip b.c. for valueFraction = 1, so it can't be

valueFraction*U + (1-valueFraction)*dU = 0

because, for valueFraction = 1, it gives the no-slip b.c. and not the slip one. This is the reason I thought to something like:

(1-valueFraction)*U + valureFraction*dU = 0

but I'm not sure.

Any confirmation is welcome :-)

Thanks again,

alberto December 2, 2005 23:10

I tried to apply the condition
I tried to apply the condition you sent to me, but when I start the solver, I get this error:

Create mesh for time = 0

Reading environmentalProperties
Reading transportProperties

request for volScalarField alpha from objectRegistry region0 failed
available objects of type volScalarField are


From function objectRegistry::lookupObject<type>(const word&) const
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/objectR egistryTemplates.C at line 122.

Also, is it possible to use data contained in the phase object and use the kineticProperties dictionary instead of transportProperties?


niklas December 3, 2005 09:09

Hi, I might possibly have the
I might possibly have the definition mixed up,but the easiest wasy to check is to run the icoFoam cavity tutorial with a fixed valueFraction and ascii format and check the values on the wall patch.

You're picking up the wrong database, the code I sent is from before the database was re-written and I dont know the new name (Mattijs does though Im sure)

Of course you can use the kineticProeprties dictionary instead, just change the name in the particleSlip.C file.


alberto December 3, 2005 11:07

The kineticTheoryProperties di
The kineticTheoryProperties dictionary seems to be unknown: it gives another fatal error where it states it can't find the dictionary. But this is probably related to the database issue too.

About the database, the only access (if I'm not wrong :-)) the code does to it should be through db(), but no name is specified there.
Also I looked at other BC's implementation and the same syntax is adopted.
Where do you choose the dictionary you pick?

Thanks and sorry if I'm boring :-)

niklas December 9, 2005 03:56

Hi, Just tested the code an

Just tested the code and it works, but I was able to reproduce the error message.
Here's the bc input you need

type particleSlip;
value uniform (0 0 0);

I'm guessing that you didnt include the value-statement, remember that if you want partial slip, you need a reference velocity.


alberto December 10, 2005 20:06

You're right Niklas. I forgot
You're right Niklas. I forgot the value statement.

Thank you!

jballen February 16, 2006 13:23

How does one obtain the tangen
How does one obtain the tangent vector to a given face. I know for example that Sf() gives the normal vector.


hjasak February 16, 2006 17:01

1) Take any vector, a 2) get
1) Take any vector, a
2) get a face normal n; if not already available, do Sf/mag(Sf)
3) the tangential component is:

a_t = a - n*(n & a)

Be careful: if you choose a to be parallel with n, you will get a zero vector. In that case, try a different a



Cynthia Poon March 26, 2009 21:23

Hi Niklas and everybody,

I've got some problem when post-processing the boundary condition. The error message in ParaView show that the "alpha" request from objectRegistry region0 failed.

Referring to #4 post, I find "If you want to postProcess the Ua variable you need to add the -lparticleSlip to the foamUser lib."

Can I ask where is that foamUser lib for post-processing?
I am sorry if my question is too silly.


makaveli_lcf April 9, 2009 11:58

Hi all!

I'm trying to implement heat convective BC like at

So we have as a parameters for applied BC:
h_ext - external heat transfer coefficient
T_ext - external heat-sink temperature
k_f - thermal conductivity of liquid

On the one hand, from Fourier's law heat flux q is equal
q = - k_f * d(T)/dn (1)

On the other hand,
q = h_ext * (T_ext - T_w) (2)

where T_w is wall temperature, which should be calculated. Combining (1) and (2), we get BC in form:

T - T_ext - k_f /h_f * d(T)/dn = 0 (3)

How to implement this BC in OpenFOAM? I tried to used "mixed" BC, setting refValue to T_ext, refGradient to zero, and calculating valueFraction as

valueFraction = 1/(1+k_f/h_f)

But at this stage I'm sure that it is not properly. Waiting for your suggestions!

Thank you

makaveli_lcf April 14, 2009 03:03

So first I solved with a mixed type, and later made own BC on the basis of fixed gradient type, considering it in form

dT/dn = h_ext / k_f * (T_ext - T) (1)

and using under relaxation for values in boundary patch as it is described at
This implicit boundary condition gives good agreement with FLUENT simulation, while mixed type BC just produces values at boundary close to T_ext.

tnk April 14, 2009 04:46

Dear Foamers,
How can I implement "switching" b.c. on outlet channel boundary?
I need, for example, zeroGradient condition for pressure on supersonic part of outlet and fixedValue condition on rest outlet part (depend on calculated Mach number).
Need I construct new class for this type of b.c.?

Best regards

makaveli_lcf April 14, 2009 04:58

look at boundary condition types in Programming guide, there is allready a set of switching boundary conditions based on velocity direction.

All times are GMT -4. The time now is 19:45.