From b3d47f042375ffc6c492b69e8492aab6bd8cef3c Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Wed, 27 Jan 2016 14:19:25 +0000
Subject: [PATCH] bin/tools/RunFunctions: runParallel now obtains the number of
 processors from numberOfSubdomains in decomposeParDict.

This default number of processors may be overridden by the new "-np"
option to runParallel which must be specified before the application
name e.g.:

runParallel -np 4 pisoFoam
---
 bin/tools/RunFunctions                                | 10 ++++++----
 .../fireFoam/les/oppositeBurningPanels/Allrun         |  2 +-
 .../combustion/fireFoam/les/smallPoolFire3D/Allrun    |  2 +-
 .../discreteMethods/dsmcFoam/supersonicCorner/Allrun  |  4 ++--
 tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun  |  4 ++--
 .../molecularDynamics/mdFoam/nanoNozzle/Allrun        |  4 ++--
 .../externalCoupledCavity/Allrun-parallel             |  2 +-
 .../chtMultiRegionFoam/multiRegionHeater/Allrun       |  2 +-
 .../chtMultiRegionFoam/snappyMultiRegionHeater/Allrun |  2 +-
 .../heatExchanger/Allrun-parallel                     |  2 +-
 .../multiRegionHeaterRadiation/Allrun-parallel        |  2 +-
 .../pimpleDyMFoam/mixerVesselAMI2D/Allrun             |  2 +-
 .../oscillatingInletACMI2D/Allrun-parallel            |  2 +-
 .../incompressible/pimpleDyMFoam/propeller/Allrun     |  2 +-
 .../incompressible/pimpleDyMFoam/wingMotion/Allrun    |  2 +-
 tutorials/incompressible/pimpleFoam/channel395/Allrun |  2 +-
 .../pisoFoam/les/motorBike/lesFiles/Allrun            |  2 +-
 .../pisoFoam/les/motorBike/motorBike/Allrun           |  8 ++++----
 tutorials/incompressible/simpleFoam/motorBike/Allrun  |  8 ++++----
 tutorials/incompressible/simpleFoam/pipeCyclic/Allrun |  2 +-
 .../incompressible/simpleFoam/turbineSiting/Allrun    |  6 +++---
 tutorials/lagrangian/MPPICFoam/cyclone/Allrun         |  9 ++++++---
 .../icoUncoupledKinematicParcelFoam/hopper/Allrun     |  4 ++--
 .../reactingParcelFilmFoam/hotBoxes/Allrun-parallel   |  2 +-
 tutorials/mesh/foamyHexMesh/blob/Allrun-parallel      | 11 ++++-------
 tutorials/mesh/foamyHexMesh/flange/Allrun-parallel    | 11 ++++-------
 tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre    | 11 ++++-------
 .../mesh/foamyHexMesh/mixerVessel/Allrun-simulation   |  5 +----
 .../mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam  |  5 +----
 .../multiphase/cavitatingFoam/les/throttle3D/Allrun   |  2 +-
 .../laminar/depthCharge3D/Allrun                      |  2 +-
 tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun  |  4 ++--
 .../multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun |  2 +-
 tutorials/multiphase/interFoam/laminar/Allrun         |  2 +-
 tutorials/multiphase/interFoam/ras/Allrun             |  2 +-
 tutorials/multiphase/interFoam/ras/DTCHull/Allrun     |  4 ++--
 .../interPhaseChangeDyMFoam/propeller/Allrun          |  2 +-
 .../multiphaseEulerFoam/damBreak4phaseFine/Allrun     |  2 +-
 .../laminar/mixerVesselAMI2D/Allrun                   |  2 +-
 .../laminar/damBreak4phaseFine/Allrun                 |  2 +-
 40 files changed, 73 insertions(+), 83 deletions(-)

diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index 6dd1fbafa56..8465acbe079 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -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
@@ -81,6 +81,7 @@ runParallel()
     APP_RUN=
     LOG_IGNORE=false
     LOG_APPEND=false
+    nProcs=$(getNumberOfProcessors)
 
     # Parse options and executable
     while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
@@ -93,12 +94,13 @@ runParallel()
             -overwrite)
                 LOG_IGNORE=true
                 ;;
+            -np)
+                nProcs="$2"
+                shift
+                ;;
             *)
                 APP_RUN="$key"
                 APP_NAME="${key##*/}"
-                # also read number of processors
-                nProcs="$2"
-                shift
                 ;;
         esac
     shift
diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
index 5528c96c783..7b08d9dbdf1 100755
--- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
+++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
@@ -30,7 +30,7 @@ decomposePar -region panelRegion > log.decomposeParPanelRegion 2>&1
 
 decomposePar -fields > log.decomposePar 2>&1
 
-runParallel `getApplication` 6
+runParallel `getApplication`
 
 paraFoam -touch
 paraFoam -touch -region panelRegion
diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun b/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
index ebd159495f7..1197f13ca7a 100755
--- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
+++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
@@ -12,6 +12,6 @@ runApplication createPatch -overwrite
 runApplication decomposePar -force
 
 # Run
-runParallel $application 4
+runParallel $application
 
 # -----------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun b/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
index 8e706a5ac4e..8704a9b0cbb 100755
--- a/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication decomposePar
-runParallel dsmcInitialise 4
-runParallel `getApplication` 4
+runParallel dsmcInitialise
+runParallel `getApplication`
 runApplication reconstructPar -noLagrangian
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun b/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
index 51572e4010a..7c0b4547401 100755
--- a/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication decomposePar
-runParallel dsmcInitialise 4
-runParallel `getApplication` 4
+runParallel dsmcInitialise
+runParallel `getApplication`
 runApplication reconstructPar -noLagrangian
 
 
diff --git a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
index 697eb2c899a..4cdfac76e02 100755
--- a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
+++ b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
@@ -11,8 +11,8 @@ runApplication blockMesh
 
 runApplication decomposePar
 
-runParallel mdInitialise 4
-runParallel $application 4
+runParallel mdInitialise
+runParallel $application
 
 runApplication reconstructPar
 
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel
index 8c451a124e8..4c959ca647b 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel
@@ -8,7 +8,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel $(getApplication) 4 &
+runParallel $(getApplication) &
 
 ./externalSolver
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
index bf6e7f74877..d0bf0a098ac 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
@@ -29,7 +29,7 @@ done
 runApplication decomposePar -allRegions
 
 # Run
-runParallel `getApplication` 4
+runParallel `getApplication`
 
 # Reconstruct
 runApplication reconstructPar -allRegions
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
index 1b68a368e41..d53a286e73f 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
@@ -34,7 +34,7 @@ runApplication `getApplication`
 #runApplication decomposePar -allRegions
 #
 ## Run
-#runParallel `getApplication` 4
+#runParallel `getApplication`
 #
 ## Reconstruct
 #runApplication reconstructPar -allRegions
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
index 70ac496b645..32143f46ad6 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel
@@ -13,7 +13,7 @@ mv log.decomposePar log.decomposePar.air
 runApplication decomposePar -region porous
 mv log.decomposePar log.decomposePar.porous
 
-runParallel $(getApplication) 4
+runParallel $(getApplication)
 
 runApplication reconstructPar -latestTime -region air
 mv log.reconstructPar log.reconstructPar.air
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
index ea086b20bce..34abacf4ba4 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
@@ -28,7 +28,7 @@ do
 done
 
 # Run
-runParallel `getApplication` 4
+runParallel `getApplication`
 
 # Reconstruct
 runApplication reconstructPar -allRegions
diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
index 80a0ee95cf5..19debb7a094 100755
--- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
@@ -10,7 +10,7 @@ application=`getApplication`
 
 #runApplication $application
 runApplication decomposePar
-runParallel $application 4
+runParallel $application
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun-parallel b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun-parallel
index 0ee115c5777..3f7cab5d82e 100755
--- a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun-parallel
+++ b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun-parallel
@@ -8,6 +8,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel $(getApplication) 4
+runParallel $(getApplication)
 
 runApplication reconstructPar
diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
index 755e9652992..1d24256eb00 100755
--- a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
@@ -8,6 +8,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel `getApplication` 4
+runParallel `getApplication`
 
 runApplication reconstructPar
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
index 60c6459cfe2..c0443867adb 100755
--- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
@@ -24,7 +24,7 @@ cp -r 0.org 0
 runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
 mv 0/pointDisplacement.unmapped 0/pointDisplacement
 runApplication decomposePar
-runParallel `getApplication` 4
+runParallel `getApplication`
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/pimpleFoam/channel395/Allrun b/tutorials/incompressible/pimpleFoam/channel395/Allrun
index a94c6e72a3b..340e3e1ef88 100755
--- a/tutorials/incompressible/pimpleFoam/channel395/Allrun
+++ b/tutorials/incompressible/pimpleFoam/channel395/Allrun
@@ -14,7 +14,7 @@ runApplication blockMesh
 
 #- Run parallel
 runApplication decomposePar -cellDist
-runParallel $application 4
+runParallel $application
 runApplication reconstructPar
 
 runApplication postChannel
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
index d39ce623e95..be0ad68bf8d 100755
--- a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
+++ b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
@@ -11,7 +11,7 @@ ls -d processor* | xargs -I {} rm -rf ./{}/0 $1
 ls -d processor* | xargs -I {} mv ./{}/500 ./{}/0 $1
 ls -d processor* | xargs -I {} rm -rf ./{}/0/uniform $1
 
-runParallel pisoFoam 8
+runParallel pisoFoam
 
 runApplication reconstructParMesh -constant -mergeTol 1e-6
 
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
index 29462ed538c..dba0d829ff7 100755
--- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
+++ b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
@@ -15,16 +15,16 @@ cp system/decomposeParDict.hierarchical system/decomposeParDict
 runApplication decomposePar
 
 cp system/decomposeParDict.ptscotch system/decomposeParDict
-runParallel snappyHexMesh 8 -overwrite -parallel
+runParallel snappyHexMesh -overwrite -parallel
 
 find . -type f -iname "*level*" -exec rm {} \;
 
 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1
 
-runParallel renumberMesh 8 -overwrite
+runParallel renumberMesh -overwrite
 
-runParallel potentialFoam 8 -initialiseUBCs
+runParallel potentialFoam -initialiseUBCs
 
-runParallel `getApplication` 8
+runParallel `getApplication`
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/simpleFoam/motorBike/Allrun b/tutorials/incompressible/simpleFoam/motorBike/Allrun
index 7b751e1a1fd..9cdfeebbf4a 100755
--- a/tutorials/incompressible/simpleFoam/motorBike/Allrun
+++ b/tutorials/incompressible/simpleFoam/motorBike/Allrun
@@ -11,7 +11,7 @@ runApplication surfaceFeatureExtract
 runApplication blockMesh
 
 runApplication decomposePar
-runParallel snappyHexMesh 6 -overwrite
+runParallel snappyHexMesh -overwrite
 
 #- For non-parallel running
 #cp -r 0.org 0 > /dev/null 2>&1
@@ -20,9 +20,9 @@ runParallel snappyHexMesh 6 -overwrite
 ls -d processor* | xargs -I {} rm -rf ./{}/0
 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
 
-runParallel patchSummary 6
-runParallel potentialFoam 6
-runParallel $(getApplication) 6
+runParallel patchSummary
+runParallel potentialFoam
+runParallel $(getApplication)
 
 runApplication reconstructParMesh -constant
 runApplication reconstructPar -latestTime
diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
index 28f5ac16f87..dede11e268b 100755
--- a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
+++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
@@ -14,7 +14,7 @@ cp -r 0.org 0
 
 #runApplication $application
 runApplication decomposePar -cellDist
-runParallel $application 5
+runParallel $application
 
 runApplication reconstructPar
 
diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
index e2cd04e37a2..310b8184e71 100755
--- a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
+++ b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
@@ -12,14 +12,14 @@ cp system/decomposeParDict.hierarchical system/decomposeParDict
 runApplication decomposePar
 
 cp system/decomposeParDict.ptscotch system/decomposeParDict
-runParallel snappyHexMesh 4 -overwrite
+runParallel snappyHexMesh -overwrite
 
 find . -type f -iname "*level*" -exec rm {} \;
 
 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1
 
-runParallel topoSet 4
-runParallel `getApplication` 4
+runParallel topoSet
+runParallel `getApplication`
 
 runApplication reconstructParMesh -constant
 runApplication reconstructPar
diff --git a/tutorials/lagrangian/MPPICFoam/cyclone/Allrun b/tutorials/lagrangian/MPPICFoam/cyclone/Allrun
index aafb01639e4..20831ede748 100755
--- a/tutorials/lagrangian/MPPICFoam/cyclone/Allrun
+++ b/tutorials/lagrangian/MPPICFoam/cyclone/Allrun
@@ -1,9 +1,10 @@
 #!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
 
-cd ${0%/*} || exit 1
-
+# Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
+
 cp $FOAM_TUTORIALS/resources/geometry/cyclone.stl.gz constant/triSurface
 
 runApplication blockMesh
@@ -12,4 +13,6 @@ runApplication snappyHexMesh -overwrite
 
 runApplication decomposePar
 
-runParallel MPPICFoam $(echo processor* | wc -w)
+runParallel MPPICFoam
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
index 27f3f41e51d..c9e57d4e6f5 100755
--- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
+++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 cd hopperInitialState
 runApplication blockMesh
 runApplication decomposePar
-runParallel `getApplication` 4
+runParallel `getApplication`
 runApplication reconstructPar -latestTime
 cd ..
 
@@ -17,7 +17,7 @@ cp -r 0.org 0
 runApplication blockMesh
 runApplication mapFields ../hopperInitialState -sourceTime latestTime
 runApplication decomposePar
-runParallel `getApplication` 4
+runParallel `getApplication`
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
index f3b7aecb79d..79670e84ee0 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
@@ -13,7 +13,7 @@ mv log.decomposePar log.decomposePar.wallFilmRegion
 runApplication decomposePar
 mv log.decomposePar log.decomposePar.primaryRegion
 
-runParallel $application 4
+runParallel $application
 
 runApplication reconstructPar -region wallFilmRegion
 mv log.reconstructPar log.reconstructPar.wallFilmRegion
diff --git a/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel b/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
index ef0ef9e42f8..21ff27d0647 100755
--- a/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
+++ b/tutorials/mesh/foamyHexMesh/blob/Allrun-parallel
@@ -4,24 +4,21 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-# Get the number of processors to run on from system/decomposeParDict
-nProc=$(getNumberOfProcessors)
-
 # copy flange surface from resources directory
 cp $FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/
 
 runApplication blockMesh -region backgroundMeshDecomposition
 runApplication decomposePar -region backgroundMeshDecomposition
 
-runParallel foamyHexMesh $nProc
+runParallel foamyHexMesh
 
-runParallel collapseEdges $nProc -latestTime -collapseFaces
+runParallel collapseEdges -latestTime -collapseFaces
 mv log.collapseEdges log.collapseFaces
 
-runParallel collapseEdges $nProc -latestTime -collapseFaceSet indirectPatchFaces
+runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 mv log.collapseEdges log.collapseFaceSet
 
-runParallel checkMesh $nProc -latestTime -allTopology -allGeometry
+runParallel checkMesh -latestTime -allTopology -allGeometry
 
 runApplication reconstructParMesh -latestTime
 
diff --git a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
index 9912810e623..318a2381ebf 100755
--- a/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
+++ b/tutorials/mesh/foamyHexMesh/flange/Allrun-parallel
@@ -4,9 +4,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-# Get the number of processors to run on from system/decomposeParDict
-nProc=$(getNumberOfProcessors)
-
 # copy flange surface from resources directory
 cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/
 
@@ -14,15 +11,15 @@ cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/
 runApplication blockMesh -region backgroundMeshDecomposition
 runApplication decomposePar -region backgroundMeshDecomposition
 
-runParallel foamyHexMesh $nProc
+runParallel foamyHexMesh
 
-runParallel collapseEdges $nProc -latestTime -collapseFaces
+runParallel collapseEdges -latestTime -collapseFaces
 mv log.collapseEdges log.collapseFaces
 
-runParallel collapseEdges $nProc -latestTime -collapseFaceSet indirectPatchFaces
+runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
 mv log.collapseEdges log.collapseFaceSet
 
-runParallel checkMesh $nProc -latestTime -allTopology -allGeometry
+runParallel checkMesh -latestTime -allTopology -allGeometry
 
 runApplication reconstructParMesh -latestTime
 
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
index c7461dd223e..93db043a8f5 100755
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre
@@ -24,9 +24,6 @@ intersectSurfaces()
 # Set application name
 application=$(getApplication)
 
-# Get number of processors to run on
-nProcs=$(getNumberOfProcessors)
-
 \rm -rf 0
 
 
@@ -88,16 +85,16 @@ runApplication decomposePar -region backgroundMeshDecomposition
 
 runApplication surfaceFeatureExtract
 
-runParallel foamyHexMesh $nProcs
+runParallel foamyHexMesh
 
-runParallel collapseEdges $nProcs -collapseFaces -latestTime
+runParallel collapseEdges -collapseFaces -latestTime
 mv log.collapseEdges log.collapseFaces
 
 #\cp system/collapseDict.indirectPatchFaces system/collapseDict
-#runParallel collapseEdges $nProcs -collapseFaceSet indirectPatchFaces -latestTime
+#runParallel collapseEdges -collapseFaceSet indirectPatchFaces -latestTime
 #mv log.collapseEdges log.collapseFaceSet
 
-runParallel checkMesh $nProcs -allTopology -allGeometry -latestTime
+runParallel checkMesh -allTopology -allGeometry -latestTime
 
 runApplication reconstructParMesh -latestTime
 
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
index ddaf6768393..8b331ca9cdc 100755
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
@@ -9,9 +9,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Set application name
 application=$(getApplication)
 
-# Get number of processors to run on
-nProcs=$(getNumberOfProcessors)
-
 \rm -rf 0
 
 runApplication createBaffles -overwrite
@@ -31,7 +28,7 @@ runApplication setFields
 runApplication decomposePar -force
 
 # Run
-runParallel $application $nProcs
+runParallel $application
 
 # Reconstruct
 runApplication reconstructPar -noFunctionObjects
diff --git a/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam b/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
index b917a3f3453..2937f5ae7d4 100755
--- a/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
+++ b/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
@@ -4,14 +4,11 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-# Get the number of processors to run on from system/decomposeParDict
-nProcs=$(getNumberOfProcessors)
-
 cp system/controlDict.rhoCentralFoam system/controlDict
 cp -r 0.org 0
 
 runApplication decomposePar
-runParallel rhoCentralFoam $nProcs
+runParallel rhoCentralFoam
 runApplication reconstructPar
 
 
diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
index 49c90a1c22a..90e7cb66858 100755
--- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
+++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
@@ -34,7 +34,7 @@ refineMeshByCellSet 1 2 3
 #runApplication mapFields ../throttle -sourceTime latestTime
 
 runApplication decomposePar
-runParallel $application 4
+runParallel $application
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
index aadf250ea34..12e3b0b662b 100755
--- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
@@ -8,7 +8,7 @@ runApplication blockMesh
 cp -r 0.org 0
 runApplication setFields
 runApplication decomposePar
-runParallel $(getApplication) 4
+runParallel $(getApplication)
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
index a50938a33aa..a0a9420e31b 100755
--- a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
@@ -39,9 +39,9 @@ runApplication setFields
 
 runApplication decomposePar
 
-runParallel renumberMesh 8 -overwrite
+runParallel renumberMesh -overwrite
 
-runParallel $(getApplication) 8
+runParallel $(getApplication)
 
 runApplication reconstructPar
 
diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
index 6d80a88bc7d..dff104f7774 100755
--- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
@@ -13,7 +13,7 @@ application=`getApplication`
 runApplication decomposePar -force
 
 # Run
-runParallel $application 6
+runParallel $application
 
 # Reconstruct
 runApplication reconstructPar -noFunctionObjects
diff --git a/tutorials/multiphase/interFoam/laminar/Allrun b/tutorials/multiphase/interFoam/laminar/Allrun
index 45adee60c76..c5b58c15131 100755
--- a/tutorials/multiphase/interFoam/laminar/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/Allrun
@@ -47,7 +47,7 @@ cloneCase damBreak damBreakFine
     cp ../damBreak/0/alpha.water.org 0/alpha.water
     runApplication setFields
     runApplication decomposePar
-    runParallel `getApplication` 4
+    runParallel `getApplication`
     runApplication reconstructPar
 )
 
diff --git a/tutorials/multiphase/interFoam/ras/Allrun b/tutorials/multiphase/interFoam/ras/Allrun
index 2d70aedba05..04439eec04f 100755
--- a/tutorials/multiphase/interFoam/ras/Allrun
+++ b/tutorials/multiphase/interFoam/ras/Allrun
@@ -39,7 +39,7 @@ cloneCase damBreak damBreakFine
     runApplication blockMesh
     runApplication setFields
     runApplication decomposePar
-    runParallel `getApplication` 4
+    runParallel `getApplication`
     runApplication reconstructPar
 )
 
diff --git a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
index a50938a33aa..a0a9420e31b 100755
--- a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
@@ -39,9 +39,9 @@ runApplication setFields
 
 runApplication decomposePar
 
-runParallel renumberMesh 8 -overwrite
+runParallel renumberMesh -overwrite
 
-runParallel $(getApplication) 8
+runParallel $(getApplication)
 
 runApplication reconstructPar
 
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
index 755e9652992..1d24256eb00 100755
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
@@ -8,6 +8,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel `getApplication` 4
+runParallel `getApplication`
 
 runApplication reconstructPar
diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
index 33fca4c7bd4..623d0fe4a69 100755
--- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
+++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
@@ -13,7 +13,7 @@ cp -r 0.org 0
 runApplication blockMesh
 runApplication setFields
 runApplication decomposePar
-runParallel $application 4
+runParallel $application
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
index 08ba9c1a955..a597dd3cae7 100755
--- a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
+++ b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
@@ -14,7 +14,7 @@ runApplication setFields
 
 #runApplication $application
 #runApplication decomposePar
-#runParallel $application 4
+#runParallel $application
 #runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
index 9086d49ad65..757afdd11af 100755
--- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
+++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
@@ -12,7 +12,7 @@ cp -r 0.org 0
 runApplication blockMesh
 runApplication setFields
 runApplication decomposePar
-runParallel $application 4
+runParallel $application
 runApplication reconstructPar
 
 # ----------------------------------------------------------------- end-of-file
-- 
GitLab