forked from Nek5000-deprecated/Nek5000-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakenek.inc
694 lines (636 loc) · 17.9 KB
/
makenek.inc
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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# This include file is used by the makenek script
# to automatically create a makefile for Nek5000
# (c) 2008,2009,2010 UCHICAGO ARGONNE, LLC
# ------------------------------------------------
echo "makenek - automatic build tool for Nek5000"
if [ "$PPLIST" == "?" ]; then
echo "available pre-processor symbols:"
echo " NOTIMER disable runtime statistics"
echo " MPITIMER enable MPI runtime statistics"
echo " MPIIO use MPI-IO I/O kernel (experimental)"
echo " BG enable Blue Gene optimizations (BG/L and BG/P)"
echo " K10_MXM use optimized MxM kernel for AMD Family 10h processors"
echo " CVODE use ODE solver from Sundials to solve for IFIELD>1 (experimental)"
echo " MOAB enable MOAB/CUBIT support (experimental)"
echo " NEKNEK enable multidomain support (experimental)"
echo " NO_LAPACK disable nek-supplied LAPACK routines"
echo " BLAS_MXM disable nek-supplied BLAS routines"
echo " EXTBAR adds underscore to exit call(for BGQ)"
exit 1
fi
# first do some checks ...
if [ $# -eq 0 ]; then
echo ""
echo "usage: makenek [.usr filename | clean] < -nocompile >"
echo ""
exit 1
fi
if [ "$mver" == "" ]; then
echo "ERROR: Your makenek is too old!"
echo "Please upgrade to last version shipped with the Nek source."
exit 1
else
if [ $mver -lt 1 ]; then
echo "ERROR: Your makenek is too old!"
echo "Please upgrade to last version shipped with the Nek source."
exit 1
fi
fi
if [ $1 = "clean" ]; then
make clean
exit 0
fi
NOCOMPILE=0
if [ "$2" == "-nocompile" ]; then
NOCOMPILE=1
fi
CASENAME=$1
CASEDIR=`pwd`
APATH_SRC=`cd $SOURCE_ROOT; pwd`
SOURCE_ROOT=$APATH_SRC
APATH_SRC=`cd $SOURCE_ROOT2; pwd`
SOURCE_ROOT_CMT=$APATH_SRC
echo "CMT root" $SOURCE_ROOT_CMT
IFMOAB=false
IFNEKNEK=false
# do some basic checks
if [ "$CASEDIR" == "$SOURCE_ROOT" ]; then
echo "FATAL ERROR: Working directory has to be different from the source!"
exit 1
fi
if [ ! -f ${CASENAME}'.usr' ]; then
echo "FATAL ERROR: Cannot find $1.usr!"
exit 1
fi
if [ -f SIZEu ]; then
if [ -f SIZE ]; then
echo "FATAL ERROR: found SIZEu and SIZE!"
exit 1
fi
NEK_WARN="WARNING: SIZEu will be deprecated in a future release. Please rename to SIZE!"
export NEK_WARN
mv -v SIZEu SIZE
fi
if [ ! -f SIZE ]; then
echo "FATAL ERROR: Cannot find SIZE!"
exit 1
fi
if [ ! -f $SOURCE_ROOT/makefile.template ]; then
echo "FATAL ERROR: Cannot find $SOURCE_ROOT/makefile.template!"
exit 1
fi
# test F77 compiler
which `echo $F77 | awk '{print $1}'` 1>/dev/null
if [ $? -ne 0 ]; then
echo "FATAL ERROR: Cannot find $F77!"
exit 1
fi
\rm test_f77.o 2>/dev/null
# basic compiler test
cat > test_f77.f << _ACEOF
subroutine test
end
_ACEOF
$F77 -c test_f77.f >/dev/null
if [ ! -f test_f77.o ]; then
echo "FATAL ERROR: Basic compiler test for $F77 failed!"
exit 1
fi
\rm test_f77.* 2>/dev/null
# test C compiler
which `echo $CC | awk '{print $1}'` 1>/dev/null
if [ $? -ne 0 ]; then
echo "FATAL ERROR: Cannot find $CC!"
exit 1
fi
\rm test_cc.o 2>/dev/null
cat > test_cc.c << _ACEOF
void function(){}
_ACEOF
$CC -c test_cc.c 1>/dev/null
if [ ! -f test_cc.o ]; then
echo "FATAL ERROR: Basic compiler test for $CC failed!"
exit 1
fi
\rm test_cc.* 2>/dev/null
# initial clean-up
rm -f nek5000 2>/dev/null
rm -f ./obj/subuser.o 2>/dev/null
# Check ptr size
cat > tmp.c << _ACEOF
#include <stdlib.h>
#include <stdio.h>
int main()
{
int *p;printf("%li\n",sizeof(p));
}
_ACEOF
$CC tmp.c 2>&1>/dev/null
ptrSize=`./a.out`
rm tmp.c a.out
if [ "$ptrSize" == "8" ]
then
PPLIST="${PPLIST} PTRSIZE8"
fi
# Check if the compiler adds an underscore to external functions
UNDERSCORE=false
cat > test_underscore.f << _ACEOF
subroutine underscore_test
call byte_rewind
end
_ACEOF
$F77 -c test_underscore.f 2>&1 >/dev/null
nm test_underscore.o | grep byte_rewind_ 1>/dev/null
if [ $? -eq 0 ]
then
UNDERSCORE=true
fi
\rm test_underscore.* 2>/dev/null
F77comp=$F77
# mpi-wrappers?
echo $F77comp | grep -i mp >/dev/null
if [ $? -eq 0 ]; then
# trying to figure out which compiler we're using
F77ok=0
F77comp_=`$F77 -showme 2>/dev/null 1>.tmp`
F77comp=`cat .tmp | awk '{print $1}' | awk -F/ '{print $NF}'`
if [ -f "`which $F77comp 2>/dev/null`" ]; then
F77ok=1
else
F77comp_=`$F77 -show 2>/dev/null 1>.tmp`
F77comp=`cat .tmp | awk '{print $1}' | awk -F/ '{print $NF}'`
if [ -f "`which $F77comp 2>/dev/null`" ]; then
F77ok=1
fi
fi
else
F77comp=`echo $F77 | awk '{print $1}'`
if [ -f "`which $F77comp 2>/dev/null`" ]; then
F77ok=1
fi
fi
\rm -f .tmp
if [ $F77ok -eq 0 ]; then
F77comp="unknown"
fi
# assign F77 compiler specific flags
case $F77comp in
*pgf*) P="-r8 -Mpreprocess"
;;
*gfortran*) P="-fdefault-real-8 -fdefault-double-8 -x f77-cpp-input"
;;
*ifort*) P="-r8 -fpconstant -fpp"
;;
*pathf*) P="-r8 -cpp -fno-second-underscore"
;;
*xlf*) P="-qrealsize=8 -qdpc=e -qsuffix=cpp=f"
PPPO="-WF,"
F77="${F77} -qsuppress=cmpmsg"
;;
*ftn*) P="-r8 -Mpreprocess"
;;
*sunf*) P="-r8const -xtypemap=real:64 -fpp"
;;
*open*) P="-r8 -cpp -fno-second-underscore"
;;
*) echo "ERROR: Unable to detect compiler!"
echo " - don't know how to promote datatype REAL to 8 bytes"
echo " - don't know how to invoke the C pre-processor (CPP) before compilation"
echo " Please edit the makefile and specify the requested compiler flags using the P variable."
echo ""
P="<specify your compiler flags here>"
NOCOMPILE=1
read;;
esac
export PPPO
# set preprocessor symbols
if [ "$IFMPI" == "false" -o "$IFMPI" == "no" ]; then
IFMPI=false
else
# default
IFMPI=true
PPLIST="${PPLIST} MPI"
fi
export IFMPI
# Check size of long int
cat > tmp.c << _ACEOF
#include <stdlib.h>
#include <stdio.h>
int main()
{
int i;
i=sizeof(long int);
printf("%i\n",i);
}
_ACEOF
$CC tmp.c 2>&1>/dev/null
longIntTest=`./a.out`
rm tmp.c a.out
if [ "$longIntTest" == "8" ]
then
PPLIST="${PPLIST} LONGINT8"
fi
if [ "$UNDERSCORE" == "true" ]; then
PPLIST="${PPLIST} UNDERSCORE"
fi
if [ "$IFTIMING" == "false" -o "$IFTIMING" == "no" ]; then
PPLIST="${PPLIST} NOTIMER"
fi
PPLIST="${PPLIST} GLOBAL_LONG_LONG"
# add user defined preprocessor symbols
for i in $PPLIST
do
if [ "$i" == "MOAB" ]; then
IFMOAB=true
echo $F77comp | grep 'gfort' >/dev/null
if [ $? -eq 0 ]; then
P="${P} -fcray-pointer"
fi
if [ "$MOAB_DIR" == "" ]; then
echo "ABORT: Please specify path to MOAB in MOAB_DIR!"
exit 1
else
if [ ! -d $MOAB_DIR ]; then
echo "ABORT: Cannot find " $MOAB_DIR
exit 1
fi
if [ ! -f $MOAB_DIR/lib/iMesh-Defs.inc ]; then
echo "ABORT: Cannot find iMesh-Defs.inc in" $MOAB_DIR"/lib; make sure MOAB is installed."
echo " (to install, use 'make install' in" $MOAB_DIR")"
exit 1
fi
fi
fi
if [ "$i" == "NEKNEK" ]; then
IFNEKNEK=true
fi
if [ "$i" == "CVODE" ]; then
if [ "$CVODE_DIR" == "" ]; then
echo "ABORT: Please specify path to CVODE in CVODE_DIR!"
exit 1
else
if [ ! -d $CVODE_DIR ]; then
echo "ABORT: Cannot find " $CVODE_DIR
exit 1
fi
fi
USR_LFLAGS="${USR_LFLAGS} -L$CVODE_DIR -lsundials_fcvode -lsundials_cvode"
if [ "$IFMPI" == "true" ]; then
USR_LFLAGS="${USR_LFLAGS} -lsundials_fnvecparallel -lsundials_nvecparallel"
else
USR_LFLAGS="${USR_LFLAGS} -lsundials_fnvecserial -lsundials_nvecserial"
fi
fi
done
# AMG setup
if [ "$IFAMG_DUMP" == "true" ]; then
if [ "$IFAMG" != "true" -a "$IFAMG" != "yes" ]; then
echo "ABORT: Cannot dump AMG files if AMG is disabled!"
exit 1
fi
IFAMG_DUMP=true
else
IFAMG_DUMP=false
fi
export IFAMG_DUMP
if [ "$IFAMG" == "true" -o "$IFAMG" == "yes" ]; then
IFAMG=true
else
# default
IFAMG=false
fi
# CMT flag
if [ "$IFCMT" == "true" -o "$IFCMT" == "yes" ]; then
IFCMT=true
else
# default
IFCMT=false
fi
export IFCMT
# MXM-handling
if [ "$MXM_USER" != "" ]; then
echo "ABORT: makenek version is too old! Update with latest from source!"
exit 1
fi
MXM_USER="mxm_std.o blas.o"
echo $PPLIST | grep 'BG' >/dev/null
if [ $? -eq 0 ]; then
MXM_USER="mxm_std.o bg_aligned3.o bg_mxm44.o bg_mxm44_uneven.o bg_mxm3.o blas.o"
OPT_FLAGS_STD="-qarch=450 -qtune=450"
OPT_FLAGS_MAG="-O5 -qarch=450d -qtune=450"
fi
echo $PPLIST | grep 'K10_MXM' >/dev/null
if [ $? -eq 0 ]; then
MXM_USER="mxm_std.o k10_mxm.o blas.o"
USR_LFLAGS="${USR_LFLAGS} ${SOURCE_ROOT}/libk10_mxm.a"
fi
echo $PPLIST | grep 'BLAS_MXM' >/dev/null
if [ $? -eq 0 ]; then
MXM_USER="mxm_std.o"
fi
LPACK="dsygv.o ssygv.o"
echo $PPLIST | grep 'NO_LAPACK' >/dev/null
if [ $? -eq 0 ]; then
LPACK=" "
fi
# set optimization flags
L0="\$(G) -O0"
L2="\$(G) -O2"
L3="\$(G) -O3"
L4="\$(L3)"
# user specified opt flags
if [ "$OPT_FLAGS_STD" != "" ]; then
echo $OPT_FLAGS_STD | grep "\-O." 1>/dev/null
if [ $? -eq 0 ]; then
L2="\$(G) $OPT_FLAGS_STD"
L3="\$(G) $OPT_FLAGS_STD"
else
L2="\$(G) -O2 $OPT_FLAGS_STD"
L3="\$(G) -O3 $OPT_FLAGS_STD"
fi
fi
if [ "$OPT_FLAGS_MAG" != "" ]; then
L4="\$(G) $OPT_FLAGS_MAG"
fi
if [ "$USR_LIB" != "" ]; then
USR_LFLAGS="${USR_LFLAGS} ${USR_LIB}"
fi
# tweak makefile template
echo "generating makefile ..."
rm -rf makefile 2>/dev/null
sed -e "s:^F77[ ]*=.*:F77\:=$F77:" \
-e "s:^CC[ ]*=.*:CC\:=$CC:" \
-e "s:^G[ ]*=.*:G\:=$G:" \
-e "s:^OPT_FLAGS[ ]*=.*:OPT_FLAGS\:=$OPT_FLAGS:" \
-e "s/^P[ ]*=.*/P:=$P/" \
-e "s/^L0[ ]*=.*/L0=$L0/" \
-e "s/^L2[ ]*=.*/L2=$L2/" \
-e "s/^L3[ ]*=.*/L3=$L3/" \
-e "s/^L4[ ]*=.*/L4=$L4/" \
-e "s/^PPPO[ ]*=.*/PPPO=$PPPO/" \
-e "s/^PPS[ ]*=.*/PPS=$PPLIST/" \
-e "s:^MXM[ ]*=.*:MXM=$MXM_USER:" \
-e "s:^LPACK[ ]*=.*:LPACK=$LPACK:" \
-e "s/^IFAMG[ ]*=.*/IFAMG:=$IFAMG/" \
-e "s/^IFAMG_DUMP[ ]*=.*/IFAMG_DUMP:=$IFAMG_DUMP/" \
-e "s/^IFMPI[ ]*=.*/IFMPI:=$IFMPI/" \
-e "s/^IFCMT[ ]*=.*/IFCMT:=$IFCMT/" \
-e "s/^IFMOAB[ ]*=.*/IFMOAB:=$IFMOAB/" \
-e "s:^MOAB_DIR[ ]*=.*:MOAB_DIR\:=${MOAB_DIR}:" \
-e "s/^IFNEKNEK[ ]*=.*/IFNEKNEK:=$IFNEKNEK/" \
-e "s:^USR[ ]*=.*:USR\:=$USR:" \
-e "s:^USR_LFLAGS[ ]*=.*:USR_LFLAGS\:=$USR_LFLAGS:" \
-e "s:^S[ ]*=.*:S\:=${SOURCE_ROOT}:" \
-e "s:^S2[ ]*=.*:S2\:=${SOURCE_ROOT_CMT}:" $SOURCE_ROOT/makefile.template >.makefile
echo $G | grep '\-g' 1>/dev/null
if [ $? -eq 0 ]; then
sed 's/-O[1-4]/-O0/g' .makefile > .makefile.tmp
mv .makefile.tmp .makefile
echo "Activate DEBUG mode"
fi
if [ "$IFVISIT" == "true" -o "$IFVISIT" == "yes" ]; then
echo ""
echo "Activate VisIt Sim Mode"
IFVISIT=true
if [ -z "$VISIT_INC" ]; then
VISIT_INC=${VISIT_INSTALL}/libsim/V2/include
fi
echo " VISIT_INC = ($VISIT_INC)"
if [ -z "$VISIT_LIB" ]; then
VISIT_LIB=${VISIT_INSTALL}/libsim/V2/lib
fi
echo " VISIT_LIB = ($VISIT_LIB)"
if [ -n "$VISIT_STOP" ]; then
VISIT_STOP="VISIT_STOP"
echo " VISIT_STOP is defined. Nek5000 will wait for VisIt to Connect."
fi
sed -e "s/^IFVISIT[ ]*=.*/IFVISIT:=${IFVISIT}/" \
-e "s:^VISIT_IFLAGS[ ]*=.*:VISIT_IFLAGS\:=-I${VISIT_INC}:" \
-e "s:^VISIT_LFLAGS[ ]*=.*:VISIT_LFLAGS\:=-L${VISIT_LIB} -lsimV2 -lsimV2f -ldl -lstdc++:" \
-e "s/^PPS[ ]*=.*/PPS=${PPLIST} VISIT ${VISIT_STOP}/" \
.makefile > .makefile.tmp
mv .makefile.tmp .makefile
echo ""
fi
if [ "$USR" != "" ]; then
echo "###########################################################" >> makefile
echo "include makefile_usr.inc" >> .makefile
fi
if [ -f .makefile ]; then
sed -e "1i\\
### makefile automatically created by makenek `date +"%m/%d/%Y %T"` ###" \
-e "s:^CASEDIR[ ]*=.*:CASEDIR\:=${CASEDIR}:" \
-e "s:^CASENAME[ ]*=.*:CASENAME\:=${CASENAME}:" .makefile > makefile
else
echo "ERROR: Nek Makefile could not be created!"
exit 1
fi
\rm .makefile 2>/dev/null
# add plugins
for i in $PLUGIN_LIST
do
if [ ! -f makenek_plugin_$i ]; then
echo "ABORT: cannot find plug-in config file" makenek_plugin_$i
exit 1
fi
source makenek_plugin_$i
plugindir="SRC_PLUGIN"
plugindir=`echo ${!plugindir}`
if [ ! -f $plugindir/makenek.inc ]; then
echo "ABORT: Cannot find plug-in include file file" $plugindir/makenek.inc
exit 1
fi
source $plugindir/makenek.inc
if [ $ierr -ne 0 ]; then
echo "ABORT: plug-in config failed!"
exit 1
else
echo "found plug-in" $i in $plugindir
fi
done
# tweak SIZE file
if [ -f "./SIZE" ]; then
cat SIZE | grep -i 'lxo' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter(lxo = lx1) ! max output grid size (lxo>=lx1)' >>SIZE
fi
cat SIZE | grep -i 'lpart' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter(lpart = 1 ) ! max number of particles/proc' >>SIZE
fi
cat SIZE | grep -i 'ax1' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer ax1,ay1,az1,ax2,ay2,az2' >> SIZE
echo ' parameter (ax1=lx1,ay1=ly1,az1=lz1,ax2=lx2,ay2=ly2,az2=lz2) ! running averages' >> SIZE
fi
cat SIZE | grep -i 'lys=lxs' >/dev/null
if [ $? -ne 0 ]; then
cat SIZE | grep -iv lxs > SIZE.x; mv SIZE.x SIZE # Clean existing SIZE file of old version
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter (lxs=1,lys=lxs,lzs=(lxs-1)*(ldim-2)+1) !New Pressure Preconditioner' >> SIZE
fi
cat SIZE | grep -i 'lfdm' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter (lfdm=0) ! == 1 for fast diagonalization method' >> SIZE
fi
cat SIZE | grep -i 'nio' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' common/IOFLAG/nio ! for logfile verbosity control' >> SIZE
fi
echo $PPLIST | grep 'CVODE' >/dev/null
if [ $? -eq 0 ]; then
cat SIZE | grep -i 'cv_maxl' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer cv_maxl' >> SIZE
echo ' parameter(cv_maxl = 20 ) ! Size of Krylov Space' >>SIZE
fi
cat SIZE | grep -i 'cv_delt' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' real cv_delt' >> SIZE
echo ' parameter(cv_delt = 0.1 ) ! linear convergence factor ' >>SIZE
fi
cat SIZE | grep -i 'cv_sigs' >/dev/null
if [ $? -ne 0 ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' real cv_sigs' >> SIZE
echo ' parameter(cv_sigs = 0.01) ! Jacobian DQ perturbation scaling factor' >>SIZE
fi
fi
cat SIZE | grep -i 'toteq' >/dev/null
if [ $? -ne 0 ]; then
if [ "$IFCMT" == "true" ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer toteq' >> SIZE
echo ' parameter(toteq = 5 ) ! Number of conserved variables ' >>SIZE
echo 'c IFCMT=TRUE then toteq=5' >>SIZE
else
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer toteq' >> SIZE
echo ' parameter(toteq = 1 ) ! Number of conserved variables ' >>SIZE
echo 'c IFCMT=FALSE then toteq=1' >>SIZE
fi
fi
cat SIZE | grep -i 'lelcmt' >/dev/null
if [ $? -ne 0 ]; then
if [ "$IFCMT" == "true" ]; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer lelcmt' >> SIZE
echo ' parameter(lelcmt = lelt ) ! # of cmt elements ' >>SIZE
echo 'c IFCMT=TRUE then lelcmt=lelt' >>SIZE
else
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer lelcmt' >> SIZE
echo ' parameter(lelcmt = 1 ) ! # of cmt elements ' >>SIZE
echo 'c IFCMT=FALSE then lelcmt=1' >>SIZE
fi
fi
else
echo "FATAL ERROR: Cannot find SIZE"
exit 1
fi
# tweak .usr (actually, .f ) file
rm -f $CASENAME.f
cp -p $CASENAME.usr $CASENAME.f
cat $CASENAME.f | grep -i "subroutine.*usrsetvert" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine usrsetvert(glo_num,nel,nx,ny,nz) ! to modify glo_num
integer*8 glo_num(1)
return
end
_ACEOF
fi
if [ "$IFCMT" == "true" -o "$IFCMT" == "yes" ]; then
cat $CASENAME.f | grep -i "subroutine.*cmt_switch" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine cmt_switch ! to set IFCMT logical flag
include 'SIZE'
include 'INPUT'
IFCMT=.true.
return
end
_ACEOF
fi
else
cat $CASENAME.f | grep -i "subroutine.*cmt_switch" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine cmt_switch ! to set IFCMT logical flag
include 'SIZE'
include 'INPUT'
IFCMT=.false.
return
end
_ACEOF
fi
fi
cat $CASENAME.f | grep -i "subroutine.*usrflt" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine usrflt(rmult) ! user defined filter
include 'SIZE'
real rmult(lx1)
call rone(rmult,lx1)
return
end
_ACEOF
fi
cat $CASENAME.f | grep -i "subroutine.*userflux" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine userflux ! user defined flux
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
real fluxout(lx1*lz1)
return
end
_ACEOF
fi
cat $CASENAME.f | grep -i "subroutine.*userEOS" >/dev/null
if [ $? -ne 0 ]; then
cat >> $CASENAME.f << _ACEOF
c
c automatically added by makenek
subroutine userEOS ! user defined EOS
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
return
end
_ACEOF
fi
if [ $NOCOMPILE -eq 1 ]; then
exit 0
fi