From 38539cc27cf5ebcd5ebedd81c967af90f5a12ddb Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 4 Dec 2012 12:12:51 +0000
Subject: [PATCH] ENH: TJunctionFan: rewrite to createBafflesDict

---
 .../pimpleFoam/TJunctionFan/0/U               |  15 +-
 .../pimpleFoam/TJunctionFan/0/epsilon         |  18 +-
 .../pimpleFoam/TJunctionFan/0/k               |  17 +-
 .../pimpleFoam/TJunctionFan/0/nuTilda         |  14 +-
 .../pimpleFoam/TJunctionFan/0/nut             |  18 +-
 .../pimpleFoam/TJunctionFan/0/p               |  40 +---
 .../pimpleFoam/TJunctionFan/Allrun            |  17 +-
 .../pimpleFoam/TJunctionFan/README.txt        |   2 +-
 .../constant/polyMesh/blockMeshDict           |  19 --
 .../TJunctionFan/system/createBafflesDict     | 186 ++++++++++++++++++
 10 files changed, 202 insertions(+), 144 deletions(-)
 create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict

diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U
index 7d734082dd4..54e519308c9 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 1 -1 0 0 0 0];
+dimensions      [m s^-1];
 
 internalField   uniform (0 0 0);
 
@@ -38,19 +38,6 @@ boundaryField
         inletValue      uniform (0 0 0);
         value           uniform (0 0 0);
     }
-    baffles
-    {
-        type            fixedValue;
-        value           uniform (0 0 0);
-    }
-    fan_half0
-    {
-        type            cyclic;
-    }
-    fan_half1
-    {
-        type            cyclic;
-    }
     defaultFaces
     {
         type            fixedValue;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon
index b972d9f1d29..3648316bd38 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 2 -3 0 0 0 0];
+dimensions      [m^2 s^-3];
 
 internalField   uniform 200;
 
@@ -41,22 +41,6 @@ boundaryField
         inletValue      uniform 200;
         value           uniform 200;
     }
-    baffles
-    {
-        type            epsilonWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           uniform 0;
-    }
-    fan_half0
-    {
-        type            cyclic;
-    }
-    fan_half1
-    {
-        type            cyclic;
-    }
     defaultFaces
     {
         type            epsilonWallFunction;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k
index a58acefeab7..bd8e325c2f5 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 2 -2 0 0 0 0];
+dimensions      [m^2 s^-2];
 
 internalField   uniform 0.375;
 
@@ -25,8 +25,6 @@ boundaryField
     {
         type            turbulentIntensityKineticEnergyInlet;
         intensity       0.05;
-        U               U;
-        phi             phi;
         value           uniform 0.375;
     }
     outlet1
@@ -41,19 +39,6 @@ boundaryField
         inletValue      uniform 0.375;
         value           uniform 0.375;
     }
-    baffles
-    {
-        type            kqRWallFunction;
-        value           uniform 0;
-    }
-    fan_half0
-    {
-        type            cyclic;
-    }
-    fan_half1
-    {
-        type            cyclic;
-    }
     defaultFaces
     {
         type            kqRWallFunction;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda
index dfa76ef6fdd..5bd1e94d8b1 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 2 -1 0 0 0 0];
+dimensions      [m^2 s^-1];
 
 internalField   uniform 0;
 
@@ -33,18 +33,6 @@ boundaryField
     {
         type            zeroGradient;
     }
-    baffles
-    {
-        type            zeroGradient;
-    }
-    fan_half0
-    {
-        type            cyclic;
-    }
-    fan_half1
-    {
-        type            cyclic;
-    }
     defaultFaces
     {
         type            zeroGradient;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut
index 831ea1e70ba..894d5b53455 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 2 -1 0 0 0 0];
+dimensions      [m^2 s^-1];
 
 internalField   uniform 0;
 
@@ -36,22 +36,6 @@ boundaryField
         type            calculated;
         value           uniform 0;
     }
-    baffles
-    {
-        type            nutkWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           uniform 0;
-    }
-    fan_half0
-    {
-        type            cyclic;
-    }
-    fan_half1
-    {
-        type            cyclic;
-    }
     defaultFaces
     {
         type            nutkWallFunction;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p
index e69dbaddef2..42728c992c0 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 2 -2 0 0 0 0];
+dimensions      [m^2 s^-2];
 
 internalField   uniform 0;
 
@@ -27,15 +27,13 @@ boundaryField
         rho             none;
         psi             none;
         gamma           1;
-        p0              40;
         pressure        table
-
-2
-(
-(0 10)
-(1 40)
-)
-;
+        2
+        (
+            (0 10)
+            (1 40)
+        )
+        ;
         value           uniform 40;
     }
     outlet1
@@ -48,30 +46,6 @@ boundaryField
         type            fixedValue;
         value           uniform 0;
     }
-    baffles
-    {
-        type            zeroGradient;
-    }
-    fan_half0
-    {
-        type            fan;
-        patchType       cyclic;
-        jumpTable       polynomial
-
-2
-(
-(100 0)
-(-0.1 1)
-)
-;
-        value           uniform 0;
-    }
-    fan_half1
-    {
-        type            fan;
-        patchType       cyclic;
-        value           uniform 0;
-    }
     defaultFaces
     {
         type            zeroGradient;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
index 2374d2fb6c3..932dded90be 100755
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
@@ -8,21 +8,10 @@ application=`getApplication`
 
 runApplication blockMesh
 
-
-# Creating patches 'out of nothing' so will get undefined value which
-# might cause floating point error
-unset FOAM_SIGFPE
-unset FOAM_SETNAN
-
-# Create faceZones for fan and baffles
+# Create faceZones for baffles and fan
 runApplication topoSet
 
-# Create fan cyclics
-runApplication createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite
-mv log.createBaffles log.createBaffles.1
-
-# Create wall baffles
-runApplication createBaffles baffleFaces '(baffles baffles)' -overwrite
-mv log.createBaffles log.createBaffles.2
+# Create wall and cyclic baffles and the fields on them
+runApplication createBaffles -overwrite
 
 runApplication $application
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt b/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt
index 0ef40d8110b..7c7924cf563 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt
@@ -1,3 +1,3 @@
 2010-04-16 T-junction with baffles and fan.
 Inlet on left, one outlet at bottom, one at top.
-To test multiple outlets.
+To test multiple outlets and fan cyclics
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict b/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict
index 66f0af7d65f..7464688c337 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict
@@ -104,25 +104,6 @@ boundary
         faces ((8 18 19 9));
     }
 
-    baffles
-    {
-        type wall;
-        faces ();
-    }
-
-    fan_half0
-    {
-        type cyclic;
-        faces ();
-        neighbourPatch fan_half1;
-    }
-    fan_half1
-    {
-        type cyclic;
-        faces ();
-        neighbourPatch fan_half0;
-    }
-
     defaultFaces
     {
         type wall;
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict
new file mode 100644
index 00000000000..92c3f3dd828
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict
@@ -0,0 +1,186 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      createBafflesDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+// Whether to convert internal faces only (so leave boundary faces intact).
+// This is only relevant if your face selection type can pick up boundary
+// faces.
+internalFacesOnly true;
+
+
+// Baffles to create.
+baffles
+{
+    baffleFaces
+    {
+        //- Use predefined faceZone to select faces and orientation.
+        type        faceZone;
+        zoneName    baffleFaces;
+
+
+        //- Optional flip
+        //flip        false;
+
+        patches
+        {
+            master
+            {
+                //- Master side patch
+                name            baffles;
+                type            wall;
+
+                patchFields
+                {
+                    epsilon
+                    {
+                        type            epsilonWallFunction;
+                        Cmu             0.09;
+                        kappa           0.41;
+                        E               9.8;
+                        value           uniform 0;
+                    }
+                    k
+                    {
+                        type            kqRWallFunction;
+                        value           uniform 0;
+                    }
+                    nut
+                    {
+                        type            nutkWallFunction;
+                        Cmu             0.09;
+                        kappa           0.41;
+                        E               9.8;
+                        value           uniform 0;
+                    }
+                    nuTilda
+                    {
+                        type            zeroGradient;
+                    }
+                    p
+                    {
+                        type            zeroGradient;
+                    }
+                    U
+                    {
+                        type            fixedValue;
+                        value           uniform (0 0 0);
+                    }
+                }
+            }
+            slave
+            {
+                //- Slave side patch
+                name            baffles;
+                type            wall;
+
+                patchFields
+                {
+                    epsilon
+                    {
+                        type            epsilonWallFunction;
+                        Cmu             0.09;
+                        kappa           0.41;
+                        E               9.8;
+                        value           uniform 0;
+                    }
+                    k
+                    {
+                        type            kqRWallFunction;
+                        value           uniform 0;
+                    }
+                    nut
+                    {
+                        type            nutkWallFunction;
+                        Cmu             0.09;
+                        kappa           0.41;
+                        E               9.8;
+                        value           uniform 0;
+                    }
+                    nuTilda
+                    {
+                        type            zeroGradient;
+                    }
+                    p
+                    {
+                        type            zeroGradient;
+                    }
+                    U
+                    {
+                        type            fixedValue;
+                        value           uniform (0 0 0);
+                    }
+                }
+            }
+        }
+    }
+
+
+
+    cyclicFaces
+    {
+        //- Select faces and orientation through a searchableSurface
+        type        searchableSurface;
+        surface     searchablePlate;
+        origin      (0.099 -0.006 0.004);
+        span        (0 0.012 0.012);
+
+        patches
+        {
+            master
+            {
+                //- Master side patch
+
+                name            fan_half0;
+                type            cyclic;
+                neighbourPatch  fan_half1;
+
+                //- Optional override of added patchfields. If not specified
+                //  any added patchfields are of type calculated.
+                patchFields
+                {
+                    p
+                    {
+                        type            fan;
+                        patchType       cyclic;
+                        jump            uniform 0;
+                        value           uniform 0;
+                        jumpTable       polynomial 1((100 0));
+                    }
+                }
+            }
+            slave
+            {
+                //- Slave side patch
+
+                name            fan_half1;
+                type            cyclic;
+                neighbourPatch  fan_half0;
+
+                patchFields
+                {
+                    p
+                    {
+                        type            fan;
+                        patchType       cyclic;
+                        value           uniform 0;
+                    }
+                }
+            }
+        }
+    }
+}
+
+
+// ************************************************************************* //
-- 
GitLab