|
[Sponsors] |
May 15, 2007, 05:28 |
Using the help of the forum (
|
#1 |
Guest
Posts: n/a
|
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 |
|
May 15, 2007, 07:34 |
Hello, Roland!
I did it in
|
#2 |
New Member
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17 |
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 |
|
May 15, 2007, 08:21 |
Normunds,
It looks interest
|
#3 |
Guest
Posts: n/a
|
Normunds,
It looks interesting. I will study it. Thanks, Roland |
|
May 15, 2007, 09:29 |
you may also find different ut
|
#4 |
Member
rafal zietara
Join Date: Mar 2009
Location: Manchester, UK
Posts: 60
Rep Power: 17 |
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. 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 ) |
|
May 21, 2007, 05:54 |
Normunds, Rafal,
Thank you
|
#5 |
Guest
Posts: n/a
|
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 |
|
May 21, 2007, 05:57 |
Sorry, the following links sho
|
#6 |
Guest
Posts: n/a
|
Sorry, the following links should work:
uniformAxialRotation.tar.gz rotationBC.tar.gz regards, Roland |
|
May 21, 2007, 11:34 |
seems result is calculated not
|
#7 |
Member
rafal zietara
Join Date: Mar 2009
Location: Manchester, UK
Posts: 60
Rep Power: 17 |
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 |
|
May 22, 2007, 04:58 |
Rafal,
The calculation of r
|
#8 |
Guest
Posts: n/a
|
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 |
|
May 22, 2007, 09:13 |
Setting a rotation boundary co
|
#9 |
Guest
Posts: n/a
|
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 |
|
May 22, 2007, 14:48 |
The original line should never
|
#10 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
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. |
|
May 28, 2007, 09:01 |
Eugene is right. Actually I am
|
#11 |
Member
rafal zietara
Join Date: Mar 2009
Location: Manchester, UK
Posts: 60
Rep Power: 17 |
Eugene is right. Actually I am also surprised that compiler didt pick this obvious mistake on all machines.
|
|
July 9, 2007, 06:23 |
Hi all,
this monday morning,
|
#12 |
Senior Member
Cedric DUPRAT
Join Date: Mar 2009
Location: Nantes, France
Posts: 195
Rep Power: 17 |
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 |
|
October 16, 2007, 13:12 |
Hi Cedric
did you manage to u
|
#13 |
Guest
Posts: n/a
|
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 |
|
February 5, 2008, 07:41 |
I've tried to compile rotation
|
#14 |
Member
Paul Mauk
Join Date: Mar 2009
Posts: 39
Rep Power: 17 |
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 |
|
February 5, 2008, 09:58 |
Hello Paul!
This is an old
|
#15 |
New Member
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17 |
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 |
|
February 6, 2008, 04:27 |
This, perhaps, is slightly bet
|
#16 |
New Member
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17 |
This, perhaps, is slightly better. I am using myself it for time dependent rotation, with a different
updateRot() function. /Normunds testRotationFoam.tar testRoatationCase.tar.bz2 |
|
February 6, 2008, 05:24 |
Hi Paul,
I just would like
|
#17 |
Senior Member
Cedric DUPRAT
Join Date: Mar 2009
Location: Nantes, France
Posts: 195
Rep Power: 17 |
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 |
|
February 6, 2008, 06:30 |
Thanks a lot for support, Norm
|
#18 |
Member
Paul Mauk
Join Date: Mar 2009
Posts: 39
Rep Power: 17 |
Thanks a lot for support, Normunds und Cedric!
I will try it. Best regards Paul. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Boundary condition of the third kind or Danckwertz boundary condition | plage | OpenFOAM Running, Solving & CFD | 4 | October 3, 2006 13:21 |
fan boundary condition? | kiran kumar | Siemens | 1 | August 4, 2006 15:07 |
Boundary Condition | TengKuei | FLUENT | 2 | May 15, 2006 11:06 |
What boundary condition? | Shanti | FLUENT | 2 | May 4, 2006 14:01 |
Slip Boundary Condition for Moving Boundary | Shukla | Main CFD Forum | 3 | November 11, 2005 16:02 |