[cig-commits] [commit] devel, master: Fix some set-but-unused variables. (d4ead38)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 6 08:30:53 PST 2014


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

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/bc58e579b3b0838a0968725a076f5904845437ca...be63f20cbb6f462104e949894dbe205d2398cd7f

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

commit d4ead38ca726d84ea6686349c443e2a1b5bc628a
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Thu Sep 11 02:32:48 2014 -0400

    Fix some set-but-unused variables.
    
    In some cases, this involved removing the assignments. Others were
    changing code to make use of the variables. Some cases I did not change,
    since it appeared the unused assignments had value to give context to
    other parts.


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

d4ead38ca726d84ea6686349c443e2a1b5bc628a
 src/auxiliaries/combine_vol_data.F90        |  3 ---
 src/auxiliaries/create_movie_GMT_global.f90 |  4 ----
 src/meshfem3D/create_chunk_buffers.f90      |  1 -
 src/meshfem3D/create_mass_matrices.f90      |  3 ---
 src/meshfem3D/create_regions_mesh.F90       |  6 +++---
 src/meshfem3D/model_aniso_inner_core.f90    |  3 +++
 src/meshfem3D/model_aniso_mantle.f90        |  6 +-----
 src/meshfem3D/model_attenuation.f90         |  5 +----
 src/meshfem3D/model_ppm.f90                 |  1 -
 src/meshfem3D/setup_color_perm.f90          |  4 +---
 src/meshfem3D/test_MPI_interfaces.f90       | 27 ++++++++++++---------------
 src/shared/binary_c_io.c                    |  2 --
 src/shared/make_gravity.f90                 |  6 +++---
 src/shared/memory_eval.f90                  |  3 +--
 src/shared/read_compute_parameters.f90      |  3 ---
 src/shared/save_header_file.F90             |  4 +---
 src/specfem3D/get_backazimuth.f90           |  3 +--
 src/specfem3D/noise_tomography.f90          |  2 ++
 src/specfem3D/save_kernels.f90              |  2 --
 src/specfem3D/save_regular_kernels.f90      |  2 --
 src/specfem3D/write_movie_surface.f90       |  3 +--
 src/specfem3D/write_output_SAC.f90          |  2 +-
 22 files changed, 31 insertions(+), 64 deletions(-)

diff --git a/src/auxiliaries/combine_vol_data.F90 b/src/auxiliaries/combine_vol_data.F90
index fa83f47..19636fe 100644
--- a/src/auxiliaries/combine_vol_data.F90
+++ b/src/auxiliaries/combine_vol_data.F90
@@ -112,9 +112,6 @@ program combine_vol_data
 
   ! starts here---------------------------------------------------------------
 
-  ! dummy initialization to avoid compiler warnings
-  ier = 0
-
   ! ADIOS mpi initialization
 #ifdef ADIOS_INPUT
   ! starts mpi
diff --git a/src/auxiliaries/create_movie_GMT_global.f90 b/src/auxiliaries/create_movie_GMT_global.f90
index 1095e6a..62e1ac0 100644
--- a/src/auxiliaries/create_movie_GMT_global.f90
+++ b/src/auxiliaries/create_movie_GMT_global.f90
@@ -847,10 +847,6 @@
     ! read points for all the slices
     print *,'Writing output',outputname
     do iproc = 0,NPROCTOT-1
-
-      ! reset point number
-      ipoin = 0
-
       do ispecloc = 1,NEX_PER_PROC_XI*NEX_PER_PROC_ETA
         ispec = ispec + 1
         if (MOVIE_COARSE) then
diff --git a/src/meshfem3D/create_chunk_buffers.f90 b/src/meshfem3D/create_chunk_buffers.f90
index 79b3742..873b15c 100644
--- a/src/meshfem3D/create_chunk_buffers.f90
+++ b/src/meshfem3D/create_chunk_buffers.f90
@@ -273,7 +273,6 @@
   iproc_edge_send = 0
   iproc_edge_receive = 0
 
-  iedge = 0
   ichunk_receive = 0
   ichunk_send = 0
 
diff --git a/src/meshfem3D/create_mass_matrices.f90 b/src/meshfem3D/create_mass_matrices.f90
index 3349053..7baa2df 100644
--- a/src/meshfem3D/create_mass_matrices.f90
+++ b/src/meshfem3D/create_mass_matrices.f90
@@ -256,12 +256,9 @@
   deltat = real(DT*dsqrt(PI*GRAV*RHOAV), kind=CUSTOM_REAL)
 
   scale_t_inv = real(dsqrt(PI*GRAV*RHOAV), kind=CUSTOM_REAL)
-  two_omega_earth_dt = 0._CUSTOM_REAL
-  b_two_omega_earth_dt = 0._CUSTOM_REAL
 
   ! distinguish between single and double precision for reals
   two_omega_earth_dt = real(2.d0 * TWO_PI / (HOURS_PER_DAY * SECONDS_PER_HOUR * scale_t_inv) * deltat, kind=CUSTOM_REAL)
-
   b_two_omega_earth_dt = - real(2.d0 * TWO_PI / (HOURS_PER_DAY * SECONDS_PER_HOUR * scale_t_inv) * deltat, kind=CUSTOM_REAL)
 
   ! definition depends if region is fluid or solid
diff --git a/src/meshfem3D/create_regions_mesh.F90 b/src/meshfem3D/create_regions_mesh.F90
index 6884e6a..9bc3d28 100644
--- a/src/meshfem3D/create_regions_mesh.F90
+++ b/src/meshfem3D/create_regions_mesh.F90
@@ -956,14 +956,14 @@
   integer :: ner_without_doubling,ilayer,ilayer_loop
   ! timing
   double precision, external :: wtime
-  double precision :: time_start,tCPU
+  !double precision :: time_start,tCPU
   integer,dimension(8) :: tval
 
   ! initializes flags for transverse isotropic elements
   ispec_is_tiso(:) = .false.
 
   ! get MPI starting time
-  time_start = wtime()
+  !time_start = wtime()
 
   ! loop on all the layers in this region of the mesh
   ispec = 0 ! counts all the elements in this region of the mesh
@@ -1065,7 +1065,7 @@
     ! user output
     if (myrank == 0) then
       ! time estimate
-      tCPU = wtime() - time_start
+      !tCPU = wtime() - time_start
 
       ! outputs current time on system
       call date_and_time(VALUES=tval)
diff --git a/src/meshfem3D/model_aniso_inner_core.f90 b/src/meshfem3D/model_aniso_inner_core.f90
index e541cb6..009c6bf 100644
--- a/src/meshfem3D/model_aniso_inner_core.f90
+++ b/src/meshfem3D/model_aniso_inner_core.f90
@@ -178,6 +178,9 @@
 !        c13 = c12 - gamma*A0
 !        and c12 = c11 - 2*c66
 !
+! Note: The value vs0, while set above, is unnecessary for the
+! calculation below.
+!
 ! Steinle-Neumann (2002):
 !
 !  r    T    rho    c11   c12  c13  c33  c44 KS   mu
diff --git a/src/meshfem3D/model_aniso_mantle.f90 b/src/meshfem3D/model_aniso_mantle.f90
index a16812c..712795f 100644
--- a/src/meshfem3D/model_aniso_mantle.f90
+++ b/src/meshfem3D/model_aniso_mantle.f90
@@ -173,9 +173,6 @@
 ! dimensionalize
   depth = R_EARTH_KM*(R_UNIT_SPHERE - r)
   if (depth <= pro(nz0) .or. depth >= pro(1)) call exit_MPI_without_rank('r out of range in build_cij')
-!! DK DK  itheta = int(theta + pxy0)/pxy0
-!! DK DK  ilon = int(phi + pxy0)/pxy0
-!! DK DK fixed that because the above contained an automatic conversion from real to int
   itheta = int(int(theta + pxy0)/pxy0)
   ilon = int(int(phi + pxy0)/pxy0)
   tet = theta
@@ -547,7 +544,7 @@
 ! array par(i,nlayer)
 ! output: array pari(ipar, nlayer): rho, A, L, xi-1, phi-1, eta-1
 
-  integer i,j,k,ip,ifanis,idum1,idum2,idum3,nlayer,nout,neff,&
+  integer i,j,k,ip,idum1,idum2,idum3,nlayer,nout,neff,&
           nband,nri,minlay,moho,kiti
   double precision pari(14,47),qkappa(47),qshear(47),par(6,47)
   double precision epa(14,47),ra(47),dcori(47),ri(47)
@@ -556,7 +553,6 @@
   character(len=80) nullval
   character(len=150), parameter :: Adrem119 = 'DATA/Montagner_model/Adrem119'
 
-     ifanis = 1
      nri = 47
 
      open(unit=13,file=Adrem119,status='old',action='read')
diff --git a/src/meshfem3D/model_attenuation.f90 b/src/meshfem3D/model_attenuation.f90
index e56af78..36b9722 100644
--- a/src/meshfem3D/model_attenuation.f90
+++ b/src/meshfem3D/model_attenuation.f90
@@ -240,13 +240,10 @@
 
   ! local parameters
   double precision :: tau_e(N_SLS)
-  double precision :: Qb
-  double precision :: R120
   integer :: i,ier
 
   ! parameter definitions
-  Qb = 57287.0d0
-  R120 = 6251.d3 ! as defined by IASP91
+  double precision, parameter :: R120 = 6251.d3 ! as defined by IASP91
 
   ! uses "pure" 1D models including their 1D-crust profiles
   ! (uses USE_EXTERNAL_CRUSTAL_MODEL set to false)
diff --git a/src/meshfem3D/model_ppm.f90 b/src/meshfem3D/model_ppm.f90
index cfb6935..4cdbf1b 100644
--- a/src/meshfem3D/model_ppm.f90
+++ b/src/meshfem3D/model_ppm.f90
@@ -1076,7 +1076,6 @@
   ! local parameters
   integer :: ii,jj,kk
   real(kind=CUSTOM_REAL) :: dist_h,dist_v
-  !real(kind=CUSTOM_REAL) :: r0,r1,theta1
 
   ! >>>>>
   ! uniform sigma
diff --git a/src/meshfem3D/setup_color_perm.f90 b/src/meshfem3D/setup_color_perm.f90
index 00cf58c..5abf9a4 100644
--- a/src/meshfem3D/setup_color_perm.f90
+++ b/src/meshfem3D/setup_color_perm.f90
@@ -509,8 +509,6 @@
   end select
 
   ! sets up elements for loops in simulations
-  ispec_inner = 0
-  ispec_outer = 0
   do ispec = 1, nspec
     ! only elements in this domain
     if (ispec_is_d(ispec)) then
@@ -523,7 +521,7 @@
         ! checks
         if (ispec_outer < 1 .or. ispec_outer > num_phase_ispec_d) then
           print*,'Error outer permutation:',idomain
-          print*,'rank:',myrank,'  ispec_inner = ',ispec_outer
+          print*,'rank:',myrank,'  ispec_outer = ',ispec_outer
           print*,'num_phase_ispec_d = ',num_phase_ispec_d
           call exit_MPI(myrank,'Error outer permutation')
         endif
diff --git a/src/meshfem3D/test_MPI_interfaces.f90 b/src/meshfem3D/test_MPI_interfaces.f90
index 10a2fc6..6ec4597 100644
--- a/src/meshfem3D/test_MPI_interfaces.f90
+++ b/src/meshfem3D/test_MPI_interfaces.f90
@@ -247,8 +247,8 @@
   ! local parameters
   real(kind=CUSTOM_REAL),dimension(:,:),allocatable :: test_flag_vector
   integer :: i,j,iglob,ier
-  integer :: inum,icount,ival
-  integer :: num_unique,num_max_valence
+  integer :: inum,icount
+  integer :: num_unique,max_valence
   integer,dimension(:),allocatable :: valence
 
   ! crust mantle
@@ -280,14 +280,13 @@
 
   ! maximum valence
   i = maxval( valence(:) )
-  num_max_valence = i
-  call max_all_i(i,ival)
+  call max_all_i(i,max_valence)
 
   ! user output
   if (myrank == 0) then
     write(IMAIN,*) '  total MPI interface points : ',inum
     write(IMAIN,*) '  unique MPI interface points: ',icount
-    write(IMAIN,*) '  maximum valence            : ',ival
+    write(IMAIN,*) '  maximum valence            : ',max_valence
     call flush_IMAIN()
   endif
 
@@ -364,8 +363,8 @@
   ! local parameters
   real(kind=CUSTOM_REAL),dimension(:),allocatable :: test_flag
   integer :: i,j,iglob,ier
-  integer :: inum,icount,ival
-  integer :: num_max_valence,num_unique
+  integer :: inum,icount
+  integer :: max_valence,num_unique
   integer,dimension(:),allocatable :: valence
 
   ! outer core
@@ -394,13 +393,12 @@
 
   ! maximum valence
   i = maxval( valence(:) )
-  num_max_valence = i
-  call max_all_i(i,ival)
+  call max_all_i(i,max_valence)
 
   if (myrank == 0) then
     write(IMAIN,*) '  total MPI interface points : ',inum
     write(IMAIN,*) '  unique MPI interface points: ',icount
-    write(IMAIN,*) '  maximum valence            : ',ival
+    write(IMAIN,*) '  maximum valence            : ',max_valence
   endif
 
   ! initialized for assembly
@@ -474,8 +472,8 @@
   ! local parameters
   real(kind=CUSTOM_REAL),dimension(:,:),allocatable :: test_flag_vector
   integer :: i,j,iglob,ier
-  integer :: inum,icount,ival
-  integer :: num_unique,num_max_valence
+  integer :: inum,icount
+  integer :: num_unique,max_valence
   integer,dimension(:),allocatable :: valence
 
   ! inner core
@@ -505,13 +503,12 @@
 
   ! maximum valence
   i = maxval( valence(:) )
-  num_max_valence = i
-  call max_all_i(i,ival)
+  call max_all_i(i,max_valence)
 
   if (myrank == 0) then
     write(IMAIN,*) '  total MPI interface points : ',inum
     write(IMAIN,*) '  unique MPI interface points: ',icount
-    write(IMAIN,*) '  maximum valence            : ',ival
+    write(IMAIN,*) '  maximum valence            : ',max_valence
   endif
 
   ! initializes for assembly
diff --git a/src/shared/binary_c_io.c b/src/shared/binary_c_io.c
index c01ee90..93a67ad 100644
--- a/src/shared/binary_c_io.c
+++ b/src/shared/binary_c_io.c
@@ -261,7 +261,6 @@ void write_abs_fbin(int *fid, char *buffer, int *length, int *index) {
 
   donelen = 0;
   remlen = *length;
-  ret = 0;
 
   // writes items of maximum MAX_B to the file
   while (remlen > 0) {
@@ -300,7 +299,6 @@ void read_abs_fbin(int *fid, char *buffer, int *length, int *index) {
 
   donelen = 0;
   remlen = *length;
-  ret = 0;
 
   // reads items of maximum MAX_B to the file
   while (remlen > 0) {
diff --git a/src/shared/make_gravity.f90 b/src/shared/make_gravity.f90
index 1651227..650bd21 100644
--- a/src/shared/make_gravity.f90
+++ b/src/shared/make_gravity.f90
@@ -55,7 +55,7 @@
   double precision yp1,ypn
 
 ! PREM
-  ROCEAN = 6368000.d0
+  ROCEAN = ROCEAN_GRAVITY ! PREM defines this as 6368000.d0
   RMIDDLE_CRUST = 6356000.d0
   RMOHO = 6346600.d0 ! PREM moho depth at 24.4 km
   R80  = 6291000.d0
@@ -80,7 +80,7 @@
   r_80 = R80/R_EARTH_GRAVITY
   r_moho = RMOHO/R_EARTH_GRAVITY
   r_middle_crust = RMIDDLE_CRUST/R_EARTH_GRAVITY
-  r_ocean = ROCEAN_GRAVITY/R_EARTH_GRAVITY
+  r_ocean = ROCEAN/R_EARTH_GRAVITY
   r_0 = 1.d0
 
   do i=1,163
@@ -126,7 +126,7 @@
 ! use PREM to get the density profile for ellipticity (fine for other 1D reference models)
   do i = 1,NR
     call prem_density(r(i),rho(i),ONE_CRUST,RICB,RCMB,RTOPDDOUBLEPRIME, &
-      R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN_GRAVITY)
+      R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN)
   enddo
 
   g(1)=0.0d0
diff --git a/src/shared/memory_eval.f90 b/src/shared/memory_eval.f90
index 8eec821..133aa13 100644
--- a/src/shared/memory_eval.f90
+++ b/src/shared/memory_eval.f90
@@ -515,13 +515,12 @@
   !
   ! if absorbing_conditions are not set or if NCHUNKS=6, only one mass matrix is needed
   ! for the sake of performance, only "rmassz" array will be filled and "rmassx" & "rmassy" will be fictitious / unused
-  NGLOB_XY_CM = 1
-  NGLOB_XY_IC = 1
   if (NCHUNKS /= 6 .and. ABSORBING_CONDITIONS) then
      NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
   else
      NGLOB_XY_CM = 1
   endif
+  NGLOB_XY_IC = 1
 
   if (ROTATION .and. EXACT_MASS_MATRIX_FOR_ROTATION) then
     NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
diff --git a/src/shared/read_compute_parameters.f90 b/src/shared/read_compute_parameters.f90
index 8b6257a..b7d1fc4 100644
--- a/src/shared/read_compute_parameters.f90
+++ b/src/shared/read_compute_parameters.f90
@@ -40,7 +40,6 @@
 
   ! local parameters
   integer :: NEX_MAX
-  double precision :: ELEMENT_WIDTH
   integer :: nblocks_xi,nblocks_eta
   ! doubling layers
   integer :: ielem,elem_doubling_mantle,elem_doubling_middle_outer_core,elem_doubling_bottom_outer_core
@@ -160,8 +159,6 @@
     if (mod(NEX_ETA/32,NPROC_ETA) /= 0) CUT_SUPERBRICK_ETA = .true.
   endif
 
-  ELEMENT_WIDTH = ANGULAR_WIDTH_XI_IN_DEGREES/dble(NEX_MAX) * DEGREES_TO_RADIANS
-
 !
 !--- compute additional parameters
 !
diff --git a/src/shared/save_header_file.F90 b/src/shared/save_header_file.F90
index a9d9c34..448c704 100644
--- a/src/shared/save_header_file.F90
+++ b/src/shared/save_header_file.F90
@@ -728,14 +728,12 @@
   ! if absorbing_conditions are not set or if NCHUNKS=6, only one mass matrix is needed
   ! for the sake of performance, only "rmassz" array will be filled and "rmassx" & "rmassy" will be fictitious / unused
 
-  NGLOB_XY_CM = 1
-  NGLOB_XY_IC = 1
-
   if (NCHUNKS /= 6 .and. ABSORBING_CONDITIONS) then
      NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
   else
      NGLOB_XY_CM = 1
   endif
+  NGLOB_XY_IC = 1
 
   if (ROTATION .and. EXACT_MASS_MATRIX_FOR_ROTATION) then
     NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
diff --git a/src/specfem3D/get_backazimuth.f90 b/src/specfem3D/get_backazimuth.f90
index 39f6070..0604688 100644
--- a/src/specfem3D/get_backazimuth.f90
+++ b/src/specfem3D/get_backazimuth.f90
@@ -38,7 +38,7 @@
 
   double precision a, a1, b, b1, c, c1
   double precision d, d1, e, e1
-  double precision ec2, eps, f, f1, g, g1, h, h1, onemec2, pherad
+  double precision ec2, f, f1, g, g1, h, h1, onemec2, pherad
   double precision phsrad, sc, sd, ss
   double precision temp, therad, thg, thsrad
 
@@ -98,7 +98,6 @@
 
   ec2 = 2.*fl - fl*fl
   onemec2 = 1. - ec2
-  eps = 1. + ec2/onemec2
 
   ! - Convert event location to radians.
   !   (Equations are unstable for latitudes of exactly 0 degrees.)
diff --git a/src/specfem3D/noise_tomography.f90 b/src/specfem3D/noise_tomography.f90
index 54c6c15..04f17b9 100644
--- a/src/specfem3D/noise_tomography.f90
+++ b/src/specfem3D/noise_tomography.f90
@@ -99,6 +99,8 @@
   if (ios /= 0) &
     call exit_MPI(myrank, 'file '//trim(filename)//' does NOT exist! This file contains the ID of the master receiver')
   read(IIN_NOISE,*,iostat=ios) irec_master_noise
+  if (ios /= 0) &
+    call exit_MPI(myrank, 'Unable to read the ID of the master receiver from '//trim(filename))
   close(IIN_NOISE)
 
   if (myrank == 0) then
diff --git a/src/specfem3D/save_kernels.f90 b/src/specfem3D/save_kernels.f90
index 39bb7f7..75b3b18 100644
--- a/src/specfem3D/save_kernels.f90
+++ b/src/specfem3D/save_kernels.f90
@@ -212,8 +212,6 @@
                 kappal = kappavstore_crust_mantle(i,j,k,ispec)
                 muvl = mul
                 muhl = mul
-                kappavl = kappal
-                kappahl = kappal
 
                 A = kappal + FOUR_THIRDS * mul
                 C = A
diff --git a/src/specfem3D/save_regular_kernels.f90 b/src/specfem3D/save_regular_kernels.f90
index 371a849..e0d8958 100644
--- a/src/specfem3D/save_regular_kernels.f90
+++ b/src/specfem3D/save_regular_kernels.f90
@@ -172,8 +172,6 @@
                 kappal = kappavstore_crust_mantle(i,j,k,ispec)
                 muvl = mul
                 muhl = mul
-                kappavl = kappal
-                kappahl = kappal
 
                 A = kappal + FOUR_THIRDS * mul
                 C = A
diff --git a/src/specfem3D/write_movie_surface.f90 b/src/specfem3D/write_movie_surface.f90
index 5ff83fa..53694c5 100644
--- a/src/specfem3D/write_movie_surface.f90
+++ b/src/specfem3D/write_movie_surface.f90
@@ -35,12 +35,11 @@
   implicit none
 
   ! local parameters
-  integer :: ipoin,ispec2D,i,j,k,npoin
+  integer :: ipoin,ispec2D,i,j,npoin
 
   ! gets number of points on surface mesh
   ipoin = 0
   do ispec2D = 1, NSPEC_TOP ! NSPEC2D_TOP(IREGION_CRUST_MANTLE)
-    k = NGLLZ
     ! loop on all the points inside the element
     do j = 1,NGLLY,NIT
       do i = 1,NGLLX,NIT
diff --git a/src/specfem3D/write_output_SAC.f90 b/src/specfem3D/write_output_SAC.f90
index 6accdca..48424b9 100644
--- a/src/specfem3D/write_output_SAC.f90
+++ b/src/specfem3D/write_output_SAC.f90
@@ -570,7 +570,7 @@
       call write_integer(int(undef))     !(91)ISTREG
       call write_integer(int(undef))     !(92)IEVREG
       call write_integer(IEVTYP)        !(93)
-      call write_integer(int(undef))     !(94)IQUAL
+      call write_integer(IQUAL)         !(94)
       call write_integer(ISYNTH)        !(95)
       call write_integer(IMAGTYP)       !(96)
       call write_integer(int(undef))     !(97)IMAGSRC



More information about the CIG-COMMITS mailing list