CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Problems with 3 degrees of rotation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2007, 03:43
Default Anyone any ideas how to solve
  #1
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Anyone any ideas how to solve this basic problem?

Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   April 25, 2007, 08:03
Default Hi everybody, Concerning th
  #2
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Hi everybody,

Concerning the movement of a patch in the code, is there a way to specify directly the point locations instead of using the velocity motionU like this:

fixedValueTetPolyPatchVectorField& motionUBodyPatch = refCast<fixedvaluetetpolypatchvectorfield>
(
motionU.boundaryField()[bodyPatchID_]
);
motionUBodyPatch == ( rot )/time().deltaT().value();

In other words, I like to read boundary point locations from a file and then replace the oldPoints on the boundary with these newPoints.

Any ideas how to achieve this, any examples?


Regards,
Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   April 25, 2007, 08:25
Default Sorry, can't say I have. Very
  #3
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
Sorry, can't say I have. Very interesting topic though, what kind of modelling did you have in mind for the bubbles?

Regards
Eric
lillberg is offline   Reply With Quote

Old   April 25, 2007, 08:27
Default Sorry! The last message is
  #4
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
Sorry!

The last message is obsolete and ended up the wrong thread

//Eric
lillberg is offline   Reply With Quote

Old   April 25, 2007, 08:45
Default bPoints from file pointVect
  #5
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
bPoints from file

pointVectorField newPoints(mesh.points())
newPoints.boundaryField()[movingPatchID]=bPoints;

You need to move the rest of the mesh accordingly

forAll(newPoints, pointI)
{
Given body rigid motion calculate the rotation refering to center of motion.
}

mesh.movePoints(newPoints)

/Eric
lillberg is offline   Reply With Quote

Old   April 25, 2007, 10:46
Default Not like that: if you do newPo
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Not like that: if you do newPoints[i].x(), OpenFOAM will make a copy of the x-component and return a scalarField.

First make a vectorField out of the stuff from the file and then do the "=".

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 26, 2007, 04:59
Default Mmm, Hrvoje, I still don't get
  #7
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Mmm, Hrvoje, I still don't get it to work. Ignoring the reading from file (this will replace the initialPoints...) stuff I have the following:

================================================

pointField initialPoints =
mesh.boundaryMesh()[patchI].localPoints();

for (runTime++; !runTime.end(); runTime++)
{
pointField newPoints = mesh.boundaryMesh()[patchI].localPoints();

forAll(newPoints, i)
{
newPoints[i] = initialPoints[i]*runTime.time().value() //just some function of time and the initial points;
}
mesh.movePoints(newPoints);

runTime.write();
}
return 0;
}

================================================
Still I get this error:
--> FOAM FATAL ERROR : Cannot move points: size of given point list smaller than the number of active points

When I use mesh.update(), this error dissapears (why?) but no motion occurs (why?).

So I am able to calculate the boundary points the way I want, but not to update / move the boundary points accordingly.


Regards, Frank

BTW, I have to use the newPoints.x() component when I add some sin() or cos() function. Why is that?
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   April 26, 2007, 06:44
Default When moving the mesh with move
  #8
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
When moving the mesh with movePoints() you need to supply new locations for ALL points in the mesh, not just the boundary. If you just move the boundarypoints you'll need an algorithm or solver to calculate the motion of the rest of the mesh. Your error results from your initialization of newPoints

>> pointField newPoints = mesh.boundaryMesh()[patchI].localPoints();

This will only copy the boundary points to newPoints and you need all mesh.points(), see post above for proper initialization.

The amount of movement in the mesh depends on the boundary motion amplitude. If you're looking for rigid body motion things should be trivial if you define a referens point (e.g. (0 0 0)) and calculate a rotation translation for each point in the mesh relative that referens. If you read a prescribed boundary point motion from a file I think you only need to calculate rotation/translation for 3 points on your boundary to specify the entire body motion, right?

If you have a prescribed motion of the boundary that is not rigid you'll need a mesh motion solver of some sort.

Hope you find this helpful

Regards, Eric
lillberg is offline   Reply With Quote

Old   April 26, 2007, 07:12
Default Thanks Eric, I already had som
  #9
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Thanks Eric, I already had some similar ideas on this, but you made it much clearer to me.

You're idea of moving all internal mesh points according to the rotational boundary motion is not going to work in 3D where the moving body has a 'complex' shape and the outer boundary is just a rectangular box where all boundary points are fixed.

I think that it is better to calculate the motionU boundary condition (which is easy since the boundary motion is known) and then use the tetDecompositionMotionSolver to move all internal mesh points. Some library (like movingBodyFvMesh) has to be created then.

This last method is slightly more difficult and I thought that it should be possible to move the boundary and the mesh accordingly in a custom solver.

Am i right?

Regards, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   April 26, 2007, 07:43
Default In that case try... Increme
  #10
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
In that case try...

Incremental motion of your patch points in 'boundaryPatchPointsDispl'

// Grab motionU from registry
tetPointVectorField& motionU =
const_cast<tetpointvectorfield&>
(
mesh.objectRegistry::lookupObject<tetpointvectorfi eld>
(
"motionU"
)
);

// Get a tetPolyPatch for the points on your moving boundary
fixedValueTetPolyPatchVectorField& motionUPatch =
refCast<fixedvaluetetpolypatchvectorfield>
(
motionU.boundaryField()[movingBoundaryPatchID]
);

// Fix an interpolator for your motionU boundary
tetPolyPatchInterpolation tetPointPatchInterpolator
(
refCast<const>(motionUPatch.patch())
);

//Use the interpolator to put the point velocities on your motionU patch
motionUPatch ==
tetPointPatchInterpolator.pointToPointInterpolate
(
boundaryPatchPointsDispl/runTime.deltaT().value()
);

// Do the mesh motion using the tetDecom solver defined in th dynamicMeshDict in constant
mesh.update();

Regards, Eric
lillberg is offline   Reply With Quote

Old   May 4, 2007, 08:13
Default Thanks, I solved the problem a
  #11
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Thanks, I solved the problem a couple of days ago. As always it turned out to be a very straightforward solution. I forgot to put some matrix inverse somewhere in my code.

So I can now start simulating a 3d flapping wing with prescribed translations (3Dofs) and rotations (3Dofs).

Regards, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   May 4, 2007, 08:44
Default Excellent, If possible, I w
  #12
Member
 
lillberg's Avatar
 
Eric Lillberg
Join Date: Mar 2009
Location: Stockholm
Posts: 80
Rep Power: 17
lillberg is on a distinguished road
Send a message via Skype™ to lillberg
Excellent,

If possible, I would like to try your code on some two-phase FSI cases that I'm playing around with.

Regards, Eric
lillberg is offline   Reply With Quote

Old   May 4, 2007, 08:57
Default Mmm, are you sure that you nee
  #13
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Mmm, are you sure that you need this, its quite simple. I only move the boundary points according to some rotation matrices with prescribed motion angles which are a function of time. So no FSI involved.

If you are still interested, drop me a mail.

Regards, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   June 12, 2007, 12:31
Default Hi Frank! Beeing enthusiast a
  #14
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Frank!
Beeing enthusiast about your work on flapping wings, I started to have a look to dynamic meshes.
At first, I used movingCone totorial inside icoDyMFoam as base example, and now I can make cube slide onto a surface, and all the mesh is readapted in a very nice way, both with 1.3 and with 1.4 version.
Now, I would like to impose a general transformation to the cube (let's say, rotating, scaling, etc...)
I don't know where to start from! I had a look to moveMesh tools, and it's very short and elegant, but a bit obscure to me.
Then, I moved to dynamicBodyFvMesh, that you yoused for your flapping wings. I looked a bit inside it, and it seems to look for some entries in the dynamicMeshDict that I can't find inside any example...

I changed my constant/dynamicMeshDict to:

solverLib "libdynamicFvMesh.so";
dynamicFvMesh dynamicBodyFvMesh;
...


But the line "dynamicFvMesh" is ignored. If I remove ite, "moveMesh" works without problems, and it still translate my cube.

Where am I wrong?
How can I use dynamicBodyFvMesh as my movement routine?
fra76 is offline   Reply With Quote

Old   June 12, 2007, 13:19
Default Hi Francesco! Very nice tha
  #15
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Hi Francesco!

Very nice that you find my work interesting! Indeed, I used dynamicBodyFvMesh to define the translational and rotational motion. In the standard dynamicBodyFvMesh you can only specify 1 freedom of translation and 1 freedom of rotation. I modified this lib, such that I am able to define a 6 DOF motion. (Remark: I did not implement a coupling between the forces and motion.)

So, you'll have to start with dynamicBodyFvMesh, where you can define your desired rotation, translation or scaling etc.....Very nice!!

Furthermore, in order to use this lib, you'll have to specify the following in dynamicMeshDict:

dynamicFvMeshLib "libtetDecompositionMotionSolver.so";
dynamicFvMesh dynamicBodyFvMesh;
dynamicBodyFvMeshCoeffs
{
bodyPatchName body_wall;
translationDirection (-1 0 0);
translationAmplitude 0;
TranslationFrequency 0.25;
initialRotationOrigin (0 0 0);
rotationAxis (1 0 0);
rotationAmplitude 0.523; //30 degrees in radians
rotationFrequency 0.25;
}

If you get this working, try moving a subset within another subset, I would be interesting :-)

Enjoy!!!

Regards, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   June 12, 2007, 13:53
Default Hi Frank! Thanks for the very
  #16
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Frank!
Thanks for the very quick reply.
I still have the same behaviuor... This is my dynamicMeshDict input file:


FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object motionProperties;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solverLib "libdynamicFvMesh.so";
twoDMotion no;
solver laplaceTetDecomposition;
diffusion quadratic patchEnhanced;
frozenDiffusion off;
distancePatches
(
cube
);

dynamicFvMeshLib "libtetDecompositionMotionSolver.so";
dynamicFvMesh dynamicBodyFvMesh;
dynamicBodyFvMeshCoeffs
{
bodyPatchName cube;
translationDirection (1 0 0);
translationAmplitude 0;
translationFrequency 1;
initialRotationOrigin (3.5 2.5 0);
rotationAxis (0 0 1.);
rotationAmplitude 0.3;
rotationFrequency 1;
}
// ************************************************** *********************** //



The problem is that moveMesh complains only for missing "solver", "solverLib", twoDMotion, diffusion, frozenDiffusion and distancePatches lines.
It completely ignores everything else...
And it's not using dynamicBodyFvMesh yet.

I guess I have to use something that activate the "dynamicFvMeshLib" option inside this dictionary...
fra76 is offline   Reply With Quote

Old   June 12, 2007, 14:51
Default Hi, I don't use: solverLi
  #17
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Hi,

I don't use:
solverLib "libdynamicFvMesh.so"

If you specify a nonexisting dynamicFvMesh, instead of dynamicBodyFvMesh, it should give the available options, including the dynamicBodyFvMesh. If not, you should recompile the dynamicFvMesh lib.

Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   June 13, 2007, 02:28
Default Thanks Frank! My mistake was
  #18
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Thanks Frank!
My mistake was using "moveMesh" instead of "moveDynamicMesh".
I can rotate the cube, at last, and I know what I have to modify in order to add mya own motion laws.
I'll play a bit with this, and I'll let you know if I'll be able to move a subset within another one.

Ciao
Francesco
fra76 is offline   Reply With Quote

Old   June 15, 2007, 02:45
Default Here I am again... After some
  #19
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Here I am again...
After some test on more complicated cases with version 1.3 dev, I would like to test my rotating and translating cube with version 1.4.
Basicly, I would like to port "dynamicBodyFvMesh" to OF 1.4, but I'm having a lot of troubles, because of tetdecompositionMotionSolver doesn't exist anymore, as the algorithm is changed.
Frank, you could recompile your modified version of "dynamicBodyFvMesh" with 1.4, am I right?
How?

Francesco
fra76 is offline   Reply With Quote

Old   June 15, 2007, 06:44
Default If it halps at all, I have por
  #20
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
If it halps at all, I have ported the dynamicBodyFvMesh and all other stuff mentioned in Zgabre already - all it needs is some time to make sure I didn't put any new bugs in...

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
3D duct bending at 90 degrees Kabo Main CFD Forum 1 October 11, 2007 04:37
Degrees of freedom NGUYEN Viet Hung FLUENT 0 July 9, 2006 19:59
1, 2 or 3 degrees of problem using 6 dof feature Manoj Kumar FLUENT 0 November 2, 2005 01:20
about the Degrees of Freedom! KEVIN FLUENT 0 March 23, 2004 08:13
180 degrees bend flow Tim Franke Main CFD Forum 0 February 1, 2000 07:28


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