From 4bc77e6aff32b92f24767ea9e9f5445dcb474f4e Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Sun, 6 Mar 2016 19:06:44 +0000
Subject: [PATCH] Sprucing up the tutorials folder and adding -dict to
 "collapseEdges" Patch provided by Bruno Santos Resolves patch application
 request http://www.openfoam.org/mantisbt/view.php?id=2015

---
 .../advanced/collapseEdges/collapseEdges.C    | 25 +++++-
 bin/tools/RunFunctions                        | 46 ++++++----
 .../polyMeshFilter/polyMeshFilter.C           | 20 ++++-
 .../polyMeshFilter/polyMeshFilter.H           | 10 ++-
 tutorials/Allrun                              |  2 +-
 .../fireFoam/les/oppositeBurningPanels/Allrun | 21 +++--
 .../multiRegionHeater/Allrun                  |  2 +-
 .../snappyMultiRegionHeater/Allrun            |  2 +-
 .../heatExchanger/Allrun-parallel             | 14 +--
 .../heatExchanger/Allrun.pre                  | 14 ++-
 .../multiRegionHeaterRadiation/Allrun         |  6 +-
 .../Allrun-parallel                           |  6 +-
 .../multiRegionHeaterRadiation/Allrun.pre     |  2 +-
 .../boundaryWallFunctionsProfile/Allrun       |  8 +-
 .../straightDuctImplicit/Allrun.pre           | 11 +--
 .../cylinder/Allrun.pre                       |  1 -
 .../hotBoxes/Allrun-parallel                  | 12 +--
 .../hotBoxes/Allrun.pre                       |  3 +-
 .../rivuletPanel/Allrun.pre                   |  1 -
 .../splashPanel/Allrun.pre                    | 24 ++++--
 tutorials/mesh/foamyHexMesh/blob/Allrun       |  8 +-
 .../mesh/foamyHexMesh/blob/Allrun-parallel    |  8 +-
 tutorials/mesh/foamyHexMesh/flange/Allrun     |  8 +-
 .../mesh/foamyHexMesh/flange/Allrun-parallel  |  8 +-
 .../mesh/foamyHexMesh/mixerVessel/Allrun-pre  | 32 ++++---
 .../mixerVessel/Allrun-simulation             |  4 +-
 .../mixerVessel/system/collapseDict           | 86 +------------------
 .../mesh/foamyHexMesh/simpleShapes/Allrun     | 36 ++++----
 .../mesh/refineMesh/refineFieldDirs/Allrun    | 23 +++--
 .../interDyMFoam/ras/DTCHull/Allrun           | 24 ++----
 .../interFoam/les/nozzleFlow2D/Allrun         | 27 ++----
 .../multiphase/interFoam/ras/DTCHull/Allrun   | 24 ++----
 .../propeller/Allrun.pre                      |  4 +-
 .../oscillatingBox/Allrun                     | 10 ++-
 34 files changed, 235 insertions(+), 297 deletions(-)
 mode change 100644 => 120000 tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict

diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
index 9df985f42ef..b3099f4f28a 100644
--- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
+++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -80,6 +80,7 @@ int main(int argc, char *argv[])
         "Collapse faces that are in the supplied face set"
     );
 
+    #include "addDictOption.H"
     #include "addOverwriteOption.H"
     #include "setRootCase.H"
     #include "createTime.H"
@@ -91,6 +92,13 @@ int main(int argc, char *argv[])
 
     const word oldInstance = mesh.pointsInstance();
 
+    const word dictName("collapseDict");
+    #include "setSystemMeshDictionaryIO.H"
+
+    Info<< "Reading " << dictName << nl << endl;
+
+    IOdictionary collapseDict(dictIO);
+
     const bool overwrite = args.optionFound("overwrite");
 
     const bool collapseFaces = args.optionFound("collapseFaces");
@@ -155,7 +163,10 @@ int main(int argc, char *argv[])
 
 
         {
-            meshFilterPtr.set(new polyMeshFilter(mesh, pointPriority));
+            meshFilterPtr.set
+            (
+                new polyMeshFilter(mesh, pointPriority, collapseDict)
+            );
             polyMeshFilter& meshFilter = meshFilterPtr();
 
             // newMesh will be empty until it is filtered
@@ -177,7 +188,10 @@ int main(int argc, char *argv[])
 
         if (collapseFaceSet)
         {
-            meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
+            meshFilterPtr.reset
+            (
+                new polyMeshFilter(mesh, pointPriority, collapseDict)
+            );
             polyMeshFilter& meshFilter = meshFilterPtr();
 
             const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
@@ -198,7 +212,10 @@ int main(int argc, char *argv[])
 
         if (collapseFaces)
         {
-            meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
+            meshFilterPtr.reset
+            (
+                new polyMeshFilter(mesh, pointPriority, collapseDict)
+            );
             polyMeshFilter& meshFilter = meshFilterPtr();
 
             const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index 3c074c7267b..cdf4af6fe9f 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -55,35 +55,43 @@ runApplication()
     APP_RUN=
     LOG_IGNORE=false
     LOG_APPEND=false
+    LOG_SUFFIX=
 
     # Parse options and executable
     while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
         key="$1"
         case "$key" in
-            -append)
+            -append|-a)
                 LOG_IGNORE=true
                 LOG_APPEND=true
                 ;;
-            -overwrite)
+            -overwrite|-o)
                 LOG_IGNORE=true
                 ;;
+            -suffix|-s)
+                LOG_SUFFIX=".$2"
+                shift
+                ;;
             *)
                 APP_RUN="$key"
                 APP_NAME="${key##*/}"
+                LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
                 ;;
         esac
-    shift
+
+        shift
     done
 
-    if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ]
+    if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
     then
-        echo "$APP_NAME already run on $PWD: remove log file to re-run"
+        echo "$APP_NAME already run on $PWD:" \
+             "remove log file 'log.$LOG_SUFFIX' to re-run"
     else
         echo "Running $APP_RUN on $PWD"
         if [ "$LOG_APPEND" = "true" ]; then
-            $APP_RUN "$@" >> log.$APP_NAME 2>&1
+            $APP_RUN "$@" >> log.$LOG_SUFFIX 2>&1
         else
-            $APP_RUN "$@" > log.$APP_NAME 2>&1
+            $APP_RUN "$@" > log.$LOG_SUFFIX 2>&1
         fi
     fi
 }
@@ -93,40 +101,48 @@ runParallel()
     APP_RUN=
     LOG_IGNORE=false
     LOG_APPEND=false
+    LOG_SUFFIX=
     nProcs=$(getNumberOfProcessors)
 
     # Parse options and executable
     while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
         key="$1"
         case "$key" in
-            -append)
+            -append|-a)
                 LOG_IGNORE=true
                 LOG_APPEND=true
                 ;;
-            -overwrite)
+            -overwrite|-o)
                 LOG_IGNORE=true
                 ;;
-            -np)
+            -suffix|-s)
+                LOG_SUFFIX=".$2"
+                shift
+                ;;
+            -np|-n)
                 nProcs="$2"
                 shift
                 ;;
             *)
                 APP_RUN="$key"
                 APP_NAME="${key##*/}"
+                LOG_SUFFIX="${APP_NAME}${LOG_SUFFIX}"
                 ;;
         esac
-    shift
+
+        shift
     done
 
-    if [ -f log.$APP_NAME ] && [ "$LOG_IGNORE" = "false" ]
+    if [ -f log.$SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
     then
-        echo "$APP_NAME already run on $PWD: remove log file to re-run"
+        echo "$APP_NAME already run on $PWD:" \
+             "remove log file 'log.$LOG_SUFFIX' to re-run"
     else
         echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
         if [ "$LOG_APPEND" = "true" ]; then
-            ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null >> log.$APP_NAME 2>&1 )
+            ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null >> log.$LOG_SUFFIX 2>&1 )
         else
-            ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 )
+            ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
         fi
     fi
 }
diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C
index 28398bdc92a..ced6d24aeb2 100644
--- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C
+++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -946,6 +946,24 @@ Foam::polyMeshFilter::polyMeshFilter
     writeSettings(Info);
 }
 
+Foam::polyMeshFilter::polyMeshFilter
+(
+    const fvMesh& mesh,
+    const labelList& pointPriority,
+    const dictionary& dict
+)
+:
+    polyMeshFilterSettings(dict),
+    mesh_(mesh),
+    newMeshPtr_(),
+    originalPointPriority_(pointPriority),
+    pointPriority_(),
+    minEdgeLen_(),
+    faceFilterFactor_()
+{
+    writeSettings(Info);
+}
+
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H
index ffae205634d..a61cb1e93b5 100644
--- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H
+++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H
@@ -207,6 +207,14 @@ public:
         //- Construct from fvMesh and a label list of point priorities
         polyMeshFilter(const fvMesh& mesh, const labelList& pointPriority);
 
+        //- Construct from fvMesh and a label list of point priorities
+        polyMeshFilter
+        (
+            const fvMesh& mesh,
+            const labelList& pointPriority,
+            const dictionary& dict
+        );
+
 
     //- Destructor
     ~polyMeshFilter();
@@ -257,7 +265,7 @@ public:
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-    #include "polyMeshFilterTemplates.C"
+#   include "polyMeshFilterTemplates.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/tutorials/Allrun b/tutorials/Allrun
index 6b600d4eb64..1f8f12eec0e 100755
--- a/tutorials/Allrun
+++ b/tutorials/Allrun
@@ -38,7 +38,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 logReport()
 {
     caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
-    app=`echo $1 | sed s/"\(.*\)\."/""/g`
+    app=`echo $1 | sed s/"\(.*\)log\."/""/g`
     appAndCase="Application $app - case $caseName"
 
     fatalError=`grep "FOAM FATAL" $1`
diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
index e5bcb245fa8..befcb5a01d7 100755
--- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
+++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
@@ -9,26 +9,31 @@ application=`getApplication`
 
 runApplication blockMesh
 
-runApplication topoSet -dict system/cRefine.topoSetDict
+runApplication -s cRefine \
+    topoSet -dict system/cRefine.topoSetDict
+
 runApplication refineMesh -overwrite -dict system/refineMeshDict
 
-rm log.topoSet
-runApplication topoSet -dict system/f.topoSetDict
+runApplication -s f \
+    topoSet -dict system/f.topoSetDict
 
 # create the pyrolysis region.
 runApplication extrudeToRegionMesh -overwrite
 
 
-rm log.topoSet
-runApplication topoSet -dict system/fBurner.topoSetDict
+runApplication -s fBurner \
+    topoSet -dict system/fBurner.topoSetDict
 
 runApplication createPatch -overwrite
 
-decomposePar -force > log.decomposePar 2>&1
+runApplication -s master \
+    decomposePar -force
 
-decomposePar -region panelRegion > log.decomposeParPanelRegion 2>&1
+runApplication -s panelRegion \
+    decomposePar -region panelRegion
 
-decomposePar -fields > log.decomposePar 2>&1
+runApplication -s fields \
+    decomposePar -fields
 
 runParallel `getApplication`
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
index bd8074f33ad..602f7159e24 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
@@ -18,7 +18,7 @@ done
 
 for i in bottomWater topAir heater leftSolid rightSolid
 do
-   changeDictionary -region $i > log.changeDictionary.$i 2>&1
+   runApplication -s $i  changeDictionary -region $i
 done
 
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
index b7e64e45259..6e65d852809 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
@@ -22,7 +22,7 @@ done
 
 for i in bottomAir topAir heater leftSolid rightSolid
 do
-   changeDictionary -region $i > log.changeDictionary.$i 2>&1
+   runApplication -s $i  changeDictionary -region $i
 done
 
 
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
index 32143f46ad6..9e5b931edcb 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
@@ -7,16 +7,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-runApplication decomposePar -region air
-mv log.decomposePar log.decomposePar.air
-
-runApplication decomposePar -region porous
-mv log.decomposePar log.decomposePar.porous
+runApplication -s air    decomposePar -region air
+runApplication -s porous decomposePar -region porous
 
 runParallel $(getApplication)
 
-runApplication reconstructPar -latestTime -region air
-mv log.reconstructPar log.reconstructPar.air
-
-runApplication reconstructPar -latestTime -region porous
-mv log.reconstructPar log.reconstructPar.porous
+runApplication -s air    reconstructPar -latestTime -region air
+runApplication -s porous reconstructPar -latestTime -region porous
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
index 87f198c6298..020b201778e 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
@@ -6,20 +6,18 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 #create meshes
-runApplication blockMesh -region air
-mv log.blockMesh log.blockMesh.air
-runApplication blockMesh -region porous
-mv log.blockMesh log.blockMesh.porous
+runApplication -s air    blockMesh -region air
+runApplication -s porous blockMesh -region porous
 
 # create rotor blades in air region
-runApplication topoSet -region air -dict system/topoSetDict.1
-mv log.topoSet log.topoSet.air.1
+runApplication -s air.1 \
+    topoSet -region air -dict system/topoSetDict.1
 
 runApplication createBaffles -region air -overwrite
 
 # create rotor zone in air region for MRF
-runApplication topoSet -region air -dict system/topoSetDict.2
-mv log.topoSet log.topoSet.air.2
+runApplication -s air.2 \
+    topoSet -region air -dict system/topoSetDict.2
 
 rm -rf constant/air/polyMesh/sets
 
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
index 9a15ba12db7..1b32e96d009 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
@@ -15,13 +15,15 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Agglomerate patch faces
 for i in bottomAir topAir
 do
-    faceAgglomerate -region $i -dict constant/viewFactorsDict > log.faceAgglomerate.$i 2>&1
+    runApplication -s $i \
+        faceAgglomerate -region $i -dict constant/viewFactorsDict
 done
 
 # Generate view factors
 for i in bottomAir topAir
 do
-    viewFactorsGen -region $i > log.viewFactorsGen.$i 2>&1
+    runApplication -s $i \
+        viewFactorsGen -region $i
 done
 
 runApplication `getApplication`
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
index 29340be8b7a..f248b4fb32d 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
@@ -18,13 +18,15 @@ runApplication decomposePar -allRegions
 # Agglomerate patch faces
 for i in bottomAir topAir
 do
-    mpirun -np 4 faceAgglomerate -region $i -dict constant/viewFactorsDict -parallel>   log.faceAgglomerate.$i 2>&1
+    runParallel -s $i -np 4 \
+        faceAgglomerate -region $i -dict constant/viewFactorsDict
 done
 
 # Generate view factors
 for i in bottomAir topAir
 do
-    mpirun -np 4 viewFactorsGen -region $i -parallel > log.viewFactorsGen.$i 2>&1
+    runParallel -s $i -np 4 \
+        viewFactorsGen -region $i
 done
 
 # Run
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun.pre
index ae1d9ff7511..22b2e59f126 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun.pre
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun.pre
@@ -17,7 +17,7 @@ done
 
 for i in bottomAir topAir heater leftSolid rightSolid
 do
-    changeDictionary -region $i > log.changeDictionary.$i 2>&1
+    runApplication -s $i  changeDictionary -region $i
 done
 
 
diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
index a61f812ff4a..26d2834e812 100755
--- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
+++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
@@ -17,15 +17,11 @@ do
     sed "s/XXX/$e/g" constant/transportProperties.template \
         > constant/transportProperties
 
-    runApplication `getApplication`
-
-    mv log.boundaryFoam log.boundaryFoam_$e
+    runApplication -s $e  `getApplication`
 
     # extract y+, U+
     # note: both must be added to foamLog.db
-    runApplication foamLog log.boundaryFoam_$e
-
-    mv log.foamLog log.foamLog_$e
+    runApplication -s $e  foamLog log.boundaryFoam.$e
 
     if [ -e logs/yPlus_0 ]
     then
diff --git a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun.pre b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun.pre
index eff1c822a7f..b43a8903996 100755
--- a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun.pre
+++ b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun.pre
@@ -9,13 +9,14 @@ runApplication surfaceFeatureExtract
 runApplication foamyHexMesh
 
 # Collapse only patch faces from incomplete conformation
-cp system/collapseDict.indirectPatchFaces system/collapseDict
-runApplication collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite
-mv log.collapseEdges log.collapseEdges-indirectPatchFaces
+runApplication -s indirectPatchFaces \
+    collapseEdges -collapseFaceSet indirectPatchFaces -latestTime -overwrite \
+                  -dict system/collapseDict.indirectPatchFaces
 
 # Collapse small edges and sliver faces
-cp system/collapseDict.collapseFaces system/collapseDict
-runApplication collapseEdges -collapseFaces -latestTime -overwrite
+runApplication -s collapseFaces \
+    collapseEdges -collapseFaces -latestTime -overwrite \
+                  -dict system/collapseDict.collapseFaces
 
 runApplication checkMesh -allTopology -allGeometry -latestTime
 
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
index 70e1cd081ef..ae65df0e259 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
@@ -5,7 +5,6 @@ cp -rf 0.org 0
 runApplication blockMesh
 
 #runApplication setSet -batch wallFilmRegion.setSet
-#mv log.setSet log.wallFilmRegion.setSet
 runApplication topoSet
 
 runApplication extrudeToRegionMesh -overwrite
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
index 79670e84ee0..29817ff80b6 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
@@ -8,15 +8,11 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 application=`getApplication`
 
-runApplication decomposePar -region wallFilmRegion
-mv log.decomposePar log.decomposePar.wallFilmRegion
-runApplication decomposePar
-mv log.decomposePar log.decomposePar.primaryRegion
+runApplication -s wallFilmRegion decomposePar -region wallFilmRegion
+runApplication -s primaryRegion  decomposePar
 
 runParallel $application
 
-runApplication reconstructPar -region wallFilmRegion
-mv log.reconstructPar log.reconstructPar.wallFilmRegion
-runApplication reconstructPar
-mv log.reconstructPar log.reconstructPar.primaryRegion
+runApplication -s wallFilmRegion reconstructPar -region wallFilmRegion
+runApplication -s primaryRegion  reconstructPar
 
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
index 06e9e9ec5fb..784b007b2c1 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
@@ -16,8 +16,7 @@ runApplication topoSet
 runApplication subsetMesh c0 -patch wallFilm -overwrite
 
 # split the obstacle patches into cube[1-6]_patch[1-6]
-echo "running patchifyObstacles"
-./patchifyObstacles > log.patchifyObstacles 2>&1
+runApplication ./patchifyObstacles
 
 # Create the wall film region via extrusion
 runApplication extrudeToRegionMesh -overwrite
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
index 3ab62f90f53..d00e6b23ff0 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
@@ -6,7 +6,6 @@ cp -rf 0.org 0
 runApplication blockMesh
 
 #runApplication setSet -batch wallFilmRegion.setSet
-#mv log.setSet log.wallFilmRegion.setSet
 runApplication topoSet -dict system/wallFilmRegion.topoSet
 
 runApplication extrudeToRegionMesh -overwrite
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
index 6924ed90016..512715678f4 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
@@ -5,17 +5,25 @@ cp -rf 0.org 0
 
 runApplication blockMesh
 
-#runApplication setSet -batch wallFilmRegion.setSet
-#mv log.setSet log.wallFilmRegion.setSet
-runApplication topoSet -dict system/wallFilmRegion.topoSet
-mv log.topoSet log.wallFilmRegion.topoSet
+#If using batch mode
+#runApplication -s wallFilmRegion \
+#    setSet -batch wallFilmRegion.setSet
+
+#If using dictionary mode
+runApplication -s wallFilmRegion \
+    topoSet -dict system/wallFilmRegion.topoSet
 
 runApplication extrudeToRegionMesh -overwrite
 
-#runApplication setSet -region wallFilmRegion -batch createWallFilmRegionPatches.setSet
-#mv log.setSet log.createWallFilmRegionPatches.setSet
-runApplication topoSet -region wallFilmRegion -dict system/createWallFilmRegionPatches.topoSet
-mv log.topoSet log.createWallFilmRegionPatches.topoSet
+#If using batch mode
+#runApplication -s createWallFilmRegionPatches \
+#    setSet -region wallFilmRegion \
+#           -batch createWallFilmRegionPatches.setSet
+
+#If using dictionary mode
+runApplication -s createWallFilmRegionPatches \
+    topoSet -region wallFilmRegion \
+            -dict system/createWallFilmRegionPatches.topoSet
 
 runApplication createPatch -region wallFilmRegion -overwrite
 
diff --git a/tutorials/mesh/foamyHexMesh/blob/Allrun b/tutorials/mesh/foamyHexMesh/blob/Allrun
index 5b36f0de083..a4d7bd61d58 100755
--- a/tutorials/mesh/foamyHexMesh/blob/Allrun
+++ b/tutorials/mesh/foamyHexMesh/blob/Allrun
@@ -9,11 +9,11 @@ cp $FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/
 
 runApplication foamyHexMesh
 
-runApplication collapseEdges -latestTime -collapseFaces
-mv log.collapseEdges log.collapseFaces
+runApplication -s collapseFaces \
+    collapseEdges -latestTime -collapseFaces
 
-runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
-mv log.collapseEdges log.collapseFaceSet
+runApplication -s collapseFaceSet \
+    collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 
 runApplication checkMesh -latestTime -allGeometry -allTopology
 
diff --git a/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel b/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
index bcc119f2403..7947ab35f21 100755
--- a/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
+++ b/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
@@ -12,11 +12,11 @@ runApplication decomposePar -region backgroundMeshDecomposition
 
 runParallel foamyHexMesh
 
-runParallel collapseEdges -latestTime -collapseFaces
-mv log.collapseEdges log.collapseFaces
+runParallel -s collapseFaces \
+    collapseEdges -latestTime -collapseFaces
 
-runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
-mv log.collapseEdges log.collapseFaceSet
+runParallel -s collapseFaceSet \
+    collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 
 runParallel checkMesh -latestTime -allTopology -allGeometry
 
diff --git a/tutorials/mesh/foamyHexMesh/flange/Allrun b/tutorials/mesh/foamyHexMesh/flange/Allrun
index fff3c129773..414ca8f4a3d 100755
--- a/tutorials/mesh/foamyHexMesh/flange/Allrun
+++ b/tutorials/mesh/foamyHexMesh/flange/Allrun
@@ -9,11 +9,11 @@ cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/
 
 runApplication foamyHexMesh
 
-runApplication collapseEdges -latestTime -collapseFaces
-mv log.collapseEdges log.collapseFaces
+runApplication -s collapseFaces \
+    collapseEdges -latestTime -collapseFaces
 
-runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
-mv log.collapseEdges log.collapseFaceSet
+runApplication -s collapseFaceSet \
+    collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 
 runApplication checkMesh -latestTime -allGeometry -allTopology
 
diff --git a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
index bd04a36575a..fb57faff8e1 100755
--- a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
+++ b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
@@ -13,11 +13,11 @@ runApplication decomposePar -region backgroundMeshDecomposition
 
 runParallel foamyHexMesh
 
-runParallel collapseEdges -latestTime -collapseFaces
-mv log.collapseEdges log.collapseFaces
+runParallel -s collapseFaces \
+    collapseEdges -latestTime -collapseFaces
 
-runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
-mv log.collapseEdges log.collapseFaceSet
+runParallel -s collapseFaceSet \
+    collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 
 runParallel checkMesh -latestTime -allTopology -allGeometry
 
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
index 58e149a7494..b95aabe645f 100755
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
@@ -6,19 +6,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 intersectSurfaces()
 {
-    runApplication              \
-        surfaceBooleanFeatures  \
-        intersection            \
-        "$@"
-
     outputName1=$(basename $1)
     outputName1=${outputName1%.*}
 
     outputName2=$(basename $2)
     outputName2=${outputName2%.*}
 
-    mv log.surfaceBooleanFeatures \
-       log.surfaceBooleanFeatures.$outputName1:$outputName2
+    runApplication -s $outputName1:$outputName2 \
+        surfaceBooleanFeatures intersection "$@"
 }
 
 # Set application name
@@ -77,30 +72,33 @@ done
 
 # Meshing
 \cp system/controlDict.mesh system/controlDict
-\cp system/collapseDict.collapseFaces system/collapseDict
 
 runApplication blockMesh -region backgroundMeshDecomposition
 
-runApplication decomposePar -region backgroundMeshDecomposition
+runApplication -s backgroundMeshDecomposition \
+    decomposePar -region backgroundMeshDecomposition
 
 runApplication surfaceFeatureExtract
 
 runParallel foamyHexMesh
 
-runParallel collapseEdges -collapseFaces -latestTime
-mv log.collapseEdges log.collapseFaces
+runParallel -s faces \
+    collapseEdges -collapseFaces -latestTime \
+                  -dict system/collapseDict.collapseFaces
 
-#\cp system/collapseDict.indirectPatchFaces system/collapseDict
-#runParallel collapseEdges -collapseFaceSet indirectPatchFaces -latestTime
-#mv log.collapseEdges log.collapseFaceSet
+#runParallel -s faceSet  \
+#    collapseEdges -collapseFaceSet indirectPatchFaces -latestTime \
+#                  -dict system/collapseDict.indirectPatchFaces
 
 runParallel checkMesh -allTopology -allGeometry -latestTime
 
 runApplication reconstructParMesh -latestTime
 
-# Copy the mesh into polyMesh and delete the 102 directory
-\cp -r 101/polyMesh constant
-\rm -rf 101
+# Copy the mesh from the latest time folder into polyMesh and delete that
+# latest time folder
+latestTime=$(foamListTimes -latestTime)
+\cp -r $latestTime/polyMesh constant
+\rm -rf $latestTime
 
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
index 69e6c8f61ed..6d2f7197876 100755
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
@@ -24,8 +24,8 @@ runApplication createPatch -overwrite
 runApplication setFields
 
 # Decompose
-\rm log.decomposePar
-runApplication decomposePar -force
+runApplication -s main \
+    decomposePar -force
 
 # Run
 runParallel $application
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict b/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict
deleted file mode 100644
index 0389a33b5a4..00000000000
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict
+++ /dev/null
@@ -1,85 +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          ascii;
-    class           dictionary;
-    object          collapseDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-// If on, after collapsing check the quality of the mesh. If bad faces are
-// generated then redo the collapsing with stricter filtering.
-controlMeshQuality      on;
-
-collapseEdgesCoeffs
-{
-    // Edges shorter than this absolute value will be merged
-    minimumEdgeLength   1e-6;
-
-    // The maximum angle between two edges that share a point attached to
-    // no other edges
-    maximumMergeAngle   180;
-}
-
-
-collapseFacesCoeffs
-{
-    // The initial face length factor
-    initialFaceLengthFactor                 1;
-
-    // If the face can't be collapsed to an edge, and it has a span less than
-    // the target face length multiplied by this coefficient, collapse it
-    // to a point.
-    maxCollapseFaceToPointSideLengthCoeff   0.3;
-
-    // Allow early collapse of edges to a point
-    allowEarlyCollapseToPoint               on;
-
-    // Fraction to premultiply maxCollapseFaceToPointSideLengthCoeff by if
-    // allowEarlyCollapseToPoint is enabled
-    allowEarlyCollapseCoeff                 0.2;
-
-    // Defining how close to the midpoint (M) of the projected
-    // vertices line a projected vertex (X) can be before making this
-    // an invalid edge collapse
-    //
-    // X---X-g----------------M----X-----------g----X--X
-    //
-    // Only allow a collapse if all projected vertices are outwith
-    // guardFraction (g) of the distance form the face centre to the
-    // furthest vertex in the considered direction
-    guardFraction                           0.1;
-}
-
-
-controlMeshQualityCoeffs
-{
-    // Name of the dictionary that has the mesh quality coefficients used
-    // by motionSmoother::checkMesh
-    #include                    "meshQualityDict";
-
-    // The amount that minimumEdgeLength will be reduced by for each
-    // edge if that edge's collapse generates a poor quality face
-    edgeReductionFactor         0.5;
-
-    // The amount that initialFaceLengthFactor will be reduced by for each
-    // face if its collapse generates a poor quality face
-    faceReductionFactor         0.5;
-
-    // Maximum number of outer iterations is mesh quality checking is enabled
-    maximumIterations           10;
-
-    maximumSmoothingIterations  1;
-
-    maxPointErrorCount          3;
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict b/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict
new file mode 120000
index 00000000000..b1789d920b4
--- /dev/null
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/system/collapseDict
@@ -0,0 +1 @@
+collapseDict.collapseFaces
\ No newline at end of file
diff --git a/tutorials/mesh/foamyHexMesh/simpleShapes/Allrun b/tutorials/mesh/foamyHexMesh/simpleShapes/Allrun
index c0d7aab678c..1254efdb611 100755
--- a/tutorials/mesh/foamyHexMesh/simpleShapes/Allrun
+++ b/tutorials/mesh/foamyHexMesh/simpleShapes/Allrun
@@ -4,28 +4,28 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-runApplication surfaceOrient \
-    constant/triSurface/cone.stl \
-    -inside '(0 -0.5 0)' \
-    constant/triSurface/cone_orient.stl
-mv log.surfaceOrient log.surfaceOrient.cone
-
-runApplication surfaceOrient \
-    constant/triSurface/sphere.stl \
-    -inside '(0 -0.5 0)' \
-    constant/triSurface/sphere_orient.stl
-mv log.surfaceOrient log.surfaceOrient.sphere
-
-runApplication surfaceBooleanFeatures intersection \
-                       constant/triSurface/cone_orient.stl \
-                       constant/triSurface/sphere_orient.stl
+runApplication -s cone \
+    surfaceOrient constant/triSurface/cone.stl \
+                  -inside '(0 -0.5 0)' \
+                  constant/triSurface/cone_orient.stl
+
+runApplication -s sphere \
+    surfaceOrient constant/triSurface/sphere.stl \
+                  -inside '(0 -0.5 0)' \
+                  constant/triSurface/sphere_orient.stl
+
+runApplication \
+    surfaceBooleanFeatures intersection \
+                           constant/triSurface/cone_orient.stl \
+                           constant/triSurface/sphere_orient.stl
 
 runApplication foamyHexMesh
 
-runApplication collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
-mv log.collapseEdges log.collapseFaceSet
+runApplication -s collapseFaceSet \
+    collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 
-runApplication collapseEdges -latestTime -collapseFaces
+runApplication -s collapseFaces \
+    collapseEdges -latestTime -collapseFaces
 
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/mesh/refineMesh/refineFieldDirs/Allrun b/tutorials/mesh/refineMesh/refineFieldDirs/Allrun
index 3498d6b3bbe..c3bdd399618 100755
--- a/tutorials/mesh/refineMesh/refineFieldDirs/Allrun
+++ b/tutorials/mesh/refineMesh/refineFieldDirs/Allrun
@@ -17,16 +17,15 @@ mkdir 0
 # Refine over Z, in 6 passes
 for index in 1 2 3 4 5 6; do
 
-  runApplication calcRadiusField
-  mv log.calcRadiusField log.calcRadiusField.tier$index
+  runApplication -s tier$index  calcRadiusField
 
-  runApplication topoSet -dict system/topoSetDict.tier$index
-  mv log.topoSet log.topoSet.tier$index
+  runApplication -s tier$index \
+      topoSet -dict system/topoSetDict.tier$index
 
   ## foamToVTK -cellSet tier$index
 
-  runApplication refineMesh -dict system/refineMeshDict.tier$index -overwrite
-  mv log.refineMesh log.refineMesh.tier$index
+  runApplication -s tier$index \
+      refineMesh -dict system/refineMeshDict.tier$index -overwrite
 
   rm -r 0/*
 
@@ -35,17 +34,15 @@ done
 # Refine over cylindrical coordinates, in 3 passes
 for index in 1 2 3; do
 
-  runApplication calcRadiusField -calcDirections
-  mv log.calcRadiusField log.calcRadiusField.range$index
+  runApplication -s range$index  calcRadiusField -calcDirections
 
-  runApplication topoSet -dict system/topoSetDict.range$index
-  mv log.topoSet log.topoSet.range$index
+  runApplication -s range$index \
+      topoSet -dict system/topoSetDict.range$index
 
   ## foamToVTK -cellSet tier$index
 
-  runApplication refineMesh -dict system/refineMeshDict.range$index \
-      -overwrite
-  mv log.refineMesh log.refineMesh.range$index
+  runApplication -s range$index \
+      refineMesh -dict system/refineMeshDict.range$index -overwrite
 
   rm -r 0/*
 
diff --git a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
index 636c425d4c5..49e618ecd43 100755
--- a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
@@ -4,12 +4,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-runRefineMesh ()
-{
-    echo "Running refineMesh on $PWD"
-    refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh 2>&1
-}
-
 # copy DTC hull surface from resources folder
 cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
 
@@ -17,17 +11,13 @@ runApplication surfaceFeatureExtract
 
 runApplication blockMesh
 
-i=1
-if [ -f log.topoSet.6 ] ; then
-   i=7
-fi
-while [ "$i" -lt 7 ] ; do
-    cp system/topoSetDict.${i} system/topoSetDict
-    runApplication topoSet
-    runRefineMesh
-    mv log.topoSet log.topoSet.$i
-    mv log.refineMesh log.refineMesh.$i
-    i=$(expr $i + 1)
+for i in 1 2 3 4 5 6
+do
+    runApplication -s $i \
+        topoSet -dict system/topoSetDict.${i}
+
+    runApplication -s $i \
+        refineMesh -dict system/refineMeshDict -overwrite
 done
 
 runApplication snappyHexMesh -overwrite
diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
index 3c04c72a4eb..5b0b162e78c 100755
--- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
+++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
@@ -7,28 +7,15 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Get application name
 application=`getApplication`
 
-runRefineMesh ()
-{
-    echo "Running refineMesh on $PWD"
-    refineMesh -dict system/refineMeshDict > log.refineMesh 2>&1
-}
-
 runApplication blockMesh
 
-i=1
-if [ -f log.topoSet ] ; then
-   i=3
-fi
-while [ "$i" -lt 3 ] ; do
-    if [ -f log.topoSet ] ; then
-        mv log.topoSet log.topoSet.1
-    fi
-    cp system/topoSetDict.${i} system/topoSetDict
-    runApplication topoSet
-    runRefineMesh
-    cp -r 1e-08/polyMesh/* constant/polyMesh
-    rm -rf 1e-08
-    i=`expr $i + 1`
+for i in 1 2
+do
+    runApplication -s $i \
+        topoSet -dict system/topoSetDict.${i}
+
+    runApplication -s $i \
+        refineMesh -dict system/refineMeshDict -overwrite
 done
 
 runApplication $application
diff --git a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
index 636c425d4c5..49e618ecd43 100755
--- a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
@@ -4,12 +4,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-runRefineMesh ()
-{
-    echo "Running refineMesh on $PWD"
-    refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh 2>&1
-}
-
 # copy DTC hull surface from resources folder
 cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
 
@@ -17,17 +11,13 @@ runApplication surfaceFeatureExtract
 
 runApplication blockMesh
 
-i=1
-if [ -f log.topoSet.6 ] ; then
-   i=7
-fi
-while [ "$i" -lt 7 ] ; do
-    cp system/topoSetDict.${i} system/topoSetDict
-    runApplication topoSet
-    runRefineMesh
-    mv log.topoSet log.topoSet.$i
-    mv log.refineMesh log.refineMesh.$i
-    i=$(expr $i + 1)
+for i in 1 2 3 4 5 6
+do
+    runApplication -s $i \
+        topoSet -dict system/topoSetDict.${i}
+
+    runApplication -s $i \
+        refineMesh -dict system/refineMeshDict -overwrite
 done
 
 runApplication snappyHexMesh -overwrite
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
index 2b47281b6c4..40f5f5f1d4d 100755
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
@@ -25,9 +25,7 @@ runApplication renumberMesh -overwrite
 # - generate face/cell sets and zones
 
 #runApplication setSet -batch createInletOutletSets.setSet
-#mv log.setSet log.createInletOutletSets.setSet
 runApplication topoSet -dict system/createInletOutletSets.topoSetDict
-#mv log.topoSet log.createInletOutletSets.topoSet
 
 
 # - create the inlet/outlet and AMI patches
@@ -35,7 +33,7 @@ runApplication topoSet -dict system/createInletOutletSets.topoSetDict
 runApplication createPatch -overwrite
 
 
-# - test by running moveDynamicMes
+# - test by running moveDynamicMesh
 #runApplication moveDynamicMesh -checkAMI
 
 
diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
index 0e00b6b1a34..4358c300592 100755
--- a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
+++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
@@ -8,10 +8,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 application=`getApplication`
 
 runApplication blockMesh
-runApplication topoSet
-mv log.topoSet log.topoSet.1
+
+runApplication -s 1  topoSet
+
 runApplication subsetMesh -overwrite c0 -patch floatingObject
-runApplication topoSet -dict system/topoSetDict-selectBottom
+
+runApplication -s selectBottom \
+    topoSet -dict system/topoSetDict-selectBottom
+
 runApplication createPatch -overwrite
 
 cp -r 0.org 0 > /dev/null 2>&1
-- 
GitLab