-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemak135.f
295 lines (274 loc) · 9.5 KB
/
emak135.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
subroutine emdlv(r,vp,vs)
c set up information on earth model (specified by
c subroutine call emiasp)
c set dimension of cpr,rd equal to number of radial
c discontinuities in model
parameter (re=6371.0)
call vak135(re-r,vp,vs,rho)
end
subroutine emdld(n,cpr,name)
parameter (re=6371.0,nd=9)
dimension cpr(nd),rd(nd)
character*(*) name
character*20 modnam
logical first
data rd/0.,20.,35.,210.,410.,660.,2740.,2891.5,5153.5/
data modnam/'ak135'/, first/.true./
if (first) then
first = .false.
do 10 i=1,nd
rd(i) = re-rd(i)
10 continue
endif
n=nd
do 1 i=1,nd
1 cpr(i)=rd(nd-i+1)
name=modnam
return
end
subroutine vak135(pz,pp,ps,prho)
parameter (nz=138)
real z(nz),rho(nz),vp(nz),vs(nz)
real interp
data (z(i),rho(i),vp(i),vs(i),i=1,10) /
+ 0.00, 3.0000, 5.8000, 3.4600,
+ 20.00, 3.0000, 5.8000, 3.4600,
+ 20.00, 3.0000, 6.5000, 3.8500,
+ 35.00, 3.0000, 6.5000, 3.8500,
+ 35.00, 3.0000, 8.0400, 4.4800,
+ 77.50, 3.0000, 8.0450, 4.4900,
+ 120.00, 3.4268, 8.0505, 4.5000,
+ 165.00, 3.3711, 8.1750, 4.5090,
+ 210.00, 3.3243, 8.3007, 4.5184,
+ 210.00, 3.3243, 8.3007, 4.5230/
data (z(i),rho(i),vp(i),vs(i),i=11,20) /
+ 260.00, 3.3663, 8.4822, 4.6094,
+ 310.00, 3.4110, 8.6650, 4.6964,
+ 360.00, 3.4577, 8.8476, 4.7832,
+ 410.00, 3.5068, 9.0302, 4.8702,
+ 410.00, 3.9317, 9.3601, 5.0806,
+ 460.00, 3.9273, 9.5280, 5.1864,
+ 510.00, 3.9233, 9.6962, 5.2922,
+ 560.00, 3.9218, 9.8640, 5.3989,
+ 610.00, 3.9206, 10.0320, 5.5047,
+ 660.00, 3.9201, 10.2000, 5.6104/
data (z(i),rho(i),vp(i),vs(i),i=21,30) /
+ 660.00, 4.2387, 10.7909, 5.9607,
+ 710.00, 4.2986, 10.9222, 6.0898,
+ 760.00, 4.3565, 11.0553, 6.2100,
+ 809.50, 4.4118, 11.1355, 6.2424,
+ 859.00, 4.4650, 11.2228, 6.2799,
+ 908.50, 4.5162, 11.3068, 6.3164,
+ 958.00, 4.5654, 11.3897, 6.3519,
+ 1007.50, 4.5926, 11.4704, 6.3860,
+ 1057.00, 4.6198, 11.5493, 6.4182,
+ 1106.50, 4.6467, 11.6265, 6.4514/
data (z(i),rho(i),vp(i),vs(i),i=31,40) /
+ 1156.00, 4.6735, 11.7020, 6.4822,
+ 1205.50, 4.7001, 11.7768, 6.5131,
+ 1255.00, 4.7266, 11.8491, 6.5431,
+ 1304.50, 4.7528, 11.9208, 6.5728,
+ 1354.00, 4.7790, 11.9891, 6.6009,
+ 1403.50, 4.8050, 12.0571, 6.6285,
+ 1453.00, 4.8307, 12.1247, 6.6554,
+ 1502.50, 4.8562, 12.1912, 6.6813,
+ 1552.00, 4.8817, 12.2558, 6.7070,
+ 1601.50, 4.9069, 12.3181, 6.7323/
data (z(i),rho(i),vp(i),vs(i),i=41,50) /
+ 1651.00, 4.9321, 12.3813, 6.7579,
+ 1700.50, 4.9570, 12.4427, 6.7820,
+ 1750.00, 4.9817, 12.5030, 6.8056,
+ 1799.50, 5.0062, 12.5638, 6.8289,
+ 1849.00, 5.0306, 12.6226, 6.8517,
+ 1898.50, 5.0548, 12.6807, 6.8743,
+ 1948.00, 5.0789, 12.7384, 6.8972,
+ 1997.50, 5.1027, 12.7956, 6.9194,
+ 2047.00, 5.1264, 12.8524, 6.9416,
+ 2096.50, 5.1499, 12.9093, 6.9625/
data (z(i),rho(i),vp(i),vs(i),i=51,60) /
+ 2146.00, 5.1732, 12.9663, 6.9852,
+ 2195.50, 5.1963, 13.0226, 7.0069,
+ 2245.00, 5.2192, 13.0786, 7.0286,
+ 2294.50, 5.2420, 13.1337, 7.0504,
+ 2344.00, 5.2646, 13.1895, 7.0722,
+ 2393.50, 5.2870, 13.2465, 7.0932,
+ 2443.00, 5.3092, 13.3017, 7.1144,
+ 2492.50, 5.3313, 13.3584, 7.1368,
+ 2542.00, 5.3531, 13.4156, 7.1584,
+ 2591.50, 5.3748, 13.4741, 7.1804/
data (z(i),rho(i),vp(i),vs(i),i=61,70) /
+ 2640.00, 5.3962, 13.5311, 7.2031,
+ 2690.00, 5.4176, 13.5899, 7.2253,
+ 2740.00, 5.4387, 13.6498, 7.2485,
+ 2740.00, 5.6934, 13.6498, 7.2485,
+ 2789.67, 5.7196, 13.6533, 7.2593,
+ 2839.33, 5.7458, 13.6570, 7.2700,
+ 2891.50, 5.7721, 13.6601, 7.2817,
+ 2891.50, 9.9145, 8.0000, 0.0000,
+ 2939.33, 9.9942, 8.0382, 0.0000,
+ 2989.66, 10.0722, 8.1283, 0.0000/
data (z(i),rho(i),vp(i),vs(i),i=71,80) /
+ 3039.99, 10.1485, 8.2213, 0.0000,
+ 3090.32, 10.2233, 8.3122, 0.0000,
+ 3140.66, 10.2964, 8.4001, 0.0000,
+ 3190.99, 10.3679, 8.4861, 0.0000,
+ 3241.32, 10.4378, 8.5692, 0.0000,
+ 3291.65, 10.5062, 8.6496, 0.0000,
+ 3341.98, 10.5731, 8.7283, 0.0000,
+ 3392.31, 10.6385, 8.8036, 0.0000,
+ 3442.64, 10.7023, 8.8761, 0.0000,
+ 3492.97, 10.7647, 8.9461, 0.0000/
data (z(i),rho(i),vp(i),vs(i),i=81,90) /
+ 3543.30, 10.8257, 9.0138, 0.0000,
+ 3593.64, 10.8852, 9.0792, 0.0000,
+ 3643.97, 10.9434, 9.1426, 0.0000,
+ 3694.30, 11.0001, 9.2042, 0.0000,
+ 3744.63, 11.0555, 9.2634, 0.0000,
+ 3794.96, 11.1095, 9.3205, 0.0000,
+ 3845.29, 11.1623, 9.3760, 0.0000,
+ 3895.62, 11.2137, 9.4297, 0.0000,
+ 3945.95, 11.2639, 9.4814, 0.0000,
+ 3996.28, 11.3127, 9.5306, 0.0000/
data (z(i),rho(i),vp(i),vs(i),i=91,100) /
+ 4046.62, 11.3604, 9.5777, 0.0000,
+ 4096.95, 11.4069, 9.6232, 0.0000,
+ 4147.28, 11.4521, 9.6673, 0.0000,
+ 4197.61, 11.4962, 9.7100, 0.0000,
+ 4247.94, 11.5391, 9.7513, 0.0000,
+ 4298.27, 11.5809, 9.7914, 0.0000,
+ 4348.60, 11.6216, 9.8304, 0.0000,
+ 4398.93, 11.6612, 9.8682, 0.0000,
+ 4449.26, 11.6998, 9.9051, 0.0000,
+ 4499.60, 11.7373, 9.9410, 0.0000/
data (z(i),rho(i),vp(i),vs(i),i=101,110) /
+ 4549.93, 11.7737, 9.9761, 0.0000,
+ 4600.26, 11.8092, 10.0103, 0.0000,
+ 4650.59, 11.8437, 10.0439, 0.0000,
+ 4700.92, 11.8772, 10.0768, 0.0000,
+ 4751.25, 11.9098, 10.1095, 0.0000,
+ 4801.58, 11.9414, 10.1415, 0.0000,
+ 4851.91, 11.9722, 10.1739, 0.0000,
+ 4902.24, 12.0001, 10.2049, 0.0000,
+ 4952.58, 12.0311, 10.2329, 0.0000,
+ 5002.91, 12.0593, 10.2565, 0.0000/
data (z(i),rho(i),vp(i),vs(i),i=111,120) /
+ 5053.24, 12.0867, 10.2745, 0.0000,
+ 5103.57, 12.1133, 10.2854, 0.0000,
+ 5153.50, 12.1391, 10.2890, 0.0000,
+ 5153.50, 12.7037, 11.0427, 3.5043,
+ 5204.61, 12.7289, 11.0585, 3.5187,
+ 5255.32, 12.7530, 11.0718, 3.5314,
+ 5306.04, 12.7760, 11.0850, 3.5435,
+ 5356.75, 12.7980, 11.0983, 3.5551,
+ 5407.46, 12.8188, 11.1166, 3.5661,
+ 5458.17, 12.8387, 11.1316, 3.5765/
data (z(i),rho(i),vp(i),vs(i),i=121,130) /
+ 5508.89, 12.8574, 11.1457, 3.5864,
+ 5559.60, 12.8751, 11.1590, 3.5957,
+ 5610.31, 12.8917, 11.1715, 3.6044,
+ 5661.02, 12.9072, 11.1832, 3.6126,
+ 5711.74, 12.9217, 11.1941, 3.6202,
+ 5762.45, 12.9351, 11.2041, 3.6272,
+ 5813.16, 12.9474, 11.2134, 3.6337,
+ 5863.87, 12.9586, 11.2219, 3.6396,
+ 5914.59, 12.9688, 11.2295, 3.6450,
+ 5965.30, 12.9779, 11.2364, 3.6498/
data (z(i),rho(i),vp(i),vs(i),i=131,138) /
+ 6016.01, 12.9859, 11.2424, 3.6540,
+ 6066.72, 12.9929, 11.2477, 3.6577,
+ 6117.44, 12.9988, 11.2521, 3.6608,
+ 6168.15, 13.0036, 11.2557, 3.6633,
+ 6218.86, 13.0074, 11.2586, 3.6653,
+ 6269.57, 13.0100, 11.2606, 3.6667,
+ 6320.29, 13.0117, 11.2618, 3.6675,
+ 6371.00, 13.0122, 11.2622, 3.6678/
pp = interp(z,vp,nz,1,pz,err)
ps = interp(z,vs,nz,1,pz,err)
prho = interp(z,rho,nz,1,pz,err)
end
real function interp(xa,ya,n,npts,x,err)
C Function to interpolate between tabulated values. The function
C returns the interpolated result, plus an error. A number of
C points to either side of the desired value is given as an argument.
C This value should be as small as feasible, since large values cause
C more variation in the interpolated result.
real xa(n), ya(n), x, value, err
C Run through tables and bracket value requested. Interpolate
C with a more limited number of points.
if (xa(1) .lt. xa(n)) then
ilo = 1
ihi = n
else
ilo = n
ihi = 1
endif
10 continue
i = (ihi + ilo)/2
if (x .eq. xa(i)) then
interp = ya(i)
err = 0.0
return
endif
if (x .lt. xa(i)) then
ihi = i
else
ilo = i
endif
if (abs(ihi - ilo) .gt. 1) go to 10
if (ihi .lt. ilo) then
i = ihi
ihi = ilo
ilo = i
endif
C Have desired value bracketed. Adjust bounds and interpolate.
j = max(1,ilo-npts+1)
k = min(n,ihi+npts-1)
if (k-j+1 .ne. 2*npts) then
if (j .eq. 1) then
k=min(j+2*npts-1,n)
else
j=max(1,k-2*npts+1)
endif
endif
call polint(xa(j),ya(j),k-j+1,x,value,err)
interp = value
return
end
SUBROUTINE POLINT(XA,YA,N,X,Y,DY)
PARAMETER (NMAX=25)
DIMENSION XA(N),YA(N),C(NMAX),D(NMAX)
IF (N .GT. NMAX) PAUSE '**POLINT: TOO MUCH DATA.'
NS=1
DIF=ABS(X-XA(1))
DO 11 I=1,N
DIFT=ABS(X-XA(I))
IF (DIFT.LT.DIF) THEN
NS=I
DIF=DIFT
ENDIF
C(I)=YA(I)
D(I)=YA(I)
11 CONTINUE
Y=YA(NS)
NS=NS-1
DO 13 M=1,N-1
DO 12 I=1,N-M
HO=XA(I)-X
HP=XA(I+M)-X
W=C(I+1)-D(I)
DEN=HO-HP
IF(DEN.EQ.0.)PAUSE
DEN=W/DEN
D(I)=HP*DEN
C(I)=HO*DEN
12 CONTINUE
IF (2*NS.LT.N-M)THEN
DY=C(NS+1)
ELSE
DY=D(NS)
NS=NS-1
ENDIF
Y=Y+DY
13 CONTINUE
RETURN
END