forked from NOAA-SWPC/IPE-grid-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc_apex_params_2d_2_new2.f90
More file actions
1815 lines (1686 loc) · 81 KB
/
calc_apex_params_2d_2_new2.f90
File metadata and controls
1815 lines (1686 loc) · 81 KB
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 calc_apex_params_2d_2( &
IN , IS, &
gr, gcol, glon, &
RE_apex , q_coordinate , BLOn, &
bcol,vmp_tube, &
vmp_apex,vmp_south_pole, &
B_magnitude_on_tubes_3D, &
Apex_D1, &
Apex_D2, &
Apex_D3, &
Apex_E1, &
Apex_E2, &
Apex_E3, &
Apex_BE3, &
DATE)
IMPLICIT NONE
INTEGER :: NPTS , NMP , NLP
INCLUDE 'npts.h'
INTEGER :: IN(NMP,NLP) , IS(NMP,NLP)
INTEGER :: i , j
INTEGER :: mp , lp
REAL(kind=8) R0
REAL(kind=8) PI
REAL(kind=8) DTR
REAL(kind=8) RTD
REAL(kind=8) Date
REAL(kind=8) RE_apex(NMP,NLP)
REAL(kind=8) Apex_D1(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_D2(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_D3(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_E1(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_E2(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_E3(3,NPTS,NMP,NLP)
REAL(kind=8) Apex_BE3(NPTS,NMP,NLP)
REAL(kind=8) Apex_grdlbm2(3,NPTS,NMP,NLP)
REAL(kind=8) ETA_APEX_3D(NPTS,NMP,NLP)
REAL(kind=8) e3e3
! REAL(kind=8) Apex_BHAT(3,npts,nmp,nlp)
REAL(kind=8) Apex_D(npts,nmp,nlp)
! REAL(kind=8) Apex_d1d1(npts,nmp,nlp)
! REAL(kind=8) Apex_d1d2(npts,nmp,nlp)
! REAL(kind=8) Apex_d2d2(npts,nmp,nlp)
REAL(kind=8) Apex_BMAG(npts,nmp,nlp)
REAL(kind=8) vmp_tube(npts,nmp,nlp)
REAL(kind=8) vmp_apex(nmp,nlp)
REAL(kind=8) vmp_south_pole
REAL(kind=8) B_magnitude_on_tubes_3D(npts,nmp,nlp)
REAL(kind=8) gr(NPTS,nmp,nlp)
REAL(kind=8) gcol(NPTS,nmp,nlp)
REAL(kind=8) glon(NPTS,nmp,nlp)
REAL(kind=8) bcol(NPTS,NMP,NLP)
REAL(kind=8) BLOn(NMP,NLP)
REAL(kind=8) q_coordinate(NPTS,NMP,NLP)
REAL(kind=8) dq_3d(NPTS-1,NMP,NLP)
REAL(kind=8) distance_ds(NPTS,NMP,NLP)
REAL(kind=8) integral_ds(NPTS,NMP,NLP)
REAL(kind=8) Apex_BE3_N(NMP,NLP), Apex_BE3_S(NMP,NLP)
INTEGER :: pnt_on_tube
INTEGER :: i_count
INTEGER :: IN_2d(NLP) , IS_2d(NLP)
INTEGER :: IN_2d_3d(NMP,NLP) , IS_2d_3d(NMP,NLP)
integer npts2
! parameter (npts2=122817)
! parameter (npts2=44438)
parameter (npts2=44514)
real(kind=8) gr_2d(npts2,nmp)
real(kind=8) gcol_2d(npts2,nmp)
real(kind=8) glon_2d(npts2,nmp)
real(kind=8) q_coordinate_2d(npts2,nmp)
real(kind=8) bcol_2d(npts2,nmp)
! real(kind=8) vmp_tube_2d(npts2,nmp)
! real(kind=8) B_magnitude_on_tubes_3D_2d(npts2,nmp)
real(kind=8) Apex_D1_2d(3,npts2,nmp)
real(kind=8) Apex_D2_2d(3,npts2,nmp)
real(kind=8) Apex_D3_2d(3,npts2,nmp)
real(kind=8) Apex_E1_2d(3,npts2,nmp)
real(kind=8) Apex_E2_2d(3,npts2,nmp)
! real(kind=8) Apex_E3_2d(3,npts2,nmp)
! real(kind=8) Apex_BE3_2d(npts2,nmp)
real(kind=8) Apex_grdlbm2_2d(3,npts2,nmp)
! real(kind=8) Eta_Apex_3d_2d(npts2,nmp)
REAL(kind=8) integral_ds_2d(npts2,nmp)
! real(kind=8) apex_D_2d(npts2,nmp)
! real(kind=8) apex_BHAT_2d(3,npts2,nmp)
! real(kind=8) apex_d1d1_2d(npts2,nmp)
! real(kind=8) apex_d1d2_2d(npts2,nmp)
! real(kind=8) apex_d2d2_2d(npts2,nmp)
real(kind=8) apex_BMAG_2d(npts2,nmp)
integer midpoint(nlp)
PARAMETER (PI=3.141592654,DTR=PI/180.0,RTD=180.0/PI,R0=6.3712E06)
call cofrm2(date)
! call get_apex2(gr, gcol, glon,npts,nmp,nlp, &
! Apex_grdlbm2,in,is)
!g
!g For our new Apex code we calculate magnetic field parameters as 3D
!g variables just once - at the start....
!g
do mp=1,nmp
do lp=1,nlp
do i=in(mp,lp),is(mp,lp)
!g
!g Be3 as read in above is in nT - we need T therefore need to multiply by 1.e-09 here.
!g This also feeds through to BMAG below (which is therfore automatically correctly in Tesla).....
!g
Apex_Be3(i,mp,lp) = Apex_Be3(i,mp,lp) * 1.e-09
!g
!g Added a minus sign here to ETA - otherwise DS comes out negative.....
!g
Eta_Apex_3d(i,mp,lp) = 0.0 - ( B_magnitude_on_tubes_3D(i,mp,lp) &
/ vmp_south_pole )
enddo
enddo
enddo
!add by TWFANG
!to get ds values
do mp=1,nmp
do lp=1,nlp
do i=in(mp,lp)+1,is(mp,lp)
dq_3d(i,mp,lp) = q_coordinate(i,mp,lp) - q_coordinate(i-1,mp,lp)
distance_ds(i,mp,lp)= dq_3d(i,mp,lp)/Eta_Apex_3d(i,mp,lp)
! if (mp.eq.1.and.lp.eq.60) write(*,*) 'ds1=',distance_ds(i,mp,lp),'gr=',gr(i,mp,lp)-6460000
enddo
! distance_ds(is(mp,lp),mp,lp)=distance_ds(is(mp,lp)-1,mp,lp)
distance_ds(in(mp,lp),mp,lp)=0.0
enddo
enddo
do mp=1,nmp
do lp=1,nlp
integral_ds(in(mp,lp):is(mp,lp),mp,lp)=0.
do i=in(mp,lp),is(mp,lp)
integral_ds(i,mp,lp)=sum(distance_ds(in(mp,lp):i,mp,lp))
! if (mp.eq.1.and.lp.eq.60) write(*,*) 'int_ds1=',integral_ds(i,mp,lp)
enddo
enddo
enddo
!g
!g We also need Bmag, D, bHat and Dhat as 3D variables.....
!g
! get D
lp_loop1: do lp = 1,nlp
mp_loop1: do mp = 1,nmp
ipts_loop1: do i = in(mp,lp),is(mp,lp)
e3e3=dot_product( Apex_E3(1:3,i,mp,lp), Apex_E3(1:3,i,mp,lp) )
apex_D(i,mp,lp)=SQRT( e3e3 ) !(3.13) D * D = e3 * e3
enddo ipts_loop1
enddo mp_loop1
enddo lp_loop1
! get BHAT
! lp_loop2: do lp = 1,nlp
! mp_loop2: do mp = 1,nmp
! do J=1,3
! apex_BHAT(J,in(mp,lp):is(mp,lp),mp,lp)=apex_D3(J,in(mp,lp):is(mp,lp),mp,lp)*apex_D(in(mp,lp):is(mp,lp),mp,lp)
! enddo
!nddo mp_loop2
!nddo lp_loop2
! get d1d2 etc
! lp_loop3: do lp = 1,nlp
! mp_loop3: do mp = 1,nmp
! ipts_loop3: do i = in(mp,lp),is(mp,lp)
! apex_d1d1(i,mp,lp)=dot_product(Apex_d1(1:3,i,mp,lp),Apex_d1(1:3,i,mp,lp))
! apex_d1d2(i,mp,lp)=dot_product(Apex_d1(1:3,i,mp,lp),Apex_d2(1:3,i,mp,lp))
! apex_d2d2(i,mp,lp)=dot_product(Apex_d2(1:3,i,mp,lp),Apex_d2(1:3,i,mp,lp))
!nddo ipts_loop3 !: do i = in(mp,lp),is(mp,lp)
!nddo mp_loop3 !: do mp = 1,nmp
!nddo lp_loop3 !: do lp = 1,nlp
! get BMAG
lp_loop4: do lp = 1,nlp
mp_loop4: do mp = 1,nmp
apex_BMAG(in(mp,lp):is(mp,lp),mp,lp) = Apex_BE3(in(mp,lp):is(mp,lp),mp,lp)*apex_D(in(mp,lp):is(mp,lp),mp,lp) !(4.13)
enddo mp_loop4 !: do mp = 1,nmp
enddo lp_loop4 !: do lp = 1,nlp
! open(114,file='plasma_tube_apex_coords_2.2005.format_latest',form='formatted',status='unknown')
i_count = 0
do lp = 1 , nlp
in_2d(lp) = i_count + 1
is_2d(lp) = in_2d(lp) + is(1,lp) - in(1,lp)
i_count = is_2d(lp)
enddo
do lp = 1 , nlp
write(6,*) 'points ',lp,in(1,lp),is(1,lp),in_2d(lp),is_2d(lp)
pnt_on_tube=is(1,lp)-in(1,lp)+1
! write(6,*) 'lp=',lp,'pnt_on_tube=',pnt_on_tube,'gcol=',gcol(in(1,lp),1,lp)
enddo
do mp = 1 , nmp
do lp = 1 , nlp
! gr_2d(in_2d(lp):is_2d(lp),mp) = gr(in(mp,lp):is(mp,lp),mp,lp)
gcol_2d(in_2d(lp):is_2d(lp),mp) = gcol(in(mp,lp):is(mp,lp),mp,lp)
glon_2d(in_2d(lp):is_2d(lp),mp) = glon(in(mp,lp):is(mp,lp),mp,lp)
q_coordinate_2d(in_2d(lp):is_2d(lp),mp) = q_coordinate(in(mp,lp):is(mp,lp),mp,lp)
bcol_2d(in_2d(lp):is_2d(lp),mp) = bcol(in(mp,lp):is(mp,lp),mp,lp)
! vmp_tube_2d(in_2d(lp):is_2d(lp),mp) = vmp_tube(in(mp,lp):is(mp,lp),mp,lp)
! B_magnitude_on_tubes_3D_2d(in_2d(lp):is_2d(lp),mp) = B_magnitude_on_tubes_3D(in(mp,lp):is(mp,lp),mp,lp)
! Apex_BE3_2d(in_2d(lp):is_2d(lp),mp) = Apex_BE3(in(mp,lp):is(mp,lp),mp,lp)
! Eta_Apex_3d_2d(in_2d(lp):is_2d(lp),mp) = Eta_Apex_3d(in(mp,lp):is(mp,lp),mp,lp)
! integral_ds_2d(in_2d(lp):is_2d(lp),mp) = integral_ds(in(mp,lp):is(mp,lp),mp,lp)
! apex_D_2d(in_2d(lp):is_2d(lp),mp) = apex_D(in(mp,lp):is(mp,lp),mp,lp)
! apex_d1d1_2d(in_2d(lp):is_2d(lp),mp) = apex_d1d1(in(mp,lp):is(mp,lp),mp,lp)
! apex_d2d2_2d(in_2d(lp):is_2d(lp),mp) = apex_d2d2(in(mp,lp):is(mp,lp),mp,lp)
! apex_BMAG_2d(in_2d(lp):is_2d(lp),mp) = apex_BMAG(in(mp,lp):is(mp,lp),mp,lp)
if (lp.lt.7) then
gr_2d(in_2d(lp):is_2d(lp),mp) = gr(in(mp,lp):is(mp,lp),mp,7)
integral_ds_2d(in_2d(lp):is_2d(lp),mp) = integral_ds(in(mp,lp):is(mp,lp),mp,7)
apex_BMAG_2d(in_2d(lp):is_2d(lp),mp) = apex_BMAG(in(mp,lp):is(mp,lp),mp,7)
else
gr_2d(in_2d(lp):is_2d(lp),mp) = gr(in(mp,lp):is(mp,lp),mp,lp)
integral_ds_2d(in_2d(lp):is_2d(lp),mp) = integral_ds(in(mp,lp):is(mp,lp),mp,lp)
apex_BMAG_2d(in_2d(lp):is_2d(lp),mp) = apex_BMAG(in(mp,lp):is(mp,lp),mp,lp)
endif
do j = 1 , 3
Apex_D1_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_D1(j,in(mp,lp):is(mp,lp),mp,lp)
Apex_D2_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_D2(j,in(mp,lp):is(mp,lp),mp,lp)
Apex_D3_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_D3(j,in(mp,lp):is(mp,lp),mp,lp)
Apex_E1_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_E1(j,in(mp,lp):is(mp,lp),mp,lp)
Apex_E2_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_E2(j,in(mp,lp):is(mp,lp),mp,lp)
! Apex_E3_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_E3(j,in(mp,lp):is(mp,lp),mp,lp)
! Apex_grdlbm2_2d(j,in_2d(lp):is_2d(lp),mp) = Apex_grdlbm2(j,in(mp,lp):is(mp,lp),mp,lp)
! apex_BHAT_2d(j,in_2d(lp):is_2d(lp),mp) = apex_BHAT(j,in(mp,lp):is(mp,lp),mp,lp)
enddo
enddo
enddo
do mp = 1 , nmp
do lp = 1 , nlp
in_2d_3d(mp,lp) = in_2d(lp)
is_2d_3d(mp,lp) = is_2d(lp)
Apex_BE3_N(mp,lp) = Apex_BE3(in(mp,lp),mp,lp)
Apex_BE3_S(mp,lp) = Apex_BE3(is(mp,lp),mp,lp)
enddo
enddo
print *, "Begin writing file..."
write(114,*) IN_2d_3d , IS_2d_3d
write(114,*) gr_2d, gcol_2d, glon_2d, q_coordinate_2d
! write(115,*) q_coordinate_2d
write(114,*) bcol_2d
write(114,*) integral_ds_2d, apex_BMAG_2d
write(114,*) Apex_D1_2d, Apex_D2_2d, Apex_D3_2d
write(114,*) Apex_E1_2d, Apex_E2_2d !Apex_grdlbm2_2d
write(114,*) Apex_BE3_N, Apex_BE3_S
close(114)
! close(115)
print *, "end writing..."
! do mp=1,nmp
! do lp=1,nlp
! do i=in_2d_3d(mp,lp),is_2d_3d(mp,lp)
! write(1114,111) mp,lp,i,(gr_2d(i,mp)-R0)/1000.,glon_2d(i,mp)/DTR,90.-gcol_2d(i,mp)/DTR
!111 format(I2,1X,I2,1X,I5,1X,F13.7,1X,2(F13.7,1X))
! enddo
! enddo
! end do
do lp = 1 , nlp
midpoint(lp) = (in_2d_3d(1,lp) + is_2d_3d(1,lp))/2
enddo
! print *, "not calling newinterp_high_res_TEC"
call newinterp_high_res_TEC(IN_2d_3d,IS_2d_3d,midpoint,gr_2d,gcol_2d,glon_2d)
! stop
end subroutine calc_apex_params_2d_2
subroutine get_apex2(gr, gcol, glon,npts,nmp,nlp, &
apex_grdlbm2,in, is)
! Reference: Richmond, A. D., Ionospheric Electrodynamics Using
! Magnetic Apex Coordinates, J. Geomag. Geoelectr., 47, 191-212, 1995.
! INPUTS:
! GLAT = Geographic (geodetic) latitude, degrees, must be within
! the grid domain (GPLAT(1) <= GLAT <= GPLAT(NLAT)).
! GLON = Geographic (geodetic) longitude, degrees, must be within
! one revolution of the grid domain:
! GPLON(1) <= GLON-360.,GLON, or GLON+360. <= GPLON(NLON))
! ALT = Altitude, km
! WK = same as entry APXMKA
! RETURNS:
! BMAG = magnitude of magnetic field, in nT
! BE3 = B_e3 of reference above (= Bmag/D), in nT
! D1,D2,D3,E1,E2,E3 = components (east, north, up) of base vectors
! described in reference above
! IST = Return status: okay (0); or failure (1).
! Dimensions of non-scalar arguments to APXMALL:
! GPLAT(NLAT),GPLON(NLON),GPALT(NALT),WK(LWK),
! B(3),BHAT(3),D1(3),D2(3),D3(3), E1(3),E2(3),E3(3), F1(2),F2(2)
implicit none
integer, intent(in) :: npts,nmp,nlp,in(nmp,nlp),is(nmp,nlp)
real(kind = 8), intent(in) :: &
gr(npts,nmp,nlp) , & ! Earth radii[m]
gcol(npts,nmp,nlp) , & ! geog. colatitude [rad]
glon(npts,nmp,nlp) ! geog. longitude [rad]
real(kind = 8), intent(out) :: apex_grdlbm2(3,npts,nmp,nlp)
REAL(kind=8) PI
REAL(kind=8) DTR
REAL(kind=8) RTD
PARAMETER (PI=3.141592654,DTR=PI/180.0,RTD=180.0/PI)
! local:
integer:: ipts,mp,lp
real(kind = 8) :: glon_deg,glat_deg,z_km
! m
real(kind = 8) :: x,y,z, &
bnrth,beast,bdown,bpx,bmx,bpy,bmy,bpz,bmz, &
re_plasma2,amount
real(kind = 8) :: dlbm2dx,dlbm2dy,dlbm2dz, &
coslat,sinlat,coslon,sinlon
bnrth = 0.
beast = 0.
bdown = 0.
amount = 10.
! re_plasma2 = 6360.
re_plasma2 = 6371.2
do mp = 1,nmp ! loop over # of flux tubes in longitude
do lp = 1,nlp ! loop over # of flux tubes in latitude
do ipts = in(mp,lp),is(mp,lp) ! loop over points along flux tube
glat_deg = 90. - gcol(ipts,mp,lp)*rtd ! geo.colat[rad] -> geo.lat[deg]
glon_deg = glon(ipts,mp,lp)*rtd ! geo.lon[rad] -> geo.lon[deg]
z_km = gr(ipts,mp,lp)*1e-3 - re_plasma2 ! earth radii[m] -> altitude [km]
!C Calculate geocentric cartesian coordinates x,y,z (in km)
call GD2CART2(GLAT_deg,GLON_deg,z_km,X,Y,Z)
!C Calculate gradient of ALOG(B0**(-2)) [= -2*ALOG(B0)] in Cartesian
!C coordinates, in units of m^{-1}
!g
!g
!g
call FELDG2 (2,(X+amount)/re_plasma2,Y/re_plasma2,Z/re_plasma2,BNRTH,BEAST,BDOWN,BPX)
call FELDG2 (2,(X-amount)/re_plasma2,Y/re_plasma2,Z/re_plasma2,BNRTH,BEAST,BDOWN,BMX)
call FELDG2 (2,X/re_plasma2,(Y+amount)/re_plasma2,Z/re_plasma2,BNRTH,BEAST,BDOWN,BPY)
call FELDG2 (2,X/re_plasma2,(Y-amount)/re_plasma2,Z/re_plasma2,BNRTH,BEAST,BDOWN,BMY)
call FELDG2 (2,X/re_plasma2,Y/re_plasma2,(Z+amount)/re_plasma2,BNRTH,BEAST,BDOWN,BPZ)
call FELDG2 (2,X/re_plasma2,Y/re_plasma2,(Z-amount)/re_plasma2,BNRTH,BEAST,BDOWN,BMZ)
! Converted these logs to use LOG instead of ALOG. mjh
dlbm2dx = (log(BMX) - log(BPX))/1.E4
dlbm2dy = (log(BMY) - log(BPY))/1.E4
dlbm2dz = (log(BMZ) - log(BPZ))/1.E4
!C Rotate gradient to local (east,north,up) coordinates
!C (1=east, 2=north, 3=up)
coslat = cos(glat_deg*DTR)
sinlat = sin(glat_deg*DTR)
coslon = cos(glon_deg*DTR)
sinlon = sin(glon_deg*DTR)
apex_grdlbm2(1,ipts,mp,lp) = -dlbm2dx*sinlon + dlbm2dy*coslon
apex_grdlbm2(2,ipts,mp,lp) = -(dlbm2dx*coslon + dlbm2dy*sinlon)*sinlat+dlbm2dz*coslat
apex_grdlbm2(3,ipts,mp,lp) = (dlbm2dx*coslon + dlbm2dy*sinlon)*coslat+dlbm2dz*sinlat
! g
enddo! loop over points along flux tube
enddo ! loop over # of flux tubes in latitude
enddo ! loop over # of flux tubes in longitude
return
end subroutine get_apex2
SUBROUTINE newinterp_high_res_TEC(IN,IS,midpoint,gr,gcol,glon)
IMPLICIT NONE
integer npts, nmp, nlp
include 'npts.h'
REAL(KIND=8) :: DTR
REAL(KIND=8) :: factor
REAL(KIND=8) :: gcol
REAL(KIND=8) :: geol1
REAL(KIND=8) :: geol2
REAL(KIND=8) :: &
geolat , glon , gr , grin , height , &
phngd , plat , plon
REAL(KIND=8) :: R0 , thngd
REAL(KIND=8) :: x1 , xn , y1 , yn , z1 , zn , PI
REAL(KIND=8) :: &
facc , facfac , dd,hvec
INTEGER :: i , ic , ifailed , iheight , &
ihem , ilon , IN , in1 , in2 , &
IS, nheights
INTEGER :: l , lp , m , mp , midpoint(nlp) , &
inearst , i1 , i2 , i3 , i4 , ii1 , ii2 , ii3 , &
ii4
REAL(KIND=8) :: maxlat , minlat
REAL(KIND=8) :: original_distance, &
sorted_distance
INTEGER :: MHIgh(90) , MLOw(90) , max_ic, minny1(1), &
minny(3)
PARAMETER (PI=3.141592654,DTR=PI/180.0,R0=6.3712E06)
! PARAMETER (nheights = 31)
PARAMETER (nheights = 183)
allocatable :: original_distance(:),sorted_distance(:)
integer npts2
! parameter (npts2=122817)
parameter (npts2=44514)
parameter (max_ic = 2*nmp*nlp)
DIMENSION gr(NPTS2,NMP) , gcol(NPTS2,NMP) , &
glon(NPTS2,NMP) , &
grin(NPTS2) , IN(NMP,NLP) , IS(NMP,NLP)
DIMENSION plat(max_ic) , plon(max_ic) , &
facc(max_ic) , &
i1(max_ic), i2(max_ic), i3(max_ic) , i4(max_ic) , &
ii1(3,nheights,91,90), ii2(3,nheights,91,90), &
ii3(3,nheights,91,90) , ii4(3,nheights,91,90) , &
facfac(3,nheights,91,90) , &
dd(3,nheights,91,90),hvec(nheights)
REAL(KIND=8) :: glon1 , glon2
! 31 heights (original?)
! DATA hvec/90.,95.,100.,105.,110.,115.,120.,125., &
! 150.,175.,200.,225.,250.,275.,300.,325.,350.,375.,400., &
! 450.,500.,550.,600.,700.,800.,900.,1000., &
! 2000.,4000.,6370.,9000./
!g
! calculate mhigh and mlow
! height = 9000.*1000.+ R0
! height = 1000.*1000.+ R0
! print *, height
! ic = 0
! DO 650 mp = 1 , NMP
! DO 640 lp = 1 , NLP
! DO 610 i = IN(mp,lp) , IS(mp,lp)
! grin(i) = gr(i,mp)
! 610 ENDDO
! DO 620 ihem = 1 , 2
! IF ( ihem == 1 ) THEN
! call FASTNEARHTPLA(grin,height,in(mp,lp),midpoint(lp),in1,in2, &
! inearst,ifailed)
! ELSE
! call FASTNEARHTPLA(grin,height,is(mp,lp),midpoint(lp),in1,in2, &
! inearst,ifailed)
! ENDIF
! IF ( ifailed == 0 ) THEN
! ic = ic + 1
! !g interpolation factor for each point....
! factor = (height-grin(in1))/(grin(in2)-grin(in1))
! facc(ic)=factor
! !g position of this point in latitude and longitude....
! plat(ic) = (((gcol(in2,mp)-gcol(in1,mp))* &
! factor)+gcol(in1,mp))/DTR
! glon2 = glon(in2,mp)
! glon1 = glon(in1,mp)
! if((glon2-glon1)/dtr > 10.) glon1 = glon1 + (360.*dtr)
! if((glon2-glon1)/dtr < -10.) glon2 = glon2 + (360.*dtr)
! plon(ic) = (((glon2 - glon1) * factor)+glon1)/DTR
! IF ( plon(ic) >= 360. ) plon(ic) = plon(ic) - 360.
! IF ( plon(ic) < 0. ) plon(ic) = plon(ic) + 360.
! !g relevent parameters at the point.....
! !g
! !g keep the flux-tube indexes for each 'ic' point in 4 arrays ......
! !g
! ! i1(ic)=mp
! ! i2(ic)=lp
! ! i3(ic)=in2
! ! i4(ic)=in1
! ENDIF
! 620 ENDDO
! 640 ENDDO
! 650 ENDDO
! DO 680 ilon = 1 , 90
! geol2 = FLOAT(ilon)*4.
! geol1 = FLOAT(ilon-2)*4.
! minlat = 90.
! maxlat = -90.
! DO 660 i = 1 , ic
! IF ( ilon == 1 ) THEN
! IF ( plon(i) < 4. .OR. plon(i) > 356. ) THEN
! geolat = 90. - plat(i)
! IF ( geolat > maxlat ) maxlat = geolat
! IF ( geolat < minlat ) minlat = geolat
! ENDIF
! ELSEIF ( plon(i) <= geol2 .AND. plon(i) >= geol1 ) &
! THEN
! geolat = 90. - plat(i)
! IF ( geolat > maxlat ) maxlat = geolat
! IF ( geolat < minlat ) minlat = geolat
! ENDIF
! 660 ENDDO
! MHIgh(ilon) = INT(maxlat/2.) + 45
! MLOw(ilon) = INT(minlat/2.) + 47
! 680 ENDDO
! end calculating mhigh and mlow
DO 300 iheight = nheights , 1 , -1
! For 31 heights
! height = hvec(iheight)*1000. + R0
! For 183 heights
height = FLOAT(iheight-1)*5000. + 90000. + R0
write(6,*) iheight,height
!g
!g Loop over all the flux tubes......
!g
ic = 0
DO 150 mp = 1 , NMP
DO 140 lp = 1 , NLP
DO 110 i = IN(mp,lp) , IS(mp,lp)
grin(i) = gr(i,mp)
110 ENDDO
DO 120 ihem = 1 , 2
IF ( ihem == 1 ) THEN
call FASTNEARHTPLA(grin,height,in(mp,lp),midpoint(lp),in1,in2, &
inearst,ifailed)
ELSE
call FASTNEARHTPLA(grin,height,is(mp,lp),midpoint(lp),in1,in2, &
inearst,ifailed)
ENDIF
IF ( ifailed == 0 ) THEN
ic = ic + 1
!g interpolation factor for each point....
factor = (height-grin(in1))/(grin(in2)-grin(in1))
facc(ic)=factor
!g position of this point in latitude and longitude....
plat(ic) = (((gcol(in2,mp)-gcol(in1,mp))* &
factor)+gcol(in1,mp))/DTR
glon2 = glon(in2,mp)
glon1 = glon(in1,mp)
if((glon2-glon1)/dtr > 10.) glon1 = glon1 + (360.*dtr)
if((glon2-glon1)/dtr < -10.) glon2 = glon2 + (360.*dtr)
plon(ic) = (((glon2 - glon1) * factor)+glon1)/DTR
IF ( plon(ic) >= 360. ) plon(ic) = plon(ic) - 360.
IF ( plon(ic) < 0. ) plon(ic) = plon(ic) + 360.
!g relevent parameters at the point.....
!g
!g keep the flux-tube indexes for each 'ic' point in 4 arrays ......
!g
i1(ic)=mp
i2(ic)=lp
i3(ic)=in2
i4(ic)=in1
ENDIF
120 ENDDO
140 ENDDO
150 ENDDO
!g
!g Find out the max and min latitudes covered at each geo
!g longitude by points at 1000 km....
!g
! IF ( iheight == 183 ) THEN
! DO 180 ilon = 1 , 90
! geol2 = FLOAT(ilon)*4.
! geol1 = FLOAT(ilon-2)*4.
! minlat = 90.
! maxlat = -90.
! DO 160 i = 1 , ic
! IF ( ilon == 1 ) THEN
! IF ( plon(i) < 4. .OR. plon(i) > 356. ) THEN
! geolat = 90. - plat(i)
! IF ( geolat > maxlat ) maxlat = geolat
! IF ( geolat < minlat ) minlat = geolat
! ENDIF
! ELSEIF ( plon(i) <= geol2 .AND. plon(i) >= geol1 ) &
! THEN
! geolat = 90. - plat(i)
! IF ( geolat > maxlat ) maxlat = geolat
! IF ( geolat < minlat ) minlat = geolat
! ENDIF
! 160 ENDDO
! MHIgh(ilon) = INT(maxlat/2.) + 45
! MLOw(ilon) = INT(minlat/2.) + 47
! write(6,5760) ilon,maxlat,mhigh(ilon),minlat,mlow(ilon)
! 5760 format('mhigh mlow ',i4,f5.1,i4,f6.1,i4)
! 180 ENDDO
! ENDIF
!g
!g Now interpolate all the values at a given height
!g onto the Geo grid
DO 250 l = 1 , 90
phngd = FLOAT(l-1)*4.
! DO 220 m = MLOw(l) , MHIgh(l)
DO 220 m = 1,91
thngd = 180. - (2.*FLOAT(m-1))
xn = height*SIN(thngd*DTR)*COS(phngd*DTR)
yn = height*SIN(thngd*DTR)*SIN(phngd*DTR)
zn = height*COS(thngd*DTR)
!g
!g loop over all points
!g
if(allocated(original_distance)) deallocate(original_distance)
if(allocated(sorted_distance)) deallocate(sorted_distance)
allocate (original_distance(ic),sorted_distance(ic))
DO 200 i = 1 , ic
x1 = height*SIN((plat(i))*DTR)*COS((plon(i))*DTR)
y1 = height*SIN((plat(i))*DTR)*SIN((plon(i))*DTR)
z1 = height*COS((plat(i))*DTR)
!g Cartesian distance to neutral point....
original_distance(i) = SQRT((x1-xn)*(x1-xn)+(y1-yn)*(y1-yn)+(z1-zn) &
*(z1-zn))
sorted_distance(i) = original_distance(i)
200 ENDDO
!g
minny1 = minloc(sorted_distance)
minny(1) = minny1(1)
sorted_distance(minny(1)) = 1.d50
minny1 = minloc(sorted_distance)
minny(2) = minny1(1)
sorted_distance(minny(2)) = 1.d50
minny1 = minloc(sorted_distance)
minny(3) = minny1(1)
sorted_distance(minny(3)) = 1.d50
!g
do i=1,3
!g
!g The 3 closest points are defined by 4 integers and a factor (mp,lp,in2,in1,facfac)......
!g
ii1(i,iheight,m,l)=i1(minny(i))
ii2(i,iheight,m,l)=i2(minny(i))
ii3(i,iheight,m,l)=i3(minny(i))
ii4(i,iheight,m,l)=i4(minny(i))
facfac(i,iheight,m,l)=facc(minny(i))
dd(i,iheight,m,l)=original_distance(minny(i))
enddo
!g lat,lon loop.....
220 ENDDO
250 ENDDO
!g height loop....
300 ENDDO
!g
write(1115,*) facfac
write(1115,*) dd
write(1115,*) ii1
write(1115,*) ii2
write(1115,*) ii3
write(1115,*) ii4
! write(1115,*) mlow
! write(1115,*) mhigh
close(1115)
!g
RETURN
end SUBROUTINE newinterp_high_res_TEC
SUBROUTINE FASTNEARHTPLA(ARR,VALue,M_IN,N_IN,M,N,nearst,IFAiled)
! this routine finds which two elements of ARR
! surround Value. Arr is a monotonically increasing array
! The start and end points for the search are M_IN and N_IN.
! The exit points surrounding Value are N and M
IMPLICIT NONE
integer npts2
! parameter (npts2=122817)
parameter (npts2=44514)
REAL(kind=8) :: ARR , VALue , dist1 , dist2
INTEGER :: IFAiled , M , N , &
M_IN , N_IN , n1 , nearst
DIMENSION ARR(NPTS2)
N=N_IN
M=M_IN
IFAiled = 0
if((value <= arr(n) .AND. value >= arr(m)) .OR. &
(value >= arr(n) .AND. value <= arr(m))) then
234 n1 =(n - m)/2 + m
IF ( ARR(n1) > VALue ) then
n=n1
else
m=n1
ENDIF
if(abs(n-m) > 1) goto 234
dist1=abs(arr(n)-value)
dist2=abs(arr(m)-value)
if(dist1 < dist2) then
nearst=n
else
nearst=m
endif
else
ifailed=1
endif
RETURN
end SUBROUTINE FASTNEARHTPLA
SUBROUTINE COFRM2 (DATE)
! Assign DGRF/IGRF spherical harmonic coefficients, to degree and
! order NMAX, for DATE, yyyy.fraction, into array G. Coefficients
! are interpolated from the DGRF dates through the current IGRF year.
! Coefficients for a later DATE are extrapolated using the IGRF
! initial value and the secular change coefficients. A warning
! message is issued if DATE is later than the last recommended
! (5 yrs later than the IGRF). An DATE input earlier than the
! first DGRF (EPOCH(1)), results in a diagnostic and a STOP.
!
! Output in COMMON /MAGCOF2/ NMAX,GB(144),GV(144),ICHG
! NMAX = Maximum order of spherical harmonic coefficients used
! GB = Coefficients for magnetic field calculation
! GV = Coefficients for magnetic potential calculation
! ICHG = Flag indicating when GB,GV have been changed in COFRM
!
! HISTORY (blame):
! COFRM and FELDG originated 15 Apr 83 by Vincent B. Wickwar
! (formerly at SRI. Int., currently at Utah State). Although set
! up to accomodate second order time derivitives, the IGRF
! (GTT, HTT) have been zero. The spherical harmonic coefficients
! degree and order is defined by NMAX (currently 10).
!
! Jun 86: Updated coefficients adding DGRF 1980 & IGRF 1985, which
! were obtained from Eos Vol. 7, No. 24. Common block MAG was
! replaced by MAGCOF2, thus removing variables not used in subroutine
! FELDG. (Roy Barnes)
!
! Apr 1992 (Barnes): Added DGRF 1985 and IGRF 1990 as described
! in EOS Vol 73 Number 16 Apr 21 1992. Other changes were made so
! future updates should:
! (1) Increment NDGY;
! (2) Append to EPOCH the next IGRF year;
! (3) Append the next DGRF coefficients to G1DIM and H1DIM; and
! (4) Replace the IGRF initial values (G0, GT) and rates of
! change indices (H0, HT).
!
! Apr 94 (Art Richmond): Computation of GV added, for finding
! magnetic potential.
!
! Aug 95 (Barnes): Added DGRF for 1990 and IGRF for 1995, which were
! obtained by anonymous ftp geomag.gsfc.nasa.gov (cd pub, mget table*)
! as per instructions from Bob Langel (langel@geomag.gsfc.nasa.gov),
! but, problems are to be reported to baldwin@geomag.gsfc.nasa.gov
! Oct 95 (Barnes): Correct error in IGRF-95 G 7 6 and H 8 7 (see
! email in folder). Also found bug whereby coefficients were not being
! updated in FELDG when IENTY did not change. ICHG was added to flag
! date changes. Also, a vestigial switch (IS) was removed from COFRM:
! It was always 0 and involved 3 branch if statements in the main
! polynomial construction loop (now numbered 200).
! Feb 99 (Barnes): Explicitly initialize GV(1) in COFRM to avoid
! possibility of compiler or loader options initializing memory
! to something else (e.g., indefinite). Also simplify the algebra
! in COFRM; this does not effect results.
! Mar 99 (Barnes): Removed three branch if's from FELDG and changed
! statement labels to ascending order
! Jun 99 (Barnes): Corrected RTOD definition in GD2CART.
! May 00 (Barnes): Replace IGRF 1995 with DGRF 1995, add IGRF
! 2000, and extend the earlier DGRF's backward to 1900. A complete
! set of coefficients came from a NGDC web page
implicit none
integer ICHG,nmax , I , IY , I1
integer N , M , NN , MM
integer NDGY , NYT , NGH
REAL(kind=8) RNN
REAL(kind=8) RTOD
REAL(kind=8) DTOR
REAL(kind=8) F , F0
REAL(kind=8) G(144) , GV(144)
REAL(kind=8) date , time , t
PARAMETER (RTOD=57.2957795130823, DTOR=0.01745329251994330)
COMMON /MAGCOF2/G,GV,ICHG,nmax
DATA NMAX,ICHG /10,-99999/
PARAMETER (NDGY=20 , NYT = NDGY+1 , NGH = 144*NDGY)
! NDGY = Number of DGRF years of sets of coefficients
! NYT = Add one for the IGRF set (and point to it).
! NGH = Dimension of the equivalenced arrays
real(kind=8) GYR(12,12,NYT) , HYR(12,12,NYT), EPOCH(NYT) , &
G1DIM(NGH) , H1DIM(NGH) , &
G0(12,12) , GT(12,12) , GTT(12,12) , &
H0(12,12) , HT(12,12) , HTT(12,12)
EQUIVALENCE (GYR(1,1,1),G1DIM(1)) , (HYR(1,1,1),H1DIM(1)) , &
(GYR(1,1,NYT),G0(1,1)) , (HYR(1,1,NYT),H0(1,1))
DATA EPOCH /1900, 1905, 1910, 1915, 1920, 1925, 1930, 1935, 1940, &
1945, 1950, 1955, 1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, &
2000/
! D_/Dtime2 coefficients are 0
DATA GTT/144*0./,HTT/144*0./
! DGRF g(n,m) for 1900:
! The "column" corresponds to "n" and
! the "line" corresponds to "m" as indicated in column 6;
! e.g., for 1965 g(0,3) = 1297. or g(6,6) = -111.
DATA (G1DIM(I),I=1,144) /0, &
-31543, -677, 1022, 876, -184, 63, 70, 11, 8, -3, 2*0, &
-2298, 2905, -1469, 628, 328, 61, -55, 8, 10, -4, 3*0, &
924, 1256, 660, 264, -11, 0, -4, 1, 2, 4*0, &
572, -361, 5, -217, 34, -9, -11, -5, 5*0, &
134, -86, -58, -41, 1, 12, -2, 6*0, &
-16, 59, -21, 2, 1, 6, 7*0, &
-90, 18, -9, -2, 4, 8*0, &
6, 5, 2, 0, 9*0, &
8, -1, 2, 10*0, &
-1, 2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1905:
DATA (G1DIM(I),I=145,288) /0, &
-31464, -728, 1037, 880, -192, 62, 70, 11, 8, -3, 2*0, &
-2298, 2928, -1494, 643, 328, 60, -54, 8, 10, -4, 3*0, &
1041, 1239, 653, 259, -11, 0, -4, 1, 2, 4*0, &
635, -380, -1, -221, 33, -9, -11, -5, 5*0, &
146, -93, -57, -41, 1, 12, -2, 6*0, &
-26, 57, -20, 2, 1, 6, 7*0, &
-92, 18, -8, -2, 4, 8*0, &
6, 5, 2, 0, 9*0, &
8, 0, 2, 10*0, &
-1, 2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1910:
DATA (G1DIM(I),I=289,432) /0, &
-31354, -769, 1058, 884, -201, 62, 71, 11, 8, -3, 2*0, &
-2297, 2948, -1524, 660, 327, 58, -54, 8, 10, -4, 3*0, &
1176, 1223, 644, 253, -11, 1, -4, 1, 2, 4*0, &
705, -400, -9, -224, 32, -9, -11, -5, 5*0, &
160, -102, -54, -40, 1, 12, -2, 6*0, &
-38, 54, -19, 2, 1, 6, 7*0, &
-95, 18, -8, -2, 4, 8*0, &
6, 5, 2, 0, 9*0, &
8, 0, 2, 10*0, &
-1, 2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1915:
DATA (G1DIM(I),I=433,576) /0, &
-31212, -802, 1084, 887, -211, 61, 72, 11, 8, -3, 2*0, &
-2306, 2956, -1559, 678, 327, 57, -54, 8, 10, -4, 3*0, &
1309, 1212, 631, 245, -10, 2, -4, 1, 2, 4*0, &
778, -416, -16, -228, 31, -9, -11, -5, 5*0, &
178, -111, -51, -38, 2, 12, -2, 6*0, &
-51, 49, -18, 3, 1, 6, 7*0, &
-98, 19, -8, -2, 4, 8*0, &
6, 6, 2, 0, 9*0, &
8, 0, 1, 10*0, &
-1, 2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1920:
DATA (G1DIM(I),I=577,720) /0, &
-31060, -839, 1111, 889, -221, 61, 73, 11, 8, -3, 2*0, &
-2317, 2959, -1600, 695, 326, 55, -54, 7, 10, -4, 3*0, &
1407, 1205, 616, 236, -10, 2, -3, 1, 2, 4*0, &
839, -424, -23, -233, 29, -9, -11, -5, 5*0, &
199, -119, -46, -37, 2, 12, -2, 6*0, &
-62, 44, -16, 4, 1, 6, 7*0, &
-101, 19, -7, -2, 4, 8*0, &
6, 6, 2, 0, 9*0, &
8, 0, 1, 10*0, &
-1, 3, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1925:
DATA (G1DIM(I),I=721,864) /0, &
-30926, -893, 1140, 891, -230, 61, 73, 11, 8, -3, 2*0, &
-2318, 2969, -1645, 711, 326, 54, -54, 7, 10, -4, 3*0, &
1471, 1202, 601, 226, -9, 3, -3, 1, 2, 4*0, &
881, -426, -28, -238, 27, -9, -11, -5, 5*0, &
217, -125, -40, -35, 2, 12, -2, 6*0, &
-69, 39, -14, 4, 1, 6, 7*0, &
-103, 19, -7, -2, 4, 8*0, &
6, 7, 2, 0, 9*0, &
8, 0, 1, 10*0, &
-1, 3, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1930:
DATA (G1DIM(I),I=865,1008) /0, &
-30805, -951, 1172, 896, -237, 60, 74, 11, 8, -3, 2*0, &
-2316, 2980, -1692, 727, 327, 53, -54, 7, 10, -4, 3*0, &
1517, 1205, 584, 218, -9, 4, -3, 1, 2, 4*0, &
907, -422, -32, -242, 25, -9, -12, -5, 5*0, &
234, -131, -32, -34, 2, 12, -2, 6*0, &
-74, 32, -12, 5, 1, 6, 7*0, &
-104, 18, -6, -2, 4, 8*0, &
6, 8, 3, 0, 9*0, &
8, 0, 1, 10*0, &
-2, 3, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1935:
DATA (G1DIM(I),I=1009,1152) /0, &
-30715, -1018, 1206, 903, -241, 59, 74, 11, 8, -3, 2*0, &
-2306, 2984, -1740, 744, 329, 53, -53, 7, 10, -4, 3*0, &
1550, 1215, 565, 211, -8, 4, -3, 1, 2, 4*0, &
918, -415, -33, -246, 23, -9, -12, -5, 5*0, &
249, -136, -25, -33, 1, 11, -2, 6*0, &
-76, 25, -11, 6, 1, 6, 7*0, &
-106, 18, -6, -2, 4, 8*0, &
6, 8, 3, 0, 9*0, &
7, 0, 2, 10*0, &
-2, 3, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1940:
DATA (G1DIM(I),I=1153,1296) /0, &
-30654, -1106, 1240, 914, -241, 57, 74, 11, 8, -3, 2*0, &
-2292, 2981, -1790, 762, 334, 54, -53, 7, 10, -4, 3*0, &
1566, 1232, 550, 208, -7, 4, -3, 1, 2, 4*0, &
916, -405, -33, -249, 20, -10, -12, -5, 5*0, &
265, -141, -18, -31, 1, 11, -2, 6*0, &
-76, 18, -9, 6, 1, 6, 7*0, &
-107, 17, -5, -2, 4, 8*0, &
5, 9, 3, 0, 9*0, &
7, 1, 2, 10*0, &
-2, 3, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1945:
DATA (G1DIM(I),I=1297,1440) /0, &
-30594, -1244, 1282, 944, -253, 59, 70, 13, 5, -3, 2*0, &
-2285, 2990, -1834, 776, 346, 57, -40, 7, -21, 11, 3*0, &
1578, 1255, 544, 194, 6, 0, -8, 1, 1, 4*0, &
913, -421, -20, -246, 0, -5, -11, 2, 5*0, &
304, -142, -25, -29, 9, 3, -5, 6*0, &
-82, 21, -10, 7, 16, -1, 7*0, &
-104, 15, -10, -3, 8, 8*0, &
29, 7, -4, -1, 9*0, &
2, -3, -3, 10*0, &
-4, 5, 11*0, &
-2, 13*0/
! DGRF g(n,m) for 1950:
DATA (G1DIM(I),I=1441,1584) /0, &
-30554, -1341, 1297, 954, -240, 54, 65, 22, 3, -8, 2*0, &
-2250, 2998, -1889, 792, 349, 57, -55, 15, -7, 4, 3*0, &
1576, 1274, 528, 211, 4, 2, -4, -1, -1, 4*0, &
896, -408, -20, -247, 1, -1, -25, 13, 5*0, &
303, -147, -16, -40, 11, 10, -4, 6*0, &
-76, 12, -7, 15, 5, 4, 7*0, &
-105, 5, -13, -5, 12, 8*0, &
19, 5, -2, 3, 9*0, &
-1, 3, 2, 10*0, &
8, 10, 11*0, &
3, 13*0/
! DGRF g(n,m) for 1955:
DATA (G1DIM(I),I=1585,1728) /0, &
-30500, -1440, 1302, 958, -229, 47, 65, 11, 4, -3, 2*0, &
-2215, 3003, -1944, 796, 360, 57, -56, 9, 9, -5, 3*0, &
1581, 1288, 510, 230, 3, 2, -6, -4, -1, 4*0, &
882, -397, -23, -247, 10, -14, -5, 2, 5*0, &
290, -152, -8, -32, 6, 2, -3, 6*0, &
-69, 7, -11, 10, 4, 7, 7*0, &
-107, 9, -7, 1, 4, 8*0, &
18, 6, 2, -2, 9*0, &
9, 2, 6, 10*0, &
5, -2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1960:
DATA (G1DIM(I),I=1729,1872) /0, &
-30421, -1555, 1302, 957, -222, 46, 67, 15, 4, 1, 2*0, &
-2169, 3002, -1992, 800, 362, 58, -56, 6, 6, -3, 3*0, &
1590, 1289, 504, 242, 1, 5, -4, 0, 4, 4*0, &
878, -394, -26, -237, 15, -11, -9, 0, 5*0, &
269, -156, -1, -32, 2, 1, -1, 6*0, &
-63, -2, -7, 10, 4, 4, 7*0, &
-113, 17, -5, -1, 6, 8*0, &
8, 10, -2, 1, 9*0, &
8, 3, -1, 10*0, &
-1, 2, 11*0, &
0, 13*0/
! DGRF g(n,m) for 1965:
DATA (G1DIM(I),I=1873,2016) /0, &
-30334, -1662, 1297, 957, -219, 45, 75, 13, 8, -2, 2*0, &
-2119, 2997, -2038, 804, 358, 61, -57, 5, 10, -3, 3*0, &
1594, 1292, 479, 254, 8, 4, -4, 2, 2, 4*0, &
856, -390, -31, -228, 13, -14, -13, -5, 5*0, &
252, -157, 4, -26, 0, 10, -2, 6*0, &
-62, 1, -6, 8, -1, 4, 7*0, &
-111, 13, -1, -1, 4, 8*0, &