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

Changing the initial Omega value in sixDoFRigidBodyMotionI.H

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2019, 03:52
Default Changing the initial Omega value in sixDoFRigidBodyMotionI.H
  #1
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 7
Magistrane is on a distinguished road
Hey Foamers,

I need your help : I am stuck for few days now : I am trying to impose an initial angular speed in my simulation using sidDoFRigidBody. I don't want to modify the physics behind equations.
This variable is representing the angular velocity in sixDoFRigidBodyMotionI.H :
Code:
inline Foam::vector Foam::sixDoFRigidBodyMotion::omega() const
{
    return  Q() & (inv(momentOfInertia_) & pi());
}
Q() and momentOfInertia are data of my problem. I think that I can't change them without changing the physics. pi() is not a constant, it is depending of time and acceleration.

Do someone has any idea to add for exemple this vector to omega (0 0 50) ?

Thanks a lot.

Best regards,

Magi
Magistrane is offline   Reply With Quote

Old   February 13, 2019, 05:40
Default
  #2
Senior Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 12
massive_turbulence is on a distinguished road
Quote:
Originally Posted by Magistrane View Post
Hey Foamers,

I need your help : I am stuck for few days now : I am trying to impose an initial angular speed in my simulation using sidDoFRigidBody. I don't want to modify the physics behind equations.
This variable is representing the angular velocity in sixDoFRigidBodyMotionI.H :
Code:
inline Foam::vector Foam::sixDoFRigidBodyMotion::omega() const
{
    return  Q() & (inv(momentOfInertia_) & pi());
}
Q() and momentOfInertia are data of my problem. I think that I can't change them without changing the physics. pi() is not a constant, it is depending of time and acceleration.

Do someone has any idea to add for exemple this vector to omega (0 0 50) ?

Thanks a lot.

Best regards,

Magi
The Q() is a tensor called here as well

Code:
inline Foam::tensor& Foam::sixDoFRigidBodyMotion::Q()
{
    return motionState_.Q();
}
https://github.com/OpenFOAM/OpenFOAM...dBodyMotionI.H

I'm not sure what it means actually, I'd have to dig deeper and the problem I'm seeing is how would you add that vector to a tensor even if you just simply tried something like adding them, and also making physical sense. I guess the diagonals of a tensor are the coordinates x,y,z? So that might be it?

momentOfInertia_ is probably a tensor as well.
massive_turbulence is offline   Reply With Quote

Old   February 13, 2019, 05:57
Default
  #3
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 7
Magistrane is on a distinguished road
Hello,

Q_ is the orientation matrice. I do not know exactly what it is but openFoam documentation recommand to get it using the surfaceInertia function. So I guess it is a geometry dependant parameter. Changing it is not really an option.

momentOfInertia could be a tensor, but its description is also geometry related...
Isn't it possible to initialize omega too (0 0 50) and then to use this formula without touching it?
Thanks !
Magistrane is offline   Reply With Quote

Old   February 13, 2019, 07:30
Default
  #4
Senior Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 12
massive_turbulence is on a distinguished road
Quote:
Originally Posted by Magistrane View Post
Hello,

Q_ is the orientation matrice. I do not know exactly what it is but openFoam documentation recommand to get it using the surfaceInertia function. So I guess it is a geometry dependant parameter. Changing it is not really an option.

momentOfInertia could be a tensor, but its description is also geometry related...
Isn't it possible to initialize omega too (0 0 50) and then to use this formula without touching it?
Thanks !
Well... the way I see it is this. You have a default constructor that takes dict files and uses those to initialize your angular velocity (omega).

Here's you constructor initializer list

Code:
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
(
    const dictionary& dict,
    const dictionary& stateDict
)
:
    motionState_(stateDict),
    motionState0_(),
    restraints_(),
    constraints_(),
    tConstraints_(tensor::I),
    rConstraints_(tensor::I),
    initialCentreOfMass_
    (
        dict.lookupOrDefault
        (
            "initialCentreOfMass",
            vector(dict.lookup("centreOfMass"))
        )
    ),
    initialCentreOfRotation_(initialCentreOfMass_),
    initialQ_
    (
        dict.lookupOrDefault
        (
            "initialOrientation",
            dict.lookupOrDefault("orientation", tensor::I)
        )
    ),
    mass_(readScalar(dict.lookup("mass"))),
    momentOfInertia_(dict.lookup("momentOfInertia")),
    aRelax_(dict.lookupOrDefault<scalar>("accelerationRelaxation", 1.0)),
    aDamp_(dict.lookupOrDefault<scalar>("accelerationDamping", 1.0)),
    report_(dict.lookupOrDefault<Switch>("report", false)),
    solver_(sixDoFSolver::New(dict.subDict("solver"), *this))
from https://github.com/OpenFOAM/OpenFOAM...idBodyMotion.C

In order to get omega(0 0 50) from that perspective is to somehow initialize the variables that are looked up in those dictionary files so that the initial state of omega is that. That's probably the best case scenario without pulling hairs trying to find a needle in a haystack going through lines of code and seeing what each line does to calculate omega and then changing that code flow to initialize omega. Or I could be wrong and there is a solution but I'm not seeing it.


EDIT:

Here's another initializer list

Code:
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
(
    const dictionary& dict
)
:
    centreOfRotation_
    (
        dict.lookupOrDefault
        (
            "centreOfRotation",
            dict.lookupOrDefault("centreOfMass", vector::zero)
        )
    ),
    Q_(dict.lookupOrDefault("orientation", tensor::I)),
    v_(dict.lookupOrDefault("velocity", vector::zero)),
    a_(dict.lookupOrDefault("acceleration", vector::zero)),
    pi_(dict.lookupOrDefault("angularMomentum", vector::zero)),
    tau_(dict.lookupOrDefault("torque", vector::zero))
{}
from sixDoFRigidBodyMotionState.C

I'm not sure where this is (what dictionary file) pi_(dict.lookupOrDefault("angularMomentum", vector::zero)), but you could maybe do

pi_(dict.lookupOrDefault("angularMomentum", omega (0 0 50))) //basically insert the vector there.
massive_turbulence is offline   Reply With Quote

Old   February 13, 2019, 07:57
Default
  #5
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 7
Magistrane is on a distinguished road
Well, I really would like to do so, I already changed the moment of inertia to create an huge acceleration at the beginning... But all of these variables are called in other functions not related to omega and it change all the physics properties behind the calcul...
The only change I can do is on Q_ (orientation) but it also has an huge impact on the simulation : this is the rotation matrice. This is physicaly a non-sens to modify this.

Only pi() could be change. I'll look into it but I think that it is time dependant, so potentially has an impact on each simulation steps.

UP : pi() contains pi0()

Quote:
pi() = rConstraints_ & aDamp_*(pi0() + 0.5*deltaT0*tau());
pi_ is define as angular momentum

Quote:
dict.add("angularMomentum", pi_);
I could change this value if I had access to it. Because angularMomentum = momentOfInertia * omega
Moment of inertia only depend of the geometry. So omega is proportional to pi_.
Magistrane is offline   Reply With Quote

Old   February 13, 2019, 08:22
Default
  #6
Senior Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 12
massive_turbulence is on a distinguished road
Quote:
Originally Posted by Magistrane View Post
Well, I really would like to do so, I already changed the moment of inertia to create an huge acceleration at the beginning... But all of these variables are called in other functions not related to omega and it change all the physics properties behind the calcul...
The only change I can do is on Q_ (orientation) but it also has an huge impact on the simulation : this is the rotation matrice. This is physicaly a non-sens to modify this.

Only pi() could be change. I'll look into it but I think that it is time dependant, so potentially has an impact on each simulation steps.

UP : pi() contains pi0()



pi_ is define as angular momentum



I could change this value if I had access to it. Because angularMomentum = momentOfInertia * omega
Moment of inertia only depend of the geometry. So omega is proportional to pi_.

Here's another interesting piece of code you should look at in
sixDoFRigidBodyMotionSolver.C

Code:
bool Foam::sixDoFRigidBodyMotionSolver::writeObject
(
    IOstream::streamFormat fmt,
    IOstream::versionNumber ver,
    IOstream::compressionType cmp,
    const bool valid
) const
{
    IOdictionary dict
    (
        IOobject
        (
            "sixDoFRigidBodyMotionState",
            mesh().time().timeName(),
            "uniform",
            mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    motion_.state().write(dict);
    return dict.regIOobject::write();
}
"sixDoFRigidBodyMotionState" is the object that looks up the dictionary but I still cannot fathom what the name of that file is. Openfoam is known for terrible documentation.
massive_turbulence is offline   Reply With Quote

Old   February 13, 2019, 08:23
Default
  #7
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 7
Magistrane is on a distinguished road
Up.
My Bad. After adding this line in the dynMeshDict:
Quote:
angularMomentum (0 0 50);
New Angular velocity is compute. I guess i have to play with this parameter.

Thanks a lot
Magistrane 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
Maximum number of iterations exceeded chtmultiregionsimpleFoam Moncef OpenFOAM Running, Solving & CFD 28 July 13, 2020 14:26
decompose dependent solution arionfard OpenFOAM 3 December 10, 2018 09:36
HeatSource BC to the whole region in chtMultiRegionHeater xsa OpenFOAM Running, Solving & CFD 3 November 7, 2016 05:07
Cannot run the code properly: very large time step continuity error crst15 OpenFOAM Running, Solving & CFD 9 December 14, 2014 18:17
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58


All times are GMT -4. The time now is 04:14.