forked from jordydavelaar/raptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·177 lines (147 loc) · 3.6 KB
/
setup.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
#!/bin/bash
echo "RAPTOR setup script"
METRIC="cks"
INT="rk4"
CODE="bhac"
GRID="smr"
RAD="pol"
SF="nosfc"
for arg in "$@"
do
case $arg in
-c=*|--code=*)
CODE="${arg#*=}"
shift # Remove --cache= from processing
;;
-m=*|--metric=*)
METRIC="${arg#*=}"
shift # Remove --cache= from processing
;;
-i=*|--int=*)
INT="${arg#*=}"
shift # Remove --cache= from processing
;;
-g=*|--grid=*)
GRID="${arg#*=}"
shift # Remove --cache= from processing
;;
-r=*|--rad=*)
RAD="${arg#*=}"
shift # Remove --cache= from processing
;;
-s=*|--sf=*)
SF="${arg#*=}"
shift # Remove --cache= from processing
;;
-b=*|--bflip=*)
BFLIP="${arg#*=}"
shift # Remove --cache= from processing
;;
esac
done
if [ "$RAPTOR" == "" ] ;
then
echo "Code dir is empty, set RAPTOR enviroment variable first"
echo "export RAPTOR=/path/to/code"
echo "Aborting..."
exit
else
echo "Code located at $RAPTOR"
echo " "
fi
rsync -u -v $RAPTOR/run/* .
echo "Copying files"
if [ "$CODE" == "bhac" ] ;
then
rsync -v -u $RAPTOR/model/bhac/* .
echo "done copying"
elif [ "$CODE" == "harm3d" ] ;
then
rsync -v -u $RAPTOR/model/harm3d/* .
elif [ "$CODE" == "hamr" ] ;
then
rsync -v -u $RAPTOR/model/HAMR/* .
else
echo "no grmhd model picked. Aborting."
exit
fi
if [ "$CODE" == "bhac" ] ;
then
if [ "$METRIC" == "mks" ] ;
then
sed -i '/#define metric (/s/.*/#define metric (MKSBHAC)/' definitions.h
fi
if [ "$METRIC" == "cks" ] ;
then
sed -i '/#define metric (/s/.*/#define metric (CKS)/' definitions.h
fi
fi
if [ "$CODE" == "harm3d" ] ;
then
if [ "$METRIC" == "mks" ] ;
then
sed -i '/#define metric (/s/.*/#define metric (MKSHARM)/' definitions.h
fi
fi
if [ "$INT" == "ver" ] ;
then
sed -i '/#define int_method (/s/.*/#define int_method (VER)/' definitions.h
fi
if [ "$INT" == "rk2" ] ;
then
sed -i '/#define int_method (/s/.*/#define int_method (RK2)/' definitions.h
fi
if [ "$INT" == "rk4" ] ;
then
sed -i '/#define int_method (/s/.*/#define int_method (RK4)/' definitions.h
fi
if [ "$INT" == "rk45" ] ;
then
sed -i '/#define int_method (/s/.*/#define int_method (RK45)/' definitions.h
fi
if [ "$GRID" == "SMR" ] ;
then
sed -i '/#define AMR /s/.*/#define AMR 0/' definitions.h
sed -i '/#define SMR /s/.*/#define SMR 1/' definitions.h
fi
if [ "$GRID" == "AMR" ] ;
then
sed -i '/#define AMR /s/.*/#define AMR 1/' definitions.h
sed -i '/#define SMR /s/.*/#define SMR 0/' definitions.h
fi
if [ "$RAD" == "pol" ] ;
then
sed -i '/#define POL (/s/.*/#define POL (1)/' definitions.h
fi
if [ "$RAD" == "unpol" ] ;
then
sed -i '/#define POL (/s/.*/#define POL (0)/' definitions.h
fi
if [ "$SF" == "sfc" ] ;
then
sed -i '/#define SFC /s/.*/#define SFC 1/' model_definitions.h
else
sed -i '/#define SFC /s/.*/#define SFC 0/' model_definitions.h
fi
if [ "$BFLIP" == "minus" ] ;
then
sed -i '/#define BPOL /s/.*/#define BPOL (MINUS)/' model_definitions.h
else
sed -i '/#define BPOL /s/.*/#define BPOL (PLUS)/' model_definitions.h
fi
echo " "
echo "Succesfully initialized."
echo " "
echo "Start compilation"
echo " "
make clean && make all
if [ $? -ne 0 ];
then
echo "Compilations unsuccesful"
exit
else
echo "Compilations succesful"
fi
echo " "
echo "Done initialization, use make all to recompile."
echo "Setup used code $CODE (-c/--code) metric $METRIC (-m/--metric) int $INT (-i/--int) grid $GRID (-g/--grid) rad $RAD (-r/--rad) sfc $SF (-s/--sf)"