Skip to content

Commit

Permalink
- fixed a bug related to USE_OTHER_TIME_FUNCTION
Browse files Browse the repository at this point in the history
  • Loading branch information
homnath committed Dec 9, 2023
1 parent b95e76b commit bd85b1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/shared/count_number_of_sources.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ subroutine count_number_of_sources(NSOURCES,sources_filename)
NLINES_PER_FORCESOLUTION_SOURCE,NLINES_PER_CMTSOLUTION_SOURCE, &
mygroup

use shared_parameters, only: USE_FORCE_POINT_SOURCE,USE_EXTERNAL_SOURCE_FILE, &
use shared_parameters, only: USE_FORCE_POINT_SOURCE,USE_OTHER_TIME_FUNCTION, &
USE_EXTERNAL_SOURCE_FILE, &
HAS_FINITE_FAULT_SOURCE,NUMBER_OF_SIMULTANEOUS_RUNS

implicit none
Expand Down Expand Up @@ -84,6 +85,12 @@ subroutine count_number_of_sources(NSOURCES,sources_filename)
nlines_per_source = NLINES_PER_CMTSOLUTION_SOURCE
endif

! number of lines for source description
! in case of USE_OTHER_TIME_FUNCTION we have to read one additional line per source (the name of other source time function)
if (USE_OTHER_TIME_FUNCTION) then
nlines_per_source = nlines_per_source + 1

Check warning on line 91 in src/shared/count_number_of_sources.f90

View check run for this annotation

Codecov / codecov/patch

src/shared/count_number_of_sources.f90#L91

Added line #L91 was not covered by tests
endif

! number of lines for source description
! in case of USE_EXTERNAL_SOURCE_FILE we have to read one additional line per source (the name of external source file)
if (USE_EXTERNAL_SOURCE_FILE) then
Expand Down
7 changes: 1 addition & 6 deletions src/specfem3D/setup_sources_receivers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,6 @@ subroutine setup_sources()
comp_dir_vect_source_N(:) = 0.d0
comp_dir_vect_source_Z_UP(:) = 0.d0

! allocate array that contains the user defined source time function
allocate(user_source_time_function(NSTEP_STF, NSOURCES_STF),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 2058')
if (ier /= 0) stop 'error allocating arrays for user sources time function'
user_source_time_function(:,:) = 0.0_CUSTOM_REAL
! sets the size of user_source_time_function array
if (USE_EXTERNAL_SOURCE_FILE) then
NSTEP_STF = NSTEP
Expand All @@ -273,7 +268,7 @@ subroutine setup_sources()
if (ier /= 0) call exit_MPI_without_rank('error allocating array 2059')

Check warning on line 268 in src/specfem3D/setup_sources_receivers.f90

View check run for this annotation

Codecov / codecov/patch

src/specfem3D/setup_sources_receivers.f90#L267-L268

Added lines #L267 - L268 were not covered by tests
else
allocate(cmt_stf(1),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 2059')
if (ier /= 0) call exit_MPI_without_rank('error allocating array 2060')
endif
if (ier /= 0) stop 'error allocating arrays for other time functions'
cmt_stf(:) = 0
Expand Down

0 comments on commit bd85b1c

Please sign in to comment.