[cig-commits] [commit] devel: Remove commented code for absorbing boundary snapshots. (772f41d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu May 1 00:50:22 PDT 2014


Repository : ssh://geoshell/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/cb32c88d6155d7974561a6f72fc17aea596e2c4d...50aa953c1db3f565d76415f5305410a529996b75

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

commit 772f41ddae02c24097ae10cfd6b8be8e19aa4022
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Sat Jan 11 00:48:57 2014 -0500

    Remove commented code for absorbing boundary snapshots.
    
    It was commented out almost 3 years ago; I don't think it's going to be
    reinstated any time soon.


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

772f41ddae02c24097ae10cfd6b8be8e19aa4022
 setup/constants.h.in                          |  7 +--
 src/cuda/compute_stacey_viscoelastic_cuda.cu  |  4 --
 src/specfem3D/compute_stacey_acoustic.f90     | 24 ++--------
 src/specfem3D/compute_stacey_poroelastic.f90  | 16 ++-----
 src/specfem3D/compute_stacey_viscoelastic.f90 | 24 ++--------
 src/specfem3D/finalize_simulation.f90         |  4 +-
 src/specfem3D/prepare_timerun.F90             | 64 ++++-----------------------
 7 files changed, 26 insertions(+), 117 deletions(-)

diff --git a/setup/constants.h.in b/setup/constants.h.in
index 62667a9..5dc62cc 100644
--- a/setup/constants.h.in
+++ b/setup/constants.h.in
@@ -91,9 +91,10 @@
 ! integer, parameter :: IMAIN = ISTANDARD_OUTPUT
 ! I/O unit for source and receiver vtk file
   integer, parameter :: IOVTK = 98
-! I/O unit for absorbing boundary snapshots
-!  integer, parameter :: IOABS = 31
-!  integer, parameter :: IOABS_AC = 32
+! I/O number for absorbing boundary snapshots (opened in C for speed)
+!  Not a Fortran I/O unit! See write_c_binary.c for more information.
+  integer, parameter :: IOABS = 0
+  integer, parameter :: IOABS_AC = 1
 ! I/O unit for plotting source time function
   integer, Parameter :: IOSTF = 71
 ! I/O unit for interface file
diff --git a/src/cuda/compute_stacey_viscoelastic_cuda.cu b/src/cuda/compute_stacey_viscoelastic_cuda.cu
index 396b9ea..c56b0f9 100644
--- a/src/cuda/compute_stacey_viscoelastic_cuda.cu
+++ b/src/cuda/compute_stacey_viscoelastic_cuda.cu
@@ -239,10 +239,6 @@ void FC_FUNC_(compute_stacey_viscoelastic_cuda,
   exit_on_cuda_error("compute_stacey_elastic_kernel");
 #endif
 
-  // ! adjoint simulations: stores absorbed wavefield part
-  // if (mp->simulation_type == 1 .and. SAVE_FORWARD .and. num_abs_boundary_faces > 0 ) &
-  //   write(IOABS,rec=it) b_reclen_field,b_absorb_field,b_reclen_field
-
   if(mp->simulation_type == 1 && mp->save_forward ) {
     // explicitly wait until compute stream is done
     // (cudaMemcpy implicitly synchronizes all other cuda operations)
diff --git a/src/specfem3D/compute_stacey_acoustic.f90 b/src/specfem3D/compute_stacey_acoustic.f90
index 045777c..f52696c 100644
--- a/src/specfem3D/compute_stacey_acoustic.f90
+++ b/src/specfem3D/compute_stacey_acoustic.f90
@@ -118,10 +118,7 @@
   if (SIMULATION_TYPE == 1 .and. SAVE_FORWARD ) then
     ! writes out absorbing boundary value only when second phase is running
     if( phase_is_inner .eqv. .true. ) then
-      ! uses fortran routine
-      !write(IOABS_AC,rec=it) b_reclen_potential,b_absorb_potential,b_reclen_potential
-      ! uses c routine
-      call write_abs(1,b_absorb_potential,b_reclen_potential,it)
+      call write_abs(IOABS_AC,b_absorb_potential,b_reclen_potential,it)
     endif
   endif
 
@@ -177,12 +174,7 @@
     ! reads in absorbing boundary array when first phase is running
     if( phase_is_inner .eqv. .false. ) then
       ! note: the index NSTEP-it+1 is valid if b_displ is read in after the Newmark scheme
-      ! uses fortran routine
-      !read(IOABS_AC,rec=NSTEP-it+1) reclen1,b_absorb_potential,reclen2
-      !if (reclen1 /= b_reclen_potential .or. reclen1 /= reclen2) &
-      !  call exit_mpi(0,'Error reading absorbing contribution b_absorb_potential')
-      ! uses c routine for faster reading
-      call read_abs(1,b_absorb_potential,b_reclen_potential,NSTEP-it+1)
+      call read_abs(IOABS_AC,b_absorb_potential,b_reclen_potential,NSTEP-it+1)
     endif
   endif !adjoint
 
@@ -257,12 +249,7 @@
     ! reads in absorbing boundary array when first phase is running
     if( phase_is_inner .eqv. .false. ) then
       ! note: the index NSTEP-it+1 is valid if b_displ is read in after the Newmark scheme
-      ! uses fortran routine
-      !read(IOABS_AC,rec=NSTEP-it+1) reclen1,b_absorb_potential,reclen2
-      !if (reclen1 /= b_reclen_potential .or. reclen1 /= reclen2) &
-      !  call exit_mpi(0,'Error reading absorbing contribution b_absorb_potential')
-      ! uses c routine for faster reading
-      call read_abs(1,b_absorb_potential,b_reclen_potential,NSTEP-it+1)
+      call read_abs(IOABS_AC,b_absorb_potential,b_reclen_potential,NSTEP-it+1)
     endif
   endif !adjoint
 
@@ -273,10 +260,7 @@
   if (SIMULATION_TYPE == 1 .and. SAVE_FORWARD ) then
     ! writes out absorbing boundary value only when second phase is running
     if( phase_is_inner .eqv. .true. ) then
-      ! uses fortran routine
-      !write(IOABS_AC,rec=it) b_reclen_potential,b_absorb_potential,b_reclen_potential
-      ! uses c routine
-      call write_abs(1,b_absorb_potential,b_reclen_potential,it)
+      call write_abs(IOABS_AC,b_absorb_potential,b_reclen_potential,it)
     endif
   endif
 
diff --git a/src/specfem3D/compute_stacey_poroelastic.f90 b/src/specfem3D/compute_stacey_poroelastic.f90
index 133c19a..f96f002 100644
--- a/src/specfem3D/compute_stacey_poroelastic.f90
+++ b/src/specfem3D/compute_stacey_poroelastic.f90
@@ -93,13 +93,8 @@
     ! reads in absorbing boundary array when first phase is running
     if( phase_is_inner .eqv. .false. ) then
       ! note: the index NSTEP-it+1 is valid if b_displ is read in after the Newmark scheme
-      ! uses fortran routine
-      !read(IOABS,rec=NSTEP-it+1) reclen1,b_absorb_field,reclen2
-      !if (reclen1 /= b_reclen_field .or. reclen1 /= reclen2) &
-      !  call exit_mpi(0,'Error reading absorbing contribution b_absorb_field')
-      ! uses c routine for faster reading
-      call read_abs(0,b_absorb_fields,b_reclen_field_poro,NSTEP-it+1)
-      call read_abs(0,b_absorb_fieldw,b_reclen_field_poro,NSTEP-it+1)
+      call read_abs(IOABS,b_absorb_fields,b_reclen_field_poro,NSTEP-it+1)
+      call read_abs(IOABS,b_absorb_fieldw,b_reclen_field_poro,NSTEP-it+1)
     endif
   endif !adjoint
 
@@ -195,11 +190,8 @@
   if( SIMULATION_TYPE == 1 .and. SAVE_FORWARD ) then
     ! writes out absorbing boundary value only when second phase is running
     if( phase_is_inner .eqv. .true. ) then
-      ! uses fortran routine
-      !write(IOABS,rec=it) b_reclen_field,b_absorb_field,b_reclen_field
-      ! uses c routine
-      call write_abs(0,b_absorb_fields,b_reclen_field_poro,it)
-      call write_abs(0,b_absorb_fieldw,b_reclen_field_poro,it)
+      call write_abs(IOABS,b_absorb_fields,b_reclen_field_poro,it)
+      call write_abs(IOABS,b_absorb_fieldw,b_reclen_field_poro,it)
     endif
   endif
 
diff --git a/src/specfem3D/compute_stacey_viscoelastic.f90 b/src/specfem3D/compute_stacey_viscoelastic.f90
index 2e7cbfb..c5554f3 100644
--- a/src/specfem3D/compute_stacey_viscoelastic.f90
+++ b/src/specfem3D/compute_stacey_viscoelastic.f90
@@ -172,10 +172,7 @@
   if( SIMULATION_TYPE == 1 .and. SAVE_FORWARD ) then
     ! writes out absorbing boundary value only when second phase is running
     if( phase_is_inner .eqv. .true. ) then
-      ! uses fortran routine
-      !write(IOABS,rec=it) b_reclen_field,b_absorb_field,b_reclen_field
-      ! uses c routine
-      call write_abs(0,b_absorb_field,b_reclen_field,it)
+      call write_abs(IOABS,b_absorb_field,b_reclen_field,it)
     endif
   endif
 
@@ -243,12 +240,7 @@
   ! reads in absorbing boundary array when first phase is running
   if( phase_is_inner .eqv. .false. ) then
     ! note: the index NSTEP-it+1 is valid if b_displ is read in after the Newmark scheme
-    ! uses fortran routine
-    !read(IOABS,rec=NSTEP-it+1) reclen1,b_absorb_field,reclen2
-    !if (reclen1 /= b_reclen_field .or. reclen1 /= reclen2) &
-    !  call exit_mpi(0,'Error reading absorbing contribution b_absorb_field')
-    ! uses c routine for faster reading
-    call read_abs(0,b_absorb_field,b_reclen_field,NSTEP-it+1)
+    call read_abs(IOABS,b_absorb_field,b_reclen_field,NSTEP-it+1)
   endif
 
   ! absorbs absorbing-boundary surface using Stacey condition (Clayton & Enquist)
@@ -376,12 +368,7 @@
     ! reads in absorbing boundary array when first phase is running
     if( phase_is_inner .eqv. .false. ) then
       ! note: the index NSTEP-it+1 is valid if b_displ is read in after the Newmark scheme
-      ! uses fortran routine
-      !read(IOABS,rec=NSTEP-it+1) reclen1,b_absorb_field,reclen2
-      !if (reclen1 /= b_reclen_field .or. reclen1 /= reclen2) &
-      !  call exit_mpi(0,'Error reading absorbing contribution b_absorb_field')
-      ! uses c routine for faster reading
-      call read_abs(0,b_absorb_field,b_reclen_field,NSTEP-it+1)
+      call read_abs(IOABS,b_absorb_field,b_reclen_field,NSTEP-it+1)
     endif
   endif !adjoint
 
@@ -391,10 +378,7 @@
   if (SIMULATION_TYPE == 1 .and. SAVE_FORWARD ) then
     ! writes out absorbing boundary value only when second phase is running
     if( phase_is_inner .eqv. .true. ) then
-      ! uses fortran routine
-      !write(IOABS,rec=it) b_reclen_field,b_absorb_field,b_reclen_field
-      ! uses c routine
-      call write_abs(0,b_absorb_field,b_reclen_field,it)
+      call write_abs(IOABS,b_absorb_field,b_reclen_field,it)
     endif
   endif
 
diff --git a/src/specfem3D/finalize_simulation.f90 b/src/specfem3D/finalize_simulation.f90
index 97599d5..fee94de 100644
--- a/src/specfem3D/finalize_simulation.f90
+++ b/src/specfem3D/finalize_simulation.f90
@@ -118,8 +118,8 @@
     if( num_abs_boundary_faces > 0 .and. (SIMULATION_TYPE == 3 .or. &
           (SIMULATION_TYPE == 1 .and. SAVE_FORWARD)) ) then
 
-      if( ELASTIC_SIMULATION) call close_file_abs(0) ! close(IOABS)
-      if( ACOUSTIC_SIMULATION) call close_file_abs(1) ! close(IOABS_AC)
+      if (ELASTIC_SIMULATION) call close_file_abs(IOABS)
+      if (ACOUSTIC_SIMULATION) call close_file_abs(IOABS_AC)
 
     endif
   endif
diff --git a/src/specfem3D/prepare_timerun.F90 b/src/specfem3D/prepare_timerun.F90
index d1d4346..bad0c76 100644
--- a/src/specfem3D/prepare_timerun.F90
+++ b/src/specfem3D/prepare_timerun.F90
@@ -954,29 +954,14 @@
 
         if (SIMULATION_TYPE == 3) then
           ! opens existing files
-
-          ! uses fortran routines for reading
-          !open(unit=IOABS,file=trim(prname)//'absorb_field.bin',status='old',&
-          !      action='read',form='unformatted',access='direct', &
-          !      recl=b_reclen_field+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening proc***_absorb_field.bin file')
-          ! uses c routines for faster reading
-          call open_file_abs_r(0,trim(prname)//'absorb_field.bin', &
+          call open_file_abs_r(IOABS,trim(prname)//'absorb_field.bin', &
                               len_trim(trim(prname)//'absorb_field.bin'), &
                               filesize)
-
         else
           ! opens new file
-          ! uses fortran routines for writing
-          !open(unit=IOABS,file=trim(prname)//'absorb_field.bin',status='unknown',&
-          !      form='unformatted',access='direct',&
-          !      recl=b_reclen_field+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening proc***_absorb_field.bin file')
-          ! uses c routines for faster writing (file index 0 for acoutic domain file)
-          call open_file_abs_w(0,trim(prname)//'absorb_field.bin', &
+          call open_file_abs_w(IOABS,trim(prname)//'absorb_field.bin', &
                               len_trim(trim(prname)//'absorb_field.bin'), &
                               filesize)
-
         endif
       endif
 
@@ -1011,29 +996,14 @@
 
         if (SIMULATION_TYPE == 3) then
           ! opens existing files
-          ! uses fortran routines for reading
-          !open(unit=IOABS_AC,file=trim(prname)//'absorb_potential.bin',status='old',&
-          !      action='read',form='unformatted',access='direct', &
-          !      recl=b_reclen_potential+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening proc***_absorb_potential.bin file')
-
-          ! uses c routines for faster reading
-          call open_file_abs_r(1,trim(prname)//'absorb_potential.bin', &
+          call open_file_abs_r(IOABS_AC,trim(prname)//'absorb_potential.bin', &
                               len_trim(trim(prname)//'absorb_potential.bin'), &
                               filesize)
-
         else
           ! opens new file
-          ! uses fortran routines for writing
-          !open(unit=IOABS_AC,file=trim(prname)//'absorb_potential.bin',status='unknown',&
-          !      form='unformatted',access='direct',&
-          !      recl=b_reclen_potential+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening proc***_absorb_potential.bin file')
-          ! uses c routines for faster writing (file index 1 for acoutic domain file)
-          call open_file_abs_w(1,trim(prname)//'absorb_potential.bin', &
+          call open_file_abs_w(IOABS_AC,trim(prname)//'absorb_potential.bin', &
                               len_trim(trim(prname)//'absorb_potential.bin'), &
                               filesize)
-
         endif
       endif
 
@@ -1062,38 +1032,20 @@
 
         if (SIMULATION_TYPE == 3) then
           ! opens existing files
-
-          ! uses fortran routines for reading
-          !open(unit=IOABS,file=trim(prname)//'absorb_field.bin',status='old',&
-          !      action='read',form='unformatted',access='direct', &
-          !      recl=b_reclen_field+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening
-          !proc***_absorb_field.bin file')
-          ! uses c routines for faster reading
-          call open_file_abs_r(0,trim(prname)//'absorb_fields.bin', &
+          call open_file_abs_r(IOABS,trim(prname)//'absorb_fields.bin', &
                               len_trim(trim(prname)//'absorb_fields.bin'), &
                               filesize)
-          call open_file_abs_r(0,trim(prname)//'absorb_fieldw.bin', &
+          call open_file_abs_r(IOABS,trim(prname)//'absorb_fieldw.bin', &
                               len_trim(trim(prname)//'absorb_fieldw.bin'), &
                               filesize)
-
         else
           ! opens new file
-          ! uses fortran routines for writing
-          !open(unit=IOABS,file=trim(prname)//'absorb_field.bin',status='unknown',&
-          !      form='unformatted',access='direct',&
-          !      recl=b_reclen_field+2*4,iostat=ier )
-          !if( ier /= 0 ) call exit_mpi(myrank,'error opening
-          !proc***_absorb_field.bin file')
-          ! uses c routines for faster writing (file index 0 for acoutic domain
-          ! file)
-          call open_file_abs_w(0,trim(prname)//'absorb_fields.bin', &
+          call open_file_abs_w(IOABS,trim(prname)//'absorb_fields.bin', &
                               len_trim(trim(prname)//'absorb_fields.bin'), &
                               filesize)
-          call open_file_abs_w(0,trim(prname)//'absorb_fieldw.bin', &
+          call open_file_abs_w(IOABS,trim(prname)//'absorb_fieldw.bin', &
                               len_trim(trim(prname)//'absorb_fieldw.bin'), &
                               filesize)
-
         endif
       endif
     else



More information about the CIG-COMMITS mailing list