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/)
-   -   UDF for planetary motion (https://www.cfd-online.com/Forums/openfoam-solving/208091-udf-planetary-motion.html)

Ansh October 9, 2018 01:08

UDF for planetary motion
 
Hello everyone, iam new to openfoam and for my project i need to describe planetary motion for two blades around one center blade. iam using overPimpleDyMFoam so can anyone point out the right direction to achieve this:confused:. Where and how to write UDF?
And how to link it with my present solver?
thanks

wyldckat October 13, 2018 06:54

Greetings Ansh and welcome to the forum,

No UDF should be necessary. Since you are likely using OpenfOAM-v1806, please study the respective OpenFOAM Tutorial Guide: https://www.openfoam.com/documentation/tutorial-guide/ - this will give you a better basis on how to get things to work.

Then once you are more familiar with how OpenFOAM works, check the tutorial case "tutorials/multiphase/overInterDyMFoam/boatAndPropeller/" and in the file "constant/dynamicMeshDict" you will start to see how the moving parts are defined...

Best regards,
Bruno

Ansh October 15, 2018 02:36

thanks for quick reply, i have started looking into mentioned tutorials. after adjusting that dynamicmeshdict according to my need iam getting following error:confused:


--> FOAM FATAL ERROR:
Could not find rho:rho

From function void Foam::functionObjects::forces::initialise()
in file forces/forces.C at line 204.

FOAM exiting


i have found other threads related to this bug and i have changed my rhoName to rho as you mentioned there still iam getting this error. Any suggestions


function for force in controldict:


functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so");
writeControl timeStep;
writeInterval 5;
patches (hole1);
rho rhoInf;

rhoInf 1;
CofR (0 0 0);
p p;
U U;
log yes;
verbose true;
}
}

wyldckat October 20, 2018 15:35

Quick answer: Details, details, details... I need details... Please check the following thread for more information on how to provide mode details: https://www.cfd-online.com/Forums/op...-get-help.html

Because my best guess right now is that you've used the wrong command to start the simulation... :(
What I mean is that the "rho" field should exist when the solver starts running... so if it doesn't exist, then it might mean that you've tried using it with the wrong application.

Ansh October 22, 2018 01:17

overPimpleDymFoam rigid body motion rho not found
 
1 Attachment(s)
iam intending to use rigid body motion in overPimpleDyMFoam since i want to give planetary motion to the blades (fig is attached) Attachment 66213
where outer two blades will rotate and revolve arround the centre blade.


I have followed the overInterDyMFoam from multiphase flow to achieve that motion
iam attaching my conrolDict,forceCoeffs and dynamicMeshDict for reference



dynamicMeshDict


Code:

motionSolverLibs    ("librigidBodyMeshMotion.so");

dynamicFvMesh      dynamicOversetFvMesh;

//dynamicOversetFvMeshCoeffs
//{
//    layerRelax 0.3;
//}

motionSolver          rigidBodyMotion;

solver
    {
        type Newmark;
        gamma  0.1;    // Velocity integration coefficient
        beta    0.1;    // Position integration coefficient
    }

    accelerationRelaxation 1.0;

    //- prescribedRotation requires some sub-iterations to converge faster
    //  to desired value.
    nIter  3;

bodies
    {
        movingzone2
        {
            type            rigidBody;
            parent          root;

            // Cuboid mass -- very simple setup. For more complicated shapes
            // see utility surfaceInertia
            mass            9;
            rho            1;
            inertia        (0.05 0 0 0.05 0 0.05);
            centreOfMass    (0.21 -0.07 0); // relative to the centreOfMass
                                            // of parent body
                                            // (here root = global coord system)

            // Transformation tensor and centre of rotation
            transform      (1 0 0 0 1 0 0 0 1) (0.21 0 0);

            joint
            {
                type            composite;
                joints
                (
                    {
                        type Pxyz;  // Allow movement in any direction
                    }
                    {
                        type Rxyz;  // Allow rotation along any axis
                                    // (local - body CS)
                    }
                );
            }

            patches        (hole2);
            innerDistance  100;    // With overset we want to avoid the mesh
                                    // deformation so have large innerDistance
            outerDistance  200;
        } // end hull

        movingzone1
        {

            type            rigidBody;
            parent          movingzone2;

            centreOfMass    (-0.228 0.0 0);
            mass            1;
            rho            1;
            inertia        (0.001 0 0 0.001 0 0.001);
            transform      (1 0 0 0 1 0 0 0 1) (-0.228 0 0);
            patches        (hole1);
            innerDistance  100;
            outerDistance  200;
            joint
            {
                type            Rx;
            }
        } //end propeller

        movingzone3
        {
            type            rigidBody;
            parent          movingzone2;//root;
            centreOfMass    (-0.265 0 0);
            mass            1;
            rho            1;
            inertia        (0.001 0 0 0.001 0 0.001);
            transform      (1 0 0 0 1 0 0 0 1) (-0.265 0 0);
            patches        (hole3);
            innerDistance  100;
            outerDistance  200;
            joint
            {
                type            Ry;
            }
        }
        solid-background
        {
            type            rigidBody;
            parent          movingzone2;//root;
            centreOfMass    (-0.265 0 0);
            mass            1;
            rho            1;
            inertia        (0.001 0 0 0.001 0 0.001);
            transform      (1 0 0 0 1 0 0 0 1) (-0.265 0 0);
            patches        (hole3);
            innerDistance  100;
            outerDistance  200;
            joint
            {
                type            Ry;
            }
        }
    }

    restraints
    {
        movingzone1Rotation
        {
            type                    prescribedRotation;
            body                    movingzone1;
            referenceOrientation    (1 0 0 0 1 0 0 0 1);
            axis                    (0 1 0);    // Axis of rotation
            omega                  sine;      // Function1 entry
            omegaCoeffs
            {
                frequency  4;
                amplitude  0.2;
                scale      (0 1 0);
                level      (0 1 0);
            }
        }
        movingzone3Rotation
        {
            type                    prescribedRotation;
            body                    movingzone3;
            referenceOrientation    (1 0 0 0 1 0 0 0 1);
            axis                    (1 0 0);
            omega                  table
            (
                (0 (0 0 0))
                (1 (16 0 0))
            );
        }
    }
}




controlDict


Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs            ("liboverset.so" "librigidBodyDynamics.so");

application    overPimpleDyMFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        5;

deltaT          0.0000000025;

writeControl    adjustableRunTime;

writeInterval  0.005;

purgeWrite      0;

writeFormat    binary;

writePrecision  10;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable true;

adjustTimeStep  yes;

//maxCo          1;
maxCo          5.0;
maxAlphaCo      5.0;
maxDeltaT      1;


functions
{
    #include "forceCoeffs"
}


forceCoeffs


Code:

forceCoeffs
{
   

    functionObjectLibs      ("libforces.so");

    writeControl    timeStep;
    timeInterval    1;

    patches        (walls);
    rho        rhoInf;      // Indicates incompressible
    rhoInf      1;
    p          p;
    U          U;
    // Redundant for incompressible
    liftDir        (0 0 1);
    dragDir        (1 0 0);
    CofR            (0 0 0);  // Axle midpoint on ground
    pitchAxis      (0 1 0);
    magUInf        20;
    lRef            1.42;        // Wheelbase length
    Aref            0.75;        // Estimated
    /*
    binData
    {
        nBin        20;          // output data into 20 bins
        direction  (1 0 0);    // bin direction
        cumulative  yes;
    }
    */
}


and error that iam getting



Code:

Creating interpolatedCells field

Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar
Selecting laminar stress model Stokes
Reading/calculating face velocity Uf

No MRF models present

No finite volume options present
Courant Number mean: 0 max: 0

Starting time loop

Courant Number mean: 0 max: 0
deltaT = 2.9999994e-09
Time = 3e-09

forces forces:
    Not including porosity effects



--> FOAM FATAL ERROR:
Could not find rho:rho

    From function void Foam::functionObjects::forces::initialise()
    in file forces/forces.C at line 204.

FOAM exiting






Quote:

What I mean is that the "rho" field should exist when the solver starts running... so if it doesn't exist, then it might mean that you've tried using it with the wrong application

1)does that mean i cannot use rigid body motion with overPimpleDyMFoam(since while using it only i have started facing this error )


2)can anyone recommend any literature available related to this?
pardon my immaturity with openfoam:o

wyldckat October 27, 2018 13:14

Quick answers:

1. I've tested with OpenFOAM-v1806 as a Docker image. I used the tutorial case "incompressible/overPimpleDyMFoam/twoSimpleRotors" as a basis and did the modifications that you mentioned to the controlDict file, namely:
  1. Added the entry for "forceCoeffs" in the "functions"...
  2. And created the file "system/forceCoeffs", although I had to add this line in order for it to work:
    Code:

        type forceCoeffs;
    namely having the content of the file like this:
    Code:

    forceCoeffs
    {

        type forceCoeffs;
        functionObjectLibs      ("libforces.so");

        writeControl    timeStep;
        timeInterval    1;

        patches        (walls);
        rho        rhoInf;      // Indicates incompressible
        rhoInf      1;
        p          p;
        U          U;
        // Redundant for incompressible
        liftDir        (0 0 1);
        dragDir        (1 0 0);
        CofR            (0 0 0);  // Axle midpoint on ground
        pitchAxis      (0 1 0);
        magUInf        20;
        lRef            1.42;        // Wheelbase length
        Aref            0.75;        // Estimated
        /*
        binData
        {
            nBin        20;          // output data into 20 bins
            direction  (1 0 0);    // bin direction
            cumulative  yes;
        }
        */
    }

Then I run the solver and everything works just fine, namely it will make the calculations while it is simulating.


It also worked when I ran the solver with the "-postProcess" option, after I had a few time steps already written to disk:
Code:

overPimpleDyMFoam -postProcess

Mmmmm... this sounds like either a bug or some detail is missing for that type of rigid body motion... You may want to report this at http://develop.openfoam.com/ - although you may need to provide a simple test case, so that it's easier to reproduce the problem and fix it.




2. The documentation provided here: https://www.openfoam.com/documentation/ - should already have a considerable amount of information... check the "Extended Code Guide" page for more details, although it may be a bit confusing at first to navigate there.


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