Skip to content

Commit

Permalink
updates comments; adds moho check for Berkeley model testing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Dec 2, 2024
1 parent 68a8f50 commit 4208388
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
16 changes: 13 additions & 3 deletions src/meshfem3D/model_crust_berkeley.f90
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ subroutine model_berkeley_crust(x,theta,phi,vp,vs,rho,moho,found_crust,elem_in_c

depth = (1.d0 - x) * EARTH_R_KM

call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth)
call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth,moho_only)

Check warning on line 151 in src/meshfem3D/model_crust_berkeley.f90

View check run for this annotation

Codecov / codecov/patch

src/meshfem3D/model_crust_berkeley.f90#L151

Added line #L151 was not covered by tests

! using crustal values
if (USE_OLD_VERSION_FORMAT) then
Expand Down Expand Up @@ -226,7 +226,7 @@ subroutine model_berkeley_crust_aniso(x,theta,phi,vpv,vph,vsv,vsh,eta_aniso,rho,

depth = (1.d0 - x) * EARTH_R_KM

call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth)
call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth,moho_only)

Check warning on line 229 in src/meshfem3D/model_crust_berkeley.f90

View check run for this annotation

Codecov / codecov/patch

src/meshfem3D/model_crust_berkeley.f90#L229

Added line #L229 was not covered by tests

! using crustal values
if (USE_OLD_VERSION_FORMAT) then
Expand Down Expand Up @@ -266,14 +266,15 @@ end subroutine model_berkeley_crust_aniso
!--------------------------------------------------------------------------------------------------
!

subroutine get_crust_val_csem(theta,phi,z,rho,vp,vsv,vsh,moho_depth)
subroutine get_crust_val_csem(theta,phi,z,rho,vp,vsv,vsh,moho_depth,moho_only)

Check warning on line 269 in src/meshfem3D/model_crust_berkeley.f90

View check run for this annotation

Codecov / codecov/patch

src/meshfem3D/model_crust_berkeley.f90#L269

Added line #L269 was not covered by tests

use model_crust_berkeley_par

implicit none

double precision,intent(in) :: theta,phi,z
double precision,intent(out) :: rho,vp,vsv,vsh,moho_depth
logical,intent(in) :: moho_only

! local parameters
! 4-th order GLL positions
Expand All @@ -290,13 +291,22 @@ subroutine get_crust_val_csem(theta,phi,z,rho,vp,vsv,vsh,moho_depth)
double precision,external :: moho_filtre
double precision,external :: lagrange

! initialize
rho = 0.d0
vp = 0.d0
vsv = 0.d0
vsh = 0.d0

Check warning on line 298 in src/meshfem3D/model_crust_berkeley.f90

View check run for this annotation

Codecov / codecov/patch

src/meshfem3D/model_crust_berkeley.f90#L295-L298

Added lines #L295 - L298 were not covered by tests

! get moho depth
moho_depth = moho1D_depth - moho_filtre(theta,phi)

!debug
!print *,"debug: [get_crust_val_csem] Moho depth:",moho_depth, &
! "moho1D_depth:",moho1D_depth,"moho_filtre:",moho_filtre(theta,phi)

! check if anything further to do or return only moho
if (moho_only) return

Check warning on line 308 in src/meshfem3D/model_crust_berkeley.f90

View check run for this annotation

Codecov / codecov/patch

src/meshfem3D/model_crust_berkeley.f90#L308

Added line #L308 was not covered by tests

!
! horizontal interpolation for all registered depths
!
Expand Down
49 changes: 29 additions & 20 deletions src/shared/get_model_parameters.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,8 @@ subroutine get_model_parameters_radii()
RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS

use shared_parameters, only: &
HONOR_1D_SPHERICAL_MOHO,CASE_3D,CRUSTAL,REFERENCE_1D_MODEL
HONOR_1D_SPHERICAL_MOHO,CASE_3D,CRUSTAL,REFERENCE_1D_MODEL, &
NCHUNKS,NEX_XI,NEX_ETA

! reference models
use model_prem_par
Expand Down Expand Up @@ -1439,33 +1440,33 @@ subroutine get_model_parameters_radii()
! (same as values in model_ccrem.f90)
CCREM_RSURFACE = R_PLANET
ROCEAN = CCREM_RSURFACE ! no ocean
RMIDDLE_CRUST = CCREM_RSURFACE - 20000.d0 ! depth = 20 km
RMOHO = CCREM_RSURFACE - 35000.d0 ! depth = 35 km
R80 = CCREM_RSURFACE - 80000.d00 ! depth = 80 km
R220 = CCREM_RSURFACE - 220000.d0 ! depth = 220 km
R400 = CCREM_RSURFACE - 410000.d0 ! depth = 410 km - CCREM depth 410km discontinuity
R600 = CCREM_RSURFACE - 600000.d0 ! depth = 600 km
R670 = CCREM_RSURFACE - 660000.d0 ! depth = 660 km - CCREM depth 660km discontinuity
R771 = CCREM_RSURFACE - 771000.d0 ! depth = 771 km (PREM)
RMIDDLE_CRUST = CCREM_RSURFACE - 20000.d0 ! depth = 20 km
RMOHO = CCREM_RSURFACE - 35000.d0 ! depth = 35 km
R80 = CCREM_RSURFACE - 80000.d00 ! depth = 80 km
R220 = CCREM_RSURFACE - 220000.d0 ! depth = 220 km
R400 = CCREM_RSURFACE - 410000.d0 ! depth = 410 km - CCREM depth 410km discontinuity
R600 = CCREM_RSURFACE - 600000.d0 ! depth = 600 km
R670 = CCREM_RSURFACE - 660000.d0 ! depth = 660 km - CCREM depth 660km discontinuity
R771 = CCREM_RSURFACE - 771000.d0 ! depth = 771 km (PREM)

Check warning on line 1450 in src/shared/get_model_parameters.F90

View check run for this annotation

Codecov / codecov/patch

src/shared/get_model_parameters.F90#L1443-L1450

Added lines #L1443 - L1450 were not covered by tests
RTOPDDOUBLEPRIME = CCREM_RSURFACE - 2741000.d0 ! depth = 2741 km (PREM)
RCMB = CCREM_RSURFACE - 2891000.d0 ! depth = 2891 km (PREM)
RICB = CCREM_RSURFACE - 5153500.d0 ! depth = 5153.5 km
RCMB = CCREM_RSURFACE - 2891000.d0 ! depth = 2891 km (PREM)
RICB = CCREM_RSURFACE - 5153500.d0 ! depth = 5153.5 km

Check warning on line 1453 in src/shared/get_model_parameters.F90

View check run for this annotation

Codecov / codecov/patch

src/shared/get_model_parameters.F90#L1452-L1453

Added lines #L1452 - L1453 were not covered by tests

RHO_TOP_OC = 9.9131d0 * 1000.d0 / RHOAV
RHO_BOTTOM_OC = 12.1478d0 * 1000.d0 / RHOAV

case (REFERENCE_MODEL_SEMUCB)
! Berkeley SEMUCB Model - discontinuities
ROCEAN = 6368000.d0
RMIDDLE_CRUST = 6356000.d0
RMOHO = 6341000.d0 ! moho depth = 30 km
R80 = 6291000.d0
R120 = -1.d0 ! no d120 discontinuity, set to fictitious value
R220 = 6151000.d0
R400 = 5961000.d0
R600 = 5771000.d0
R670 = 5721000.d0
R771 = 5600000.d0
RMIDDLE_CRUST = 6356000.d0 ! depth = 15 km
RMOHO = 6341000.d0 ! moho depth = 30 km
R80 = 6291000.d0 ! depth = 80 km
R120 = -1.d0 ! no d120 discontinuity, set to fictitious value
R220 = 6151000.d0 ! depth = 220 km
R400 = 5961000.d0 ! depth = 410 km
R600 = 5771000.d0 ! depth = 600 km
R670 = 5721000.d0 ! depth = 650 km
R771 = 5600000.d0 ! depth = 771 km

Check warning on line 1469 in src/shared/get_model_parameters.F90

View check run for this annotation

Codecov / codecov/patch

src/shared/get_model_parameters.F90#L1461-L1469

Added lines #L1461 - L1469 were not covered by tests
RTOPDDOUBLEPRIME = 3630000.d0
RCMB = 3480000.d0
RICB = 1221500.d0
Expand Down Expand Up @@ -1605,6 +1606,14 @@ subroutine get_model_parameters_radii()
! moves fictitious moho closer to this 1d moho depth
RMOHO_FICTITIOUS_IN_MESHER = R_PLANET - 29000.000 ! down at 29 km depth
R80_FICTITIOUS_IN_MESHER = R_PLANET - 130000.000 ! down at 130 km depth

! coarse global mesh modification (to allow for small testing examples)
! to avoid Jacobian errors around lat/lon ~ 80 deg / 100 deg due to stretching
if (NCHUNKS == 6 .and. min(NEX_XI,NEX_ETA) <= 48) then
RMOHO_FICTITIOUS_IN_MESHER = R_PLANET - 35000.000 ! down at 35 km depth
R80_FICTITIOUS_IN_MESHER = R_PLANET - 140000.000 ! down at 100 km depth

Check warning on line 1614 in src/shared/get_model_parameters.F90

View check run for this annotation

Codecov / codecov/patch

src/shared/get_model_parameters.F90#L1612-L1614

Added lines #L1612 - L1614 were not covered by tests
endif

endif
endif

Expand Down
4 changes: 4 additions & 0 deletions src/shared/read_compute_parameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ subroutine rcp_check_parameters()
! for flat topography, NEX = 32 setting still okay
nex_minimum = 32
endif

! Berkeley coarse global mesh modification (to allow for small testing examples)
if (REFERENCE_1D_MODEL == REFERENCE_MODEL_SEMUCB) nex_minimum = 32

! checks nex
if (NEX_XI < nex_minimum) &
stop 'NEX_XI must be greater to cut the sphere into slices with positive Jacobian'
Expand Down

0 comments on commit 4208388

Please sign in to comment.