From 10132305e476cbd3659c05a1ae2158bff9865614 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 14 Dec 2018 15:25:52 +0100
Subject: [PATCH] TUT: provisional runTimePostProcessing test with cutting
 planes (#1091)

---
 .../RAS/elipsekkLOmega/{0 => 0.orig}/U        |   0
 .../RAS/elipsekkLOmega/{0 => 0.orig}/kl       |   0
 .../RAS/elipsekkLOmega/{0 => 0.orig}/kt       |   0
 .../RAS/elipsekkLOmega/{0 => 0.orig}/nut      |   0
 .../RAS/elipsekkLOmega/{0 => 0.orig}/omega    |   0
 .../RAS/elipsekkLOmega/{0 => 0.orig}/p        |   0
 .../pimpleFoam/RAS/elipsekkLOmega/Allclean    |   2 +-
 .../pimpleFoam/RAS/elipsekkLOmega/Allrun      |  14 +--
 .../RAS/elipsekkLOmega/Allrun-parallel        |  13 ++
 .../pimpleFoam/RAS/elipsekkLOmega/Allrun.pre  |  24 ++++
 .../RAS/elipsekkLOmega/system/controlDict     |   7 ++
 .../system/runTimePostProcessing              | 117 ++++++++++++++++++
 .../RAS/elipsekkLOmega/system/sampling        | 100 +++++++++++++++
 13 files changed, 263 insertions(+), 14 deletions(-)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/U (100%)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/kl (100%)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/kt (100%)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/nut (100%)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/omega (100%)
 rename tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/{0 => 0.orig}/p (100%)
 create mode 100755 tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun-parallel
 create mode 100755 tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun.pre
 create mode 100644 tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/runTimePostProcessing
 create mode 100644 tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/sampling

diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/U b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/U
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/U
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/U
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/kl b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/kl
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/kl
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/kl
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/kt b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/kt
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/kt
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/kt
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/nut b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/nut
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/nut
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/nut
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/omega b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/omega
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/omega
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/omega
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/p b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/p
similarity index 100%
rename from tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0/p
rename to tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/0.orig/p
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allclean b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allclean
index be7ddb06884..e2f275d9fd6 100755
--- a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allclean
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allclean
@@ -2,6 +2,6 @@
 cd ${0%/*} || exit 1                        # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions  # Tutorial clean functions
 
-cleanCase
+cleanCase0
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun
index 097989bcc7b..f54b7a529e9 100755
--- a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun
@@ -2,20 +2,8 @@
 cd ${0%/*} || exit 1                        # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
 
+runApplication ./Allrun.pre
 
-runApplication blockMesh
-runApplication transformPoints -scale '(1.6666 1 1)'
-
-runApplication changeDictionary -instance system -dict system/changeDictionaryDict.X
-runApplication mirrorMesh -overwrite
-rm -f log.mirrorMesh
-rm -f log.changeDictionary
-
-runApplication changeDictionary -instance system -dict system/changeDictionaryDict.Y
-runApplication mirrorMesh -overwrite
-
-runApplication topoSet
-runApplication createPatch -overwrite
 runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun-parallel b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun-parallel
new file mode 100755
index 00000000000..e23148eef9d
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun-parallel
@@ -0,0 +1,13 @@
+#!/bin/sh
+cd ${0%/*} || exit 1                        # Run from this directory
+. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
+
+runApplication ./Allrun.pre
+
+runApplication decomposePar
+
+runParallel $(getApplication)
+
+runApplication reconstructPar
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun.pre b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun.pre
new file mode 100755
index 00000000000..f98d8e1402f
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/Allrun.pre
@@ -0,0 +1,24 @@
+#!/bin/sh
+cd ${0%/*} || exit 1                        # Run from this directory
+. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
+
+runApplication blockMesh
+runApplication transformPoints -scale '(1.6666 1 1)'
+
+runApplication changeDictionary -instance system -dict system/changeDictionaryDict.X
+runApplication mirrorMesh -overwrite
+rm -f log.mirrorMesh
+rm -f log.changeDictionary
+
+runApplication changeDictionary -instance system -dict system/changeDictionaryDict.Y
+runApplication mirrorMesh -overwrite
+
+restore0Dir
+
+runApplication topoSet
+
+runApplication createPatch -overwrite
+
+echo "End"
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/controlDict b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/controlDict
index 84282c220f0..6f9d819fbca 100644
--- a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/controlDict
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/controlDict
@@ -49,4 +49,11 @@ adjustTimeStep  yes;
 
 maxCo           0.2;
 
+
+functions
+{
+//     #include "sampling"
+//     #include "runTimePostProcessing"
+}
+
 // ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/runTimePostProcessing b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/runTimePostProcessing
new file mode 100644
index 00000000000..b14879f52c1
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/runTimePostProcessing
@@ -0,0 +1,117 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v1806                                 |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+
+postPro1
+{
+    type            runTimePostProcessing;
+    libs            ("librunTimePostProcessing.so");
+    writeControl    writeTime;
+    output
+    {
+        name        image;
+        width       800;
+        height      600;
+    }
+    camera
+    {
+        // If camera is moving, optionally provide start and end times
+        // startPosition    0.2;
+        // endPosition      0.75;
+
+        // Total number of frames to generate
+        nFrameTotal     1;
+
+        // Parallel projection flag
+        parallelProjection  yes;
+
+        clipBox         (-0.2 -0.2 0)(1.65 0.2 1.25); // optional
+
+        position        (-2.28 1.28 2.24);
+        focalPoint      (0.003 0.008 0.024);
+        up              (0.26 0.930 -0.266);
+        zoom    1.25;
+    }
+
+    // Default colours
+    // - If select to colourBy colour, these values are used unless
+    // they are locally overridden
+    colours
+    {
+        background      (0.317647 0.341176 0.431373);
+        background2     ${background};
+        text            (0 0 0);
+        edge            (1 0 0);
+        surface         (0.5 0.5 0.5);
+        line            (1 0 0);
+    }
+
+    lines
+    {
+    }
+
+
+    _plane
+    {
+        type            functionObjectSurface;
+        functionObject  cuttingPlane;
+        colourMap       blueWhiteRed;
+        representation  glyph;
+        maxGlyphLength  0.1;
+        visible         yes;
+        featureEdges    no;
+        colourBy        field;
+        field           U;
+        range           (0 10);
+        opacity         1;
+        scalarBar
+        {
+            visible     no;
+        }
+    }
+
+
+    surfaces
+    {
+        plane0
+        {
+            ${_plane};
+            functionObject  plane0;
+        }
+        plane1
+        {
+            ${_plane};
+            functionObject  plane1;
+        }
+        plane2
+        {
+            ${_plane};
+            functionObject  plane2;
+        }
+        plane3
+        {
+            ${_plane};
+            functionObject  plane3;
+        }
+    }
+
+    // Text data
+    text
+    {
+        text1
+        {
+            string          "elipsekkLOmega";
+            position        (0.1 0.05);
+            size            24;
+            bold            no;
+            visible         yes;
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/sampling b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/sampling
new file mode 100644
index 00000000000..839c39ca653
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/RAS/elipsekkLOmega/system/sampling
@@ -0,0 +1,100 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v1806                                 |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+
+plane0
+{
+    type            surfaces;
+    libs            ("libsampling.so");
+    writeControl    writeTime;
+
+    surfaceFormat   vtk;
+    fields          ( p U );
+
+    interpolationScheme cellPoint;
+
+    surfaces
+    (
+        plane0
+        {
+            type            cuttingPlane;
+            planeType       pointAndNormal;
+            interpolate     true;
+            pointAndNormalDict
+            {
+                point   (0 0 0);
+                normal  (1 0 0);
+            }
+        }
+    );
+}
+
+
+plane1
+{
+    ${plane0}
+
+    surfaces
+    (
+        plane1
+        {
+            type            cuttingPlane;
+            planeType       pointAndNormal;
+            interpolate     true;
+            pointAndNormalDict
+            {
+                point   (0.1 0 0);
+                normal  (1 0 0);
+            }
+        }
+    );
+}
+
+
+plane2
+{
+    ${plane0}
+
+    surfaces
+    (
+        plane2
+        {
+            type            cuttingPlane;
+            planeType       pointAndNormal;
+            interpolate     true;
+            pointAndNormalDict
+            {
+                point   (0.2 0 0);
+                normal  (1 0 0);
+            }
+        }
+    );
+}
+
+
+plane3
+{
+    ${plane0}
+
+    surfaces
+    (
+        plane3
+        {
+            type            cuttingPlane;
+            planeType       pointAndNormal;
+            interpolate     true;
+            pointAndNormalDict
+            {
+                point   (0.3 0 0);
+                normal  (1 0 0);
+            }
+        }
+    );
+}
+
+
+// ************************************************************************* //
-- 
GitLab