-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_ATES.sh
154 lines (128 loc) · 4.23 KB
/
run_ATES.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
#!/bin/bash
# Executable bash script to run the ATES code
echo '=============================================='
echo '| |'
echo '| |'
echo '| WELCOME TO ATES-2.0 |'
echo '| |'
echo '| |'
echo '=============================================='
echo ''
echo 'For instruction on how to use, please consult'
echo ' /~https://github.com/AndreaCaldiroli/ATES-Code'
#------- Directories -------#
# Current directory
PWD=$(pwd)
# Main program directory
DIR_MAIN="$PWD"
# Source files directory
DIR_SRC="$PWD/src"
# Mod files directory
DIR_MOD="$DIR_SRC/mod"
# Utilities directory
DIR_UTILS="$DIR_SRC/utils"
# Modules directories
DIR_FILES="$DIR_SRC/modules/files_IO"
DIR_FLUX="$DIR_SRC/modules/flux"
DIR_FUNC="$DIR_SRC/modules/functions"
DIR_INIT="$DIR_SRC/modules/init"
DIR_NLSOLVE="$DIR_SRC/modules/nonlinear_system_solver"
DIR_PPC="$DIR_SRC/modules/post_process"
DIR_RAD="$DIR_SRC/modules/radiation"
DIR_STAT="$DIR_SRC/modules/states"
DIR_TIME="$DIR_SRC/modules/time_step"
#------- Cleaning old files -------#
# Clean old executable
rm -f $DIR_MAIN/*.x
# Clean .mod files
if [ ! -d $DIR_MOD ]; then
mkdir $DIR_MOD
fi
rm -f $DIR_MOD/*.mod
#------- Call python interface to create input file -------#
TABLE_FILE="$DIR_UTILS/params_table.txt"
if [ ! -f "$TABLE_FILE" ]; then
python3 -W ignore "$DIR_UTILS/gen_file.py"
mv "params_table.txt" "$DIR_UTILS/params_table.txt"
fi
python3 -W ignore "$DIR_UTILS/ATES_interface_main.py"
#------- Check input parameters -------#
INPUT_FILE="$DIR_MAIN/input.inp"
# Check if input parameters file exists
echo "Searching for the input parameters file..."
if [ -f "$INPUT_FILE" ]; then
echo "Input file found. Proceeding..."
else # Abort if no input.inp exists
echo "Unable to find a valid input file."
echo "Please create one through ATES interface."
exit 1
fi
# Create output directory if it doesn't exists
if [ ! -d "$DIR_MAIN/output" ]; then
mkdir "$DIR_MAIN/output"
fi
#------- Executing fortran file -------#
# Define compiler string
if [[ $1 = "--ifort" ]]; then
comp_str="ifort -O3 -xHost -module "$DIR_MOD" -qopenmp -no-wrap-margin"
elif [[ $1 = "--ifx" ]]; then
comp_str="ifx -O3 -xHost -module "$DIR_MOD" -qopenmp -no-wrap-margin"
else
comp_str="gfortran -O3 -J"$DIR_MOD" -I"$DIR_MOD" -fopenmp"
fi
# Define string with order of compilation
str=" $comp_str \
$DIR_INIT/parameters.f90\
$DIR_FILES/input_read.f90\
$DIR_FILES/load_IC.f90\
$DIR_FILES/write_output.f90\
$DIR_FILES/write_setup_report.f90\
$DIR_FUNC/grav_field.f90\
$DIR_FUNC/cross_sec.f90\
$DIR_FUNC/UW_conversions.f90\
$DIR_FUNC/utilities.f90\
$DIR_NLSOLVE/dogleg.f90\
$DIR_NLSOLVE/enorm.f90\
$DIR_NLSOLVE/hybrd1.f90\
$DIR_NLSOLVE/qform.f90\
$DIR_NLSOLVE/r1mpyq.f90\
$DIR_NLSOLVE/System_HeH.f90\
$DIR_NLSOLVE/System_HeH_TR.f90\
$DIR_NLSOLVE/System_implicit_adv_HeH.f90\
$DIR_NLSOLVE/System_implicit_adv_HeH_TR.f90\
$DIR_NLSOLVE/dpmpar.f90\
$DIR_NLSOLVE/fdjac1.f90\
$DIR_NLSOLVE/hybrd.f90\
$DIR_NLSOLVE/qrfac.f90\
$DIR_NLSOLVE/r1updt.f90\
$DIR_NLSOLVE/System_H.f90\
$DIR_NLSOLVE/System_implicit_adv_H.f90
$DIR_RAD/sed_read.f90\
$DIR_RAD/J_inc.f90\
$DIR_RAD/Cool_coeff.f90\
$DIR_RAD/util_ion_eq.f90\
$DIR_RAD/ionization_equilibrium.f90\
$DIR_NLSOLVE/T_equation.f90\
$DIR_PPC/post_process_adv.f90\
$DIR_STAT/Apply_BC.f90\
$DIR_STAT/PLM_rec.f90\
$DIR_STAT/Source.f90\
$DIR_STAT/Reconstruction.f90\
$DIR_FLUX/speed_estimate_HLLC.f90\
$DIR_FLUX/speed_estimate_ROE.f90\
$DIR_FLUX/Num_Fluxes.f90\
$DIR_TIME/RK_rhs.f90\
$DIR_TIME/eval_dt.f90\
$DIR_INIT/define_grid.f90\
$DIR_INIT/set_energy_vectors.f90\
$DIR_INIT/set_gravity_grid.f90\
$DIR_INIT/set_IC.f90\
$DIR_INIT/init.f90"
# Compile
$str $DIR_MAIN/ATES_main.f90 -o $DIR_MAIN/ATES.x
# ... and execute
$DIR_MAIN/ATES.x
# Print when execution is over
echo "
----- ATES shutdown -----"
echo '=============================================='