CFD Online Discussion Forums

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

Madeleine P. Vincent April 27, 2013 12:04

Variable velocity boundary condition
Hi all,

I am interested in applying a velocity boundary condition to a solid structure in the middle of the flow. The velocity, however, is not constant along the surface of the structure. So I can't use the "fixedValue" within the U file, such as:

type fixedValue;
value uniform (0 5 0);

The velocity may be computed from a function or even a 3rd party algorithm, and then applied at each step.

What's the best way to implement this in OpenFOAM?


ngj April 28, 2013 08:57

Hi Madeleine,

Essentially, your question have two different answers, so let me address each of them separately:

1. If you define the velocity by a function, then I would as an initial start suggest to use swak4Foam ( Several examples of its use are distributed along with the source code.

2. If you need to get the information from a third party software, then I would suggest that you write a boundary condition, which links to this third party software. Actually, I would write a class that takes care of the linking and make this class known to the boundary condition.
In this way all the interaction between OpenFoam and this other software is hid away from the user, which makes the application much easier.
In addition to this, future extensions or investigation of different approaches become extremely easy to implement and more importantly, it is easy to identify which version was used, because you can make multiple boundary conditions with different names based on the original class.

Kind regards


Madeleine P. Vincent May 6, 2013 13:38


it looks like swak4foam is adequate for what I am doing. I'll consider writing a custom class later if necessary.

Thanks a lot for the help!


All times are GMT -4. The time now is 07:25.