Skip to content

Commit

Permalink
ADded subroutine to interpolate seismograms from located source.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsawade committed Jun 30, 2023
1 parent 79bd204 commit a52a4c7
Show file tree
Hide file tree
Showing 12 changed files with 423 additions and 28 deletions.
1 change: 0 additions & 1 deletion apps/print_cmt.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ program print_cmt
call print_source(sources(i), 1)
enddo


end program print_cmt
8 changes: 8 additions & 0 deletions src/constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,12 @@ module constants
integer, parameter :: NLINES_PER_CMTSOLUTION_SOURCE = 13
integer, parameter :: NLINES_PER_FORCESOLUTION_SOURCE = 11

! Perturbation values
double precision,parameter :: dmom = 1.0d23
double precision,parameter :: dlat = 0.0001d0
double precision,parameter :: dlon = 0.0001d0
double precision,parameter :: ddep = 0.01d0
double precision,parameter :: dcmt = -1.d0
double precision,parameter :: dhdur = 0.001d0

end module constants
1 change: 1 addition & 0 deletions src/gf3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ add_library(gf3d SHARED
${CMAKE_CURRENT_LIST_DIR}/gf3d.F90
${CMAKE_CURRENT_LIST_DIR}/seismograms.F90
${CMAKE_CURRENT_LIST_DIR}/seismograms_windows.F90
${CMAKE_CURRENT_LIST_DIR}/interpolate_source.F90
# ${CMAKE_CURRENT_LIST_DIR}/gf3d_write_seismograms.F90
)

Expand Down
11 changes: 11 additions & 0 deletions src/gf3d/gf3d.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ module gf3d
init_log, finalize_log, &
fftpack

! interface interpolate_source
! module subroutine interpolate_source(GF, source, seismograms)
! use gf, only: t_GF
! use sources, only: t_source
! use interpolation, only: interpolateMT
! type(t_GF), intent(in) :: GF
! type(t_source), intent(in) :: source
! double precision, dimension(:,:,:) :: seismograms
! end subroutine interpolate_source
! end interface interpolate_source

interface get_seismograms
module subroutine get_seismograms(GF, sources, superseismograms)
use gf, only: t_GF
Expand Down
52 changes: 52 additions & 0 deletions src/gf3d/interpolate_source.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
submodule (gf3d:seismograms) source_interpolation

implicit none

contains

module subroutine interpolate_source(GF, source, seismograms)

use gf, only: t_GF
use sources, only: t_source
use interpolation, only: interpolateMT

! In
type(t_GF), intent(in) :: GF
type(t_source), intent(in) :: source
! Out
double precision, dimension(:,:,:) :: seismograms

! Local
integer :: i,j,k,iglob
double precision, dimension(:,:,:,:,:,:,:), allocatable :: displacement

! Allocate temporary displacement array
allocate(displacement(size(GF%displacement,1), 3, 3, GF%ngllx,GF%nglly,GF%ngllz,GF%nsteps))

! Get displacement array
do k=1,GF%ngllz
do j=1,GF%nglly
do i=1,GF%ngllx
iglob = GF%ibool(i,j,k, source%ispec)
displacement(:,:,:,i,j,k, :) = GF%displacement(:,:,:,iglob,:)
enddo
enddo
enddo

if (source%force) then
call throwerror(-1, "Force source interpolation not implemented.")
else
call interpolateMT(&
displacement, size(GF%displacement,1), &
GF%nsteps, GF%ngllx, GF%nglly, GF%ngllz, GF%xigll, GF%yigll, GF%zigll, &
source%Mxx, source%Myy, source%Mzz, &
source%Mxy, source%Mxz, source%Myz, &
source%xi, source%eta,source%gamma, &
source%xix, source%xiy, source%xiz, &
source%etax, source%etay, source%etaz, &
source%gammax, source%gammay, source%gammaz, &
seismograms)
endif
end subroutine interpolate_source

end submodule
Loading

0 comments on commit a52a4c7

Please sign in to comment.