-
Notifications
You must be signed in to change notification settings - Fork 2
/
runout.diiid
executable file
·440 lines (401 loc) · 10.8 KB
/
runout.diiid
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
#!/bin/ksh
echo "runout V 6.27 : DIV Input =" $1 ": OUT Input =" $2 ": <Optional Grid = $3>"
if [ $# -lt 2 ]
then
echo "usage: $0 <DIV case name> <OUT input file> <Optional - Grid file name> <Optional - Experimental dataffile reference> <Optional - File name extension for output plot PDF>"
echo " Specify \"none\" for any placeholder options. "
exit 1
fi
#
# Set Run-time environment variables
#
#-------------------------------------
#
export CASENAME=$1
export XLFRTEOPTS=namelist=old
export ADASCENT=/fusion/projects/adas/adas
export ZEXT=.gz
#
VER=pgi
#
# If this script is run from the root of the code directory then
# the line assigning PROGDIR will pick up the correct local path - otherwise
# PROGDIR should be set to the local installation directory. The
# default is divimp since the alternate is only really useful when
# working with multiple versions of the code
#
#PROGDIR=`basename \`pwd\``
#
DIVINSTALLDIR=/fusion/projects/codes/oedge
DIVWRITEDIR=/cscratch/$USER
#DIVINSTALLDIR=$HOME
#DIVWRITEDIR=$HOME
#
PROGDIR=divimp
#
#
export EXEROOT=$DIVINSTALLDIR/$PROGDIR
export DATAROOT=$HOME/$PROGDIR
#export DATAROOT=$DIVINSTALLDIR/$PROGDIR
#
export RUNROOT=$DIVWRITEDIR/$PROGDIR
export RESULTSROOT=$DIVWRITEDIR/$PROGDIR
#
#RUNROOT=$DIVINSTALLDIR/$PROGDIR
#EXEROOT=$DIVINSTALLDIR/$PROGDIR
#DATAROOT=$DIVINSTALLDIR/$PROGDIR
#
# 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=$RUNROOT/cases
export DIVDATDIR=$DATAROOT/data
export DIVRESDIR=$RESULTSROOT/results
#
#export DIVRUNDIR=$RUNROOT/cases
#export DIVDATDIR=$RUNROOT/data
#export DIVRESDIR=$RUNROOT/results
#
export DIVMAINDIR=$EXEROOT
export DIVEXEDIR=$EXEROOT/div6
export OUTEXEDIR=$EXEROOT/out6
export PINEXEDIR=$EXEROOT/pin6
export EIREXEDIR=$EXEROOT/eirene
export EIREXE99DIR=$EXEROOT/eirene99
export EQUDIR=$DATAROOT/shots
#
export DIVEXE=$DIVEXEDIR/div6O$VER
export OUTEXE=$OUTEXEDIR/out6O$VER
export PINEXE=$PINEXEDIR/pin6O
export EIREXE=$EIREXEDIR/eirene
export EIREXE99=$EIREXE99DIR/Sources/eirene
#
# jdemod - the following variables are relevant to some of the
# EIRENE07 run scripts - these should not be needed in OUT
# but there may be related code or scripts that use them
#
# add eirene07 directory
export EIRDIR=$EXEROOT/eirene07
#
#
# Setup DIVHOME for the Eirene07 run script
# - this is also needed for data loading code in DIVIMP so it can
# find the data directories
# - NOTE: when Steve's run scripts are updated to allow different
# users to access common code then the code in hc_lddta.f90 will
# need to be changed to access the EXEROOT and not RUNROOT ... however
# at the present time DIVHOME is the only environment variable with
# a common meaning between these scripts and Steve's versions
# - this is needed in OUT to load HC data for plotting
#
export DIVHOME=$RUNROOT
# Location of graphics library used by EIRENE:
# export GLI_HOME=$DIVHOME/libsrc
export GLI_HOME=$EXEROOT/libsrc
# Set local directories:
export RUNDIR=$RUNROOT
export BATDIR=$EXEROOT/scripts
export EXEDIR=$DIVRUNDIR/$CASENAME
export DATDIR=$DIVDATDIR
export OUTDIR=$OUTEXEDIR
#
#--------------------------------------------------------------
# May need to add to LD_LIBRARY_PATH to find linked libraries
#
#
#export LD_LIBRARY_PATH=
#export LD_LIBRARY_PATH=$DIVINSTALLDIR/$PROGDIR/local/lib:/usr/local/lib
#echo "LIBRARY PATH:" $LD_LIBRARY_PATH
#
#-------------------------------------
#
# Additional Setup
#
# Set plot file name extension
#
if [[ -n $5 ]] then
export PLOTEXT=-$5
else
export PLOTEXT=-a
fi
#
#-------------------------------------
#
# Execute the code
#
#-------------------------------------
#
# Change to Execution directory
#
cd $DIVRUNDIR
#
# Remove specific directory for the case if it already exists
#
if [[ -e $CASENAME ]] then
echo "Deleting old case directory:" $DIVRUNDIR/$CASENAME
rm -rf $CASENAME
fi
#
# Create run directory
#
mkdir $CASENAME
cd $CASENAME
#
# Execute OUT
#
# Unit 4 is the equilibrium input file
# Unit 8 is the binary output file from DIVIMP
# Unit 9 is an echo of the input to OUT
# Unit 13 is the xy grid
# Unit 26 is a print file containing the data from all plots
# Unit 49 is a summary of all plots
#
# Copy and gunzip the results of the DIVIMP run
#
cp $DIVRESDIR/$CASENAME.raw$ZEXT $DIVRUNDIR/$CASENAME/$CASENAME.raw$ZEXT
gunzip -f -v $CASENAME.raw$ZEXT
mv $CASENAME.raw fort.8
#
# Supplementary raw files (SL)
# Some consolidation of these files needs to
# take place, but it has not been done yet (Sep 6, 2000)
#
if [[ -f $DIVRESDIR/$CASENAME.raw.src$ZEXT ]] then
cp $DIVRESDIR/$CASENAME.raw.src$ZEXT $DIVRUNDIR/$CASENAME
gunzip -f -v $CASENAME.raw.src$ZEXT
mv $CASENAME.raw.src source.dat
fi
if [[ -f $DIVRESDIR/$CASENAME.raw.pla$ZEXT ]] then
cp $DIVRESDIR/$CASENAME.raw.pla$ZEXT $DIVRUNDIR/$CASENAME
gunzip -f -v $CASENAME.raw.pla
mv $CASENAME.raw.pla plasma.dat
fi
if [[ -f $DIVRESDIR/$CASENAME.raw.geo$ZEXT ]] then
cp $DIVRESDIR/$CASENAME.raw.geo$ZEXT $DIVRUNDIR/$CASENAME
gunzip -f -v $CASENAME.raw.geo
mv $CASENAME.raw.geo geomty.dat
fi
if [[ -f $DIVRESDIR/$CASENAME.eirtrc ]] then
cp $DIVRESDIR/$CASENAME.eirtrc eirtrac.dat
fi
if [[ -f $DIVRESDIR/$CASENAME.raw.tri ]] then
cp $DIVRESDIR/$CASENAME.raw.tri triangles.raw
fi
if [[ -f $DIVRESDIR/$CASENAME.eir2 ]] then
cp $DIVRESDIR/$CASENAME.eir2 eirene.transfer
fi
#
# Info file for output
#
if [[ -f $EQUDIR/info.dat ]] then
ln -s $EQUDIR/info.dat $DIVRUNDIR/$CASENAME/info.dat
fi
#
# Link to EIRENE AMJUEL data files (SL)
#
#ln -s "$EIREXE99DIR/a+m/HYDHEL" .
#ln -s "$EIREXE99DIR/a+m/SPUTER" .
#ln -s "$EIREXE99DIR/a+m/AMJUEL.TEX" AMJUEL
#ln -s "$EIREXE99DIR/a+m/METHANE" .
#
# Eirene07 uses the data files from the Eirene04 tree. However, all versions of Eirene except 07 are not supported. At some point we
# should clean this up.
#
# Try this for now - may need to flag this file for differetiating 99 from 07 - or move the linkage to the EIRENE run scripts assuming divimp doesn't use them
#
ln -sf $EIRDIR/Eirene_04/Database/Surfacedata/SPUTER SPUTER
ln -sf $EIRDIR/Eirene_04/Database/AMdata/amjuel.tex AMJUEL
ln -sf $EIRDIR/Eirene_04/Database/AMdata/hydhel.tex HYDHEL
ln -sf $EIRDIR/Eirene_04/Database/AMdata/h2vibr.tex H2VIBR
ln -sf $EIRDIR/Eirene_04/Database/AMdata/methane.tex METHANE
ln -sf $EIRDIR/Eirene_04/Database/Surfacedata/TRIM
#
# Connect an experimental data input file to unit 13.
# If one has been specified.
#
# 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/$CASENAME/fort.13
else
if [[ -f $EQUDIR/$3.$4.experiment ]] then
ln -s $EQUDIR/$3.$4.experiment $DIVRUNDIR/$CASENAME/fort.13
else
if [[ -f $EQUDIR/$3.experiment ]] then
ln -s $EQUDIR/$3.experiment $DIVRUNDIR/$CASENAME/fort.13
fi
fi
fi
else
if [[ -f $EQUDIR/$3.experiment ]] then
ln -s $EQUDIR/$3.experiment $DIVRUNDIR/$CASENAME/fort.13
fi
fi
#
# Link to the toroidal camera inversion data (SL)
#
if [[ -f $EQUDIR/$3.camera ]] then
ln -s $EQUDIR/$3.camera $DIVRUNDIR/$CASENAME/camera.dat
fi
#
#if [[ -n $3 ]] then
# if [[ -f $EQUDIR/$3.experiment ]] then
# ln -s $EQUDIR/$3.experiment $DIVRUNDIR/$CASENAME/fort.13
# fi
#fi
#
#
# Execute OUT
#
$OUTEXE < $DIVDATDIR/$2.d6o > outouta
#
# Copy or move results.
#
# .outa - OUT debugging file
mvc outouta $CASENAME.outa
#
# Rename the netcdf output if any
# this is here in case netcdf is used in future for plot output
#
if [[ -f out_netcdf_out.nc ]] then
# save the compressed version of the nc file
# according to the documentation this file can be accessed as
# easily as a regular nc file but takes much less space
nccopy -d5 out_netcdf_out.nc out_netcdf_out_compress.nc
mvc out_netcdf_out_compress.nc $CASENAME_out.nc
fi
# Postscript plots
# Change to using $plotext .psg and .pdf so that
# the files will not necessarily overwrite
#
if [[ -f POSTSCPT.LIS ]] then
ps2pdf POSTSCPT.LIS $CASENAME$PLOTEXT.pdf
mv POSTSCPT.LIS $CASENAME$PLOTEXT.psg
fi
# .daga OUT output file
mvc fort.7 $CASENAME.daga
# Echo of input
mvc fort.9 $CASENAME.inga
# Special print file
mvc fort.26 $CASENAME.grpa
# Special print file
mvc fort.49 $CASENAME.plta
# Print out for Kevin Erents
mvc fort.56 $CASENAME.probe
# Move the signal file to results if one exists
mvc signal_output.dat $CASENAME$PLOTEXT.signals
# Erosion/Deposition print out
mvc impurity_wall_deposition.dat $CASENAME.deposition
# Upstream impurity profiles print out
mvc upstream_impurity_profiles.dat $CASENAME.up_imp_prof
# Upstream impurity profiles print out
mvc sol_impurity_profiles.dat $CASENAME.sol_imp_prof
# AUG file
mvc fort.59 $CASENAME.augdiv_out
# Core file in case OUT crashed
mvc core $CASENAME.out.core
# eirene ionization analysis
mvc eirene_iz_analysis.dat $CASENAME.eiz
# exb source terms over grid
mvc exb_source_terms.dat $CASENAME.exb
# collector probe analysis
mvc collector_probe.out $CASENAME.collector_probe
#---------------------------------------
#
# Move any files starting with $CASENAME
# to the results directory
#
mv -f $CASENAME* $DIVRESDIR
#---------------------------------------
#
# Clean-up
#
# remove unwanted fortran output
rm fort.*
# remove other raw files that may have been linked
rm -f plasma.dat
rm -f geomty.dat
rm -f source.dat
#
# 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
#
# Remove eirtrac.dat if linked
#
if [[ -f eirtrac.dat ]] then
rm -f eirtrac.dat
fi
#
# Unlink the EIRENE files
#
if [[ -f HYDHEL ]] then
rm -f HYDHEL
fi
#
if [[ -f SPUTER ]] then
rm -f SPUTER
fi
#
if [[ -f AMJUEL ]] then
rm -f AMJUEL
fi
#
if [[ -f METHANE ]] then
rm -f METHANE
fi
#
if [[ -e TRIM ]] then
rm -f TRIM
fi
#
if [[ -f H2VIBR ]] then
rm -f H2VIBR
fi
#
# Final cleanup
#
cd $DIVRUNDIR
rmdir $CASENAME
cd $DIVRESDIR
#
# Gzip and generate any remaining print files
#
#gzip $CASENAME.outa
#if [[ -f $CASENAME.plta ]] then
# a2ps -R $CASENAME.plta --output=$CASENAME.plta.ps
#fi
#
# Print
#
#lp $CASENAME.plt.ps
#lp $CASENAME.psga
#
# Return to starting directory.
#
cd $DIVRUNDIR