forked from GAmfe/genray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadj_real8.f
1761 lines (1697 loc) · 46.7 KB
/
adj_real8.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
CBH Notes: Sept, 2002
C Search for "e-16" to find points where precision
C was changed to "e-8", for purposes of getting code
C running at 32-bit precision.
C WASN'T ABLE TO GET THIS WORKING (GOT some NaN).
C Should revert to e-16 for double precision.
CBH Used replace real*8 real*8 < adj_cft_bh.f > adj_real8_bh.f
CBH replaced 1.e-8 with 1.d-16 by hand.
C FTANGLE v1.53, created with UNIX on "Saturday, September 23, 1995 at 12:43."
C COMMAND LINE: "ftangle -mCRAY -=n=#.cft -=c=/dev/null adj"
C RUN TIME: "Monday, March 4, 1996 at 11:45."
C WEB FILE: "adj.web"
C CHANGE FILE: (none)
C* 14: *
*line 477 "adj.web"
program adjoint
implicit none
integer nmax,imax,kmax,tmax,lmax,tskip
real*8 t,c2,ze,zi,eps,psivar,kappa,ipola,umax,dt,alpha,rho
real*8 cpu,cpu0
cSm020909
c external operinit,second,runa
external operinit,runa
C* :14 *
C* 14: *
*line 490 "adj.web"
call operinit
write(6,*)'Enter '//'psivar,kappa,ipola'
C* :14 *
C* 14: *
*line 501 "adj.web"
read(5,*,end=90001)psivar,kappa,ipola
if(int(psivar+0.5d0).EQ.2)then
ipola=8*atan(1.0d0)*29.1d0
end if
90000 continue
write(6,*)'Enter t,c2,ze,zi,eps,nmax,umax,imax,kmax,dt,tmax,alpha,
&rho,lmax'
C* :14 *
C* 14: *
*line 518 "adj.web"
read(5,*,end=90001)t,c2,ze,zi,eps,nmax,umax,imax,kmax,dt,tmax,alph
&a,rho,lmax
if(t.LE.0.OR.c2.LE.0)goto 90001
write(6,*)t,c2,ze,zi,eps,nmax,umax,imax,kmax,dt,tmax,alpha,rho,lma
&x
write(6,*)psivar,kappa,ipola
tskip=10
cSm020909
c call second(cpu0)
call runa(t,c2,ze,zi,eps,psivar,kappa,ipola,nmax,umax,imax,kmax,dt
&,tmax,alpha,rho,lmax,tskip)
cSm020909
c call second(cpu)
c write(6,'(1x,a,f10.2,a)')'CPU time: ',cpu-cpu0,' secs'
goto 90000
90001 continue
stop
end
C* 15: *
*line 553 "adj.web"
C* :15 *
C* 15: *
*line 568 "adj.web"
C* :15 *
C* 16: *
*line 571 "adj.web"
C* :16 *
C* 16: *
*line 573 "adj.web"
subroutine operinit
implicit none
open(unit=20,file='adjout',form='unformatted',status='unknown')
return
end
C* :16 *
C* 16: *
*line 582 "adj.web"
C* :16 *
C* 17: *
*line 585 "adj.web"
C* :17 *
C* 17: *
*line 611 "adj.web"
C* :17 *
C* 18: *
*line 614 "adj.web"
C* :18 *
C* 18: *
*line 640 "adj.web"
C* :18 *
C* 24: *
*line 756 "adj.web"
subroutine runa(t,c2,ze,zi,eps,psivar,kappa,ipola,nmax,umax,imax,k
&max,dt,tmax,alpha,rho,lmax,tskip)
implicit none
integer nmax,imax,kmax,tmax,lmax,tskip
real*8 t,c2,ze,zi,eps,psivar,kappa,ipola,umax,dt,alpha,rho
integer nmax1,imax1,lmaxa,lmaxa1
C* 25: *
*line 813 "adj.web"
integer memsize,worksize,pwork
C* 30: *
*line 934 "adj.web"
integer pua,pug,pth0a,pth0g,pcsth0a,pchi
C* :30 *
C* 34: *
*line 989 "adj.web"
integer plegjy
C* :34 *
C* 44: *
*line 1150 "adj.web"
integer pchil,plegp
C* :44 *
C* 51: *
*line 1264 "adj.web"
integer pduug,pfu,pdtt,pfm,ppsid
C* :51 *
C* 72: *
*line 1843 "adj.web"
integer plam1a,plam2g,pharr
C* :72 *
C* 92: *
*line 2261 "adj.web"
integer puinv,pth0inv
C* :92 *
C* 100: *
*line 2424 "adj.web"
integer presid,presida
C* :100 *
*line 814 "adj.web"
C* :25 *
C* 25: *
*line 820 "adj.web"
C* :25 *
C* 25: *
*line 824 "adj.web"
C* :25 *
C* 25: *
*line 831 "adj.web"
C* :25 *
C* 25: *
*line 832 "adj.web"
cSm020909
integer memory_max
parameter (memory_max=5000000)
real*8 memory(0:memory_max)
cSm020909
c real*8 memory
c dimension memory(0:*)
c integer malloc
integer ibaseaddr
real*8 baseaddr1
cSm020909
real*8 baseaddr
cSm020909 Warning: because of COMMON the alignment of object is
c inconsistent with its type [BASEADDR1] real*8 baseaddr1
common /dptr/ baseaddr,baseaddr1
cSm020909
c pointer(baseaddr,memory)
integer status
c_cray external hpalloc,hpdeallc
c_pc external malloc,free
c external malloc,free
C* :25 *
C* 25: *
*line 838 "adj.web"
C* :25 *
C* 25: *
*line 845 "adj.web"
C* :25 *
C* 25: *
*line 846 "adj.web"
C* :25 *
*line 764 "adj.web"
external runb
nmax1=nmax
imax1=imax
C* :24 *
C* 24: *
*line 776 "adj.web"
if(mod(nmax1,2).EQ.1)nmax1=nmax1+1
if(mod(imax1,2).EQ.0)imax1=imax1+1
C* :24 *
C* 24: *
*line 780 "adj.web"
if(mod(lmax,2).EQ.0)lmax=lmax-1
lmaxa=(lmax+1)/2
lmaxa1=lmaxa
if(lmaxa1.EQ.0)lmaxa1=1
memsize=0
worksize=0
C* 31: *
*line 938 "adj.web"
pua=memsize
memsize=memsize+nmax
pug=memsize
memsize=memsize+nmax+1
pth0a=memsize
memsize=memsize+imax
pth0g=memsize
memsize=memsize+imax+1
pcsth0a=memsize
memsize=memsize+imax
pchi=memsize
memsize=memsize+imax1*nmax
C* :31 *
C* 35: *
*line 993 "adj.web"
plegjy=memsize
memsize=memsize+nmax1*7*4*(lmaxa1+1)
C* :35 *
C* 38: *
*line 1033 "adj.web"
worksize=max(worksize,2*(max(2*lmaxa-1,0)+2+1)*7*2)
C* :38 *
C* 41: *
*line 1102 "adj.web"
worksize=max(worksize,nmax+(nmax1+1)*7*2)
C* :41 *
C* 45: *
*line 1154 "adj.web"
pchil=memsize
memsize=memsize+nmax1*lmaxa1
plegp=memsize
memsize=memsize+imax1*lmaxa1
C* :45 *
C* 48: *
*line 1198 "adj.web"
worksize=max(worksize,imax)
C* :48 *
C* 52: *
*line 1268 "adj.web"
pduug=memsize
memsize=memsize+nmax+1
pfu=memsize
memsize=memsize+nmax
pdtt=memsize
memsize=memsize+nmax
pfm=memsize
memsize=memsize+nmax
ppsid=memsize
memsize=memsize+nmax1*5*2
C* :52 *
C* 58: *
*line 1459 "adj.web"
worksize=max(worksize,nmax*2+nmax+(nmax1+1)*7*2)
C* :58 *
C* 73: *
*line 1847 "adj.web"
plam1a=memsize
memsize=memsize+imax
plam2g=memsize
memsize=memsize+imax+1
pharr=memsize
memsize=memsize+(((lmaxa1-1)*lmaxa1*(2*lmaxa1-1))/6+(lmaxa1-1)*lma
&xa1+lmaxa1)
C* :73 *
C* 76: *
*line 1905 "adj.web"
worksize=max(worksize,2*kmax+((((lmaxa1+3)-1)*(lmaxa1+3))/2+(lmaxa
&1+1)))
C* :76 *
C* 90: *
*line 2250 "adj.web"
worksize=max(worksize,3*imax)
C* :90 *
C* 93: *
*line 2265 "adj.web"
puinv=memsize
memsize=memsize+nmax1*3
pth0inv=memsize
memsize=memsize+imax1*3
C* :93 *
C* 101: *
*line 2428 "adj.web"
presid=memsize
memsize=memsize+imax1*nmax
presida=memsize
memsize=memsize+imax1*nmax
C* :101 *
C* 101: *
*line 2432 "adj.web"
worksize=max(worksize,imax1*nmax)
C* :101 *
C* 101: *
*line 2434 "adj.web"
C* :101 *
C* 109: *
*line 2574 "adj.web"
worksize=max(worksize,imax)
C* :109 *
*line 793 "adj.web"
pwork=memsize
memsize=memsize+worksize
C* 26: *
*line 872 "adj.web"
C* :26 *
C* 26: *
*line 879 "adj.web"
c_cray call hpalloc(baseaddr,1*memsize,status,0)
c_cray if(status.NE.0)then
c_cray write(6,*)'Couldn''t allocate memory: ',memsize
c_cray return
c_cray end if
c_pc Using unix library libU77.a
c_pc baseaddr=malloc(8*memsize)
c_pc if (baseaddr.eq.0) stop 'failed malloc in runa'
cBH FOLLOWING LINE IS FOR 8 BYTE WORDS. PROBABLY 4* OK HERE,
cBH (OR, 1*, see above) UNLESS RESET real*8 ==> real*8*8
cSm020909
c baseaddr=malloc(8*memsize)
cSm020909
baseaddr=8*memsize !it can be redused
baseaddr1=baseaddr
ibaseaddr=baseaddr
write(*,*)'runa: baseaddr,ibaseaddr',baseaddr,ibaseaddr
if (baseaddr.eq.0) stop 'failed malloc in runa'
C* :26 *
C* 26: *
*line 885 "adj.web"
C* :26 *
*line 796 "adj.web"
write(*,*)'in runa memsize,memory_max',memsize,memory_max
call runb(t,c2,ze,zi,eps,psivar,kappa,ipola,nmax,umax,imax,kmax,dt
&,tmax,alpha,rho,lmax,tskip,nmax1,imax1,lmaxa,lmaxa1,worksize,memor
&y(pua),memory(pug),memory(pth0a),memory(pth0g),memory(pcsth0a),mem
&ory(pchi),memory(plegjy),memory(pchil),memory(plegp),memory(pduug)
&,memory(pfu),memory(pdtt),memory(pfm),memory(ppsid),memory(plam1a)
&,memory(plam2g),memory(pharr),memory(puinv),memory(pth0inv),memory
&(presid),memory(presida),memory(pwork))
C* 27: *
*line 887 "adj.web"
C* :27 *
C* 27: *
*line 889 "adj.web"
c_cray call hpdeallc(baseaddr,status,0)
c_pc call free(baseaddr)
cSm020909
c call free(baseaddr)
C* :27 *
C* 27: *
*line 891 "adj.web"
C* :27 *
*line 806 "adj.web"
return
end
C* :24 *
C* 28: *
*line 896 "adj.web"
subroutine runb(t,c2,ze,zi,eps,psivar,kappa,ipola,nmax,umax,imax,k
&max,dt,tmax,alpha,rho,lmax,tskip,nmax1,imax1,lmaxa,lmaxa1,worksize
&,ua,ug,th0a,th0g,csth0a,chi,legjy,chil,legp,duug,fu,dtt,fm,psid,la
&m1a,lam2g,harr,uinv,th0inv,resid,resida,work)
implicit none
integer worksize
real*8 work
dimension work(0:worksize-1)
C* 29: *
*line 925 "adj.web"
integer nmax,imax,nmax1,imax1,n,i
real*8 du,umax,ua,ug,dth0,th0max,th0a,th0g,csth0a,chi
dimension ua(0:nmax-1),ug(0:nmax),th0a(0:imax-1),th0g(0:imax),csth
&0a(0:imax-1),chi(0:imax1-1,0:nmax-1)
real*8 pi
C* :29 *
C* 33: *
*line 981 "adj.web"
real*8 c,c2
real*8 legjy
integer lmax,lmaxa,lmaxa1
dimension legjy(0:nmax1-1,0:6,0:3,0:lmaxa1)
external initjy
C* :33 *
C* 43: *
*line 1144 "adj.web"
real*8 chil,legp
dimension chil(0:nmax1-1,1:lmaxa1),legp(0:imax1-1,1:lmaxa1)
external initp
C* :43 *
C* 50: *
*line 1249 "adj.web"
real*8 t,ze,zi
real*8 duug,fu,dtt
dimension duug(0:nmax),fu(0:nmax-1),dtt(0:nmax-1)
real*8 fm
dimension fm(0:nmax-1)
real*8 psid
dimension psid(0:nmax1-1,0:4,0:1)
external maxwel,isotrop
C* :50 *
C* 60: *
*line 1492 "adj.web"
real*8 psivar,kappa,ipola
real*8 eps
C* :60 *
C* 71: *
*line 1837 "adj.web"
integer kmax
real*8 lam1a,lam2g,harr
dimension lam1a(0:imax-1),lam2g(0:imax),harr((((lmaxa1-1)*lmaxa1*(
&2*lmaxa1-1))/6+(lmaxa1-1)*lmaxa1+lmaxa1))
C* :71 *
C* 91: *
*line 2255 "adj.web"
real*8 uinv,th0inv,rho
dimension uinv(0:nmax1-1,-1:1),th0inv(0:imax1-1,-1:1)
external matinit
C* :91 *
C* 99: *
*line 2408 "adj.web"
integer tmax,time,tskip
real*8 resid,abserr,relerr,maxerr,alpha,dt,resida
dimension resid(0:imax1-1,0:nmax-1),resida(0:imax1-1,0:nmax-1)
C* :99 *
C* 99: *
*line 2413 "adj.web"
C$$$ external hdfout
C* :99 *
C* 99: *
*line 2415 "adj.web"
external decomp,reactall,residue,error
C* :99 *
C* 99: *
*line 2417 "adj.web"
integer ifail
external md03uaf
C* :99 *
C* 99: *
*line 2422 "adj.web"
C* :99 *
C* 106: *
*line 2521 "adj.web"
real*8 curv,current,cond,e
external current
C* :106 *
*line 909 "adj.web"
C* 32: *
*line 948 "adj.web"
du=umax/nmax
do n=0,nmax-1
ua(n)=(n+0.5d0)*du
ug(n)=n*du
end do
ug(nmax)=umax
pi=4*atan(1.0d0)
cBH th0max=atan2(1.0d0,sqrt(2*eps/(1-eps)))
th0max=atan2(1.0d0,sqrt(2*eps/(1-eps)))
dth0=th0max/imax
do i=0,imax-1
th0a(i)=(i+0.5d0)*dth0
csth0a(i)=cos(th0a(i))
th0g(i)=i*dth0
end do
th0g(imax)=th0max
do n=0,nmax-1
do i=0,imax-1
chi(i,n)=0
end do
end do
C* :32 *
C* 36: *
*line 997 "adj.web"
c=sqrt(c2)
lmaxa=(lmax+1)/2
call initjy(ua,c,nmax,nmax1,lmaxa,lmaxa1,legjy,work(0),work(2*(max
&(2*lmaxa-1,0)+2+1)*7),max(2*lmaxa-1,0)+2)
C* :36 *
C* 46: *
*line 1160 "adj.web"
call initp(csth0a,imax,imax1,lmaxa,lmaxa1,legp,work)
C* :46 *
C* 53: *
*line 1277 "adj.web"
call maxwel(ua,du,c,nmax,fm,t)
do n=0,nmax-1
chil(n,1)=1
end do
call isotrop(ua,du,c,fm,chil(0,1),nmax,nmax1,legjy(0,0,0,0),psid,z
&e,zi,duug,fu,dtt,work)
C* :53 *
C* 74: *
*line 1854 "adj.web"
call maginit(eps,psivar,kappa,ipola,th0a,th0g,lam1a,lam2g,harr,ima
&x,lmaxa1,kmax,work(0),work(kmax),work(2*kmax))
C* :74 *
C* 94: *
*line 2271 "adj.web"
call matinit(du,ua,ug,nmax,nmax1,dth0,th0a,th0g,imax,imax1,duug,fu
&,dtt,lam1a,lam2g,uinv,th0inv,rho)
C* :94 *
*line 911 "adj.web"
do time=0,tmax
C* 102: *
*line 2437 "adj.web"
call decomp(chi,nmax,nmax1,imax,imax1,lmaxa,lmaxa1,th0a,dth0,legp,
&chil)
call reactall(ua,du,c,fm,t,chil,nmax,nmax1,imax,imax1,lam1a,legjy(
&0,0,0,1),psid,legp,harr,ze,lmaxa,lmaxa1,resid,work(0),work(nmax),w
&ork(2*nmax))
C* :102 *
C* 103: *
*line 2445 "adj.web"
C* :103 *
C* 103: *
*line 2451 "adj.web"
call residue(ua,nmax,nmax1,csth0a,imax,imax1,chi,dtt,c,lam1a,uinv,
&th0inv,resid)
C* :103 *
C* 103: *
*line 2453 "adj.web"
if(mod(time,tskip).EQ.0)then
call error(du,ua,umax,nmax,dth0,th0a,th0max,imax,imax1,resid,chi,a
&bserr,relerr,maxerr,work(0),work(imax),work(2*imax))
C* :103 *
C* 103: *
*line 2457 "adj.web"
C$$$ call hdfout(resid,chi,du,umax,nmax,dth0,imax,imax1,time)
C* :103 *
C* 103: *
*line 2459 "adj.web"
end if
C* :103 *
C* 104: *
*line 2463 "adj.web"
C* :104 *
C* 104: *
*line 2465 "adj.web"
ifail=0
call md03uaf(imax,nmax,imax1,th0inv(0,-1),th0inv(0,0),th0inv(0,1),
&uinv(0,-1),uinv(0,0),uinv(0,1),-dt,alpha,time,resid,resida,work,if
&ail)
if(ifail.NE.0)then
write(6,*)'md03uaf failed: ',ifail,time
end if
C* :104 *
C* 104: *
*line 2478 "adj.web"
do n=0,nmax-1
do i=0,imax-1
chi(i,n)=chi(i,n)+dt*resid(i,n)
end do
end do
C* :104 *
C* 107: *
*line 2531 "adj.web"
if(mod(time,tskip).EQ.0)then
curv=current(du,ua,c,nmax,dth0,th0a,imax,imax1,fm,chi,work)
e=t/harr((((1-1)*1*(2*1-1))/6+(1-1)*1+1))
cond=curv*zi/(t*sqrt(t)*e)
write(6,*)time,cond,abserr,relerr,maxerr
end if
C* :107 *
*line 914 "adj.web"
end do
C* 111: *
*line 2618 "adj.web"
write(20)nmax,imax,kmax,lmax
write(20)real(t),real(c2),real(ze),real(zi),real(eps)
write(20)real(umax),real(th0max),real(du),real(dth0),real(rho)
write(20)real(dt),tmax,real(alpha)
write(20)real(cond),real(abserr),real(relerr)
write(20)(real(ua(n)),n=0,nmax-1)
write(20)(real(ug(n)),n=0,nmax)
write(20)(real(th0a(n)),n=0,imax-1)
write(20)(real(th0g(n)),n=0,imax)
write(20)(real(fm(n)),n=0,nmax-1)
write(20)((real(chi(i,n)),i=0,imax-1),n=0,nmax-1)
C* :111 *
*line 917 "adj.web"
return
end
C* :28 *
C* 37: *
*line 1004 "adj.web"
subroutine initjy(ua,c,nmax,nmax1,lmaxa,lmaxa1,legjy,jarray,djarra
&y,lmax1)
implicit none
integer nmax,nmax1,lmaxa,lmaxa1,n,mult,la,l,a,lmax1
real*8 ua,legjy,c,jarray,djarray
dimension ua(0:nmax-1),legjy(0:nmax1-1,0:6,0:3,0:lmaxa1)
dimension jarray(-lmax1-1:lmax1,0:6),djarray(-lmax1-1:lmax1,0:6)
external legjn
do n=0,nmax-1
call legjn(ua(n),c,max(2*lmaxa-1,0),jarray,djarray,lmax1)
do la=0,lmaxa
l=max(max(2*la-1,0),0)
mult=(-1)**(l+1)
do a=0,6
legjy(n,a,0,la)=jarray(l,a)
legjy(n,a,1,la)=mult*jarray(-l-1,a)
legjy(n,a,2,la)=djarray(l,a)
legjy(n,a,3,la)=mult*djarray(-l-1,a)
end do
end do
end do
return
end
C* :37 *
C* 40: *
*line 1056 "adj.web"
subroutine pot(ua,du,c,fm,chil,nmax,nmax1,legjy,psid,fla,ijy)
implicit none
integer p0,p02,p022,p1,p11
parameter(p0=0,p02=1,p022=2,p1=3,p11=4)
integer j0,j1,j2,j02,j11,j22,j022
parameter(j0=0,j1=1,j2=2,j02=3,j11=4,j22=5,j022=6)
integer nmax,nmax1,n,a
real*8 ua,du,c,fm,chil,legjy
dimension ua(0:nmax-1),fm(0:nmax-1),chil(0:nmax-1),legjy(0:nmax1-1
&,0:6,0:3)
real*8 psid
dimension psid(0:nmax1-1,0:4,0:1)
real*8 fla,ijy
dimension fla(0:nmax-1),ijy(0:nmax1,0:6,0:1)
C* 42: *
*line 1109 "adj.web"
do n=0,nmax-1
fla(n)=fm(n)*chil(n)*ua(n)**2/sqrt(1+(ua(n)/c)**2)*du/2
end do
do a=0,6
do n=0,nmax-1
ijy(n+1,a,0)=fla(n)*legjy(n,a,0)
ijy(n,a,1)=fla(n)*legjy(n,a,1)
end do
ijy(0,a,0)=0
ijy(nmax,a,1)=0
end do
do n=1,nmax
do a=0,6
ijy(n,a,0)=ijy(n-1,a,0)+ijy(n,a,0)
end do
end do
do n=nmax-1,0,-1
do a=0,6
ijy(n,a,1)=ijy(n+1,a,1)+ijy(n,a,1)
end do
end do
do a=0,6
do n=0,nmax-1
ijy(n,a,0)=ijy(n,a,0)+ijy(n+1,a,0)
ijy(n,a,1)=ijy(n,a,1)+ijy(n+1,a,1)
end do
end do
C* :42 *
*line 1073 "adj.web"
do n=0,nmax-1
psid(n,p0,0)=legjy(n,j0,1)*ijy(n,j0,0)+ijy(n,j0,1)*legjy(n,j0,0)
psid(n,p02,0)=legjy(n,j0,1)*ijy(n,j02,0)+legjy(n,j02,1)*ijy(n,j2,0
&)+ijy(n,j0,1)*legjy(n,j02,0)+ijy(n,j02,1)*legjy(n,j2,0)
psid(n,p022,0)=legjy(n,j0,1)*ijy(n,j022,0)+legjy(n,j02,1)*ijy(n,j2
&2,0)+legjy(n,j022,1)*ijy(n,j2,0)+ijy(n,j0,1)*legjy(n,j022,0)+ijy(n
&,j02,1)*legjy(n,j22,0)+ijy(n,j022,1)*legjy(n,j2,0)
psid(n,p1,0)=legjy(n,j1,1)*ijy(n,j1,0)+ijy(n,j1,1)*legjy(n,j1,0)
psid(n,p11,0)=legjy(n,j1,1)*ijy(n,j11,0)+legjy(n,j11,1)*ijy(n,j1,0
&)+ijy(n,j1,1)*legjy(n,j11,0)+ijy(n,j11,1)*legjy(n,j1,0)
psid(n,p0,1)=legjy(n,j0,3)*ijy(n,j0,0)+ijy(n,j0,1)*legjy(n,j0,2)
psid(n,p02,1)=legjy(n,j0,3)*ijy(n,j02,0)+legjy(n,j02,3)*ijy(n,j2,0
&)+ijy(n,j0,1)*legjy(n,j02,2)+ijy(n,j02,1)*legjy(n,j2,2)
psid(n,p022,1)=legjy(n,j0,3)*ijy(n,j022,0)+legjy(n,j02,3)*ijy(n,j2
&2,0)+legjy(n,j022,3)*ijy(n,j2,0)+ijy(n,j0,1)*legjy(n,j022,2)+ijy(n
&,j02,1)*legjy(n,j22,2)+ijy(n,j022,1)*legjy(n,j2,2)
psid(n,p1,1)=legjy(n,j1,3)*ijy(n,j1,0)+ijy(n,j1,1)*legjy(n,j1,2)
psid(n,p11,1)=legjy(n,j1,3)*ijy(n,j11,0)+legjy(n,j11,3)*ijy(n,j1,0
&)+ijy(n,j1,1)*legjy(n,j11,2)+ijy(n,j11,1)*legjy(n,j1,2)
end do
return
end
C* :40 *
C* 47: *
*line 1166 "adj.web"
subroutine initp(x,imax,imax1,lmaxa,lmaxa1,legp,leg0)
implicit none
integer imax,imax1,lmaxa,lmaxa1,i,l,la
real*8 x,legp
dimension x(0:imax-1),legp(0:imax1-1,1:lmaxa1)
real*8 leg0
dimension leg0(0:imax-1)
if(lmaxa.LT.1)return
la=1
do i=0,imax-1
leg0(i)=1
legp(i,la)=x(i)
end do
do la=2,lmaxa
l=max(2*la-1,0)
do i=0,imax-1
leg0(i)=((2*l-3)*x(i)*legp(i,la-1)-(l-2)*leg0(i))/(l-1)
legp(i,la)=((2*l-1)*x(i)*leg0(i)-(l-1)*legp(i,la-1))/l
end do
end do
return
end
C* :47 *
C* 49: *
*line 1213 "adj.web"
subroutine decomp(chi,nmax,nmax1,imax,imax1,lmaxa,lmaxa1,th0a,dth0
&,legp,chil)
implicit none
integer nmax,nmax1,imax,imax1,lmaxa,lmaxa1,la,l,n,i
real*8 chi,th0a,dth0,legp,chil,sn
dimension chi(0:imax1-1,0:nmax-1),th0a(0:imax-1),legp(0:imax1-1,1:
&lmaxa1),chil(0:nmax1-1,1:lmaxa1)
do la=1,lmaxa
l=max(2*la-1,0)
do n=0,nmax-1
chil(n,la)=0
end do
do i=0,imax-1
sn=sin(th0a(i))*legp(i,la)
do n=0,nmax-1
chil(n,la)=chil(n,la)+chi(i,n)*sn
end do
end do
do n=0,nmax-1
chil(n,la)=(2*l+1)*dth0*chil(n,la)
end do
end do
return
end
C* :49 *
C* 54: *
*line 1290 "adj.web"
subroutine isotrop(ua,du,c,fm,chil,nmax,nmax1,legjy,psid,ze,zi,duu
&g,fu,dtt,work)
implicit none
integer p0,p02,p022,p1,p11
parameter(p0=0,p02=1,p022=2,p1=3,p11=4)
integer nmax,nmax1,n
real*8 ua,c,psid,duug,fu,dtt,pi,g,u,ze,zi,du,fm,chil,legjy
dimension ua(0:nmax-1),fm(0:nmax-1),chil(0:nmax-1),legjy(0:nmax1-1
&,0:6,0:3),psid(0:nmax1-1,0:4,0:1),duug(0:nmax),fu(0:nmax-1),dtt(0:
&nmax-1)
real*8 work
dimension work(0:nmax+(nmax1+1)*7*2-1)
external pot
call pot(ua,du,c,fm,chil,nmax,nmax1,legjy,psid,work(0),work(nmax))
pi=4*atan(1.0d0)
do n=0,nmax-1
u=ua(n)
g=sqrt(1+(u/c)**2)
duug(n)=ze*4*pi*g/u*(2*g**2*psid(n,p02,1)-u*psid(n,p0,0)-8*g**2/c*
&*2*psid(n,p022,1)+8*u/c**4*psid(n,p022,0))
dtt(n)=ze*4*pi/(g*u)*(-g**2*psid(n,p02,1)-u/c**2*psid(n,p02,0)+4*g
&**2/c**2*psid(n,p022,1)-4*u/c**4*psid(n,p022,0))+zi*g/(2*u)
fu(n)=ze*4*pi*g*(-psid(n,p1,1)+2/c**2*psid(n,p11,1))
end do
duug(nmax)=(3*duug(nmax-1)-duug(nmax-2))/2
do n=nmax-1,1,-1
duug(n)=(duug(n)+duug(n-1))/2
end do
duug(0)=duug(0)
return
end
C* :54 *
C* 55: *
*line 1338 "adj.web"
subroutine maxwel(ua,du,c,nmax,fm,t)
implicit none
integer nmax,n
real*8 ua,du,c,fm,t,sum,pi
dimension ua(0:nmax-1),fm(0:nmax-1)
sum=0
do n=0,nmax-1
fm(n)=exp(-ua(n)**2/(sqrt(1+(ua(n)/c)**2)+1)/t)
sum=sum+ua(n)**2*fm(n)
end do
pi=4*atan(1.0d0)
sum=4*pi*du*sum
do n=0,nmax-1
fm(n)=fm(n)/sum
end do
return
end
C* :55 *
C* 56: *
*line 1369 "adj.web"
subroutine reaction(ua,du,c,fm,t,chil,nmax,nmax1,legjy,psid,ze,rea
&ctl,l,work)
implicit none
integer p0,p02,p022,p1,p11
parameter(p0=0,p02=1,p022=2,p1=3,p11=4)
integer nmax,nmax1,n,l
real*8 ua,du,c,legjy,psid,ze,reactl,fm,chil,t,pi,u,g
dimension ua(0:nmax-1),legjy(0:nmax1-1,0:6,0:3),psid(0:nmax1-1,0:4
&,0:1),reactl(0:nmax-1),fm(0:nmax-1),chil(0:nmax-1)
real*8 work
dimension work(0:nmax+(nmax1+1)*7*2-1)
external pot
call pot(ua,du,c,fm,chil,nmax,nmax1,legjy,psid,work(0),work(nmax))
pi=4*atan(1.0d0)
do n=0,nmax-1
u=ua(n)
g=sqrt(1+(u/c)**2)
reactl(n)=reactl(n)+ze*4*pi*(fm(n)*chil(n)/g-u/t*psid(n,p1,1)-2/(c
&**2*g)*psid(n,p1,0)+2*u/(c**2*t)*psid(n,p11,1)+u/t*psid(n,p0,1)-(u
&**2/(g*t**2)-1/t)*psid(n,p0,0)+(2*g*u/t**2-2*u/(c**2*t))*psid(n,p0
&2,1)-(l*(l+1)/(g*t**2)-2/(c**2*t))*psid(n,p02,0)-8*g*u/(c**2*t**2)
&*psid(n,p022,1)+4*((l+2)*(l-1)/g+2*g)/(c**2*t**2)*psid(n,p022,0))
end do
return
end
C* :56 *
C* 57: *
*line 1417 "adj.web"
subroutine reactall(ua,du,c,fm,t,chil,nmax,nmax1,imax,imax1,lam1a,
&legjy,psid,legp,harr,ze,lmaxa,lmaxa1,react,reactl,chila,work)
implicit none
integer nmax,nmax1,imax,imax1,lmaxa,lmaxa1
real*8 ua,du,c,fm,t,chil,lam1a,legjy,psid,legp,harr,ze,react
dimension ua(0:nmax-1),fm(0:nmax-1),chil(0:nmax1-1,1:lmaxa1),lam1a
&(0:imax-1),legjy(0:nmax1-1,0:6,0:3,1:lmaxa1),psid(0:nmax1-1,0:4,0:
&1),legp(0:imax1-1,1:lmaxa1),harr((((lmaxa1-1)*lmaxa1*(2*lmaxa1-1))
&/6+(lmaxa1-1)*lmaxa1+lmaxa1)),react(0:imax1-1,0:nmax-1)
integer la,la1,la2,n,i
real*8 reactl,chila,work
dimension reactl(0:nmax-1),chila(0:nmax-1),work(0:nmax+(nmax1+1)*7
&*2-1)
external reaction
do n=0,nmax-1
do i=0,imax-1
react(i,n)=0
end do
end do
do la1=1,lmaxa
C* 59: *
*line 1464 "adj.web"
do n=0,nmax-1
reactl(n)=0
end do
do la=la1,lmaxa
do n=0,nmax-1
chila(n)=0
end do
do la2=1,la
do n=0,nmax-1
chila(n)=chila(n)+harr((((la-1)*la*(2*la-1))/6+(la1-1)*la+la2))*ch
&il(n,la2)
end do
end do
call reaction(ua,du,c,fm,t,chila,nmax,nmax1,legjy(0,0,0,la),psid,z
&e,reactl,max(2*la-1,0),work)
end do
C* :59 *
*line 1439 "adj.web"
do n=0,nmax-1
do i=0,imax-1
react(i,n)=react(i,n)+reactl(n)*legp(i,la1)
end do
end do
end do
do n=0,nmax-1
do i=0,imax-1
react(i,n)=react(i,n)/lam1a(i)
end do
end do
return
end
C* :57 *
C* 61: *
*line 1499 "adj.web"
subroutine psipolf(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipo
&lr)
implicit none
real*8 dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipolr
external psipola,psipolb,psipolc
if(int(psivar+0.5d0).EQ.0)then
call psipola(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipolr)
else if(int(psivar+0.5d0).EQ.1)then
call psipolb(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipolr)
else
call psipolc(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipolr)
end if
return
end
C* :61 *
C* 62: *
*line 1518 "adj.web"
subroutine psipola(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipo
&lr)
implicit none
real*8 dr,z,psivar,kappa,ipola,r0,psipol1,psipol,psipolz,psipolr
psipol1=1
psipol=-psipol1*(dr**2+(z/kappa)**2)
psipolz=-psipol1*2*z/kappa**2
psipolr=-psipol1*2*dr
return
end
C* :62 *
C* 63: *
*line 1534 "adj.web"
subroutine psipolb(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipo
&lr)
implicit none
cSm0209009
c real*8 dr,z,psivar,kappa,ipola,r0,a,alpha,r,psipol1,psipol,psipolz,p
c &sipolr
real*8 dr,z,psivar,kappa,ipola,r0,a,alpha,r,psipol1,psipol,psipolz
&,psipolr
psipol1=1
a=0
alpha=kappa**2*(a**2-r0**2)/(4*r0**2)
r=r0+dr
psipol=-psipol1*((a**2-r**2)*z**2+alpha*(dr*(r0+r))**2)
psipolz=-psipol1*2*(a**2-r**2)*z
psipolr=-psipol1*2*(-r*z**2+2*alpha*r*dr*(r0+r))
return
end
C* :63 *
C* 64: *
*line 1554 "adj.web"
subroutine psipolc(dr,z,psivar,kappa,ipola,r0,psipol,psipolz,psipo
&lr)
implicit none
real*8 dr,z,psivar,kappa,ipola,r0,psipol,psipolr,psipolz
real*8 rv,zv,numer,numerr,numerz,denom,denomr,denomz,temp,tempr
integer k,m,l
integer nnum,nden
parameter(nnum=3,nden=2)
C* 65: *
*line 1607 "adj.web"
real*8 ac
dimension ac(((nnum+1)*(nnum+2))/2+((nden+1)*(nden+2))/2)
save ac
data ac/0.000510d0,-0.003820d0,-0.029876d0,-0.003174d0,0.142820d0,
&5.484722d0,-0.000972d0,0.099224d0,0.000000d0,0.000000d0,0.001580d0
&,0.000021d0,-0.015488d0,0.000110d0,-0.009744d0,1.000000d0/
C* :65 *
*line 1561 "adj.web"
rv=dr*(dr+2*r0)
zv=z**2
numer=0
numerr=0
numerz=0
k=0
do m=nnum,0,-1
temp=0
tempr=0
do l=nnum-m,0,-1
k=k+1
temp=temp*rv+ac(k)
if(l.GT.0)tempr=tempr*rv+l*ac(k)
end do
numer=numer*zv+temp
numerr=numerr*zv+tempr
if(m.GT.0)numerz=numerz*zv+m*temp
end do
denom=0
denomr=0
denomz=0
do m=nden,0,-1
temp=0
tempr=0
do l=nden-m,0,-1