2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
8 #------------------------------------------------------------------------------
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
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/>.
29 # quickly tests the tutorials and writes out the scheme/solver information
31 #------------------------------------------------------------------------------
33 cd ${0%/*} ||
exit 1 # run from this directory
36 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
42 -d sets up a default scheme on all schemes
45 * quickly tests the tutorials and writes out the scheme/solver information
52 setDefaultFvSchemes
() {
54 gradSchemes { default Gauss linear; }
58 div(phi,fu_ft_h) Gauss multivariateSelection
64 div(phi,ft_b_h_hu) Gauss multivariateSelection
73 laplacianSchemes { default Gauss linear corrected; }
74 interpolationSchemes { default linear; }
75 snGradSchemes { default corrected; }
76 fluxRequired { default yes; }
83 unset MAIN_CONTROL_DICT
86 $HOME/.
$WM_PROJECT/$WM_PROJECT_VERSION \
91 if [ -f "$i/controlDict" ]
93 MAIN_CONTROL_DICT
="$i/controlDict"
98 [ -f "$MAIN_CONTROL_DICT" ] || usage
"main controlDict not found"
101 TEST_RUN_DIR
=..
/tutorialsTest
107 interpolationScheme \
111 SCHEMES_FILE
="FvSchemes"
112 SCHEMES_TEMP
="FvSchemes.temp"
113 SOLVERS_FILE
="FvSolution"
114 SOLVERS_TEMP
="FvSolution.temp"
123 usage
"Aborting due to invalid option"
129 -d) DEFAULT_SCHEMES
=1;;
140 if [ -d "$TEST_RUN_DIR" ]
145 echo "Modifying ${MAIN_CONTROL_DICT}"
146 if [ -e ${MAIN_CONTROL_DICT}.org
]
148 echo "File ${MAIN_CONTROL_DICT}.org already exists"
149 echo "Did Alltest fail in some way and then run again?"
153 # Clean up on termination and on Ctrl-C
154 trap 'mv ${MAIN_CONTROL_DICT}.org ${MAIN_CONTROL_DICT} 2>/dev/null; exit 0' \
156 cp ${MAIN_CONTROL_DICT} ${MAIN_CONTROL_DICT}.org
159 -e s
/"\(fvSchemes[ \t]*\)\([0-9]\);"/"\1 1;"/g \
160 -e s
/"\(solution[ \t]*\)\([0-9]\);"/"\1 1;"/g \
161 ${MAIN_CONTROL_DICT}.org
> ${MAIN_CONTROL_DICT}
163 echo "Copying the tutorials"
164 cp -a ${TUTORIALS_DIR} ${TEST_RUN_DIR}
166 echo "Modifying the controlDicts to run only one time step"
167 cd ${TEST_RUN_DIR} ||
exit 1
169 for CD
in `find . -name "controlDict*"`
173 -e s
/"\(startFrom[ \t]*\)\([a-zA-Z]*\);"/"\1 latestTime;"/g \
174 -e s
/"\(stopAt[ \t]*\)\([a-zA-Z]*\);"/"\1 nextWrite;"/g \
175 -e s
/"\(writeControl[ \t]*\)\([a-zA-Z]*\);"/"\1 timeStep;"/g \
176 -e s
/"\(writeInterval[ \t]*\)\([0-9a-zA-Z.-]*\);"/"\1 1;"/g \
180 if [ $DEFAULT_SCHEMES = 1 ]
182 echo "Modifying the fvSchemes to contain only default schemes"
183 for FV_SC
in `find . -name fvSchemes`
187 mv ${FV_SC} ${FV_SC}.org
188 sed -e /"${S}"/,/$p/d ${FV_SC}.org > ${FV_SC}
190 setDefaultFvSchemes >> ${FV_SC}
196 sed -e :a -e '/\\$/N; s/\\\n//; ta' Allrun > temp
198 `grep "applications
=" temp | sed 's/applications=\"\([A-Za-z \t]*\)\"/\1/g'`
200 rm $SCHEMES_FILE > /dev/null 2>&1
201 for APP in $APPLICATIONS
203 echo $APP >> $SCHEMES_FILE
204 echo "$APP: " | tr -d "\n" >> $SOLVERS_FILE
205 for ST in $FV_SCHEMES
207 rm $SCHEMES_TEMP > /dev/null 2>&1
208 rm $SOLVERS_TEMP > /dev/null 2>&1
209 echo " ${ST}" >> $SCHEMES_FILE
210 for LOG in `find ${APP} -name "log.
${APP}"`
212 for S in `grep ${ST} ${LOG} | cut -d" " -f4`
214 echo " ${S}" >> $SCHEMES_TEMP
216 echo `grep solver ${LOG} | cut -d" " -f4` >> $SOLVERS_TEMP
218 if [ -f $SCHEMES_TEMP ]
220 cat $SCHEMES_TEMP | sort -u >> $SCHEMES_FILE
223 cat $SOLVERS_TEMP | tr " " "\n" | sort -u | tr "\n" " " >> $SOLVERS_FILE
224 echo "" >> $SOLVERS_FILE
228 # ----------------------------------------------------------------- end-of-file