forked from Nek5000-deprecated/Nek5000-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdrive2.f
2042 lines (1889 loc) · 55.3 KB
/
drive2.f
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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
subroutine initdim
C-------------------------------------------------------------------
C
C Transfer array dimensions to common
C
C-------------------------------------------------------------------
include 'SIZE'
include 'INPUT'
C
NX1=LX1
NY1=LY1
NZ1=LZ1
C
NX2=LX2
NY2=LY2
NZ2=LZ2
C
NX3=LX3
NY3=LY3
NZ3=LZ3
C
NXD=LXD
NYD=LYD
NZD=LZD
C
NELT=LELT
NELV=LELV
NDIM=LDIM
C
RETURN
END
C
subroutine initdat
C--------------------------------------------------------------------
C
C Initialize and set default values.
C
C--------------------------------------------------------------------
include 'SIZE'
include 'TOTAL'
include 'CTIMER'
COMMON /DOIT/ IFDOIT
LOGICAL IFDOIT
c Set default logicals
IFDOIT = .FALSE.
IFCVODE = .false.
IFEXPLVIS = .false.
ifsplit = .false.
if (lx1.eq.lx2) ifsplit=.true.
if_full_pres = .false.
c Turn off (on) diagnostics for communication
IFGPRNT= .FALSE.
CALL RZERO (PARAM,200)
C
C The initialization of CBC is done in READAT
C
C LCBC = 3*6*LELT*(LDIMT1+1)
C CALL BLANK(CBC,LCBC)
C
CALL BLANK(CCURVE ,12*LELT)
NEL8 = 8*LELT
CALL RZERO(XC,NEL8)
CALL RZERO(YC,NEL8)
CALL RZERO(ZC,NEL8)
C
NTOT=NX1*NY1*NZ1*LELT
CALL RZERO(ABX1,NTOT)
CALL RZERO(ABX2,NTOT)
CALL RZERO(ABY1,NTOT)
CALL RZERO(ABY2,NTOT)
CALL RZERO(ABZ1,NTOT)
CALL RZERO(ABZ2,NTOT)
CALL RZERO(VGRADT1,NTOT)
CALL RZERO(VGRADT2,NTOT)
NTOT=NX2*NY2*NZ2*LELT
CALL RZERO(USRDIV,NTOT)
RETURN
END
C
subroutine comment
C---------------------------------------------------------------------
C
C No need to comment !!
C
C---------------------------------------------------------------------
include 'SIZE'
include 'INPUT'
include 'GEOM'
include 'TSTEP'
include 'CTIMER'
LOGICAL IFCOUR
SAVE IFCOUR
COMMON /CPRINT/ IFPRINT
LOGICAL IFPRINT
REAL*8 EETIME0,EETIME1,EETIME2
SAVE EETIME0,EETIME1,EETIME2
DATA EETIME0,EETIME1,EETIME2 /0.0, 0.0, 0.0/
C
C Only node zero makes comments.
IF (NIO.NE.0) RETURN
C
C
IF (EETIME0.EQ.0.0 .AND. ISTEP.EQ.1) EETIME0=DNEKCLOCK()
EETIME1=EETIME2
EETIME2=DNEKCLOCK()
C
IF (ISTEP.EQ.0) THEN
IFCOUR = .FALSE.
DO 10 IFIELD=1,NFIELD
IF (IFADVC(IFIELD)) IFCOUR = .TRUE.
10 CONTINUE
IF (IFWCNO) IFCOUR = .TRUE.
ELSEIF (ISTEP.GT.0 .AND. LASTEP.EQ.0 .AND. IFTRAN) THEN
TTIME_STP = EETIME2-EETIME1 ! time per timestep
TTIME = EETIME2-EETIME0 ! sum of all timesteps
IF(ISTEP.EQ.1) THEN
TTIME_STP = 0
TTIME = 0
ENDIF
IF ( IFCOUR)
$ WRITE(6,100)ISTEP,TIME,DT,COURNO,TTIME,TTIME_STP
IF (.NOT.IFCOUR) WRITE (6,101) ISTEP,TIME,DT
ELSEIF (LASTEP.EQ.1) THEN
TTIME_STP = EETIME2-EETIME1 ! time per timestep
TTIME = EETIME2-EETIME0 ! sum of all timesteps
ENDIF
100 FORMAT('Step',I7,', t=',1pE14.7,', DT=',1pE14.7
$,', C=',0pF7.3,2(1pE11.4))
101 FORMAT('Step',I7,', time=',1pE12.5,', DT=',1pE11.3)
RETURN
END
C
subroutine setvar
C------------------------------------------------------------------------
C
C Initialize variables
C
C------------------------------------------------------------------------
include 'SIZE'
include 'INPUT'
include 'GEOM'
include 'DEALIAS'
include 'TSTEP'
C
C Enforce splitting/Uzawa according to the way the code was compiled
C
c
nxd = lxd
nyd = lyd
nzd = lzd
C
C Geometry on Mesh 3 or 1?
C
IFGMSH3 = .TRUE.
IF ( IFSTRS ) IFGMSH3 = .FALSE.
IF (.NOT.IFFLOW) IFGMSH3 = .FALSE.
IF ( IFSPLIT ) IFGMSH3 = .FALSE.
NGEOM = 2
C
NFIELD = 1
IF (IFHEAT) THEN
NFIELD = 2 + NPSCAL
NFLDTM = 1 + NPSCAL
ENDIF
c
nfldt = nfield
if (ifmhd) then
nfldt = nfield + 1
nfldtm = nfldtm + 1
endif
c
IF (IFMODEL) CALL SETTMC
IF (IFMODEL.AND.IFKEPS) THEN
NPSCAL = 1
NFLDTM = NPSCAL + 1
IF (LDIMT.LT.NFLDTM) THEN
WRITE (6,*) 'k-e turbulence model activated'
WRITE (6,*) 'Insufficient number of field arrays'
WRITE (6,*) 'Rerun through PRE or change SIZE file'
call exitt
ENDIF
NFIELD = NFIELD + 2
CALL SETTURB
ENDIF
MFIELD = 1
IF (IFMVBD) MFIELD = 0
C
DO 100 IFIELD=MFIELD,nfldt+(LDIMT-1 - NPSCAL)
IF (IFTMSH(IFIELD)) THEN
NELFLD(IFIELD) = NELT
ELSE
NELFLD(IFIELD) = NELV
ENDIF
100 CONTINUE
C
NMXH = 1000
if (iftran) NMXH = 100
NMXP = 1000 ! (for testing) 100 ! 2000
NMXE = 100 ! 1000
NMXNL = 10 ! 100
C
PARAM(86) = 0 ! No skew-symm. convection for now
C
BETAG = 0 ! PARAM(3)
GTHETA = 0 ! PARAM(4)
DT = abs(PARAM(12))
DTINIT = DT
FINTIM = PARAM(10)
NSTEPS = PARAM(11)
IOCOMM = PARAM(13)
TIMEIO = PARAM(14)
IOSTEP = PARAM(15)
LASTEP = 0
TOLPDF = abs(PARAM(21))
TOLHDF = abs(PARAM(22))
TOLREL = abs(PARAM(24))
TOLABS = abs(PARAM(25))
CTARG = PARAM(26)
NBDINP = PARAM(27)
NABMSH = PARAM(28)
if (nbdinp.gt.lorder) then
if (nid.eq.0) then
write(6,*) 'ERROR: torder > lorder.',nbdinp,lorder
write(6,*) 'Change SIZEu and recompile entire code.'
endif
call exitt
endif
if(abs(PARAM(16)).ge.2) IFCVODE = .true.
C
C Check accuracy requested.
C
IF (TOLREL.LE.0.) TOLREL = 0.01
C
C Relaxed pressure iteration; maximum decrease in the residual.
C
PRELAX = 0.1*TOLREL
IF (.NOT.IFTRAN .AND. .NOT.IFNAV) PRELAX = 1.E-5
C
C Tolerance for nonlinear iteration
C
TOLNL = 1.E-4
C
C Fintim overrides nsteps
C
IF (FINTIM.NE.0.) NSTEPS = 1000000000
IF (.NOT.IFTRAN ) NSTEPS = 1
C
C Print interval defaults to 1
C
IF (IOCOMM.EQ.0) IOCOMM = nsteps+1
C
C Set logical for Boussinesq approx (natural convection)
C
IFNATC = .FALSE.
IF (BETAG.GT.0.) IFNATC=.TRUE.
IF(IFLOMACH) IFNATC = .FALSE.
C
C Set default for mesh integration scheme
C
IF (NABMSH.LE.0 .OR. NABMSH.GT.3) THEN
NABMSH = NBDINP
PARAM(28) = (NABMSH)
ENDIF
C
C Set default for mixing length factor
C
TLFAC = 0.14
c IF (PARAM(49) .LE. 0.0) PARAM(49) = TLFAC
C
C Courant number only applicable if convection in ANY field.
C
IADV = 0
IFLD1 = 1
IF (.NOT.IFFLOW) IFLD1 = 2
DO 200 IFIELD=IFLD1,nfldt
IF (IFADVC(IFIELD)) IADV = 1
200 CONTINUE
C
C If characteristics, need number of sub-timesteps (DT/DS).
C Current sub-timeintegration scheme: RK4.
C If not characteristics, i.e. standard semi-implicit scheme,
C check user-defined Courant number.
C
IF (IADV.EQ.1) CALL SETCHAR
C
C Initialize order of time-stepping scheme (BD)
C Initialize time step array.
C
NBD = 0
CALL RZERO (DTLAG,10)
C
C Useful constants
C
one = 1.
PI = 4.*ATAN(one)
C
RETURN
END
C
subroutine echopar
C
C Echo the nonzero parameters from the readfile to the logfile
C
include 'SIZE'
include 'INPUT'
CHARACTER*132 STRING
CHARACTER*1 STRING1(132)
EQUIVALENCE (STRING,STRING1)
C
IF (nid.ne.0) RETURN
C
OPEN (UNIT=9,FILE=REAFLE,STATUS='OLD')
REWIND(UNIT=9)
C
C
READ(9,*,ERR=400)
READ(9,*,ERR=400) VNEKTON
NKTONV=VNEKTON
VNEKMIN=2.5
IF(VNEKTON.LT.VNEKMIN)THEN
PRINT*,' Error: This NEKTON Solver Requires a .rea file'
PRINT*,' from prenek version ',VNEKMIN,' or higher'
PRINT*,' Please run the session through the preprocessor'
PRINT*,' to bring the .rea file up to date.'
call exitt
ENDIF
READ(9,*,ERR=400) NDIM
c error check
IF(NDIM.NE.LDIM)THEN
WRITE(6,10) LDIM,NDIM
10 FORMAT(//,2X,'Error: This NEKTON Solver has been compiled'
$ /,2X,' for spatial dimension equal to',I2,'.'
$ /,2X,' The data file has dimension',I2,'.')
CALL exitt
ENDIF
C
CALL BLANK(STRING,132)
CALL CHCOPY(STRING,REAFLE,132)
Ls=LTRUNC(STRING,132)
READ(9,*,ERR=400) NPARAM
WRITE(6,82) NPARAM,(STRING1(j),j=1,Ls)
C
DO 20 I=1,NPARAM
CALL BLANK(STRING,132)
READ(9,80,ERR=400) STRING
Ls=LTRUNC(STRING,132)
IF (PARAM(i).ne.0.0) WRITE(6,81) I,(STRING1(j),j=1,Ls)
20 CONTINUE
80 FORMAT(A132)
81 FORMAT(I4,3X,132A1)
82 FORMAT(I4,3X,'Parameters from file:',132A1)
CLOSE (UNIT=9)
write(6,*) ' '
c if(param(2).ne.param(8).and.nio.eq.0) then
c write(6,*) 'Note VISCOS not equal to CONDUCT!'
c write(6,*) 'Note VISCOS =',PARAM(2)
c write(6,*) 'Note CONDUCT =',PARAM(8)
c endif
if (param(62).gt.0) then
if(nio.eq.0) write(6,*)
& 'enable byte swap for output'
call set_bytesw_write(1)
endif
c
return
C
C Error handling:
C
400 CONTINUE
WRITE(6,401)
401 FORMAT(2X,'ERROR READING PARAMETER DATA'
$ ,/,2X,'ABORTING IN ROUTINE ECHOPAR.')
CALL exitt
C
500 CONTINUE
WRITE(6,501)
501 FORMAT(2X,'ERROR READING LOGICAL DATA'
$ ,/,2X,'ABORTING IN ROUTINE ECHOPAR.')
CALL exitt
C
RETURN
END
C
subroutine gengeom (igeom)
C----------------------------------------------------------------------
C
C Generate geometry data
C
C----------------------------------------------------------------------
include 'SIZE'
include 'INPUT'
include 'TSTEP'
include 'GEOM'
include 'WZ'
C
COMMON /SCRUZ/ XM3 (LX3,LY3,LZ3,LELT)
$ , YM3 (LX3,LY3,LZ3,LELT)
$ , ZM3 (LX3,LY3,LZ3,LELT)
C
if (nio.eq.0.and.istep.le.1) write(6,*) 'generate geometry data'
IF (IGEOM.EQ.1) THEN
RETURN
ELSEIF (IGEOM.EQ.2) THEN
CALL LAGMASS
IF (ISTEP.EQ.0) CALL GENCOOR (XM3,YM3,ZM3)
IF (ISTEP.GE.1) CALL UPDCOOR
CALL GEOM1 (XM3,YM3,ZM3)
CALL GEOM2
CALL UPDMSYS (1)
CALL VOLUME
CALL SETINVM
CALL SETDEF
CALL SFASTAX
IF (ISTEP.GE.1) CALL EINIT
ELSEIF (IGEOM.EQ.3) THEN
c
c Take direct stiffness avg of mesh
c
ifieldo = ifield
if (.not.ifneknekm) CALL GENCOOR (XM3,YM3,ZM3)
if (ifheat) then
ifield = 2
CALL dssum(xm3,nx3,ny3,nz3)
call col2 (xm3,tmult,ntot3)
CALL dssum(ym3,nx3,ny3,nz3)
call col2 (ym3,tmult,ntot3)
if (if3d) then
CALL dssum(xm3,nx3,ny3,nz3)
call col2 (xm3,tmult,ntot3)
endif
else
ifield = 1
CALL dssum(xm3,nx3,ny3,nz3)
call col2 (xm3,vmult,ntot3)
CALL dssum(ym3,nx3,ny3,nz3)
call col2 (ym3,vmult,ntot3)
if (if3d) then
CALL dssum(xm3,nx3,ny3,nz3)
call col2 (xm3,vmult,ntot3)
endif
endif
CALL GEOM1 (XM3,YM3,ZM3)
CALL GEOM2
CALL UPDMSYS (1)
CALL VOLUME
CALL SETINVM
CALL SETDEF
CALL SFASTAX
ifield = ifieldo
ENDIF
if (nio.eq.0.and.istep.le.1) then
write(6,*) 'done :: generate geometry data'
write(6,*) ' '
endif
return
end
c-----------------------------------------------------------------------
subroutine files
C
C Defines machine specific input and output file names.
C
include 'SIZE'
include 'INPUT'
include 'PARALLEL'
C
CHARACTER*132 NAME
CHARACTER*1 SESS1(132),PATH1(132),NAM1(132)
EQUIVALENCE (SESSION,SESS1)
EQUIVALENCE (PATH,PATH1)
EQUIVALENCE (NAME,NAM1)
CHARACTER*1 DMP(4),FLD(4),REA(4),HIS(4),SCH(4) ,ORE(4), NRE(4)
CHARACTER*1 RE2(4)
CHARACTER*4 DMP4 ,FLD4 ,REA4 ,HIS4 ,SCH4 ,ORE4 , NRE4
CHARACTER*4 RE24
EQUIVALENCE (DMP,DMP4), (FLD,FLD4), (REA,REA4), (HIS,HIS4)
$ , (SCH,SCH4), (ORE,ORE4), (NRE,NRE4)
$ , (RE2,RE24)
DATA DMP4,FLD4,REA4 /'.dmp','.fld','.rea'/
DATA HIS4,SCH4 /'.his','.sch'/
DATA ORE4,NRE4 /'.ore','.nre'/
DATA RE24 /'.re2' /
CHARACTER*78 STRING
C
C Find out the session name:
C
c CALL BLANK(SESSION,132)
c CALL BLANK(PATH ,132)
c ierr = 0
c IF(NID.EQ.0) THEN
c OPEN (UNIT=8,FILE='SESSION.NAME',STATUS='OLD',ERR=24)
c READ(8,10) SESSION
c READ(8,10) PATH
c 10 FORMAT(A132)
c CLOSE(UNIT=8)
c GOTO 23
c 24 ierr = 1
c 23 ENDIF
c call err_chk(ierr,' Cannot open SESSION.NAME!$')
len = ltrunc(path,132)
if(indx1(path1(len),'/',1).lt.1) then
call chcopy(path1(len+1),'/',1)
endif
c call bcast(SESSION,132*CSIZE)
c call bcast(PATH,132*CSIZE)
CALL BLANK(REAFLE,132)
CALL BLANK(RE2FLE,132)
CALL BLANK(FLDFLE,132)
CALL BLANK(HISFLE,132)
CALL BLANK(SCHFLE,132)
CALL BLANK(DMPFLE,132)
CALL BLANK(OREFLE,132)
CALL BLANK(NREFLE,132)
CALL BLANK(NAME ,132)
C
C Construct file names containing full path to host:
C
LS=LTRUNC(SESSION,132)
LPP=LTRUNC(PATH,132)
LSP=LS+LPP
c
call chcopy(nam1( 1),path1,lpp)
call chcopy(nam1(lpp+1),sess1,ls )
l1 = lpp+ls+1
ln = lpp+ls+4
c
c
c .rea file
call chcopy(nam1 (l1),rea , 4)
call chcopy(reafle ,nam1,ln)
c write(6,*) 'reafile:',reafle
c
c .re2 file
call chcopy(nam1 (l1),re2 , 4)
call chcopy(re2fle ,nam1,ln)
c
c .fld file
call chcopy(nam1 (l1),fld , 4)
call chcopy(fldfle ,nam1,ln)
c
c .his file
call chcopy(nam1 (l1),his , 4)
call chcopy(hisfle ,nam1,ln)
c
c .sch file
call chcopy(nam1 (l1),sch , 4)
call chcopy(schfle ,nam1,ln)
c
c
c .dmp file
call chcopy(nam1 (l1),dmp , 4)
call chcopy(dmpfle ,nam1,ln)
c
c .ore file
call chcopy(nam1 (l1),ore , 4)
call chcopy(orefle ,nam1,ln)
c
c .nre file
call chcopy(nam1 (l1),nre , 4)
call chcopy(nrefle ,nam1,ln)
c
C Write the name of the .rea file to the logfile.
C
IF (NIO.EQ.0) THEN
CALL CHCOPY(STRING,REAFLE,78)
WRITE(6,1000) STRING
WRITE(6,1001)
1000 FORMAT(//,2X,'Beginning session:',/,2X,A78)
1001 FORMAT(/,' ')
ENDIF
C
RETURN
END
C
subroutine settime
C----------------------------------------------------------------------
C
C Store old time steps and compute new time step, time and timef.
C Set time-dependent coefficients in time-stepping schemes.
C
C----------------------------------------------------------------------
include 'SIZE'
include 'GEOM'
include 'INPUT'
include 'TSTEP'
COMMON /CPRINT/ IFPRINT
LOGICAL IFPRINT
SAVE
C
irst = param(46)
C
C Set time step.
C
DO 10 ILAG=10,2,-1
DTLAG(ILAG) = DTLAG(ILAG-1)
10 CONTINUE
CALL SETDT
DTLAG(1) = DT
IF (ISTEP.EQ.1 .and. irst.le.0) DTLAG(2) = DT
C
C Set time.
C
TIMEF = TIME
TIME = TIME+DT
C
C Set coefficients in AB/BD-schemes.
C
CALL SETORDBD
if (irst.gt.0) nbd = nbdinp
CALL RZERO (BD,10)
CALL SETBD (BD,DTLAG,NBD)
NAB = 3
IF (ISTEP.LE.2 .and. irst.le.0) NAB = ISTEP
CALL RZERO (AB,10)
CALL SETABBD (AB,DTLAG,NAB,NBD)
IF (IFMVBD) THEN
NBDMSH = 1
NABMSH = PARAM(28)
IF (NABMSH.GT.ISTEP .and. irst.le.0) NABMSH = ISTEP
IF (IFSURT) NABMSH = NBD
CALL RZERO (ABMSH,10)
CALL SETABBD (ABMSH,DTLAG,NABMSH,NBDMSH)
ENDIF
C
C Set logical for printout to screen/log-file
C
IFPRINT = .FALSE.
IF (IOCOMM.GT.0.AND.MOD(ISTEP,IOCOMM).EQ.0) IFPRINT=.TRUE.
IF (ISTEP.eq.1 .or. ISTEP.eq.0 ) IFPRINT=.TRUE.
IF (NIO.eq.-1) ifprint=.false.
RETURN
END
subroutine geneig (igeom)
C-----------------------------------------------------------------------
C
C Compute eigenvalues.
C Used for automatic setting of tolerances and to find critical
C time step for explicit mode.
C Currently eigenvalues are computed only for the velocity mesh.
C
C-----------------------------------------------------------------------
include 'SIZE'
include 'EIGEN'
include 'INPUT'
include 'TSTEP'
C
IF (IGEOM.EQ.1) RETURN
C
C Decide which eigenvalues to be computed.
C
IF (IFFLOW) THEN
C
IFAA = .FALSE.
IFAE = .FALSE.
IFAS = .FALSE.
IFAST = .FALSE.
IFGA = .TRUE.
IFGE = .FALSE.
IFGS = .FALSE.
IFGST = .FALSE.
C
C For now, only compute eigenvalues during initialization.
C For deforming geometries the eigenvalues should be
C computed every time step (based on old eigenvectors => more memory)
C
IMESH = 1
IFIELD = 1
TOLEV = 1.E-3
TOLHE = TOLHDF
TOLHR = TOLHDF
TOLHS = TOLHDF
TOLPS = TOLPDF
CALL EIGENV
CALL ESTEIG
C
ELSEIF (IFHEAT.AND..NOT.IFFLOW) THEN
C
CALL ESTEIG
C
ENDIF
C
RETURN
END
C-----------------------------------------------------------------------
subroutine fluid (igeom)
C
C Driver for solving the incompressible Navier-Stokes equations.
C
C Current version:
C (1) Velocity/stress formulation.
C (2) Constant/variable properties.
C (3) Implicit/explicit time stepping.
C (4) Automatic setting of tolerances .
C (5) Lagrangian/"Eulerian"(operator splitting) modes
C
C-----------------------------------------------------------------------
include 'SIZE'
include 'DEALIAS'
include 'INPUT'
include 'SOLN'
include 'TSTEP'
real*8 ts, dnekclock
ifield = 1
imesh = 1
call unorm
call settolv
ts = dnekclock()
if(nio.eq.0 .and. igeom.eq.1)
& write(6,*) 'Solving for fluid',ifsplit,iftran,ifnav
if (ifsplit) then
c PLAN 4: TOMBO SPLITTING
c - Time-dependent Navier-Stokes calculation (Re>>1).
c - Same approximation spaces for pressure and velocity.
c - Incompressibe or Weakly compressible (div u .ne. 0).
call plan4
igeom = 2
call twalluz (igeom) ! Turbulence model
call chkptol ! check pressure tolerance
call vol_flow ! check for fixed flow rate
elseif (iftran) then
c call plan1 (igeom) ! Orig. NEKTON time stepper
call plan3 (igeom) ! Same as PLAN 1 w/o nested iteration
! Std. NEKTON time stepper !
if (ifmodel) call twalluz (igeom) ! Turbulence model
if (igeom.ge.2) call chkptol ! check pressure tolerance
if (igeom.ge.2) call vol_flow ! check for fixed flow rate
else ! steady Stokes, non-split
c - Steady/Unsteady Stokes/Navier-Stokes calculation.
c - Consistent approximation spaces for velocity and pressure.
c - Explicit treatment of the convection term.
c - Velocity/stress formulation.
call plan1 (igeom) ! The NEKTON "Classic".
endif
if(nio.eq.0 .and. igeom.ge.2)
& write(*,'(4x,i7,1x,1p2e12.4,a)')
& istep,time,dnekclock()-ts,' Fluid done'
return
end
c-----------------------------------------------------------------------
subroutine heat (igeom)
C
C Driver for temperature or passive scalar.
C
C Current version:
C (1) Varaiable properties.
C (2) Implicit time stepping.
C (3) User specified tolerance for the Helmholtz solver
C (not based on eigenvalues).
C (4) A passive scalar can be defined on either the
C temperatur or the velocity mesh.
C (5) A passive scalar has its own multiplicity (B.C.).
C
include 'SIZE'
include 'INPUT'
include 'TSTEP'
include 'TURBO'
include 'DEALIAS'
real*8 ts, dnekclock
ts = dnekclock()
if (nio.eq.0 .and. igeom.eq.1)
& write(*,'(13x,a)') 'Solving for heat'
if (ifcvode) then
call cdscal_cvode(igeom)
igeom = 2
elseif (ifsplit) then
do igeo=1,2
do ifield=2,nfield
intype = -1
if (.not.iftmsh(ifield)) imesh = 1
if ( iftmsh(ifield)) imesh = 2
call unorm
call settolt
call cdscal (igeo)
enddo
enddo
igeom = 2
else ! PN-PN-2
do ifield=2,nfield
intype = -1
if (.not.iftmsh(ifield)) imesh = 1
if ( iftmsh(ifield)) imesh = 2
call unorm
call settolt
call cdscal (igeom)
enddo
endif
if (nio.eq.0 .and. igeom.ge.2)
& write(*,'(4x,i7,1x,1p2e12.4,a)')
& istep,time,dnekclock()-ts,' Heat done'
return
end
c-----------------------------------------------------------------------
subroutine meshv (igeom)
C Driver for mesh velocity used in conjunction with moving geometry.
C
C-----------------------------------------------------------------------
include 'SIZE'
include 'INPUT'
include 'TSTEP'
C
IF (IGEOM.EQ.1) RETURN
C
IFIELD = 0
NEL = NELFLD(IFIELD)
IMESH = 1
IF (IFTMSH(IFIELD)) IMESH = 2
C
CALL UPDMSYS (0)
CALL MVBDRY (NEL)
CALL ELASOLV (NEL)
C
RETURN
END
subroutine rescont (ind)
c
include 'SIZE'
include 'INPUT'
include 'PARALLEL'
include 'TSTEP'
c
if (np.gt.1) return
irst = param(46)
iwrf = 1
if (irst.ne.0) then
iwrf = mod(istep,iabs(irst))
if (lastep.eq.1) iwrf = 0
endif
c
if (ind.eq.1 .and. irst.gt.0) call rstartc (ind)
if (ind.eq.0 .and. iwrf.eq.0) call rstartc (ind)
c
return
end
subroutine rstartc (ind)
c
include 'SIZE'
include 'TOTAL'
common /SCRSF/ xm3(lx3,ly3,lz3,lelv)
$ , ym3(lx3,ly3,lz3,lelv)
$ , zm3(lx3,ly3,lz3,lelv)
c
integer icall1,icall2
save icall1,icall2
data icall1 /0/
data icall2 /0/
c
if (np.gt.1) return
ntov1=nx1*ny1*nz1*nelv
ntov2=nx2*ny2*nz2*nelv
ntot1=nx1*ny1*nz1*nelt
ntfc1=nx1*nz1*6*nelv
ntow1=lx1m*ly1m*lz1m*nelfld(0)
ntoe1=lx1m*ly1m*lz1m*nelv
ntotf=ntot1*ldimt
nlag =lorder-1
c
if (ind.eq.1) then
c
iru=22
if (icall1.eq.0) then
icall1=1
open(unit=22,file=orefle,status='OLD')
endif
c
rewind iru
read(iru,1100,end=9000) time,dt,courno,(dtlag(i),i=1,10)
read(iru,1100,end=9000) eigaa, eigas, eigast, eigae,
$ eigga, eiggs, eiggst, eigge
c
write (6,*) ' '
write (6,*) 'READ RESTART FILE, TIME =',time
c
iread = 0
if (ifmvbd) then
read (iru,1100,end=9000) (xm1(i,1,1,1),i=1,ntot1)
read (iru,1100,end=9000) (ym1(i,1,1,1),i=1,ntot1)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (zm1(i,1,1,1),i=1,ntot1)
read (iru,1100,end=9000) (wx(i,1,1,1) ,i=1,ntow1)
read (iru,1100,end=9000) (wy(i,1,1,1) ,i=1,ntow1)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (wz(i,1,1,1) ,i=1,ntow1)
if (nlag.ge.1) then
read (iru,1100,end=9000) (wxlag(i,1,1,1,1) ,i=1,ntow1*nlag)
read (iru,1100,end=9000) (wylag(i,1,1,1,1) ,i=1,ntow1*nlag)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (wzlag(i,1,1,1,1) ,i=1,ntow1*nlag)
endif
endif
c
iread = 1
if (ifflow) then
read (iru,1100,end=9000) (vx(i,1,1,1) ,i=1,ntov1)
read (iru,1100,end=9000) (vy(i,1,1,1) ,i=1,ntov1)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (vz(i,1,1,1) ,i=1,ntov1)
read (iru,1100,end=9000) (pr(i,1,1,1) ,i=1,ntov2)
read (iru,1100,end=9000) (abx2(i,1,1,1),i=1,ntov1)
read (iru,1100,end=9000) (aby2(i,1,1,1),i=1,ntov1)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (abz2(i,1,1,1),i=1,ntov1)
read (iru,1100,end=9000) (abx1(i,1,1,1),i=1,ntov1)
read (iru,1100,end=9000) (aby1(i,1,1,1),i=1,ntov1)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (abz1(i,1,1,1),i=1,ntov1)
if (nlag.ge.1) then
read (iru,1100,end=9000) (vxlag (i,1,1,1,1),i=1,ntov1*nlag)
read (iru,1100,end=9000) (vylag (i,1,1,1,1),i=1,ntov1*nlag)
if (ndim.eq.3)
$ read (iru,1100,end=9000) (vzlag (i,1,1,1,1),i=1,ntov1*nlag)
read (iru,1100,end=9000) (bm1lag(i,1,1,1,1),i=1,ntot1*nlag)
endif
endif
c
iread = 2
if (ifheat) then
read (iru,1100,end=9000) (t(i,1,1,1,1),i=1,ntotf)
read (iru,1100,end=9000) (vgradt1(i,1,1,1,1),i=1,ntotf)
read (iru,1100,end=9000) (vgradt2(i,1,1,1,1),i=1,ntotf)
if (nlag.ge.1) then
read (iru,1100,end=9000) (tlag(i,1,1,1,1,1),i=1,ntotf*nlag)
endif
endif
c
iread = 3
if (ifmodel .and. .not.ifkeps) then
read (iru,1100,end=9000) tlmax,tlimul
read (iru,1100,end=9000) (turbl(i,1,1,1),i=1,ntov1)
endif
if (ifcwuz) then
read (iru,1100,end=9000) (zwall (i,1,1,1),i=1,ntfc1)
read (iru,1100,end=9000) (uwall(i,1,1,1),i=1,ntfc1)
endif
c
if (ifgeom) then
call geom1 (xm3,ym3,zm3)
call geom2
call updmsys (1)