CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   OscillatingFixedValue in OpenFOAM 141dev (

mathieu September 9, 2008 17:42

Hi, It looks like the oscil

It looks like the oscillatingFixedValue boundary condition does not work properly when it is used in the motionU file to apply a movement. See the case in attachment (moveDynamicMesh <root> <case>).



elorriaux September 10, 2008 02:05

Hi, I can't get the attachm

I can't get the attachment.

Anyway, i'm using oscillatingFixedValue in motionU, and it works.

Can you detail your problem ?


mathieu September 10, 2008 09:09

Hi, Here is a smaller case

Here is a smaller case that should upload. Use fluentMeshToFoam to generate the mesh (cylindre.msh). cylindre.tgz

It looks like that the motion of the boundary is the half of what it is supposed to be, but the rest of the mesh moves like it should. See the picture :


elorriaux September 10, 2008 14:39

Hi Mathieu, take a look at
Hi Mathieu,

take a look at this file src/fvMotionSolver/lnInclude/oscillatingDisplacementPointPatchVectorField.C

Your boundary motion is computed in this code part.

Note that motionU is a velocity and not a displacement, and the velocity imposed is '1.0 + amplitude * sin (2 * pi * frequency * t). You'll have to rebuild your library if you don't want the '1.0'.

elorriaux September 10, 2008 14:44

Humm sorry, i gave you the wro
Humm sorry, i gave you the wrong path.

Check src/OpenFOAM/fields/PointPatchFields/derived/oscillatingFixedValue/OscillatingFi xedValuePointPatchField.C


mathieu September 10, 2008 15:39

Hi Etienne, Thank you for y
Hi Etienne,

Thank you for your reply. Did my case work correctly on your OpenFOAM installation ?


elorriaux September 11, 2008 06:53

Hello Matthieu, i'm getting
Hello Matthieu,

i'm getting the same issue with my installation.

In fact, i think your timestep is too long. Try with smaller deltaT (ie 0.05 or 0.1). Here is an attempt with deltat=0.05 :


mathieu September 11, 2008 09:22

Hi Etienne, I also tried a
Hi Etienne,

I also tried a smaller timestep (in fact, I put a big time step in my case to clearly show the problem) and as one can see on your video, there is still a "distortion" of the mesh near the boundary which becomes an important issue for meshes with fine discretization on boundary layers. On the opposite, if you try the uniformFixedValue BC (with a constant non-zero velocity) instead of oscillatingFixedValue you'll see that it works perfectly.

By the way, I don't think the timestep size is important for dynamic mesh purposes since the Laplace equation is steady state (however it might affect the computation time within each timestep). Thanks again !


elorriaux September 11, 2008 09:46

I don't think the problem come
I don't think the problem comes from oscillatingFixedValue condition. The mesh solver seems to have difficulties when there are variations of velocity. It seems to work properly with constant velocity.


mathieu September 11, 2008 11:24

Hi people, hi Etienne, It l
Hi people, hi Etienne,

It looks like I am very lucky...

I removed lines 313 and 314 in src/OpenFOAM/fields/PointPatchFields/derived/oscillatingFixedValue/OscillatingFi xedValuePointPatchField.C :

// FixedValuePointPatchField
// <patchfield,>::initEvaluate();

Then, I recompile the tetDecompositionFiniteElement librairy :

cd ~/OpenFOAM/OpenFOAM-1.4.1-dev/src/tetDecompositionFiniteElement

After those modifications, my case works perfectly with the oscillationgFixedValue BC in the motionU file.

However, I am not an expert with the code and it would be nice if an OpenFOAM expert could take a look at this issue.

Kind regards,


peter73 November 12, 2008 17:12

I used openfoam 1.5. The file
I used openfoam 1.5. The file OscillatingFi xedValuePointPatchField.C is not in the directory mentioned here but it was located at src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingF ixedValueFvPatchField.C

Implement the oscillating boundary in the files pointMotionU and cellMotionU as follows. But I get the error message like

Selecting dynamicFvMesh dynamicMotionSolverFvMesh
Selecting motion solver: velocityLaplacian

Not Implemented
Trying to construct an genericFvPatchField on patch movingWall of field cellMotionU#0 Foam::error::printStack(Foam: in "/home/yslian/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/"
#1 Foam::error::abort() in "/home/yslian/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/"
#2 Foam::genericFvPatchField<foam::vector<double> >::genericFvPatchField(Foam::fvPatch const&, Foam::DimensionedField<foam::vector<double>, Foam::volMesh> const&) in "/home/yslian/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/"

It seems the boundary condition is not implemented in the new version. I appreciate any suggestions.


type oscillatingFixedValue;
refValue uniform (0 0 0);
amplitude uniform (0 2 0);
frequency 50;
curTimeIndex 0.0;

henry November 12, 2008 18:07

What BC have you specified for
What BC have you specified for the movingWall in the file pointMotionU?


peter73 November 12, 2008 19:06

The bc posted there is just on
The bc posted there is just one example. Basically, I want to oscillate one object around certain point, meanwhile, the object will move up and down.



The problem is the the oscillatingFixedValue does not work with OF1.5.

henry November 13, 2008 04:36

oscillatingFixedValue is not a
oscillatingFixedValue is not a valid BC for pointMotionU which is a pointField not a volField. Look at the avalable BCs for pointMotionU in
and if none of these suit your needs you can easily roll your own based on these examples.


peter73 November 13, 2008 08:49

Henry, Thanks. I noticed t

Thanks. I noticed that last night and I copied the oscillatingFixedValue from the

After comparing
(timeVaryingUniformFixedValue Fv PatchField.C)
( Point )
I noticed the difference between these two is one use Fv and another use Point in the .C and .H file. So I change that the oscillating**.C.

When I compile the file, I get the error message that

fields/pointPatchFields/derived/oscillatingFixedValue/oscillatingFixedValuePoint PatchField.C:159: error: expected initializer before ā<ā token
fields/pointPatchFields/derived/oscillatingFixedValue/oscillatingFixedValuePoint PatchField.C:39: error: redefinition of āFoam::scalar Foam::oscillatingFixedValuePointPatchField<type>:: currentScale() constā
fields/pointPatchFields/derived/oscillatingFixedValue/oscillatingFixedValuePoint PatchField.C:39: error: āFoam::scalar Foam::oscillatingFixedValuePointPatchField<type>:: currentScale() constā previously declared here

I just start to learn C++ and so I search the internet for help but still cannot find a solution yet.

peter73 November 13, 2008 18:25

I reduced the error to only on
I reduced the error to only one: refined variables. If someone wants to take a look and fixed this bug, please send me email so I will send the files to you.


patriem January 31, 2009 11:08

Hello Foamers, i have a que
Hello Foamers,

i have a question concerning the formula for oscillatingfixedvalue in 1.4.1-dev.

At the top posting, you said that the velocity imposed is '1.0 + amplitude * sin (2 * pi * frequency * t).

I“m not a C++ crack, but in my files it seems to be
U = amplitude * cos(2*pi*frequency*t)

I just don“t understand follwing:
If you have a simple oscillating motion, it can be described as


then the velocity is


Where is the 2*frequency*t in OscillatingFi xedValuePointPatchField.C? Can anyone explain me the differencies between the last and the first formula?

Thank you!

hjasak January 31, 2009 13:01

Yes, that would be my fault.
Yes, that would be my fault. I've been playing with various forms, depending on whether you want the mean value in the oscillation to be zero or not and whether you prefer to start from zero (sin) or from extreme (cos).

I have no strong opinions on what this should be and soon we will have an intepreted formula here instead. Do you hav a preference? It would be easy to simply change your local version of the code (no consequences).



patriem January 31, 2009 14:08

Still thinking about the frequ
Still thinking about the frequency.
Is that the number of oscillations per one second or the number of oscillations per given intervall (between starttime and stoptime)?

Thank you very much for answering.

I“m just getting familiar with the topic movingmesh, dynamicmesh and oscillation b.c. I also read your dissertations about the fem moving mesh solvers etc.
I want to calculate a test case and present OF to my institute (part of the University Stuttgart)
In like the oscillatingFixedValue b.c. and maybe i want to couple it with a topological layer add/removal.
But i“m just working in, so a little help is useful even if some questions may be stupid;)

patriem February 3, 2009 16:12

Hallo Foamers! At the momen
Hallo Foamers!

At the moment i use laplacefacedecomposition and a motonU file with oscillatingFixedValue b.c. to define mesh-motion. Version 1.4.1-dev. But i am not sure about the appropriate files:

Is the internal-meshpoint motion dscribed here?

src/OpenFOAM/fields/PointPatchFields/derived/oscillatingFixedValue/OscillatingFi xedValuePointPatchField.C
Is the movement/velocity of the oscillating b. c. described here?

Thank you very much for answers, the movement of my mesh seems to be too small...

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