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

transform in the new motion library rigidBodyMeshMotion

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By tecmul
  • 1 Post By Sachin m
  • 3 Post By tecmul

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2018, 23:46
Default transform in the new motion library rigidBodyMeshMotion
  #1
Member
 
Jiadong Wang
Join Date: Mar 2018
Location: Australia
Posts: 32
Rep Power: 8
jiadongw is on a distinguished road
Hello Foamers,

Recently, I’m trying to conduct the tutorial wingMotion with the new motion library rigidBodyMeshMotion. This tutorial originally employs the sixDoFRigidBodyMotion.

Unfortunately, the new case with rigidBodyMeshMotion has some problems. One of quite weird things is the moment of linearAxialAngularSpring has a same direction with angle, which means the axis spring accelerate the rotation instead of restraining it.
Also, I’m quite confused about the parameter ‘transform’ in dynamicMeshDict of rigidBodyMeshMotion.

I have attached the modified dynamicMeshDict (rigidBodyMeshMotion) and original dynamicMeshDict (sixDoFRigidBodyMotion) to this post.
Does anyone have the experience with this new motion library rigidBodyMeshMotion?

Any suggestions will be appreciated.

Thank you.

dynamicMeshDict of rigidBodyMeshMotion:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh      dynamicMotionSolverFvMesh;

motionSolverLibs ("libRY05rigidBodyMeshMotion.so");

motionSolver    rigidBodyMotion;

report          on;

solver
{
    type symplectic;
}

g               (0 -9.81 0);
rho             rhoInf;
rhoInf          1;

bodies
{
   wing
  {

    type            rigidBody;
    parent          root;
    centreOfMass    (0.4974612746 -0.01671895744 0.125);
    mass            22.9;
    inertia         (1.958864357 0 0 3.920839234 0 2.057121362);
    transform       (1 0 0 0 1 0 0 0 1) (0.25 0.007 0.125);
   
    joint
    {
       type   composite;
       joints
       (
            {
                 type     Py;
            }                      
            {
                 type     Rz;
            }
       );
    }

        patches         (wing);
        innerDistance   0.3;
        outerDistance   1;

  }
}

restraints
{
    verticalSpring
    {
        type            linearSpring;
        body            wing;
        anchor          (0.25 0.007 0.125);
        refAttachmentPt (0.25 0.007 0.125);
        stiffness       4000;
        damping         2;
        restLength      0;
    }

    axialSpring
    {
        type            linearAxialAngularSpring;
        body            wing;
        axis            (0 0 1);
        referenceOrientation (1 0 0 0 1 0 0 0 1);
        stiffness       700;
        damping         0.5;
    }
}


// ************************************************************************* //
dynamicMeshDict of sixDoFRigidBodyMotion:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh      dynamicMotionSolverFvMesh;

motionSolverLibs ("libtest00.so");

motionSolver    sixDoFRigidBodyMotion;

patches         (wing);
innerDistance   0.3;
outerDistance   1;

mass            22.9;
centreOfMass    (0.4974612746 -0.01671895744 0.125);
momentOfInertia (1.958864357 3.920839234 2.057121362);
orientation
(
    0.9953705935 0.09611129781 0
    -0.09611129781 0.9953705935 0
    0 0 1
);
angularMomentum (0 0 -2);
g               (0 -9.81 0);
rho             rhoInf;
rhoInf          1;
report          on;

solver
{
    type symplectic;
}

constraints
{
    yLine
    {
        sixDoFRigidBodyMotionConstraint line;
        centreOfRotation    (0.25 0.007 0.125);
        direction           (0 1 0);
    }

    zAxis
    {
        sixDoFRigidBodyMotionConstraint axis;
        axis                (0 0 1);
    }
}

restraints
{
    verticalSpring
    {
        sixDoFRigidBodyMotionRestraint linearSpring;

        anchor          (0.25 0.007 0.125);
        refAttachmentPt (0.25 0.007 0.125);
        stiffness       4000;
        damping         2;
        restLength      0;
    }

    axialSpring
    {
        sixDoFRigidBodyMotionRestraint linearAxialAngularSpring;

        axis            (0 0 1);
        stiffness       700;
        damping         0.5;
        referenceOrientation $orientation;
    }
}


// ************************************************************************* //
jiadongw is offline   Reply With Quote

Old   July 13, 2018, 23:51
Default
  #2
Member
 
Jiadong Wang
Join Date: Mar 2018
Location: Australia
Posts: 32
Rep Power: 8
jiadongw is on a distinguished road
Just ignore the name of library in both dynamicMeshDict. That’s the recompiled version without any changes except I add some output orders using Info.
jiadongw is offline   Reply With Quote

Old   July 15, 2018, 21:43
Default
  #3
Member
 
Jiadong Wang
Join Date: Mar 2018
Location: Australia
Posts: 32
Rep Power: 8
jiadongw is on a distinguished road
Any ideas?
jiadongw is offline   Reply With Quote

Old   January 25, 2020, 17:27
Default
  #4
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
I'm struggling with the same questions as OP.
In interFoam's floating object tutorial (OpenFOAM v6), there's two dynamic mesh dictionaries, one for the sixDoF library and one for the rigidBodyMotion library.

sixDoF:
Code:
centreOfMass        (0.5 0.45 0.35);
rigidBodyMotion:
Code:
centreOfMass    (0 0 0.25);
transform       (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);
Why is it defined like this?
tecmul is offline   Reply With Quote

Old   March 28, 2020, 17:20
Default
  #5
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Anyone? Any ideas?
a.morang likes this.
tecmul is offline   Reply With Quote

Old   October 12, 2020, 07:51
Default
  #6
Member
 
Sachin
Join Date: Aug 2014
Location: India
Posts: 84
Rep Power: 11
Sachin m is on a distinguished road
Any ideas??
a.morang likes this.
Sachin m is offline   Reply With Quote

Old   February 10, 2021, 15:23
Default
  #7
Member
 
Himanshu
Join Date: Jan 2017
Posts: 34
Rep Power: 9
Himanshu_Shrivastava is on a distinguished road
any ideas?..
all confused here..
Himanshu_Shrivastava is offline   Reply With Quote

Old   February 10, 2021, 16:08
Default
  #8
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
So I've been working with and testing the rigidBodyDynamics library for some time. I'm not 100% certain so take everything I say with a grain of salt, especially regarding the coordinate transform.


The tensor and vector specified under the transform keyword represent a coordinate transform from the parent frame to the local frame of the body's joint. The vector is the displacement of the origin of the local frame relative to the parent frame and the tensor is its rotation (google 3D rotation matrix). The frame of the root body is identical to the global frame. The centre of mass of a body is specified relative to its local frame. So the following dictionary from the floating object tutorial
Code:
centreOfMass    (0 0 0.25);
transform       (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);
is telling us that the origin of the local frame (the joint) of the floating body is displaced by the vector (0.5 0.45 0.1) with respect to the origin of the parent body, here the global frame. The axes of the local frame are aligned with the global frame because of the identity rotation tensor. The centre of mass is located at (0 0 0.25) relative to the local frame, or (0.5 0.45 0.35) in the global coordinate system.



About the problem with the axial spring restraint mentioned in the OP, I think the problem is with the direction of the vector "a" that the class uses to determine the sense of the applied moment. This was a while ago but if I remember correctly, rectifying the problem required only a very simple modification to the class.
Yann, marxioxyz and FloB like this.
tecmul is offline   Reply With Quote

Old   March 17, 2021, 01:06
Default Transform in dynamic mesh dict
  #9
Member
 
Sachin
Join Date: Aug 2014
Location: India
Posts: 84
Rep Power: 11
Sachin m is on a distinguished road
Quote:
Originally Posted by tecmul View Post
So I've been working with and testing the rigidBodyDynamics library for some time. I'm not 100% certain so take everything I say with a grain of salt, especially regarding the coordinate transform.


The tensor and vector specified under the transform keyword represent a coordinate transform from the parent frame to the local frame of the body's joint. The vector is the displacement of the origin of the local frame relative to the parent frame and the tensor is its rotation (google 3D rotation matrix). The frame of the root body is identical to the global frame. The centre of mass of a body is specified relative to its local frame. So the following dictionary from the floating object tutorial
Code:
centreOfMass    (0 0 0.25);
transform       (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);
is telling us that the origin of the local frame (the joint) of the floating body is displaced by the vector (0.5 0.45 0.1) with respect to the origin of the parent body, here the global frame. The axes of the local frame are aligned with the global frame because of the identity rotation tensor. The centre of mass is located at (0 0 0.25) relative to the local frame, or (0.5 0.45 0.35) in the global coordinate system.



About the problem with the axial spring restraint mentioned in the OP, I think the problem is with the direction of the vector "a" that the class uses to determine the sense of the applied moment. This was a while ago but if I remember correctly, rectifying the problem required only a very simple modification to the class.


Quote:
Originally Posted by Bloerb View Post
Yes, those can change, depending on how you constrain your part.



transform can be used to define your inertia inside a different coordinate system.

Code:
transform       (1 0 0 0 1 0 0 0 1) (2.929541 0 0.2);
The first part is the roation matrix. the second a vector by which to move it.


Hence:
1 0 0

0 1 0

0 0 1



is the unit matrix. Meaning no rotation. And (2.929541 0 0.2) is a translation by that vector. You can hence always use

Code:
transform       (1 0 0 0 1 0 0 0 1) (0 0 0);
but you need to make sure to calculate your moment of inertia correctly


https://ibb.co/tqfHZ7v
This is the image of my case set up.
It consists of a domain and two floating objects.
I have to specify center of mass and transform for both the objects.
Dimension of the bodies are Lx=0.3 , Ly=0.2 , Lz=0.5.
Iam confused on how to specify the Center of mass and transform.
As per the above quote, the center of mass has to be specified based on the local co ordinate of the body. So COM will be (0,0,0.25) for both the body, assuming the local co ordinate system to be at the bottom of either bodies.(Correct me if iam wrong)
I presume the center of rotaion to be at 0.1 m above the center of mass, Which has to be defined in the global co ordinate system (Correct me if iam wrong).
Both bodies are identical.
Domain size is (1 1 1) (-1 -1 -1).
COM for first body with respect to Global Co ordinate system is (-0.5,0.45,0.35)
COM for second body with respect to Global Co ordinate system is (0.5,0.45,0.35)
Please help me on how to specify the center of mass and transform. Iam using Openfoam V 2006.
How can we find the Local co ordinate system values using paraview?



https://ibb.co/m4Q9z90
Sketch of Domain and body.
Sachin m is offline   Reply With Quote

Old   March 17, 2021, 02:12
Default
  #10
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Quote:
Originally Posted by Sachin m View Post

I presume the center of rotaion to be at 0.1 m above the center of mass,
COM for first body with respect to Global Co ordinate system is (-0.5,0.45,0.35)
Please help me on how to specify the center of mass and transform. Iam using Openfoam V 2006.
How can we find the Local co ordinate system values using paraview?
If the centre of rotation of the body is to be 0.1 m above the centre of mass, then for the left body you would specify
Code:
centreOfMass    (0 0 -0.1);
transform       (1 0 0 0 1 0 0 0 1) (-0.5 0.45 0.45);
The centre of rotation is the origin of the local coordinate system. I hope this helps.
tecmul is offline   Reply With Quote

Old   March 17, 2021, 04:48
Default
  #11
Member
 
Sachin
Join Date: Aug 2014
Location: India
Posts: 84
Rep Power: 11
Sachin m is on a distinguished road
Quote:
Originally Posted by tecmul View Post
If the centre of rotation of the body is to be 0.1 m above the centre of mass, then for the left body you would specify
Code:
centreOfMass    (0 0 -0.1);
transform       (1 0 0 0 1 0 0 0 1) (-0.5 0.45 0.45);
The centre of rotation is the origin of the local coordinate system. I hope this helps.
How can we know the origin of local co ordinate system?
Sachin m is offline   Reply With Quote

Old   March 17, 2021, 06:46
Default
  #12
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Quote:
Originally Posted by Sachin m View Post
How can we know the origin of local co ordinate system?
The user sets the origin of the local coordinate system. Or are you asking how to monitor the origin as it moves over time?
tecmul is offline   Reply With Quote

Old   June 16, 2021, 06:44
Default
  #13
New Member
 
Florian
Join Date: Apr 2021
Posts: 8
Rep Power: 5
FloB is on a distinguished road
Hi tecmul,

Thanks for your explanations, now I understand a bit more the function "transform" in the file dynamicMeshDict.


Do you (or any other foamer) know what is the point of having a local frame different from the global frame ?

In the tutorial of interDyMFoam, I think they have to do this to precise to which point is applied the joint Py. Indeed, I think the joint Py (or Pxy, Pxyz, Pz etc...) is always applied to the origin of the local frame, which is here the point (0.5 0.45 0.1) in global frame. Therefore, it is in agreement with, the constraint fixedLine in the file "dynamicMeshDict.sixDoF" : the point (0.5 0.45 0.1) can only translate along y axis.

Am I right ? Are there others points to set a different local frame ?


Moreover, why do we have to work with these two files (dynamicMeshDict and dynamicMeshDict.sixDoF) whereas most information are redundant between them ?

I think that dynamicMeshDict is dedicated to the mesh of the cuboid whereas the other file is dedicated to rest of the mesh but I'm not sure...
FloB is offline   Reply With Quote

Old   June 16, 2021, 10:00
Default
  #14
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Hello Florian, glad I could help.
I don't know the answer to your first question, but if I had to guess I'd say it's something to do with Roy Featherstone's algorithm. The rigid body dynamics library is based on his work and mirrors its logic.
The two dynamic mesh dictionary files are for use with the two rigid body dynamics libraries currently available in OpenFoam. The former file is for use with the rigidBodyDynamics library, the latter for sixDoF.
See 212949-flow-induced-3d-motion-openfoam.html#post719121 for a post on the differences between the two libraries.
tecmul is offline   Reply With Quote

Old   June 17, 2021, 04:55
Default
  #15
New Member
 
Florian
Join Date: Apr 2021
Posts: 8
Rep Power: 5
FloB is on a distinguished road
Quote:
Originally Posted by tecmul View Post
Hello Florian, glad I could help.
I don't know the answer to your first question, but if I had to guess I'd say it's something to do with Roy Featherstone's algorithm. The rigid body dynamics library is based on his work and mirrors its logic.
The two dynamic mesh dictionary files are for use with the two rigid body dynamics libraries currently available in OpenFoam. The former file is for use with the rigidBodyDynamics library, the latter for sixDoF.
See 212949-flow-induced-3d-motion-openfoam.html#post719121 for a post on the differences between the two libraries.
Hi tecmul, thank you very much for your quick answer.

I have a question about this sentence :

Quote:
These are nearly identical, however the rigidBodyDynamics library can solve for more than one rigid body. The sixDoFRigidBodyMotion on the other hand can be used as a boundary condition for every mesh motion solver
When he says that the sixDoFRigidBodyMotion can be used as a boundary condition, is it not also the case for the rigidBodyDynamics library ?
Moreover what is mesh motion solver ? Is it the solver mentionned like this :

solver
{
type Newmark;
}

so it would mean that the sixDoFRigidBodyMotion can be solved with Newmark, Crank-Nicolson and Symplectic (which is confirmed here https://openfoamwiki.net/index.php/P...onSolverFvMesh) but for rigidBodyDynamics, less solvers can be used ? (there is at least Newmark according to the tutorial)


Another question :

Do you know why no inertia is mentionned in the tutorial using rigidBodyMeshMotion library ? I tried to add diagonal coefficients, but it does not change the results..


Thanks in advance,

Florian
FloB is offline   Reply With Quote

Old   July 3, 2021, 05:51
Default
  #16
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Quote:
Originally Posted by FloB View Post
When he says that the sixDoFRigidBodyMotion can be used as a boundary condition, is it not also the case for the rigidBodyDynamics library ?
No, it isn't; and besides, the ability to use the sixDoFRigidBodyMotion as a boundary condition was removed from OpenFoam 5 onwards. See this for a discussion that might be helpful.

Quote:
Originally Posted by FloB View Post
Moreover what is mesh motion solver ? Is it the solver mentionned like this :

solver
{
type Newmark;
}
The Newmark solver solves for the position of the rigid body from its acceleration. Each solver uses a particular integration scheme. Once the rigid body has moved, then the fluid mesh around it must also be displaced. How this is done depends on the mesh motion solver.

Quote:
Originally Posted by FloB View Post
Do you know why no inertia is mentionned in the tutorial using rigidBodyMeshMotion library ? I tried to add diagonal coefficients, but it does not change the results..
If you mean the floating object tutorial, then that's because the library is calculating the moment of inertia for you. It can do this because the shape (type->cuboid), dimensions and density of the floating body have been specified.
tecmul is offline   Reply With Quote

Old   July 10, 2021, 11:42
Default
  #17
Member
 
Himanshu
Join Date: Jan 2017
Posts: 34
Rep Power: 9
Himanshu_Shrivastava is on a distinguished road
Quote:
Originally Posted by tecmul View Post
So I've been working with and testing the rigidBodyDynamics library for some time. I'm not 100% certain so take everything I say with a grain of salt, especially regarding the coordinate transform.


The tensor and vector specified under the transform keyword represent a coordinate transform from the parent frame to the local frame of the body's joint. The vector is the displacement of the origin of the local frame relative to the parent frame and the tensor is its rotation (google 3D rotation matrix). The frame of the root body is identical to the global frame. The centre of mass of a body is specified relative to its local frame. So the following dictionary from the floating object tutorial
Code:
centreOfMass    (0 0 0.25);
transform       (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);
is telling us that the origin of the local frame (the joint) of the floating body is displaced by the vector (0.5 0.45 0.1) with respect to the origin of the parent body, here the global frame. The axes of the local frame are aligned with the global frame because of the identity rotation tensor. The centre of mass is located at (0 0 0.25) relative to the local frame, or (0.5 0.45 0.35) in the global coordinate system.



About the problem with the axial spring restraint mentioned in the OP, I think the problem is with the direction of the vector "a" that the class uses to determine the sense of the applied moment. This was a while ago but if I remember correctly, rectifying the problem required only a very simple modification to the class.
Hello tecMul,

Thank you for sharing your knowledge. what ever you said , i was able to make sense from tutorial "multiphase\interFoam\RAS\floatingObject".
when i check thoroughly the result, what ever you said the relation of COM and vector (in transform)....
but, when I saw tutorial "multiphase\overInterDyMFoam\boatAndPropeller" , then in dynamicMeshDict, its written as:

centreOfMass (-0.2847 0.03 0); // Relative to parent CoM
mass 0.0288;
inertia (7.6e-6 0 0 4.2e-6 0 4.2e-6);
// transform and CoR - relative to parent CoR
transform (1 0 0 0 1 0 0 0 1) (-0.2757 0.03 0);

i.e. COM w.r.t parent COM and COR w.r.t parent COR..

is this because in "multiphase\overInterDyMFoam\boatAndPropeller" , we have multi rigid connected bodies?

Thank You
Himanshu_Shrivastava is offline   Reply With Quote

Old   September 14, 2021, 07:02
Default
  #18
Member
 
Join Date: Sep 2018
Posts: 53
Rep Power: 7
tecmul is on a distinguished road
Yes the boat and propeller tutorial confused me as well. I think the comment is wrong here because I've run tests of double pendulums and the centre of mass does indeed seem to be specified relative to the body's own joint, not the parent's centre of mass. But again, I'm not 100% sure.
tecmul is offline   Reply With Quote

Reply

Tags
rigid body motion, transform, wing motion


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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
How to use "translation" in solidBodyMotionFunction in OpenFOAM rupesh_w OpenFOAM Running, Solving & CFD 5 August 16, 2016 04:27
External management of solid motion (using dynamicmesh) maxou1993 Main CFD Forum 0 July 28, 2015 11:37
decomposePar is missing a library whk1992 OpenFOAM Pre-Processing 8 March 7, 2015 07:53
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20


All times are GMT -4. The time now is 13:15.