Skip to content

Commit

Permalink
code cleaning and compiler warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Nov 6, 2024
1 parent 1a978a5 commit 0cf3984
Show file tree
Hide file tree
Showing 12 changed files with 678 additions and 264 deletions.
93 changes: 73 additions & 20 deletions src/meshfem3D/save_arrays_solver_hdf5.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
!=====================================================================
!
! S p e c f e m 3 D G l o b e
! ----------------------------
!
! Main historical authors: Dimitri Komatitsch and Jeroen Tromp
! Princeton University, USA
! and CNRS / University of Marseille, France
! (there are currently many more authors!)
! (c) Princeton University and CNRS / University of Marseille, April 2014
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License along
! with this program; if not, write to the Free Software Foundation, Inc.,
! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
!
!=====================================================================


subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
NSPEC2D_TOP,NSPEC2D_BOTTOM)

Expand Down Expand Up @@ -37,8 +65,6 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
tau_s_store,tau_e_store,Qmu_store, &
nglob_oceans, nglob_xy



use manager_hdf5
#endif

Expand Down Expand Up @@ -125,7 +151,7 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
!
if (myrank == 0) then
! create and open solver_data.h5
name_database_hdf5 = LOCAL_PATH(1:len_trim(LOCAL_PATH))//'/'//'solver_data.h5'
name_database_hdf5 = LOCAL_PATH(1:len_trim(LOCAL_PATH)) // '/' // 'solver_data.h5'
if (iregion_code == 1) then
call h5_create_file(name_database_hdf5)
else
Expand Down Expand Up @@ -608,6 +634,16 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
#else
! no HDF5 compilation

! to avoid compiler warnings
integer :: idummy

idummy = size(idoubling,kind=4)
idummy = size(ibool,kind=4)
idummy = size(xstore,kind=4)
idummy = size(ystore,kind=4)
idummy = size(zstore,kind=4)
idummy = max(NSPEC2D_TOP,NSPEC2D_BOTTOM)

! user output
print *
print *, "Error: HDF5 routine save_databases_hdf5() called without HDF5 Support."
Expand All @@ -617,7 +653,7 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &

#endif

end subroutine save_arrays_solver_hdf5
end subroutine save_arrays_solver_hdf5

!
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -672,9 +708,6 @@ subroutine save_arrays_boundary_hdf5()
! processor dependent group names
character(len=64) :: gname_region

! process rank
myrank = myrank

! first check the number of surface elements are the same for Moho, 400, 670
if (.not. SUPPRESS_CRUSTAL_MESH .and. HONOR_1D_SPHERICAL_MOHO) then
if (ispec2D_moho_top /= NSPEC2D_MOHO .or. ispec2D_moho_bot /= NSPEC2D_MOHO) &
Expand Down Expand Up @@ -794,7 +827,7 @@ subroutine save_arrays_boundary_hdf5()
stop 'Error HDF5 save_databases_hdf5(): called without compilation support'
#endif

end subroutine save_arrays_boundary_hdf5
end subroutine save_arrays_boundary_hdf5

!
!-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -853,8 +886,6 @@ subroutine save_MPI_arrays_hdf5(iregion_code,LOCAL_PATH, &
integer, dimension(0:NPROCTOT-1) :: offset_num_colors_outer
integer, dimension(0:NPROCTOT-1) :: offset_num_colors_inner

myrank = myrank

! gather the offsets
call gather_all_all_singlei(num_interfaces, offset_num_interfaces, NPROCTOT)
call gather_all_all_singlei(max_nibool_interfaces, offset_max_nibool_interfaces, NPROCTOT)
Expand Down Expand Up @@ -990,13 +1021,29 @@ subroutine save_MPI_arrays_hdf5(iregion_code,LOCAL_PATH, &

#else
! no HDF5 compilation
print* , "Error: HDF5 routine save_MPI_arrays_hdf5() called without HDF5 Support."
print* , "To enable HDF5 support, reconfigure with --with-hdf5 flag."

! to avoid compiler warnings
integer :: idummy

idummy = iregion_code
idummy = len_trim(LOCAL_PATH)
idummy = size(ibool_interfaces,kind=4)
idummy = size(my_neighbors,kind=4)
idummy = size(nibool_interfaces,kind=4)
idummy = max(nspec_inner,nspec_outer)
idummy = size(num_elem_colors)
idummy = size(phase_ispec_inner)

print * , "Error: HDF5 routine save_MPI_arrays_hdf5() called without HDF5 Support."
print * , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 save_MPI_arrays_hdf5(): called without compilation support'
#endif

end subroutine save_MPI_arrays_hdf5

!
!-------------------------------------------------------------------------------------------------
!

subroutine get_absorb_stacey_boundary_hdf5(iregion, num_abs_boundary_faces, &
abs_boundary_ispec,abs_boundary_npoin, &
Expand Down Expand Up @@ -1139,15 +1186,21 @@ subroutine get_absorb_stacey_boundary_hdf5(iregion, num_abs_boundary_faces, &
call h5_close_file_p()

#else
! no HDF5 compilation
print* , "Error: HDF5 routine get_absorb_stacey_boundary_hdf5() called without HDF5 Support."
print* , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 get_absorb_stacey_boundary_hdf5(): called without compilation support'
#endif


! no HDF5 compilation

! to avoid compiler warnings
integer :: idummy

idummy = iregion
idummy = size(abs_boundary_ispec,kind=4)
idummy = size(abs_boundary_npoin)
idummy = size(abs_boundary_ijk)
idummy = size(abs_boundary_normal,kind=4)
idummy = size(abs_boundary_jacobian2dw,kind=4)

print * , "Error: HDF5 routine get_absorb_stacey_boundary_hdf5() called without HDF5 Support."
print * , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 get_absorb_stacey_boundary_hdf5(): called without compilation support'
#endif

end subroutine get_absorb_stacey_boundary_hdf5
end subroutine get_absorb_stacey_boundary_hdf5
11 changes: 5 additions & 6 deletions src/meshfem3D/save_model_meshfiles_hdf5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ subroutine save_model_meshfiles_hdf5()
do j = 1,NGLLY
do i = 1,NGLLX
temp_store(i,j,k,ispec) = Qmu_store(1,1,1,ispec)
end do
end do
end do
end do
enddo
enddo
enddo
enddo
endif

! Qmu
Expand Down Expand Up @@ -273,5 +273,4 @@ subroutine save_model_meshfiles_hdf5()

#endif


end subroutine save_model_meshfiles_hdf5
end subroutine save_model_meshfiles_hdf5
1 change: 1 addition & 0 deletions src/shared/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ shared_OBJECTS = \
shared_MODULES = \
$(FC_MODDIR)/constants.$(FC_MODEXT) \
$(FC_MODDIR)/manager_adios.$(FC_MODEXT) \
$(FC_MODDIR)/manager_hdf5.$(FC_MODEXT) \
$(FC_MODDIR)/model_prem_par.$(FC_MODEXT) \
$(FC_MODDIR)/model_sohl_par.$(FC_MODEXT) \
$(FC_MODDIR)/model_mars_1d_par.$(FC_MODEXT) \
Expand Down
6 changes: 3 additions & 3 deletions src/specfem3D/locate_point.f90
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,13 @@ subroutine find_local_coordinates(x_target,y_target,z_target,xi,eta,gamma,x,y,z,
! the polynomial solution is defined everywhere
! can be useful for convergence of iterative scheme with distorted elements
!if (xi > 1.10d0) xi = 1.10d0
!if (xi < -1.10d0) xi = -1.10d0
!if (xi <-1.10d0) xi = -1.10d0
if (abs(xi) > 1.10d0) xi = sign(1.10d0,xi)
!if (eta > 1.10d0) eta = 1.10d0
!if (eta < -1.10d0) eta = -1.10d0
!if (eta <-1.10d0) eta = -1.10d0
if (abs(eta) > 1.10d0) eta = sign(1.10d0,eta)
!if (gamma > 1.10d0) gamma = 1.10d0
!if (gamma < -1.10d0) gamma = -1.10d0
!if (gamma <-1.10d0) gamma = -1.10d0
if (abs(gamma) > 1.10d0) gamma = sign(1.10d0,gamma)

! end of non linear iterations
Expand Down
2 changes: 1 addition & 1 deletion src/specfem3D/prepare_movie.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ subroutine prepare_movie_surface()
nmovie_points = NGLLX * NGLLY * NSPEC2D_TOP(IREGION_CRUST_MANTLE)
else ! HDF5
nmovie_points = 4 * (NGLLX-1) * (NGLLY-1) * NSPEC2D_TOP(IREGION_CRUST_MANTLE)
end if
endif
NIT = 1
endif

Expand Down
Loading

0 comments on commit 0cf3984

Please sign in to comment.