From 6e6ae853b5793dab6276d6a6ca6c9ca08042ca10 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 14 Jun 2018 13:45:49 +0100
Subject: [PATCH] ENH: prescribedRotation: improvements to testcase. See #872.

---
 .../boatAndPropeller/0.orig/U                 |   6 -
 .../boatAndPropeller/constant/dynamicMeshDict |  33 +++--
 .../boatAndPropeller/system/fvSchemes         |   5 +-
 .../boatAndPropeller/system/fvSchemes_VOF     |  69 ---------
 .../boatAndPropeller/system/fvSolution        |  18 ++-
 .../boatAndPropeller/system/refineMeshDict    |   6 -
 .../boatAndPropeller/system/topoSetDictHull   |   5 -
 .../system/topoSetDictHull_pokus              | 109 ---------------
 .../system/topoSetDictPropeller               | 130 +----------------
 .../boatAndPropeller/system/topoSetDictRefine |   5 -
 .../boatAndPropeller/system/topoSetDictRudder | 131 ------------------
 11 files changed, 41 insertions(+), 476 deletions(-)
 delete mode 100644 tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes_VOF
 delete mode 100644 tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull_pokus

diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/0.orig/U b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/0.orig/U
index 6b03790013a..8b31b52533d 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/0.orig/U
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/0.orig/U
@@ -41,12 +41,6 @@ boundaryField
        value           uniform (0 0 0);
    }
 
-//
-//    right1
-//    {
-//        type            zeroGradient;   //calculated;
-//        value           $internalField;
-//    }
 
     "overset.*"
     {
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/constant/dynamicMeshDict b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/constant/dynamicMeshDict
index 4142814ded2..1eb61449926 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/constant/dynamicMeshDict
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/constant/dynamicMeshDict
@@ -21,7 +21,7 @@ dynamicFvMesh       dynamicOversetFvMesh;
 
 motionSolver        rigidBodyMotion;
 
-// rigidBodyMotionCoeffs
+// rigidBodyMotionCoeffs  - not needed any more
 //  {
     report          on;
 
@@ -45,11 +45,16 @@ motionSolver        rigidBodyMotion;
             type            rigidBody;
             parent          root;
 
-            // Cuboid mass
+            // 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);
+            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
@@ -58,16 +63,18 @@ motionSolver        rigidBodyMotion;
                 joints
                 (
                     {
-                        type Pxyz;
+                        type Pxyz;  // Allow movement in any direction
                     }
                     {
-                        type Rxyz;
+                        type Rxyz;  // Allow rotation along any axis
+                                    // (local - body CS)
                     }
                 );
             }
 
             patches         (hullWall);
-            innerDistance   100;
+            innerDistance   100;    // With overset we want to avoid the mesh
+                                    // deformation so have large innerDistance
             outerDistance   200;
         } // end hull
 
@@ -117,8 +124,15 @@ motionSolver        rigidBodyMotion;
             type                    prescribedRotation;
             body                    rudder;
             referenceOrientation    (1 0 0 0 1 0 0 0 1);
-            axis                    (0 1 0);
-            omega                   (0 26 0);
+            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
         {
@@ -128,7 +142,8 @@ motionSolver        rigidBodyMotion;
             axis                    (1 0 0);
             omega                   table
             (
-                (0 (16 0 0))
+                (0 (0 0 0))
+                (1 (16 0 0))
             );
         }
     }
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes
index eca84fbcc59..548fc28ad0d 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes
@@ -56,6 +56,7 @@ oversetInterpolation
 {
     method          inverseDistance;
 }
+
 oversetInterpolationRequired
 {
     alpha.water;
@@ -63,10 +64,6 @@ oversetInterpolationRequired
 
 fluxRequired
 {
-//    default         no;
-    // p_rgh;
-    // pcorr;
-    // alpha.water;
 }
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes_VOF b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes_VOF
deleted file mode 100644
index ebf1e23fe56..00000000000
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSchemes_VOF
+++ /dev/null
@@ -1,69 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    object      fvSchemes;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-ddtSchemes
-{
-    default         Euler;
-}
-
-gradSchemes
-{
-    default         Gauss linear;
-}
-
-divSchemes
-{
-    div(rhoPhi,U)   Gauss limitedLinearV 1;
-    div(U)          Gauss linear;
-    div(phi,alpha)  Gauss vanLeer;
-    div(phirb,alpha) Gauss linear;
-    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
-
-    div(phi,k)      Gauss upwind;
-    div(phi,epsilon) Gauss upwind;
-    div(phi,omega) Gauss upwind;
-}
-
-laplacianSchemes
-{
-    default         Gauss linear corrected;
-}
-
-interpolationSchemes
-{
-    default         linear;
-}
-
-snGradSchemes
-{
-    default         corrected;
-}
-
-oversetInterpolation
-{
-    method          inverseDistance;
-}
-
-fluxRequired
-{
-    default         no;
-    p;
-  //  p_rgh;
-  //  pcorr;
- //   alpha.water;
-}
-
-// ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSolution b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSolution
index 62ccc0aba4b..8de90006795 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSolution
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/fvSolution
@@ -59,6 +59,12 @@ solvers
         tolerance       1e-9;
         relTol          0.01;
     }
+
+    Phi
+    {
+        $p_rgh;
+    }
+
     p_rghFinal
     {
         $p_rgh;
@@ -82,9 +88,9 @@ PIMPLE
     nCorrectors         2;
     nNonOrthogonalCorrectors 0;
 
-    ddtCorr                     yes;
-    correctPhi                 no;
-    massFluxInterpolation      no;
+    ddtCorr                 yes;
+    correctPhi              no;
+    massFluxInterpolation   no;
 
     moveMeshOuterCorrectors no;
     turbOnFinalIterOnly no;
@@ -92,6 +98,12 @@ PIMPLE
     oversetAdjustPhi    no;
 
 }
+potentialFlow
+{
+    nNonOrthogonalCorrectors    2;
+    PhiRefCell                  0;
+    PhiRefValue                 0;
+}
 
 relaxationFactors
 {
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/refineMeshDict b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/refineMeshDict
index ad4d6be563a..143f66f1b49 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/refineMeshDict
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/refineMeshDict
@@ -24,12 +24,6 @@ globalCoeffs
     tan1            (1 0 0);
     tan2            (0 1 0);
 }
-/*
-patchLocalCoeffs
-{
-    patch           outside;
-    tan1            (1 0 0);
-}*/
 
 directions      ( tan1 tan2 );
 
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
index 356b4a37b5a..1821edd138f 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
@@ -18,7 +18,6 @@ actions
 (
     {
       name    bgr0;       // all around bgr
-  //    set     hullBox0set;
       type    cellSet;
       action  new;
       source  zoneToCell;
@@ -80,9 +79,6 @@ actions
             boxes
             (
                  (0.05 -0.082 -0.1)(0.52 0.052 0.1) //hullBox
-            //      (0 -1 -1)(5 1 1) //hullBox
-            //     (-0.02 -0.05 -0.03)( -0.01 0.05 0.03) //propeller
-            //     (-0.08 -0.08 -0.03)(-0.06 0.08 0.03) //rudder
             );
         }
     }
@@ -132,7 +128,6 @@ actions
             set bgr0;
         }
     }
-
 );
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull_pokus b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull_pokus
deleted file mode 100644
index 185f61ad9cd..00000000000
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull_pokus
+++ /dev/null
@@ -1,109 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus-overset                          |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    object      topoSetDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-actions
-(
-    {
-        name    hullBox0;       // all around bgr
-        type    cellSet;
-        action  new;
-        source  regionToCell;
-        sourceInfo
-        {
-            insidePoints ((0.3 0.001 0.001));
-        }
-    }
-
-
-
-    // Select box to remove from region 1 and 2
-
-    // {
-    //     name    box; //all but hullBox0 region
-    //     type    cellSet;
-    //     action  new;
-    //     source  cellToCell;
-    //     sourceInfo
-    //     {
-    //         set c0;
-    //     }
-    // }
-
-    {
-        name    box; // all cells including hullBox0
-        type    cellSet;
-        action  new; // was: add;
-        source  cellToCell;
-        sourceInfo
-        {
-            set hullBox0;
-        }
-    }
-
-
-    {
-        name    box;
-        type    cellSet;
-        action  subset;
-        source  boxToCell;
-        sourceInfo
-        {
-            boxes
-            (
-                 (0.0501 -0.1 -0.1)(0.5 0.1 0.1) //hullBox
-            //      (0 -1 -1)(5 1 1) //hullBox
-            //     (-0.02 -0.05 -0.03)( -0.01 0.05 0.03) //propeller
-            //     (-0.08 -0.08 -0.03)(-0.06 0.08 0.03) //rudder
-            );
-        }
-    }
-
-    {
-        name    box;
-        type    cellSet;
-        action  invert;
-    }
-
-    {
-        name    c0;            //copy
-        type    cellSet;
-        action  new;
-        source  cellToCell;
-        sourceInfo
-        {
-            set hullBox0;
-        }
-    }
-
-    {
-        name    c0;          //all cells but hullBox0 region
-        type    cellSet;
-        action  invert;
-    }
-    {
-        name    box; // all cells including hullBox0
-        type    cellSet;
-        action  add;
-        source  cellToCell;
-        sourceInfo
-        {
-            set c0;
-        }
-    }
-
-);
-
-// ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
index e16c649d14a..bd2980e1ff5 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
@@ -18,7 +18,6 @@ actions
 (
     {
       name    bgr0;       // all around bgr
-  //    set     hullBox0set;
       type    cellSet;
       action  new;
       source  zoneToCell;
@@ -79,9 +78,7 @@ actions
         {
             boxes
             (
-            //     (0.15 -0.1 -0.1)(0.5 0.1 0.1) //hullBox
             (-0.0199 -0.0499 -0.0499)( -0.00998 0.0499 0.0499) //propeller
-          //  (-0.10 -0.0749 -0.00499)(-0.050 0.0749 0.00499) //rudder
             );
         }
     }
@@ -131,131 +128,6 @@ actions
             set bgr0;
         }
     }
-
 );
 
-
-// /*--------------------------------*- C++ -*----------------------------------*\
-// | =========                 |                                                 |
-// | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-// |  \\    /   O peration     | Version:  plus-overset                          |
-// |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-// |    \\/     M anipulation  |                                                 |
-// \*---------------------------------------------------------------------------*/
-// FoamFile
-// {
-//     version     2.0;
-//     format      ascii;
-//     class       dictionary;
-//     object      topoSetDict;
-// }
-// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//
-// actions
-// (
-//     {
-//         name    propeller0;       // all around bgr
-//         type    cellSet;
-//         action  new;
-//         source  zoneToCell;
-//         sourceInfo
-//         {
-//             name propeller;
-//           //  insidePoints ((-0.02 0.0001 0.0001));
-//         }
-//     }
-//     {
-//         name    c0;            //copy
-//         type    cellSet;
-//         action  new;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set propeller0;
-//         }
-//     }
-//
-//     {
-//         name    c0;          //all around hullBox0
-//         type    cellSet;
-//         action  invert;
-//     }
-//
-// /*
-//
-//     {
-//         name    c1;
-//         type    cellSet;
-//         action  new;
-//         source  regionsToCell;
-//         sourceInfo
-//         {
-//             insidePoints ((-0.01 0.0 0.0));
-//             set          c0;
-//         }
-//     }
-//
-//
-//
-//
-//
-//    {
-//         name    c1;
-//         type    cellSet;
-//         action  delete;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set c2;
-//         }
-//     }
-// */
-//     // Select box to remove from region 1 and 2
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  new;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set c0;
-//         }
-//     }
-//
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  add;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set propeller0;
-//         }
-//     }
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  subset;
-//         source  boxToCell;
-//         sourceInfo
-//         {
-//             boxes
-//             (
-//             //     (0 -0.1 -0.1)(0.5 0.1 0.1) //hullBox
-//                  (-0.0199 -0.0499 -0.0499)( -0.00998 0.0499 0.0499) //propeller
-//             //     (-0.08 -0.08 -0.03)(-0.06 0.08 0.03) //rudder
-//             );
-//         }
-//     }
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  invert;
-//     }
-// );
-//
-// // ************************************************************************* //
+// ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRefine b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRefine
index 17762d7c77f..dfa821e7c82 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRefine
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRefine
@@ -16,7 +16,6 @@ FoamFile
 
 actions
 (
-
     {
         name    refineSet;
         type    cellSet;
@@ -27,13 +26,9 @@ actions
             boxes
             (
                 (-0.2 -0.2 -0.2)(0.0 0.2 0.2) //hullBox
-            //      (0 -1 -1)(5 1 1) //hullBox
-            //     (-0.02 -0.05 -0.03)( -0.01 0.05 0.03) //propeller
-            //     (-0.08 -0.08 -0.03)(-0.06 0.08 0.03) //rudder
             );
         }
     }
-
 );
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
index 460a11d274f..e1e23b38e17 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
@@ -18,7 +18,6 @@ actions
 (
     {
       name    bgr0;       // all around bgr
-  //    set     hullBox0set;
       type    cellSet;
       action  new;
       source  zoneToCell;
@@ -79,8 +78,6 @@ actions
         {
             boxes
             (
-            //     (0.15 -0.1 -0.1)(0.5 0.1 0.1) //hullBox
-            //     (-0.02 -0.05 -0.03)( -0.01 0.05 0.03) //propeller
             (-0.10 -0.0749 -0.00499)(-0.050 0.0749 0.00499) //rudder
             );
         }
@@ -131,134 +128,6 @@ actions
             set bgr0;
         }
     }
-
 );
 
 // ************************************************************************* //
-
-
-
-// /*--------------------------------*- C++ -*----------------------------------*\
-// | =========                 |                                                 |
-// | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-// |  \\    /   O peration     | Version:  plus-overset                          |
-// |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-// |    \\/     M anipulation  |                                                 |
-// \*---------------------------------------------------------------------------*/
-// FoamFile
-// {
-//     version     2.0;
-//     format      ascii;
-//     class       dictionary;
-//     object      topoSetDict;
-// }
-// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//
-// actions
-// (
-//     {
-//         name    rudder0;       // all around bgr
-//         type    cellSet;
-//         action  new;
-//         source  zoneToCell;
-//         sourceInfo
-//         {
-//            name rudder;
-//             //insidePoints ((-0.11 0.0 0.0));
-//         }
-//     }
-//     {
-//         name    c0;            //copy
-//         type    cellSet;
-//         action  new;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set rudder0;
-//         }
-//     }
-//
-//     {
-//         name    c0;          //all around hullBox0
-//         type    cellSet;
-//         action  invert;
-//     }
-//
-// /*
-//
-//     {
-//         name    c1;
-//         type    cellSet;
-//         action  new;
-//         source  regionsToCell;
-//         sourceInfo
-//         {
-//             insidePoints ((-0.01 0.0 0.0));
-//             set          c0;
-//         }
-//     }
-//
-//
-//
-//
-//
-//    {
-//         name    c1;
-//         type    cellSet;
-//         action  delete;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set c2;
-//         }
-//     }
-// */
-//     // Select box to remove from region 1 and 2
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  new;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set c0;
-//         }
-//     }
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  add;
-//         source  cellToCell;
-//         sourceInfo
-//         {
-//             set rudder0;
-//         }
-//     }
-//
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  subset;
-//         source  boxToCell;
-//         sourceInfo
-//         {
-//             boxes
-//             (
-//             //     (0 -0.1 -0.1)(0.5 0.1 0.1) //hullBox
-//             //     (-0.02 -0.05 -0.03)( -0.01 0.05 0.03) //propeller
-//                  (-0.10 -0.0749 -0.00499)(-0.050 0.0749 0.00499) //rudder
-//             );
-//         }
-//     }
-//
-//     {
-//         name    box;
-//         type    cellSet;
-//         action  invert;
-//     }
-// );
-//
-// // ************************************************************************* //
-- 
GitLab