-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
286 lines (244 loc) · 8.15 KB
/
makefile
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#######################################################################
## ##
## Angular Momentum Model Of Relativistic Electron beam (AMoRE) code ##
## ##
## Copyright © 2015 Michaël J TOUATI ##
## ##
## This file is part of AMoRE. ##
## ##
## AMoRE is free software: you can redistribute it and/or modify ##
## it under the terms of the GNU General Public License as published ##
## by the Free Software Foundation, either version 3 of the License, ##
## or (at your option) any later version. ##
## ##
## AMoRE is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##
## GNU General Public License for more details. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with AMoRE. If not, see <https://www.gnu.org/licenses/>. ##
## ##
#######################################################################
## Initial commit written by Michaël J TOUATI - Oct. 2015
######################
######################
## INTEL compiler ##
######################
######################
# F90 = ifort
##########
# openMP #
##########
# OPTS = -O3 -fopenmp -r8
# OPTS = -O2 -fopenmp
#########
# debug #
#########
# OPTS = -O0 -g -debug all -debug-parameters all -fopenmp
# OPTS = -O0 -traceback -r8 -std08 -fpe0 -g -debug all -debug-parameters all -fopenmp
################
################
## gfortran ##
################
################
# F90 = mpif90
F90 = gfortran
##########
# openMP #
##########
# OPTS = -O3 -fopenmp -fdefault-real-8
OPTS = -O2 -fopenmp
#########
# debug #
#########
#OPTS = -O3 -Wall -fcheck=all -g -fbacktrace -fopenmp
# OPTS = -fdefault-real-8 -O0 -g -fopenmp -Wall -fcheck=all -fbacktrace -std=f2008 -fall-intrinsics -ffpe-trap=invalid,zero,overflow
#####################################
#####################################
## Compilation rules ##
#####################################
#####################################
SRC_PATH = sources/
SRC_PATH_PY = sources/plot/
SRCS = Acuracy.f90 \
Constants.f90 \
Physics_library.f90 \
Fokker_Planck_coef.f90 \
Input.f90 \
Transport_coef.f90 \
VFP.f90 \
Initialization.f90 \
Diagnostics.f90 \
EM_fields.f90 \
Heat_equations.f90 \
AMoRE.f90
SRCS_CHK = Acuracy.f90 \
Constants.f90 \
Physics_library.f90 \
Fokker_Planck_coef.f90 \
Input.f90 \
Input_chk.f90
OBJTS := $(SRCS:%.f90=%.o)
OBJTS_CHK := $(SRCS_CHK:%.f90=%.o)
all : check-input-deck amore \
remove-compilation-files
amore : $(OBJTS)
$(F90) $(OPTS) $(OBJTS) -o amore
%.o : $(SRC_PATH)%.f90
$(F90) $(OPTS) -c $(SRC_PATH)$*.f90
check-input-deck : $(OBJTS_CHK)
$(F90) $(OPTS) $(OBJTS_CHK) -o check-input-deck
remove-compilation-files :
@rm *.mod
@rm *.o
#########################
#########################
## Checking input-deck ##
#########################
#########################
check :
@./check-input-deck
#############
#############
## Running ##
#############
#############
run :
@./amore
##############
##############
## Cleaning ##
##############
##############
clean_results :
@rm -rf results
clean_figures :
@rm -rf figures
clean_dist :
@rm -rf *.mod *.o amore check-input-deck ${SRC_PATH_PY}__pycache__
clean : clean_results clean_figures clean_dist
##############
##############
## Plotting ##
##############
##############
plot_energy :
@python3 ${SRC_PATH_PY}plot_energy.py
plot_initialization :
@python3 ${SRC_PATH_PY}plot_initialization.py
plot_material :
@python3 ${SRC_PATH_PY}plot_material.py
plot_maps :
@python3 ${SRC_PATH_PY}plot_maps.py
plot_distribution :
@python3 ${SRC_PATH_PY}plot_distribution.py
plot : plot_energy \
plot_initialization \
plot_material \
plot_maps \
plot_distribution
###############
###############
## Testing ##
###############
###############
TEST_DIR = Vlasov/HLL-1
TEST_DIR += Vlasov/HLL-2
TEST_DIR += Parallelization/OpenMP
TEST_DIR += Fokker-Planck/Implicit-collisions
TEST_DIR += MHD/Bi-temperature
TEST_DIR += MHD/Magnetic-diffusion
TEST_DIR += Laser-solid-interaction/Rear-side-refluxing
TEST_DIR += Laser-solid-interaction/Both-sides-refluxing
TEST_DIR += Solids/Al
TEST_DIR += Solids/Cu
TEST_DIR += Solids/Ta
TEST_DIR += Solids/CH-like
TEST_DIR += Solids/C-vitreous
TEST_DIR += Plasmas/H
TEST_DIR += Plasmas/Be
TEST_DIR += Plasmas/Shock-ignition
TEST_DIR += Spectrum/Gaussian
TEST_DIR += Spectrum/Boltzmannian
TEST_DIR += Spectrum/Bi-temperature
TEST_DIR += Spectrum/Modified-bi-temperature
TEST_DIR += Spectrum/Particle-In-Cell
TEST_DIR += X-rays/Kalpha
TEST_DIR += X-rays/Tracer
# TEST_DIR += New-features/Example
RED =$(shell tput setaf 1)
GREEN =$(shell tput setaf 2)
RESET =$(shell tput sgr0)
TESTS:=$(sort ${TEST_DIR})
test :
@mv input-deck input-deck-old
@echo '---------------------------------'
@echo ' TESTS DESCRIPTION '
@echo '---------------------------------'
@echo ' '
@echo 'The tests consist in performing '
@echo ' diff file1 file2 where : '
@echo ' * file1 is the test simulation '
@echo ' terminal output '
@echo ' * file2 the terminal output of '
@echo ' the corresponding simulation '
@echo ' performed by the developper '
@echo ' located in test-cases/Tests/ '
@echo ' '
@for tst in ${TESTS}; do \
echo '---------------------------------' ; \
echo $${tst}' :' ; \
if [ $${tst} = Solids/C-vitreous ]; then \
mv sources/user/resistivity_tab.dat sources/user/resistivity_tab-old.dat ; \
cp test-cases/Tests/Solids/C-vitreous/resistivity_tab.dat sources/user/ ; \
fi ; \
if [ $${tst} = Solids/CH-like ]; then \
mv sources/user/resistivity_tab.dat sources/user/resistivity_tab-old.dat ; \
cp test-cases/Tests/Solids/CH-like/resistivity_tab.dat sources/user/ ; \
fi ; \
if [ $${tst} = Plasmas/Shock-ignition ]; then \
mv sources/user/plasma_tab.dat sources/user/plasma_tab-old.dat ; \
cp test-cases/Tests/Plasmas/Shock-ignition/plasma_tab.dat sources/user/ ; \
fi ; \
if [ $${tst} = Spectrum/Particle-In-Cell ]; then \
mv sources/user/spectrum_tab.dat sources/user/spectrum_tab-old.dat ; \
cp test-cases/Tests/Spectrum/Particle-In-Cell/spectrum_tab.dat sources/user/ ; \
fi ; \
cp test-cases/Tests/$${tst}/input-deck . ; \
./amore > test.output ; \
if hash tac 2>/dev/null; then \
tail -n +0 test.output | head -n -4 > file1 ; \
tail -n +0 test-cases/Tests/$${tst}/output | head -n -4 > file2 ; \
else \
tail -n +0 test.output | tail -r | tail -n +5 | tail -r > file1 ; \
tail -n +0 test-cases/Tests/$${tst}/output | tail -r | tail -n +5 | tail -r > file2 ; \
fi ; \
diff file1 file2; \
TST=$$?; \
rm file1; rm file2; \
if [ $$TST -eq 0 ]; then echo "${GREEN}PASSED${RESET}"; else echo "${RED}NOT PASSED${RESET}"; exit 2; fi; \
if [ $${tst} = Solids/C-vitreous ]; then \
mv sources/user/resistivity_tab-old.dat sources/user/resistivity_tab.dat ; \
fi ; \
if [ $${tst} = Solids/CH-like ]; then \
mv sources/user/resistivity_tab-old.dat sources/user/resistivity_tab.dat ; \
fi ; \
if [ $${tst} = Plasmas/Shock-ignition ]; then \
mv sources/user/plasma_tab-old.dat sources/user/plasma_tab.dat ; \
fi ; \
if [ $${tst} = Spectrum/Particle-In-Cell ]; then \
mv sources/user/spectrum_tab-old.dat sources/user/spectrum_tab.dat ; \
fi ; \
done
@rm -rf results/Vlasov
@rm -rf results/Fokker-Planck
@rm -rf results/Laser-solid-interaction
@rm -rf results/MHD
@rm -rf results/Parallelization
@rm -rf results/Plasmas
@rm -rf results/Solids
@rm -rf results/Spectrum
@rm -rf results/X-rays
@mv input-deck-old input-deck
@rm -f test.output