twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / bin / foamExec
blob92e58caa62faf16cd8848977106e263cd621b824
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # foamExec
28 # Description
29 # Usage: foamExec [-v foamVersion] <foamCommand> ...
31 # Runs the <foamVersion> version of executable <foamCommand>
32 # with the rest of the arguments.
34 # Can also be used for parallel runs e.g.
35 # mpirun -np <nProcs> \
36 # foamExec -v <foamVersion> <foamCommand> ... -parallel
38 # SeeAlso
39 # foamEtcFile
40 #------------------------------------------------------------------------------
41 usage() {
42 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
43 cat<<USAGE
45 Usage: ${0##*/} [OPTION] <application> ...
47 options:
48 -version <ver> specify an alternative OpenFOAM version
49 pass through to foamEtcFile
50 -help this usage
52 * run a particular OpenFOAM version of <application>
54 USAGE
55 exit 1
59 # This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
60 # or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
62 # foamEtcFile must be found in the same directory as this script
63 #-------------------------------------------------------------------------------
65 unset etcOpts version
66 # parse options
67 while [ "$#" -gt 0 ]
69 case "$1" in
70 -h | -help)
71 usage
73 -v | -version)
74 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
75 version="$2"
76 etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
77 shift
79 -m | -mode | -p | -prefix)
80 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
81 etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
82 shift
84 --)
85 shift
86 break
88 -*)
89 usage "invalid option '$1'"
92 break
94 esac
95 shift
96 done
100 # Find and source OpenFOAM settings (bashrc)
101 # placed in function to preserve command-line arguments
103 sourceRc()
105 # default is the current version
106 : ${version:=${WM_PROJECT_VERSION:-unknown}}
108 foamDotFile="$(${0%/*}/foamEtcFile $etcOpts bashrc)" || {
109 echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
110 exit 1
113 . $foamDotFile
117 [ "$#" -ge 1 ] || usage "no application specified"
119 sourceRc
120 exec "$@"
122 #------------------------------------------------------------------------------