-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhsetup.sh
More file actions
97 lines (82 loc) · 2.43 KB
/
hsetup.sh
File metadata and controls
97 lines (82 loc) · 2.43 KB
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
#!/bin/bash
set -e
cdir=$(pwd)
export MuFLRPath=$cdir/MultiFluid
########################################################
# Modify your path here
export ClassPath=~/MultiFluidCodes/class_public
# Load modules
source load_modules.sh $2
########################################################
if [[ ! -d "$ClassPath" ]]; then
echo 'Cannot find CLASS in the path you specified!'
exit 1
fi
if [[ -d $1 ]];
then echo 'Directory' $1 'already exists!'
exit 1
else
mkdir $1
fi
NTAU1=$(grep "const int N_tau = " MultiFluid/utils/cosmofunc.h | sed -e s/"const int N_tau = "//g -e s/";.*$"//g)
NMU1=$(grep "const int N_mu = " MultiFluid/utils/cosmofunc.h | sed -e s/"const int N_mu = "//g -e s/";.*$"//g)
NTAU2=$(grep "N_TAU" Config.sh | awk -F'=' '{print $2}')
NMU2=$(grep "N_MU" Config.sh | awk -F'=' '{print $2}')
if [[ $NTAU1 != $NTAU2 ]];
then echo 'MuFLR has N_tau =' $NTAU1 ', while gadget-4 has N_tau =' $NTAU2
echo 'Set the parameters equally and recompile! (Either in cosmofunc.h or Config.sh)'
rm -r $1
exit 1
fi
if [[ $NMU1 != $NMU2 ]];
then echo 'MuFLR has N_mu =' $NMU1 ', while gadget-4 has N_mu =' $NMU2
echo 'Set the parameters equally and recompile! (Either in cosmofunc.h or Config.sh)'
rm -r $1
exit 1
fi
while true; do
read -p 'Do you want to restart a Hybrid simulation? [y/n] ' RES_HYB
case $RES_HYB in
[yY]) break;;
[nN]) break;;
*) echo "Please enter only 'y' or 'n'.";;
esac
done
if [[ $RES_HYB == "n" ]];
then
while true; do
read -p 'Do you want to restart a MultiFluid simulation? [y/n] ' RES_MF
case $RES_MF in
[yY]) break;;
[nN]) break;;
*) echo "Please enter only 'y' or 'n'.";;
esac
done
fi
case $RES_HYB in
y)
source htools/scripts/build_LR.sh $1 $2
source htools/scripts/build_MF.sh $1
source htools/scripts/build_HY.sh $1
echo ''
echo 'Ready to start in folder ' $1
sleep 1
;;
n)
case $RES_MF in
y)
echo 'Preparing LR and MF'
source htools/scripts/build_LR.sh $1 $2
source htools/scripts/build_MF.sh $1
echo ''
echo 'Ready to start in folder ' $1
;;
n)
echo 'Preparing LR'
source htools/scripts/build_LR.sh $1 $2
echo ''
echo 'Ready to start in folder ' $1
;;
esac
;;
esac