CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   oscillating inlet (

mo.houssami May 18, 2011 12:13

oscillating inlet

I am using OpenFoam and I would like to have an Oscillating inlet or an oscillating wall so that my flow start oscillating.
any ideas ? :confused:

Thank you :D

AMahrla May 19, 2011 09:15

There's oscillatingFixedValue boundary condition, that can be found in src/finiteVolume/fields/fvPatchFields/derived (valid for OpenFOAM-1.6.x).

type oscillatingFixedValue;
refValue (8 0 0);
amplitude 2;
frequency 5;



mo.houssami May 24, 2011 05:01

Thank you Astrid, just what I needed :)

November March 21, 2012 02:33

Hi guys
How would you set the initial condition for p after u is set to be oscillatingfixedValue???

mo.houssami March 21, 2012 09:49


Originally Posted by November (Post 350564)
Hi guys
How would you set the initial condition for p after u is set to be oscillatingfixedValue???


I put zeroGradient .

November March 21, 2012 21:20

Hi Mo,

Thank you for your reply.
I tried to put zeroGradient to 0/p at inlet. Somehow I got all p and u at all timesteps to be 0???

In my input file for boundary:
inlet type is set to be patch

and then in 0/p,
inlet type is set to be zeroGradient;

in 0/u, if i want to specify U=Umsin(2*pi*f*t),would the following be correct?
type oscillatingFixedValue;
refValue uniform (0 0 0); //steady current velocity, which is 0 in my case
//offset (0 -1 0);
amplitude constant 1; //Um
frequency constant 0.5; //f
//value uniform (0 0 0); //not sure what this is for?

Could you tell me my problem, really appreciated. Also, may I know how you specified your outlet BC? Thanks a lot.

mo.houssami March 28, 2012 11:13

3 Attachment(s)
Hi, sorry for the late reply.

I only used this condition once last year, so I don't really remember...But I can send you a case that I run, and it was working fine, maybe it can help you out.

Good luck ! :cool:

November March 28, 2012 21:28

Hi Mo.

Thanks a lot. I will have a look at that.


flowris June 4, 2012 07:07

Why is there only one amplitude in the velocity? I would expect a vector of three components, since velocity is a vector.

Personally, I need a velocity vector that varies in time as
(0.4, 0.6*sin(2*pi*t), 0.0)
i.e. x- and z-components are constant, y-component fluctuates.

Can this be done with oscillatingFixedValue?

Eske January 11, 2013 17:29


I am trying to use oscillatingFixedValue as my velocity inlet BC, but I'm wondering what refValue means. Do anyone know that?

What if you only want to have an oscillating motion of the domain (without any current comming into the domain), do I need to put the velocity inlet BC like this in 0/u:

type oscillatingFixedValue;
refValue uniform (0 0 0);
amplitude 1;
frequency 0.5;

Regards Eske

flowris January 14, 2013 05:02

When you say "oscillate the whole domain", I suppose you mean you want to do something like shaking a closed container. For this, check the different sloshing tank tutorials. They are for multiphase, but the same procedure goes for single phase.

Eske January 14, 2013 06:05

Thanks for your reply. What I want is to simulate waves, but not with waves2Foam. I want to make my domain oscillate forth and back. I tried with the oscillatingFixedValue as my velocity inlet BC, which actually oscillate my domain, but it is only working if refValue uniform (1 0 0) which means that a stream/current is coming into the domain in the x-direction. I don't want that current coming in, I only want to oscillate my water domain.

Thanks for your help, Mark

ngj January 14, 2013 06:12

Hi Mark,

Then the easiest for you would probably be to make your own version of oscillatingFixedValue, where you can have a (0 0 0) refValue.

Actually, if I remember correctly, then oscillatingFixedValue differs from the official releases and the 1.6-ext branch, where the user can choose the refValue in the latter.

Kind regards,


Eske January 16, 2013 09:00

Thanks for your reply Niels.

FYI I solved my problem concerning the oscillating inlet by looking in the code src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue and changed 1.0 + amplitude * sin(2 * Pi * frequency * t) to 0.0 + amplitude * sin(2 * Pi * frequency * t) and recompiled. This solved my problem concerning the oscillating velocity.

However have anybody got problems with the pressure by using the oscillatingFixedValue, because at all time my pressure becomes positive. What I think is, that somewhere in the code a positive body force or similar is hard coded. Somebody knows something about this?

Kind regards, Mark

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