BUG: potentialFoam/cylinder: indexing into non-existing patch in parallel
[OpenFOAM-2.0.x.git] / tutorials / Alltest
blob8d8790a58de3a86b4f0568e3d33505dd23cf4bae
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 # Alltest
28 # Description
29 # quickly tests the tutorials and writes out the scheme/solver information
31 #------------------------------------------------------------------------------
32 cd ${0%/*} || exit 1 # run from this directory
34 usage()
36 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
37 cat<<USAGE
39 usage: ${0##*/} [OPTION]
41 options:
42 -default sets up a default scheme on all schemes
43 -help print the usage
45 * quickly tests the tutorials and writes out the scheme/solver information
47 USAGE
48 exit 1
51 #------------------------------------------------------------------------------
53 unset DEFAULT_SCHEMES
55 # parse options
56 while [ "$#" -gt 0 ]
58 case "$1" in
59 -h | -help)
60 usage
62 -d | -default)
63 DEFAULT_SCHEMES=true
64 shift
66 -*)
67 usage "unknown option: '$*'"
70 break
72 esac
73 done
76 setDefaultFvSchemes()
78 cat<<EOF
79 gradSchemes { default Gauss linear; }
80 divSchemes
82 default Gauss linear;
83 div(phi,fu_ft_h) Gauss multivariateSelection
85 fu upwind;
86 ft upwind;
87 h upwind;
89 div(phi,ft_b_h_hu) Gauss multivariateSelection
91 fu upwind;
92 ft upwind;
93 b upwind;
94 h upwind;
95 hu upwind;
98 laplacianSchemes { default Gauss linear corrected; }
99 interpolationSchemes { default linear; }
100 snGradSchemes { default corrected; }
101 fluxRequired { default yes; }
106 # VARIABLE
108 unset MAIN_CONTROL_DICT
110 for i in \
111 $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
112 $HOME/.$WM_PROJECT \
113 $WM_PROJECT_DIR/etc \
116 if [ -f "$i/controlDict" ]
117 then
118 MAIN_CONTROL_DICT="$i/controlDict"
119 break
121 done
123 [ -f "$MAIN_CONTROL_DICT" ] || usage "main controlDict not found"
126 TUTORIALS_DIR=.
127 TEST_RUN_DIR=../tutorialsTest
128 FV_SCHEMES=\
130 gradScheme \
131 divScheme \
132 laplacianScheme \
133 interpolationScheme \
134 snGradScheme \
135 fluxRequired \
137 SCHEMES_FILE="FvSchemes"
138 SCHEMES_TEMP="FvSchemes.temp"
139 SOLVERS_FILE="FvSolution"
140 SOLVERS_TEMP="FvSolution.temp"
144 # MAIN
147 if [ -d "$TEST_RUN_DIR" ]
148 then
149 rm -rf $TEST_RUN_DIR
152 echo "Modifying ${MAIN_CONTROL_DICT}"
153 if [ -e ${MAIN_CONTROL_DICT}.org ]
154 then
155 echo "File ${MAIN_CONTROL_DICT}.org already exists"
156 echo "Did Alltest fail in some way and then run again?"
157 exit 1
160 # Clean up on termination and on Ctrl-C
161 trap 'mv ${MAIN_CONTROL_DICT}.org ${MAIN_CONTROL_DICT} 2>/dev/null; exit 0' \
162 EXIT TERM INT
163 cp ${MAIN_CONTROL_DICT} ${MAIN_CONTROL_DICT}.org
165 sed \
166 -e s/"\(fvSchemes[ \t]*\)\([0-9]\);"/"\1 1;"/g \
167 -e s/"\(solution[ \t]*\)\([0-9]\);"/"\1 1;"/g \
168 ${MAIN_CONTROL_DICT}.org > ${MAIN_CONTROL_DICT}
170 echo "Copying the tutorials"
171 cp -a ${TUTORIALS_DIR} ${TEST_RUN_DIR}
173 echo "Modifying the controlDicts to run only one time step"
174 cd ${TEST_RUN_DIR} || exit 1
176 for CD in `find . -name "controlDict*"`
178 mv ${CD} ${CD}.org
179 sed \
180 -e s/"\(startFrom[ \t]*\)\([a-zA-Z]*\);"/"\1 latestTime;"/g \
181 -e s/"\(stopAt[ \t]*\)\([a-zA-Z]*\);"/"\1 nextWrite;"/g \
182 -e s/"\(writeControl[ \t]*\)\([a-zA-Z]*\);"/"\1 timeStep;"/g \
183 -e s/"\(writeInterval[ \t]*\)\([0-9a-zA-Z.-]*\);"/"\1 1;"/g \
184 ${CD}.org > ${CD}
185 done
187 if [ "$DEFAULT_SCHEMES" = true ]
188 then
189 echo "Modifying the fvSchemes to contain only default schemes"
190 for FV_SC in `find . -name fvSchemes`
192 for S in $FV_SCHEMES
194 mv ${FV_SC} ${FV_SC}.org
195 sed -e /"${S}"/,/$p/d ${FV_SC}.org > ${FV_SC}
196 done
197 setDefaultFvSchemes >> ${FV_SC}
198 done
201 ./Allrun
203 sed -e :a -e '/\\$/N; s/\\\n//; ta' Allrun > temp
204 APPLICATIONS=\
205 `grep "applications=" temp | sed 's/applications=\"\([A-Za-z \t]*\)\"/\1/g'`
207 rm $SCHEMES_FILE > /dev/null 2>&1
208 for APP in $APPLICATIONS
210 echo $APP >> $SCHEMES_FILE
211 echo "$APP: " | tr -d "\n" >> $SOLVERS_FILE
212 for ST in $FV_SCHEMES
214 rm $SCHEMES_TEMP $SOLVERS_TEMP > /dev/null 2>&1
215 echo " ${ST}" >> $SCHEMES_FILE
216 for LOG in `find ${APP} -name "log.${APP}"`
218 for S in `grep ${ST} ${LOG} | cut -d" " -f4`
220 echo " ${S}" >> $SCHEMES_TEMP
221 done
222 echo `grep solver ${LOG} | cut -d" " -f4` >> $SOLVERS_TEMP
223 done
224 if [ -f $SCHEMES_TEMP ]
225 then
226 cat $SCHEMES_TEMP | sort -u >> $SCHEMES_FILE
228 done
229 cat $SOLVERS_TEMP | tr " " "\n" | sort -u | tr "\n" " " >> $SOLVERS_FILE
230 echo "" >> $SOLVERS_FILE
231 done
233 # ----------------------------------------------------------------- end-of-file