diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/Allwclean index 9fc0cf15ce35965dfc268adf75fe0e8442758f4e..1607ce8b6fec1f910e28f88d62177ad5a69dc3c0 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 1bebf480a104f075fb29523d78cded5920f50ac3..114a214393d69c1e1a6cea34afcca30d6f33cab6 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 6a3f696f902b3816a54014cce0435b614071258d..e00b463c97ed0c6371c82a055f2237cde7e1b579 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 ce8bcabbfc4ada9d48fb301820be1cb87c770a01..04120ad052129afd97b44368730f907f40bb5641 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 c5a0b2cea66f21e7f8bf51b25c16d98ddd1b663d..d3930811be0d1a9830b836fd6f03a1f871e44d2f 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 486d999d45a31b431ab378193e9dae4311b9f3a7..70e761244d6a538a4a7650a6940f403ffb8e41dd 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 5a8494c4b60dce6826245c6735a16bf6f7707065..3f56512f8f0a538be6d62aa6442cdb85da479156 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 862ed262d87e660157ae5c8802d3e9dc742b91c5..e3d10540407746aa540094722244765301791705 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 cbd249f6efbb5b00592ca006a4c38c9f1f4d7b9a..2067a879ff5ee323b6c728b50abe098f7866f543 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 a916d0755471418253cb46c1d993f21b4fa9ecef..e3d10540407746aa540094722244765301791705 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 a98fd76068981a93b833e87d7ff2d2fe6b540142..2d31897a485a9bfeaf56bc63327588e1e6d24041 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 f302b7891a417508af9b4804b1e06258bac31f7d..55b9f196c9354011e33acea50877cd3cfef99d5b 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 fa83764ff90ebb5b229c5e6afa79cc2144b5ae97..c72455aaadc7fa4ed10f0c059421cf5c87ec6263 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 77dcff4e4cd89763b504f0830dcff2a3160a189b..6f040f3f38f81ef5770f6bf57f88bb5ce98fbfae 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 915160a56a32fb73024940dd32e3a0d5bcc510ae..3a5026609faf89c35928cc82e5ea78fd2e363fc5 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 4ca8996123427ebb9e7e737dd03b17c234863a39..400caa22e896850ef9f402feee7d621668f7d698 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<<EOF plot "$resultsDir/x40_U_UMean.xy" u (\$5/Ub):1 title "X/h = 4" w lines lc "black" lw 2 EOF + +# ------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/createPlots b/tutorials/incompressible/simpleFoam/bump2D/createPlots index 9ae5e39bb5296c5ac415e5c97067472b6da82eab..31c08adc247c17f0d59ddcbccb5e324a15b5b21b 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/createPlots +++ b/tutorials/incompressible/simpleFoam/bump2D/createPlots @@ -1,8 +1,8 @@ #!/bin/sh # Note: CFL3D data available from: # 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 #set -x @@ -102,3 +102,5 @@ then \rm -f Cx.$$ tau.$$ cp.$$ profiles.dat fi + +# ------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/Allclean b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/Allclean index b2105c21b3e42b6bdad325716d4f1ea0a949406a..aea3f0b970e7eb178cd3e91da59e823bd8884261 100755 --- a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/Allclean +++ b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/Allclean @@ -1,7 +1,7 @@ #!/bin/sh 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 \ probes wallPressure pRefProbe diff --git a/tutorials/multiphase/interFoam/RAS/damBreak/Allclean b/tutorials/multiphase/interFoam/RAS/damBreak/Allclean index 050c71bde5fa12db36297c4d96cb268799cdcf01..a818e3ba0e87a5767608be3a4cde463239873518 100755 --- a/tutorials/multiphase/interFoam/RAS/damBreak/Allclean +++ b/tutorials/multiphase/interFoam/RAS/damBreak/Allclean @@ -5,14 +5,14 @@ cd ${0%/*} || exit 1 # Run from this directory keepCases="damBreak" loseCases="damBreakFine" -for case in $keepCases +for caseName in $keepCases do - (cd $case && foamCleanTutorials) + (cd $caseName && foamCleanTutorials) done -for case in $loseCases +for caseName in $loseCases do - removeCase $case + removeCase $caseName done #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/Allclean b/tutorials/multiphase/interFoam/laminar/damBreak/Allclean index 050c71bde5fa12db36297c4d96cb268799cdcf01..a818e3ba0e87a5767608be3a4cde463239873518 100755 --- a/tutorials/multiphase/interFoam/laminar/damBreak/Allclean +++ b/tutorials/multiphase/interFoam/laminar/damBreak/Allclean @@ -5,14 +5,14 @@ cd ${0%/*} || exit 1 # Run from this directory keepCases="damBreak" loseCases="damBreakFine" -for case in $keepCases +for caseName in $keepCases do - (cd $case && foamCleanTutorials) + (cd $caseName && foamCleanTutorials) done -for case in $loseCases +for caseName in $loseCases do - removeCase $case + removeCase $caseName done #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingCylinder/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingCylinder/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingCylinder/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingCylinder/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allclean b/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allclean +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/sloshingTank2D/Allclean b/tutorials/multiphase/interIsoFoam/sloshingTank2D/Allclean index dc74ee4df5c566f4315aaf259253ed0bf0fb8e56..e923a99f6019fab310529a1946b076234a71469f 100755 --- a/tutorials/multiphase/interIsoFoam/sloshingTank2D/Allclean +++ b/tutorials/multiphase/interIsoFoam/sloshingTank2D/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allclean b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allclean index af7604fd467a62b16c57a786d8d02b03c1ded0b4..af842959fd13c9ff41db00399a383dfb31a6bd93 100755 --- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allclean +++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allclean @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -foamCleanTutorials cases +foamCleanTutorials -self rm -rf alpha.air alpha.other alpha.water \ alpha.air.gz alpha.other.gz alpha.water.gz