From bd85b1c815f682f668beb1a9945be4d0953b5af2 Mon Sep 17 00:00:00 2001 From: homnath Date: Sat, 9 Dec 2023 07:12:35 -0500 Subject: [PATCH] - fixed a bug related to USE_OTHER_TIME_FUNCTION --- src/shared/count_number_of_sources.f90 | 9 ++++++++- src/specfem3D/setup_sources_receivers.f90 | 7 +------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/shared/count_number_of_sources.f90 b/src/shared/count_number_of_sources.f90 index aba14d4ba..57ce9361e 100644 --- a/src/shared/count_number_of_sources.f90 +++ b/src/shared/count_number_of_sources.f90 @@ -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 @@ -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 + 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 diff --git a/src/specfem3D/setup_sources_receivers.f90 b/src/specfem3D/setup_sources_receivers.f90 index 8014fd7e8..9b0efdb9d 100644 --- a/src/specfem3D/setup_sources_receivers.f90 +++ b/src/specfem3D/setup_sources_receivers.f90 @@ -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 @@ -273,7 +268,7 @@ subroutine setup_sources() if (ier /= 0) call exit_MPI_without_rank('error allocating array 2059') 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