Skip to content

Commit

Permalink
adding some more explicit type conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed May 17, 2024
1 parent 833a4f1 commit f604d7c
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 151 deletions.
26 changes: 13 additions & 13 deletions src/meshfem3D/model_EMC.f90
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ subroutine scale_Brocher_rho_from_vp()
rho = fac1 * vp + fac2 * vp_p2 + fac3 * vp_p3 + fac4 * vp_p4 + fac5 * vp_p5

! Density
EMC_rho(ix,iy,iz) = rho
EMC_rho(ix,iy,iz) = real(rho,kind=CUSTOM_REAL)
enddo
enddo
enddo
Expand Down Expand Up @@ -861,7 +861,7 @@ subroutine scale_Brocher_vs_from_vp()
vs = fac1 + fac2 * vp + fac3 * vp_p2 + fac4 * vp_p3 + fac5 * vp_p4

! Density
EMC_vs(ix,iy,iz) = vs
EMC_vs(ix,iy,iz) = real(vs,kind=CUSTOM_REAL)
enddo
enddo
enddo
Expand All @@ -872,7 +872,7 @@ subroutine scale_Brocher_vs_from_vp()
! unit scaling to convert to same unit as vp
if (EMC_vp_unit == 3) then
! use same unit as vp km/s -> m/s
EMC_vs = EMC_vs * 1000.d0
EMC_vs = EMC_vs * 1000.0_CUSTOM_REAL
EMC_vs_unit = 3
endif

Expand Down Expand Up @@ -932,7 +932,7 @@ subroutine scale_Brocher_vp_from_vs()
vp = fac1 + fac2 * vs + fac3 * vs_p2 + fac4 * vs_p3 + fac5 * vs_p4

! Vp
EMC_vp(ix,iy,iz) = vp
EMC_vp(ix,iy,iz) = real(vp,kind=CUSTOM_REAL)
enddo
enddo
enddo
Expand All @@ -943,7 +943,7 @@ subroutine scale_Brocher_vp_from_vs()
! unit scaling to convert to same unit as vs
if (EMC_vs_unit == 3) then
! use same unit as vp km/s -> m/s
EMC_vp = EMC_vp * 1000.d0
EMC_vp = EMC_vp * 1000.0_CUSTOM_REAL
EMC_vp_unit = 3
endif

Expand Down Expand Up @@ -1674,9 +1674,9 @@ subroutine fill_EMC_missing_values_interpolated()
end select

! stores interpolated value
EMC_vp(ilon,ilat,idep) = vp_interp
EMC_vs(ilon,ilat,idep) = vs_interp
EMC_rho(ilon,ilat,idep) = rho_interp
EMC_vp(ilon,ilat,idep) = real(vp_interp,kind=CUSTOM_REAL)
EMC_vs(ilon,ilat,idep) = real(vs_interp,kind=CUSTOM_REAL)
EMC_rho(ilon,ilat,idep) = real(rho_interp,kind=CUSTOM_REAL)

! update mask flag
tmp_mask(ilon,ilat,idep) = .false.
Expand Down Expand Up @@ -2553,7 +2553,7 @@ subroutine read_emc_model()
! units: 1==m, 2==km, 3==m/s, 4==km/s, 5==g/cm^3, 6==kg/cm^3, 7==kg/m^3
if (EMC_dep_unit == 1) then
! converts to km
EMC_dep(:) = EMC_dep(:) / 1000.d0
EMC_dep(:) = EMC_dep(:) / 1000.0_CUSTOM_REAL
EMC_dep_unit = 2 ! in km
endif
! converts depth reference direction to positive being down (positive depth below sealevel, negative depth above)
Expand Down Expand Up @@ -3030,23 +3030,23 @@ subroutine read_emc_model()
if (EMC_rho_unit == 5) then
! converts to kg/m^3
! rho [kg/m^3] = rho * 1000 [g/cm^3]
EMC_rho(:,:,:) = EMC_rho(:,:,:) * 1000.d0
EMC_rho(:,:,:) = EMC_rho(:,:,:) * 1000.0_CUSTOM_REAL
EMC_rho_unit = 7 ! kg/m^3
else if (EMC_rho_unit == 6) then
! converts to kg/m^3
! rho [kg/m^3] = rho * 1000000 [kg/cm^3]
EMC_rho(:,:,:) = EMC_rho(:,:,:) * 1.d6
EMC_rho(:,:,:) = EMC_rho(:,:,:) * 1.e6_CUSTOM_REAL
EMC_rho_unit = 7 ! kg/m^3
endif
! converts velocity to default m/s
if (EMC_vp_unit == 4) then
! converts to m/s
EMC_vp(:,:,:) = EMC_vp(:,:,:) * 1000.d0
EMC_vp(:,:,:) = EMC_vp(:,:,:) * 1000.0_CUSTOM_REAL
EMC_vp_unit = 3
endif
if (EMC_vs_unit == 4) then
! converts to m/s
EMC_vs(:,:,:) = EMC_vs(:,:,:) * 1000.d0
EMC_vs(:,:,:) = EMC_vs(:,:,:) * 1000.0_CUSTOM_REAL
EMC_vs_unit = 3
endif

Expand Down
4 changes: 2 additions & 2 deletions src/meshfem3D/save_model_meshfiles_adios.F90
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ subroutine save_model_meshfiles_adios()
! anisotropic values
if (ANISOTROPIC_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then
! the scale of GPa--[g/cm^3][(km/s)^2]
scaleval = dsqrt(PI*GRAV*RHOAV)
scale_GPa = (RHOAV/1000.d0)*((R_PLANET*scaleval/1000.d0)**2)
scaleval = real(sqrt(PI*GRAV*RHOAV),kind=CUSTOM_REAL)
scale_GPa = real((RHOAV/1000.d0)*((R_PLANET*scaleval/1000.d0)**2),kind=CUSTOM_REAL)

allocate(temp_store_mu0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
if (ier /= 0) stop 'Error allocating temp mu0 array'
Expand Down
Loading

0 comments on commit f604d7c

Please sign in to comment.