From 182f66063435cc4aa6c4e316bacc8b1f4e83bce9 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Fri, 26 Oct 2012 10:27:30 +0100
Subject: [PATCH] ENH: Updates to tutorial Allrun scripts

---
 .../combustion/engineFoam/kivaTest/Allrun     | 30 +++----------------
 .../mixerVessel2D/makeMesh                    |  7 +++--
 .../sonicFoam/ras/nacaAirfoil/Allrun          | 15 ++--------
 .../buoyantCavity/validation/createGraphs     | 10 ++++++-
 .../circuitBoardCooling/Allrun                |  2 +-
 .../MRFSimpleFoam/mixerVessel2D/makeMesh      | 10 +++++--
 .../pimpleDyMFoam/mixerVesselAMI2D/Allrun     |  1 -
 .../pimpleDyMFoam/mixerVesselAMI2D/makeMesh   | 13 ++++++--
 .../pimpleFoam/TJunctionFan/Allrun            |  8 +++--
 .../pimpleFoam/elipsekkLOmega/Allrun          |  2 +-
 .../reactingParcelFoam/filter/Allrun          |  6 ++--
 .../interFoam/ras/damBreakPorousBaffle/Allrun |  2 +-
 12 files changed, 51 insertions(+), 55 deletions(-)

diff --git a/tutorials/combustion/engineFoam/kivaTest/Allrun b/tutorials/combustion/engineFoam/kivaTest/Allrun
index 21d4983a939..5088aaff7bf 100755
--- a/tutorials/combustion/engineFoam/kivaTest/Allrun
+++ b/tutorials/combustion/engineFoam/kivaTest/Allrun
@@ -7,36 +7,14 @@ cd ${0%/*} || exit 1    # run from this directory
 # Get application name
 application=`getApplication`
 
-runKivaToFoam()
-{
-    if [ -f log.kivaToFoam ]
-    then
-        echo "kivaToFoam already run: remove log file to re-run"
-    else
-        echo "kivaToFoam: converting kiva file"
-        kivaToFoam -file $1 > log.kivaToFoam 2>&1
-    fi
-}
-
-
-restartApplication()
-{
-    if [ -f log-2.$1 ]
-    then
-        echo "$1 already run: remove log file to re-run"
-    else
-        echo "Running $1"
-        $1 > log-2.$1 2>&1
-    fi
-}
-
-
-runKivaToFoam otape17
+runApplication kivaToFoam -file otape17
 
 cp system/controlDict.1st system/controlDict
 runApplication $application
+mv log.$application log.$application.1
 
 cp system/controlDict.2nd system/controlDict
-restartApplication $application
+runApplication $application
+mv log.$application log.$application.2
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh
index 937900177cf..3d13f36b4fd 100755
--- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh
+++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh
@@ -1,5 +1,8 @@
 #!/bin/sh
-set -x
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
-blockMesh > log.blockMesh 2>&1
+runApplication blockMesh
diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
index 6142b9557c8..7ff431e35f3 100755
--- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
+++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
@@ -7,24 +7,13 @@ cd ${0%/*} || exit 1    # run from this directory
 # Get application name
 application=`getApplication`
 
-runStarToFoam()
-{
-    if [ -f log.star3ToFoam -o -f log.starToFoam ]
-    then
-        echo "star3ToFoam already run on $PWD: remove log file to re-run"
-    else
-        echo "star3ToFoam: converting mesh $1"
-        star3ToFoam $1 > log.star3ToFoam 2>&1
-    fi
-}
+runApplication star3ToFoam prostar/nacaAirfoil
 
-runStarToFoam prostar/nacaAirfoil
 mv constant/polyMesh/boundary temp
 sed -e s/"\([\t ]*type[\t ]*\)symmetryPlane"/"\1empty"/g \
     temp > constant/polyMesh/boundary
 rm temp
-runApplication $application
 
-# end-of-file
+runApplication $application
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
index 2d9ceeb49a1..4baed11dace 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
@@ -83,8 +83,16 @@ type -P gnuplot &>/dev/null || {
     exit 1
 }
 
+SETSDIR="../sets"
+
+if [ ! -d $SETSDIR ]
+then
+    echo "createGraphs: results sets not available in folder $SETSDIR"
+    exit 0
+fi
+
 # paths to data
-LATESTTIME=`ls ../sets`
+LATESTTIME=`ls $SETSDIR`
 OFDATAROOT=../sets/$LATESTTIME
 
 EXPTDATAROOT=./exptData
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
index 6de4b18840f..ed131900d36 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
@@ -13,7 +13,7 @@ unset FOAM_SETNAN
 unset FOAM_SIGFPE
 
 # Create first baffle
-createBaffles baffleFaces '(baffle1Wall_0 baffle1Wall_1)' -overwrite > log.createBaffles 2>&1
+runApplication createBaffles baffleFaces '(baffle1Wall_0 baffle1Wall_1)' -overwrite
 
 # Create region
 runApplication extrudeToRegionMesh -overwrite
diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh
index 937900177cf..8cb3ae622ef 100755
--- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh
+++ b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh
@@ -1,5 +1,11 @@
 #!/bin/sh
-set -x
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
-blockMesh > log.blockMesh 2>&1
+
+runApplication blockMesh
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
index 3aa63c00d9b..f0383778536 100755
--- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
@@ -1,7 +1,6 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
 
-
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh
index edcd0dadfe3..937765f7cb7 100755
--- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh
+++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh
@@ -1,6 +1,13 @@
 #!/bin/sh
-set -x
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
-blockMesh > log.blockMesh 2>&1
-topoSet
+
+runApplication blockMesh
+
+runApplication topoSet
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
index 84758693b88..2374d2fb6c3 100755
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
@@ -16,9 +16,13 @@ unset FOAM_SETNAN
 
 # Create faceZones for fan and baffles
 runApplication topoSet
+
 # Create fan cyclics
-createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite > log.createBaffles 2>&1
+runApplication createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite
+mv log.createBaffles log.createBaffles.1
+
 # Create wall baffles
-createBaffles baffleFaces '(baffles baffles)' -overwrite > log.createBaffles 2>&1
+runApplication createBaffles baffleFaces '(baffles baffles)' -overwrite
+mv log.createBaffles log.createBaffles.2
 
 runApplication $application
diff --git a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
index fd85f49a951..656b92f3add 100755
--- a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
+++ b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
@@ -8,7 +8,7 @@ cd ${0%/*} || exit 1    # run from this directory
 application=`getApplication`
 
 runApplication blockMesh
-transformPoints -scale '(1.6666 1 1)'
+runApplication transformPoints -scale '(1.6666 1 1)'
 
 runApplication changeDictionary -instance system -dict system/changeDictionaryDict.X
 runApplication mirrorMesh -overwrite
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
index 061be5a02eb..b7428e064f4 100755
--- a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
@@ -21,10 +21,12 @@ setsToZones -noFlipMap > log.setsToZones 2>&1
 # - use binary writing to avoid 'nan'
 # - use setFields to set values
 unset FOAM_SIGFPE
-createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite > log.createBaffles1 2>&1
+runApplication createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite
+mv log.createBaffles log.createBaffles1
 
 # create the second cyclic - rhs of porous zone
-createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite > log.createBaffles2 2>&1
+runApplication createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite
+mv log.createBaffles log.createBaffles2
 
 # Initialise newly created patchFields to 0
 runApplication changeDictionary
diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
index 29758935af3..32c7e6f9481 100755
--- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
+++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
@@ -16,7 +16,7 @@ unset FOAM_SETNAN
 # Create faceZones for porous baffles
 runApplication topoSet
 
-createBaffles cyclicZoneFaces '(porous_half0 porous_half1)' -overwrite > log.createBaffles 2>&1
+runApplication createBaffles cyclicZoneFaces '(porous_half0 porous_half1)' -overwrite
 
 runApplication changeDictionary
 
-- 
GitLab