Skip to content

Commit

Permalink
Merge pull request #1655 from homnath/devel
Browse files Browse the repository at this point in the history
- added reuse option for external source time function file to CMTSOLUTION
  • Loading branch information
danielpeter authored Nov 23, 2023
2 parents 3eb4e22 + b3bf93e commit 0321f61
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/specfem3D/get_cmt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ subroutine get_cmt(CMTSOLUTION,yr,jda,mo,da,ho,mi,sec, &

! local variables below
integer :: julian_day,isource
integer :: ishift,nright
integer :: i,itype,istart,iend,ier,ipos
double precision :: t_shift(NSOURCES)
character(len=256) :: string
Expand Down Expand Up @@ -372,9 +373,22 @@ subroutine get_cmt(CMTSOLUTION,yr,jda,mo,da,ho,mi,sec, &
! gets external STF file name
read(IIN,"(a)") string
external_source_time_function_filename = trim(string)

! reads in stf values
call read_external_source_time_function(isource,user_source_time_function,external_source_time_function_filename)
if (trim(external_source_time_function_filename) == 'REUSE' .or. &
trim(external_source_time_function_filename) == 'Reuse' .or. &
trim(external_source_time_function_filename) == 'reuse') then
! Reuse the source time function of the first source.
if (isource == 1) then
stop 'Error: "reuse" option cannot be used for the first source!'
endif
ishift=nint(t_shift(isource)/DT)
nright=NSTEP_STF-ishift
user_source_time_function(1:ishift,isource)=0.0_CUSTOM_REAL
user_source_time_function(ishift+1:NSTEP_STF,isource)=user_source_time_function(1:nright,1)
else

! reads in stf values
call read_external_source_time_function(isource,user_source_time_function,external_source_time_function_filename)
endif
endif

enddo
Expand Down

0 comments on commit 0321f61

Please sign in to comment.