1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
#---------------------------------*- sh -*-------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2015-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# CleanFunctions
#
# Description
# Miscellaneous cleanup functions for tutorial cases
#
#------------------------------------------------------------------------------
cleanTimeDirectories()
{
echo "Cleaning case $PWD"
zeros=""
while [ ${#zeros} -lt 8 ]
do
timeDir="0.${zeros}[1-9]*"
rm -rf ./${timeDir} ./-${timeDir}
zeros="0$zeros"
done
rm -rf \
./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* \
./.fxLock ./*.xml ./ParaView* ./paraFoam* \
./*.blockMesh ./*.foam ./*.OpenFOAM \
./.setSet
}
cleanAdiosOutput()
{
if [ -d adiosData ] && [ -d system ]
then
rm -rf adiosData
fi
}
cleanDynamicCode()
{
if [ -d dynamicCode ] && [ -d system ]
then
rm -rf dynamicCode
fi
}
cleanSnappyFiles()
{
rm -f \
constant/polyMesh/cellLevel \
constant/polyMesh/pointLevel \
constant/polyMesh/refinementHistory \
constant/polyMesh/level0Edge \
constant/polyMesh/surfaceIndex
rm -f \
processor*/constant/polyMesh/cellLevel \
processor*/constant/polyMesh/pointLevel \
processor*/constant/polyMesh/refinementHistory \
processor*/constant/polyMesh/level0Edge \
processor*/constant/polyMesh/surfaceIndex
rm -f \
constant/cellLevel \
constant/pointLevel \
0/cellLevel \
0/pointLevel
rm -f \
processor*/constant/cellLevel \
processor*/constant/pointLevel \
processor*/0/cellLevel \
processor*/0/pointLevel
}
cleanOptimisation()
{
rm -rf optimisation
rm -rf constant/controlPoints
}
cleanPostProcessing()
{
rm -rf Ensight EnSight ensightWrite insitu VTK
rm -rf postProcessing
rm -rf postProcessing-*
rm -rf cuttingPlane
rm -rf surfaceSampling
}
cleanCase()
{
cleanTimeDirectories
cleanPostProcessing
cleanAdiosOutput
cleanDynamicCode
cleanOptimisation
rm -rf processor*
rm -rf TDAC
rm -rf probes*
rm -rf forces*
rm -rf graphs*
rm -rf sets
rm -rf system/machines
# From mpirunDebug
rm -f gdbCommands mpirun.schema
cleanSnappyFiles
rm -f 0/cellDist
(
cd constant 2>/dev/null || exit 0
rm -rf \
cellDecomposition cellToRegion cellLevel* pointLevel* \
tetDualMesh \
;
# Old constant/polyMesh location for blockMeshDict still in use?
# - emit a gentle warning
if [ -e polyMesh/blockMeshDict.m4 ]
then
rm -f polyMesh/blockMeshDict
echo
echo "Warning: not removing constant/polyMesh/ "
echo " it contains a blockMeshDict, which should normally be under system/ instead"
echo
elif [ -e polyMesh/blockMeshDict ]
then
echo
echo "Warning: not removing constant/polyMesh/ "
echo " it contains a blockMeshDict, which should normally be under system/ instead"
echo
else
# Remove polyMesh entirely if there is no blockMeshDict
rm -rf polyMesh
fi
)
if [ -e system/blockMeshDict.m4 ]
then
rm -f system/blockMeshDict
fi
}
# Frequently used - cleanCase and rm -rf 0/
cleanCase0()
{
cleanCase
rm -rf 0
}
removeCase()
{
echo "Removing case ${1:-unknown}"
[ "$#" -ge 1 ] && rm -rf "$1"
}
cleanSamples()
{
rm -rf sets samples sampleSurfaces
}
cleanUcomponents()
{
rm -rf 0/Ux 0/Uy 0/Uz
}
cleanFaMesh ()
{
rm -rf \
constant/faMesh/faceLabels* \
constant/faMesh/faBoundary* \
;
}
cleanApplication()
{
echo "Cleaning application $PWD"
wclean
}
#------------------------------------------------------------------------------
|