1 |
c subroutine igrf_sub(xlat,xlong,year,height, |
2 |
c & xl,icode,dip,dec) |
3 |
c---------------------------------------------------------------- |
4 |
c INPUT: |
5 |
c xlat geodatic latitude in degrees |
6 |
c xlong geodatic longitude in degrees |
7 |
c year decimal year (year+month/12.0-0.5 or year+day-of-year/365 |
8 |
c or 366 if leap year) |
9 |
c height height in km |
10 |
c OUTPUT: |
11 |
c xl L value |
12 |
c icode =1 L is correct; =2 L is not correct; |
13 |
c =3 an approximation is used |
14 |
c dip geomagnetic inclination in degrees |
15 |
c dec geomagnetic declination in degress |
16 |
c---------------------------------------------------------------- |
17 |
c |
18 |
c REAL LATI,LONGI |
19 |
c COMMON/GENER/ UMR,ERA,AQUAD,BQUAD |
20 |
c SAVE /GENER/ |
21 |
C |
22 |
c CALL INITIZE |
23 |
c ibbb=0 |
24 |
c ALOG2=ALOG(2.) |
25 |
c ISTART=1 |
26 |
c lati=xlat |
27 |
c longi=xlong |
28 |
c |
29 |
C----------------CALCULATE PROFILES----------------------------------- |
30 |
c |
31 |
c CALL FELDCOF(YEAR,DIMO) |
32 |
c CALL FELDG(LATI,LONGI,HEIGHT,BNORTH,BEAST,BDOWN,BABS) |
33 |
c CALL SHELLG(LATI,LONGI,HEIGHT,DIMO,XL,ICODE,BAB1) |
34 |
c DIP=ASIN(BDOWN/BABS)/UMR |
35 |
c DEC=ASIN(BEAST/SQRT(BEAST*BEAST+BNORTH*BNORTH))/UMR |
36 |
c RETURN |
37 |
c END |
38 |
c |
39 |
c |
40 |
C SHELLIG.FOR, Version 2.0, January 1992 |
41 |
C |
42 |
C 11/01/91-DKB- SHELLG: lowest starting point for B0 search is 2 |
43 |
C 1/27/92-DKB- Adopted to IGRF-91 coeffcients model |
44 |
C 2/05/92-DKB- Reduce variable-names: INTER(P)SHC,EXTRA(P)SHC,INITI(ALI)ZE |
45 |
C 8/08/95-DKB- Updated to IGRF-45-95; new coeff. DGRF90, IGRF95, IGRF95S |
46 |
C 5/31/00-DKB- Updated to IGRF-45-00; new coeff.: IGRF00, IGRF00s |
47 |
C 3/24/05-DKB- Updated to IGRF-45-10; new coeff.: IGRF05, IGRF05s |
48 |
C 4/25/05-DKB- CALL FELDI and DO 1111 I=1,7 [Alexey Petrov] |
49 |
C |
50 |
C********************************************************************* |
51 |
C SUBROUTINES FINDB0, SHELLG, STOER, FELDG, FELDCOF, GETSHC, * |
52 |
C INTERSHC, EXTRASHC, INITIZE * |
53 |
C********************************************************************* |
54 |
C********************************************************************* |
55 |
C |
56 |
C |
57 |
SUBROUTINE FINDB0(STPS,BDEL,VALUE,BEQU,RR0) |
58 |
IMPLICIT REAL(8)(A-H) |
59 |
IMPLICIT REAL(8)(O-Z) |
60 |
C-------------------------------------------------------------------- |
61 |
C FINDS SMALLEST MAGNETIC FIELD STRENGTH ON FIELD LINE |
62 |
C |
63 |
C INPUT: STPS STEP SIZE FOR FIELD LINE TRACING |
64 |
C COMMON/FIDB0/ |
65 |
C SP DIPOLE ORIENTED COORDINATES FORM SHELLG; P(1,*), |
66 |
C P(2,*), P(3,*) CLOSEST TO MAGNETIC EQUATOR |
67 |
C BDEL REQUIRED ACCURACY = [ B(LAST) - BEQU ] / BEQU |
68 |
C B(LAST) IS FIELD STRENGTH BEFORE BEQU |
69 |
C |
70 |
C OUTPUT: VALUE =.FALSE., IF BEQU IS NOT MINIMAL VALUE ON FIELD LINE |
71 |
C BEQU MAGNETIC FIELD STRENGTH AT MAGNETIC EQUATOR |
72 |
C RR0 EQUATORIAL RADIUS NORMALIZED TO EARTH RADIUS |
73 |
C BDEL FINAL ACHIEVED ACCURACY |
74 |
C-------------------------------------------------------------------- |
75 |
REAL(8) P |
76 |
DIMENSION P(8,4),SP(3) |
77 |
LOGICAL VALUE |
78 |
COMMON/FIDB0/ SP |
79 |
SAVE /FIDB0/ |
80 |
C |
81 |
STEP=STPS |
82 |
IRUN=0 |
83 |
7777 IRUN=IRUN+1 |
84 |
IF(IRUN.GT.5) THEN |
85 |
VALUE=.FALSE. |
86 |
GOTO 8888 |
87 |
ENDIF |
88 |
C*********************FIRST THREE POINTS |
89 |
P(1,2)=SP(1) |
90 |
P(2,2)=SP(2) |
91 |
P(3,2)=SP(3) |
92 |
STEP=-SIGN(STEP,P(3,2)) |
93 |
CALL STOER(P(1,2),BQ2,R2) |
94 |
P(1,3)=P(1,2)+0.5*STEP*P(4,2) |
95 |
P(2,3)=P(2,2)+0.5*STEP*P(5,2) |
96 |
P(3,3)=P(3,2)+0.5*STEP |
97 |
CALL STOER(P(1,3),BQ3,R3) |
98 |
P(1,1)=P(1,2)-STEP*(2.*P(4,2)-P(4,3)) |
99 |
P(2,1)=P(2,2)-STEP*(2.*P(5,2)-P(5,3)) |
100 |
P(3,1)=P(3,2)-STEP |
101 |
CALL STOER(P(1,1),BQ1,R1) |
102 |
P(1,3)=P(1,2)+STEP*(20.*P(4,3)-3.*P(4,2)+P(4,1))/18. |
103 |
P(2,3)=P(2,2)+STEP*(20.*P(5,3)-3.*P(5,2)+P(5,1))/18. |
104 |
P(3,3)=P(3,2)+STEP |
105 |
CALL STOER(P(1,3),BQ3,R3) |
106 |
C******************INVERT SENSE IF REQUIRED |
107 |
IF(BQ3.LE.BQ1) GOTO 2 |
108 |
STEP=-STEP |
109 |
R3=R1 |
110 |
BQ3=BQ1 |
111 |
DO 1 I=1,5 |
112 |
ZZ=P(I,1) |
113 |
P(I,1)=P(I,3) |
114 |
1 P(I,3)=ZZ |
115 |
C******************INITIALIZATION |
116 |
2 STEP12=STEP/12. |
117 |
VALUE=.TRUE. |
118 |
BMIN=1.E4 |
119 |
BOLD=1.E4 |
120 |
C******************CORRECTOR (FIELD LINE TRACING) |
121 |
N=0 |
122 |
5555 P(1,3)=P(1,2)+STEP12*(5.*P(4,3)+8.*P(4,2)-P(4,1)) |
123 |
N=N+1 |
124 |
P(2,3)=P(2,2)+STEP12*(5.*P(5,3)+8.*P(5,2)-P(5,1)) |
125 |
C******************PREDICTOR (FIELD LINE TRACING) |
126 |
P(1,4)=P(1,3)+STEP12*(23.*P(4,3)-16.*P(4,2)+5.*P(4,1)) |
127 |
P(2,4)=P(2,3)+STEP12*(23.*P(5,3)-16.*P(5,2)+5.*P(5,1)) |
128 |
P(3,4)=P(3,3)+STEP |
129 |
CALL STOER(P(1,4),BQ3,R3) |
130 |
DO 1111 J=1,3 |
131 |
C DO 1111 I=1,8 |
132 |
DO 1111 I=1,7 |
133 |
1111 P(I,J)=P(I,J+1) |
134 |
B=SQRT(BQ3) |
135 |
IF(B.LT.BMIN) BMIN=B |
136 |
IF(B.LE.BOLD) THEN |
137 |
BOLD=B |
138 |
ROLD=1./R3 |
139 |
SP(1)=P(1,4) |
140 |
SP(2)=P(2,4) |
141 |
SP(3)=P(3,4) |
142 |
GOTO 5555 |
143 |
ENDIF |
144 |
IF(BOLD.NE.BMIN) THEN |
145 |
VALUE=.FALSE. |
146 |
ENDIF |
147 |
BDELTA=(B-BOLD)/BOLD |
148 |
IF(BDELTA.GT.BDEL) THEN |
149 |
STEP=STEP/10. |
150 |
GOTO 7777 |
151 |
ENDIF |
152 |
8888 RR0=ROLD |
153 |
BEQU=BOLD |
154 |
BDEL=BDELTA |
155 |
RETURN |
156 |
END |
157 |
C |
158 |
C |
159 |
SUBROUTINE SHELLG(GLAT,GLON,ALT,DIMO,FL,ICODE,B0) |
160 |
IMPLICIT REAL(8)(A-H) |
161 |
IMPLICIT REAL(8)(O-Z) |
162 |
C-------------------------------------------------------------------- |
163 |
C CALCULATES L-VALUE FOR SPECIFIED GEODAETIC COORDINATES, ALTITUDE |
164 |
C AND GEMAGNETIC FIELD MODEL. |
165 |
C REF: G. KLUGE, EUROPEAN SPACE OPERATIONS CENTER, INTERNAL NOTE |
166 |
C NO. 67, 1970. |
167 |
C G. KLUGE, COMPUTER PHYSICS COMMUNICATIONS 3, 31-35, 1972 |
168 |
C-------------------------------------------------------------------- |
169 |
C CHANGES (D. BILITZA, NOV 87): |
170 |
C - USING CORRECT DIPOL MOMENT I.E.,DIFFERENT COMMON/MODEL/ |
171 |
C - USING IGRF EARTH MAGNETIC FIELD MODELS FROM 1945 TO 1990 |
172 |
C-------------------------------------------------------------------- |
173 |
C INPUT: ENTRY POINT SHELLG |
174 |
C GLAT GEODETIC LATITUDE IN DEGREES (NORTH) |
175 |
C GLON GEODETIC LONGITUDE IN DEGREES (EAST) |
176 |
C ALT ALTITUDE IN KM ABOVE SEA LEVEL |
177 |
C |
178 |
C ENTRY POINT SHELLC |
179 |
C V(3) CARTESIAN COORDINATES IN EARTH RADII (6371.2 KM) |
180 |
C X-AXIS POINTING TO EQUATOR AT 0 LONGITUDE |
181 |
C Y-AXIS POINTING TO EQUATOR AT 90 LONG. |
182 |
C Z-AXIS POINTING TO NORTH POLE |
183 |
C |
184 |
C DIMO DIPOL MOMENT IN GAUSS (NORMALIZED TO EARTH RADIUS) |
185 |
C |
186 |
C COMMON |
187 |
C X(3) NOT USED |
188 |
C H(144) FIELD MODEL COEFFICIENTS ADJUSTED FOR SHELLG |
189 |
C----------------------------------------------------------------------- |
190 |
C OUTPUT: FL L-VALUE |
191 |
C ICODE =1 NORMAL COMPLETION |
192 |
C =2 UNPHYSICAL CONJUGATE POINT (FL MEANINGLESS) |
193 |
C =3 SHELL PARAMETER GREATER THAN LIMIT UP TO |
194 |
C WHICH ACCURATE CALCULATION IS REQUIRED; |
195 |
C APPROXIMATION IS USED. |
196 |
C B0 MAGNETIC FIELD STRENGTH IN GAUSS |
197 |
C----------------------------------------------------------------------- |
198 |
REAL(8) AQUAD,BQUAD,ERA |
199 |
REAL(8) CT,ST,D,ALT,X,RQ,P,U,STEP |
200 |
DIMENSION V(3),U(3,3),P(8,100),SP(3) |
201 |
COMMON X(3),H(196) |
202 |
COMMON/FIDB0/ SP |
203 |
SAVE /FIDB0/ |
204 |
COMMON/GENER/ ERA,AQUAD,BQUAD,UMR |
205 |
SAVE /GENER/ |
206 |
C |
207 |
C-- RMIN, RMAX ARE BOUNDARIES FOR IDENTIFICATION OF ICODE=2 AND 3 |
208 |
C-- STEP IS STEP SIZE FOR FIELD LINE TRACING |
209 |
C-- STEQ IS STEP SIZE FOR INTEGRATION |
210 |
C |
211 |
DATA RMIN,RMAX /0.05,1.01/ |
212 |
DATA STEP,STEQ /0.20,0.03/ |
213 |
BEQU=1.E10 |
214 |
C*****ENTRY POINT SHELLG TO BE USED WITH GEODETIC CO-ORDINATES |
215 |
RLAT=GLAT*UMR |
216 |
CT=SIN(RLAT) |
217 |
ST=COS(RLAT) |
218 |
D=SQRT(AQUAD-(AQUAD-BQUAD)*CT*CT) |
219 |
X(1)=(ALT+AQUAD/D)*ST/ERA |
220 |
X(3)=(ALT+BQUAD/D)*CT/ERA |
221 |
RLON=GLON*UMR |
222 |
X(2)=X(1)*SIN(RLON) |
223 |
X(1)=X(1)*COS(RLON) |
224 |
GOTO9 |
225 |
ENTRY SHELLC(V,FL,B0) |
226 |
C*****ENTRY POINT SHELLC TO BE USED WITH CARTESIAN CO-ORDINATES |
227 |
X(1)=V(1) |
228 |
X(2)=V(2) |
229 |
X(3)=V(3) |
230 |
C*****CONVERT TO DIPOL-ORIENTED CO-ORDINATES |
231 |
DATA U/ +0.3511737,-0.9148385,-0.1993679, |
232 |
A +0.9335804,+0.3583680,+0.0000000, |
233 |
B +0.0714471,-0.1861260,+0.9799247/ |
234 |
9 RQ=1./(X(1)*X(1)+X(2)*X(2)+X(3)*X(3)) |
235 |
R3H=SQRT(RQ*SQRT(RQ)) |
236 |
P(1,2)=(X(1)*U(1,1)+X(2)*U(2,1)+X(3)*U(3,1))*R3H |
237 |
P(2,2)=(X(1)*U(1,2)+X(2)*U(2,2) )*R3H |
238 |
P(3,2)=(X(1)*U(1,3)+X(2)*U(2,3)+X(3)*U(3,3))*RQ |
239 |
C*****FIRST THREE POINTS OF FIELD LINE |
240 |
STEP=-SIGN(STEP,P(3,2)) |
241 |
CALL STOER(P(1,2),BQ2,R2) |
242 |
B0=SQRT(BQ2) |
243 |
P(1,3)=P(1,2)+0.5*STEP*P(4,2) |
244 |
P(2,3)=P(2,2)+0.5*STEP*P(5,2) |
245 |
P(3,3)=P(3,2)+0.5*STEP |
246 |
CALL STOER(P(1,3),BQ3,R3) |
247 |
P(1,1)=P(1,2)-STEP*(2.*P(4,2)-P(4,3)) |
248 |
P(2,1)=P(2,2)-STEP*(2.*P(5,2)-P(5,3)) |
249 |
P(3,1)=P(3,2)-STEP |
250 |
CALL STOER(P(1,1),BQ1,R1) |
251 |
P(1,3)=P(1,2)+STEP*(20.*P(4,3)-3.*P(4,2)+P(4,1))/18. |
252 |
P(2,3)=P(2,2)+STEP*(20.*P(5,3)-3.*P(5,2)+P(5,1))/18. |
253 |
P(3,3)=P(3,2)+STEP |
254 |
CALL STOER(P(1,3),BQ3,R3) |
255 |
C*****INVERT SENSE IF REQUIRED |
256 |
IF(BQ3.LE.BQ1)GOTO2 |
257 |
STEP=-STEP |
258 |
R3=R1 |
259 |
BQ3=BQ1 |
260 |
DO 1 I=1,7 |
261 |
ZZ=P(I,1) |
262 |
P(I,1)=P(I,3) |
263 |
1 P(I,3)=ZZ |
264 |
C*****SEARCH FOR LOWEST MAGNETIC FIELD STRENGTH |
265 |
2 IF(BQ1.LT.BEQU) THEN |
266 |
BEQU=BQ1 |
267 |
IEQU=1 |
268 |
ENDIF |
269 |
IF(BQ2.LT.BEQU) THEN |
270 |
BEQU=BQ2 |
271 |
IEQU=2 |
272 |
ENDIF |
273 |
IF(BQ3.LT.BEQU) THEN |
274 |
BEQU=BQ3 |
275 |
IEQU=3 |
276 |
ENDIF |
277 |
C*****INITIALIZATION OF INTEGRATION LOOPS |
278 |
STEP12=STEP/12. |
279 |
STEP2=STEP+STEP |
280 |
STEQ=SIGN(STEQ,STEP) |
281 |
FI=0. |
282 |
ICODE=1 |
283 |
ORADIK=0. |
284 |
OTERM=0. |
285 |
STP=R2*STEQ |
286 |
Z=P(3,2)+STP |
287 |
STP=STP/0.75 |
288 |
P(8,1)=STEP2*(P(1,1)*P(4,1)+P(2,1)*P(5,1)) |
289 |
P(8,2)=STEP2*(P(1,2)*P(4,2)+P(2,2)*P(5,2)) |
290 |
C*****MAIN LOOP (FIELD LINE TRACING) |
291 |
DO 3 N=3,3333 |
292 |
C*****CORRECTOR (FIELD LINE TRACING) |
293 |
P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2)) |
294 |
P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2)) |
295 |
C*****PREPARE EXPANSION COEFFICIENTS FOR INTERPOLATION |
296 |
C*****OF SLOWLY VARYING QUANTITIES |
297 |
P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N)) |
298 |
C0=P(1,N-1)**2+P(2,N-1)**2 |
299 |
C1=P(8,N-1) |
300 |
C2=(P(8,N)-P(8,N-2))*0.25 |
301 |
C3=(P(8,N)+P(8,N-2)-C1-C1)/6.0 |
302 |
D0=P(6,N-1) |
303 |
D1=(P(6,N)-P(6,N-2))*0.5 |
304 |
D2=(P(6,N)+P(6,N-2)-D0-D0)*0.5 |
305 |
E0=P(7,N-1) |
306 |
E1=(P(7,N)-P(7,N-2))*0.5 |
307 |
E2=(P(7,N)+P(7,N-2)-E0-E0)*0.5 |
308 |
C*****INNER LOOP (FOR QUADRATURE) |
309 |
4 T=(Z-P(3,N-1))/STEP |
310 |
IF(T.GT.1.)GOTO5 |
311 |
HLI=0.5*(((C3*T+C2)*T+C1)*T+C0) |
312 |
ZQ=Z*Z |
313 |
R=HLI+SQRT(HLI*HLI+ZQ) |
314 |
IF(R.LE.RMIN)GOTO30 |
315 |
RQ=R*R |
316 |
FF=SQRT(1.+3.*ZQ/RQ) |
317 |
RADIK=B0-((D2*T+D1)*T+D0)*R*RQ*FF |
318 |
IF((R-RMAX).le.0.) goto 44 |
319 |
IF((R-RMAX).gt.0.) goto 45 |
320 |
45 ICODE=2 |
321 |
RADIK=RADIK-12.*(R-RMAX)**2 |
322 |
44 IF(RADIK+RADIK.LE.ORADIK) GOTO 10 |
323 |
TERM=SQRT(RADIK)*FF*((E2*T+E1)*T+E0)/(RQ+ZQ) |
324 |
FI=FI+STP*(OTERM+TERM) |
325 |
ORADIK=RADIK |
326 |
OTERM=TERM |
327 |
STP=R*STEQ |
328 |
Z=Z+STP |
329 |
GOTO4 |
330 |
C*****PREDICTOR (FIELD LINE TRACING) |
331 |
5 P(1,N+1)=P(1,N)+STEP12*(23.*P(4,N)-16.*P(4,N-1)+5.*P(4,N-2)) |
332 |
P(2,N+1)=P(2,N)+STEP12*(23.*P(5,N)-16.*P(5,N-1)+5.*P(5,N-2)) |
333 |
P(3,N+1)=P(3,N)+STEP |
334 |
CALL STOER(P(1,N+1),BQ3,R3) |
335 |
C*****SEARCH FOR LOWEST MAGNETIC FIELD STRENGTH |
336 |
IF(BQ3.LT.BEQU) THEN |
337 |
IEQU=N+1 |
338 |
BEQU=BQ3 |
339 |
ENDIF |
340 |
3 CONTINUE |
341 |
10 IF(IEQU.lt.2) IEQU=2 |
342 |
SP(1)=P(1,IEQU-1) |
343 |
SP(2)=P(2,IEQU-1) |
344 |
SP(3)=P(3,IEQU-1) |
345 |
IF(ORADIK.LT.1E-15)GOTO11 |
346 |
FI=FI+STP/0.75*OTERM*ORADIK/(ORADIK-RADIK) |
347 |
C |
348 |
C-- The minimal allowable value of FI was changed from 1E-15 to 1E-12, |
349 |
C-- because 1E-38 is the minimal allowable arg. for ALOG in our envir. |
350 |
C-- D. Bilitza, Nov 87. |
351 |
C |
352 |
11 FI=0.5*ABS(FI)/SQRT(B0)+1E-12 |
353 |
C |
354 |
C*****COMPUTE L FROM B AND I. SAME AS CARMEL IN INVAR. |
355 |
C |
356 |
C-- Correct dipole moment is used here. D. Bilitza, Nov 87. |
357 |
C |
358 |
DIMOB0=DIMO/B0 |
359 |
arg1=dlog(FI) |
360 |
arg2=dlog(DIMOB0) |
361 |
c arg = FI*FI*FI/DIMOB0 |
362 |
c if(abs(arg).gt.88.0) arg=88.0 |
363 |
XX=3*arg1-arg2 |
364 |
IF(XX.GT.23.0) GOTO 776 |
365 |
IF(XX.GT.11.7) GOTO 775 |
366 |
IF(XX.GT.+3.0) GOTO 774 |
367 |
IF(XX.GT.-3.0) GOTO 773 |
368 |
IF(XX.GT.-22.) GOTO 772 |
369 |
c 771 GG=3.33338E-1*XX+3.0062102E-1 |
370 |
GG=3.33338E-1*XX+3.0062102E-1 |
371 |
GOTO777 |
372 |
772 GG=((((((((-8.1537735E-14*XX+8.3232531E-13)*XX+1.0066362E-9)*XX+ |
373 |
18.1048663E-8)*XX+3.2916354E-6)*XX+8.2711096E-5)*XX+1.3714667E-3)* |
374 |
2XX+1.5017245E-2)*XX+4.3432642E-1)*XX+6.2337691E-1 |
375 |
GOTO777 |
376 |
773 GG=((((((((2.6047023E-10*XX+2.3028767E-9)*XX-2.1997983E-8)*XX- |
377 |
15.3977642E-7)*XX-3.3408822E-6)*XX+3.8379917E-5)*XX+1.1784234E-3)* |
378 |
2XX+1.4492441E-2)*XX+4.3352788E-1)*XX+6.228644E-1 |
379 |
GOTO777 |
380 |
774 GG=((((((((6.3271665E-10*XX-3.958306E-8)*XX+9.9766148E-07)*XX- |
381 |
11.2531932E-5)*XX+7.9451313E-5)*XX-3.2077032E-4)*XX+2.1680398E-3)* |
382 |
2XX+1.2817956E-2)*XX+4.3510529E-1)*XX+6.222355E-1 |
383 |
GOTO777 |
384 |
775 GG=(((((2.8212095E-8*XX-3.8049276E-6)*XX+2.170224E-4)*XX-6.7310339 |
385 |
1E-3)*XX+1.2038224E-1)*XX-1.8461796E-1)*XX+2.0007187E0 |
386 |
GOTO777 |
387 |
776 GG=XX-3.0460681E0 |
388 |
777 FL=EXP(dLOG((1.+EXP(GG))*DIMOB0)/3.0) |
389 |
RETURN |
390 |
C*****APPROXIMATION FOR HIGH VALUES OF L. |
391 |
30 ICODE=3 |
392 |
T=-P(3,N-1)/STEP |
393 |
FL=1./(ABS(((C3*T+C2)*T+C1)*T+C0)+1E-15) |
394 |
RETURN |
395 |
END |
396 |
C |
397 |
C |
398 |
SUBROUTINE STOER(P,BQ,R) |
399 |
IMPLICIT REAL(8)(A-H) |
400 |
IMPLICIT REAL(8)(O-Z) |
401 |
|
402 |
C******************************************************************* |
403 |
C* SUBROUTINE USED FOR FIELD LINE TRACING IN SHELLG * |
404 |
C* CALLS ENTRY POINT FELDI IN GEOMAGNETIC FIELD SUBROUTINE FELDG * |
405 |
C******************************************************************* |
406 |
REAL(8) P,ZM,FLI,WR,XM,R,YM,XI,DR |
407 |
DIMENSION P(7),U(3,3) |
408 |
COMMON XI(3),H(196) |
409 |
C*****XM,YM,ZM ARE GEOMAGNETIC CARTESIAN INVERSE CO-ORDINATES |
410 |
ZM=P(3) |
411 |
FLI=P(1)*P(1)+P(2)*P(2)+1E-15 |
412 |
R=0.5*(FLI+SQRT(FLI*FLI+(ZM+ZM)**2)) |
413 |
RQ=R*R |
414 |
WR=SQRT(R) |
415 |
XM=P(1)*WR |
416 |
YM=P(2)*WR |
417 |
C*****TRANSFORM TO GEOGRAPHIC CO-ORDINATE SYSTEM |
418 |
DATA U/ +0.3511737,-0.9148385,-0.1993679, |
419 |
A +0.9335804,+0.3583680,+0.0000000, |
420 |
B +0.0714471,-0.1861260,+0.9799247/ |
421 |
XI(1)=XM*U(1,1)+YM*U(1,2)+ZM*U(1,3) |
422 |
XI(2)=XM*U(2,1)+YM*U(2,2)+ZM*U(2,3) |
423 |
XI(3)=XM*U(3,1) +ZM*U(3,3) |
424 |
C*****COMPUTE DERIVATIVES |
425 |
C CALL FELDI(XI,H) |
426 |
CALL FELDI |
427 |
Q=H(1)/RQ |
428 |
DX=H(3)+H(3)+Q*XI(1) |
429 |
DY=H(4)+H(4)+Q*XI(2) |
430 |
DZ=H(2)+H(2)+Q*XI(3) |
431 |
C*****TRANSFORM BACK TO GEOMAGNETIC CO-ORDINATE SYSTEM |
432 |
DXM=U(1,1)*DX+U(2,1)*DY+U(3,1)*DZ |
433 |
DYM=U(1,2)*DX+U(2,2)*DY |
434 |
DZM=U(1,3)*DX+U(2,3)*DY+U(3,3)*DZ |
435 |
DR=(XM*DXM+YM*DYM+ZM*DZM)/R |
436 |
C*****FORM SLOWLY VARYING EXPRESSIONS |
437 |
P(4)=(WR*DXM-0.5*P(1)*DR)/(R*DZM) |
438 |
P(5)=(WR*DYM-0.5*P(2)*DR)/(R*DZM) |
439 |
DSQ=RQ*(DXM*DXM+DYM*DYM+DZM*DZM) |
440 |
BQ=DSQ*RQ*RQ |
441 |
P(6)=SQRT(DSQ/(RQ+3.*ZM*ZM)) |
442 |
P(7)=P(6)*(RQ+ZM*ZM)/(RQ*DZM) |
443 |
RETURN |
444 |
END |
445 |
C |
446 |
C |
447 |
SUBROUTINE FELDG(GLAT,GLON,ALT,BNORTH,BEAST,BDOWN,BABS) |
448 |
IMPLICIT REAL(8)(A-H) |
449 |
IMPLICIT REAL(8)(O-Z) |
450 |
C------------------------------------------------------------------- |
451 |
C CALCULATES EARTH MAGNETIC FIELD FROM SPHERICAL HARMONICS MODEL |
452 |
C REF: G. KLUGE, EUROPEAN SPACE OPERATIONS CENTRE, INTERNAL NOTE 61, |
453 |
C 1970. |
454 |
C-------------------------------------------------------------------- |
455 |
C CHANGES (D. BILITZA, NOV 87): |
456 |
C - FIELD COEFFICIENTS IN BINARY DATA FILES INSTEAD OF BLOCK DATA |
457 |
C - CALCULATES DIPOL MOMENT |
458 |
C-------------------------------------------------------------------- |
459 |
C INPUT: ENTRY POINT FELDG |
460 |
C GLAT GEODETIC LATITUDE IN DEGREES (NORTH) |
461 |
C GLON GEODETIC LONGITUDE IN DEGREES (EAST) |
462 |
C ALT ALTITUDE IN KM ABOVE SEA LEVEL |
463 |
C |
464 |
C ENTRY POINT FELDC |
465 |
C V(3) CARTESIAN COORDINATES IN EARTH RADII (6371.2 KM) |
466 |
C X-AXIS POINTING TO EQUATOR AT 0 LONGITUDE |
467 |
C Y-AXIS POINTING TO EQUATOR AT 90 LONG. |
468 |
C Z-AXIS POINTING TO NORTH POLE |
469 |
C |
470 |
C COMMON BLANK AND ENTRY POINT FELDI ARE NEEDED WHEN USED |
471 |
C IN CONNECTION WITH L-CALCULATION PROGRAM SHELLG. |
472 |
C |
473 |
C COMMON /MODEL/ AND /GENER/ |
474 |
C UMR = ATAN(1.0)*4./180. <DEGREE>*UMR=<RADIANT> |
475 |
C ERA EARTH RADIUS FOR NORMALIZATION OF CARTESIAN |
476 |
C COORDINATES (6371.2 KM) |
477 |
C AQUAD, BQUAD SQUARE OF MAJOR AND MINOR HALF AXIS FOR |
478 |
C EARTH ELLIPSOID AS RECOMMENDED BY INTERNATIONAL |
479 |
C ASTRONOMICAL UNION (6378.160, 6356.775 KM). |
480 |
C NMAX MAXIMUM ORDER OF SPHERICAL HARMONICS |
481 |
C TIME YEAR (DECIMAL: 1973.5) FOR WHICH MAGNETIC |
482 |
C FIELD IS TO BE CALCULATED |
483 |
C G(M) NORMALIZED FIELD COEFFICIENTS (SEE FELDCOF) |
484 |
C M=NMAX*(NMAX+2) |
485 |
C------------------------------------------------------------------------ |
486 |
C OUTPUT: BABS MAGNETIC FIELD STRENGTH IN GAUSS |
487 |
C BNORTH, BEAST, BDOWN COMPONENTS OF THE FIELD WITH RESPECT |
488 |
C TO THE LOCAL GEODETIC COORDINATE SYSTEM, WITH AXIS |
489 |
C POINTING IN THE TANGENTIAL PLANE TO THE NORTH, EAST |
490 |
C AND DOWNWARD. |
491 |
C----------------------------------------------------------------------- |
492 |
REAL(8) G,H,X,Z,F,S,T,XI,Y,XXX,BXXX,BYYY,BZZZ,B |
493 |
REAL(8) YYY,ZZZ,BABS,BEAST,BRHO,BNORTH,BDOWN,ST,CT,CP,SP |
494 |
REAL(8) ERA, AQUAD, BQUAD,ALT,RHO,RQ,D |
495 |
DIMENSION V(3),B(3),G(196) |
496 |
CHARACTER*258 NAME |
497 |
INTEGER NMAX |
498 |
REAL TIME |
499 |
COMMON XI(3),H(196) |
500 |
|
501 |
COMMON/MODEL/ G,NMAX,TIME,NAME |
502 |
SAVE/MODEL/ |
503 |
COMMON/GENER/ ERA,AQUAD,BQUAD,UMR |
504 |
SAVE/GENER/ |
505 |
C |
506 |
C-- IS RECORDS ENTRY POINT |
507 |
C |
508 |
C*****ENTRY POINT FELDG TO BE USED WITH GEODETIC CO-ORDINATES |
509 |
IS=1 |
510 |
RLAT=GLAT*UMR |
511 |
CT=SIN(RLAT) |
512 |
ST=COS(RLAT) |
513 |
D=SQRT(AQUAD-(AQUAD-BQUAD)*CT*CT) |
514 |
RLON=GLON*UMR |
515 |
CP=COS(RLON) |
516 |
SP=SIN(RLON) |
517 |
ZZZ=(ALT+BQUAD/D)*CT/ERA |
518 |
RHO=(ALT+AQUAD/D)*ST/ERA |
519 |
XXX=RHO*CP |
520 |
YYY=RHO*SP |
521 |
GOTO10 |
522 |
ENTRY FELDC(V,B) |
523 |
C*****ENTRY POINT FELDC TO BE USED WITH CARTESIAN CO-ORDINATES |
524 |
IS=2 |
525 |
XXX=V(1) |
526 |
YYY=V(2) |
527 |
ZZZ=V(3) |
528 |
10 RQ=1./(XXX*XXX+YYY*YYY+ZZZ*ZZZ) |
529 |
XI(1)=XXX*RQ |
530 |
XI(2)=YYY*RQ |
531 |
XI(3)=ZZZ*RQ |
532 |
GOTO20 |
533 |
ENTRY FELDI |
534 |
C*****ENTRY POINT FELDI USED FOR L COMPUTATION |
535 |
IS=3 |
536 |
20 IHMAX=NMAX*NMAX+1 |
537 |
LAST=IHMAX+NMAX+NMAX |
538 |
IMAX=NMAX+NMAX-1 |
539 |
DO 8 I=IHMAX,LAST |
540 |
8 H(I)=G(I) |
541 |
DO 6 K=1,3,2 |
542 |
I=IMAX |
543 |
IH=IHMAX |
544 |
1 IL=IH-I |
545 |
F=2./FLOAT(I-K+2) |
546 |
X=XI(1)*F |
547 |
Y=XI(2)*F |
548 |
Z=XI(3)*(F+F) |
549 |
I=I-2 |
550 |
c print *,' I ',I |
551 |
IF((I-1).lt.0) goto 5 |
552 |
IF((I-1).eq.0) goto 4 |
553 |
IF((I-1).gt.0) goto 2 |
554 |
2 DO 3 M=3,I,2 |
555 |
H(IL+M+1)=G(IL+M+1)+Z*H(IH+M+1)+X*(H(IH+M+3)-H(IH+M-1)) |
556 |
A -Y*(H(IH+M+2)+H(IH+M-2)) |
557 |
3 H(IL+M)=G(IL+M)+Z*H(IH+M)+X*(H(IH+M+2)-H(IH+M-2)) |
558 |
A +Y*(H(IH+M+3)+H(IH+M-1)) |
559 |
4 H(IL+2)=G(IL+2)+Z*H(IH+2)+X*H(IH+4)-Y*(H(IH+3)+H(IH)) |
560 |
H(IL+1)=G(IL+1)+Z*H(IH+1)+Y*H(IH+4)+X*(H(IH+3)-H(IH)) |
561 |
5 H(IL)=G(IL)+Z*H(IH)+2.*(X*H(IH+1)+Y*H(IH+2)) |
562 |
IH=IL |
563 |
IF(I.GE.K)GOTO1 |
564 |
6 CONTINUE |
565 |
IF(IS.EQ.3)RETURN |
566 |
S=.5*H(1)+2.*(H(2)*XI(3)+H(3)*XI(1)+H(4)*XI(2)) |
567 |
T=(RQ+RQ)*SQRT(RQ) |
568 |
BXXX=T*(H(3)-S*XXX) |
569 |
BYYY=T*(H(4)-S*YYY) |
570 |
BZZZ=T*(H(2)-S*ZZZ) |
571 |
IF(IS.EQ.2)GOTO7 |
572 |
BABS=SQRT(BXXX*BXXX+BYYY*BYYY+BZZZ*BZZZ) |
573 |
BEAST=BYYY*CP-BXXX*SP |
574 |
BRHO=BYYY*SP+BXXX*CP |
575 |
BNORTH=BZZZ*ST-BRHO*CT |
576 |
BDOWN=-BZZZ*CT-BRHO*ST |
577 |
RETURN |
578 |
7 B(1)=BXXX |
579 |
B(2)=BYYY |
580 |
B(3)=BZZZ |
581 |
RETURN |
582 |
END |
583 |
C |
584 |
C |
585 |
SUBROUTINE FELDCOF(YEAR,DIMO) |
586 |
IMPLICIT REAL(8)(A-H) |
587 |
IMPLICIT REAL(8)(O-Z) |
588 |
C------------------------------------------------------------------------ |
589 |
C DETERMINES COEFFICIENTS AND DIPOL MOMENT FROM IGRF MODELS |
590 |
C |
591 |
C INPUT: YEAR DECIMAL YEAR FOR WHICH GEOMAGNETIC FIELD IS TO |
592 |
C BE CALCULATED |
593 |
C OUTPUT: DIMO GEOMAGNETIC DIPOL MOMENT IN GAUSS (NORMALIZED |
594 |
C TO EARTH'S RADIUS) AT THE TIME (YEAR) |
595 |
C D. BILITZA, NSSDC, GSFC, CODE 633, GREENBELT, MD 20771, |
596 |
C (301)286-9536 NOV 1987. |
597 |
C ### updated to IGRF-2000 version -dkb- 5/31/2000 |
598 |
C ### updated to IGRF-2005 version -dkb- 3/24/2000 |
599 |
C----------------------------------------------------------------------- |
600 |
CHARACTER*258 FIL1, FIL2 |
601 |
CHARACTER*258 FILMOD |
602 |
C ### FILMOD, DTEMOD arrays +1 |
603 |
c DIMENSION GH1(144),GH2(120),GHA(144),FILMOD(14),DTEMOD(14) |
604 |
REAL(8) GH1, GH2, GHA |
605 |
DIMENSION GH1(196),GH2(196),GHA(196),FILMOD(3),DTEMOD(3) |
606 |
DOUBLE PRECISION X,F0,F |
607 |
DOUBLE PRECISION DIMO |
608 |
INTEGER L1,L2,L3 |
609 |
INTEGER NMAX |
610 |
REAL YEAR |
611 |
REAL TIME |
612 |
CHARACTER *258 P1,P2,P3 |
613 |
REAL(8) AQUAD,BQUAD,ERAD |
614 |
COMMON/PPATH/ L1,L2,L3,P1, P2, P3 |
615 |
SAVE/PPATH/ |
616 |
COMMON/MODEL/ GH1,NMAX,TIME,FIL1 |
617 |
SAVE/MODEL/ |
618 |
COMMON/GENER/ ERAD,AQUAD,BQUAD,UMR |
619 |
SAVE/GENER/ |
620 |
C ### updated to 2005 |
621 |
C CHARACTER COEFPATH*80, COEF1*80, COEF2*80, COEF3*80 |
622 |
|
623 |
c COEFPATH = 'OrbitalInfo/src/' |
624 |
c COEF1 = 'dgrf00.dat' |
625 |
c COEF2 = 'igrf05.dat' |
626 |
c COEF3 = 'igrf05s.dat' |
627 |
c COEF1 = COEFPATH(1:16)//COEF1 |
628 |
c COEF2 = COEFPATH(1:16)//COEF2 |
629 |
c COEF3 = COEFPATH(1:16)//COEF3 |
630 |
c FILMOD(1) = COEF1 |
631 |
c FILMOD(2) = COEF2 |
632 |
c FILMOD(3) = COEF3 |
633 |
c print *, "qui" |
634 |
FILMOD(1) = P1(1:L1) |
635 |
FILMOD(2) = P2(1:L2) |
636 |
FILMOD(3) = P3(1:L3) |
637 |
c print *, "qua" |
638 |
c FILMOD(1) = 'OrbitalInfo/src/dgrf00.dat' |
639 |
c FILMOD(2) = 'OrbitalInfo/src/igrf05.dat' |
640 |
c FILMOD(3) = 'OrbitalInfo/src/igrf05s.dat' |
641 |
c WRITE(*,*) FILMOD(1) |
642 |
c WRITE(*,*) FILMOD(2) |
643 |
c WRITE(*,*) FILMOD(3) |
644 |
c DATA FILMOD / 'dgrf00.dat', 'igrf05.dat', 'igrf05s.dat'/ |
645 |
DATA DTEMOD / 2005., 2010., 2015./ |
646 |
c |
647 |
c DATA FILMOD /'dgrf45.dat', 'dgrf50.dat', |
648 |
c 1 'dgrf55.dat', 'dgrf60.dat', 'dgrf65.dat', |
649 |
c 2 'dgrf70.dat', 'dgrf75.dat', 'dgrf80.dat', |
650 |
c 3 'dgrf85.dat', 'dgrf90.dat', 'dgrf95.dat', |
651 |
c 4 'dgrf00.dat','igrf05.dat','igrf05s.dat'/ |
652 |
c DATA DTEMOD / 1945., 1950., 1955., 1960., 1965., 1970., |
653 |
c 1 1975., 1980., 1985., 1990., 1995., 2000.,2005.,2010./ |
654 |
C |
655 |
C ### numye = numye + 1 ; is number of years represented by IGRF |
656 |
C |
657 |
c NUMYE=13 |
658 |
NUMYE=2 |
659 |
c print *, "quo" |
660 |
|
661 |
C |
662 |
C IS=0 FOR SCHMIDT NORMALIZATION IS=1 GAUSS NORMALIZATION |
663 |
C IU IS INPUT UNIT NUMBER FOR IGRF COEFFICIENT SETS |
664 |
C |
665 |
IU = 10 |
666 |
IS = 0 |
667 |
C-- DETERMINE IGRF-YEARS FOR INPUT-YEAR |
668 |
TIME = YEAR |
669 |
IYEA = INT(YEAR/5.)*5 |
670 |
c L = (IYEA - 1945)/5 + 1 |
671 |
L = (IYEA - 2000)/5 + 1 |
672 |
IF(L.LT.1) L=1 |
673 |
IF(L.GT.NUMYE) L=NUMYE |
674 |
DTE1 = DTEMOD(L) |
675 |
FIL1 = FILMOD(L) |
676 |
DTE2 = DTEMOD(L+1) |
677 |
FIL2 = FILMOD(L+1) |
678 |
c WRITE(*,*) FIL1 |
679 |
c WRITE(*,*) FIL2 |
680 |
c print *, "que" |
681 |
C-- GET IGRF COEFFICIENTS FOR THE BOUNDARY YEARS |
682 |
CALL GETSHC (IU, FIL1, NMAX1, ERAD, GH1, IER) |
683 |
IF (IER .NE. 0) STOP |
684 |
c print *, "quessss" |
685 |
CALL GETSHC (IU, FIL2, NMAX2, ERAD, GH2, IER) |
686 |
IF (IER .NE. 0) STOP |
687 |
c print *, "quj" |
688 |
C-- DETERMINE IGRF COEFFICIENTS FOR YEAR |
689 |
IF (L .LE. NUMYE-1) THEN |
690 |
CALL INTERSHC (YEAR, DTE1, NMAX1, GH1, DTE2, |
691 |
1 NMAX2, GH2, NMAX, GHA) |
692 |
ELSE |
693 |
CALL EXTRASHC (YEAR, DTE1, NMAX1, GH1, NMAX2, |
694 |
1 GH2, NMAX, GHA) |
695 |
ENDIF |
696 |
c print *, "quw" |
697 |
C-- DETERMINE MAGNETIC DIPOL MOMENT AND COEFFIECIENTS G |
698 |
F0=0.D0 |
699 |
DO 1234 J=1,3 |
700 |
F = GHA(J) * 1.D-5 |
701 |
F0 = F0 + F * F |
702 |
1234 CONTINUE |
703 |
DIMO = DSQRT(F0) |
704 |
|
705 |
GH1(1) = 0.0 |
706 |
I=2 |
707 |
F0=1.D-5 |
708 |
IF(IS.EQ.0) F0=-F0 |
709 |
SQRT2=SQRT(2.) |
710 |
|
711 |
c print *, "quq" |
712 |
|
713 |
DO 9 N=1,NMAX |
714 |
X = N |
715 |
F0 = F0 * X * X / (4.D0 * X - 2.D0) |
716 |
IF(IS.EQ.0) F0 = F0 * (2.D0 * X - 1.D0) / X |
717 |
F = F0 * 0.5D0 |
718 |
IF(IS.EQ.0) F = F * SQRT2 |
719 |
GH1(I) = GHA(I-1) * F0 |
720 |
I = I+1 |
721 |
DO 9 M=1,N |
722 |
F = F * (X + M) / (X - M + 1.D0) |
723 |
IF(IS.EQ.0) F = F * DSQRT((X - M + 1.D0) / (X + M)) |
724 |
GH1(I) = GHA(I-1) * F |
725 |
GH1(I+1) = GHA(I) * F |
726 |
I=I+2 |
727 |
9 CONTINUE |
728 |
RETURN |
729 |
END |
730 |
C |
731 |
C |
732 |
SUBROUTINE GETSHC (IU, FSPEC, NMAX, ERAD, GH, IER) |
733 |
IMPLICIT REAL(8)(A-H) |
734 |
IMPLICIT REAL(8)(O-Z) |
735 |
C =============================================================== |
736 |
C |
737 |
C Version 1.01 |
738 |
C |
739 |
C Reads spherical harmonic coefficients from the specified |
740 |
C file into an array. |
741 |
C |
742 |
C Input: |
743 |
C IU - Logical unit number |
744 |
C FSPEC - File specification |
745 |
C |
746 |
C Output: |
747 |
C NMAX - Maximum degree and order of model |
748 |
C ERAD - Earth's radius associated with the spherical |
749 |
C harmonic coefficients, in the same units as |
750 |
C elevation |
751 |
C GH - Schmidt quasi-normal internal spherical |
752 |
C harmonic coefficients |
753 |
C IER - Error number: = 0, no error |
754 |
C = -2, records out of order |
755 |
C = FORTRAN run-time error number |
756 |
C |
757 |
C A. Zunde |
758 |
C USGS, MS 964, Box 25046 Federal Center, Denver, CO 80225 |
759 |
C |
760 |
C =============================================================== |
761 |
|
762 |
CHARACTER FSPEC*(*), FOUT*258 |
763 |
REAL(8) GH,ERAD |
764 |
DIMENSION GH(*) |
765 |
C --------------------------------------------------------------- |
766 |
C Open coefficient file. Read past first header record. |
767 |
C Read degree and order of model and Earth's radius. |
768 |
C --------------------------------------------------------------- |
769 |
WRITE(FOUT,667) FSPEC |
770 |
c 667 FORMAT('/usr/local/etc/httpd/cgi-bin/natasha/IRI/',A12) |
771 |
667 FORMAT(A258) |
772 |
c print *," gui" |
773 |
OPEN (IU, FILE=FOUT, STATUS='OLD', IOSTAT=IER, ERR=999) |
774 |
c print *," gua" |
775 |
READ (IU, *, IOSTAT=IER, ERR=999) |
776 |
c print *," gue" |
777 |
READ (IU, *, IOSTAT=IER, ERR=999) NMAX, ERAD |
778 |
c print *," guo" |
779 |
C --------------------------------------------------------------- |
780 |
C Read the coefficient file, arranged as follows: |
781 |
C |
782 |
C N M G H |
783 |
C ---------------------- |
784 |
C / 1 0 GH(1) - |
785 |
C / 1 1 GH(2) GH(3) |
786 |
C / 2 0 GH(4) - |
787 |
C / 2 1 GH(5) GH(6) |
788 |
C NMAX*(NMAX+3)/2 / 2 2 GH(7) GH(8) |
789 |
C records \ 3 0 GH(9) - |
790 |
C \ . . . . |
791 |
C \ . . . . |
792 |
C NMAX*(NMAX+2) \ . . . . |
793 |
C elements in GH \ NMAX NMAX . . |
794 |
C |
795 |
C N and M are, respectively, the degree and order of the |
796 |
C coefficient. |
797 |
C --------------------------------------------------------------- |
798 |
|
799 |
I = 0 |
800 |
DO 2211 NN = 1, NMAX |
801 |
DO 2233 MM = 0, NN |
802 |
READ (IU, *, IOSTAT=IER, ERR=999) N, M, G, H |
803 |
IF (NN .NE. N .OR. MM .NE. M) THEN |
804 |
IER = -2 |
805 |
GOTO 999 |
806 |
ENDIF |
807 |
I = I + 1 |
808 |
GH(I) = G |
809 |
IF (M .NE. 0) THEN |
810 |
I = I + 1 |
811 |
GH(I) = H |
812 |
ENDIF |
813 |
2233 CONTINUE |
814 |
2211 CONTINUE |
815 |
c print *," guj" |
816 |
|
817 |
999 CLOSE (IU) |
818 |
c print *," guw IER",IER |
819 |
if ( IER .eq. -1 ) IER = 0 ! gfortran 4.1.2 bug workaround... hoping not to create problems with other versions |
820 |
|
821 |
RETURN |
822 |
END |
823 |
C |
824 |
C |
825 |
SUBROUTINE INTERSHC (DATE, DTE1, NMAX1, GH1, DTE2, |
826 |
1 NMAX2, GH2, NMAX, GH) |
827 |
IMPLICIT REAL(8)(A-H) |
828 |
IMPLICIT REAL(8)(O-Z) |
829 |
REAL DATE |
830 |
C =============================================================== |
831 |
C |
832 |
C Version 1.01 |
833 |
C |
834 |
C Interpolates linearly, in time, between two spherical |
835 |
C harmonic models. |
836 |
C |
837 |
C Input: |
838 |
C DATE - Date of resulting model (in decimal year) |
839 |
C DTE1 - Date of earlier model |
840 |
C NMAX1 - Maximum degree and order of earlier model |
841 |
C GH1 - Schmidt quasi-normal internal spherical |
842 |
C harmonic coefficients of earlier model |
843 |
C DTE2 - Date of later model |
844 |
C NMAX2 - Maximum degree and order of later model |
845 |
C GH2 - Schmidt quasi-normal internal spherical |
846 |
C harmonic coefficients of later model |
847 |
C |
848 |
C Output: |
849 |
C GH - Coefficients of resulting model |
850 |
C NMAX - Maximum degree and order of resulting model |
851 |
C |
852 |
C A. Zunde |
853 |
C USGS, MS 964, Box 25046 Federal Center, Denver, CO 80225 |
854 |
C |
855 |
C =============================================================== |
856 |
|
857 |
REAL(8) GH1, GH2, GH |
858 |
DIMENSION GH1(*), GH2(*), GH(*) |
859 |
|
860 |
C --------------------------------------------------------------- |
861 |
C The coefficients (GH) of the resulting model, at date |
862 |
C DATE, are computed by linearly interpolating between the |
863 |
C coefficients of the earlier model (GH1), at date DTE1, |
864 |
C and those of the later model (GH2), at date DTE2. If one |
865 |
C model is smaller than the other, the interpolation is |
866 |
C performed with the missing coefficients assumed to be 0. |
867 |
C --------------------------------------------------------------- |
868 |
|
869 |
FACTOR = (DATE - DTE1) / (DTE2 - DTE1) |
870 |
|
871 |
IF (NMAX1 .EQ. NMAX2) THEN |
872 |
K = NMAX1 * (NMAX1 + 2) |
873 |
NMAX = NMAX1 |
874 |
ELSE IF (NMAX1 .GT. NMAX2) THEN |
875 |
K = NMAX2 * (NMAX2 + 2) |
876 |
L = NMAX1 * (NMAX1 + 2) |
877 |
DO 1122 I = K + 1, L |
878 |
1122 GH(I) = GH1(I) + FACTOR * (-GH1(I)) |
879 |
NMAX = NMAX1 |
880 |
ELSE |
881 |
K = NMAX1 * (NMAX1 + 2) |
882 |
L = NMAX2 * (NMAX2 + 2) |
883 |
DO 1133 I = K + 1, L |
884 |
1133 GH(I) = FACTOR * GH2(I) |
885 |
NMAX = NMAX2 |
886 |
ENDIF |
887 |
|
888 |
DO 1144 I = 1, K |
889 |
1144 GH(I) = GH1(I) + FACTOR * (GH2(I) - GH1(I)) |
890 |
|
891 |
RETURN |
892 |
END |
893 |
C |
894 |
C |
895 |
SUBROUTINE EXTRASHC (DATE, DTE1, NMAX1, GH1, NMAX2, |
896 |
1 GH2, NMAX, GH) |
897 |
IMPLICIT REAL(8)(A-H) |
898 |
IMPLICIT REAL(8)(O-Z) |
899 |
REAL DATE |
900 |
|
901 |
C =============================================================== |
902 |
C |
903 |
C Version 1.01 |
904 |
C |
905 |
C Extrapolates linearly a spherical harmonic model with a |
906 |
C rate-of-change model. |
907 |
C |
908 |
C Input: |
909 |
C DATE - Date of resulting model (in decimal year) |
910 |
C DTE1 - Date of base model |
911 |
C NMAX1 - Maximum degree and order of base model |
912 |
C GH1 - Schmidt quasi-normal internal spherical |
913 |
C harmonic coefficients of base model |
914 |
C NMAX2 - Maximum degree and order of rate-of-change |
915 |
C model |
916 |
C GH2 - Schmidt quasi-normal internal spherical |
917 |
C harmonic coefficients of rate-of-change model |
918 |
C |
919 |
C Output: |
920 |
C GH - Coefficients of resulting model |
921 |
C NMAX - Maximum degree and order of resulting model |
922 |
C |
923 |
C A. Zunde |
924 |
C USGS, MS 964, Box 25046 Federal Center, Denver, CO 80225 |
925 |
C |
926 |
C =============================================================== |
927 |
|
928 |
REAL(8) GH1, GH2, GH |
929 |
DIMENSION GH1(*), GH2(*), GH(*) |
930 |
|
931 |
C --------------------------------------------------------------- |
932 |
C The coefficients (GH) of the resulting model, at date |
933 |
C DATE, are computed by linearly extrapolating the coef- |
934 |
C ficients of the base model (GH1), at date DTE1, using |
935 |
C those of the rate-of-change model (GH2), at date DTE2. If |
936 |
C one model is smaller than the other, the extrapolation is |
937 |
C performed with the missing coefficients assumed to be 0. |
938 |
C --------------------------------------------------------------- |
939 |
|
940 |
FACTOR = (DATE - DTE1) |
941 |
|
942 |
IF (NMAX1 .EQ. NMAX2) THEN |
943 |
K = NMAX1 * (NMAX1 + 2) |
944 |
NMAX = NMAX1 |
945 |
ELSE IF (NMAX1 .GT. NMAX2) THEN |
946 |
K = NMAX2 * (NMAX2 + 2) |
947 |
L = NMAX1 * (NMAX1 + 2) |
948 |
DO 1155 I = K + 1, L |
949 |
1155 GH(I) = GH1(I) |
950 |
NMAX = NMAX1 |
951 |
ELSE |
952 |
K = NMAX1 * (NMAX1 + 2) |
953 |
L = NMAX2 * (NMAX2 + 2) |
954 |
DO 1166 I = K + 1, L |
955 |
1166 GH(I) = FACTOR * GH2(I) |
956 |
NMAX = NMAX2 |
957 |
ENDIF |
958 |
|
959 |
DO 1177 I = 1, K |
960 |
1177 GH(I) = GH1(I) + FACTOR * GH2(I) |
961 |
|
962 |
RETURN |
963 |
END |
964 |
C |
965 |
C |
966 |
SUBROUTINE INITIZE(TP1,TL1,TP2,TL2,TP3,TL3) |
967 |
IMPLICIT REAL(8)(A-H) |
968 |
IMPLICIT REAL(8)(O-Z) |
969 |
C---------------------------------------------------------------- |
970 |
C Initializes the parameters in COMMON/GENER/ |
971 |
C |
972 |
C UMR = ATAN(1.0)*4./180. <DEGREE>*UMR=<RADIANT> |
973 |
C ERA EARTH RADIUS FOR NORMALIZATION OF CARTESIAN |
974 |
C COORDINATES (6371.2 KM) |
975 |
C EREQU MAJOR HALF AXIS FOR EARTH ELLIPSOID (6378.160 KM) |
976 |
C ERPOL MINOR HALF AXIS FOR EARTH ELLIPSOID (6356.775 KM) |
977 |
C AQUAD SQUARE OF MAJOR HALF AXIS FOR EARTH ELLIPSOID |
978 |
C BQUAD SQUARE OF MINOR HALF AXIS FOR EARTH ELLIPSOID |
979 |
C |
980 |
C ERA, EREQU and ERPOL as recommended by the INTERNATIONAL |
981 |
C ASTRONOMICAL UNION . |
982 |
C----------------------------------------------------------------- |
983 |
INTEGER TL1,TL2,TL3 |
984 |
CHARACTER (len=258) TP1,TP2,TP3 |
985 |
INTEGER L1,L2,L3 |
986 |
CHARACTER *258 P1,P2,P3 |
987 |
REAL(8) AQUAD,BQUAD,ERA |
988 |
|
989 |
COMMON/PPATH/ L1,L2,L3,P1, P2, P3 |
990 |
SAVE/PPATH/ |
991 |
|
992 |
COMMON/GENER/ERA,AQUAD,BQUAD,UMR |
993 |
SAVE/GENER/ |
994 |
|
995 |
L1 = TL1 |
996 |
L2 = TL2 |
997 |
L3 = TL3 |
998 |
P1 = TP1(1:L1) |
999 |
P2 = TP2(1:L2) |
1000 |
P3 = TP3(1:L3) |
1001 |
|
1002 |
ERA=6371.2 |
1003 |
EREQU=6378.16 |
1004 |
ERPOL=6356.775 |
1005 |
AQUAD=EREQU*EREQU |
1006 |
BQUAD=ERPOL*ERPOL |
1007 |
UMR=ATAN(1.0)*4./180. |
1008 |
RETURN |
1009 |
END |