CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problems with 3 degrees of rotation (https://www.cfd-online.com/Forums/openfoam-solving/58006-problems-3-degrees-rotation.html)

lr103476 April 20, 2007 03:43

Anyone any ideas how to solve
 
Anyone any ideas how to solve this basic problem?

Frank

lr103476 April 25, 2007 08:03

Hi everybody, Concerning th
 
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

lillberg April 25, 2007 08:25

Sorry, can't say I have. Very
 
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 April 25, 2007 08:27

Sorry! The last message is
 
Sorry!

The last message is obsolete and ended up the wrong thread

//Eric

lillberg April 25, 2007 08:45

bPoints from file pointVect
 
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

hjasak April 25, 2007 10:46

Not like that: if you do newPo
 
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

lr103476 April 26, 2007 04:59

Mmm, Hrvoje, I still don't get
 
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?

lillberg April 26, 2007 06:44

When moving the mesh with move
 
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

lr103476 April 26, 2007 07:12

Thanks Eric, I already had som
 
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

lillberg April 26, 2007 07:43

In that case try... Increme
 
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

lr103476 May 4, 2007 08:13

Thanks, I solved the problem a
 
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

lillberg May 4, 2007 08:44

Excellent, If possible, I w
 
Excellent,

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

Regards, Eric

lr103476 May 4, 2007 08:57

Mmm, are you sure that you nee
 
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

fra76 June 12, 2007 12:31

Hi Frank! Beeing enthusiast a
 
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?

lr103476 June 12, 2007 13:19

Hi Francesco! Very nice tha
 
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

fra76 June 12, 2007 13:53

Hi Frank! Thanks for the very
 
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...

lr103476 June 12, 2007 14:51

Hi, I don't use: solverLi
 
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

fra76 June 13, 2007 02:28

Thanks Frank! My mistake was
 
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 June 15, 2007 02:45

Here I am again... After some
 
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

hjasak June 15, 2007 06:44

If it halps at all, I have por
 
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

fra76 June 17, 2007 08:37

This is a good news! However,
 
This is a good news!
However, I would like to implement something like "dynamicBodyFvMesh" with the new algorithm in OF 1.4...

fra76 June 19, 2007 05:23

Hi all! In the OF 1.4 release
 
Hi all!
In the OF 1.4 release notes, regarding mesh motion, I've found: "Flexible and efficient finite volume based mesh motion solvers (replacing the finite element mesh motion solvers)."
In another post inside this forum (http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/4218) Hrvoje wrote "the cell-based diffusion equation which "replaces it" is so pathetically useless that I have abandoned it more than 10 years ago"

Can someone please explain me why the cell based method is so worse than the finite element one? Some article about both methods would help me a lot, too!

In one of my test cases, OF 1.3 fails, while the new method works better, and much faster, even if it slightly changes a fixed boundary. (Hrvoje, I think I could send you the pictures, if you're interested)

Bye
Francesco

lr103476 June 19, 2007 05:46

Just put the pictures here. I
 
Just put the pictures here. I am also interested in the new car:-)

When Hrvoje manages to put all three (finite volume, cell decomp, cellFace decomp) into one 1.4 development release, I will make a comparison using a 3D moving body, looking at accuracy and efficiency.

Frank

sek February 3, 2009 12:10

Hi Frank and others, Can yo
 
Hi Frank and others,

Can you please tell me how I can specify a dynamic pitching motion of an airfoil with 1.5? I see lots of discussion here but it's not clear whether I can do it without writing any code or not. -Thanks,

lr103476 February 3, 2009 13:55

Hi Sung-Eun Kim! Do you wan
 
Hi Sung-Eun Kim!

Do you want to describe the complete plunging pitching motion of the airfoil, or is there any fluid-structure interaction involved?

Regards, Frank

sek February 3, 2009 14:23

Hi Frank, Thanks a lot for
 
Hi Frank,

Thanks a lot for your reply.

for now I have forced oscillation (prescribed motion) in mind. After posting the question, I somehow figured out from examples I could prescribe a translational and a rotational motion on the airfoil (both are periodic) using the dynamicBodyFvMesh class as shown below.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.4 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solverLib "libdynamicFvMesh.so";

dynamicFvMesh dynamicBodyFvMesh;

dynamicBodyFvMeshCoeffs
{
bodyPatchName movingWall;
translationDirection (0 1 0);
translationAmplitude 0;
translationFrequency 1;
initialRotationOrigin (0 0 0);
rotationAxis (0 0 1);
rotationAmplitude 0.349;
rotationFrequency 10;
}

twoDMotion yes;

solver laplaceFaceDecomposition;

diffusivity quadratic;

frozenDiffusion on;

distancePatches
(
movingWall
);

And in "U" file, I set the type as "movingWallVelocity". That's all I did. The solution seems what you would expect from a dynamically pitching airfoil. Did I miss something?

Thanks,
Sung-Eun

lr103476 February 3, 2009 14:36

Hi Sun-Eun, This is exactly
 
Hi Sun-Eun,

This is exactly what I do for a complex flapping wing. In a dynamicFvMesh based class you can do whatever you like with the boundary points, so translation, rotation and/or flexing. DynamicBodyFvMesh is a class with only translation and rotating in one direction (if I am not mistaken), but you can easily extend that. Be aware that for large rotations the standard laplacian motion solver may not be good enough. In that case try the SBRStress motion solver, a small rewrite of your dynamicFvMesh class may be necessary......

Soon, we will put our Radial Basis Function motion solver in the SVN-dev repository.....

Enjoy the moving meshes!
Frank

arashfluid April 6, 2014 04:07

flapping wing FSI
 
Hi Frank and friends
I want to use icoFsiFoam in OF-1.6-ext to solve pitching and plunging motion of 3D wing problem. without FSI mode, I've applied those motions using two methods in dynamic MeshDict:1)solidBodyMotionFvMesh,2)dynamicMotionSo lverFvMesh with displacement Laplacian solver using pointDisplacement. But these methods and RBFmotion are based on finite volume,whereas icoFsi mesh motion is based on finite element.That's why I converet this solver to finite volume solver.The problem is that after running the solver,wingsolid and wingfluid,each of them moves separately and do not affect each other.
would you please tell me how I could do it with the previous finite element solver?Like the flapping console test case, with knowing the difference between these two cases, that here the plunging motion should also be applied to solid.

maryfery September 25, 2014 11:56

how to implement prescribed 3D translation and rotations in OpenFOAM 2.3?
 
it is used to be possible to do it in OF 1.6 via dynamicBodyFvMotion class but this class does not exist in 2.3 version.
also I tried to use SBRStress but i don't know how to implement the prescribed motion.
I need a function like tabulated6DoFMotionCoeffs which reads the translations and rotations from a .dat file for example.
thanks for your response in advance.

cheers;
maryam

fsifsi May 18, 2016 03:00

dynamicMeshDict
 
Hello Francesco Del Citto
Could you post your dynamicMeshDict again, please.
I get error "Selected mesh motion solver is RBFMotionSolver, instead tetMotionSolver"
when i use dynamicBodyFvMesh in OF3.1.ext
Many thanks
Quote:

Originally Posted by fra76 (Post 200898)
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



All times are GMT -4. The time now is 09:05.