From 2fc299be894abd4ece801dccfb33e122709a39f1 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 4 Dec 2012 13:01:19 +0000
Subject: [PATCH] ENH: filter: convert to createBafflesDict

---
 .../reactingParcelFoam/filter/Allrun          | 17 +---
 .../filter/constant/polyMesh/blockMeshDict    | 26 ------
 .../filter/constant/polyMesh/boundary         | 83 -------------------
 .../filter/system/createBafflesDict           | 81 ++++++++++++++++++
 4 files changed, 83 insertions(+), 124 deletions(-)
 delete mode 100644 tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary
 create mode 100644 tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict

diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
index b82b7aad36e..7db81c26764 100755
--- a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
@@ -10,23 +10,10 @@ application=`getApplication`
 runApplication blockMesh
 
 # create sets
-#setSet -batch system/sets.setSet > log.setSet1 2>&1
 runApplication topoSet
 
-# create the first cyclic - lhs of porous zone
-# Note that we don't know what value to give these patches-out-of-nothing so
-# - use binary writing to avoid 'nan'
-# - use setFields to set values
-unset FOAM_SIGFPE
-runApplication createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite
-mv log.createBaffles log.createBaffles1
-
-# create the second cyclic - rhs of porous zone
-runApplication createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite
-mv log.createBaffles log.createBaffles2
-
-# Initialise newly created patchFields to 0
-runApplication changeDictionary
+# create baffles and fields
+createBaffles -overwrite
 
 runApplication $application
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict
index 04b1edd6ab2..ae16964f935 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict
@@ -100,32 +100,6 @@ boundary
         );
     }
 
-    cycLeft_half0
-    {
-        type cyclic;
-        faces    ();
-        neighbourPatch cycLeft_half1;
-    }
-    cycLeft_half1
-    {
-        type cyclic;
-        faces    ();
-        neighbourPatch cycLeft_half0;
-    }
-
-    cycRight_half0
-    {
-        type cyclic;
-        faces    ();
-        neighbourPatch cycRight_half1;
-    }
-    cycRight_half1
-    {
-        type cyclic;
-        faces    ();
-        neighbourPatch cycRight_half0;
-    }
-
     frontAndBack
     {
         type empty;
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary
deleted file mode 100644
index 3a75efa15be..00000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary
+++ /dev/null
@@ -1,83 +0,0 @@
-/*--------------------------------*- 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      binary;
-    class       polyBoundaryMesh;
-    location    "constant/polyMesh";
-    object      boundary;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-8
-(
-    walls
-    {
-        type            wall;
-        nFaces          172;
-        startFace       3294;
-    }
-    inlet
-    {
-        type            patch;
-        nFaces          20;
-        startFace       3466;
-    }
-    outlet
-    {
-        type            patch;
-        nFaces          20;
-        startFace       3486;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-        inGroups        1(cyclic);
-        nFaces          20;
-        startFace       3506;
-        matchTolerance  0.0001;
-        neighbourPatch  cycLeft_half1;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-        inGroups        1(cyclic);
-        nFaces          20;
-        startFace       3526;
-        matchTolerance  0.0001;
-        neighbourPatch  cycLeft_half0;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-        inGroups        1(cyclic);
-        nFaces          20;
-        startFace       3546;
-        matchTolerance  0.0001;
-        neighbourPatch  cycRight_half1;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-        inGroups        1(cyclic);
-        nFaces          20;
-        startFace       3566;
-        matchTolerance  0.0001;
-        neighbourPatch  cycRight_half0;
-    }
-    frontAndBack
-    {
-        type            empty;
-        inGroups        1(empty);
-        nFaces          3440;
-        startFace       3586;
-    }
-)
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict b/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict
new file mode 100644
index 00000000000..1caf47dc89d
--- /dev/null
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict
@@ -0,0 +1,81 @@
+/*--------------------------------*- 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
+{
+    cycLeft
+    {
+        //- Use predefined faceZone to select faces and orientation.
+        type        faceZone;
+        zoneName    cycLeft;
+
+        patches
+        {
+            master
+            {
+                //- Master side patch
+
+                name            cycLeft_half0;
+                type            cyclic;
+                neighbourPatch  cycLeft_half1;
+            }
+            slave
+            {
+                //- Slave side patch
+
+                name            cycLeft_half1;
+                type            cyclic;
+                neighbourPatch  cycLeft_half0;
+            }
+        }
+    }
+
+    cycRight
+    {
+        //- Use predefined faceZone to select faces and orientation.
+        type        faceZone;
+        zoneName    cycRight;
+
+        patches
+        {
+            master
+            {
+                //- Master side patch
+
+                name            cycRight_half0;
+                type            cyclic;
+                neighbourPatch  cycRight_half1;
+            }
+            slave
+            {
+                //- Slave side patch
+
+                name            cycRight_half1;
+                type            cyclic;
+                neighbourPatch  cycRight_half0;
+            }
+        }
+    }
+}
+
+
+// ************************************************************************* //
-- 
GitLab