-
Notifications
You must be signed in to change notification settings - Fork 12
/
schemes.f90
2403 lines (2286 loc) · 51.4 KB
/
schemes.f90
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
!################################################################################
!This file is part of Incompact3d.
!
!Incompact3d
!Copyright (c) 2012 Eric Lamballais and Sylvain Laizet
!
! Incompact3d is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation.
!
! Incompact3d is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with the code. If not, see <http://www.gnu.org/licenses/>.
!-------------------------------------------------------------------------------
!-------------------------------------------------------------------------------
! We kindly request that you cite Incompact3d in your publications and
! presentations. The following citations are suggested:
!
! 1-Laizet S. & Lamballais E., 2009, High-order compact schemes for
! incompressible flows: a simple and efficient method with the quasi-spectral
! accuracy, J. Comp. Phys., vol 228 (15), pp 5989-6015
!
! 2-Laizet S. & Li N., 2011, Incompact3d: a powerful tool to tackle turbulence
! problems with up to 0(10^5) computational cores, Int. J. of Numerical
! Methods in Fluids, vol 67 (11), pp 1735-1757
!################################################################################
!********************************************************************
!
subroutine schemes_dns()
!
!********************************************************************
USE param
USE derivX
USE derivY
USE derivZ
USE var
implicit none
integer :: i,j,k
real(mytype) :: fpi2
! Coefficients for the 6th Order Scheme
alfa1x= 2. !
af1x =-(5./2. )/dx !
bf1x = ( 2. )/dx
cf1x = (1./2. )/dx
df1x = 0.
alfa2x= 1./4.
af2x = (3./4. )/dx
alfanx= 2.
afnx =-(5./2. )/dx
bfnx = ( 2. )/dx
cfnx = (1./2. )/dx
dfnx = 0.
alfamx= 1./4.
afmx = (3./4. )/dx
alfaix= 1./3.
afix = (7./9. )/dx
bfix = (1./36. )/dx
alsa1x= 11.
as1x = (13. )/dx2
bs1x =-(27. )/dx2
cs1x = (15. )/dx2
ds1x =-(1. )/dx2
alsa2x= 1./10.
as2x = (6./5. )/dx2
alsa3x= 2./11.
as3x = (12./11.)/dx2
bs3x = (3./44. )/dx2
alsanx= 11.
asnx = (13. )/dx2
bsnx =-(27. )/dx2
csnx = (15. )/dx2
dsnx =-(1. )/dx2
alsamx= 1./10.
asmx = (6./5. )/dx2
alsatx= 2./11.
astx = (12./11.)/dx2
bstx = (3./44. )/dx2
!alsaix= 2./11.
!asix = (12./11.)/dx2
!bsix = (3./44. )/dx2
!csix = 0.
!NUMERICAL DISSIPATION (see publications for help)
fpi2=4.
! fpi2=(48./7)/(pi*pi)
alsaix=(45.*fpi2*pi*pi-272.)/(2.*(45.*fpi2*pi*pi-208.))
asix =((6.-9.*alsaix)/4.)/dx2
bsix =((-3.+24*alsaix)/5.)/(4.*dx2)
csix =((2.-11.*alsaix)/20.)/(9.*dx2)
! stop
!if (nrank==0) then
! write(*,*) '=== derxx ==='
! write(*,*) alsaix
! write(*,*) asix*dx2
! write(*,*) bsix*4*dx2
! write(*,*) csix*9*dx2
! write(*,*) '============='
alfa1y= 2.
af1y =-(5./2. )/dy
bf1y = ( 2. )/dy
cf1y = (1./2. )/dy
df1y = 0.
alfa2y= 1./4.
af2y = (3./4. )/dy
alfany= 2.
afny =-(5./2. )/dy
bfny = ( 2. )/dy
cfny = (1./2. )/dy
dfny = 0.
alfamy= 1./4.
afmy = (3./4. )/dy
alfajy= 1./3.
afjy = (7./9. )/dy
bfjy = (1./36. )/dy
alsa1y= 11.
as1y = (13. )/dy2
bs1y =-(27. )/dy2
cs1y = (15. )/dy2
ds1y =-(1. )/dy2
alsa2y= 1./10.
as2y = (6./5. )/dy2
alsa3y= 2./11.
as3y = (12./11.)/dy2
bs3y = (3./44. )/dy2
alsany= 11.
asny = (13. )/dy2
bsny =-(27. )/dy2
csny = (15. )/dy2
dsny =-(1. )/dy2
alsamy= 1./10.
asmy = (6./5. )/dy2
alsaty= 2./11.
asty = (12./11.)/dy2
bsty = (3./44. )/dy2
!alsajy= 2./11.
!asjy = (12./11.)/dy2
!bsjy = (3./44. )/dy2
!csjy = 0.
alsajy=(45.*fpi2*pi*pi-272.)/(2.*(45.*fpi2*pi*pi-208.))
asjy =((6.-9.*alsajy)/4.)/dy2
bsjy =((-3.+24*alsajy)/5.)/(4.*dy2)
csjy =((2.-11.*alsajy)/20.)/(9.*dy2)
!if (nrank==0) then
! write(*,*) '=== deryy ==='
! write(*,*) alsajy
! write(*,*) asjy*dy2
! write(*,*) bsjy*4*dy2
! write(*,*) csjy*9*dy2
! write(*,*) '============='
!endif
alcaix6=9./62.
acix6=(63./62.)/dx
bcix6=(17./62.)/3./dx
cfx6(1)=alcaix6
cfx6(2)=alcaix6
cfx6(nxm-2)=alcaix6
cfx6(nxm-1)=alcaix6
cfx6(nxm)=0.
if (nclx==0) ccx6(1)=2.
if (nclx==1) ccx6(1)=1. + alcaix6
if (nclx==2) ccx6(1)=1. + alcaix6
ccx6(2)=1.
ccx6(nxm-2)=1.
ccx6(nxm-1)=1.
if (nclx==0) ccx6(nxm)=1. + alcaix6*alcaix6
if (nclx==1) ccx6(nxm)=1. + alcaix6
if (nclx==2) ccx6(nxm)=1. + alcaix6
cbx6(1)=alcaix6
cbx6(2)=alcaix6
cbx6(nxm-2)=alcaix6
cbx6(nxm-1)=alcaix6
cbx6(nxm)=0.
do i=3,nxm-3
cfx6(i)=alcaix6
ccx6(i)=1.
cbx6(i)=alcaix6
enddo
cfi6(1)=alcaix6 + alcaix6
cfi6(2)=alcaix6
cfi6(nx-2)=alcaix6
cfi6(nx-1)=alcaix6
cfi6(nx)=0.
cci6(1)=1.
cci6(2)=1.
cci6(nx-2)=1.
cci6(nx-1)=1.
cci6(nx)=1.
cbi6(1)=alcaix6
cbi6(2)=alcaix6
cbi6(nx-2)=alcaix6
cbi6(nx-1)=alcaix6 + alcaix6
cbi6(nx)=0.
do i=3,nx-3
cfi6(i)=alcaix6
cci6(i)=1.
cbi6(i)=alcaix6
enddo
ailcaix6=3./10.
aicix6=1./128.*(75.+70.*ailcaix6)
bicix6=1./256.*(126.*ailcaix6-25.)
cicix6=1./256.*(-10.*ailcaix6+3.)
if (nrank==0) print *,'New coef Inter X',aicix6,bicix6,cicix6
cifx6(1)=ailcaix6
cifx6(2)=ailcaix6
cifx6(nxm-2)=ailcaix6
cifx6(nxm-1)=ailcaix6
cifx6(nxm)=0.
if (nclx==0) cicx6(1)=2.
if (nclx==1) cicx6(1)=1. + ailcaix6
if (nclx==2) cicx6(1)=1. + ailcaix6
cicx6(2)=1.
cicx6(nxm-2)=1.
cicx6(nxm-1)=1.
if (nclx==0) cicx6(nxm)=1. + ailcaix6*ailcaix6
if (nclx==1) cicx6(nxm)=1. + ailcaix6
if (nclx==2) cicx6(nxm)=1. + ailcaix6
cibx6(1)=ailcaix6
cibx6(2)=ailcaix6
cibx6(nxm-2)=ailcaix6
cibx6(nxm-1)=ailcaix6
cibx6(nxm)=0.
do i=3,nxm-3
cifx6(i)=ailcaix6
cicx6(i)=1.
cibx6(i)=ailcaix6
enddo
cifi6(1)=ailcaix6 + ailcaix6
cifi6(2)=ailcaix6
cifi6(nx-2)=ailcaix6
cifi6(nx-1)=ailcaix6
cifi6(nx)=0.
cici6(1)=1.
cici6(2)=1.
cici6(nx-2)=1.
cici6(nx-1)=1.
cici6(nx)=1.
cibi6(1)=ailcaix6
cibi6(2)=ailcaix6
cibi6(nx-2)=ailcaix6
cibi6(nx-1)=ailcaix6 + ailcaix6
cibi6(nx)=0.
do i=3,nx-3
cifi6(i)=ailcaix6
cici6(i)=1.
cibi6(i)=ailcaix6
enddo
alcaiy6=9./62.
aciy6=(63./62.)/dy
bciy6=(17./62.)/3./dy
cfy6(1)=alcaiy6
cfy6(2)=alcaiy6
cfy6(nym-2)=alcaiy6
cfy6(nym-1)=alcaiy6
cfy6(nym)=0.
if (ncly==0) ccy6(1)=2.
if (ncly==1) ccy6(1)=1. + alcaiy6
if (ncly==2) ccy6(1)=1. + alcaiy6
ccy6(2)=1.
ccy6(nym-2)=1.
ccy6(nym-1)=1.
if (ncly==0) ccy6(nym)=1. + alcaiy6*alcaiy6
if (ncly==1) ccy6(nym)=1. + alcaiy6
if (ncly==2) ccy6(nym)=1. + alcaiy6
cby6(1)=alcaiy6
cby6(2)=alcaiy6
cby6(nym-2)=alcaiy6
cby6(nym-1)=alcaiy6
cby6(nym)=0.
do j=3,nym-3
cfy6(j)=alcaiy6
ccy6(j)=1.
cby6(j)=alcaiy6
enddo
cfi6y(1)=alcaiy6 + alcaiy6
cfi6y(2)=alcaiy6
cfi6y(ny-2)=alcaiy6
cfi6y(ny-1)=alcaiy6
cfi6y(ny)=0.
cci6y(1)=1.
cci6y(2)=1.
cci6y(ny-2)=1.
cci6y(ny-1)=1.
cci6y(ny)=1.
cbi6y(1)=alcaiy6
cbi6y(2)=alcaiy6
cbi6y(ny-2)=alcaiy6
cbi6y(ny-1)=alcaiy6 + alcaiy6
cbi6y(ny)=0.
do j=3,ny-3
cfi6y(j)=alcaiy6
cci6y(j)=1.
cbi6y(j)=alcaiy6
enddo
ailcaiy6=3./10.
aiciy6=1./128.*(75.+70.*ailcaiy6)
biciy6=1./256.*(126.*ailcaiy6-25.)
ciciy6=1./256.*(-10.*ailcaiy6+3.)
if (nrank==0) print *,'New coef Inter Y',aiciy6,biciy6,ciciy6
cify6(1)=ailcaiy6
cify6(2)=ailcaiy6
cify6(nym-2)=ailcaiy6
cify6(nym-1)=ailcaiy6
cify6(nym)=0.
if (ncly==0) cicy6(1)=2.
if (ncly==1) cicy6(1)=1. + ailcaiy6
if (ncly==2) cicy6(1)=1. + ailcaiy6
cicy6(2)=1.
cicy6(nym-2)=1.
cicy6(nym-1)=1.
if (ncly==0) cicy6(nym)=1. + ailcaiy6*ailcaiy6
if (ncly==1) cicy6(nym)=1. + ailcaiy6
if (ncly==2) cicy6(nym)=1. + ailcaiy6
ciby6(1)=ailcaiy6
ciby6(2)=ailcaiy6
ciby6(nym-2)=ailcaiy6
ciby6(nym-1)=ailcaiy6
ciby6(nym)=0.
do j=3,nym-3
cify6(j)=ailcaiy6
cicy6(j)=1.
ciby6(j)=ailcaiy6
enddo
cifi6y(1)=ailcaiy6 + ailcaiy6
cifi6y(2)=ailcaiy6
cifi6y(ny-2)=ailcaiy6
cifi6y(ny-1)=ailcaiy6
cifi6y(ny)=0.
cici6y(1)=1.
cici6y(2)=1.
cici6y(ny-2)=1.
cici6y(ny-1)=1.
cici6y(ny)=1.
cibi6y(1)=ailcaiy6
cibi6y(2)=ailcaiy6
cibi6y(ny-2)=ailcaiy6
cibi6y(ny-1)=ailcaiy6 + ailcaiy6
cibi6y(ny)=0.
do j=3,ny-3
cifi6y(j)=ailcaiy6
cici6y(j)=1.
cibi6y(j)=ailcaiy6
enddo
#ifndef TWOD
alcaiz6=9./62.
aciz6=(63./62.)/dz
bciz6=(17./62.)/3./dz
cfz6(1)=alcaiz6
cfz6(2)=alcaiz6
cfz6(nzm-2)=alcaiz6
cfz6(nzm-1)=alcaiz6
cfz6(nzm)=0.
if (nclz==0) ccz6(1)=2.
if (nclz==1) ccz6(1)=1. + alcaiz6
if (nclz==2) ccz6(1)=1. + alcaiz6
ccz6(2)=1.
ccz6(nzm-2)=1.
ccz6(nzm-1)=1.
if (nclz==0) ccz6(nzm)=1. + alcaiz6*alcaiz6
if (nclz==1) ccz6(nzm)=1. + alcaiz6
if (nclz==2) ccz6(nzm)=1. + alcaiz6
cbz6(1)=alcaiz6
cbz6(2)=alcaiz6
cbz6(nzm-2)=alcaiz6
cbz6(nzm-1)=alcaiz6
cbz6(nzm)=0.
do k=3,nzm-3
cfz6(k)=alcaiz6
ccz6(k)=1.
cbz6(k)=alcaiz6
enddo
cfi6z(1)=alcaiz6 + alcaiz6
cfi6z(2)=alcaiz6
cfi6z(nz-2)=alcaiz6
cfi6z(nz-1)=alcaiz6
cfi6z(nz)=0.
cci6z(1)=1.
cci6z(2)=1.
cci6z(nz-2)=1.
cci6z(nz-1)=1.
cci6z(nz)=1.
cbi6z(1)=alcaiz6
cbi6z(2)=alcaiz6
cbi6z(nz-2)=alcaiz6
cbi6z(nz-1)=alcaiz6 + alcaiz6
cbi6z(nz)=0.
do k=3,nz-3
cfi6z(k)=alcaiz6
cci6z(k)=1.
cbi6z(k)=alcaiz6
enddo
ailcaiz6=3./10.
aiciz6=1./128.*(75.+70.*ailcaiz6)
biciz6=1./256.*(126.*ailcaiz6-25.)
ciciz6=1./256.*(-10.*ailcaiz6+3.)
if (nrank==0) print *,'New coef Inter Z',aiciz6,biciz6,ciciz6
cifz6(1)=ailcaiz6
cifz6(2)=ailcaiz6
cifz6(nzm-2)=ailcaiz6
cifz6(nzm-1)=ailcaiz6
cifz6(nzm)=0.
if (nclz==0) cicz6(1)=2.
if (nclz==1) cicz6(1)=1. + ailcaiz6
if (nclz==2) cicz6(1)=1. + ailcaiz6
cicz6(2)=1.
cicz6(nzm-2)=1.
cicz6(nzm-1)=1.
if (nclz==0) cicz6(nzm)=1. + ailcaiz6*ailcaiz6
if (nclz==1) cicz6(nzm)=1. + ailcaiz6
if (nclz==2) cicz6(nzm)=1. + ailcaiz6
cibz6(1)=ailcaiz6
cibz6(2)=ailcaiz6
cibz6(nzm-2)=ailcaiz6
cibz6(nzm-1)=ailcaiz6
cibz6(nzm)=0.
do k=3,nzm-3
cifz6(k)=ailcaiz6
cicz6(k)=1.
cibz6(k)=ailcaiz6
enddo
cifi6z(1)=ailcaiz6 + ailcaiz6
cifi6z(2)=ailcaiz6
cifi6z(nz-2)=ailcaiz6
cifi6z(nz-1)=ailcaiz6
cifi6z(nz)=0.
cici6z(1)=1.
cici6z(2)=1.
cici6z(nz-2)=1.
cici6z(nz-1)=1.
cici6z(nz)=1.
cibi6z(1)=ailcaiz6
cibi6z(2)=ailcaiz6
cibi6z(nz-2)=ailcaiz6
cibi6z(nz-1)=ailcaiz6 + ailcaiz6
cibi6z(nz)=0.
do k=3,nz-3
cifi6z(k)=ailcaiz6
cici6z(k)=1.
cibi6z(k)=ailcaiz6
enddo
alfa1z= 2.
af1z =-(5./2. )/dz
bf1z = ( 2. )/dz
cf1z = (1./2. )/dz
df1z = 0.
alfa2z= 1./4.
af2z = (3./4. )/dz
alfanz= 2.
afnz =-(5./2. )/dz
bfnz = ( 2. )/dz
cfnz = (1./2. )/dz
dfnz = 0.
alfamz= 1./4.
afmz = (3./4. )/dz
alfakz= 1./3.
afkz = (7./9. )/dz
bfkz = (1./36. )/dz
alsa1z= 11.
as1z = (13. )/dz2
bs1z =-(27. )/dz2
cs1z = (15. )/dz2
ds1z =-(1. )/dz2
alsa2z= 1./10.
as2z = (6./5. )/dz2
alsa3z= 2./11.
as3z = (12./11.)/dz2
bs3z = (3./44. )/dz2
alsanz= 11.
asnz = (13. )/dz2
bsnz =-(27. )/dz2
csnz = (15. )/dz2
dsnz =-(1. )/dz2
alsamz= 1./10.
asmz = (6./5. )/dz2
alsatz= 2./11.
astz = (12./11.)/dz2
bstz = (3./44. )/dz2
! alsakz= 2./11.
! askz = (12./11.)/dz2
! bskz = (3./44. )/dz2
! cskz = 0.
alsakz=(45.*fpi2*pi*pi-272.)/(2.*(45.*fpi2*pi*pi-208.))
askz =((6.-9.*alsakz)/4.)/dz2
bskz =((-3.+24*alsakz)/5.)/(4.*dz2)
cskz =((2.-11.*alsakz)/20.)/(9.*dz2)
!if (nrank==0) then
! write(*,*) '=== derzz ==='
! write(*,*) alsakz
! write(*,*) askz*dz2
! write(*,*) bskz*4*dz2
! write(*,*) cskz*9*dz2
! write(*,*) '============='
!endif
#endif
if (nclx.eq.0) then
ffx(1) =alfaix
ffx(2) =alfaix
ffx(nx-2)=alfaix
ffx(nx-1)=alfaix
ffx(nx) =0.
fcx(1) =2.
fcx(2) =1.
fcx(nx-2)=1.
fcx(nx-1)=1.
fcx(nx )=1.+alfaix*alfaix
fbx(1) =alfaix
fbx(2) =alfaix
fbx(nx-2)=alfaix
fbx(nx-1)=alfaix
fbx(nx )=0.
do i=3,nx-3
ffx(i)=alfaix
fcx(i)=1.
fbx(i)=alfaix
enddo
endif
if (nclx.eq.1) then
ffx(1) =alfaix+alfaix
ffx(2) =alfaix
ffx(nx-2)=alfaix
ffx(nx-1)=alfaix
ffx(nx) =0.
fcx(1) =1.
fcx(2) =1.
fcx(nx-2)=1.
fcx(nx-1)=1.
fcx(nx )=1.
fbx(1) =alfaix
fbx(2) =alfaix
fbx(nx-2)=alfaix
fbx(nx-1)=alfaix+alfaix
fbx(nx )=0.
do i=3,nx-3
ffx(i)=alfaix
fcx(i)=1.
fbx(i)=alfaix
enddo
endif
if (nclx.eq.2) then
ffx(1) =alfa1x
ffx(2) =alfa2x
ffx(nx-2)=alfaix
ffx(nx-1)=alfamx
ffx(nx) =0.
fcx(1) =1.
fcx(2) =1.
fcx(nx-2)=1.
fcx(nx-1)=1.
fcx(nx )=1.
fbx(1) =alfa2x
fbx(2) =alfaix
fbx(nx-2)=alfamx
fbx(nx-1)=alfanx
fbx(nx )=0.
do i=3,nx-3
ffx(i)=alfaix
fcx(i)=1.
fbx(i)=alfaix
enddo
endif
if (ncly.eq.0) then
ffy(1) =alfajy
ffy(2) =alfajy
ffy(ny-2)=alfajy
ffy(ny-1)=alfajy
ffy(ny) =0.
fcy(1) =2.
fcy(2) =1.
fcy(ny-2)=1.
fcy(ny-1)=1.
fcy(ny )=1.+alfajy*alfajy
fby(1) =alfajy
fby(2) =alfajy
fby(ny-2)=alfajy
fby(ny-1)=alfajy
fby(ny )=0.
do j=3,ny-3
ffy(j)=alfajy
fcy(j)=1.
fby(j)=alfajy
enddo
endif
if (ncly.eq.1) then
ffy(1) =alfajy+alfajy
ffy(2) =alfajy
ffy(ny-2)=alfajy
ffy(ny-1)=alfajy
ffy(ny) =0.
fcy(1) =1.
fcy(2) =1.
fcy(ny-2)=1.
fcy(ny-1)=1.
fcy(ny )=1.
fby(1) =alfajy
fby(2) =alfajy
fby(ny-2)=alfajy
fby(ny-1)=alfajy+alfajy
fby(ny )=0.
do j=3,ny-3
ffy(j)=alfajy
fcy(j)=1.
fby(j)=alfajy
enddo
endif
if (ncly.eq.2) then
ffy(1) =alfa1y
ffy(2) =alfa2y
ffy(ny-2)=alfajy
ffy(ny-1)=alfamy
ffy(ny) =0.
fcy(1) =1.
fcy(2) =1.
fcy(ny-2)=1.
fcy(ny-1)=1.
fcy(ny )=1.
fby(1) =alfa2y
fby(2) =alfajy
fby(ny-2)=alfamy
fby(ny-1)=alfany
fby(ny )=0.
do j=3,ny-3
ffy(j)=alfajy
fcy(j)=1.
fby(j)=alfajy
enddo
endif
#ifndef TWOD
if (nclz.eq.0) then
ffz(1) =alfakz
ffz(2) =alfakz
ffz(nz-2)=alfakz
ffz(nz-1)=alfakz
ffz(nz) =0.
fcz(1) =2.
fcz(2) =1.
fcz(nz-2)=1.
fcz(nz-1)=1.
fcz(nz )=1.+alfakz*alfakz
fbz(1) =alfakz
fbz(2) =alfakz
fbz(nz-2)=alfakz
fbz(nz-1)=alfakz
fbz(nz )=0.
do k=3,nz-3
ffz(k)=alfakz
fcz(k)=1.
fbz(k)=alfakz
enddo
endif
if (nclz.eq.1) then
ffz(1) =alfakz+alfakz
ffz(2) =alfakz
ffz(nz-2)=alfakz
ffz(nz-1)=alfakz
ffz(nz) =0.
fcz(1) =1.
fcz(2) =1.
fcz(nz-2)=1.
fcz(nz-1)=1.
fcz(nz )=1.
fbz(1) =alfakz
fbz(2) =alfakz
fbz(nz-2)=alfakz
fbz(nz-1)=alfakz+alfakz
fbz(nz )=0.
do k=3,nz-3
ffz(k)=alfakz
fcz(k)=1.
fbz(k)=alfakz
enddo
endif
if (nclz.eq.2) then
ffz(1) =alfa1z
ffz(2) =alfa2z
ffz(nz-2)=alfakz
ffz(nz-1)=alfamz
ffz(nz) =0.
fcz(1) =1.
fcz(2) =1.
fcz(nz-2)=1.
fcz(nz-1)=1.
fcz(nz )=1.
fbz(1) =alfa2z
fbz(2) =alfakz
fbz(nz-2)=alfamz
fbz(nz-1)=alfanz
fbz(nz )=0.
do k=3,nz-3
ffz(k)=alfakz
fcz(k)=1.
fbz(k)=alfakz
enddo
endif
#endif
if (nclx.eq.0) then
sfx(1) =alsaix
sfx(2) =alsaix
sfx(nx-2)=alsaix
sfx(nx-1)=alsaix
sfx(nx) =0.
scx(1) =2.
scx(2) =1.
scx(nx-2)=1.
scx(nx-1)=1.
scx(nx )=1.+alsaix*alsaix
sbx(1) =alsaix
sbx(2) =alsaix
sbx(nx-2)=alsaix
sbx(nx-1)=alsaix
sbx(nx )=0.
do i=3,nx-3
sfx(i)=alsaix
scx(i)=1.
sbx(i)=alsaix
enddo
endif
if (nclx.eq.1) then
sfx(1) =alsaix+alsaix
sfx(2) =alsaix
sfx(nx-2)=alsaix
sfx(nx-1)=alsaix
sfx(nx) =0.
scx(1) =1.
scx(2) =1.
scx(nx-2)=1.
scx(nx-1)=1.
scx(nx )=1.
sbx(1) =alsaix
sbx(2) =alsaix
sbx(nx-2)=alsaix
sbx(nx-1)=alsaix+alsaix
sbx(nx )=0.
do i=3,nx-3
sfx(i)=alsaix
scx(i)=1.
sbx(i)=alsaix
enddo
endif
if (nclx.eq.2) then
sfx(1) =alsa1x
sfx(2) =alsa2x
sfx(3) =alsa3x
sfx(nx-3)=alsaix
sfx(nx-2)=alsatx
sfx(nx-1)=alsamx
sfx(nx) =0.
scx(1) =1.
scx(2) =1.
scx(3) =1.
scx(nx-3)=1.
scx(nx-2)=1.
scx(nx-1)=1.
scx(nx )=1.
sbx(1) =alsa2x
sbx(2) =alsa3x
sbx(3) =alsaix
sbx(nx-3)=alsatx
sbx(nx-2)=alsamx
sbx(nx-1)=alsanx
sbx(nx )=0.
do i=4,nx-4
sfx(i)=alsaix
scx(i)=1.
sbx(i)=alsaix
enddo
endif
if (ncly.eq.0) then
sfy(1) =alsajy
sfy(2) =alsajy
sfy(ny-2)=alsajy
sfy(ny-1)=alsajy
sfy(ny) =0.
scy(1) =2.
scy(2) =1.
scy(ny-2)=1.
scy(ny-1)=1.
scy(ny )=1.+alsajy*alsajy
sby(1) =alsajy
sby(2) =alsajy
sby(ny-2)=alsajy
sby(ny-1)=alsajy
sby(ny )=0.
do j=3,ny-3
sfy(j)=alsajy
scy(j)=1.
sby(j)=alsajy
enddo
endif
if (ncly.eq.1) then
sfy(1) =alsajy+alsajy
sfy(2) =alsajy
sfy(ny-2)=alsajy
sfy(ny-1)=alsajy
sfy(ny) =0.
scy(1) =1.
scy(2) =1.
scy(ny-2)=1.
scy(ny-1)=1.
scy(ny )=1.
sby(1) =alsajy
sby(2) =alsajy
sby(ny-2)=alsajy
sby(ny-1)=alsajy+alsajy
sby(ny )=0.
do j=3,ny-3
sfy(j)=alsajy
scy(j)=1.
sby(j)=alsajy
enddo
endif
if (ncly.eq.2) then
sfy(1) =alsa1y
sfy(2) =alsa2y
sfy(3) =alsa3y
sfy(ny-3)=alsajy
sfy(ny-2)=alsaty
sfy(ny-1)=alsamy
sfy(ny) =0.
scy(1) =1.
scy(2) =1.
scy(3) =1.
scy(ny-3)=1.
scy(ny-2)=1.
scy(ny-1)=1.
scy(ny )=1.
sby(1) =alsa2y
sby(2) =alsa3y
sby(3) =alsajy
sby(ny-3)=alsaty
sby(ny-2)=alsamy
sby(ny-1)=alsany
sby(ny )=0.
do j=4,ny-4
sfy(j)=alsajy
scy(j)=1.
sby(j)=alsajy
enddo
endif
#ifndef TWOD
if (nclz.eq.0) then
sfz(1) =alsakz
sfz(2) =alsakz
sfz(nz-2)=alsakz
sfz(nz-1)=alsakz
sfz(nz) =0.
scz(1) =2.
scz(2) =1.
scz(nz-2)=1.
scz(nz-1)=1.
scz(nz )=1.+alsakz*alsakz
sbz(1) =alsakz
sbz(2) =alsakz
sbz(nz-2)=alsakz
sbz(nz-1)=alsakz
sbz(nz )=0.
do k=3,nz-3
sfz(k)=alsakz
scz(k)=1.
sbz(k)=alsakz
enddo
endif
if (nclz.eq.1) then
sfz(1) =alsakz+alsakz
sfz(2) =alsakz
sfz(nz-2)=alsakz
sfz(nz-1)=alsakz
sfz(nz) =0.
scz(1) =1.
scz(2) =1.
scz(nz-2)=1.
scz(nz-1)=1.
scz(nz )=1.
sbz(1) =alsakz
sbz(2) =alsakz
sbz(nz-2)=alsakz
sbz(nz-1)=alsakz+alsakz
sbz(nz )=0.
do k=3,nz-3
sfz(k)=alsakz
scz(k)=1.
sbz(k)=alsakz
enddo
endif
if (nclz.eq.2) then
sfz(1) =alsa1z
sfz(2) =alsa2z
sfz(3) =alsa3z
sfz(nz-3)=alsakz
sfz(nz-2)=alsatz
sfz(nz-1)=alsamz
sfz(nz) =0.
scz(1) =1.
scz(2) =1.
scz(3) =1.
scz(nz-3)=1.
scz(nz-2)=1.
scz(nz-1)=1.
scz(nz )=1.
sbz(1) =alsa2z
sbz(2) =alsa3z
sbz(3) =alsakz
sbz(nz-3)=alsatz
sbz(nz-2)=alsamz
sbz(nz-1)=alsanz
sbz(nz )=0.
do k=4,nz-4
sfz(k)=alsakz
scz(k)=1.
sbz(k)=alsakz
enddo
endif
#endif
do i=1,nx
ffxp(i)=ffx(i)
sfxp(i)=sfx(i)
enddo
do i=1,nxm
cfxp6(i)=cfx6(i)
cifxp6(i)=cifx6(i)
enddo
do i=1,nx
cifip6(i)=cifi6(i)
cfip6(i)=cfi6(i)
enddo
do j=1,ny
ffyp(j)=ffy(j)
sfyp(j)=sfy(j)
enddo
do j=1,nym
cfyp6(j)=cfy6(j)
cifyp6(j)=cify6(j)
enddo
do j=1,ny
cifip6y(j)=cifi6y(j)
cfip6y(j)=cfi6y(j)
enddo
#ifndef TWOD
do k=1,nz
ffzp(k)=ffz(k)
sfzp(k)=sfz(k)
enddo
do k=1,nzm
cfzp6(k)=cfz6(k)
cifzp6(k)=cifz6(k)
enddo
do k=1,nz
cifip6z(k)=cifi6z(k)
cfip6z(k)=cfi6z(k)
enddo
#endif
if (nclx.eq.1) then
ffxp(1)=0.
sfx (1)=0.
endif
if (ncly.eq.1) then
ffyp(1)=0.
sfy (1)=0.
endif
cfxp6(1)=0.
cfip6(1)=0.
cfyp6(1)=0.
cfip6y(1)=0.