-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAllrun
executable file
·56 lines (44 loc) · 1.86 KB
/
Allrun
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
#!/usr/bin/env bash
source ${1}/etc/bashrc
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
set -e
function getParam() {
foamDictionary -entry "$1" -value system/geometryDict
}
nCurvePnts=$(getParam "nCurvePnts")
nCtrlPnts=$(getParam "nCtrlPnts")
nNewCtrlPnts=$((nCtrlPnts-2))
L=$(getParam "L")
counter=1
ctrlPnts="["
for i in $(seq 1 $nNewCtrlPnts); do
ctrlPnts="$ctrlPnts [$(getParam "Ctrl${counter}X"), $(getParam "Ctrl${counter}Y"), 0],"
counter=$((counter+1))
done
ctrlPnts="$ctrlPnts ]"
## First generate the geometry
runApplication openscad -o geometry/pitzDaily.stl -D "nCurvePnts=$nCurvePnts;nCtrlPnts=$nCtrlPnts;L=$L;newCtrlPnts=$ctrlPnts" openscad/pitzDaily.scad
## Then remove the faces whose normals are in Z
sed -r '/facet normal [-+]?0 [-+]?0 /,+6d' geometry/pitzDaily.stl > geometry/pitzDaily2D.stl
# Check the surface file
runApplication surfaceCheck geometry/pitzDaily2D.stl
# Split patches and put back together
runApplication pvpython patches.py $PWD/geometry
echo "Writing geometry/pitzDaily.stl"
sed "s/^solid.*/solid inlet/g" geometry/inlet.stl > geometry/pitzDaily.stl
sed "s/^solid.*/solid outlet/g" geometry/outlet.stl >> geometry/pitzDaily.stl
sed "s/^solid.*/solid upperWall/g" geometry/upperWall.stl >> geometry/pitzDaily.stl
counter=1
for ii in geometry/patch*.stl; do
sed "s/^solid.*/solid wall_$counter/g" "$ii" >> geometry/pitzDaily.stl
counter=$((counter+1))
done
# Generate the mesh
runApplication cartesian2DMesh
cp -rT 0orig 0
# Parallel run on the slurm cluster
runApplication $(getApplication)
postProcess -fields "(p U)" -func "totalPressureIncompressible" -latestTime
postProcess -fields "total(p)" -func "pressureDifferencePatch" -latestTime