Merge branch 'master' of github.com:OpenCFD/OpenFOAM-2.0.x
[OpenFOAM-2.0.x.git] / bin / foamRunTutorials
blobd98b87ccb15ca53731ac7f99c1e178e424e41dad
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2004-2011 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 # foamRunTutorials
28 # Description
29 # Run either Allrun or blockMesh/application in current directory
30 # and all its subdirectories.
32 #------------------------------------------------------------------------------
34 #------------------------------------------------------------------------------
35 # Select the version of make to be used
36 #------------------------------------------------------------------------------
38 # normally use "make"
39 make="make"
41 ## set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set
42 #if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
43 #then
44 # WM_NCOMPPROCS=$(wmakeScheduler -count)
45 # [ $? -eq 0 ] || unset WM_NCOMPPROCS
46 #fi
48 #if [ "$WM_NCOMPPROCS" ]
49 #then
50 # if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
51 # then
52 # lockDir=$HOME/.$WM_PROJECT/.wmake
54 # if [ -d $lockDir ]
55 # then
56 # rm -f $lockDir/*
57 # else
58 # mkdir -p $lockDir
59 # fi
61 # make="make --no-print-directory -j "$WM_NCOMPPROCS
62 # fi
63 #fi
67 # Source tutorial functions
68 . $WM_PROJECT_DIR/bin/tools/RunFunctions
70 thisScript=$0
71 if [ "/${thisScript#/}" != "$thisScript" ]
72 then
73 thisScript="$PWD/$thisScript"
76 # If an argument is supplied do not execute ./Allrun to avoid recursion
77 if [ $# = 0 -a -f "./Allrun" ]
78 then
79 # Specialised script.
80 ./Allrun
81 elif [ -d system ]
82 then
83 # Normal case.
84 parentDir=`dirname $PWD`
85 application=`getApplication`
86 runApplication blockMesh
87 runApplication $application
88 else
89 # Loop over sub-directories and compile any applications
90 for caseName in *
92 if [ -d $caseName -a -d "$caseName/Make" ]
93 then
94 ( compileApplication $caseName )
96 done
97 # Recurse to subdirectories
98 #for caseName in *
99 #do
100 # if [ -d $caseName ]
101 # then
102 # ( cd $caseName && $thisScript )
103 # fi
104 #done
105 FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
106 #$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$WM_SCHEDULER $thisScript"
107 $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript"
110 #------------------------------------------------------------------------------