-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
executable file
·488 lines (433 loc) · 16.4 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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# Top level makefile for IM/RAM_SCB
default : RAM_SCB
include Makefile.def
srcDir = src
GlowDir= srcGlow
INSTALLFILES = ${srcDir}/Makefile.DEPEND \
${srcDir}/Makefile.RULES \
srcInterface/Makefile.DEPEND \
srcExternal/Makefile.DEPEND \
${GlowDir}/Makefile.DEPEND
help:
@echo ' '
@echo ' You can "make" the following:'
@echo ' '
@echo ' <default> Build the RAM-SCB executable.'
@echo ' '
@echo ' help (makefile option list)'
@echo ' install (install RAM_SCB)'
@echo ' PDF (Make PDF version of the documentation)'
@echo ' HTML (Make HTML version of the documentation)'
@echo ' test (run all tests for RAM-SCB)'
@echo ' test_help (show all options for running the tests)'
@echo ' unittest (run unit test suite for RAM-SCB)'
@echo ' LIB (Component library libIM for SWMF)'
PDF:
@cd doc/Tex; make PDF
RAM_SCB:
@cd ${SHAREDIR}; make LIB
@cd srcExternal; make LIB
@cd ${GlowDir}; make LIB
@cd ${srcDir}; make LIB
@cd ${srcDir}; make RAM_SCB
install:
@touch ${INSTALLFILES}
LIB:
cd ${srcDir}; make LIB
cd srcInterface; make LIB
cd srcExternal; make LIB
cd ${GlowDir}; make LIB
clean:
@touch ${INSTALLFILES}
@cd ${srcDir}; make clean
@cd srcInterface; make clean
@cd srcExternal; make clean
@cd ${GlowDir}; make clean
@(if [ -d util ]; then cd util; make clean; fi);
@(if [ -d share ]; then cd share; make clean; fi);
distclean:
./Config.pl -uninstall
allclean:
@touch ${INSTALLFILES}
@(if [ -d srcNetcdf ]; then rm -rf srcNetcdf; fi);
@(if [ -d srcPspline ]; then rm -rf srcPspline; fi);
@cd ${srcDir}; make distclean
@cd srcInterface; make distclean
@cd ${GlowDir}; make distclean
rm -f *~
rundir:
mkdir -p ${RUNDIR}/IM/output
cp input/RamIndices.txt ${RUNDIR}/
cp input/apf107.dat ${RUNDIR}/
cp input/ig_rz.dat ${RUNDIR}/
cp input/newtau.dat ${RUNDIR}/
cp input/ne_full.dat ${RUNDIR}/
cp input/initialization.nc ${RUNDIR}/IM/
cp input/QinDenton_20130317_1min.txt ${RUNDIR}/IM/
cp input/NitrogenCrossSections.dat ${RUNDIR}/IM/
cp input/AEindex.txt ${RUNDIR}/
cd ${RUNDIR}; \
ln -s ../input/bav_diffcoef_chorus_rpa_Kp*.PAonly.dat .
cd ${RUNDIR}/IM/output; \
mkdir -p ram/Dsbnd scb/Day00 sce/
cd ${RUNDIR}/IM; \
mkdir input_ram input_scb input_sce output_swmf; \
mkdir restartIN restartOUT; \
tar xzf ${IMDIR}/input/ramscb_inputs.tgz; \
mv Input_git/EMIC_model input_ram/; \
mv Input_git/HBand input_ram/; \
mv Input_git/HeBand input_ram/; \
mv Input_git/w2k.dat ../; \
mv Input_git/W05_coeff.dat ../; \
mv Input_git/omni.txt ../; \
mv Input_git/*geomlt*.txt input_ram/; \
mv initialization.nc input_ram/; \
mv QinDenton_20130317_1min.txt input_scb/; \
mv NitrogenCrossSections.dat input_ram/; \
cp -r ${IMDIR}/input/glow_data input_sce/;
@(if [ "$(STANDALONE)" != "NO" ]; then \
cd ${RUNDIR} ; \
cp ${IMDIR}/Param/PARAM.in.default ./PARAM.in; \
ln -s ${BINDIR}/ram_scb.exe .; \
ln -s IM/* .; \
rm -f output; \
ln -s IM/output/ram output_ram; \
ln -s IM/output/scb output_scb; \
ln -s IM/output/sce output_sce;\
fi)
#---------
# TESTS
#---------
unittest:
@cd ${SHAREDIR}; make LIB
@cd srcExternal; make LIB
@cd ${srcDir}; make LIB
@cd ${srcDir}; make tests
@(make unittest_run)
TESTDIR1 = run_test1
TESTDIR2 = run_test2
TESTDIR3 = run_test3
TESTDIR4 = run_test4
TESTDIRC = run_test
TESTDIRU = run_unittest
unittest_run:
@rm -rf ${TESTDIRU}
@make rundir RUNDIR=${TESTDIRU} STANDALONE="YES"
@mv ${srcDir}/unittest.exe ${TESTDIRU}
@cd ${TESTDIRU}; ./unittest.exe
test:
@(make test1)
@(make test2)
@(make test3)
@(make test4)
testCI:
@(make test2)
@(make test3)
test_help:
@echo "Preceed all commands with 'make'..."
@echo " test Run all tests in serial."
@echo " test1 Test RAM only (dipole+VS, no SCB.)"
@echo " test2 Test1 + Restart to test restart files."
@echo " test3 Test RAM-SCB using W2k, T89, and electrons."
@echo " test1 MPIRUN='mpiexec -n 2' Run test1 in parallel (on two cpus.)"
@echo "Each test has commands to perform individual steps, e.g.:"
@echo " test1_compile Compile code for test1"
@echo " test1_rundir Create run directory for test."
@echo " test1_run Execute the test simulation."
@echo " test1_check Compare results to reference solution."
#TEST TRAVIS
testTravisLong:
@echo "starting..." > test1.diff
@echo "test1_compile..." >> test1.diff
make test1_compile
@echo "test1_rundir..." >> test1.diff
make test1_rundir PARAMFILE=PARAM.in.test1
@echo "test1_run..." >> test1.diff
make test1_run MPIRUN=
@echo "test1_check..." >> test1.diff
make test1_check
@echo "starting..." > test3.diff
@echo "test3_compile..." >> test3.diff
make test3_compile
@echo "test3_rundir..." >> test3.diff
make test3_rundir PARAMFILE=PARAM.in.test3
@echo "test3_run..." >> test3.diff
make test3_run MPIRUN=
@echo "starting..." > test4.diff
@echo "test4_compile..." >> test4.diff
make test4_compile
@echo "test4_rundir..." >> test4.diff
make test4_rundir PARAMFILE=PARAM.in.test4
@echo "test4_run..." >> test4.diff
make test4_run MPIRUN=
@echo "test4_check..." >> test4.diff
make testTravis_check
#TRAVIS Test
testTravis_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR3}/output_ram/pressure_d20130317_t001500.dat \
${TESTDIR4}/output_ram/pressure_d20130317_t001500.dat \
> testTravis.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR3}/output_scb/hI_output_d20130317_t001500.dat \
${TESTDIR4}/output_scb/hI_output_d20130317_t001500.dat \
>> testTravis.diff
ncdump -v "Flux_H","B_xyz" \
${TESTDIR3}/output_ram/sat1_d20130317_t000000.nc \
| sed -e '1,/data:/d' > \
${TESTDIR3}/output_ram/sat1.test
ncrcat ${TESTDIR4}/output_ram/sat1_d20130317_t000000.nc \
${TESTDIR4}/output_ram/sat1_d20130317_t001000.nc \
${TESTDIR4}/output_ram/sat1.nc
ncdump -v "Flux_H","B_xyz" ${TESTDIR4}/output_ram/sat1.nc \
| sed -e '1,/data:/d' > \
${TESTDIR4}/output_ram/sat1.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR3}/output_ram/sat1.test \
${TESTDIR4}/output_ram/sat1.test \
>> testTravis.diff
@echo "Test Successful!"
#TEST 1----------------------------------
test1:
@echo "starting..." > test1.diff
@echo "test1_compile..." >> test1.diff
make test1_compile
@echo "test1_rundir..." >> test1.diff
make test1_rundir PARAMFILE=PARAM.in.test1
@echo "test1_run..." >> test1.diff
make test1_run MPIRUN=
@echo "test1_check..." >> test1.diff
make test1_check
test1_compile:
make
test1_rundir:
rm -rf ${TESTDIR1}
make rundir RUNDIR=${TESTDIR1} STANDALONE="YES"
cp Param/${PARAMFILE} ${TESTDIR1}/PARAM.in
cp input/sat*.dat ${TESTDIR1}/
test1_run:
cd ${TESTDIR1}; ${MPIRUN} ./ram_scb.exe | tee runlog
test1_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR1}/output_ram/log_d20130317_t000000.log \
${IMDIR}/output/test1/log.ref \
> test1.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR1}/output_ram/pressure_d20130317_t001500.dat \
${IMDIR}/output/test1/pressure.ref \
>> test1.diff
ncdump -v "Flux_H","B_xyz" \
${TESTDIR1}/output_ram/sat1_d20130317_t000000.nc \
| sed -e '1,/data:/d' > \
${TESTDIR1}/output_ram/sat1.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR1}/output_ram/sat1.test \
${IMDIR}/output/test1/sat1.ref \
>> test1.diff
ncdump -v "Flux_H","B_xyz" \
${TESTDIR1}/output_ram/sat2_d20130317_t000000.nc \
| sed -e '1,/data:/d' > \
${TESTDIR1}/output_ram/sat2.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR1}/output_ram/sat2.test \
${IMDIR}/output/test1/sat2.ref \
>> test1.diff
@echo "Test Successful!"
#TEST 2----------------------------------
test2:
@echo "starting..." > test2.diff
@echo "test2_compile..." >> test2.diff
make test2_compile
@echo "test2_rundir..." >> test2.diff
make test2_rundir PARAMFILE=PARAM.in.test2
@echo "test2_run..." >> test2.diff
make test2_run MPIRUN=
@echo "test2_check..." >> test2.diff
make test2_check
test2_compile:
make
test2_rundir:
rm -rf ${TESTDIR2}
make rundir RUNDIR=${TESTDIR2} STANDALONE="YES"
cp Param/${PARAMFILE}.* ${TESTDIR2}/
cp input/sat*.dat ${TESTDIR2}/
test2_run:
cd ${TESTDIR2}; \
rm PARAM.in; ln -s PARAM.in.test2.1st PARAM.in; \
${MPIRUN} ./ram_scb.exe | tee runlog1; \
rm PARAM.in; ln -s PARAM.in.test2.2nd PARAM.in; \
mv restartOUT/*.nc restartIN/restart.nc; \
mv restartOUT/*.txt restartIN/restart_info.txt; \
${MPIRUN} ./ram_scb.exe | tee runlog2;
test2_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR2}/output_ram/pressure_d20130317_t001500.dat \
${IMDIR}/output/test1/pressure.ref \
> test2.diff
ncrcat ${TESTDIR2}/output_ram/sat1_d20130317_t000000.nc \
${TESTDIR2}/output_ram/sat1_d20130317_t001000.nc \
${TESTDIR2}/output_ram/sat1.nc
ncdump -v "Flux_H","B_xyz" ${TESTDIR2}/output_ram/sat1.nc \
| sed -e '1,/data:/d' > \
${TESTDIR2}/output_ram/sat1.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR2}/output_ram/sat1.test \
${IMDIR}/output/test1/sat1.ref \
>> test2.diff
ncrcat ${TESTDIR2}/output_ram/sat2_d20130317_t000000.nc \
${TESTDIR2}/output_ram/sat2_d20130317_t001000.nc \
${TESTDIR2}/output_ram/sat2.nc
ncdump -v "Flux_H","B_xyz" ${TESTDIR2}/output_ram/sat2.nc \
| sed -e '1,/data:/d' > \
${TESTDIR2}/output_ram/sat2.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR2}/output_ram/sat2.test \
${IMDIR}/output/test1/sat2.ref \
>> test2.diff
@echo "Test Successful!"
#TEST 3----------------------------------
test3:
@echo "starting..." > test3.diff
@echo "test3_compile..." >> test3.diff
make test3_compile
@echo "test3_rundir..." >> test3.diff
make test3_rundir PARAMFILE=PARAM.in.test3
@echo "test3_run..." >> test3.diff
make test3_run MPIRUN=
@echo "test3_check..." >> test3.diff
make test3_check
test3_compile:
make
test3_rundir:
rm -rf ${TESTDIR3}
make rundir RUNDIR=${TESTDIR3} STANDALONE="YES"
cp Param/${PARAMFILE} ${TESTDIR3}/PARAM.in
cp input/sat*.dat ${TESTDIR3}/
test3_run:
cd ${TESTDIR3}; ${MPIRUN} ./ram_scb.exe | tee runlog;
test3_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR3}/output_ram/pressure_d20130317_t001500.dat \
${IMDIR}/output/test3/pressure.ref \
> test3.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR3}/output_scb/hI_output_d20130317_t001500.dat \
${IMDIR}/output/test3/hI.ref \
>> test3.diff
@echo "Test Successful!"
#TEST 4----------------------------------
test4:
@echo "starting..." > test4.diff
@echo "test4_compile..." >> test4.diff
make test4_compile
@echo "test4_rundir..." >> test4.diff
make test4_rundir PARAMFILE=PARAM.in.test4
@echo "test4_run..." >> test4.diff
make test4_run MPIRUN=
@echo "test4_check..." >> test4.diff
make test4_check
test4_compile:
make
test4_rundir:
rm -rf ${TESTDIR4}
make rundir RUNDIR=${TESTDIR4} STANDALONE="YES"
cp Param/${PARAMFILE}.* ${TESTDIR4}/
cp input/sat*.dat ${TESTDIR4}/
test4_run:
cd ${TESTDIR4}; \
rm PARAM.in; ln -s PARAM.in.test4.1st PARAM.in; \
${MPIRUN} ./ram_scb.exe | tee runlog1; \
rm PARAM.in; ln -s PARAM.in.test4.2nd PARAM.in; \
mv restartOUT/*.nc restartIN/restart.nc; \
mv restartOUT/*.txt restartIN/restart_info.txt; \
${MPIRUN} ./ram_scb.exe | tee runlog2;
test4_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR4}/output_ram/pressure_d20130317_t001500.dat \
${IMDIR}/output/test3/pressure.ref \
> test4.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR4}/output_scb/hI_output_d20130317_t001500.dat \
${IMDIR}/output/test3/hI.ref \
>> test4.diff
ncrcat ${TESTDIR4}/output_ram/sat1_d20130317_t000000.nc \
${TESTDIR4}/output_ram/sat1_d20130317_t001000.nc \
${TESTDIR4}/output_ram/sat1.nc
ncdump -v "Flux_H","B_xyz" ${TESTDIR4}/output_ram/sat1.nc \
| sed -e '1,/data:/d' > \
${TESTDIR4}/output_ram/sat1.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR4}/output_ram/sat1.test \
${IMDIR}/output/test3/sat1.ref \
>> test4.diff
ncrcat ${TESTDIR4}/output_ram/sat2_d20130317_t000000.nc \
${TESTDIR4}/output_ram/sat2_d20130317_t001000.nc \
${TESTDIR4}/output_ram/sat2.nc
ncdump -v "Flux_H","B_xyz" ${TESTDIR4}/output_ram/sat2.nc \
| sed -e '1,/data:/d' > \
${TESTDIR4}/output_ram/sat2.test
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIR4}/output_ram/sat2.test \
${IMDIR}/output/test3/sat2.ref \
>> test4.diff
@echo "Test Successful!"
#TEST EMIC----------------------------------
testEMIC:
@echo "starting..." > testEMIC.diff
@echo "testEMIC_compile..." >> testEMIC.diff
make testEMIC_compile
@echo "testEMIC_rundir..." >> testEMIC.diff
make testEMIC_rundir PARAMFILE=PARAM.in.testEMIC
@echo "testEMIC_run..." >> testEMIC.diff
make testEMIC_run MPIRUN=
@echo "testEMIC_check..." >> testEMIC.diff
make testEMIC_check
testEMIC_compile:
make
testEMIC_rundir:
rm -rf ${TESTDIRC}
make rundir RUNDIR=${TESTDIRC} STANDALONE="YES"
cp Param/${PARAMFILE} ${TESTDIRC}/PARAM.in
cp input/sat*.dat ${TESTDIRC}/
testEMIC_run:
cd ${TESTDIRC}; ${MPIRUN} ./ram_scb.exe | tee runlog;
testEMIC_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIRC}/output_ram/log_d20130317_t000000.log \
${IMDIR}/output/testEMIC/log.ref \
> testEMIC.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIRC}/output_ram/pressure_d20130317_t001500.dat \
${IMDIR}/output/testEMIC/pressure.ref \
>> testEMIC.diff
@echo "Test Successful!"
#TEST SCE----------------------------------
testSCE:
@echo "starting..." > testSCE.diff
@echo "testSCE_compile..." >> testSCE.diff
make testSCE_compile
@echo "testSCE_rundir..." >> testSCE.diff
make testSCE_rundir PARAMFILE=PARAM.in.testSCE
@echo "testSCE_run..." >> testSCE.diff
make testSCE_run MPIRUN=
@echo "testSCE_check..." >> testSCE.diff
make testSCE_check
testSCE_compile:
make
testSCE_rundir:
rm -rf ${TESTDIRC}
make rundir RUNDIR=${TESTDIRC} STANDALONE="YES"
cp Param/${PARAMFILE} ${TESTDIRC}/PARAM.in
cp -r input/glow_data ${TESTDIRC}/=
testSCE_run:
cd ${TESTDIRC}; ${MPIRUN} ./ram_scb.exe | tee runlog;
testSCE_check:
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIRC}/output_ram/log_d20130317_t000000.log \
${IMDIR}/output/testSCE/log.ref \
> testSCE.diff
${SCRIPTDIR}/DiffNum.pl -b -a=1e-9 \
${TESTDIRC}/output_ram/pressure_d20130317_t001000.dat \
${IMDIR}/output/testSCE/pressure.ref \
>> testSCE.diff
@echo "Test Successful!"