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
This commit is contained in:
Henry Weller
2016-01-27 14:19:25 +00:00
parent 8446f25f1f
commit 20204cb468
40 changed files with 73 additions and 83 deletions

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -81,6 +81,7 @@ runParallel()
APP_RUN= APP_RUN=
LOG_IGNORE=false LOG_IGNORE=false
LOG_APPEND=false LOG_APPEND=false
nProcs=$(getNumberOfProcessors)
# Parse options and executable # Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
@ -93,12 +94,13 @@ runParallel()
-overwrite) -overwrite)
LOG_IGNORE=true LOG_IGNORE=true
;; ;;
-np)
nProcs="$2"
shift
;;
*) *)
APP_RUN="$key" APP_RUN="$key"
APP_NAME="${key##*/}" APP_NAME="${key##*/}"
# also read number of processors
nProcs="$2"
shift
;; ;;
esac esac
shift shift

View File

@ -30,7 +30,7 @@ decomposePar -region panelRegion > log.decomposeParPanelRegion 2>&1
decomposePar -fields > log.decomposePar 2>&1 decomposePar -fields > log.decomposePar 2>&1
runParallel `getApplication` 6 runParallel `getApplication`
paraFoam -touch paraFoam -touch
paraFoam -touch -region panelRegion paraFoam -touch -region panelRegion

View File

@ -12,6 +12,6 @@ runApplication createPatch -overwrite
runApplication decomposePar -force runApplication decomposePar -force
# Run # Run
runParallel $application 4 runParallel $application
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -6,8 +6,8 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication blockMesh runApplication blockMesh
runApplication decomposePar runApplication decomposePar
runParallel dsmcInitialise 4 runParallel dsmcInitialise
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar -noLagrangian runApplication reconstructPar -noLagrangian
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -6,8 +6,8 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication blockMesh runApplication blockMesh
runApplication decomposePar runApplication decomposePar
runParallel dsmcInitialise 4 runParallel dsmcInitialise
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar -noLagrangian runApplication reconstructPar -noLagrangian

View File

@ -11,8 +11,8 @@ runApplication blockMesh
runApplication decomposePar runApplication decomposePar
runParallel mdInitialise 4 runParallel mdInitialise
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar

View File

@ -8,7 +8,7 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication decomposePar runApplication decomposePar
runParallel $(getApplication) 4 & runParallel $(getApplication) &
./externalSolver ./externalSolver

View File

@ -29,7 +29,7 @@ done
runApplication decomposePar -allRegions runApplication decomposePar -allRegions
# Run # Run
runParallel `getApplication` 4 runParallel `getApplication`
# Reconstruct # Reconstruct
runApplication reconstructPar -allRegions runApplication reconstructPar -allRegions

View File

@ -34,7 +34,7 @@ runApplication `getApplication`
#runApplication decomposePar -allRegions #runApplication decomposePar -allRegions
# #
## Run ## Run
#runParallel `getApplication` 4 #runParallel `getApplication`
# #
## Reconstruct ## Reconstruct
#runApplication reconstructPar -allRegions #runApplication reconstructPar -allRegions

View File

@ -13,7 +13,7 @@ mv log.decomposePar log.decomposePar.air
runApplication decomposePar -region porous runApplication decomposePar -region porous
mv log.decomposePar log.decomposePar.porous mv log.decomposePar log.decomposePar.porous
runParallel $(getApplication) 4 runParallel $(getApplication)
runApplication reconstructPar -latestTime -region air runApplication reconstructPar -latestTime -region air
mv log.reconstructPar log.reconstructPar.air mv log.reconstructPar log.reconstructPar.air

View File

@ -28,7 +28,7 @@ do
done done
# Run # Run
runParallel `getApplication` 4 runParallel `getApplication`
# Reconstruct # Reconstruct
runApplication reconstructPar -allRegions runApplication reconstructPar -allRegions

View File

@ -10,7 +10,7 @@ application=`getApplication`
#runApplication $application #runApplication $application
runApplication decomposePar runApplication decomposePar
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -8,6 +8,6 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication decomposePar runApplication decomposePar
runParallel $(getApplication) 4 runParallel $(getApplication)
runApplication reconstructPar runApplication reconstructPar

View File

@ -8,6 +8,6 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar

View File

@ -24,7 +24,7 @@ cp -r 0.org 0
runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
mv 0/pointDisplacement.unmapped 0/pointDisplacement mv 0/pointDisplacement.unmapped 0/pointDisplacement
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -14,7 +14,7 @@ runApplication blockMesh
#- Run parallel #- Run parallel
runApplication decomposePar -cellDist runApplication decomposePar -cellDist
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar
runApplication postChannel runApplication postChannel

View File

@ -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 {} mv ./{}/500 ./{}/0 $1
ls -d processor* | xargs -I {} rm -rf ./{}/0/uniform $1 ls -d processor* | xargs -I {} rm -rf ./{}/0/uniform $1
runParallel pisoFoam 8 runParallel pisoFoam
runApplication reconstructParMesh -constant -mergeTol 1e-6 runApplication reconstructParMesh -constant -mergeTol 1e-6

View File

@ -15,16 +15,16 @@ cp system/decomposeParDict.hierarchical system/decomposeParDict
runApplication decomposePar runApplication decomposePar
cp system/decomposeParDict.ptscotch system/decomposeParDict cp system/decomposeParDict.ptscotch system/decomposeParDict
runParallel snappyHexMesh 8 -overwrite -parallel runParallel snappyHexMesh -overwrite -parallel
find . -type f -iname "*level*" -exec rm {} \; find . -type f -iname "*level*" -exec rm {} \;
ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1 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 # ----------------------------------------------------------------- end-of-file

View File

@ -11,7 +11,7 @@ runApplication surfaceFeatureExtract
runApplication blockMesh runApplication blockMesh
runApplication decomposePar runApplication decomposePar
runParallel snappyHexMesh 6 -overwrite runParallel snappyHexMesh -overwrite
#- For non-parallel running #- For non-parallel running
#cp -r 0.org 0 > /dev/null 2>&1 #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 {} rm -rf ./{}/0
ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
runParallel patchSummary 6 runParallel patchSummary
runParallel potentialFoam 6 runParallel potentialFoam
runParallel $(getApplication) 6 runParallel $(getApplication)
runApplication reconstructParMesh -constant runApplication reconstructParMesh -constant
runApplication reconstructPar -latestTime runApplication reconstructPar -latestTime

View File

@ -14,7 +14,7 @@ cp -r 0.org 0
#runApplication $application #runApplication $application
runApplication decomposePar -cellDist runApplication decomposePar -cellDist
runParallel $application 5 runParallel $application
runApplication reconstructPar runApplication reconstructPar

View File

@ -12,14 +12,14 @@ cp system/decomposeParDict.hierarchical system/decomposeParDict
runApplication decomposePar runApplication decomposePar
cp system/decomposeParDict.ptscotch system/decomposeParDict cp system/decomposeParDict.ptscotch system/decomposeParDict
runParallel snappyHexMesh 4 -overwrite runParallel snappyHexMesh -overwrite
find . -type f -iname "*level*" -exec rm {} \; find . -type f -iname "*level*" -exec rm {} \;
ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1 ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1
runParallel topoSet 4 runParallel topoSet
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructParMesh -constant runApplication reconstructParMesh -constant
runApplication reconstructPar runApplication reconstructPar

View File

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $WM_PROJECT_DIR/bin/tools/RunFunctions
cp $FOAM_TUTORIALS/resources/geometry/cyclone.stl.gz constant/triSurface cp $FOAM_TUTORIALS/resources/geometry/cyclone.stl.gz constant/triSurface
runApplication blockMesh runApplication blockMesh
@ -12,4 +13,6 @@ runApplication snappyHexMesh -overwrite
runApplication decomposePar runApplication decomposePar
runParallel MPPICFoam $(echo processor* | wc -w) runParallel MPPICFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # Run from this directory
cd hopperInitialState cd hopperInitialState
runApplication blockMesh runApplication blockMesh
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar -latestTime runApplication reconstructPar -latestTime
cd .. cd ..
@ -17,7 +17,7 @@ cp -r 0.org 0
runApplication blockMesh runApplication blockMesh
runApplication mapFields ../hopperInitialState -sourceTime latestTime runApplication mapFields ../hopperInitialState -sourceTime latestTime
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -13,7 +13,7 @@ mv log.decomposePar log.decomposePar.wallFilmRegion
runApplication decomposePar runApplication decomposePar
mv log.decomposePar log.decomposePar.primaryRegion mv log.decomposePar log.decomposePar.primaryRegion
runParallel $application 4 runParallel $application
runApplication reconstructPar -region wallFilmRegion runApplication reconstructPar -region wallFilmRegion
mv log.reconstructPar log.reconstructPar.wallFilmRegion mv log.reconstructPar log.reconstructPar.wallFilmRegion

View File

@ -4,24 +4,21 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $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 # copy flange surface from resources directory
cp $FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/ cp $FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/
runApplication blockMesh -region backgroundMeshDecomposition runApplication blockMesh -region backgroundMeshDecomposition
runApplication decomposePar -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 mv log.collapseEdges log.collapseFaces
runParallel collapseEdges $nProc -latestTime -collapseFaceSet indirectPatchFaces runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
mv log.collapseEdges log.collapseFaceSet mv log.collapseEdges log.collapseFaceSet
runParallel checkMesh $nProc -latestTime -allTopology -allGeometry runParallel checkMesh -latestTime -allTopology -allGeometry
runApplication reconstructParMesh -latestTime runApplication reconstructParMesh -latestTime

View File

@ -4,9 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $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 # copy flange surface from resources directory
cp $FOAM_TUTORIALS/resources/geometry/flange.stl.gz constant/triSurface/ 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 blockMesh -region backgroundMeshDecomposition
runApplication decomposePar -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 mv log.collapseEdges log.collapseFaces
runParallel collapseEdges $nProc -latestTime -collapseFaceSet indirectPatchFaces runParallel collapseEdges -latestTime -collapseFaceSet indirectPatchFaces
mv log.collapseEdges log.collapseFaceSet mv log.collapseEdges log.collapseFaceSet
runParallel checkMesh $nProc -latestTime -allTopology -allGeometry runParallel checkMesh -latestTime -allTopology -allGeometry
runApplication reconstructParMesh -latestTime runApplication reconstructParMesh -latestTime

View File

@ -24,9 +24,6 @@ intersectSurfaces()
# Set application name # Set application name
application=$(getApplication) application=$(getApplication)
# Get number of processors to run on
nProcs=$(getNumberOfProcessors)
\rm -rf 0 \rm -rf 0
@ -88,16 +85,16 @@ runApplication decomposePar -region backgroundMeshDecomposition
runApplication surfaceFeatureExtract runApplication surfaceFeatureExtract
runParallel foamyHexMesh $nProcs runParallel foamyHexMesh
runParallel collapseEdges $nProcs -collapseFaces -latestTime runParallel collapseEdges -collapseFaces -latestTime
mv log.collapseEdges log.collapseFaces mv log.collapseEdges log.collapseFaces
#\cp system/collapseDict.indirectPatchFaces system/collapseDict #\cp system/collapseDict.indirectPatchFaces system/collapseDict
#runParallel collapseEdges $nProcs -collapseFaceSet indirectPatchFaces -latestTime #runParallel collapseEdges -collapseFaceSet indirectPatchFaces -latestTime
#mv log.collapseEdges log.collapseFaceSet #mv log.collapseEdges log.collapseFaceSet
runParallel checkMesh $nProcs -allTopology -allGeometry -latestTime runParallel checkMesh -allTopology -allGeometry -latestTime
runApplication reconstructParMesh -latestTime runApplication reconstructParMesh -latestTime

View File

@ -9,9 +9,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Set application name # Set application name
application=$(getApplication) application=$(getApplication)
# Get number of processors to run on
nProcs=$(getNumberOfProcessors)
\rm -rf 0 \rm -rf 0
runApplication createBaffles -overwrite runApplication createBaffles -overwrite
@ -31,7 +28,7 @@ runApplication setFields
runApplication decomposePar -force runApplication decomposePar -force
# Run # Run
runParallel $application $nProcs runParallel $application
# Reconstruct # Reconstruct
runApplication reconstructPar -noFunctionObjects runApplication reconstructPar -noFunctionObjects

View File

@ -4,14 +4,11 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $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 system/controlDict.rhoCentralFoam system/controlDict
cp -r 0.org 0 cp -r 0.org 0
runApplication decomposePar runApplication decomposePar
runParallel rhoCentralFoam $nProcs runParallel rhoCentralFoam
runApplication reconstructPar runApplication reconstructPar

View File

@ -34,7 +34,7 @@ refineMeshByCellSet 1 2 3
#runApplication mapFields ../throttle -sourceTime latestTime #runApplication mapFields ../throttle -sourceTime latestTime
runApplication decomposePar runApplication decomposePar
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -8,7 +8,7 @@ runApplication blockMesh
cp -r 0.org 0 cp -r 0.org 0
runApplication setFields runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel $(getApplication) 4 runParallel $(getApplication)
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -39,9 +39,9 @@ runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel renumberMesh 8 -overwrite runParallel renumberMesh -overwrite
runParallel $(getApplication) 8 runParallel $(getApplication)
runApplication reconstructPar runApplication reconstructPar

View File

@ -13,7 +13,7 @@ application=`getApplication`
runApplication decomposePar -force runApplication decomposePar -force
# Run # Run
runParallel $application 6 runParallel $application
# Reconstruct # Reconstruct
runApplication reconstructPar -noFunctionObjects runApplication reconstructPar -noFunctionObjects

View File

@ -47,7 +47,7 @@ cloneCase damBreak damBreakFine
cp ../damBreak/0/alpha.water.org 0/alpha.water cp ../damBreak/0/alpha.water.org 0/alpha.water
runApplication setFields runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar
) )

View File

@ -39,7 +39,7 @@ cloneCase damBreak damBreakFine
runApplication blockMesh runApplication blockMesh
runApplication setFields runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar
) )

View File

@ -39,9 +39,9 @@ runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel renumberMesh 8 -overwrite runParallel renumberMesh -overwrite
runParallel $(getApplication) 8 runParallel $(getApplication)
runApplication reconstructPar runApplication reconstructPar

View File

@ -8,6 +8,6 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication decomposePar runApplication decomposePar
runParallel `getApplication` 4 runParallel `getApplication`
runApplication reconstructPar runApplication reconstructPar

View File

@ -13,7 +13,7 @@ cp -r 0.org 0
runApplication blockMesh runApplication blockMesh
runApplication setFields runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -14,7 +14,7 @@ runApplication setFields
#runApplication $application #runApplication $application
#runApplication decomposePar #runApplication decomposePar
#runParallel $application 4 #runParallel $application
#runApplication reconstructPar #runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -12,7 +12,7 @@ cp -r 0.org 0
runApplication blockMesh runApplication blockMesh
runApplication setFields runApplication setFields
runApplication decomposePar runApplication decomposePar
runParallel $application 4 runParallel $application
runApplication reconstructPar runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file