Skip to content
Snippets Groups Projects
Commit 26e1b299 authored by Andrew Heather's avatar Andrew Heather
Browse files

Merge branch 'RunFunctions' into 'merge-foundation'

ENH: added -decomposeParDict as argument to getNumberOfProcessors()

Continuing discussion at 
https://develop.openfoam.com/Development/OpenFOAM-plus/commit/1507178a1bfffef916faab8f6d69dd72c3f0ee76?title=#note_1093

Now the Allrun script could be
```
runParallel -decomposeParDict system/decomposeParDict-6 snappyHexMesh -overwrite
```

Thanks @Mattijs 


See merge request !36
parents 62144e4d e0a0f94e
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -41,8 +41,10 @@ isTest()
getNumberOfProcessors()
{
expandDictionary system/decomposeParDict \
| sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
if [ -f $1 ]
then
expandDictionary $1 | sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
fi
}
getApplication()
......@@ -100,13 +102,16 @@ runParallel()
{
LOG_NAME=
APP_RUN=
# Store any parsed additional arguments e.g. decomposeParDict
APP_PARARGS=
LOG_IGNORE=false
LOG_APPEND=false
LOG_SUFFIX=
nProcs=$(getNumberOfProcessors)
# Check the default decomposeParDict if available
nProcs=$(getNumberOfProcessors "system/decomposeParDict")
# Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
while [ $# -gt 0 ] && [ -z "$APP_RUN" ] ; do
key="$1"
case "$key" in
-append|-a)
......@@ -124,6 +129,11 @@ runParallel()
nProcs="$2"
shift
;;
-decomposeParDict)
nProcs=$(getNumberOfProcessors "$2")
APP_PARARGS="$APP_PARARGS -decomposeParDict $2"
shift
;;
*)
APP_RUN="$key"
APP_NAME="${key##*/}"
......@@ -141,9 +151,9 @@ runParallel()
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.$LOG_SUFFIX 2>&1 )
( mpirun -np $nProcs $APP_RUN $APP_PARARGS -parallel "$@" < /dev/null >> log.$LOG_SUFFIX 2>&1 )
else
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
( mpirun -np $nProcs $APP_RUN $APP_PARARGS -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
fi
fi
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment