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

Custom boundary condition rotation angle access

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2022, 14:23
Post Custom boundary condition rotation angle access
  #1
New Member
 
Adrian del Ser
Join Date: Oct 2021
Posts: 15
Rep Power: 5
adrian.delser is on a distinguished road
Hi everyone,


I'm trying to create a custom codedFixedValue boundary condition that depends on the angle of rotation and angular velocity of a rotating rigid body. The motion solver is sixDoFRigidBodyMotion.



Inside controlDict, one can add the following code to print out this data:



Code:
functions
{
    sixDoFRigidBodyState
    {
        type           sixDoFRigidBodyState;
        libs           ("libsixDoFRigidBodyState.so");
        angleFormat    degrees;
    }
}
How could I access (during runtime of course) the rotation rate/rotation angle or other data contained in sixDoFRigidBodyState as variables to code into the codedFixedValue boundary condition? I have tried to follow the class tree without success.



I have found this code which gets access to db() or patch() to set a sinusoidal boundary condition in space, but I am not sure how to get to sixDoFRigidBodyState and the values it contains:


Code:
codedPatch
    {
        type            codedFixedValue;
        value           uniform 0;


        name    codedPatchBC;   // name of generated BC

        code
        #{
        //const scalar t = this -> db().time().value();
        const scalar pi = constant::mathematical::pi; 
        const fvPatch& patch = this -> patch();
        const vectorField& cf = patch.Cf();         
        const scalar l = 0.1;
        scalarField& field = *this;
        forAll(cf, i)
        {
            field[i] = 273+100*sin((2*pi/l)*cf[i].x());
        }
        #};
Thanks,


Adrian
adrian.delser is offline   Reply With Quote

Old   February 12, 2022, 04:11
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
From this file it seems you have to access the motion solver
https://develop.openfoam.com/Develop...gidBodyState.C

The the function motion() returns the motion state

Best

Michael
mAlletto is offline   Reply With Quote

Old   February 12, 2022, 04:17
Default
  #3
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Probably you have to write this lines in your function object

Code:
. const sixDoFRigidBodyMotionSolver& motionSolver_ =
        refCast<const sixDoFRigidBodyMotionSolver>(mesh.motion());

    const sixDoFRigidBodyMotion& motion = motionSolver_.motion();
mAlletto is offline   Reply With Quote

Old   February 17, 2022, 05:11
Default
  #4
New Member
 
Adrian del Ser
Join Date: Oct 2021
Posts: 15
Rep Power: 5
adrian.delser is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
Probably you have to write this lines in your function object

Code:
. const sixDoFRigidBodyMotionSolver& motionSolver_ =
        refCast<const sixDoFRigidBodyMotionSolver>(mesh.motion());

    const sixDoFRigidBodyMotion& motion = motionSolver_.motion();

Thanks! I'll be testing this soon, is this something you can put directly in the code block of the custom boundary condition?
adrian.delser is offline   Reply With Quote

Old   February 17, 2022, 13:09
Default
  #5
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Yes yes. You have to access the value at the boundary
mAlletto is offline   Reply With Quote

Reply

Tags
boundary condition, codedfixedvalue, sixdofrigidbodymotion


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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Constant mass flow rate boundary condition sahm OpenFOAM 0 June 20, 2018 23:45
Constant contact angle boundary condition sdeb31 FLUENT 0 January 12, 2018 13:13
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 06:15
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 07:49


All times are GMT -4. The time now is 16:58.