[cig-commits] [commit] devel: fixed a bug (uninitialized array hdur_tiny) in the case of USE_FORCE_POINT_SOURCE (858a86e)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Oct 1 14:40:41 PDT 2014


Repository : https://github.com/geodynamics/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/c6e79a8b6c3bfec725eeb40bf8f42398e736d3cb...858a86e5e8e4c076696d24c8c9942e93d3d663cb

>---------------------------------------------------------------

commit 858a86e5e8e4c076696d24c8c9942e93d3d663cb
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Wed Oct 1 23:36:09 2014 +0200

    fixed a bug (uninitialized array hdur_tiny) in the case of USE_FORCE_POINT_SOURCE


>---------------------------------------------------------------

858a86e5e8e4c076696d24c8c9942e93d3d663cb
 src/specfem3D/comp_source_time_function.f90       |  2 +-
 src/specfem3D/compute_add_sources_acoustic.f90    | 21 ++++-----------------
 src/specfem3D/compute_add_sources_poroelastic.f90 | 17 -----------------
 src/specfem3D/finalize_simulation.f90             |  5 ++---
 src/specfem3D/setup_sources_receivers.f90         | 11 ++++-------
 5 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/src/specfem3D/comp_source_time_function.f90 b/src/specfem3D/comp_source_time_function.f90
index 855dd7b..8871263 100644
--- a/src/specfem3D/comp_source_time_function.f90
+++ b/src/specfem3D/comp_source_time_function.f90
@@ -60,7 +60,7 @@
   hdur_decay = hdur
 
   ! this here uses a stronger gaussian decay rate (empirical value) to avoid non-zero onset times;
-  ! however, it should mimik a triangle source time function...
+  ! however, it should mimic a triangle source time function...
   !hdur_decay = hdur  / SOURCE_DECAY_STRONG
 
   ! note: a nonzero time to start the simulation with would lead to more high-frequency noise
diff --git a/src/specfem3D/compute_add_sources_acoustic.f90 b/src/specfem3D/compute_add_sources_acoustic.f90
index e45158a..14192e8 100644
--- a/src/specfem3D/compute_add_sources_acoustic.f90
+++ b/src/specfem3D/compute_add_sources_acoustic.f90
@@ -124,14 +124,9 @@
 
             if (USE_FORCE_POINT_SOURCE) then
 
+!! DK DK note from DK DK: the statement below is very weird
               f0 = hdur(isource) !! using hdur as a FREQUENCY just to avoid changing FORCESOLUTION file format
 
-              !if (it == 1 .and. myrank == 0) then
-              !  write(IMAIN,*) 'using a source of dominant frequency ',f0
-              !  write(IMAIN,*) 'lambda_S at dominant frequency = ',3000./sqrt(3.)/f0
-              !  write(IMAIN,*) 'lambda_S at highest significant frequency = ',3000./sqrt(3.)/(2.5*f0)
-              !endif
-
               if (USE_RICKER_TIME_FUNCTION) then
                 stf_used = comp_source_time_function_rickr(dble(it-1)*DT-t0-tshift_src(isource),f0)
               else
@@ -468,20 +463,13 @@
 
             if (USE_FORCE_POINT_SOURCE) then
 
+!! DK DK note from DK DK: the statement below is very weird
               f0 = hdur(isource) !! using hdur as a FREQUENCY just to avoid changing FORCESOLUTION file format
 
-              !if (it == 1 .and. myrank == 0) then
-              !  write(IMAIN,*) 'using a source of dominant frequency ',f0
-              !  write(IMAIN,*) 'lambda_S at dominant frequency = ',3000./sqrt(3.)/f0
-              !  write(IMAIN,*) 'lambda_S at highest significant frequency = ',3000./sqrt(3.)/(2.5*f0)
-              !endif
-
               if (USE_RICKER_TIME_FUNCTION) then
-                stf_used = comp_source_time_function_rickr( &
-                           dble(NSTEP-it)*DT-t0-tshift_src(isource),f0)
+                stf_used = comp_source_time_function_rickr(dble(NSTEP-it)*DT-t0-tshift_src(isource),f0)
               else
-                stf_used = comp_source_time_function_gauss( &
-                           dble(NSTEP-it)*DT-t0-tshift_src(isource),hdur_tiny(isource))
+                stf_used = comp_source_time_function_gauss(dble(NSTEP-it)*DT-t0-tshift_src(isource),hdur_tiny(isource))
               endif
 
               ! beware, for acoustic medium, source is: pressure divided by Kappa of the fluid
@@ -637,7 +625,6 @@
 ! forward simulations
   if (SIMULATION_TYPE == 1 .and. nsources_local > 0) then
 
-!way 2
     if (NSOURCES > 0) then
       do isource = 1,NSOURCES
         ! precomputes source time function factor
diff --git a/src/specfem3D/compute_add_sources_poroelastic.f90 b/src/specfem3D/compute_add_sources_poroelastic.f90
index 8ad1bf8..559e2e7 100644
--- a/src/specfem3D/compute_add_sources_poroelastic.f90
+++ b/src/specfem3D/compute_add_sources_poroelastic.f90
@@ -116,16 +116,6 @@
 
             if(USE_FORCE_POINT_SOURCE) then
 
-              !f0 = hdur(isource) !! using hdur as a FREQUENCY just to avoid changing CMTSOLUTION file format
-              !t0 = 1.2d0/f0
-
-!              if (it == 1 .and. myrank == 0) then
-!                print *,'using a source of dominant frequency ',f0
-!chris
-!                print *,'lambda_S at dominant frequency = ',3000./sqrt(3.)/f0
-!                print *,'lambda_S at highest significant frequency = ',3000./sqrt(3.)/(2.5*f0)
-!              endif
-
               if( USE_RICKER_TIME_FUNCTION ) then
                 stf = comp_source_time_function_rickr(dble(it-1)*DT-t0-tshift_src(isource),hdur(isource))
               else
@@ -363,13 +353,6 @@
 
             if(USE_FORCE_POINT_SOURCE) then
 
-               !f0 = hdur(isource) !! using hdur as a FREQUENCY just to avoid changing CMTSOLUTION file format
-               !if (it == 1 .and. myrank == 0) then
-               !   write(IMAIN,*) 'using a source of dominant frequency ',f0
-               !   write(IMAIN,*) 'lambda_S at dominant frequency = ',3000./sqrt(3.)/f0
-               !   write(IMAIN,*) 'lambda_S at highest significant frequency = ',3000./sqrt(3.)/(2.5*f0)
-               !endif
-
                if( USE_RICKER_TIME_FUNCTION ) then
                  stf = comp_source_time_function_rickr(dble(NSTEP-it)*DT-t0-tshift_src(isource),hdur(isource))
                else
diff --git a/src/specfem3D/finalize_simulation.f90 b/src/specfem3D/finalize_simulation.f90
index d880c43..d22a8c8 100644
--- a/src/specfem3D/finalize_simulation.f90
+++ b/src/specfem3D/finalize_simulation.f90
@@ -169,11 +169,10 @@
     deallocate(comp_dir_vect_source_E)
     deallocate(comp_dir_vect_source_N)
     deallocate(comp_dir_vect_source_Z_UP)
-    if (.not. USE_RICKER_TIME_FUNCTION) then
-      deallocate(hdur_tiny)
-    endif
   endif
 
+  deallocate(hdur_tiny)
+
   ! mass matrices
   if( ELASTIC_SIMULATION ) then
     deallocate(rmassx)
diff --git a/src/specfem3D/setup_sources_receivers.f90 b/src/specfem3D/setup_sources_receivers.f90
index 50d9655..66ef435 100644
--- a/src/specfem3D/setup_sources_receivers.f90
+++ b/src/specfem3D/setup_sources_receivers.f90
@@ -106,12 +106,11 @@
              comp_dir_vect_source_N(NSOURCES), &
              comp_dir_vect_source_Z_UP(NSOURCES),stat=ier)
     if (ier /= 0) stop 'error allocating arrays for force point sources'
-    if (.not. USE_RICKER_TIME_FUNCTION) then
-      allocate(hdur_tiny(NSOURCES),stat=ier)
-      if (ier /= 0) stop 'error allocating arrays for force point sources'
-    endif
   endif
 
+  allocate(hdur_tiny(NSOURCES),stat=ier)
+  if (ier /= 0) stop 'error allocating arrays for force point sources'
+
   ! for source encoding (acoustic sources so far only)
   allocate(pm1_source_encoding(NSOURCES),stat=ier)
   if( ier /= 0 ) stop 'error allocating arrays for sources'
@@ -146,9 +145,7 @@
   hdur_gaussian(:) = hdur(:)/SOURCE_DECAY_MIMIC_TRIANGLE
 
   ! initialize a very short (but non-zero) half duration to use a pseudo-Dirac function
-  if(USE_FORCE_POINT_SOURCE .and. .not. USE_RICKER_TIME_FUNCTION) then
-    hdur_tiny(:) = 5*DT
-  endif
+  hdur_tiny(:) = 5.d0*DT
 
   ! define t0 as the earliest start time
   ! note: an earlier start time also reduces numerical noise due to a



More information about the CIG-COMMITS mailing list