CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Rotation Boundary Condition (http://www.cfd-online.com/Forums/openfoam-solving/59168-rotation-boundary-condition.html)

rswbroers May 15, 2007 04:28

Using the help of the forum (
 
Using the help of the forum ( http://www.cfd-online.com/OpenFOAM_D...ges/1/174.html ), I've managed to set up a case with a rotation boundary condition by adding the following lines to simpleFoam.C, just ahead of the start of the time loop:

/***********************************************/
label patchID = mesh.boundaryMesh().findPatchID("WHEEL");
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
const vectorField& FaceCentres = cPatch.faceCentres();

point origin(0.5, 0.20, 0.5);
vector axis(0, 0, 1);
scalar radPerSecond(5);

const vectorField& tempRotation = radPerSecond * axis ^ (FaceCentres - origin);
U.boundaryField()[patchID] == tempRotation;
/***********************************************/

This does exactly what I want it to do, except for the fact that the rotation specification (i.e. origin, axis, radPerSecond and the patch name this is applied to) is hard coded into the executable.

What I am looking for is way of reading the rotation specification in from file. For example from the file 0/U (or similar):

boundaryField
{

WHEEL
{
type rotation;
origin (0.5 0.2 0.5);
axis (0 0 1);
radPerSecond (5);
}

Is such a thing possible? Where should I look for examples this?

Thank you very much.

best regards,
Roland

normunds May 15, 2007 06:34

Hello, Roland! I did it in
 
Hello, Roland!

I did it in that way, see code in


ftp://ftp.jesystems.eu/pub/OpenFoam/...ionFoam.tar.gz


and the case

ftp://ftp.jesystems.eu/pub/OpenFoam/...ionFoam.tar.gz

result is

ftp://ftp.jesystems.eu/pub/OpenFoam/...n/rotation.tif

Well, it is my "development version"
of rotation boundary condition,
please check it before serious use!

You may split my vectorial
w0 to axis and angular
rotation frequency.


best regards

/Normunds

rswbroers May 15, 2007 07:21

Normunds, It looks interest
 
Normunds,

It looks interesting. I will study it.

Thanks,
Roland

rafal May 15, 2007 08:29

you may also find different ut
 
you may also find different utility useful.
one i wrote for mixer3D. it is on the
basis of patchAverage utility and has
the same syntax. it sets velocity on
specified patch. it reads all necessary
rotation parameters from dynamicMeshDict
of dynamic mesh (similar to mixer2D case
in OpenFOAM-1.3).
I used it with fixedValue BC.
invoke it once at the beginning and then
solve everything later like with
standard fixedValue not bothered to think if
my patch is doing right job or not.

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif patchMixerSetVel.tar.gz

hope that helps.
rafal

(note: this code could be better written
and cleaner but it is doing job well
so I left it as it is. feel free to modify
it http://www.cfd-online.com/OpenFOAM_D...part/happy.gif )

rswbroers May 21, 2007 04:54

Normunds, Rafal, Thank you
 
Normunds, Rafal,

Thank you for your codes. Both do what I was looking for, each in a different manner. Unfortunately both also have a (different) drawback that prevents me from using it for practical applications.

With Normunds' code you specify the rotation b.c. in the startTime U file, as you would with an ordinary moving wall. This works perfectly.
However it is not possible to restart a run as the rotation specification is not copied to any new time directories, which is serious drawback.

Attached below is my modification of Normunds' code. I compiled it with simpleFOAM by adding uniformAxialRotation.C to simpleFOAM/Make/files. Also included is an example U file.

Would it be possible to copy the rotation specification to new time directories? Or would, perhaps, another approach would be better?

/attach{uniformAxialRotation.tar.gz}

Rafals code works by creating a nonuniform list before running a case. It does not modify any of the solvers, which makes it nice and simple. When running on my pc it works perfectly. However when I try to run it on our cluster it crashes with a segmentation fault. On both computers I tried with two different cases (one small, one large) with the same result.

Attached below is my version of Rafal's code. Included is an example rotationBCDict file that needs to be placed in the constant directory.
The segmentation fault occurs on line 109. Uncommenting line 110 would also cause a segmentation fault. Line 111 would run without a problem. Again, the segmentation fault does not occur on all machines.

Does anyone have an idea what is going wrong here?

/attach{rotationBC.tar.gz}

best regards,
Roland

rswbroers May 21, 2007 04:57

Sorry, the following links sho
 
Sorry, the following links should work:

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif uniformAxialRotation.tar.gz
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif rotationBC.tar.gz

regards,
Roland

rafal May 21, 2007 10:34

seems result is calculated not
 
seems result is calculated not properly.
spit out _omega, _axis, faceCentres, _centre.
and see if the values are correct.
My code it was fast simple implementation for
my specific case of rotating plain surface. it
may be buggy for other cases and certainly do not support to be applied on moving wall for this you need to update variables every time step.
rafal

rswbroers May 22, 2007 03:58

Rafal, The calculation of r
 
Rafal,

The calculation of result looks exactly as it should be on the working machine. And on both machines _omega, _axis, _centre and faceCentres look identical, so I doubt this is causing the trouble.

Actually I think your code is suitable for what I am trying to do. As type remains fixedValue (for U), the nonuniform List is copied to each timestep/iteration without alterations. It is no different, at least to my limited knowledge of OF, to specifying a uniformly moving wall using 'value uniform (1 0 0);'.

best regards,
Roland

rswbroers May 22, 2007 08:13

Setting a rotation boundary co
 
Setting a rotation boundary condition now works on both machines by changing line 108 from

const vectorField& result = _omega * _axis ^ (faceCentres - _centre);

to

vectorField result = _omega * _axis ^ (faceCentres - _centre);

I have absolutely no idea why the original line failed to work on one machine and worked perfectly on another.

best regards,
Roland

eugene May 22, 2007 13:48

The original line should never
 
The original line should never work! In fact I'm surprised it compiles.

"const vectorField&" is is a constant reference to an existing vector field object.

rafal May 28, 2007 08:01

Eugene is right. Actually I am
 
Eugene is right. Actually I am also surprised that compiler didt pick this obvious mistake on all machines.

cedric_duprat July 9, 2007 05:23

Hi all, this monday morning,
 
Hi all,
this monday morning, I'm using the rotationBC which is describe upper,
but .... an error is coming while runing OF:
keyword type is undefined in dictionary "/craya/big/duprat/OpenFOAM/duprat-1.3/duprat-1.3.ori/run/ESSAI2/0/U::walldyna"
so, I would like to know if did well :
1- installing and compilling rotationBC in utilities/preporocessing/
I also correct the mistake describe upper
2- changing my 0/U adding the rotation in my patch walldyna (omega, axis, center) by hand (no FoamX)
which is not running.
then try adding the rotationDict in mycase/system/
but, it is also not runing.

As Srinath propose, I don't use FoamX, so I "run" my case with : oddles .../run mycase

I can't find where I am wrong ...I think I still not understand the Foam's philosophy adding some of newly build B/C, ect, ...

Some help is welcome ...thanks

Cedric

rengu October 16, 2007 12:12

Hi Cedric did you manage to u
 
Hi Cedric
did you manage to use rotationBC?
if yes can you tell me the approach to install it and use it?

best regards,
guillaume

plmauk February 5, 2008 07:41

I've tried to compile rotation
 
I've tried to compile rotationFoam, making by
Normunds Jekabsons, but following error message
appears :

[plmauk@cfd-61 rotationFoam]$ wmake
SOURCE=boundary/derivated/uniformAxialRotation.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -Iinclude -IlnInclude -I. -I/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/uniformAxialRotation.o
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.H: In instantiation of 'Foam::DimensionedField<foam::vector<double>, Foam::volMesh>':
boundary/derivated/uniformAxialRotation.C:14: instantiated from here
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.H:8 3: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.H:9 2: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.C:5 8: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.C:8 6: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedField.C:1 01: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedFieldIO.C :59: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/DimensionedFieldI.H: 36: error: invalid use of incomplete type 'struct Foam::volMesh'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:5 8: error: forward declaration of 'struct Foam::volMesh'
boundary/derivated/uniformAxialRotation.C: In constructor 'Foam::uniformAxialRotationFvPatch::uniformAxialRo tationFvPatch(const Foam::fvPatch&, const Foam::vectorField&)':
boundary/derivated/uniformAxialRotation.C:14: error: no matching function for call to 'Foam::fixedValueFvPatchField<foam::vector<double> >::fixedValueFvPatchField(const Foam::fvPatch&, const Foam::Field<foam::vector<double> >&)'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:87: note: candidates are: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:76: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:66: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:53: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:41: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
boundary/derivated/uniformAxialRotation.C:17: error: 'class Foam::uniformAxialRotationFvPatch' has no member named 'checkVolField'
boundary/derivated/uniformAxialRotation.C: In constructor 'Foam::uniformAxialRotationFvPatch::uniformAxialRo tationFvPatch(const Foam::fvPatch&, const Foam::Field<foam::vector<double> >&, const Foam::dictionary&)':
boundary/derivated/uniformAxialRotation.C:32: error: no matching function for call to 'Foam::fixedValueFvPatchField<foam::vector<double> >::fixedValueFvPatchField(const Foam::fvPatch&, const Foam::Field<foam::vector<double> >&, const Foam::dictionary&)'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:87: note: candidates are: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:76: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:66: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:53: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:41: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
boundary/derivated/uniformAxialRotation.C: In constructor 'Foam::uniformAxialRotationFvPatch::uniformAxialRo tationFvPatch(const Foam::uniformAxialRotationFvPatch&, const Foam::fvPatch&, const Foam::Field<foam::vector<double> >&, const Foam::fvPatchFieldMapper&)':
boundary/derivated/uniformAxialRotation.C:54: error: no matching function for call to 'Foam::fixedValueFvPatchField<foam::vector<double> >::fixedValueFvPatchField(const Foam::uniformAxialRotationFvPatch&, const Foam::fvPatch&, const Foam::Field<foam::vector<double> >&, const Foam::fvPatchFieldMapper&)'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:87: note: candidates are: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:76: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:66: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:53: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:41: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
boundary/derivated/uniformAxialRotation.C: In constructor 'Foam::uniformAxialRotationFvPatch::uniformAxialRo tationFvPatch(const Foam::uniformAxialRotationFvPatch&, const Foam::Field<foam::vector<double> >&)':
boundary/derivated/uniformAxialRotation.C:66: error: no matching function for call to 'Foam::fixedValueFvPatchField<foam::vector<double> >::fixedValueFvPatchField(const Foam::uniformAxialRotationFvPatch&, const Foam::Field<foam::vector<double> >&)'
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:87: note: candidates are: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:76: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:66: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fixedValueFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:53: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
/home/plmauk/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fixedValueFvPatc hField.C:41: note: Foam::fixedValueFvPatchField<type>::fixedValueFvPa tchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&) [with Type = Foam::Vector<double>]
make: *** [Make/linuxGccDPOpt/uniformAxialRotation.o] Fehler 1

normunds February 5, 2008 09:58

Hello Paul! This is an old
 
Hello Paul!

This is an old one, some kind of early development version. It works with OF 1.3 only. I have version for 1.4.1, just I can post it only tomorrow morning.

best regards

/normunds

normunds February 6, 2008 04:27

This, perhaps, is slightly bet
 
This, perhaps, is slightly better. I am using myself it for time dependent rotation, with a different
updateRot() function.

/Normunds

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif testRotationFoam.tar
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif testRoatationCase.tar.bz2

cedric_duprat February 6, 2008 05:24

Hi Paul, I just would like
 
Hi Paul,

I just would like to add that there is also one code avaiable on the wiki from Sig turbomachinery.
You will find all the details here: http://openfoamwiki.net/index.php/Si...e_next_meeting
in addSwirlAndRotation.

Cedric

plmauk February 6, 2008 06:30

Thanks a lot for support, Norm
 
Thanks a lot for support, Normunds und Cedric!
I will try it.

Best regards
Paul.


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