-
Notifications
You must be signed in to change notification settings - Fork 2
/
rundiv.aug
618 lines (613 loc) · 13.3 KB
/
rundiv.aug
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
#!/bin/ksh
echo rundiv V 6.27 : DIV Input = $1 : OUT Input = $2 : Grid = $3 : BG Data = $4 : CFD Data = $5 : DIV Data = $6
if [ $# -lt 3 ]
then
echo "usage: $0 <DIV input file> <OUT input file> <geometry file name> <fluid plasma filename extention - optional> <CFD solution - optional> <DIVIMP solution - optional>"
echo "Use the word none as the argument for uneeded options"
exit 1
fi
#
# Set Run-time environment variables
#
# These should be all that require changing for most installations
#
#-------------------------------------
#
export CASENAME=$1
export XLFRTEOPTS=namelist=old
export ADASCENT=/afs/ipp/home/a/adas/adas
#
VER=sun
RUNROOT=$HOME/divimp
EXEROOT=$HOME/divimp
DATAROOT=$HOME/divimp
#
# Loctions of the various DIVIMP files
#
# DIVRUNDIR - Directory where DIVIMP will run - must have read/write access
# DIVDATDIR - Directory containing the input data files
# DIVRESDIR - Directory where the results from the case will be stored
#
# DIVMAINDIR- Main DIVIMP directory containing the source code tree
# DIVEXEDIR - Directory containing the DIVIMP executable
# DIVOUTDIR - Directory containing the OUT excutable
# PINEXEDIR - Directory containing the PIN executable
# EIREXEDIR - Directory containing the EIRENE executable
#
# EQUDIR - Directory containg the equilibrium, background plasma and pump files
#
# DIVEXE - DIVIMP executable
# OUTEXE - OUT executable
# PINEXE - PIN executable
# EIREXE - EIRENE executable
#
export DIVRUNDIR=/tmp
export DIVDATDIR=$RUNROOT/data
export DIVRESDIR=$RUNROOT/results
#
export DIVMAINDIR=$EXEROOT
export DIVEXEDIR=$EXEROOT/bin/@sys
export OUTEXEDIR=$EXEROOT/bin/@sys
export PINEXEDIR=$EXEROOT/pin6
export PIN5EXEDIR=$EXEROOT/pin5
export EIREXEDIR=$EXEROOT/eirene
export EIREXE99DIR=$EXEROOT/bin/@sys
export EQUDIR=$DATAROOT/shots
#
export DIVEXE=$DIVEXEDIR/div6O$VER
export OUTEXE=$OUTEXEDIR/out6O$VER
export PINEXE=$PINEXEDIR/pin6O
export PIN5EXE=$PIN5EXEDIR/pin5O
export EIREXE=$EIREXEDIR/Sources/eirene
export EIREXE99=$EIREXE99DIR/eirene
#
#-------------------------------------
#
#
# Change to execution directory
#
cd $DIVRUNDIR
mkdir $1
cd $1
#
# Link in the EIRENE databases
#
#
ln -s $EIREXE99DIR/a+m/HYDHEL HYDHEL
ln -s $EIREXE99DIR/a+m/SPUTER SPUTER
ln -s $EIREXE99DIR/a+m/AMJUEL.TEX AMJUEL
ln -s $EIREXE99DIR/a+m/METHANE METHANE
#
# Unit 4 is the equilibrium input file
# Unit 13 is the xy grid file (if available)
# Unit 14 is the DIVIMP input file - assigned to unit 14 for NIMBUS purposes
# - now connected in the runpin script
#
if [[ -f $EQUDIR/$3 ]] then
ln -s $EQUDIR/$3 $DIVRUNDIR/$1/fort.4
else
echo "Grid file " $EQUDIR/$3 " does not exist."
echo "Abnormal Script Termination - Script Exiting"
cd ..
rm -rf $1
exit 1
fi
#
# Info file for Eirene option related print outs
#
if [[ -f $EQUDIR/info.dat ]] then
ln -s $EQUDIR/info.dat $DIVRUNDIR/$1/info.dat
fi
#
# JET hybrid wall data file
#
if [[ -f $EQUDIR/hybrid.dat ]] then
ln -s $EQUDIR/hybrid.dat $DIVRUNDIR/$1/fort.28
#else
# echo "JET hybrid wall data file not found."
fi
#
# CFD OSM files
#
if [[ -f $DIVRESDIR/$5.cfd.gz ]] then
gunzip $DIVRESDIR/$5.cfd.gz
fi
#
if [[ -f $DIVRESDIR/$5.cfd ]] then
echo "Linking ..." $DIVRESDIR/$5.cfd
ln -s $DIVRESDIR/$5.cfd $DIVRUNDIR/$1/fort.74
fi
#
# Other files that are not usually used.
#
# cp $EQUDIR/$3.grd $DIVRUNDIR/$1/fort.13
# cp $EQUDIR/$3.dat $DIVRUNDIR/$1/fort.12
# cp $EQUDIR/$3.prn $DIVRUNDIR/$1/fort.10
#
# divimp_plasma.dat is a background plasma solution - if required.
#
if [[ -f $DIVRESDIR/$6.bgp ]] then
echo "Linking ..." $DIVRESDIR/$6.bgp
ln -s $DIVRESDIR/$6.bgp $DIVRUNDIR/$1/divimp_plasma.dat
fi
#
# divimp_aux_data.dat contains various data from a previous DIVIMP run
#
if [[ -f $DIVRESDIR/$6.auxdata ]] then
echo "Linking ..." $DIVRESDIR/$6.auxdata
ln -s $DIVRESDIR/$6.auxdata $DIVRUNDIR/$1/divimp_aux_data.dat
fi
#
# A fluid plasma solution is linked to fort.11 - if one is available.
#
if [[ -n $4 ]] then
if [[ -f $EQUDIR/$4 ]] then
ln -s $EQUDIR/$4 $DIVRUNDIR/$1/fort.11
else
if [[ -f $EQUDIR/$3.$4 ]] then
ln -s $EQUDIR/$3.$4 $DIVRUNDIR/$1/fort.11
else
if [[ -f $EQUDIR/$3.g80 ]] then
ln -s $EQUDIR/$3.g80 $DIVRUNDIR/$1/fort.11
fi
fi
fi
else
if [[ -f $EQUDIR/$3.g80 ]] then
ln -s $EQUDIR/$3.g80 $DIVRUNDIR/$1/fort.11
fi
fi
#
# Unit 12 is an auxiliary file for the background plasma solution - if required.
#
if [[ -n $4 ]] then
if [[ -f $EQUDIR/$4.aux ]] then
ln -s $EQUDIR/$4.aux $DIVRUNDIR/$1/fort.11
else
if [[ -f $EQUDIR/$3.$4.aux ]] then
ln -s $EQUDIR/$3.$4.aux $DIVRUNDIR/$1/fort.12
else
if [[ -f $EQUDIR/$3.aux ]] then
ln -s $EQUDIR/$3.aux $DIVRUNDIR/$1/fort.12
fi
fi
fi
else
if [[ -f $EQUDIR/$3.aux ]] then
ln -s $EQUDIR/$3.aux $DIVRUNDIR/$1/fort.12
fi
fi
#
# Unit 13 contains experimental data for the case - if available.
#
if [[ -n $4 ]] then
if [[ -f $EQUDIR/$4.experiment ]] then
ln -s $EQUDIR/$4.experiment $DIVRUNDIR/$1/fort.11
else
if [[ -f $EQUDIR/$3.$4.experiment ]] then
ln -s $EQUDIR/$3.$4.experiment $DIVRUNDIR/$1/fort.13
else
if [[ -f $EQUDIR/$3.experiment ]] then
ln -s $EQUDIR/$3.experiment $DIVRUNDIR/$1/fort.13
fi
fi
fi
else
if [[ -f $EQUDIR/$3.experiment ]] then
ln -s $EQUDIR/$3.experiment $DIVRUNDIR/$1/fort.13
fi
fi
#
# If an external flux file is available for the shot it will
# be linked to the "ext_flux.dat" file.
#
#
if [[ -n $4 ]] then
if [[ -f $EQUDIR/$4.extflx ]] then
ln -s $EQUDIR/$4.extflx $DIVRUNDIR/$1/ext_flux.dat
else
if [[ -f $EQUDIR/$3.$4.extflx ]] then
ln -s $EQUDIR/$3.$4.extflx $DIVRUNDIR/$1/ext_flux.dat
else
if [[ -f $EQUDIR/$3.extflx ]] then
ln -s $EQUDIR/$3.extflx $DIVRUNDIR/$1/ext_flux.dat
fi
fi
fi
else
if [[ -f $EQUDIR/$3.extflx ]] then
ln -s $EQUDIR/$3.extflx $DIVRUNDIR/$1/ext_flux.dat
fi
fi
#
# Link to the toroidal camera inversion data (SL)
#
if [[ -f $EQUDIR/$3.camera ]] then
ln -s $EQUDIR/$3.camera $DIVRUNDIR/$1/camera.dat
fi
#
# These are the scripts that will run the apprpriate hydrogenic
# neutral code depending on the type of grid. PIN/NIMBUS or EIRENE.
#
#
cp $DIVMAINDIR/runpin rpindiv
#cp $DIVMAINDIR/runpin5 rpindiv5
#cp $DIVMAINDIR/runeire reirediv
cp $DIVMAINDIR/runeire99 reire99
#
# Execute DIVIMP
#
# Unit 7 is the text output from DIVIMP
# Unit 9 is an echo of the DIVIMP input
# Unit 17 is the passing file from DIVIMP to PIN
# Unit 19 is the temporary file used to record PIN iteration information
# Unit 21 is the print file from the CALCSOL option
# Unit 22 is the HTML version of the .dat file
# Unit 23 is a temporary file used to store HTML as the code runs
# Unit 25 is a diagnostic print file of grid information
# Unit 26 is used by OUT to print the numerics for plots
# Unit 27 is another grid print file
# Unit 41 is the TRAN file output for JET post-processors
# Unit 50 is a diagnostic file from the Theta routines and Steve's code
# Unit 88 is a SOL22 (and other stuff) diagnostic file
#
# Link DIVIMP input data file - so name can be extracted.
#
if [[ -f $DIVDATDIR/$1.d6i ]] then
ln -s $DIVDATDIR/$1.d6i fort.5
else
echo "DIVIMP Input file " $DIVDATDIR/$1.d6i " does not exist."
echo "Abnormal Script Termination - Script Exiting"
cd ..
rm -rf $1
exit 1
fi
#
# Copy EIRENE input file template:
#
if [[ -f $EIREXE99DIR/$1.dat ]] then
ln -s $EIREXE99DIR/$1.dat $DIVRUNDIR/$1/fort.80
else
ln -s $EIREXE99DIR/eirene99.dat $DIVRUNDIR/$1/fort.80
fi
#
# Run DIVIMP - Use optimized version.
#
echo Starting DIVIMP ...
#
$DIVEXE < fort.5 > divout1
#
echo DIVIMP Finished.
#
if [[ -n $PINCASE ]] then
echo "PIN/NIMBUS case: " $PINCASE
fi
#
# Save SOL22 plot file
#
if [[ -f POSTSCPT.LIS ]] then
mv POSTSCPT.LIS $DIVRESDIR/$1.sol22.ps
fi
#
# Copy or move results.
# .lim Debugging file
#
if [[ -f divout1 ]] then
mv divout1 $DIVRESDIR/$1.lim
fi
#
# .dat case output file
#
if [[ -f fort.7 ]] then
mv fort.7 $DIVRESDIR/$1.dat
fi
#
# .html case output file
#
if [[ -f fort.22 ]] then
mv fort.22 $DIVRESDIR/$1.html
fi
#
# .inp input echo file + other information
#
if [[ -f fort.9 ]] then
mv fort.9 $DIVRESDIR/$1.inp
fi
#
# PIN input plasma file
#
if [[ -f fort.17 ]] then
mv fort.17 $DIVRESDIR/$1.pin
fi
#
# Additional information from SOL option 22.
#
if [[ -f fort.21 ]] then
mv fort.21 $DIVRESDIR/$1.sol22
fi
#
# Print-out from PIN
#
if [[ -f fort.24 ]] then
mv fort.24 $DIVRESDIR/$1.pinprn
fi
#
# TRAN file for JET postprocessors
#
if [[ -f fort.41 ]] then
mv fort.41 $DIVRESDIR/$1.tran
fi
#
# Diagnostic information from THETA module (among others)
#
if [[ -f fort.50 ]] then
mv fort.50 $DIVRESDIR/$1.theta
fi
#
# Print out for Kevin
#
if [[ -f fort.56 ]] then
mv fort.56 $DIVRESDIR/$1.probe
fi
#
# Additional information from SOL option 23.
#
if [[ -f fort.71 ]] then
mv fort.71 $DIVRESDIR/$1.sol23
fi
#
# Excel print information from sol23
#
if [[ -f fort.73 ]] then
mv fort.73 $DIVRESDIR/$1.exl23
fi
#
# CFD solution file
#
if [[ -f fort.75 ]] then
mv fort.75 $DIVRESDIR/$1.cfd
fi
#
# Diagnostic files (SL)
#
if [[ -f fort.88 ]] then
mv fort.88 $DIVRESDIR/$1.src
fi
#
if [[ -f fort.87 ]] then
mv fort.87 $DIVRESDIR/$1.g3
fi
#
# DIVIMP format background plasma file - if writing one
# has been requested.
#
if [[ -f divimp_plasma.out ]] then
mv divimp_plasma.out $DIVRESDIR/$1.bgp
fi
#
# Additional DIVIMP data file - output in a standardized tagged format.
#
if [[ -f divimp_aux_data.out ]] then
mv divimp_aux_data.out $DIVRESDIR/$1.auxdata
fi
#
# Core file in case DIVIMP crashed
#
if [[ -f core ]] then
mv core $DIVRESDIR/$1.core
fi
#
# mv fort.25 $DIVRESDIR/$1.lst.grd
# mv fort.27 $DIVRESDIR/$1.cell.grd
#
# Convert the DIVIMP output data file to postscript.
#
a2ps $DIVRESDIR/$1.dat --output=$DIVRESDIR/$1.ps
#
# a2ps -nn $DIVRESDIR/$1.sol > $DIVRESDIR/$1.sol.ps
# mv POSTSCPT.LIS $DIVRESDIR/$1.sol.psg
#
# Execute OUT
#
echo Starting OUTput processing ...
#
$OUTEXE < $DIVDATDIR/$2.d6o > outout1
#
echo OUTput processing complete.
#
# Copy or move results of OUT run.
#
# .out - OUT debugging file
#
if [[ -f outout1 ]] then
mv outout1 $DIVRESDIR/$1.out
fi
# .raw complete results file
#
if [[ -f fort.8 ]] then
mv fort.8 $DIVRESDIR/$1.raw
fi
#
# AUG file
#
if [[ -f fort.59 ]] then
mv fort.59 $DIVRESDIR/$1.AUGdiv
fi
#
# Supplimentary .raw files (SL)
#
if [[ -f fort.89 ]] then
mv fort.89 $DIVRESDIR/$1.raw.src
fi
if [[ -f fort.94 ]] then
mv fort.94 $DIVRESDIR/$1.raw.pla
fi
if [[ -f fort.95 ]] then
mv fort.95 $DIVRESDIR/$1.raw.geo
fi
if [[ -f fort.79 ]] then
mv fort.79 $DIVRESDIR/$1.raw.rel
fi
#
# .dag OUT output file
#
if [[ -f fort.7 ]] then
mv fort.7 $DIVRESDIR/$1.dag
fi
#
# .psg - Postscript plots
#
if [[ -f POSTSCPT.LIS ]] then
ps2pdf POSTSCPT.LIS $DIVRESDIR/$1.pdf
mv POSTSCPT.LIS $DIVRESDIR/$1.psg
fi
#
# .ing - Echo of input to graphing routines
#
if [[ -f fort.9 ]] then
mv fort.9 $DIVRESDIR/$1.ing
fi
#
# Special printed listing of some plot information.
#
if [[ -f fort.26 ]] then
mv fort.26 $DIVRESDIR/$1.grp
fi
#
# Special printed listing of some plot information.
#
if [[ -f fort.49 ]] then
mv fort.49 $DIVRESDIR/$1.plt
fi
#
# EIRENE related output:
#
if [[ -f fort.81 ]] then
mv fort.81 $DIVRESDIR/$1.eirdat
fi
if [[ -f eirtrac.dat ]] then
mv eirtrac.dat $DIVRESDIR/$1.eirtrc
fi
#if [[ -f fort.80 ]] then
# mv fort.80 $DIVRESDIR/$1.eirtmp
#fi
if [[ -f fort.52 ]] then
mv fort.52 $DIVRESDIR/$1.eirgeo
fi
if [[ -f fort.50 ]] then
mv fort.50 $DIVRESDIR/$1.debug
fi
if [[ -f fort.85 ]] then
mv fort.85 $DIVRESDIR/$1.g1
fi
if [[ -f addsur.dat ]] then
mv addsur.dat $DIVRESDIR/$1.eirsur
fi
#
# Move image files if any ...
#
if [[ -f $1_image01.jpg ]] then
mv *image*.jpg $DIVRESDIR
fi
#
# cp fort.13 $EQUDIR/$3.grd
# a2ps -nn -p $DIVRESDIR/$1.plt > $DIVRESDIR/$1.plt.ps
#
#
# Clean-up
#
rm *.dat
rm fort.*
rm -f rpindiv
rm -f rpindiv5
rm -f reirediv
rm -f reire99
#
rm -f HYDHEL
rm -f SPUTER
rm -f AMJUEL
rm -f METHANE
#
# Remove camera file if linked
#
if [[ -f camera.dat ]] then
rm -f camera.dat
fi
#
# Remove info.dat file if linked
#
if [[ -f info.dat ]] then
rm -f info.dat
fi
#
cd $DIVRUNDIR
rmdir $1
cd $DIVRESDIR
#
# Compress the larger output files - check for file existence
# before compressing.
#
if [[ -f $1.raw ]] then
compress -f -v $1.raw
fi
# (SL)
if [[ -f $1.raw.src ]] then
compress -f -v $1.raw.src
fi
if [[ -f $1.raw.pla ]] then
compress -f -v $1.raw.pla
fi
if [[ -f $1.raw.geo ]] then
compress -f -v $1.raw.geo
fi
if [[ -f $1.raw.rel ]] then
compress -f -v $1.raw.rel
fi
#
if [[ -f $1.lim ]] then
compress -f -v $1.lim
fi
#
if [[ -f $1.sol22 ]] then
compress -f -v $1.sol22
fi
#
if [[ -f $1.sol22 ]] then
compress -f -v $1.sol23
fi
#
#if [[ -f $1.sol22 ]] then
# compress -f -v $1.sol22
#fi
#
if [[ -f $1.out ]] then
compress -f -v $1.out
fi
#
if [[ -f $1.pinout ]] then
compress -f -v $1.pinout
fi
#
if [[ -f $1.pinraw ]] then
compress -f -v $1.pinraw
fi
#
if [[ -f $1.pinnim ]] then
compress -f -v $1.pinnim
fi
#
if [[ -f $1.pinmc ]] then
compress -f -v $1.pinmc
fi
#
# Print
#
# lp $1.ps
# lp $1.sol.ps
# lp $1.plt.ps
# lp $1.psg
# lp $1.sol.ps
#
# Return to base directory.
#
cd $DIVRUNDIR