Skip to content

Commit

Permalink
- added reuse option for external source time function file to CMTSOL…
Browse files Browse the repository at this point in the history
…UTION
  • Loading branch information
homnath committed Nov 22, 2023
1 parent 3eb4e22 commit b3bf93e
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!'

Check warning on line 381 in src/specfem3D/get_cmt.f90

View check run for this annotation

Codecov / codecov/patch

src/specfem3D/get_cmt.f90#L380-L381

Added lines #L380 - L381 were not covered by tests
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)

Check warning on line 386 in src/specfem3D/get_cmt.f90

View check run for this annotation

Codecov / codecov/patch

src/specfem3D/get_cmt.f90#L383-L386

Added lines #L383 - L386 were not covered by tests
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 b3bf93e

Please sign in to comment.