-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpfield2mod.f
1860 lines (1859 loc) · 66.4 KB
/
pfield2mod.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
!-----------------------------------------------------------------------
!
module pfield2d
!
! Fortran90 interface to 2d parallel PIC Fortran77 library pfield2lib.f
! pfield2mod.f contains procedures to manage guard cells and solve
! fields in fourier space:
! defines module pfield2d
! cguard => ipcguard2x copies guard cells in x for non-uniform,
! periodic 2d vector data.
! calls PCGUARD2X, PBGUARD2X, PDGUARD2X, PCGUARD2XL,
! PBGUARD2XL, or PDGUARD2XL
! cguard => ipdguard2x copies guard cells in x for non-uniform,
! periodic 2d scalar data.
! calls PDGUARD2X, or PDGUARD2XL
! sguard => ipsguard2 initialize field for scalar array with various
! interpolations.
! calls PSGUARD2, or PSGUARD2L
! sguard => ipscguard2 initialize field for 2 or 3 component vector
! array with various interpolations.
! calls PSCGUARD2, PSCGUARD22, PSCGUARD2L, or PSCGUARD22L
! sguard => ipsfguard2 initialize 2 or 3 component field with scaled
! vector array with various interpolations.
! calls PSCFGUARD2, PSCFGUARD22, PSCFGUARD2L, or PSCFGUARD22L
! sguard => ipsmcguard2 initialize 2d tensor field with various
! interpolations.
! calls PSMCGUARD2, PSMCGUARD22, PSMCGUARD2L, or PSMCGUARD22L
! aguard => ipaguard2x adds guard cells in x for non-uniform, periodic
! 2d scalar data, with various interpolations.
! calls PAGUARD2X, or PAGUARD2XL
! aguard => ipacguard2x adds guard cells in x for non-uniform, periodic
! 2d vector data, with various interpolations.
! calls PACGUARD2X, PACGUARD22X, PACGUARD2XL, or PACGUARD22XL
! amcguard => ipamcguard2x adds guard cells in x for for non-uniform,
! periodic 2d tensor field, with various interpolations.
! calls PAMCGUARD2X, or PAMCGUARD2XL
! zguard => ipzguard2 zeros out guard cells in periodic 2d scalar field.
! calls PZGUARD2, or PZGUARD2L
! pois_init => ippois22init initializes tables for field solvers.
! calls PPOIS22
! pois => ippois2 solves poisson equation for electric force, potential,
! or smoothing.
! calls PPOISP2
! pois => ippois22 solves 2d poisson equation for electric force.
! calls PPOIS22
! spois => ipspois2 smoother for 2d periodic scalar field.
! calls PPOISP2
! pois3 => ippois23 solves 2-1/2d poisson equation for electric force.
! calls PPOIS22, or PPOIS23
! cuperp => ipcuperp2 calculates the transverse part of periodic 2-1/2d
! vector field.
! calls PCUPERP2, or PCUPERP22
! bpois => jpbpois23 solves 2-1/2d vector poisson equation for magnetic
! force.
! calls PBPOISP23, or PBPOISP22
! sbpois => ipsbpois23 smoother for 2-1/2d periodic vector field.
! calls PBPOISP23, or PBPOISP22
! apois => ipapois23 solves 2-1/2d vector poisson equation for vector
! potential.
! calls PBPOISP23, or PBPOISP22
! ibpois => iipbpois23 solves vector poisson equation for magnetic field
! calls IPBPOISP23
! maxwel => ipmaxwel2 solves maxwell equation for electric and magnetic
! fields.
! calls PMAXWEL2
! emfield => ipemfield2 calculates periodic electric and magnetic forces
! from fields given by maxwell and poisson equations.
! calls PEMFIELD2
! emfieldr => ipemfieldr2 calculates electric and magnetic forces from
! fields given by maxwell and poisson equations for
! sine-cosine transforms.
! calls PEMFIELDR2
! avpot => ipavpot23 calculates vector potential from magnetic field.
! calls PAVPOT23
! avrpot => ipavrpot23 calculates radiative vector potential from
! magnetic field and current.
! calls PAVRPOT23
! gtmodes => ipgtmodes2 extracts selected fourier components from
! potential array.
! calls PGTMODES2
! gtmodes => ipgtvmodes2 extracts selected fourier components from
! vector potential array.
! calls PGTVMODES2
! ptmodes => ipptmodes2 places selected fourier components into potential
! array.
! calls PPTMODES2
! ptmodes => ipptvmodes2 places selected fourier components into vector
! potential array.
! calls PPTVMODES2
! poynt => ippoynt2 calculates the momentum in the electromagnetic field
! calls PPOYNT2
! poynt => ipdpoynt2 calculates the momentum in the darwin field.
! calls PDPOYNT2, or PDPOYNT22
! dcuperp => ipdcuperp23 calculate transverse derivative of 2-1/2d
! current density from momentum flux.
! calls PDCUPERP23, or PDCUPERP22
! adcuperp => ipadcuperp23 calculate transverse derivative of 2-1/2d
! current density from momentum flux and acceleration
! density.
! calls PADCUPERP23, or PADCUPERP22
! epois_init => ipepois23init initializes tables for darwin field solver
! calls PEPOISP23
! epois => ipepois23 solves 2-1/2d vector vector poisson equation for
! transverse electric force.
! calls PEPOISP23, or PEPOISP22
! iepois => iipepois23 solves 2-1/2d vector vector poisson equation for
! transverse electric field.
! calls PEPOISP23, or PEPOISP22
! addqei => ipaddqei2 adds electron and ion densities.
! calls PADDQEI2
! addqei => ipaddqei2x adds electron and ion densities, and calculates
! maximum and minimum plasma frequency.
! calls PADDQEI2X
! baddext => ipbaddext2 adds constant to magnetic field in real space for
! 2-1/2d code.
! calls PBADDEXT2, or PBADDEXT22
! imoment => ipimoment2 calculates ion momentum from integral of qi*fxy.
! calls PIMOMENT2, or PIMOMENT22
! addfields => ipaddvrfield2 calculates a = b + c for distributed real
! vector fields.
! calls PADDVRFIELD2
! written by viktor k. decyk, ucla
! copyright 2000, regents of the university of california
! update: november 15, 2009
!
use globals, only: LINEAR, QUADRATIC
use p0d, only: wtimer
implicit none
private
public :: LINEAR, QUADRATIC
public :: PSCGUARD2, PSGUARD2, PSCGUARD2L, PSGUARD2L
public :: PACGUARD2X, PAGUARD2X, PACGUARD2XL, PAGUARD2XL
public :: cguard, bguard, sguard, aguard, zguard
public :: pois_init, pois, spois, pois3, cuperp, bpois, sbpois
public :: ibpois, maxwel, emfield, emfieldr, apois, avpot, avrpot
public :: gtmodes, ptmodes, poynt
public :: amcguard, dcuperp, adcuperp, epois_init, epois, iepois
public :: addqei, baddext
public :: imoment, ipdivf2, ipgradf2, ipcurlf2, ipcurlf22
public :: addfields
!
! define interface to original Fortran77 procedures
!
interface
subroutine PCGUARD2X(fxy,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: fxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PDGUARD2X(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PBGUARD2X(bxy,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: bxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCGUARD2(cu,nyp,xj0,yj0,zj0,nx,nxe,nypmx,nblok)
implicit none
real :: xj0, yj0, zj0
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCGUARD22(cu,nyp,xj0,yj0,nx,nxe,nypmx,nblok)
implicit none
real :: xj0, yj0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSGUARD2(q,nyp,qi0,nx,nxe,nypmx,nblok)
implicit none
real :: qi0
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PACGUARD2X(cu,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PACGUARD22X(cu,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PAGUARD2X(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PZGUARD2(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PCGUARD2XL(fxy,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: fxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PDGUARD2XL(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PBGUARD2XL(bxy,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: bxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCGUARD2L(cu,nyp,xj0,yj0,zj0,nx,nxe,nypmx,nblok)
implicit none
real :: xj0, yj0, zj0
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCGUARD22L(cu,nyp,xj0,yj0,nx,nxe,nypmx,nblok)
implicit none
real :: xj0, yj0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSGUARD2L(q,nyp,qi0,nx,nxe,nypmx,nblok)
implicit none
real :: qi0
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PACGUARD2XL(cu,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PACGUARD22XL(cu,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PAGUARD2XL(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PZGUARD2L(q,nyp,nx,nxe,nypmx,nblok)
implicit none
integer nx, nxe, nypmx, nblok
real, dimension(nxe,nypmx,nblok) :: q
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PPOISP2(q,fx,fy,isign,ffc,ax,ay,affp,we,nx,ny,kstrt,&
&nyv,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, we
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q, fx, fy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PPOIS22(q,fxy,isign,ffc,ax,ay,affp,we,nx,ny,kstrt,ny&
&v,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, we
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q
complex, dimension(2,nyv,kxp,jblok) :: fxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PPOIS23(q,fxy,isign,ffc,ax,ay,affp,we,nx,ny,kstrt,ny&
&v,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, we
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q
complex, dimension(2,nyv,kxp,jblok) :: fxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PDIVF2(f,df,nx,ny,kstrt,ndim,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, ndim, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: f
complex, dimension(nyv,kxp,jblok) :: df
end subroutine
end interface
interface
subroutine PGRADF2(df,f,nx,ny,kstrt,ndim,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, ndim, nyv, kxp, jblok
complex, dimension(nyv,kxp,jblok) :: df
complex, dimension(3,nyv,kxp,jblok) :: f
end subroutine
end interface
interface
subroutine PCURLF2(f,g,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: f, g
end subroutine
end interface
interface
subroutine PCURLF22(f,g,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(2,nyv,kxp,jblok) :: f
complex, dimension(nyv,kxp,jblok) :: g
end subroutine
end interface
interface
subroutine PCUPERP2(cu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: cu
end subroutine
end interface
interface
subroutine PCUPERP22(cu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(2,nyv,kxp,jblok) :: cu
end subroutine
end interface
interface
subroutine PBPOISP23(cu,bxy,isign,ffc,ax,ay,affp,ci,wm,nx,ny,ks&
&trt,nyv,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, ci, wm
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(3,nyv,kxp,jblok) :: cu
complex, dimension(3,nyv,kxp,jblok) :: bxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PBPOISP22(cu,bxy,bz,isign,ffc,ax,ay,affp,ci,wm,nx,ny&
&,kstrt,nyv,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, ci, wm
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(2,nyv,kxp,jblok) :: cu
complex, dimension(2,nyv,kxp,jblok) :: bxy
complex, dimension(nyv,kxp,jblok) :: bz
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine IPBPOISP23(cu,bxy,ffc,ci,wm,nx,ny,kstrt,nyv,kxp,jblo&
&k,nyhd)
implicit none
real :: ci, wm
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(3,nyv,kxp,jblok) :: cu
complex, dimension(3,nyv,kxp,jblok) :: bxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PMAXWEL2(exy,bxy,cu,ffc,affp,ci,dt,wf,wm,nx,ny,kstrt&
&,nyv,kxp,jblok,nyhd)
implicit none
real :: affp, ci, dt, wf, wm
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(3,nyv,kxp,jblok) :: exy, bxy, cu
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PEMFIELD2(fxy,exy,ffc,isign,nx,ny,kstrt,nyv,kxp,jblo&
&k,nyhd)
implicit none
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(3,nyv,kxp,jblok) :: fxy, exy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PEMFIELDR2(fxy,exy,ffd,isign,nx,ny,kstrt,nyv,kxp2,j2&
&blok,nyd)
implicit none
integer :: isign, nx, ny, kstrt, nyv, kxp2, j2blok, nyd
real, dimension(3,nyv,kxp2+1,j2blok) :: fxy, exy
complex, dimension(nyd,kxp2,j2blok) :: ffd
end subroutine
end interface
interface
subroutine PAVPOT23(bxy,axy,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: bxy, axy
end subroutine
end interface
interface
subroutine PAVRPOT23(axy,bxy,ffc,affp,ci,nx,ny,kstrt,nyv,kxp,jb&
&lok,nyhd)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
real :: affp, ci
complex, dimension(3,nyv,kxp,jblok) :: axy, bxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PGTMODES2(pot,pott,nx,ny,it,modesx,modesy,kstrt,nyv,&
&kxp,jblok,nt,modesxpd,modesyd)
implicit none
integer :: nx, ny, it, modesx, modesy, kstrt, nyv, kxp, jblok
integer :: nt, modesxpd, modesyd
complex, dimension(nyv,kxp,jblok) :: pot
complex, dimension(nt,modesyd,modesxpd,jblok) :: pott
end subroutine
end interface
interface
subroutine PPTMODES2(pot,pott,nx,ny,it,modesx,modesy,kstrt,nyv,&
&kxp,jblok,nt,modesxpd,modesyd)
implicit none
integer :: nx, ny, it, modesx, modesy, kstrt, nyv, kxp, jblok
integer :: nt, modesxpd, modesyd
complex, dimension(nyv,kxp,jblok) :: pot
complex, dimension(nt,modesyd,modesxpd,jblok) :: pott
end subroutine
end interface
interface
subroutine PGTVMODES2(vpot,vpott,nx,ny,it,modesx,modesy,ndim,ks&
&trt,nyv,kxp,jblok,nt,modesxpd,modesyd)
implicit none
integer :: nx, ny, it, modesx, modesy, ndim, kstrt, nyv, kxp
integer :: jblok, nt, modesxpd, modesyd
complex, dimension(ndim,nyv,kxp,jblok) :: vpot
complex, dimension(nt,ndim,modesyd,modesxpd,jblok) :: vpott
end subroutine
end interface
interface
subroutine PPTVMODES2(vpot,vpott,nx,ny,it,modesx,modesy,ndim,ks&
&trt,nyv,kxp,jblok,nt,modesxpd,modesyd)
implicit none
integer :: nx, ny, it, modesx, modesy, ndim, kstrt, nyv, kxp
integer :: jblok, nt, modesxpd, modesyd
complex, dimension(ndim,nyv,kxp,jblok) :: vpot
complex, dimension(nt,ndim,modesyd,modesxpd,jblok) :: vpott
end subroutine
end interface
interface
subroutine PPOYNT2(q,exy,bxy,ffc,affp,sx,sy,sz,nx,ny,kstrt,nyv,&
&kxp,jblok,nyhd)
implicit none
real :: affp, sx, sy, sz
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q
complex, dimension(3,nyv,kxp,jblok) :: exy, bxy
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PDPOYNT2(q,cu,ffc,affp,ci,sx,sy,sz,nx,ny,kstrt,nyv,k&
&xp,jblok,nyhd)
implicit none
real :: affp, ci, sx, sy, sz
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q
complex, dimension(3,nyv,kxp,jblok) :: cu
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PDPOYNT22(q,cu,ffc,affp,ci,sx,sy,nx,ny,kstrt,nyv,kxp&
&,jblok,nyhd)
implicit none
real :: affp, ci, sx, sy
integer :: nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(nyv,kxp,jblok) :: q
complex, dimension(2,nyv,kxp,jblok) :: cu
complex, dimension(nyhd,kxp,jblok) :: ffc
end subroutine
end interface
interface
subroutine PSCFGUARD2(cus,cu,nyp,q2m0,nx,nxe,nypmx,nblok)
implicit none
real :: q2m0
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cus, cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCFGUARD22(cus,cu,nyp,q2m0,nx,nxe,nypmx,nblok)
implicit none
real :: q2m0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cus, cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSMCGUARD2(amu,nyp,x2y2m0,xym0,zxm0,zym0,nx,nxe,nypm&
&x,nblok)
implicit none
real :: x2y2m0, xym0, zxm0, zym0
integer nx, nxe, nypmx, nblok
real, dimension(4,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSMCGUARD22(amu,nyp,x2y2m0,xym0,nx,nxe,nypmx,nblok)
implicit none
real :: x2y2m0, xym0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PAMCGUARD2X(amu,nyp,nx,nxe,nypmx,nblok,ndim)
implicit none
integer nx, nxe, nypmx, nblok, ndim
real, dimension(ndim,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCFGUARD2L(cus,cu,nyp,q2m0,nx,nxe,nypmx,nblok)
implicit none
real :: q2m0
integer nx, nxe, nypmx, nblok
real, dimension(3,nxe,nypmx,nblok) :: cus, cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSCFGUARD22L(cus,cu,nyp,q2m0,nx,nxe,nypmx,nblok)
implicit none
real :: q2m0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: cus, cu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSMCGUARD2L(amu,nyp,x2y2m0,xym0,zxm0,zym0,nx,nxe,nyp&
&mx,nblok)
implicit none
real :: x2y2m0, xym0, zxm0, zym0
integer nx, nxe, nypmx, nblok
real, dimension(4,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PSMCGUARD22L(amu,nyp,x2y2m0,xym0,nx,nxe,nypmx,nblok)
implicit none
real :: x2y2m0, xym0
integer nx, nxe, nypmx, nblok
real, dimension(2,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PAMCGUARD2XL(amu,nyp,nx,nxe,nypmx,nblok,ndim)
implicit none
integer nx, nxe, nypmx, nblok, ndim
real, dimension(ndim,nxe,nypmx,nblok) :: amu
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PDCUPERP22(dcu,amu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(2,nyv,kxp,jblok) :: dcu
complex, dimension(2,nyv,kxp,jblok) :: amu
end subroutine
end interface
interface
subroutine PADCUPERP23(dcu,amu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: dcu
complex, dimension(4,nyv,kxp,jblok) :: amu
end subroutine
end interface
interface
subroutine PADCUPERP22(dcu,amu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(2,nyv,kxp,jblok) :: dcu
complex, dimension(2,nyv,kxp,jblok) :: amu
end subroutine
end interface
interface
subroutine PDCUPERP23(dcu,amu,nx,ny,kstrt,nyv,kxp,jblok)
implicit none
integer :: nx, ny, kstrt, nyv, kxp, jblok
complex, dimension(3,nyv,kxp,jblok) :: dcu
complex, dimension(4,nyv,kxp,jblok) :: amu
end subroutine
end interface
interface
subroutine PEPOISP23(dcu,exy,isign,ffe,ax,ay,affp,wp0,ci,wf,nx,&
&ny,kstrt,nyv,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, wp0, ci, wf
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(3,nyv,kxp,jblok) :: dcu, exy
complex, dimension(nyhd,kxp,jblok) :: ffe
end subroutine
end interface
interface
subroutine PEPOISP22(dcu,exy,isign,ffe,ax,ay,affp,wp0,ci,wf,nx,&
&ny,kstrt,nyv,kxp,jblok,nyhd)
implicit none
real :: ax, ay, affp, wp0, ci, wf
integer :: isign, nx, ny, kstrt, nyv, kxp, jblok, nyhd
complex, dimension(2,nyv,kxp,jblok) :: dcu, exy
complex, dimension(nyhd,kxp,jblok) :: ffe
end subroutine
end interface
interface
subroutine PADDQEI2(qe,qi,nyp,nx,nxe,nypmx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
! real, dimension(*) :: qe, qi
real :: qe, qi
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PADDQEI2X(qe,qi,nyp,qbme,qbmi,wpmax,wpmin,nx,nxe,nyp&
&mx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
real :: qbme, qbmi ,wpmax, wpmin
! real, dimension(*) :: qe, qi
real :: qe, qi
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PBADDEXT2(bxy,nyp,omx,omy,omz,nx,nxe,nypmx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
real :: omx, omy, omz
! real, dimension(*) :: bxy
real :: bxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PBADDEXT22(bz,nyp,omz,nx,nxe,nypmx,nblok)
implicit none
integer :: nx, nxe, nypmx, nblok
real :: omz
! real, dimension(*) :: bz
real :: bz
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PIMOMENT2(qi,fxy,nyp,pxi,pyi,pzi,dt,nx,nxe,nypmx,nbl&
&ok)
implicit none
integer :: nx, nxe, nypmx, nblok
real :: pxi, pyi, pzi, dt
! real, dimension(*) :: qi
! real, dimension(*) :: fxy
real :: qi, fxy
integer, dimension(nblok) :: nyp
end subroutine
end interface
interface
subroutine PADDVRFIELD2(a,b,c,ndim,nxe,nypmx,nblok)
implicit none
integer :: ndim, nxe, nypmx, nblok
real, dimension(ndim,nxe,nypmx,nblok) :: a, b, c
end subroutine
end interface
!
! define generic interfaces to Fortran90 library
!
interface cguard
module procedure ipcguard2x
module procedure ipdguard2x
end interface
!
interface bguard
module procedure ipbguard2x
end interface
!
interface sguard
module procedure ipscguard2
module procedure ipsguard2
module procedure ipsfguard2
module procedure ipsmcguard2
end interface
!
interface aguard
module procedure ipacguard2x
module procedure ipaguard2x
end interface
!
interface zguard
module procedure ipzguard2
end interface
!
interface pois_init
module procedure ippois22init
end interface
!
interface pois
module procedure ippois2
module procedure ippois22
end interface
!
interface spois
module procedure ipspois2
end interface
!
interface pois3
module procedure ippois23
end interface
!
interface cuperp
module procedure ipcuperp2
end interface
!
interface bpois
module procedure jpbpois23
end interface
!
interface sbpois
module procedure ipsbpois23
end interface
!
interface apois
module procedure ipapois23
end interface
!
interface ibpois
module procedure iipbpois23
end interface
!
interface maxwel
module procedure ipmaxwel2
end interface
!
interface emfield
module procedure ipemfield2
end interface
!
interface emfieldr
module procedure ipemfieldr2
end interface
!
interface avpot
module procedure ipavpot23
end interface
!
interface avrpot
module procedure ipavrpot23
end interface
!
interface gtmodes
module procedure ipgtmodes2
module procedure ipgtvmodes2
end interface
!
interface ptmodes
module procedure ipptmodes2
module procedure ipptvmodes2
end interface
!
interface poynt
module procedure ippoynt2
module procedure ipdpoynt2
end interface
!
interface amcguard
module procedure ipamcguard2x
end interface
!
interface dcuperp
module procedure ipdcuperp23
end interface
!
interface adcuperp
module procedure ipadcuperp23
end interface
!
interface epois_init
module procedure ipepois23init
end interface
!
interface epois
module procedure ipepois23
end interface
!
interface iepois
module procedure iipepois23
end interface
!
interface addqei
module procedure ipaddqei2
module procedure ipaddqei2x
end interface
!
interface baddext
module procedure ipbaddext2
end interface
!
interface imoment
module procedure ipimoment2
end interface
!
interface addfields
module procedure ipaddvrfield2
end interface
!
! define Fortran90 interface functions to Fortran77 library
!
contains
!
subroutine ipcguard2x(fxy,nyp,nx,inorder)
! copy guard cells in x for non-uniform, periodic 2d vector data
implicit none
integer :: nx
integer, optional :: inorder
real, dimension(:,:,:,:), pointer :: fxy
integer, dimension(:), pointer :: nyp
! local data
integer :: nxe, nypmx, nblok, order
nxe = size(fxy,2); nypmx = size(fxy,3); nblok = size(fxy,4)
order = QUADRATIC
if (present(inorder)) order = inorder
select case(size(fxy,1))
case (1)
if (order==LINEAR) then
call PDGUARD2XL(fxy,nyp,nx,nxe,nypmx,nblok)
else
call PDGUARD2X(fxy,nyp,nx,nxe,nypmx,nblok)
endif
case (2)
if (order==LINEAR) then
call PCGUARD2XL(fxy,nyp,nx,nxe,nypmx,nblok)
else
call PCGUARD2X(fxy,nyp,nx,nxe,nypmx,nblok)
endif
case (3)
if (order==LINEAR) then
call PBGUARD2XL(fxy,nyp,nx,nxe,nypmx,nblok)
else
call PBGUARD2X(fxy,nyp,nx,nxe,nypmx,nblok)
endif
end select
end subroutine ipcguard2x
!
subroutine ipdguard2x(q,nyp,nx,inorder)
! copy guard cells in x for non-uniform, periodic 2d scalar data
implicit none
integer :: nx
integer, optional :: inorder
real, dimension(:,:,:), pointer :: q
integer, dimension(:), pointer :: nyp
! local data
integer :: nxe, nypmx, nblok, order
nxe = size(q,1); nypmx = size(q,2); nblok = size(q,3)
order = QUADRATIC
if (present(inorder)) order = inorder
if (order==LINEAR) then
call PDGUARD2XL(q,nyp,nx,nxe,nypmx,nblok)
else
call PDGUARD2X(q,nyp,nx,nxe,nypmx,nblok)
endif
end subroutine ipdguard2x
!
subroutine ipbguard2x(bxy,nyp,nx,inorder)
! copy guard cells in x for non-uniform, periodic 2d vector data
implicit none
integer :: nx
integer, optional :: inorder
real, dimension(:,:,:,:), pointer :: bxy
integer, dimension(:), pointer :: nyp
! local data
integer :: nxe, nypmx, nblok, order
nxe = size(bxy,2); nypmx = size(bxy,3); nblok = size(bxy,4)
order = QUADRATIC
if (present(inorder)) order = inorder
if (order==LINEAR) then
call PBGUARD2XL(bxy,nyp,nx,nxe,nypmx,nblok)
else
call PBGUARD2X(bxy,nyp,nx,nxe,nypmx,nblok)
endif
end subroutine ipbguard2x
!
subroutine ipscguard2(cu,nyp,xj0,yj0,zj0,nx,inorder)
! initialize periodic 2d vector field
implicit none
integer :: nx
integer, optional :: inorder
real :: xj0, yj0, zj0
real, dimension(:,:,:,:), pointer :: cu
integer, dimension(:), pointer :: nyp
! local data
integer :: nxe, nypmx, nblok, order
nxe = size(cu,2); nypmx = size(cu,3); nblok = size(cu,4)
order = QUADRATIC
if (present(inorder)) order = inorder
select case(size(cu,1))
case (2)
if (order==LINEAR) then
call PSCGUARD22L(cu,nyp,xj0,yj0,nx,nxe,nypmx,nblok)
else
call PSCGUARD22(cu,nyp,xj0,yj0,nx,nxe,nypmx,nblok)
endif
case (3)
if (order==LINEAR) then
call PSCGUARD2L(cu,nyp,xj0,yj0,zj0,nx,nxe,nypmx,nblok)
else
call PSCGUARD2(cu,nyp,xj0,yj0,zj0,nx,nxe,nypmx,nblok)
endif
end select
end subroutine ipscguard2
!
subroutine ipsguard2(q,nyp,qi0,nx,inorder)
! initialize periodic 2d scalar field
implicit none
integer :: nx
integer, optional :: inorder
real :: qi0
real, dimension(:,:,:), pointer :: q
integer, dimension(:), pointer :: nyp
! local data
integer :: nxe, nypmx, nblok, order
nxe = size(q,1); nypmx = size(q,2); nblok = size(q,3)
order = QUADRATIC
if (present(inorder)) order = inorder
if (order==LINEAR) then
call PSGUARD2L(q,nyp,qi0,nx,nxe,nypmx,nblok)