@@ -114,7 +114,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
114114
115115 ! local parameters
116116 double precision :: r,scaleval
117- double precision :: RICB
117+ double precision :: ROCEAN,RMIDDLE_CRUST,RMOHO, R8 0,R220, R4 00,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB, RICB
118118
119119! compute real physical radius in meters
120120 r = x * R_PLANET
@@ -124,11 +124,42 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
124124
125125! note: using stop statements, not exit_mpi() calls to avoid the need for MPI libraries when linking xcreate_header_file
126126
127- ! version compatibility
127+ ! default setting
128+ ROCEAN = PREM_ROCEAN
129+ RMIDDLE_CRUST = PREM_RMIDDLE_CRUST
130+ RMOHO = PREM_RMOHO
131+ R8 0 = PREM_R8 0
132+ R220 = PREM_R220
133+ R4 00 = PREM_R4 00
134+ R600 = PREM_R600
135+ R670 = PREM_R670
136+ R771 = PREM_R771
137+ RTOPDDOUBLEPRIME = PREM_RTOPDDOUBLEPRIME
138+ RCMB = PREM_RCMB
139+ RICB = PREM_RICB
140+
141+ ! note: different versions use different radii when calling this routine
128142 if (USE_OLD_VERSION_FORMAT) then
143+ ! version compatibility with older versions 7.0 - 8.0
129144 RICB = PREM_RICB_OLD
130- else
131- RICB = PREM_RICB
145+
146+ ! version compatibility with special case Berkeley model
147+ ! note: old Berkeley implementation used radii different to PREM when calling this routine for gravity evaluation.
148+ ! this was inconsistent with the the spline evaluation in the old make_gravity.f90.
149+ ! the change here below is to re-introduce this inconsistency to match the old Berkeley model output.
150+ !
151+ ! new(er) versions use the "original" PREM model for calculating gravity (and ellipticity).
152+ ! that is, gravity (acceleration g) and ellipticity (based on density model) is based on PREM, since we know that
153+ ! PREM was constructed with corresponding constraints.
154+ ! other reference models might better adapt to velocities, but might violate for example total mass constraints.
155+ ! the different radii of the reference models are used for meshing purposes only.
156+ !
157+ if (REFERENCE_1D_MODEL == REFERENCE_MODEL_SEMUCB) then
158+ RICB = PREM_RICB
159+ RMOHO = 6341000.d0
160+ R4 00 = 5961000.d0
161+ R670 = 5721000.d0
162+ endif
132163 endif
133164
134165 if (check_doubling_flag) then
@@ -145,31 +176,31 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
145176 !
146177 !- -- outer core
147178 !
148- else if (r > RICB .and. r < PREM_RCMB ) then
179+ else if (r > RICB .and. r < RCMB ) then
149180 if (idoubling /= IFLAG_OUTER_CORE_NORMAL) &
150181 stop ' wrong doubling flag for outer core point in model_prem_iso()'
151182 !
152183 !- -- D" at the base of the mantle
153184 !
154- else if (r > PREM_RCMB .and. r < PREM_RTOPDDOUBLEPRIME ) then
185+ else if (r > RCMB .and. r < RTOPDDOUBLEPRIME ) then
155186 if (idoubling /= IFLAG_MANTLE_NORMAL) &
156187 stop ' wrong doubling flag for D" point in model_prem_iso()'
157188 !
158189 !- -- mantle: from top of D" to d670
159190 !
160- else if (r > PREM_RTOPDDOUBLEPRIME .and. r < PREM_R670 ) then
191+ else if (r > RTOPDDOUBLEPRIME .and. r < R670 ) then
161192 if (idoubling /= IFLAG_MANTLE_NORMAL) &
162193 stop ' wrong doubling flag for top D" to d670 point in model_prem_iso()'
163194 !
164195 !- -- mantle: from d670 to d220
165196 !
166- else if (r > PREM_R670 .and. r < PREM_R220 ) then
197+ else if (r > R670 .and. r < R220 ) then
167198 if (idoubling /= IFLAG_670_220) &
168199 stop ' wrong doubling flag for d670 to d220 point in model_prem_iso()'
169200 !
170201 !- -- mantle and crust: from d220 to MOHO and then to surface
171202 !
172- else if (r > PREM_R220 ) then
203+ else if (r > R220 ) then
173204 if (idoubling /= IFLAG_220_80 .and. idoubling /= IFLAG_80_MOHO .and. idoubling /= IFLAG_CRUST) &
174205 stop ' wrong doubling flag for d220 to Moho to surface point in model_prem_iso()'
175206 endif
@@ -201,7 +232,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
201232!
202233!- -- outer core
203234!
204- else if (r > RICB .and. r <= PREM_RCMB ) then
235+ else if (r > RICB .and. r <= RCMB ) then
205236 drhodr = - 1.2638d0 - 2.0d0 * 3.6426d0 * x - 3.0d0 * 5.5281d0 * x* x
206237 rho = 12.5815d0 - 1.2638d0 * x - 3.6426d0 * x* x - 5.5281d0 * x* x* x
207238 if (REFERENCE_1D_MODEL == REFERENCE_MODEL_PREM2) then
@@ -223,7 +254,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
223254!
224255!- -- D" at the base of the mantle
225256!
226- else if (r > PREM_RCMB .and. r <= PREM_RTOPDDOUBLEPRIME ) then
257+ else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME ) then
227258 drhodr = - 6.4761d0 + 2.0d0 * 5.5283d0 * x - 3.0d0 * 3.0807d0 * x* x
228259 rho = 7.9565d0 - 6.4761d0 * x + 5.5283d0 * x* x - 3.0807d0 * x* x* x
229260 if (REFERENCE_1D_MODEL == REFERENCE_MODEL_PREM2) then
@@ -239,7 +270,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
239270!
240271!- -- mantle: from top of D" to d670
241272!
242- else if (r > PREM_RTOPDDOUBLEPRIME .and. r <= PREM_R771 ) then
273+ else if (r > RTOPDDOUBLEPRIME .and. r <= R771 ) then
243274 drhodr = - 6.4761d0 + 2.0d0 * 5.5283d0 * x - 3.0d0 * 3.0807d0 * x* x
244275 rho = 7.9565d0 - 6.4761d0 * x + 5.5283d0 * x* x - 3.0807d0 * x* x* x
245276 if (REFERENCE_1D_MODEL == REFERENCE_MODEL_PREM2) then
@@ -258,7 +289,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
258289 vs = 11.1671d0 - 13.7818d0 * x + 17.4575d0 * x* x - 9.2777d0 * x* x* x
259290 Qmu = 312.0d0
260291 Qkappa = 57827.0d0
261- else if (r > PREM_R771 .and. r <= PREM_R670 ) then
292+ else if (r > R771 .and. r <= R670 ) then
262293 drhodr = - 6.4761d0 + 2.0d0 * 5.5283d0 * x - 3.0d0 * 3.0807d0 * x* x
263294 rho = 7.9565d0 - 6.4761d0 * x + 5.5283d0 * x* x - 3.0807d0 * x* x* x
264295 vp = 29.2766d0 - 23.6027d0 * x + 5.5242d0 * x* x - 2.5514d0 * x* x* x
@@ -268,28 +299,28 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
268299!
269300!- -- mantle: above d670
270301!
271- else if (r > PREM_R670 .and. r <= PREM_R600 ) then
302+ else if (r > R670 .and. r <= R600 ) then
272303 drhodr = - 1.4836d0
273304 rho = 5.3197d0 - 1.4836d0 * x
274305 vp = 19.0957d0 - 9.8672d0 * x
275306 vs = 9.9839d0 - 4.9324d0 * x
276307 Qmu = 143.0d0
277308 Qkappa = 57827.0d0
278- else if (r > PREM_R600 .and. r <= PREM_ R4 00 ) then
309+ else if (r > R600 .and. r <= R4 00 ) then
279310 drhodr = - 8.0298d0
280311 rho = 11.2494d0 - 8.0298d0 * x
281312 vp = 39.7027d0 - 32.6166d0 * x
282313 vs = 22.3512d0 - 18.5856d0 * x
283314 Qmu = 143.0d0
284315 Qkappa = 57827.0d0
285- else if (r > PREM_ R4 00 .and. r <= PREM_R220 ) then
316+ else if (r > R4 00 .and. r <= R220 ) then
286317 drhodr = - 3.8045d0
287318 rho = 7.1089d0 - 3.8045d0 * x
288319 vp = 20.3926d0 - 12.2569d0 * x
289320 vs = 8.9496d0 - 4.4597d0 * x
290321 Qmu = 143.0d0
291322 Qkappa = 57827.0d0
292- else if (r > PREM_R220 .and. r <= PREM_ R8 0 ) then
323+ else if (r > R220 .and. r <= R8 0 ) then
293324 drhodr = 0.6924d0
294325 rho = 2.6910d0 + 0.6924d0 * x
295326 vp = 4.1875d0 + 3.9382d0 * x
@@ -299,7 +330,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
299330 else
300331 if (CRUSTAL .and. .not. SUPPRESS_CRUSTAL_MESH) then
301332! fill with PREM mantle and later add CRUST2.0
302- if (r > PREM_ R8 0 ) then
333+ if (r > R8 0 ) then
303334 ! density/velocity from mantle just below moho
304335 drhodr = 0.6924d0
305336 rho = 2.6910d0 + 0.6924d0 * x
@@ -311,7 +342,7 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
311342 endif
312343 else
313344! use PREM crust
314- if (r > PREM_ R8 0 .and. r <= PREM_RMOHO ) then
345+ if (r > R8 0 .and. r <= RMOHO ) then
315346 drhodr = 0.6924d0
316347 rho = 2.6910d0 + 0.6924d0 * x
317348 vp = 4.1875d0 + 3.9382d0 * x
@@ -322,13 +353,13 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
322353 else if (SUPPRESS_CRUSTAL_MESH) then
323354 ! extend the Moho up to the surface instead of the crust
324355 drhodr = 0.6924d0
325- rho = 2.6910d0 + 0.6924d0 * (PREM_RMOHO / R_PLANET)
326- vp = 4.1875d0 + 3.9382d0 * (PREM_RMOHO / R_PLANET)
327- vs = 2.1519d0 + 2.3481d0 * (PREM_RMOHO / R_PLANET)
356+ rho = 2.6910d0 + 0.6924d0 * (RMOHO / R_PLANET)
357+ vp = 4.1875d0 + 3.9382d0 * (RMOHO / R_PLANET)
358+ vs = 2.1519d0 + 2.3481d0 * (RMOHO / R_PLANET)
328359 Qmu = 600.0d0
329360 Qkappa = 57827.0d0
330361
331- else if (r > PREM_RMOHO .and. r <= PREM_RMIDDLE_CRUST ) then
362+ else if (r > RMOHO .and. r <= RMIDDLE_CRUST ) then
332363 drhodr = 0.0d0
333364 rho = 2.9d0
334365 vp = 6.8d0
@@ -346,15 +377,15 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL,check_
346377 Qkappa = 57827.0d0
347378 endif
348379
349- else if (r > PREM_RMIDDLE_CRUST .and. r <= PREM_ROCEAN ) then
380+ else if (r > RMIDDLE_CRUST .and. r <= ROCEAN ) then
350381 drhodr = 0.0d0
351382 rho = 2.6d0
352383 vp = 5.8d0
353384 vs = 3.2d0
354385 Qmu = 600.0d0
355386 Qkappa = 57827.0d0
356387! for density profile for gravity, we do not check that r <= R_PLANET
357- else if (r > PREM_ROCEAN ) then
388+ else if (r > ROCEAN ) then
358389 drhodr = 0.0d0
359390 rho = 2.6d0
360391 vp = 5.8d0
0 commit comments