diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean index 9fc0cf15ce..1607ce8b6f 100755 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean @@ -7,4 +7,4 @@ wclean libso CompressibleMultiPhaseTurbulenceModels wclean libso laserDTRM wclean -# ----------------------------------------------------------------- end-of-file +#------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwmake b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwmake index 1bebf480a1..114a214393 100755 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwmake +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwmake @@ -11,4 +11,4 @@ wmake $targetType CompressibleMultiPhaseTurbulenceModels wmake $targetType laserDTRM wmake $targetType -# ----------------------------------------------------------------- end-of-file +#------------------------------------------------------------------------------ diff --git a/bin/foamCleanTutorials b/bin/foamCleanTutorials index 6a3f696f90..e00b463c97 100755 --- a/bin/foamCleanTutorials +++ b/bin/foamCleanTutorials @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | +# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # | Copyright (C) 2011 OpenFOAM Foundation @@ -31,22 +31,54 @@ # Run either Allwclean, Allclean or default cleanCase in current directory # 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 -thisScript=$0 +thisScript="$0" if [ "/${thisScript#/}" != "$thisScript" ] then thisScript="$PWD/$thisScript" fi -# If an argument is supplied do not execute ./Allwclean or ./Allclean -# (to avoid recursion) -if [ $# -eq 0 -a -f Allwclean ] +# Simple option/argument parsing. +# By default use Allclean, Allwclean when present +# +# 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 # Specialized script ./Allwclean -elif [ $# -eq 0 -a -f Allclean ] +elif [ -n "$withAllclean" ] && [ -f Allclean ] then # Specialized script ./Allclean diff --git a/etc/templates/axisymmetricJet/Allclean b/etc/templates/axisymmetricJet/Allclean index ce8bcabbfc..04120ad052 100755 --- a/etc/templates/axisymmetricJet/Allclean +++ b/etc/templates/axisymmetricJet/Allclean @@ -1,8 +1,8 @@ #!/bin/sh -cd ${0%/*} || exit 1 # run from this directory - -# Source tutorial clean functions -. $WM_PROJECT_DIR/bin/tools/CleanFunctions +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions cleanCase rm constant/polyMesh/boundary + +#------------------------------------------------------------------------------ diff --git a/etc/templates/axisymmetricJet/Allrun b/etc/templates/axisymmetricJet/Allrun index c5a0b2cea6..d3930811be 100755 --- a/etc/templates/axisymmetricJet/Allrun +++ b/etc/templates/axisymmetricJet/Allrun @@ -1,8 +1,6 @@ #!/bin/sh -cd ${0%/*} || exit 1 # run from this directory - -# Source tutorial run functions -. $WM_PROJECT_DIR/bin/tools/RunFunctions +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions runApplication blockMesh runApplication extrudeMesh diff --git a/tutorials/Allclean b/tutorials/Allclean index 486d999d45..70e761244d 100755 --- a/tutorials/Allclean +++ b/tutorials/Allclean @@ -15,7 +15,7 @@ fi removeLogs echo "Cleaning tutorials ..." -foamCleanTutorials cases +foamCleanTutorials -self echo "--------" diff --git a/tutorials/basic/overPotentialFoam/cylinder/Allclean b/tutorials/basic/overPotentialFoam/cylinder/Allclean index 5a8494c4b6..3f56512f8f 100755 --- a/tutorials/basic/overPotentialFoam/cylinder/Allclean +++ b/tutorials/basic/overPotentialFoam/cylinder/Allclean @@ -2,10 +2,10 @@ cd ${0%/*} || exit 1 # Run from this directory . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions -# Extrude mesh around cylinder +# An extruded mesh around cylinder (cd cylinderAndBackground && ./Allclean) -# Add background mesh +# The background mesh (cd cylinderMesh && foamCleanTutorials) #------------------------------------------------------------------------------ diff --git a/tutorials/compressible/overRhoSimpleFoam/hotCylinder/Allclean b/tutorials/compressible/overRhoSimpleFoam/hotCylinder/Allclean index 862ed262d8..e3d1054040 100755 --- a/tutorials/compressible/overRhoSimpleFoam/hotCylinder/Allclean +++ b/tutorials/compressible/overRhoSimpleFoam/hotCylinder/Allclean @@ -1,10 +1,10 @@ #!/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) -# Add background mesh +# The background mesh (cd cylinderMesh && foamCleanTutorials) -# ----------------------------------------------------------------- end-of-file +#------------------------------------------------------------------------------ diff --git a/tutorials/compressible/sonicLiquidFoam/Allclean b/tutorials/compressible/sonicLiquidFoam/Allclean index cbd249f6ef..2067a879ff 100755 --- a/tutorials/compressible/sonicLiquidFoam/Allclean +++ b/tutorials/compressible/sonicLiquidFoam/Allclean @@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory . $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions removeCase decompressionTankFine -foamCleanTutorials cases +foamCleanTutorials -self #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean index a916d07554..e3d1054040 100755 --- a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean @@ -1,10 +1,10 @@ #!/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) -# Add background mesh +# The background mesh (cd cylinderMesh && foamCleanTutorials) #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun index a98fd76068..2d31897a48 100755 --- a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun @@ -2,10 +2,10 @@ cd ${0%/*} || exit 1 # Run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions -# Extrude mesh around cylinder +# An extruded mesh around cylinder (cd cylinderMesh && ./Allrun.pre) -# Add background mesh +# The background mesh (cd cylinderAndBackground && ./Allrun $*) #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean index f302b7891a..55b9f196c9 100755 --- a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean @@ -1,5 +1,7 @@ #!/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 cleanCase0 + +# ------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun index fa83764ff9..c72455aaad 100755 --- a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun @@ -1,6 +1,6 @@ #!/bin/sh -cd ${0%/*} || exit 1 # run from this directory -. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions restore0Dir @@ -11,3 +11,5 @@ runApplication decomposePar runParallel createBoxTurb runParallel pimpleFoam + +# ------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allclean b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allclean index 77dcff4e4c..6f040f3f38 100755 --- a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allclean +++ b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allclean @@ -1,6 +1,7 @@ #!/bin/sh -cd ${0%/*} || exit 1 # run from this directory +cd ${0%/*} || exit 1 # Run from this directory (cd initChannel && ./Allclean) (cd fullCase && ./Allclean) +#------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allrun b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allrun index 915160a56a..3a5026609f 100755 --- a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allrun +++ b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/Allrun @@ -1,5 +1,5 @@ #!/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 # main case @@ -8,4 +8,4 @@ cd ${0%/*} || exit 1 # run from this directory # Run the main case (cd fullCase && ./Allrun) - +# ------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/fullCase/plot b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/fullCase/plot index 4ca8996123..400caa22e8 100755 --- a/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/fullCase/plot +++ b/tutorials/incompressible/pimpleFoam/LES/surfaceMountedCube/fullCase/plot @@ -1,5 +1,5 @@ #!/bin/sh -cd ${0%/*} || exit 1 # run from this directory +cd ${0%/*} || exit 1 # Run from this directory time=$1 resultsDir="postProcessing/sample1/$time" @@ -47,3 +47,5 @@ gnuplot<