-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAllrun.slurm
executable file
·61 lines (51 loc) · 1.93 KB
/
Allrun.slurm
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
#!/usr/bin/bash -l
#SBATCH -N 1
#SBATCH -n 2
#SBATCH --output=log.%x
#SBATCH --partition=queue-1
#SBATCH --constraint=c5a.24xlarge
#
source ${2}/etc/bashrc
conda activate /fsx/bias/bias_env
cd "${1}" || 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
runApplication decomposePar
# Parallel run on the slurm cluster
mpirun --output-filename log $(getApplication) -parallel
runApplication reconstructPar