CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Rotating objects (http://www.cfd-online.com/Forums/openfoam-solving/59452-rotating-objects.html)

 Marcus Gellert (Gellert) February 2, 2005 11:08

Hi all, I have a question

Hi all,

I have a question regarding moving meshes in terms of a rotationg cylinder.
I found the 2D mixer example in icoTopoFoam and removed the blades.
But i don't like the sliding patches in the inside because they producing strange
results if I close the cylinder at top and botton with stationary solid walls.
My question: is it possible to define movements in terms of rotation without the mixer
class, e.g. use icoAutoFoam and define the inner wall as a rotating wall?

My second question concerns the property of the default boundary condition 'empty patch'.
What does it mathematically mean? Exists a more detailed description of usable boundary
conditions and also of the way the system of equations are implemented and solved?

Thank you.

 Mattijs Janssens (Mattijs) February 2, 2005 11:17

- strange velocities: you are

- strange velocities: you are making a 3D geometry (since you have walls on top and bottom) which is only one cell thick?

- moving walls: you can just enter a non-zero velocity for the walls of the mixer (see the lid-driven cavity tutorial). All velocities are in stationary coord system.

- empty patch is a patch for which nothing has to be done. There are no values stored, nothing is discretised.

Mattijs

 Marcus Gellert (Gellert) February 2, 2005 11:59

* I extended the third direct

* I extended the third direction to get an aspect ratio of eight. Additionally I modified the resolution
also in r- and phi-direction. Nevertheless near top and bottom the velocity distribution in radial
direction is wrong, it's constant in the outer part (outside the slider) and correct (quadratically)
in the inner part (low Reynolds number). With 'empty patch' top and bottom it looks good
but doesn't take into account effects from solid caps which are important for
higer Reynolds numbers.

I also didn't got the point why the sliders are needed or what effect they have. I'm new in the
field of finite volume methods, perhaps thats the reason I'm asking.

* It's not simply a moving wall but rotating. Could I define velocities like v_x=sin(t) for the wall?

* Regarding the empty patch: I know that nothing needs to be done, but what kind of constraint
undergoes my fluid particle at such a 'wall'?

 Hrvoje Jasak (Hjasak) February 2, 2005 12:17

OK, here's some explanations:

OK, here's some explanations:

1) Empty patch
As you know, foam is a 3-d solver and 2-d cases are solved using 3-d cells and a geometry 1 cell thick. In that case, what is the natural boundary condition for the "top" and "bottom" plane? Well, it would be something like a symmetry plane or a zero gradient for all variables (there is no "action" in that direction).
Howver, both choices I have given imply that value will be stored for all faces in the patch. Thus for a 2-d geometry you would end up storing all cell vaues three times: once for the cell and once for each top and bottom face. This is wasteful and unnecessary + it costs both storage and operations (as the boundary condition is always evaluated!).

Why can we get away with doing a 3-d calculation on a 2-d slice? it is because the faces in the front and back plane do not really matter, i.e we do not need to solve anything on them (to be very precise, a sum of face area vectors for each cells without the front and back plane equals zero).

On the other hand, foam requires you to specify a boundary condition for all external faces INCLUDING the front and back plane. An elegant solution for this problem is the empty boundary condition: it tells foam to store no values and do no operations for this patch. With this on the front and back plane, you only solve for and store one value for all cells in 2-d and there is no overhead. However, if you use it for a 3-d geometry, you will get garbage.

2) Why do you need sliders?

Specifying a velocity on the wall can be done in 2 ways:
- moving the actual wall + using the movingWallVelocity b.c
- defining a non-zero tangential velocity on the wall.

If your wall is smooth, the second one is OK: for example, you can define the rotating cylinder in this way + if you like, the actual wall velocity can be a function of time or whatever else you like.

If you want to do a mixer, you will have blades etc and the velocity is not tangential to the wall in all places. Therefore, you cannot specify it in any other way apart from actually moving the wall. Now look at the mixer tutorial and create the whole mesh in one piece. Use the automatic mesh motion solver to move the impeller and leave the outside fixed. After half a rotation (at the latest), your mesh will fold onto itself and become invalid - you may like to draw this by hand :-) Once you do that, it will become clear why you need a sliding mesh.

Good luck,

Hrv

 Marcus Gellert (Gellert) February 2, 2005 12:39

Now it becomes clearer to me,

Now it becomes clearer to me, thank you.

So my way is the second one to define a
nonzero tangential velocity. There is no tutorial with such a case, isn't it?

 Hrvoje Jasak (Hjasak) February 2, 2005 12:45

The tutorials describing this

The tutorials describing this are:

Moving the actual wall:
- without change of topology: icoFoamAutoMotion movingCone
- with changing topology: icoTopoFoam: mixer2D

Specifying non-zero tangential velocity: icoFoam cavity

Have a careful look at what happens to the mesh in all cases. Incidentally, icoFoam cavity is also a 2-D case with the empty boundary conditions.

Enjoy,

Hrv

 Marcus Gellert (Gellert) February 9, 2005 07:15

I'm back for asking. Both ca

I'm back for asking.
Both cases you pointed out are different to rotation in so far as the wall velocities are tangential but limited to one
direction (x in the cavity case). For rotation it's something like

uniform ( sin(x) cos(y) 0 )

I don't know how to define it. For the nonuniform case one has to give a list with velocity values at all boundary points?
What's the order of that points?

 Eugene de Villiers (Eugene) February 9, 2005 08:24

Do a search of the board post

Do a search of the board posts. I think the general question of specifying varying boundary conditions has been asked several times. There are even one or two example codes if I am not mistaken.

Search topic: boundary

 Marcus Gellert (Gellert) February 9, 2005 08:40

The boundary conditions are n

The boundary conditions are not varying, they are fixed. Ok only fixed in time and depending on the position in space.
So my question is if I need to define a list of values at all boundary grid points or if there is an easier way.

(I didn't found an answer in either the documentation nor the message posts. And I was also not able to see similarities
in the tutorial cases.)

 Eugene de Villiers (Eugene) February 9, 2005 09:01

You need to define velocities

You need to define velocities at all boundary faces.

The following code included in your solver before the main calculations begin, should do the trick:

/***********************************************/
label patchID = mesh.boundaryMesh().findPatchID(nameOfRotatingSurf ace);

const polyPatch& cPatch = mesh.boundaryMesh()[patchID];

forAll(cPatch, faceI)
{
const vector& faceCoord = cPatch.faceCentres();
vector faceU(vector::zero);
faceU.x() = some function of faceCoord;
faceU.y() = some function of faceCoord;
faceU.z() = some function of faceCoord;

U.boundaryField()[patchID][faceI] = faceU;
}

/***********************************************/

Obviously, you need to replace "nameOfRotatingSurface" and "some function of faceCoord" with the appropriate expressions.

(note this code has not been tested, and is intended as guideline only)

 Marcus Gellert (Gellert) February 9, 2005 09:11

Thank you Eugene. I will try

Thank you Eugene. I will try it that way.

 Eugene de Villiers (Eugene) February 9, 2005 09:40

Better code: /************

Better code:

/***********************************************/
label patchID = mesh.boundaryMesh().findPatchID(nameOfRotatingSurf ace);

const fvPatch& cPatch = mesh.boundaryMesh()[patchID];

const vectorField& faceCentres = cPatch.Cf();
U.boundaryField()[patchID] = some function of faceCentres;

/***********************************************/

If you need to access the component fields it can be done via ".component(i)" where i=0,1,2 equiv x,y,z

 Hrvoje Jasak (Hjasak) February 9, 2005 10:18

And a completion :-) point

And a completion :-)

point origin(1, 1, 0.05);
vector axis(0, 0, 1);

U.boundaryField()[patchID] = axis ^ (faceCentres - origin);

Vectors, Dude, vectors! :-)

 thumthae June 20, 2005 07:47

Hi Hrvoje, I want the paddl

Hi Hrvoje,

I want the paddle of 2Dmixer example of icoTopoFoam move with fluctuating function.
for example, to define the paddle move with fluctuated angular speed, omega=A*sin(B*deltaT), where A and B are constant.

How can I do? which file I need to edit.

 hjasak June 20, 2005 13:37

Heya, It depends a bit on w

Heya,

It depends a bit on what version of foam you are - the location of the file may be slightly different (apologies).

Go find the directory containing icoTopoFoam - in the old version, it should be something like:

OpenFOAM-1.1/applications/solvers/incompressible/icoTopoFoam

In there, find the mixerMesh (or mixerFvMesh) class, which defines what the mixer vessel will be doing. An alternative location would be OpenFOAM-1.1/src/topoFvMeshes/mixerFvMesh/

Now look for the slide() or similar function - search for rpm in the .C file and you should be able to find it. In there (I am using the old code as an example), it will actually move the mesh:

// Rotational speed needs to be converted from rpm
movePoints
(
cs_.toGlobal
(
cs_.toLocal(allPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
)
);

Take that function and rip it apart in any way you like (hopefully, renaming the class first). You can pull through the parameters from the dictionary in the constructor etc.

Beware of the setup with double mesh motion (that's NOT an error) :-) and enjoy!

Hrv

 brahim April 25, 2007 17:06

hello, i would like to turn

hello,
i would like to turn an imppeler wall in 3D (i.e moving wall) using the new code OpenFOAM-1.4 with MRF case. is it possible and and how can it be done this !

I thank you for helping me.
B.

 sradl September 12, 2007 14:26

Dear Foamers, I'd also like

Dear Foamers,

I'd also like to have rotating parts in 3D with complex geometry, i.e., not using blockMesh and using MRF to get a steady-state solution. Just like the way the mixer2D tutorial, but with an external mesh.

Has anybody tried this? How have you defined the cellZones? I'd like to use Cubit or Salome,

br

 McCarra December 14, 2010 16:06

I would like to have a look at icoTopoFoam mixer 2D tutorial. How can I get it? I'm on version 1.7.1. I have a rotating square and the mesh rotates with it, so I need sliding interface as Hrv said in this thread. Bu I don't know how to combine automatic mesh motion with sliding interface.

Thanks

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