STYLE: more consistent shell style in tutorial run/clean scripts

This commit is contained in:
Mark Olesen
2010-03-10 10:55:42 +01:00
parent 2068c67a33
commit 6b6dd51a27
112 changed files with 721 additions and 260 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
@ -12,19 +13,25 @@ LadenburgJet60psi \
biconic25-55Run35 \
"
for case in $cases
for caseName in $cases
do
if [ "$case" = "shockTube" ]
(
cd $caseName || exit
if [ "$caseName" = shockTube ]
then
rm -rf $case/0
cp -r $case/0.org $case/0
rm -rf 0
cp -r 0.org 0
fi
(cd $case && foamCleanTutorials && cleanSamples)
foamCleanTutorials && cleanSamples
if [ "$case" = "biconic25-55Run35" ]
if [ "$caseName" = "biconic25-55Run35" ]
then
rm -rf $case/constant/polyMesh/boundary
wclean $case/datToFoam
rm -rf constant/polyMesh/boundary
wclean datToFoam
fi
)
done
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
@ -14,26 +16,30 @@ LadenburgJet60psi \
biconic25-55Run35 \
"
moveTimeMeshToConstant ()
moveTimeMeshToConstant()
{
DT=`foamInfoExec -times | tail -1`
if [ "$DT" != 0 ] ; then
if [ "$DT" != 0 ]
then
mv ${DT}/polyMesh/* constant/polyMesh
rm -rf ${DT}
fi
}
for case in $cases
do
(cd $case && runApplication blockMesh)
#
if [ "$case" = "shockTube" ] ; then
(cd $case && runApplication setFields)
fi
#
if [ "$case" = "biconic25-55Run35" ] ; then
cd $case
for caseName in $cases
do
(
cd $caseName || exit
runApplication blockMesh
case "$caseName" in
shockTube)
runApplication setFields
;;
biconic25-55Run35)
wmake datToFoam
runApplication datToFoam grid256.dat
@ -46,9 +52,11 @@ do
mv $CONST/polyMesh/boundary $CONST/polyMesh/boundary.bak
sed -f $CONST/wedgeScr $CONST/polyMesh/boundary.bak > $CONST/polyMesh/boundary
rm $CONST/polyMesh/boundary.bak
;;
esac
cd ..
fi
#
(cd $case && runApplication $application)
runApplication $application
)
done
# ----------------------------------------------------------------- end-of-file

View File

@ -1,43 +1,54 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage: $0 [options]
Runs a set of samples across the cone face and concatenates output files
usage()
{
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
Options are:
-l -latestTime option for sample
-h help
EOF
cat<<USAGE
Usage: ${0##*/} [OPTION]
options:
-l -latestTime option for sample
-h help
Runs a set of samples across the cone face and concatenates output files
USAGE
exit 1
}
LATEST_TIME=""
unset timeOpt
OPTS=`getopt hl $*`
if [ $? -ne 0 ] ; then
echo "Aborting due to invalid option"
printUsage
exit 1
fi
[ $? -eq 0 ] || usage "Aborting due to invalid option"
eval set -- "$OPTS"
while [ $1 != -- ]; do
while [ $1 != -- ]
do
case $1 in
-l) LATEST_TIME="-latestTime";;
-h) printUsage; exit 1;;
-l)
timeOpt="-latestTime"
;;
-h)
usage
;;
esac
shift
done
shift
sample ${LATEST_TIME}
sample $timeOpt
SDIR="sets"
LSDIR=`ls $SDIR | head -1`
EXAMPLE_FILE=`ls -1 $SDIR/${LSDIR}/* | head -1`
FS=`basename $EXAMPLE_FILE | cut -d_ -f2-`
for d in $SDIR/*
do
cat ${d}/cone25_${FS} ${d}/cone55_${FS} ${d}/base_${FS} > ${d}/biconic_${FS}
cat ${d}/cone25_${FS} ${d}/cone55_${FS} ${d}/base_${FS} > ${d}/biconic_${FS}
done
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
@ -9,3 +11,5 @@ application=`getApplication`
runApplication blockMesh
runApplication setFields
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
@ -6,3 +7,5 @@
rm -rf 0
cp -r 0.org 0
cleanCase
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
@ -7,3 +9,5 @@ application=`getApplication`
runApplication blockMesh
runApplication setFields
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
@ -7,3 +8,5 @@ cleanCase
rm -rf 0
cp -r 0.org 0
cleanSamples
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
@ -9,3 +11,5 @@ runApplication setFields
runApplication $application
runApplication foamCalc mag U
runApplication sample
# ----------------------------------------------------------------- end-of-file

View File

@ -1,11 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name
application=`getApplication`
runStarToFoam ()
runStarToFoam()
{
if [ -f log.star3ToFoam -o -f log.starToFoam ]
then
@ -24,3 +26,5 @@ rm temp
runApplication $application
# end-of-file
# ----------------------------------------------------------------- end-of-file

View File

@ -1,7 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
removeCase decompressionTankFine
foamCleanTutorials cases
# ----------------------------------------------------------------- end-of-file

View File

@ -1,14 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Set application name
application="sonicLiquidFoam"
setDecompressionTankFine ()
setDecompressionTankFine()
{
blockMeshDict="$1/constant/polyMesh/blockMeshDict"
controlDict="$1/system/controlDict"
blockMeshDict="constant/polyMesh/blockMeshDict"
controlDict="system/controlDict"
sed \
-e s/"30 20"/"120 80"/g \
-e s/"30 5"/"120 20"/g \
@ -16,6 +19,7 @@ setDecompressionTankFine ()
-e s/"30 95"/"120 380"/g \
$blockMeshDict > temp.$$
mv temp.$$ $blockMeshDict
sed \
-e s/"\(deltaT[ \t]*\) 5e-07;"/"\1 1e-07;"/g \
-e s/"\(endTime[ \t]*\) 0.00025;"/"\1 0.00015;"/g \
@ -23,16 +27,22 @@ setDecompressionTankFine ()
mv temp.$$ $controlDict
}
# Do decompressionTank
(cd decompressionTank && foamRunTutorials)
( cd decompressionTank && foamRunTutorials )
# Clone case
cloneCase decompressionTank decompressionTankFine
cd decompressionTankFine
(
cd decompressionTankFine || exit
# Modify case
setDecompressionTankFine .
setDecompressionTankFine
# And execute
runApplication blockMesh
runApplication $application
cd ..
)
# ----------------------------------------------------------------- end-of-file