forked from precice/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleaning-tools.sh
executable file
·188 lines (171 loc) · 4.22 KB
/
cleaning-tools.sh
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
#!/bin/sh
error() {
echo "Error: $1" >&2
exit 1
}
clean_tutorial() {
(
set -e -u
cd "$1"
echo "# Cleaning up all cases in $(pwd)..."
rm -rfv ./precice-run/
# Run clean.sh if it exists in the base tutorial directory
if test -f "clean.sh"; then
./clean.sh
fi
for case in */; do
if [ "${case}" = images/ ] || [ "${case}" = reference-results/ ]; then
continue
fi
case "${case}" in solver*)
continue
esac
(cd "${case}" && ./clean.sh || echo "No cleaning script in ${case} - skipping")
done
)
}
clean_precice_logs() {
(
set -e -u
cd "$1"
echo "- Cleaning up preCICE logs in $(pwd)"
rm -fv ./precice-*-iterations.log \
./precice-*-convergence.log \
./precice-*-watchpoint-*.log \
./precice-*-watchintegral-*.log \
./core
rm -rfv ./precice-profiling/ profiling.json trace.json
rm -rfv ./precice-exports/
)
}
clean_case_logs() {
(
set -e -u
cd "$1"
echo "- Cleaning up general case logs in $(pwd)"
CASENAME="$(readlink -f "$0" | xargs dirname | xargs basename)"
rm -fv "./$CASENAME.log"
)
}
clean_calculix() {
(
set -e -u
cd "$1"
echo "- Cleaning up CalculiX case in $(pwd)"
rm -fv ./*.cvg ./*.dat ./*.frd ./*.sta ./*.12d ./*.rout spooles.out dummy
rm -fv WarnNodeMissMultiStage.nam
rm -fv ./*.eig
rm -fv ./*.vtk
clean_precice_logs .
clean_case_logs .
)
}
clean_codeaster() {
(
set -e -u
cd "$1"
echo "- Cleaning up code_aster case in $(pwd)"
rm -fv ./*.mess ./*.resu ./*.rmed
rm -rfv ./REPE_OUT/*
clean_precice_logs .
clean_case_logs .
)
}
clean_dealii() {
(
set -e -u
cd "$1"
echo "- Cleaning up deal.II case in $(pwd)"
rm -rfv ./dealii-output/
clean_precice_logs .
clean_case_logs .
)
}
clean_fenics() {
(
set -e -u
cd "$1"
echo "- Cleaning up FEniCS case in $(pwd)"
rm -rfv ./output/
clean_precice_logs .
clean_case_logs .
)
}
clean_nutils() {
(
set -e -u
cd "$1"
echo "- Cleaning up Nutils case in $(pwd)"
rm -fv ./*.vtk
clean_precice_logs .
clean_case_logs .
)
}
clean_openfoam() {
(
set -e -u
cd "$1"
echo "- Cleaning up OpenFOAM case in $(pwd)"
if [ -n "${WM_PROJECT:-}" ] || error "No OpenFOAM environment is active."; then
# shellcheck disable=SC1090 # This is an OpenFOAM file which we don't need to check
. "${WM_PROJECT_DIR}/bin/tools/CleanFunctions"
cleanCase > /dev/null
rm -rfv 0/uniform/functionObjects/functionObjectProperties history
fi
clean_precice_logs .
clean_case_logs .
)
}
clean_su2() {
(
set -e -u
cd "$1"
echo "- Cleaning up SU2 case in $(pwd)"
rm -fv ./restart_flow_*.dat ./restart_flow_*.csv forces_breakdown.dat ./surface_flow_*.csv ./flow_*.vtk ./history_*.vtk ./history.vtk ./history_*.csv ./history.csv ./surface_flow_*.vtu ./flow_*.vtu
clean_precice_logs .
clean_case_logs .
)
}
clean_aste() {
(
set -e -u
cd "$1"
echo "- Cleaning up ASTE results in $(pwd)"
rm -fv result.vtk result.stats.json
rm -fvr fine_mesh coarse_mesh mapped
)
}
clean_dune() {
(
set -e -u
cd "$1"
echo "- Cleaning up DUNE case in $(pwd)"
rm -fv ./dgfparser.log
rm -fv ./*.pvd
rm -fv ./*.vtu
rm -rfv ./output/
clean_precice_logs .
clean_case_logs .
)
}
clean_dumux() {
(
set -e -u
cd "$1"
echo "- Cleaning up DuMuX case in $(pwd)"
rm -fv ./*.vtu
rm -fv ./*.pvd
clean_precice_logs .
clean_case_logs .
)
}
clean_fmi() {
(
set -e -u
cd "$1"
echo "- Cleaning up FMI case in $(pwd)"
rm -rfv ./output/
clean_precice_logs .
clean_case_logs .
)
}