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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

motionSolverLibs    ("librigidBodyMeshMotion.so");

dynamicFvMesh       dynamicOversetFvMesh;

motionSolver        rigidBodyMotion;

// rigidBodyMotionCoeffs  - not needed any more
//  {
    report          on;

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

    accelerationRelaxation 0.4;

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

    bodies
    {
        hull
        {
            type            rigidBody;
            parent          root;

            // To get Tensor of Inertia (symmetrical) use surfaceInertia
            // here hull is empty shell

            mass            0.552;
            inertia            (0.0033 0 0 0.01 0 0.0095);
            centreOfMass    (0.2857 -0.07 0); // relative to the centreOfMass
                                            // of parent body
                                            // (here root = global coord system)

            // Transformation tensor and centre of rotation (CoR)
            transform       (1 0 0 0 1 0 0 0 1) (0.2857 -0.07 0);

            joint
            {
            // These constrains are applied only to body hull,
            // other bodies need to have their own set
            // Constraints used for faster run

                type            composite;
                joints
                (
                    {
                        type Px;  // Allow translation in X -
                    }
                    {
                        type Ry;  // Allow rotation along Y axis
                                  // (local - body CS)
                    }
                );
            }

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

        propeller
        {

            type            rigidBody;
            parent          hull;

            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);
            patches        (propellerWall);
            innerDistance   100;
            outerDistance   200;
            joint
            {
                type            Rx;
            }
        }

        rudder
        {
            type            rigidBody;
            parent          hull;
            centreOfMass    (-0.3602 -0.0055 0);
            mass            0.0746;
            inertia         (3.3e-5 0 0 4.7e-6 0 3.4e-5);
            // transform and CoR - relative to parent CoR
            transform       (1 0 0 0 1 0 0 0 1) (-0.3487 -0.04 0);
            patches        (rudderWall);
            innerDistance   100;
            outerDistance   200;
            joint
            {
                type            Ry;
            }
        }
    }

    restraints
    {
        rudderRotation
        {
            type                    prescribedRotation;
            body                    rudder;
            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);
            }
        }
        propellerRotation
        {
            type                    prescribedRotation;
            body                    propeller;
            referenceOrientation    (1 0 0 0 1 0 0 0 1);
            axis                    (1 0 0);
            omega                   table
            (
                (0 (0 0 0))
                (1 (16 0 0))
            );
        }
    }

//  } // end of rigidBodyMotionCoeffs


// ************************************************************************* //
