From 0cf39840303a815610706f03172ea1b7db2f43ec Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 6 Nov 2024 16:22:10 +0100 Subject: [PATCH] code cleaning and compiler warning fixes --- src/meshfem3D/save_arrays_solver_hdf5.F90 | 93 +++++-- src/meshfem3D/save_model_meshfiles_hdf5.F90 | 11 +- src/shared/rules.mk | 1 + src/specfem3D/locate_point.f90 | 6 +- src/specfem3D/prepare_movie.f90 | 2 +- src/specfem3D/read_arrays_solver_hdf5.F90 | 260 +++++++++++++----- src/specfem3D/read_forward_arrays_hdf5.F90 | 74 +++--- src/specfem3D/save_forward_arrays_hdf5.F90 | 40 ++- src/specfem3D/save_kernels_hdf5.F90 | 74 +++++- src/specfem3D/write_movie_volume_hdf5.F90 | 275 +++++++++++++++----- src/specfem3D/write_output_HDF5.F90 | 104 +++++--- src/specfem3D/write_seismograms.f90 | 2 + 12 files changed, 678 insertions(+), 264 deletions(-) diff --git a/src/meshfem3D/save_arrays_solver_hdf5.F90 b/src/meshfem3D/save_arrays_solver_hdf5.F90 index d7a6d9faf..422f2a2d4 100644 --- a/src/meshfem3D/save_arrays_solver_hdf5.F90 +++ b/src/meshfem3D/save_arrays_solver_hdf5.F90 @@ -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) @@ -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 @@ -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 @@ -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." @@ -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 ! !----------------------------------------------------------------------- @@ -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) & @@ -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 ! !------------------------------------------------------------------------------------------------- @@ -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) @@ -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, & @@ -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 diff --git a/src/meshfem3D/save_model_meshfiles_hdf5.F90 b/src/meshfem3D/save_model_meshfiles_hdf5.F90 index 399253cbf..e33510d5b 100644 --- a/src/meshfem3D/save_model_meshfiles_hdf5.F90 +++ b/src/meshfem3D/save_model_meshfiles_hdf5.F90 @@ -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 @@ -273,5 +273,4 @@ subroutine save_model_meshfiles_hdf5() #endif - -end subroutine save_model_meshfiles_hdf5 + end subroutine save_model_meshfiles_hdf5 diff --git a/src/shared/rules.mk b/src/shared/rules.mk index 1a6a2dab3..67ac579e6 100644 --- a/src/shared/rules.mk +++ b/src/shared/rules.mk @@ -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) \ diff --git a/src/specfem3D/locate_point.f90 b/src/specfem3D/locate_point.f90 index af7b1f175..4fed6479a 100644 --- a/src/specfem3D/locate_point.f90 +++ b/src/specfem3D/locate_point.f90 @@ -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 diff --git a/src/specfem3D/prepare_movie.f90 b/src/specfem3D/prepare_movie.f90 index 32b05a546..a63d998ff 100644 --- a/src/specfem3D/prepare_movie.f90 +++ b/src/specfem3D/prepare_movie.f90 @@ -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 diff --git a/src/specfem3D/read_arrays_solver_hdf5.F90 b/src/specfem3D/read_arrays_solver_hdf5.F90 index e33ac481e..1f09fd256 100644 --- a/src/specfem3D/read_arrays_solver_hdf5.F90 +++ b/src/specfem3D/read_arrays_solver_hdf5.F90 @@ -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 read_arrays_solver_hdf5(iregion_code, & nspec,nglob,nglob_xy, & nspec_iso,nspec_tiso,nspec_ani, & @@ -297,18 +325,86 @@ subroutine read_arrays_solver_hdf5(iregion_code, & call h5_close_file_p() #else - print* - print*,'ERROR: HDF5 support not enabled' - print*, 'Please recompile with HDF5 support with the --with-hdf5 option' - print* + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = iregion_code + + idummy = size(ibool,kind=4) + idummy = size(idoubling,kind=4) + idummy = size(ispec_is_tiso,kind=4) + + idummy = size(xstore,kind=4) + idummy = size(ystore,kind=4) + idummy = size(zstore,kind=4) + + idummy = size(xix,kind=4) + idummy = size(xiy,kind=4) + idummy = size(xiz,kind=4) + idummy = size(etax,kind=4) + idummy = size(etay,kind=4) + idummy = size(etaz,kind=4) + idummy = size(gammax,kind=4) + idummy = size(gammay,kind=4) + idummy = size(gammaz,kind=4) + + idummy = size(c11store,kind=4) + idummy = size(c12store,kind=4) + idummy = size(c13store,kind=4) + idummy = size(c14store,kind=4) + idummy = size(c15store,kind=4) + idummy = size(c16store,kind=4) + idummy = size(c22store,kind=4) + idummy = size(c23store,kind=4) + idummy = size(c24store,kind=4) + idummy = size(c25store,kind=4) + idummy = size(c26store,kind=4) + idummy = size(c33store,kind=4) + idummy = size(c34store,kind=4) + idummy = size(c35store,kind=4) + idummy = size(c36store,kind=4) + idummy = size(c44store,kind=4) + idummy = size(c45store,kind=4) + idummy = size(c46store,kind=4) + idummy = size(c55store,kind=4) + idummy = size(c56store,kind=4) + idummy = size(c66store,kind=4) + + idummy = size(kappavstore,kind=4) + idummy = size(kappahstore,kind=4) + idummy = size(muvstore,kind=4) + idummy = size(muhstore,kind=4) + idummy = size(mu0store,kind=4) + idummy = size(rhostore,kind=4) + idummy = size(eta_anisostore,kind=4) + idummy = size(rho_vp,kind=4) + idummy = size(rho_vs,kind=4) + + idummy = size(rmassx,kind=4) + idummy = size(rmassy,kind=4) + idummy = size(rmassz,kind=4) + + idummy = size(b_rmassx,kind=4) + idummy = size(b_rmassy,kind=4) + + idummy = size(rmass_ocean_load,kind=4) + + print * + print *,'ERROR: HDF5 support not enabled' + print *, 'Please recompile with HDF5 support with the --with-hdf5 option' + print * stop #endif + end subroutine read_arrays_solver_hdf5 -end subroutine read_arrays_solver_hdf5 - +! +!------------------------------------------------------------------------------------------------- +! -subroutine read_mesh_databases_MPI_hdf5(iregion_code) + subroutine read_mesh_databases_MPI_hdf5(iregion_code) use specfem_par use specfem_par_crustmantle @@ -402,7 +498,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("nibool_interfaces", & nibool_interfaces_crust_mantle(1:num_interfaces), & (/sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(ibool_interfaces_crust_mantle(max_nibool_interfaces,num_interfaces), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating ibool_interfaces_crust_mantle etc.') @@ -411,7 +507,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("ibool_interfaces", & ibool_interfaces_crust_mantle(1:max_nibool_interfaces,1:num_interfaces), & (/0,sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(phase_ispec_inner_crust_mantle(num_phase_ispec,2), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating phase_ispec_inner_crust_mantle etc.') @@ -420,7 +516,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("phase_ispec_inner", & phase_ispec_inner_crust_mantle(1:num_phase_ispec,1:2), & (/sum(offset_num_phase_ispec(0:myrank-1)),0/), H5_COL) - end if + endif allocate(num_elem_colors_crust_mantle(num_colors_outer+num_colors_inner), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating num_elem_colors_crust_mantle etc.') @@ -428,7 +524,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("num_elem_colors", & num_elem_colors_crust_mantle(1:(num_colors_outer+num_colors_inner)), & (/sum(offset_num_colors_outer(0:myrank-1))/), H5_COL) - end if + endif case (IREGION_OUTER_CORE) @@ -450,7 +546,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("nibool_interfaces", & nibool_interfaces_outer_core(1:num_interfaces), & (/sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(ibool_interfaces_outer_core(max_nibool_interfaces,num_interfaces), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating ibool_interfaces_outer_core etc.') @@ -459,7 +555,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("ibool_interfaces", & ibool_interfaces_outer_core(1:max_nibool_interfaces,1:num_interfaces), & (/0,sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(phase_ispec_inner_outer_core(num_phase_ispec,2), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating phase_ispec_inner_outer_core etc.') @@ -468,7 +564,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("phase_ispec_inner", & phase_ispec_inner_outer_core(1:num_phase_ispec,1:2), & (/sum(offset_num_phase_ispec(0:myrank-1)),0/), H5_COL) - end if + endif allocate(num_elem_colors_outer_core(num_colors_outer+num_colors_inner), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating num_elem_colors_outer_core etc.') @@ -476,7 +572,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("num_elem_colors", & num_elem_colors_outer_core(1:(num_colors_outer+num_colors_inner)), & (/sum(offset_num_colors_outer(0:myrank-1))/), H5_COL) - end if + endif case (IREGION_INNER_CORE) @@ -498,7 +594,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("nibool_interfaces", & nibool_interfaces_inner_core(1:num_interfaces), & (/sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(ibool_interfaces_inner_core(max_nibool_interfaces,num_interfaces), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating ibool_interfaces_inner_core etc.') @@ -507,7 +603,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("ibool_interfaces", & ibool_interfaces_inner_core(1:max_nibool_interfaces,1:num_interfaces), & (/0,sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(phase_ispec_inner_inner_core(num_phase_ispec,2), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating phase_ispec_inner_inner_core etc.') @@ -516,7 +612,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("phase_ispec_inner", & phase_ispec_inner_inner_core(1:num_phase_ispec,1:2), & (/sum(offset_num_phase_ispec(0:myrank-1)),0/), H5_COL) - end if + endif allocate(num_elem_colors_inner_core(num_colors_outer+num_colors_inner), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating num_elem_colors_inner_core etc.') @@ -524,7 +620,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("num_elem_colors", & num_elem_colors_inner_core(1:(num_colors_outer+num_colors_inner)), & (/sum(offset_num_colors_outer(0:myrank-1))/), H5_COL) - end if + endif case (IREGION_TRINFINITE) @@ -546,7 +642,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("nibool_interfaces", & nibool_interfaces_trinfinite(1:num_interfaces), & (/sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(ibool_interfaces_trinfinite(max_nibool_interfaces,num_interfaces), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating ibool_interfaces_trinfinite etc.') @@ -555,7 +651,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("ibool_interfaces", & ibool_interfaces_trinfinite(1:max_nibool_interfaces,1:num_interfaces), & (/0,sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(phase_ispec_inner_trinfinite(num_phase_ispec,2), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating phase_ispec_inner_trinfinite etc.') @@ -564,7 +660,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("phase_ispec_inner", & phase_ispec_inner_trinfinite(1:num_phase_ispec,1:2), & (/sum(offset_num_phase_ispec(0:myrank-1)),0/), H5_COL) - end if + endif allocate(num_elem_colors_trinfinite(num_colors_outer+num_colors_inner), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating num_elem_colors_trinfinite etc.') @@ -572,7 +668,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("num_elem_colors", & num_elem_colors_trinfinite(1:(num_colors_outer+num_colors_inner)), & (/sum(offset_num_colors_outer(0:myrank-1))/), H5_COL) - end if + endif case (IREGION_INFINITE) @@ -594,7 +690,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("nibool_interfaces", & nibool_interfaces_infinite(1:num_interfaces), & (/sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(ibool_interfaces_infinite(max_nibool_interfaces,num_interfaces), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating ibool_interfaces_infinite etc.') @@ -603,7 +699,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("ibool_interfaces", & ibool_interfaces_infinite(1:max_nibool_interfaces,1:num_interfaces), & (/0,sum(offset_num_interfaces(0:myrank-1))/), H5_COL) - end if + endif allocate(phase_ispec_inner_infinite(num_phase_ispec,2), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating phase_ispec_inner_infinite etc.') @@ -612,7 +708,7 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("phase_ispec_inner", & phase_ispec_inner_infinite(1:num_phase_ispec,1:2), & (/sum(offset_num_phase_ispec(0:myrank-1)),0/), H5_COL) - end if + endif allocate(num_elem_colors_infinite(num_colors_outer+num_colors_inner), stat=ierr) if (ierr /= 0) call exit_mpi(myrank,'Error allocating num_elem_colors_infinite etc.') @@ -620,10 +716,10 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_read_dataset_collect_hyperslab_in_group("num_elem_colors", & num_elem_colors_infinite(1:(num_colors_outer+num_colors_inner)), & (/sum(offset_num_colors_outer(0:myrank-1))/), H5_COL) - end if + endif case default - print*, 'ERROR: unknown region code' + print *, 'ERROR: unknown region code' stop end select @@ -633,18 +729,27 @@ subroutine read_mesh_databases_MPI_hdf5(iregion_code) call h5_close_file_p() #else - print* - print*,'ERROR: HDF5 support not enabled' - print*, 'Please recompile with HDF5 support with the --with-hdf5 option' - print* + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = iregion_code + + print * + print *,'ERROR: HDF5 support not enabled' + print *, 'Please recompile with HDF5 support with the --with-hdf5 option' + print * stop #endif -end subroutine read_mesh_databases_MPI_hdf5 + end subroutine read_mesh_databases_MPI_hdf5 +! +!------------------------------------------------------------------------------------------------- +! - -subroutine read_mesh_databases_coupling_hdf5() + subroutine read_mesh_databases_coupling_hdf5() #ifdef USE_HDF5 use constants @@ -781,7 +886,7 @@ subroutine read_mesh_databases_coupling_hdf5() call h5_read_dataset_collect_hyperslab_in_group("jacobian2D_xmin", jacobian2D_xmin_crust_mantle, & (/0,0,sum(offset_nspec2D_xmin(0:myrank-1))/), H5_COL) ! jacobian_xmax - call h5_read_dataset_collect_hyperslab_in_group("jacobian2D_xmax", jacobian2D_xmax_crust_mantle,& + call h5_read_dataset_collect_hyperslab_in_group("jacobian2D_xmax", jacobian2D_xmax_crust_mantle, & (/0,0,sum(offset_nspec2D_xmax(0:myrank-1))/), H5_COL) ! jacobian_ymin call h5_read_dataset_collect_hyperslab_in_group("jacobian2D_ymin", jacobian2D_ymin_crust_mantle, & @@ -798,7 +903,7 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_CRUST_MANTLE > 0 + endif ! NSPEC_CRUST_MANTLE > 0 if (NSPEC_OUTER_CORE > 0) then ! change group name @@ -882,7 +987,7 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_OUTER_CORE > 0 + endif ! NSPEC_OUTER_CORE > 0 if (NSPEC_INNER_CORE > 0) then @@ -929,7 +1034,7 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_INNER_CORE > 0 + endif ! NSPEC_INNER_CORE > 0 if (FULL_GRAVITY) then if (ADD_TRINF) then @@ -977,8 +1082,8 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_TRINFINITE > 0 - end if ! ADD_TRINF + endif ! NSPEC_TRINFINITE > 0 + endif ! ADD_TRINF if (NSPEC_INFINITE > 0) then ! change group name @@ -1024,8 +1129,8 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_INFINITE > 0 - end if ! FULL_GRAVITY + endif ! NSPEC_INFINITE > 0 + endif ! FULL_GRAVITY ! close file call h5_close_file_p() @@ -1049,7 +1154,7 @@ subroutine read_mesh_databases_coupling_hdf5() ! checks setup if (tmp_nspec2d_moho /= NSPEC2D_MOHO .or. tmp_nspec2d_400 /= NSPEC2D_400 .or. tmp_nspec2d_670 /= NSPEC2D_670) then - print *,'Error: invalid NSPEC2D values read in for solver: ',& + print *,'Error: invalid NSPEC2D values read in for solver: ', & tmp_nspec2d_moho,tmp_nspec2d_400,tmp_nspec2d_670,'(boundary_disc.h5)' print *,' should be MOHO/400/670 : ',NSPEC2D_MOHO,NSPEC2D_400,NSPEC2D_670,'(mesh_parameters.h5)' call exit_mpi(myrank, 'Error reading boundary_disc.h5 file') @@ -1099,24 +1204,24 @@ subroutine read_mesh_databases_coupling_hdf5() ! close group call h5_close_group() - end if ! NSPEC_CRUST_MANTLE > 0 - end if ! SAVE_BOUNDARY_MESH .and. SIMULATION_TYPE == 3 - - - + endif ! NSPEC_CRUST_MANTLE > 0 + endif ! SAVE_BOUNDARY_MESH .and. SIMULATION_TYPE == 3 #else - print* - print*,'ERROR: HDF5 support not enabled' - print*, 'Please recompile with HDF5 support with the --with-hdf5 option' - print* + print * + print *,'ERROR: HDF5 support not enabled' + print *, 'Please recompile with HDF5 support with the --with-hdf5 option' + print * stop #endif -end subroutine read_mesh_databases_coupling_hdf5 + end subroutine read_mesh_databases_coupling_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine read_mesh_databases_stacey_hdf5 + subroutine read_mesh_databases_stacey_hdf5 use specfem_par use specfem_par_crustmantle @@ -1213,7 +1318,7 @@ subroutine read_mesh_databases_stacey_hdf5 ! close group call h5_close_group() - end if ! NSPEC_CRUST_MANTLE > 0 + endif ! NSPEC_CRUST_MANTLE > 0 if (NSPEC_OUTER_CORE > 0) then ! open the group @@ -1277,24 +1382,27 @@ subroutine read_mesh_databases_stacey_hdf5 ! close group call h5_close_group() - end if ! NSPEC_OUTER_CORE > 0 + endif ! NSPEC_OUTER_CORE > 0 ! close file call h5_close_file_p() #else - print* - print*,'ERROR: HDF5 support not enabled' - print*, 'Please recompile with HDF5 support with the --with-hdf5 option' - print* + print * + print *,'ERROR: HDF5 support not enabled' + print *, 'Please recompile with HDF5 support with the --with-hdf5 option' + print * stop #endif -end subroutine read_mesh_databases_stacey_hdf5 + end subroutine read_mesh_databases_stacey_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine read_attenuation_hdf5(iregion_code, factor_common, scale_factor, tau_s, vnspec, f_c_source) + subroutine read_attenuation_hdf5(iregion_code, factor_common, scale_factor, tau_s, vnspec, f_c_source) use constants_solver @@ -1322,11 +1430,8 @@ subroutine read_attenuation_hdf5(iregion_code, factor_common, scale_factor, tau_ integer :: comm, info double precision, dimension(0:NPROCTOT_VAL-1) :: tmp_dp_arr -#endif - if (.not. ATTENUATION_VAL) return -#ifdef USE_HDF5 call world_get_comm(comm) call world_get_info_null(info) @@ -1370,11 +1475,24 @@ subroutine read_attenuation_hdf5(iregion_code, factor_common, scale_factor, tau_ call h5_close_file_p() #else - print* - print*,'ERROR: HDF5 support not enabled' - print*, 'Please recompile with HDF5 support with the --with-hdf5 option' - print* + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + double precision :: d_dummy + + idummy = iregion_code + d_dummy = f_c_source + + idummy = size(factor_common,kind=4) + idummy = size(scale_factor,kind=4) + idummy = size(tau_s,kind=4) + + print * + print *,'ERROR: HDF5 support not enabled' + print *, 'Please recompile with HDF5 support with the --with-hdf5 option' + print * stop #endif -end subroutine read_attenuation_hdf5 + end subroutine read_attenuation_hdf5 diff --git a/src/specfem3D/read_forward_arrays_hdf5.F90 b/src/specfem3D/read_forward_arrays_hdf5.F90 index 1023a50c4..616da08df 100644 --- a/src/specfem3D/read_forward_arrays_hdf5.F90 +++ b/src/specfem3D/read_forward_arrays_hdf5.F90 @@ -111,15 +111,15 @@ subroutine read_intermediate_forward_arrays_hdf5() (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('epsilondev_yz_crust_mantle', epsilondev_yz_crust_mantle, & (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', epsilondev_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', epsilondev_xx_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', epsilondev_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', epsilondev_yy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', epsilondev_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', epsilondev_xy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', epsilondev_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', epsilondev_xz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', epsilondev_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', epsilondev_yz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) if (ROTATION_VAL) then @@ -140,15 +140,15 @@ subroutine read_intermediate_forward_arrays_hdf5() (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('R_yz_crust_mantle', R_yz_crust_mantle, & (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xx_inner_core', R_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xx_inner_core', R_xx_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yy_inner_core', R_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yy_inner_core', R_yy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xy_inner_core', R_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xy_inner_core', R_xy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xz_inner_core', R_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xz_inner_core', R_xz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yz_inner_core', R_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yz_inner_core', R_yz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) endif @@ -169,6 +169,9 @@ subroutine read_intermediate_forward_arrays_hdf5() end subroutine read_intermediate_forward_arrays_hdf5 +! +!------------------------------------------------------------------------------------------------- +! subroutine read_forward_arrays_hdf5() @@ -257,15 +260,15 @@ subroutine read_forward_arrays_hdf5() (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('epsilondev_yz_crust_mantle', b_epsilondev_yz_crust_mantle, & (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', b_epsilondev_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', b_epsilondev_xx_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', b_epsilondev_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', b_epsilondev_yy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', b_epsilondev_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', b_epsilondev_xy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', b_epsilondev_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', b_epsilondev_xz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', b_epsilondev_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', b_epsilondev_yz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) if (ROTATION_VAL) then @@ -286,15 +289,15 @@ subroutine read_forward_arrays_hdf5() (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('R_yz_crust_mantle', b_R_yz_crust_mantle, & (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xx_inner_core', b_R_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xx_inner_core', b_R_xx_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yy_inner_core', b_R_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yy_inner_core', b_R_yy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xy_inner_core', b_R_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xy_inner_core', b_R_xy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xz_inner_core', b_R_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xz_inner_core', b_R_xz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yz_inner_core', b_R_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yz_inner_core', b_R_yz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) endif @@ -326,6 +329,10 @@ subroutine read_forward_arrays_hdf5() end subroutine read_forward_arrays_hdf5 +! +!------------------------------------------------------------------------------------------------- +! + subroutine read_forward_arrays_undoatt_hdf5(iteration_on_subset_tmp) use specfem_par @@ -418,15 +425,15 @@ subroutine read_forward_arrays_undoatt_hdf5(iteration_on_subset_tmp) (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('epsilondev_yz_crust_mantle', b_epsilondev_yz_crust_mantle, & (/0,0,0,sum(offset_nglob_mc_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', b_epsilondev_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xx_inner_core', b_epsilondev_xx_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', b_epsilondev_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yy_inner_core', b_epsilondev_yy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', b_epsilondev_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xy_inner_core', b_epsilondev_xy_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', b_epsilondev_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_xz_inner_core', b_epsilondev_xz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', b_epsilondev_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('epsilondev_yz_inner_core', b_epsilondev_yz_inner_core, & (/0,0,0,sum(offset_nglob_ic_str_or_att(0:myrank-1))/), H5_COL) if (ROTATION_VAL) then @@ -447,15 +454,15 @@ subroutine read_forward_arrays_undoatt_hdf5(iteration_on_subset_tmp) (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) call h5_read_dataset_collect_hyperslab('R_yz_crust_mantle', b_R_yz_crust_mantle, & (/0,0,0,0,sum(offset_nspec_cm_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xx_inner_core', b_R_xx_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xx_inner_core', b_R_xx_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yy_inner_core', b_R_yy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yy_inner_core', b_R_yy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xy_inner_core', b_R_xy_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xy_inner_core', b_R_xy_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_xz_inner_core', b_R_xz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_xz_inner_core', b_R_xz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) - call h5_read_dataset_collect_hyperslab('R_yz_inner_core', b_R_yz_inner_core, & + call h5_read_dataset_collect_hyperslab('R_yz_inner_core', b_R_yz_inner_core, & (/0,0,0,0,sum(offset_nspec_ic_att(0:myrank-1))/), H5_COL) endif @@ -480,6 +487,13 @@ subroutine read_forward_arrays_undoatt_hdf5(iteration_on_subset_tmp) call h5_close_file_p() #else + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = iteration_on_subset_tmp + print *,'Error: HDF5 not enabled in this version of the code' print *, 'Please recompile with the HDF5 option enabled with the configure flag --with-hdf5' call exit_mpi(myrank,'Error: HDF5 not enabled in this version of the code') diff --git a/src/specfem3D/save_forward_arrays_hdf5.F90 b/src/specfem3D/save_forward_arrays_hdf5.F90 index 8962127fc..9c02fda10 100644 --- a/src/specfem3D/save_forward_arrays_hdf5.F90 +++ b/src/specfem3D/save_forward_arrays_hdf5.F90 @@ -26,7 +26,7 @@ !===================================================================== -subroutine save_intermediate_forward_arrays_hdf5() + subroutine save_intermediate_forward_arrays_hdf5() use specfem_par use specfem_par_crustmantle @@ -229,11 +229,13 @@ subroutine save_intermediate_forward_arrays_hdf5() #endif + end subroutine save_intermediate_forward_arrays_hdf5 -end subroutine save_intermediate_forward_arrays_hdf5 - +! +!------------------------------------------------------------------------------------------------- +! -subroutine save_forward_arrays_hdf5() + subroutine save_forward_arrays_hdf5() use specfem_par use specfem_par_crustmantle @@ -439,11 +441,13 @@ subroutine save_forward_arrays_hdf5() #endif + end subroutine save_forward_arrays_hdf5 -end subroutine save_forward_arrays_hdf5 - +! +!------------------------------------------------------------------------------------------------- +! -subroutine save_forward_arrays_undoatt_hdf5() + subroutine save_forward_arrays_undoatt_hdf5() use specfem_par use specfem_par_crustmantle @@ -648,10 +652,13 @@ subroutine save_forward_arrays_undoatt_hdf5() #endif -end subroutine save_forward_arrays_undoatt_hdf5 + end subroutine save_forward_arrays_undoatt_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine save_forward_model_at_shifted_frequency_hdf5(factor_scale_relaxed_crust_mantle,factor_scale_relaxed_inner_core) + subroutine save_forward_model_at_shifted_frequency_hdf5(factor_scale_relaxed_crust_mantle,factor_scale_relaxed_inner_core) use constants @@ -974,11 +981,18 @@ subroutine save_forward_model_at_shifted_frequency_hdf5(factor_scale_relaxed_cru call h5_close_file_p() #else + ! no HDF5 support - print *,'Error: HDF5 not enabled in this version of the code' - print *, 'Please recompile with the HDF5 option enabled with the configure flag --with-hdf5' - call exit_mpi(myrank,'Error: HDF5 not enabled in this version of the code') + ! to avoid compiler warnings + integer :: idummy + + idummy = size(factor_scale_relaxed_crust_mantle,kind=4) + idummy = size(factor_scale_relaxed_inner_core,kind=4) + + print *,'Error: HDF5 not enabled in this version of the code' + print *, 'Please recompile with the HDF5 option enabled with the configure flag --with-hdf5' + call exit_mpi(myrank,'Error: HDF5 not enabled in this version of the code') #endif -end subroutine save_forward_model_at_shifted_frequency_hdf5 + end subroutine save_forward_model_at_shifted_frequency_hdf5 diff --git a/src/specfem3D/save_kernels_hdf5.F90 b/src/specfem3D/save_kernels_hdf5.F90 index 8248ba1ac..eec80b973 100644 --- a/src/specfem3D/save_kernels_hdf5.F90 +++ b/src/specfem3D/save_kernels_hdf5.F90 @@ -25,7 +25,8 @@ ! !===================================================================== -subroutine write_kernels_strength_noise_hdf5() + + subroutine write_kernels_strength_noise_hdf5() use specfem_par use specfem_par_crustmantle @@ -85,10 +86,13 @@ subroutine write_kernels_strength_noise_hdf5() #endif -end subroutine write_kernels_strength_noise_hdf5 + end subroutine write_kernels_strength_noise_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_cm_ani_hdf5(alphav_kl_crust_mantle,alphah_kl_crust_mantle, & + subroutine write_kernels_cm_ani_hdf5(alphav_kl_crust_mantle,alphah_kl_crust_mantle, & betav_kl_crust_mantle,betah_kl_crust_mantle, & eta_kl_crust_mantle, & bulk_c_kl_crust_mantle,bulk_beta_kl_crust_mantle, & @@ -317,6 +321,22 @@ subroutine write_kernels_cm_ani_hdf5(alphav_kl_crust_mantle,alphah_kl_crust_mant call h5_close_file_p() #else + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = size(alphav_kl_crust_mantle,kind=4) + idummy = size(alphah_kl_crust_mantle,kind=4) + idummy = size(betav_kl_crust_mantle,kind=4) + idummy = size(betah_kl_crust_mantle,kind=4) + idummy = size(eta_kl_crust_mantle,kind=4) + idummy = size(bulk_c_kl_crust_mantle,kind=4) + idummy = size(bulk_beta_kl_crust_mantle,kind=4) + idummy = size(bulk_betav_kl_crust_mantle,kind=4) + idummy = size(bulk_betah_kl_crust_mantle,kind=4) + idummy = size(Gc_prime_kl_crust_mantle,kind=4) + idummy = size(Gs_prime_kl_crust_mantle,kind=4) print *,'Error: HDF5 not enabled in this version of the code' print *, 'Please recompile with the HDF5 option enabled with the configure flag --with-hdf5' @@ -324,10 +344,13 @@ subroutine write_kernels_cm_ani_hdf5(alphav_kl_crust_mantle,alphah_kl_crust_mant #endif -end subroutine write_kernels_cm_ani_hdf5 + end subroutine write_kernels_cm_ani_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_cm_iso_hdf5(mu_kl_crust_mantle, kappa_kl_crust_mantle, rhonotprime_kl_crust_mantle, & + subroutine write_kernels_cm_iso_hdf5(mu_kl_crust_mantle, kappa_kl_crust_mantle, rhonotprime_kl_crust_mantle, & bulk_c_kl_crust_mantle,bulk_beta_kl_crust_mantle) use specfem_par @@ -414,6 +437,16 @@ subroutine write_kernels_cm_iso_hdf5(mu_kl_crust_mantle, kappa_kl_crust_mantle, call h5_close_file_p() #else + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = size(mu_kl_crust_mantle,kind=4) + idummy = size(kappa_kl_crust_mantle,kind=4) + idummy = size(rhonotprime_kl_crust_mantle,kind=4) + idummy = size(bulk_c_kl_crust_mantle,kind=4) + idummy = size(bulk_beta_kl_crust_mantle,kind=4) print *,'Error: HDF5 not enabled in this version of the code' print *, 'Please recompile with the HDF5 option enabled with the configure flag --with-hdf5' @@ -421,10 +454,13 @@ subroutine write_kernels_cm_iso_hdf5(mu_kl_crust_mantle, kappa_kl_crust_mantle, #endif -end subroutine write_kernels_cm_iso_hdf5 + end subroutine write_kernels_cm_iso_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_oc_hdf5() + subroutine write_kernels_oc_hdf5() use specfem_par use specfem_par_outercore @@ -486,10 +522,13 @@ subroutine write_kernels_oc_hdf5() #endif -end subroutine write_kernels_oc_hdf5 + end subroutine write_kernels_oc_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_ic_hdf5() + subroutine write_kernels_ic_hdf5() use specfem_par use specfem_par_innercore @@ -554,10 +593,13 @@ subroutine write_kernels_ic_hdf5() #endif -end subroutine write_kernels_ic_hdf5 + end subroutine write_kernels_ic_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_boundary_kl_hdf5() + subroutine write_kernels_boundary_kl_hdf5() use specfem_par use specfem_par_crustmantle @@ -640,10 +682,13 @@ subroutine write_kernels_boundary_kl_hdf5() #endif -end subroutine write_kernels_boundary_kl_hdf5 + end subroutine write_kernels_boundary_kl_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_kernels_Hessian_hdf5() + subroutine write_kernels_Hessian_hdf5() use specfem_par use specfem_par_crustmantle @@ -711,4 +756,5 @@ subroutine write_kernels_Hessian_hdf5() #endif -end subroutine write_kernels_Hessian_hdf5 + end subroutine write_kernels_Hessian_hdf5 + diff --git a/src/specfem3D/write_movie_volume_hdf5.F90 b/src/specfem3D/write_movie_volume_hdf5.F90 index e60f0242e..8dd8cf72c 100644 --- a/src/specfem3D/write_movie_volume_hdf5.F90 +++ b/src/specfem3D/write_movie_volume_hdf5.F90 @@ -26,6 +26,7 @@ !===================================================================== subroutine movie_volume_init_hdf5() + #ifdef USE_HDF5 use specfem_par use specfem_par_movie_hdf5 @@ -92,25 +93,31 @@ subroutine movie_volume_init_hdf5() if (NSPEC_INNER_CORE == 0) output_ic = .false. ! print - !print*, 'output_sv = ',output_sv - !print*, 'output_cm = ',output_cm - !print*, 'output_oc = ',output_oc - !print*, 'output_ic = ',output_ic - !print*, 'NSPEC_CRUST_MANTLE = ',NSPEC_CRUST_MANTLE - !print*, 'NSPEC_CRUST_MANTLE_STRAIN_ONLY = ',NSPEC_CRUST_MANTLE_STRAIN_ONLY - !print*, 'NSPEC_CRUST_MANTLE_STR_OR_ATT = ',NSPEC_CRUST_MANTLE_STR_OR_ATT - !print*, 'NSPEC_OUTER_CORE = ',NSPEC_OUTER_CORE - !print*, 'NSPEC_OUTER_CORE_3DMOVIE = ',NSPEC_OUTER_CORE_3DMOVIE - !print*, 'NSPEC_INNER_CORE = ',NSPEC_INNER_CORE + !print *, 'output_sv = ',output_sv + !print *, 'output_cm = ',output_cm + !print *, 'output_oc = ',output_oc + !print *, 'output_ic = ',output_ic + !print *, 'NSPEC_CRUST_MANTLE = ',NSPEC_CRUST_MANTLE + !print *, 'NSPEC_CRUST_MANTLE_STRAIN_ONLY = ',NSPEC_CRUST_MANTLE_STRAIN_ONLY + !print *, 'NSPEC_CRUST_MANTLE_STR_OR_ATT = ',NSPEC_CRUST_MANTLE_STR_OR_ATT + !print *, 'NSPEC_OUTER_CORE = ',NSPEC_OUTER_CORE + !print *, 'NSPEC_OUTER_CORE_3DMOVIE = ',NSPEC_OUTER_CORE_3DMOVIE + !print *, 'NSPEC_INNER_CORE = ',NSPEC_INNER_CORE #else write (*,*) 'Error: HDF5 is not enabled in this version of the code.' write (*,*) 'Please recompile with the HDF5 option enabled with --with-hdf5' stop #endif + end subroutine movie_volume_init_hdf5 +! +!------------------------------------------------------------------------------------------------- +! + subroutine movie_volume_finalize_hdf5() + #ifdef USE_HDF5 use specfem_par_movie_hdf5 @@ -128,8 +135,13 @@ subroutine movie_volume_finalize_hdf5() write (*,*) 'Please recompile with the HDF5 option enabled with --with-hdf5' stop #endif + end subroutine movie_volume_finalize_hdf5 +! +!------------------------------------------------------------------------------------------------- +! + subroutine write_movie_volume_mesh_hdf5(nu_3dmovie,num_ibool_3dmovie,mask_3dmovie,mask_ibool_3dmovie, & muvstore_crust_mantle_3dmovie,npoints_3dmovie,nelems_3dmovie_in) @@ -235,19 +247,19 @@ subroutine write_movie_volume_mesh_hdf5(nu_3dmovie,num_ibool_3dmovie,mask_3dmovi nspec_vol_mov_all_proc_ic_conn = sum(offset_nspec_vol_ic_conn) !if (myrank == 0) then - ! print*, 'npoints_vol_mov_all_proc = ', npoints_vol_mov_all_proc - ! print*, 'npoints_vol_mov_all_proc_cm = ', npoints_vol_mov_all_proc_cm - ! print*, 'npoints_vol_mov_all_proc_oc = ', npoints_vol_mov_all_proc_oc - ! print*, 'npoints_vol_mov_all_proc_ic = ', npoints_vol_mov_all_proc_ic - - ! print*, 'nspec_vol_mov_all_proc = ', nspec_vol_mov_all_proc - ! print*, 'nspec_vol_mov_all_proc_cm = ', nspec_vol_mov_all_proc_cm - ! print*, 'nspec_vol_mov_all_proc_oc = ', nspec_vol_mov_all_proc_oc - ! print*, 'nspec_vol_mov_all_proc_ic = ', nspec_vol_mov_all_proc_ic - - ! print*, 'nspec_vol_mov_all_proc_cm_conn = ', nspec_vol_mov_all_proc_cm_conn - ! print*, 'nspec_vol_mov_all_proc_oc_conn = ', nspec_vol_mov_all_proc_oc_conn - ! print*, 'nspec_vol_mov_all_proc_ic_conn = ', nspec_vol_mov_all_proc_ic_conn + ! print *, 'npoints_vol_mov_all_proc = ', npoints_vol_mov_all_proc + ! print *, 'npoints_vol_mov_all_proc_cm = ', npoints_vol_mov_all_proc_cm + ! print *, 'npoints_vol_mov_all_proc_oc = ', npoints_vol_mov_all_proc_oc + ! print *, 'npoints_vol_mov_all_proc_ic = ', npoints_vol_mov_all_proc_ic + + ! print *, 'nspec_vol_mov_all_proc = ', nspec_vol_mov_all_proc + ! print *, 'nspec_vol_mov_all_proc_cm = ', nspec_vol_mov_all_proc_cm + ! print *, 'nspec_vol_mov_all_proc_oc = ', nspec_vol_mov_all_proc_oc + ! print *, 'nspec_vol_mov_all_proc_ic = ', nspec_vol_mov_all_proc_ic + + ! print *, 'nspec_vol_mov_all_proc_cm_conn = ', nspec_vol_mov_all_proc_cm_conn + ! print *, 'nspec_vol_mov_all_proc_oc_conn = ', nspec_vol_mov_all_proc_oc_conn + ! print *, 'nspec_vol_mov_all_proc_ic_conn = ', nspec_vol_mov_all_proc_ic_conn !endif ! @@ -312,8 +324,8 @@ subroutine write_movie_volume_mesh_hdf5(nu_3dmovie,num_ibool_3dmovie,mask_3dmovi ! check if counters are correct if (ipoints_3dmovie /= npoints_3dmovie) then - print*, 'Error: did not find the right number of points for 3D movie' - print*, 'ipoints_3dmovie = ',ipoints_3dmovie,' npoints_3dmovie = ',npoints_3dmovie + print *, 'Error: did not find the right number of points for 3D movie' + print *, 'ipoints_3dmovie = ',ipoints_3dmovie,' npoints_3dmovie = ',npoints_3dmovie stop endif @@ -414,7 +426,7 @@ subroutine write_movie_volume_mesh_hdf5(nu_3dmovie,num_ibool_3dmovie,mask_3dmovi ! create elm_conn for movie ! for crust and mantle (strain and vector output) - if (output_sv) call get_conn_for_movie(elm_conn, sum(offset_poin_vol(0:myrank-1)), iNIT, nelems_3dmovie, & + if (output_sv) call get_conn_for_movie(elm_conn, sum(offset_poin_vol(0:myrank-1)), iNIT, nelems_3dmovie, & npoints_3dmovie, NSPEC_CRUST_MANTLE, num_ibool_3dmovie, mask_ibool_3dmovie, ibool_crust_mantle) ! for crust and mantle (not strain or vector output) if (output_cm) call get_conn_for_movie(elm_conn_cm, sum(offset_poin_vol_cm(0:myrank-1)), 1, nelems_3dmovie_cm, & @@ -538,15 +550,30 @@ subroutine write_movie_volume_mesh_hdf5(nu_3dmovie,num_ibool_3dmovie,mask_3dmovi npoints_vol_mov_all_proc_ic, nspec_vol_mov_all_proc_ic) #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + + idummy = nelems_3dmovie_in + + idummy = size(num_ibool_3dmovie,kind=4) + idummy = size(nu_3dmovie,kind=4) + idummy = size(mask_3dmovie,kind=4) + idummy = size(mask_ibool_3dmovie,kind=4) + idummy = size(muvstore_crust_mantle_3dmovie,kind=4) + + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop #endif end subroutine write_movie_volume_mesh_hdf5 +! +!------------------------------------------------------------------------------------------------- +! subroutine write_movie_volume_strains_hdf5(vnspec_eps_cm, & eps_trace_over_3_crust_mantle, & @@ -708,19 +735,31 @@ subroutine write_movie_volume_strains_hdf5(vnspec_eps_cm, & #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy -#endif + idummy = size(eps_trace_over_3_crust_mantle,kind=4) + idummy = size(epsilondev_xx_crust_mantle,kind=4) + idummy = size(epsilondev_yy_crust_mantle,kind=4) + idummy = size(epsilondev_xy_crust_mantle,kind=4) + idummy = size(epsilondev_xz_crust_mantle,kind=4) + idummy = size(epsilondev_yz_crust_mantle,kind=4) - end subroutine write_movie_volume_strains_hdf5 + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop +#endif + end subroutine write_movie_volume_strains_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_movie_volume_divcurl_hdf5(vnspec_eps_cm,eps_trace_over_3_crust_mantle, & + subroutine write_movie_volume_divcurl_hdf5(vnspec_eps_cm,eps_trace_over_3_crust_mantle, & div_displ_outer_core, & accel_outer_core,kappavstore_outer_core,rhostore_outer_core,ibool_outer_core, & vnspec_eps_ic,eps_trace_over_3_inner_core, & @@ -734,7 +773,7 @@ subroutine write_movie_volume_divcurl_hdf5(vnspec_eps_cm,eps_trace_over_3_crust_ use constants_solver #ifdef USE_HDF5 - use shared_parameters, only: OUTPUT_FILES,H5_COL + use shared_parameters, only: OUTPUT_FILES use specfem_par, only: it use specfem_par_crustmantle, only: ibool_crust_mantle use specfem_par_innercore, only: ibool_inner_core @@ -902,6 +941,7 @@ subroutine write_movie_volume_divcurl_hdf5(vnspec_eps_cm,eps_trace_over_3_crust_ do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX + iglob = ibool_inner_core(i,j,k,ispec) tmp_data(iglob) = sqrt( epsilondev_xx_inner_core(i,j,k,ispec)**2 & + epsilondev_yy_inner_core(i,j,k,ispec)**2 & + epsilondev_xy_inner_core(i,j,k,ispec)**2 & @@ -920,16 +960,43 @@ subroutine write_movie_volume_divcurl_hdf5(vnspec_eps_cm,eps_trace_over_3_crust_ call h5_close_file() #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + + idummy = size(eps_trace_over_3_crust_mantle,kind=4) + idummy = size(div_displ_outer_core,kind=4) + + idummy = size(accel_outer_core,kind=4) + idummy = size(kappavstore_outer_core,kind=4) + idummy = size(rhostore_outer_core,kind=4) + idummy = size(ibool_outer_core,kind=4) + + idummy = size(eps_trace_over_3_inner_core,kind=4) + idummy = size(epsilondev_xx_crust_mantle,kind=4) + idummy = size(epsilondev_yy_crust_mantle,kind=4) + idummy = size(epsilondev_xy_crust_mantle,kind=4) + idummy = size(epsilondev_xz_crust_mantle,kind=4) + idummy = size(epsilondev_yz_crust_mantle,kind=4) + + idummy = size(epsilondev_xx_inner_core,kind=4) + idummy = size(epsilondev_yy_inner_core,kind=4) + idummy = size(epsilondev_xy_inner_core,kind=4) + idummy = size(epsilondev_xz_inner_core,kind=4) + idummy = size(epsilondev_yz_inner_core,kind=4) + + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop #endif end subroutine write_movie_volume_divcurl_hdf5 - +! +!------------------------------------------------------------------------------------------------- +! subroutine write_movie_volume_vector_hdf5(npoints_3dmovie, & ibool_crust_mantle,vector_crust_mantle, & @@ -1060,16 +1127,30 @@ subroutine write_movie_volume_vector_hdf5(npoints_3dmovie, & deallocate(store_val3d_N,store_val3d_E,store_val3d_Z) #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + double precision :: d_dummy -#endif + idummy = size(ibool_crust_mantle,kind=4) + idummy = size(mask_3dmovie,kind=4) + idummy = size(nu_3dmovie,kind=4) + idummy = size(vector_crust_mantle,kind=4) + + d_dummy = scalingval + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop + +#endif end subroutine write_movie_volume_vector_hdf5 +! +!------------------------------------------------------------------------------------------------- +! subroutine write_movie_volume_displnorm_hdf5(displ_crust_mantle,displ_inner_core,displ_outer_core, & ibool_crust_mantle,ibool_inner_core,ibool_outer_core) @@ -1079,7 +1160,7 @@ subroutine write_movie_volume_displnorm_hdf5(displ_crust_mantle,displ_inner_core use constants_solver #ifdef USE_HDF5 - use shared_parameters, only: OUTPUT_FILES,H5_COL + use shared_parameters, only: OUTPUT_FILES use specfem_par, only: it, scale_displ use specfem_par_movie_hdf5 #endif @@ -1216,17 +1297,31 @@ subroutine write_movie_volume_displnorm_hdf5(displ_crust_mantle,displ_inner_core #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + + idummy = size(displ_crust_mantle,kind=4) + idummy = size(displ_inner_core,kind=4) + idummy = size(displ_outer_core,kind=4) + idummy = size(ibool_crust_mantle,kind=4) + idummy = size(ibool_inner_core,kind=4) + idummy = size(ibool_outer_core,kind=4) + + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop #endif end subroutine write_movie_volume_displnorm_hdf5 +! +!------------------------------------------------------------------------------------------------- +! -subroutine write_movie_volume_velnorm_hdf5(veloc_crust_mantle,veloc_inner_core,veloc_outer_core, & + subroutine write_movie_volume_velnorm_hdf5(veloc_crust_mantle,veloc_inner_core,veloc_outer_core, & ibool_crust_mantle,ibool_inner_core,ibool_outer_core) ! outputs norm of velocity: MOVIE_VOLUME_TYPE == 8 @@ -1234,7 +1329,7 @@ subroutine write_movie_volume_velnorm_hdf5(veloc_crust_mantle,veloc_inner_core,v use constants_solver #ifdef USE_HDF5 - use shared_parameters, only: OUTPUT_FILES,H5_COL + use shared_parameters, only: OUTPUT_FILES use specfem_par, only: it, scale_veloc use specfem_par_movie_hdf5 #endif @@ -1370,18 +1465,31 @@ subroutine write_movie_volume_velnorm_hdf5(veloc_crust_mantle,veloc_inner_core,v call h5_close_file_p() #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + + idummy = size(veloc_crust_mantle,kind=4) + idummy = size(veloc_inner_core,kind=4) + idummy = size(veloc_outer_core,kind=4) + idummy = size(ibool_crust_mantle,kind=4) + idummy = size(ibool_inner_core,kind=4) + idummy = size(ibool_outer_core,kind=4) + + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop #endif end subroutine write_movie_volume_velnorm_hdf5 +! +!------------------------------------------------------------------------------------------------- +! - - subroutine write_movie_volume_accelnorm_hdf5(accel_crust_mantle,accel_inner_core,accel_outer_core, & + subroutine write_movie_volume_accelnorm_hdf5(accel_crust_mantle,accel_inner_core,accel_outer_core, & ibool_crust_mantle,ibool_inner_core,ibool_outer_core) ! outputs norm of acceleration: MOVIE_VOLUME_TYPE == 1 @@ -1389,7 +1497,7 @@ subroutine write_movie_volume_accelnorm_hdf5(accel_crust_mantle,accel_inner_core use constants_solver #ifdef USE_HDF5 - use shared_parameters, only: OUTPUT_FILES,H5_COL + use shared_parameters, only: OUTPUT_FILES use specfem_par, only: it, scale_t_inv,scale_veloc use specfem_par_movie_hdf5 #endif @@ -1525,10 +1633,21 @@ subroutine write_movie_volume_accelnorm_hdf5(accel_crust_mantle,accel_inner_core endif #else + ! no HDF5 support - print*, 'Error: HDF5 is not enabled in this version of the code.' - print*, 'Please recompile with the HDF5 option enabled with --with-hdf5' - stop + ! to avoid compiler warnings + integer :: idummy + + idummy = size(accel_crust_mantle,kind=4) + idummy = size(accel_inner_core,kind=4) + idummy = size(accel_outer_core,kind=4) + idummy = size(ibool_crust_mantle,kind=4) + idummy = size(ibool_inner_core,kind=4) + idummy = size(ibool_outer_core,kind=4) + + print *, 'Error: HDF5 is not enabled in this version of the code.' + print *, 'Please recompile with the HDF5 option enabled with --with-hdf5' + stop #endif @@ -1539,6 +1658,7 @@ end subroutine write_movie_volume_accelnorm_hdf5 ! #ifdef USE_HDF5 + subroutine get_conn_for_movie(elm_conn,offset,iNIT,nelems_3dmovie,npoints_3dmovie, & nelems_in_this_region, & num_ibool_3dmovie,mask_ibool_3dmovie,ibool_of_the_section) @@ -1558,7 +1678,7 @@ subroutine get_conn_for_movie(elm_conn,offset,iNIT,nelems_3dmovie,npoints_3dmovi integer, dimension(NGLLX,NGLLY,NGLLZ,nelems_in_this_region),intent(in) :: ibool_of_the_section integer, dimension(9,nelems_3dmovie), intent(out) :: elm_conn ! local parameters - integer :: ispec,ii + integer :: ispec integer,parameter :: cell_type = 9 integer :: iglob1,iglob2,iglob3,iglob4,iglob5,iglob6,iglob7,iglob8 integer :: n1,n2,n3,n4,n5,n6,n7,n8 @@ -1637,6 +1757,7 @@ end subroutine get_conn_for_movie ! !------------------------------------------------------------------------------------------------- ! + #ifdef USE_HDF5 subroutine elm2node_base(array_3dspec, array_1dmovie, nelms, npoints, ibool_of_the_section) @@ -1671,10 +1792,14 @@ end subroutine elm2node_base #endif +! +!------------------------------------------------------------------------------------------------- +! #ifdef USE_HDF5 subroutine write_array3dspec_as_1d_hdf5(dset_name, nelms, npoints, array_3dspec, offset1d, ibool_of_the_section) + use specfem_par use specfem_par_movie_hdf5 @@ -1687,7 +1812,6 @@ subroutine write_array3dspec_as_1d_hdf5(dset_name, nelms, npoints, array_3dspec, integer, dimension(NGLLX,NGLLY,NGLLZ,nelms), intent(in) :: ibool_of_the_section ! local parameters - integer :: i,j,k,ii real(kind=CUSTOM_REAL), dimension(npoints) :: array_1dmovie ! convert 3d array to 1d array @@ -1703,9 +1827,11 @@ end subroutine write_array3dspec_as_1d_hdf5 ! !------------------------------------------------------------------------------------------------- ! + #ifdef USE_HDF5 subroutine write_xdmf_vol_hdf5_one_data(fname_h5, attr_name, dset_name, len_data, target_unit, it_str, value_on_node) + use specfem_par use specfem_par_movie_hdf5 @@ -1737,6 +1863,9 @@ subroutine write_xdmf_vol_hdf5_one_data(fname_h5, attr_name, dset_name, len_data end subroutine write_xdmf_vol_hdf5_one_data +! +!------------------------------------------------------------------------------------------------- +! subroutine write_xdmf_vol_hdf5_header(nelems, nglobs, fname_h5_data_vol_xdmf, target_unit, region_flag) @@ -1815,6 +1944,10 @@ subroutine write_xdmf_vol_hdf5_header(nelems, nglobs, fname_h5_data_vol_xdmf, ta end subroutine write_xdmf_vol_hdf5_header +! +!------------------------------------------------------------------------------------------------- +! + subroutine write_xdmf_vol_hdf5_footer(target_unit) implicit none @@ -1828,6 +1961,9 @@ subroutine write_xdmf_vol_hdf5_footer(target_unit) end subroutine write_xdmf_vol_hdf5_footer +! +!------------------------------------------------------------------------------------------------- +! subroutine write_xdmf_vol_hdf5(npoints_3dmovie, nelems_3dmovie, & npoints_3dmovie_cm, nelems_3dmovie_cm, & @@ -1847,10 +1983,6 @@ subroutine write_xdmf_vol_hdf5(npoints_3dmovie, nelems_3dmovie, & ! local parameters integer :: i, ii character(len=20) :: it_str, movie_prefix - character(len=20) :: nelm_str, nglo_str - character(len=20) :: nelm_str_cm, nglo_str_cm - character(len=20) :: nelm_str_oc, nglo_str_oc - character(len=20) :: nelm_str_ic, nglo_str_ic character(len=MAX_STRING_LEN) :: fname_xdmf_vol, fname_xdmf_vol_oc, fname_xdmf_vol_ic character(len=MAX_STRING_LEN) :: fname_h5_data_vol_xdmf @@ -1885,7 +2017,7 @@ subroutine write_xdmf_vol_hdf5(npoints_3dmovie, nelems_3dmovie, & ! write headers for each dataset ! volume strain - if (MOVIE_VOLUME_TYPE == 1 .OR. MOVIE_VOLUME_TYPE == 2 .OR. MOVIE_VOLUME_TYPE == 3) then + if (MOVIE_VOLUME_TYPE == 1 .or. MOVIE_VOLUME_TYPE == 2 .or. MOVIE_VOLUME_TYPE == 3) then if (MOVIE_VOLUME_TYPE == 1) then movie_prefix = 'E' ! strain else if (MOVIE_VOLUME_TYPE == 2) then @@ -2127,6 +2259,17 @@ subroutine write_xdmf_vol_hdf5(npoints_3dmovie, nelems_3dmovie, & endif ! output_ic + ! to avoid compiler warnings + i = npoints_3dmovie + i = npoints_3dmovie_cm + i = npoints_3dmovie_ic + i = npoints_3dmovie_oc + + i = nelems_3dmovie + i = nelems_3dmovie_cm + i = nelems_3dmovie_ic + i = nelems_3dmovie_oc + end subroutine write_xdmf_vol_hdf5 #endif diff --git a/src/specfem3D/write_output_HDF5.F90 b/src/specfem3D/write_output_HDF5.F90 index c7ac9311c..086ea5800 100644 --- a/src/specfem3D/write_output_HDF5.F90 +++ b/src/specfem3D/write_output_HDF5.F90 @@ -27,26 +27,32 @@ subroutine split_string(input_string, delimiter, part1, part2) - implicit none - character(len=*), intent(in) :: input_string - character(len=*), intent(in) :: delimiter - character(len=*), intent(out) :: part1 - character(len=*), intent(out) :: part2 - integer :: delim_pos - - ! Find the position of the delimiter - delim_pos = index(input_string, delimiter) - - ! Split the string at the delimiter - if (delim_pos > 0) then - part1 = input_string(1:delim_pos-1) - part2 = input_string(delim_pos+1:) - else - part1 = input_string - part2 = '' - end if + + implicit none + character(len=*), intent(in) :: input_string + character(len=*), intent(in) :: delimiter + character(len=*), intent(out) :: part1 + character(len=*), intent(out) :: part2 + integer :: delim_pos + + ! Find the position of the delimiter + delim_pos = index(input_string, delimiter) + + ! Split the string at the delimiter + if (delim_pos > 0) then + part1 = input_string(1:delim_pos-1) + part2 = input_string(delim_pos+1:) + else + part1 = input_string + part2 = '' + endif + end subroutine split_string +! +!------------------------------------------------------------------------------------------------- +! + #ifdef USE_HDF5 subroutine write_hdf5_seismogram_init(nlength_total_seismogram) @@ -65,7 +71,7 @@ subroutine write_hdf5_seismogram_init(nlength_total_seismogram) ! local parameters integer :: i,irec,ier integer, intent(in) :: nlength_total_seismogram - integer :: nrec_total + real(kind=CUSTOM_REAL), dimension(:), allocatable :: time_array real(kind=CUSTOM_REAL), dimension(:), allocatable :: rec_dists ! store the distances character(len=MAX_LENGTH_STATION_NAME), dimension(:), allocatable :: stations @@ -110,8 +116,8 @@ subroutine write_hdf5_seismogram_init(nlength_total_seismogram) else ! adjoint simulation: backward/reconstructed wavefields time_array(i) = real( dble((NSTEP-i)*NTSTEP_BETWEEN_OUTPUT_SAMPLE) * DT - t0, kind=CUSTOM_REAL) - end if - end do + endif + enddo ! write the time dataset call h5_write_dataset_no_group('time',time_array) @@ -129,12 +135,12 @@ subroutine write_hdf5_seismogram_init(nlength_total_seismogram) status='unknown',action='read',iostat=ier) if (ier /= 0) then stop 'Error: write_hdf5_seismogram_init: error opening output_list_stations.txt' - end if + endif ! skip the header (3 lines) do i = 1,n_header_lines read(IOUT,*) - end do + enddo ! read the station information ! each line includes: network.station dummy dummy dist dummy @@ -146,7 +152,7 @@ subroutine write_hdf5_seismogram_init(nlength_total_seismogram) if (ier /= 0) stop 'Error: write_hdf5_seismogram_init: error reading output_list_stations.txt' read(line, *) tmpstr, dummy, dummy, rec_dists(irec), dummy call split_string(trim(tmpstr), '.', networks(irec), stations(irec)) - end do + enddo close(IOUT) @@ -163,9 +169,12 @@ subroutine write_hdf5_seismogram_init(nlength_total_seismogram) end subroutine write_hdf5_seismogram_init - #endif +! +!------------------------------------------------------------------------------------------------- +! + subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientation) use specfem_par, only: & @@ -175,7 +184,7 @@ subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientat #ifdef USE_HDF5 use specfem_par, only: & myrank, seismo_current, nrec, & - ROTATE_SEISMOGRAMS_RT, NTSTEP_BETWEEN_OUTPUT_SAMPLE, & + NTSTEP_BETWEEN_OUTPUT_SAMPLE, & WRITE_SEISMOGRAMS_BY_MAIN, hdf5_seismo_fname use shared_parameters, only: & NSTEP, OUTPUT_SEISMOS_HDF5 @@ -193,10 +202,9 @@ subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientat real(kind=CUSTOM_REAL), dimension(nlength_seismogram,1) :: seismogram_tmp logical, save :: is_initialized = .false. - integer :: i, ier, nlength_total_seismogram + integer :: i, nlength_total_seismogram logical :: if_dataset_exists - ! check if anything to do if (.not. OUTPUT_SEISMOS_HDF5) return @@ -206,20 +214,25 @@ subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientat ! total length of the seismogram nlength_total_seismogram = NSTEP / NTSTEP_BETWEEN_OUTPUT_SAMPLE - print*, 'nlength_total_seismogram = ', nlength_total_seismogram - print*, 'NSTEP = ', NSTEP - print*, 'NTSTEP_BETWEEN_OUTPUT_SAMPLE = ', NTSTEP_BETWEEN_OUTPUT_SAMPLE - print*, 'nrec = ', nrec - print*, 'irec = ', irec - print*, 'seismo_current = ', seismo_current - print*, 'shape(seismogram_tmp) = ', shape(seismogram_tmp) - print*, 'shape(seismogram_tmp(iorientation,1:seismo_current)) = ', shape(seismogram_tmp(iorientation,1:seismo_current)) + + ! debug + if (myrank == 0) then + print *, '*** HDF5 seismogram outputs: station irec = ',irec,'***' + print *, ' nlength_total_seismogram = ', nlength_total_seismogram + print *, ' NSTEP = ', NSTEP + print *, ' NTSTEP_BETWEEN_OUTPUT_SAMPLE = ', NTSTEP_BETWEEN_OUTPUT_SAMPLE + print *, ' nrec = ', nrec + print *, ' irec = ', irec, 'irec_local = ', irec_local + print *, ' seismo_current = ', seismo_current + print *, ' shape(seismogram_tmp) = ', shape(seismogram_tmp) + print *, ' shape(seismogram_tmp(iorientation,1:seismo_current)) = ', shape(seismogram_tmp(iorientation,1:seismo_current)) + print * + endif + ! convert array with shape (seimo_current) to (nlength_total_seismogram, 1) do i = 1, seismo_current seismogram_tmp(i,1) = seismogram_tmp_in(iorientation,i) - end do - - + enddo ! initialize if (.not. is_initialized) then @@ -248,6 +261,17 @@ subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientat call h5_close_file() #else + ! no HDF5 support + + ! to avoid compiler warnings + integer :: idummy + + idummy = iorientation + idummy = len_trim(chn) + + idummy = irec + idummy = irec_local + idummy = size(seismogram_tmp_in,kind=4) write(*,*) 'Error: HDF5 support not enabled in this version of Specfem3D_Globe' write(*,*) 'Please recompile with the --with-hdf5 option' @@ -255,4 +279,4 @@ subroutine write_output_hdf5(seismogram_tmp_in, irec_local, irec, chn, iorientat #endif - end subroutine write_output_hdf5 \ No newline at end of file + end subroutine write_output_hdf5 diff --git a/src/specfem3D/write_seismograms.f90 b/src/specfem3D/write_seismograms.f90 index bd2542eb0..f5930dacd 100644 --- a/src/specfem3D/write_seismograms.f90 +++ b/src/specfem3D/write_seismograms.f90 @@ -690,6 +690,8 @@ subroutine write_one_seismogram(one_seismogram,irec,irec_local,ftype_flag,compon ! initializes seismogram_tmp(:,:) = 0.0_CUSTOM_REAL + is_for_asdf = .false. + is_for_hdf5 = .false. ! check file type if (ftype_flag == 0) then