ENH: add directory support for foamCleanTutorials

This commit is contained in:
Mark Olesen
2019-02-23 19:59:04 +01:00
committed by Andrew Heather
parent 5de5ae35ba
commit 33edea3ea4
28 changed files with 93 additions and 54 deletions

View File

@ -7,4 +7,4 @@ wclean libso CompressibleMultiPhaseTurbulenceModels
wclean libso laserDTRM wclean libso laserDTRM
wclean wclean
# ----------------------------------------------------------------- end-of-file #------------------------------------------------------------------------------

View File

@ -11,4 +11,4 @@ wmake $targetType CompressibleMultiPhaseTurbulenceModels
wmake $targetType laserDTRM wmake $targetType laserDTRM
wmake $targetType wmake $targetType
# ----------------------------------------------------------------- end-of-file #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | # \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# | Copyright (C) 2011 OpenFOAM Foundation # | Copyright (C) 2011 OpenFOAM Foundation
@ -31,22 +31,54 @@
# Run either Allwclean, Allclean or default cleanCase in current directory # Run either Allwclean, Allclean or default cleanCase in current directory
# and all its subdirectories. # and all its subdirectories.
# #
# When an argument is provided, it is treated as a directory name.
# If an option (eg, -self) is provided, it suppresses calling
# Allwclean or Allclean (ie, to avoid recursion)
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
thisScript=$0 thisScript="$0"
if [ "/${thisScript#/}" != "$thisScript" ] if [ "/${thisScript#/}" != "$thisScript" ]
then then
thisScript="$PWD/$thisScript" thisScript="$PWD/$thisScript"
fi fi
# If an argument is supplied do not execute ./Allwclean or ./Allclean # Simple option/argument parsing.
# (to avoid recursion) # By default use Allclean, Allwclean when present
if [ $# -eq 0 -a -f Allwclean ] #
# If an argument is supplied, treat as a change directory
#
# If an option (eg, -self) is provided,
# do not execute ./Allwclean or ./Allclean (to avoid recursion)
withAllclean=true
if [ "$#" -gt 0 ]
then
case "$1" in
-h | -help*)
echo "${0##*/}: recursively clean an OpenFOAM case directory" 1>&2
exit 0
;;
-self | -*)
unset withAllclean
;;
*)
cd "$1" 2>/dev/null || {
echo "${0##*}: No such directory" 1>&2
exit 2
}
;;
esac
fi
if [ -n "$withAllclean" ] && [ -f Allwclean ]
then then
# Specialized script # Specialized script
./Allwclean ./Allwclean
elif [ $# -eq 0 -a -f Allclean ] elif [ -n "$withAllclean" ] && [ -f Allclean ]
then then
# Specialized script # Specialized script
./Allclean ./Allclean

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase cleanCase
rm constant/polyMesh/boundary rm constant/polyMesh/boundary
#------------------------------------------------------------------------------

View File

@ -1,8 +1,6 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh runApplication blockMesh
runApplication extrudeMesh runApplication extrudeMesh

View File

@ -15,7 +15,7 @@ fi
removeLogs removeLogs
echo "Cleaning tutorials ..." echo "Cleaning tutorials ..."
foamCleanTutorials cases foamCleanTutorials -self
echo "--------" echo "--------"

View File

@ -2,10 +2,10 @@
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
# Extrude mesh around cylinder # An extruded mesh around cylinder
(cd cylinderAndBackground && ./Allclean) (cd cylinderAndBackground && ./Allclean)
# Add background mesh # The background mesh
(cd cylinderMesh && foamCleanTutorials) (cd cylinderMesh && foamCleanTutorials)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
# Extrude mesh around cylinder # An extruded mesh around cylinder
(cd cylinderAndBackground && ./Allclean) (cd cylinderAndBackground && ./Allclean)
# Add background mesh # The background mesh
(cd cylinderMesh && foamCleanTutorials) (cd cylinderMesh && foamCleanTutorials)
# ----------------------------------------------------------------- end-of-file #------------------------------------------------------------------------------

View File

@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
removeCase decompressionTankFine removeCase decompressionTankFine
foamCleanTutorials cases foamCleanTutorials -self
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
# Extrude mesh around cylinder # An extruded mesh around cylinder
(cd cylinderAndBackground && ./Allclean) (cd cylinderAndBackground && ./Allclean)
# Add background mesh # The background mesh
(cd cylinderMesh && foamCleanTutorials) (cd cylinderMesh && foamCleanTutorials)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,10 +2,10 @@
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
# Extrude mesh around cylinder # An extruded mesh around cylinder
(cd cylinderMesh && ./Allrun.pre) (cd cylinderMesh && ./Allrun.pre)
# Add background mesh # The background mesh
(cd cylinderAndBackground && ./Allrun $*) (cd cylinderAndBackground && ./Allrun $*)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0 cleanCase0
# ------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir restore0Dir
@ -11,3 +11,5 @@ runApplication decomposePar
runParallel createBoxTurb runParallel createBoxTurb
runParallel pimpleFoam runParallel pimpleFoam
# ------------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
(cd initChannel && ./Allclean) (cd initChannel && ./Allclean)
(cd fullCase && ./Allclean) (cd fullCase && ./Allclean)
#------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
# Run a precursor channel flow to create a fully developed flow profile for the # Run a precursor channel flow to create a fully developed flow profile for the
# main case # main case
@ -8,4 +8,4 @@ cd ${0%/*} || exit 1 # run from this directory
# Run the main case # Run the main case
(cd fullCase && ./Allrun) (cd fullCase && ./Allrun)
# ------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # Run from this directory
time=$1 time=$1
resultsDir="postProcessing/sample1/$time" resultsDir="postProcessing/sample1/$time"
@ -47,3 +47,5 @@ gnuplot<<EOF
plot "$resultsDir/x40_U_UMean.xy" u (\$5/Ub):1 title "X/h = 4" w lines lc "black" lw 2 plot "$resultsDir/x40_U_UMean.xy" u (\$5/Ub):1 title "X/h = 4" w lines lc "black" lw 2
EOF EOF
# ------------------------------------------------------------------------------

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# Note: CFL3D data available from: # Note: CFL3D data available from:
# https://turbmodels.larc.nasa.gov/bump_sa.html # https://turbmodels.larc.nasa.gov/bump_sa.html
cd ${0%/*} || exit 1 # run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
#set -x #set -x
@ -102,3 +102,5 @@ then
\rm -f Cx.$$ tau.$$ cp.$$ profiles.dat \rm -f Cx.$$ tau.$$ cp.$$ profiles.dat
fi fi
# ------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz 0/T.air.gz 0/T.water.gz \ rm -rf 0/alpha.water 0/alpha.water.gz 0/T.air.gz 0/T.water.gz \
probes wallPressure pRefProbe probes wallPressure pRefProbe

View File

@ -5,14 +5,14 @@ cd ${0%/*} || exit 1 # Run from this directory
keepCases="damBreak" keepCases="damBreak"
loseCases="damBreakFine" loseCases="damBreakFine"
for case in $keepCases for caseName in $keepCases
do do
(cd $case && foamCleanTutorials) (cd $caseName && foamCleanTutorials)
done done
for case in $loseCases for caseName in $loseCases
do do
removeCase $case removeCase $caseName
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,14 +5,14 @@ cd ${0%/*} || exit 1 # Run from this directory
keepCases="damBreak" keepCases="damBreak"
loseCases="damBreakFine" loseCases="damBreakFine"
for case in $keepCases for caseName in $keepCases
do do
(cd $case && foamCleanTutorials) (cd $caseName && foamCleanTutorials)
done done
for case in $loseCases for caseName in $loseCases
do do
removeCase $case removeCase $caseName
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases foamCleanTutorials -self
rm -rf alpha.air alpha.other alpha.water \ rm -rf alpha.air alpha.other alpha.water \
alpha.air.gz alpha.other.gz alpha.water.gz alpha.air.gz alpha.other.gz alpha.water.gz