From 8cc2623148345290c58da28392e4367415d3319d Mon Sep 17 00:00:00 2001 From: weng Date: Mon, 22 Apr 2024 12:58:36 +0800 Subject: [PATCH 01/56] Refine TWF by adding indepent mus and mud Add a special kind of TWF for TPV benchmarks Revise a bug in special TWF minor changes small bug Update 06_fault_sources.tex in user manual --- doc/USER_MANUAL/06_fault_sources.tex | 13 +++- my_mpi.mod | Bin 0 -> 11109 bytes src/specfem3D/fault_solver_common.f90 | 2 +- src/specfem3D/fault_solver_dynamic.f90 | 88 ++++++++++++++++++------- 4 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 my_mpi.mod diff --git a/doc/USER_MANUAL/06_fault_sources.tex b/doc/USER_MANUAL/06_fault_sources.tex index ce7ad619f..7018ade7b 100644 --- a/doc/USER_MANUAL/06_fault_sources.tex +++ b/doc/USER_MANUAL/06_fault_sources.tex @@ -246,8 +246,8 @@ \section{Input Files} followed by (n1+n2+n3) \&\textbf{DIST2D} blocks\newline -\&\textbf{SWF} mus, mud, dc {[}, nmus, nmud, ndc{]} (weakening\_kind=1 for linear (default); weakening\_kind=2 for exponential) /\newline -\&\textbf{TWF} nuc\_x, nuc\_y, nuc\_z, nuc\_r, nuc\_t0, nuc\_v /\newline +\&\textbf{SWF} mus, mud, dc {[}, nmus, nmud, ndc{]} (weakening\_kind=1 for linear (default); weakening\_kind=2 for exponential; weakening\_kind=3 for power-law with p) /\newline +\&\textbf{TWF} nuc\_x, nuc\_y, nuc\_z, nuc\_r, nuc\_t0, nuc\_v, mus, mud, kind /\newline \&\textbf{RSF} V0,f0,a,b,L,V\_init,theta\_init,C,StateLaw {[} nV0,nf0,na,nb,nL,nV\_init,ntheta\_init,nC {]} /\newline @@ -315,8 +315,12 @@ \section{Input Files} \item [{ndc}] = number of heterogeneous items for critical slip-weakening distance {[}default is 0{]} \item [{nC}] = number of heterogeneous items for cohesion +\item [{p}] = power-law coefficient (Chambon et al., 2006) +{[}default is 1{]} \item [{weakening\_kind}] = 1 for linear slip-weakening law (default); 2 for exponential slip-weakening law: - $$\mu = \mu_d + (\mu_s-\mu_d) exp(-\frac{u}{d_c}) $$ + $$\mu = \mu_d + (\mu_s-\mu_d) exp(-\frac{u}{d_c}) $$; + 3 for power-law slip-weakening law: + $$\mu = \mu_d + (\mu_s-\mu_d) (1+\frac{u}{p d_c})^{-p} $$ \end{description} \item [{\&\textbf{TWF}}] input block sets the time-weakening friction parameters @@ -328,6 +332,9 @@ \section{Input Files} \item [{nuc\_r}] = the radius of time-weakening nucleation (in m) \item [{nuc\_t0}] = the cohesive time. The friction linearly decreases from static friction to dynamic friction during this time (in s) \item [{nuc\_v}] = the time-weakening nucleation speed (in m/s) +\item [{mus}] = constant static friction coefficient for TWF +\item [{mud}] = constant dynamic friction coefficient for TWF +\item [{kind}] = 1 for regular TWF (default); 2 for TWF in TPV22* benchmarks \end{description} \item [{\&\textbf{RSF}}] input block sets the rate and state friction parameters diff --git a/my_mpi.mod b/my_mpi.mod new file mode 100644 index 0000000000000000000000000000000000000000..1c9828043e89a97b04a22c4106ce9db2f84d8fa7 GIT binary patch literal 11109 zcmcJVOKenC9LCRBpn&CBc@#ye15`xX(kc&MbZDm!nOA3~G>E3DSk%~{0TbQ1CN6ZP z!MHFXtPEkHaphyl!i}z6Dv3K26Jv}qZ2Z1+@9CX6kDhxj<0S1p)Beu)|L%A1J#+54 z(<5@?>Rut{gb;6@7#SWNJ}K@;yLT;q#jla!k)wmh28a3f`qy`txFy3^F53KWzc=* z7G10D+|p_xRdmM0Tl zMKTkfNTJrFOVDvF$E)SC=*gfOozgzl&@?u~i4dMNwg8c7Y(pb74R&@O$oZLyyyQYf zX~ZiUn#Fc0>dB%Pkj!ES8lkq?*=c)nrc@LUWKg9OziMb2JEf{8ja`6b8hvPlroqlm z-{oSXQJ5-<-5G>wCY5k#CVQl?CzA&O$xN6>XeR9Jv|g;&rwf&dQn4-`%Ag&2af~3E zc4#sWOW&Sk_5qT~Jd(jZJ3Et^s#oV~q8~tL;IxuLHZ+e%rK~59JRq3|)kBT5v(xxQ zp;>62s};rm49d~II?j_e<d2)bu2A z7?4cj2{b~_4|aCC&OA@06TfO`8b_q6CyhZsGL0cLLepSpr|)~2r_xL+;m}OvU7c@c zb`-T`CL?HsX2Q-+>zU`NbmCVHO=DE5dd`q10m(F;LL)Q{c6R#CI!~n$uV`o%$E2ty zi{pS~7AMdM&4QhswlmLD>BO%Zn#M_~>Ph2iKr)SI&IVH6{$&3M#$rR8Cb_9# z)|1CLAeqMm8licxv(tFnY%)}tZqg}-rc#v3o>V3Q$yBD$2=&g+PVX7#sr2E~Y+D#j zvD!H;HFLe)aw|k=|CxL2|AN*(T3d_FaFY|cv6i=blk;ojaGi3`u3@X&*e)K_azsVA?P?PM_36uSij^AV%V5mv< z>4Zrxi=;}j0xZ-d`*gx2m$XuutO5%)$v&Mh$%V*NCTqY#O|nlXOv2N;?p`*gx2AJL>b+znu%CfTPGCZoYS#W>l_V3K`oCb5QB zFXb;@lI!%h@oo%1{EXtWPR=sA@fq+6wtR7sr8s+-&jrV;l}58rX*L8GlimPy7Td)Y z=l~u|TEOp35RWZ2kRNe7;7pZ`S2K*tT)KG|+_|{&3TG)!_D3sg*5_^?>PqT!<-jP; z-TnZO+U*FkR3>=G1kJMi&^(SaLhUwg(T%E%<{FqeY#Fv>EJexvVQ^+m?&|p3q$Y2L zjiTIx8-UcVMv$c{!Mi4CmZiN}Jj+$P8sBpom3h>@1gDPh3TG)!wg;0HlQruf2D=1S z)lcs43=3QiyAAXuY?*i~YH>k4zutkHMh*ghAGk6iZ>J0oTwA>ZY93p9h$%~Xk|#Ep zq*O+vKvbu3GiXQ>^C%_l6W$^^G)F*sqqZKwSzG-PY2N~-3UWL%uQ6u0ttUC%W6DyNLzP*a0q)zBoW%)f zsZaPlJ8W9u&i@2hS>S+W*5@vbZccVSrYyxtUbT>BWezgGfK-(+XqknXP+?2k$Ogz# zm*B@HXqM#;{|-=<<*;Se8+_XKhkPKU>FO>K-Hq773<%Riby)+?ss(i94H(9MOoE|UWi%-=2 zc~y3%(!|qzUh=yzt9}_CjV%ZF2s*$G7BDoJhx{8&Q5{PS9R=El zd(u{2g*w!^UyJC{>Q|nonlw-S?=)%2Idr*;>-yStlS@$(=d+ayfLnbhu%iOc?=Q3p z@i3yvkAPgir(HfK9ooEbYv|FM3P({*m~)<+nlLekD#zu&HC22hXrjEn>iF_VYZ#y$ znsoXp=vJpZ#Whhn{YMie=1^s}r?3Lksv3VFYr@R-Gmx!rW745b$G>UXoM~vnbX?fm JE=)ikV literal 0 HcmV?d00001 diff --git a/src/specfem3D/fault_solver_common.f90 b/src/specfem3D/fault_solver_common.f90 index 85198cee8..aac349303 100644 --- a/src/specfem3D/fault_solver_common.f90 +++ b/src/specfem3D/fault_solver_common.f90 @@ -67,7 +67,7 @@ module fault_solver_common end type swf_type type twf_type - real(kind=CUSTOM_REAL) :: nuc_x, nuc_y, nuc_z, nuc_r, nuc_t0, nuc_v + real(kind=CUSTOM_REAL) :: nuc_x,nuc_y,nuc_z,nuc_r,nuc_t0,nuc_v,mus,mud,kind end type twf_type diff --git a/src/specfem3D/fault_solver_dynamic.f90 b/src/specfem3D/fault_solver_dynamic.f90 index 2ae63c68c..ed33b7d42 100644 --- a/src/specfem3D/fault_solver_dynamic.f90 +++ b/src/specfem3D/fault_solver_dynamic.f90 @@ -996,6 +996,7 @@ subroutine BC_DYNFLT_set3d(bc,MxA,V,D,iflt) real(kind=CUSTOM_REAL) :: deltat,half_dt,timeval integer :: i,ipoin,iglob,ipass real(kind=CUSTOM_REAL) :: nuc_x, nuc_y, nuc_z, nuc_r, nuc_t0, nuc_v, dist, tw_r, coh_size + real(kind=CUSTOM_REAL) :: temp_T ! note: this implementation follows the description in: ! - rate and state friction: @@ -1108,18 +1109,32 @@ subroutine BC_DYNFLT_set3d(bc,MxA,V,D,iflt) nuc_r = bc%twf%nuc_r nuc_t0 = bc%twf%nuc_t0 nuc_v = bc%twf%nuc_v - do i = 1,bc%nglob - dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 - if (dist <= nuc_r) then - tw_r = timeval * nuc_v - coh_size = nuc_t0 * nuc_v - if (dist <= tw_r - coh_size) then - bc%mu(i) = min(bc%mu(i), bc%swf%mud(i)) - else if (dist > tw_r - coh_size .and. dist <= tw_r ) then - bc%mu(i) = min(bc%mu(i), bc%swf%mud(i) + (dist-(tw_r-coh_size))/coh_size*(bc%swf%mus(i)-bc%swf%mud(i))) + if(bc%twf%kind==1) then + do i = 1,bc%nglob + dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 + if (dist < nuc_r) then + tw_r = timeval * nuc_v + coh_size = nuc_t0 * nuc_v + if (dist <= tw_r - coh_size) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud) + else if (dist > tw_r - coh_size .and. dist <= tw_r ) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud + (dist-(tw_r-coh_size))/coh_size*(bc%twf%mus-bc%twf%mud)) + endif endif - endif - enddo + enddo + elseif(bc%twf%kind==2) then + do i = 1,bc%nglob + dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 + if (dist < nuc_r) then + temp_T = dist/0.7/3464 + 0.081*nuc_r/0.7/3464*(1/(1-(dist/nuc_r)**2)-1) + if (timeval >= temp_T+nuc_t0) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud) + else if (timeval>=temp_T .and. timeval tw_r - coh_size .and. dist <= tw_r ) then - bc%mu(i) = min(bc%mu(i), bc%swf%mud(i) + (dist-(tw_r-coh_size))/coh_size*(bc%swf%mus(i)-bc%swf%mud(i))) + if(bc%twf%kind==1) then + do i = 1,bc%nglob + dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 + if (dist < nuc_r) then + tw_r = timeval * nuc_v + coh_size = nuc_t0 * nuc_v + if (dist <= tw_r - coh_size) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud) + else if (dist > tw_r - coh_size .and. dist <= tw_r ) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud + (dist-(tw_r-coh_size))/coh_size*(bc%twf%mus-bc%twf%mud)) + endif endif - endif - enddo + enddo + elseif(bc%twf%kind==2) then + do i = 1,bc%nglob + dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 + if (dist < nuc_r) then + temp_T = dist/0.7/3464 + 0.081*nuc_r/0.7/3464*(1/(1-(dist/nuc_r)**2)-1) + if (timeval >= temp_T+nuc_t0) then + bc%mu(i) = min(bc%mu(i), bc%twf%mud) + else if (timeval>=temp_T .and. timeval Date: Thu, 21 Mar 2024 15:47:10 +0100 Subject: [PATCH 02/56] updates error messages --- .../pml_set_local_dampingcoeff.f90 | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/generate_databases/pml_set_local_dampingcoeff.f90 b/src/generate_databases/pml_set_local_dampingcoeff.f90 index 390deba23..c7809b782 100644 --- a/src/generate_databases/pml_set_local_dampingcoeff.f90 +++ b/src/generate_databases/pml_set_local_dampingcoeff.f90 @@ -383,7 +383,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif ! stores damping profiles and auxiliary coefficients at the C-PML element's GLL points - if (alpha_x < ZERO) stop "there is error in mesh of CPML-layer x" + if (alpha_x < ZERO) & + stop "there is an alpha error in mesh of CPML-layer x" K_store_x(i,j,k,ispec_CPML) = K_x d_store_x(i,j,k,ispec_CPML) = d_x @@ -438,7 +439,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif ! stores damping profiles and auxiliary coefficients at the C-PML element's GLL points - if (alpha_y < ZERO) stop "there is error in mesh of CPML-layer y" + if (alpha_y < ZERO) & + stop "there is an alpha error in mesh of CPML-layer y" K_store_x(i,j,k,ispec_CPML) = ONE d_store_x(i,j,k,ispec_CPML) = ZERO @@ -497,7 +499,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif ! stores damping profiles and auxiliary coefficients at the C-PML element's GLL points - if (alpha_z < ZERO) stop "there is error in mesh of CPML-layer z" + if (alpha_z < ZERO) & + stop "there is an alpha error in mesh of CPML-layer z" K_store_x(i,j,k,ispec_CPML) = ONE d_store_x(i,j,k,ispec_CPML) = ZERO @@ -644,7 +647,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif ! stores damping profiles and auxiliary coefficients at the C-PML element's GLL points - if (alpha_x < ZERO .or. alpha_y < ZERO) stop "there is error in mesh of CPML-layer xy" + if (alpha_x < ZERO .or. alpha_y < ZERO) & + stop "there is an alpha error in mesh of CPML-layer xy" K_store_x(i,j,k,ispec_CPML) = K_x d_store_x(i,j,k,ispec_CPML) = d_x @@ -795,7 +799,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif ! stores damping profiles and auxiliary coefficients at the C-PML element's GLL points - if (alpha_x < ZERO .or. alpha_z < ZERO) stop "there is error in mesh of CPML-layer xz" + if (alpha_x < ZERO .or. alpha_z < ZERO) & + stop "there is an alpha error in mesh of CPML-layer xz" K_store_x(i,j,k,ispec_CPML) = K_x d_store_x(i,j,k,ispec_CPML) = d_x @@ -946,7 +951,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif !! DK DK define an alias for y and z variable names (which are the same) - if (alpha_y < ZERO .or. alpha_z < ZERO) stop "there is error in mesh of CPML-layer yz" + if (alpha_y < ZERO .or. alpha_z < ZERO) & + stop "there is an alpha error in mesh of CPML-layer yz" K_store_x(i,j,k,ispec_CPML) = ONE d_store_x(i,j,k,ispec_CPML) = ZERO @@ -1354,7 +1360,8 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif !! DK DK define an alias for y and z variable names (which are the same) - if (alpha_x < ZERO .or. alpha_y < ZERO .or. alpha_z < ZERO) stop "there is error in mesh of CPML-layer xyz" + if (alpha_x < ZERO .or. alpha_y < ZERO .or. alpha_z < ZERO) & + stop "there is an alpha error in mesh of CPML-layer xyz" K_store_x(i,j,k,ispec_CPML) = K_x d_store_x(i,j,k,ispec_CPML) = d_x @@ -1534,7 +1541,7 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) endif if (abs(beta_z - alpha_x) < min_distance_between_CPML_parameter) then - stop 'there is an error in the separation of beta_z and alpha_z' + stop 'there is an error in the separation of beta_z and alpha_x' endif d_x = (beta_x - alpha_x) * K_x From f28355576dddbcff42e5b6a1bf9056088e4eafbc Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 21 Mar 2024 16:19:01 +0100 Subject: [PATCH 03/56] cleans code formatting --- setup/config.fh.in | 4 +- src/auxiliaries/combine_surf_data.f90 | 2 +- .../combine_vol_data_vtk_binary.F90 | 4 +- .../convolve_source_timefunction.f90 | 2 +- .../create_movie_shakemap_AVS_DX_GMT.f90 | 8 +- src/check_mesh_quality/check_mesh_quality.f90 | 52 +-- src/decompose_mesh/fault_scotch.f90 | 12 +- src/decompose_mesh/module_database.f90 | 16 +- src/decompose_mesh/module_mesh.f90 | 10 +- src/decompose_mesh/module_partition.f90 | 8 +- .../part_decompose_mesh_hdf5.F90 | 4 +- src/decompose_mesh/partition_scotch.F90 | 2 +- .../program_decompose_mesh_mpi.f90 | 20 +- .../create_regions_mesh.f90 | 8 +- src/generate_databases/finalize_databases.f90 | 2 +- .../get_coupling_surfaces.f90 | 16 +- src/generate_databases/get_perm_color.f90 | 88 ++-- src/generate_databases/model_1d_prem.f90 | 250 +++++------ src/generate_databases/model_1d_socal.f90 | 24 +- .../model_external_values.F90 | 2 +- src/generate_databases/model_ipati.f90 | 2 +- src/generate_databases/model_sep.f90 | 36 +- .../pml_set_local_dampingcoeff.f90 | 10 +- .../save_arrays_solver_hdf5.F90 | 68 +-- .../adjoint_source/adjoint_source_mod.f90 | 4 +- ...nstantaneous_phase_envelope_misfit_mod.f90 | 34 +- .../adjoint_source/rotations_mod.f90 | 4 +- .../adjoint_source/signal_processing_mod.f90 | 48 +-- .../elastic_tensor_tools_mod.f90 | 12 +- .../input_output/IO_model_mod.f90 | 70 ++-- .../input_output/Teleseismic_IO.f90 | 6 +- .../input_output/input_output_mod.f90 | 44 +- .../input_output/interpolation_mod.f90 | 66 +-- .../input_output/mesh_tools_mod.f90 | 54 +-- .../passive_imaging_format_mod.f90 | 70 ++-- .../inversion_scheme/PrecondFWI_mod.f90 | 26 +- .../inversion_scheme/family_parameter_mod.f90 | 4 +- .../inversion_scheme/inversion_scheme_mod.f90 | 12 +- .../inversion_scheme/vti_parameters.f90 | 40 +- .../projection_on_FD_grid_mod.f90 | 82 ++-- .../regularization/regularization_SEM_mod.f90 | 368 ++++++++--------- .../specfem_interface_mod.F90 | 2 +- .../CMT3D/cmt3d/cmt3d_constants.f90 | 2 +- .../CMT3D/cmt3d/cmt3d_sub.f90 | 30 +- .../CMT3D/cmt3d/cmt3d_sub2.f90 | 22 +- .../CMT3D/cmt3d/cmt3d_sub4.f90 | 26 +- .../CMT3D/cmt3d/get_cmt.f90 | 18 +- .../CMT3D/cmt3d/utm_geo.f90 | 16 +- .../CMT3D/grid3d/get_cmt.f90 | 18 +- .../CMT3D/grid3d/grid3d_constants.f90 | 4 +- .../CMT3D/grid3d/grid3d_sub.f90 | 34 +- .../CMT3D/grid3d/grid3d_sub2.f90 | 36 +- .../CMT3D/grid3d/grid3d_sub3.f90 | 8 +- src/meshfem3D/chunk_earth_mesh_mod.f90 | 126 +++--- src/meshfem3D/create_CPML_regions.f90 | 2 +- src/meshfem3D/create_visual_files.f90 | 8 +- src/meshfem3D/define_subregions.f90 | 24 +- src/meshfem3D/determine_cavity.f90 | 18 +- src/meshfem3D/earth_chunk.f90 | 390 +++++++++--------- src/meshfem3D/get_flags_boundaries.f90 | 26 +- src/meshfem3D/save_databases.F90 | 64 +-- src/meshfem3D/save_databases_adios.F90 | 2 +- src/meshfem3D/save_databases_hdf5.F90 | 20 +- src/meshfem3D/store_boundaries.f90 | 14 +- src/shared/check_mesh_resolution.f90 | 8 +- src/shared/define_derivation_matrices.f90 | 24 +- src/shared/define_mass_matrices.f90 | 6 +- src/shared/detect_surface.f90 | 2 +- src/shared/get_attenuation_model.f90 | 46 +-- src/shared/get_element_face.f90 | 24 +- src/shared/get_global.f90 | 8 +- src/shared/get_shape3D.f90 | 40 +- src/shared/gll_library.f90 | 32 +- src/shared/hdf5_manager.F90 | 2 +- src/shared/parallel.f90 | 2 +- src/shared/recompute_jacobian.f90 | 2 +- src/shared/write_VTK_data.f90 | 44 +- src/specfem3D/calendar.f90 | 8 +- src/specfem3D/comp_source_time_function.f90 | 2 +- .../compute_add_sources_acoustic.f90 | 12 +- .../compute_add_sources_viscoelastic.F90 | 12 +- src/specfem3D/compute_boundary_kernel.f90 | 2 +- .../compute_coupling_viscoelastic_po.f90 | 2 +- src/specfem3D/compute_energy.f90 | 52 +-- src/specfem3D/compute_forces_acoustic.F90 | 18 +- .../compute_forces_poro_fluid_part.f90 | 4 +- .../compute_forces_poro_solid_part.f90 | 4 +- src/specfem3D/compute_forces_viscoelastic.F90 | 42 +- src/specfem3D/convert_time.f90 | 50 +-- src/specfem3D/couple_with_injection.f90 | 4 +- src/specfem3D/create_color_image.f90 | 54 +-- src/specfem3D/fault_solver_common.f90 | 8 +- src/specfem3D/fault_solver_dynamic.f90 | 10 +- src/specfem3D/fault_solver_kinematic.f90 | 2 +- src/specfem3D/gravity_perturbation.f90 | 56 +-- src/specfem3D/locate_MPI_slice.f90 | 2 +- src/specfem3D/locate_source.F90 | 2 +- src/specfem3D/make_gravity.f90 | 238 +++++------ src/specfem3D/noise_tomography.f90 | 4 +- .../pml_compute_accel_contribution.f90 | 12 +- .../pml_compute_memory_variables.f90 | 24 +- src/specfem3D/prepare_attenuation.f90 | 6 +- src/specfem3D/prepare_gravity.f90 | 6 +- src/specfem3D/setup_sources_receivers.f90 | 6 +- src/specfem3D/vtk_window.F90 | 2 +- src/specfem3D/write_movie_output.F90 | 6 +- src/specfem3D/write_movie_output_HDF5.F90 | 6 +- src/tomography/compute_kernel_integral.f90 | 18 +- src/tomography/model_update.f90 | 26 +- .../clip_sem.f90 | 10 +- .../combine_sem.f90 | 4 +- .../smooth_sem.F90 | 10 +- src/tomography/save_external_bin_m_up.f90 | 6 +- src/tomography/sum_kernels.f90 | 2 +- src/tomography/sum_preconditioned_kernels.f90 | 2 +- 115 files changed, 1739 insertions(+), 1739 deletions(-) diff --git a/setup/config.fh.in b/setup/config.fh.in index 81eba8174..008a15d9d 100644 --- a/setup/config.fh.in +++ b/setup/config.fh.in @@ -98,9 +98,9 @@ ! switches do-loops between: do k=1,NGLLZ; do j=1,NGLLY; do i=1,NGLLX <-> do ijk=1,NGLLCUBE #ifdef FORCE_VECTORIZATION -# define DO_LOOP_IJK do ijk=1,NGLLCUBE +# define DO_LOOP_IJK do ijk = 1,NGLLCUBE #else -# define DO_LOOP_IJK do k=1,NGLLZ; do j=1,NGLLY; do i=1,NGLLX +# define DO_LOOP_IJK do k = 1,NGLLZ; do j = 1,NGLLY; do i = 1,NGLLX #endif ! switches enddo-loops between: enddo; enddo; enddo ! NGLLZ,NGLLY,NGLLX <-> enddo ! NGLLCUBE diff --git a/src/auxiliaries/combine_surf_data.f90 b/src/auxiliaries/combine_surf_data.f90 index 2fdb6cf75..6edc1349a 100644 --- a/src/auxiliaries/combine_surf_data.f90 +++ b/src/auxiliaries/combine_surf_data.f90 @@ -372,7 +372,7 @@ program combine_surf_data numpoin = 0 mask_ibool = .false. - do ispec_surf=1,nspec_surf + do ispec_surf = 1,nspec_surf ispec = ibelm_surf(ispec_surf) k = 1 do j = 1, NGLLY, iny diff --git a/src/auxiliaries/combine_vol_data_vtk_binary.F90 b/src/auxiliaries/combine_vol_data_vtk_binary.F90 index cadcc9084..c244c0aa3 100644 --- a/src/auxiliaries/combine_vol_data_vtk_binary.F90 +++ b/src/auxiliaries/combine_vol_data_vtk_binary.F90 @@ -275,7 +275,7 @@ program combine_vol_data_vtk_binary allocate(celltype(nee),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1163') - celltype=12 + celltype = 12 call write_unstructured_mesh(mesh_file,len_trim(mesh_file), 1, npp, pts, nee, celltype, conn, & filename,len_trim(filename),total_dat) @@ -588,7 +588,7 @@ subroutine cvd_write_GLL_points_binary(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zst mask_ibool(:) = .false. numpoin = 0 - do ispec=1,NSPEC_AB + do ispec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX diff --git a/src/auxiliaries/convolve_source_timefunction.f90 b/src/auxiliaries/convolve_source_timefunction.f90 index dedb84eab..17949a59c 100644 --- a/src/auxiliaries/convolve_source_timefunction.f90 +++ b/src/auxiliaries/convolve_source_timefunction.f90 @@ -128,7 +128,7 @@ program convolve_source_time_function ! compute number of samples to remove from end of seismograms number_remove = N_j + 1 - do i=1,nlines - number_remove + do i = 1,nlines - number_remove write(*,*) sngl(timeval(i)),' ',sngl(sem_fil(i)) enddo diff --git a/src/auxiliaries/create_movie_shakemap_AVS_DX_GMT.f90 b/src/auxiliaries/create_movie_shakemap_AVS_DX_GMT.f90 index c2ceca206..b05059113 100644 --- a/src/auxiliaries/create_movie_shakemap_AVS_DX_GMT.f90 +++ b/src/auxiliaries/create_movie_shakemap_AVS_DX_GMT.f90 @@ -132,7 +132,7 @@ program create_movie_shakemap stop 'error opening moviedata header file' endif ! skips first few lines - do i=1,6 + do i = 1,6 read(IIN,'(a)') line enddo ! line with info, e.g. "integer,parameter :: NSPEC_SURFACE_EXT_MESH = 23855" @@ -703,7 +703,7 @@ program create_movie_shakemap ! output list of points mask_point = .false. ipoin = 0 - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_FOUR_CORNERS_AVS_DX*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_FOUR_CORNERS_AVS_DX @@ -726,7 +726,7 @@ program create_movie_shakemap write(11,*) 'object 2 class array type int rank 1 shape 4 items ',nspectot_AVS_max,' data follows' ! output list of elements - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_FOUR_CORNERS_AVS_DX*(ispec-1) ! four points for each element ibool_number1 = iglob(ieoff + 1) @@ -757,7 +757,7 @@ program create_movie_shakemap ! output data values mask_point = .false. - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_FOUR_CORNERS_AVS_DX*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_FOUR_CORNERS_AVS_DX diff --git a/src/check_mesh_quality/check_mesh_quality.f90 b/src/check_mesh_quality/check_mesh_quality.f90 index 2cb8f49fc..f13be98b1 100644 --- a/src/check_mesh_quality/check_mesh_quality.f90 +++ b/src/check_mesh_quality/check_mesh_quality.f90 @@ -859,9 +859,9 @@ subroutine local_version_of_get_shape3D(dershape3D,xigll,yigll,zigll,NGNOD, & ! *** create 3D shape functions and jacobian ! *** - do i=1,local_NGLLX_always_5 - do j=1,local_NGLLY_always_5 - do k=1,local_NGLLZ_always_5 + do i = 1,local_NGLLX_always_5 + do j = 1,local_NGLLY_always_5 + do k = 1,local_NGLLZ_always_5 xi = xigll(i) eta = yigll(j) @@ -921,15 +921,15 @@ subroutine local_version_of_get_shape3D(dershape3D,xigll,yigll,zigll,NGNOD, & !--- check the shape functions and their derivatives - do i=1,local_NGLLX_always_5 - do j=1,local_NGLLY_always_5 - do k=1,local_NGLLZ_always_5 + do i = 1,local_NGLLX_always_5 + do j = 1,local_NGLLY_always_5 + do k = 1,local_NGLLZ_always_5 sumdershapexi = ZERO sumdershapeeta = ZERO sumdershapegamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD sumdershapexi = sumdershapexi + dershape3D(1,ia,i,j,k) sumdershapeeta = sumdershapeeta + dershape3D(2,ia,i,j,k) sumdershapegamma = sumdershapegamma + dershape3D(3,ia,i,j,k) @@ -972,29 +972,29 @@ subroutine local_version_of_get_shape3D_27(NGNOD,dershape3D,xi,eta,gamma,i,j,k, double precision l1xi,l2xi,l3xi,l1eta,l2eta,l3eta,l1gamma,l2gamma,l3gamma double precision l1pxi,l2pxi,l3pxi,l1peta,l2peta,l3peta,l1pgamma,l2pgamma,l3pgamma - l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 - l3xi=HALF*xi*(xi+ONE) + l1xi = HALF*xi*(xi-ONE) + l2xi = ONE-xi**2 + l3xi = HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF - l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 - l3eta=HALF*eta*(eta+ONE) + l1eta = HALF*eta*(eta-ONE) + l2eta = ONE-eta**2 + l3eta = HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF - l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 - l3gamma=HALF*gamma*(gamma+ONE) + l1gamma = HALF*gamma*(gamma-ONE) + l2gamma = ONE-gamma**2 + l3gamma = HALF*gamma*(gamma+ONE) - l1pgamma=gamma-HALF + l1pgamma = gamma-HALF l2pgamma=-TWO*gamma - l3pgamma=gamma+HALF + l3pgamma = gamma+HALF ! corner nodes @@ -1127,9 +1127,9 @@ subroutine local_version_of_calc_jacobian(xelm,yelm,zelm,dershape3D,found_a_nega ! do i=1,local_NGLLX_always_5 ! for this CPML mesh extrusion routine it is sufficient to test the 8 corners of each element to reduce the cost ! because we just want to detect if the element is flipped or not, and if so flip it back - do k=1,local_NGLLZ_always_5,local_NGLLZ_always_5-1 - do j=1,local_NGLLY_always_5,local_NGLLY_always_5-1 - do i=1,local_NGLLX_always_5,local_NGLLX_always_5-1 + do k = 1,local_NGLLZ_always_5,local_NGLLZ_always_5-1 + do j = 1,local_NGLLY_always_5,local_NGLLY_always_5-1 + do i = 1,local_NGLLX_always_5,local_NGLLX_always_5-1 xxi = ZERO xeta = ZERO @@ -1141,7 +1141,7 @@ subroutine local_version_of_calc_jacobian(xelm,yelm,zelm,dershape3D,found_a_nega zeta = ZERO zgamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD xxi = xxi + dershape3D(1,ia,i,j,k)*xelm(ia) xeta = xeta + dershape3D(2,ia,i,j,k)*xelm(ia) xgamma = xgamma + dershape3D(3,ia,i,j,k)*xelm(ia) diff --git a/src/decompose_mesh/fault_scotch.f90 b/src/decompose_mesh/fault_scotch.f90 index efabaf681..36cc1fd64 100644 --- a/src/decompose_mesh/fault_scotch.f90 +++ b/src/decompose_mesh/fault_scotch.f90 @@ -1112,7 +1112,7 @@ subroutine fault_repartition_parallel(nelmnts, part, nodes_coords, nnodes, nproc ! flag used to decide if we have to re-assign partitions found = .true. - do iflt=1,size(faults) + do iflt = 1,size(faults) e2 = fault_elements_connected(iflt,e1) if (e2 >= 0) then proc2 = part(e2) @@ -1550,7 +1550,7 @@ subroutine write_fault_database_mpi(IIN_database, myrank, nE, glob2loc_elmnt, ip integer :: nspec_fault_1,nspec_fault_2 integer :: inodes(NGNOD2D), node_loc(NGNOD2D) - do iflt=1,size(faults) + do iflt = 1,size(faults) ! get number of fault elements in this partition nspec_fault_1 = count( ipart(faults(iflt)%ispec1) == myrank + 1) nspec_fault_2 = count( ipart(faults(iflt)%ispec2) == myrank + 1) @@ -1567,10 +1567,10 @@ subroutine write_fault_database_mpi(IIN_database, myrank, nE, glob2loc_elmnt, ip ! if no fault element in this partition, move to next fault if (nspec_fault_1 == 0) cycle - do i=1, faults(iflt)%nspec + do i = 1, faults(iflt)%nspec iE = faults(iflt)%ispec1(i) if (ipart(iE) /= myrank +1) cycle - iE_loc=glob2loc_elmnt(iE) + iE_loc = glob2loc_elmnt(iE) inodes = faults(iflt)%inodes1(:,i) do inode = 1, NGNOD2D @@ -1579,10 +1579,10 @@ subroutine write_fault_database_mpi(IIN_database, myrank, nE, glob2loc_elmnt, ip write(IIN_database) iE_loc, node_loc(1:NGNOD2D) enddo - do i=1, faults(iflt)%nspec + do i = 1, faults(iflt)%nspec iE = faults(iflt)%ispec2(i) if (ipart(iE) /= myrank +1) cycle - iE_loc=glob2loc_elmnt(iE) + iE_loc = glob2loc_elmnt(iE) inodes = faults(iflt)%inodes2(:,i) do inode = 1, NGNOD2D diff --git a/src/decompose_mesh/module_database.f90 b/src/decompose_mesh/module_database.f90 index 19505ea3e..e4dc7b1b8 100644 --- a/src/decompose_mesh/module_database.f90 +++ b/src/decompose_mesh/module_database.f90 @@ -178,7 +178,7 @@ subroutine write_database(myrank, ipart, elmnts, nodes_coords, nodes_coords_open if (ier /= 0) call exit_MPI_without_rank('error allocating array 59') do iE_loc = 1, nE_loc iE = iE_loc ! loc2glob_elmnt(iE_loc) - do inode =1, NGNOD + do inode = 1, NGNOD loc_elmnt(inode) = glob2loc_nodes(elmnts(inode, iE)) enddo iE = loc2glob_elmnt(iE_loc) @@ -237,7 +237,7 @@ subroutine write_database(myrank, ipart, elmnts, nodes_coords, nodes_coords_open do i = 1,nE if (ipart(i) == myrank+1) then write(IIN_database) is_CPML(i) - if (is_CPML(i)) ncp=ncp+1 + if (is_CPML(i)) ncp = ncp+1 endif enddo !write(*,*) 'CPML ', myrank, ncp, nspec_cpml_local, nspec_cpml @@ -302,7 +302,7 @@ subroutine write_database(myrank, ipart, elmnts, nodes_coords, nodes_coords_open enddo endif !! on doit inclure ce if dessous ? if (k > 0) then - itype=k + itype = k !! need to update flag for HEX27 if (NGNOD == 27) then if (k == 3) itype=2 !! it's edge @@ -453,7 +453,7 @@ subroutine compute_adjcy_table(myrank, elmnts, nE) integer, intent(in) :: myrank , nE integer, dimension(NGNOD,nE), intent(in) :: elmnts - integer, parameter :: NGNOD_EIGHT_CORNERS=8 + integer, parameter :: NGNOD_EIGHT_CORNERS = 8 integer :: iE, iE_loc integer :: kE, New_element integer :: inode, ivertex @@ -472,13 +472,13 @@ subroutine compute_adjcy_table(myrank, elmnts, nE) if (ier /= 0) call exit_MPI_without_rank('error allocating array 64') allocate(nb_neigh(nE_loc),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 65') - do iE_loc=1,nE_loc !! loop on all element in partition + do iE_loc = 1,nE_loc !! loop on all element in partition iE = loc2glob_elmnt(iE_loc) nb_element_stored = 0 stored_elements(:)=0 do inode = 1, NGNOD_EIGHT_CORNERS !! loop only on the corner of the element ivertex = elmnts(inode,iE_loc) - ivertex_local=glob2loc_nodes(ivertex) + ivertex_local = glob2loc_nodes(ivertex) do kE = 1, nelmnts_by_node(ivertex_local) !! loop on all ivertex connected elements New_element = elmnts_by_node(kE,ivertex_local) call store_new_element(New_element, nb_element_stored, stored_elements) @@ -491,7 +491,7 @@ subroutine compute_adjcy_table(myrank, elmnts, nE) allocate(adjcy(size_adjacency),id_adjcy(0:nE_loc),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 66') id_adjcy(0) = 0 - do iE_loc=1, nE_loc !! loop on all element in partition + do iE_loc = 1, nE_loc !! loop on all element in partition iE = loc2glob_elmnt(iE_loc) nb_element_stored = 0 stored_elements(:)=0 @@ -528,7 +528,7 @@ subroutine store_new_element(new_indx, nb, indx) integer, intent(inout) :: nb integer, dimension(:), intent(inout) :: indx integer :: i - do i=1,nb + do i = 1,nb if (new_indx == indx(i)) return enddo nb = nb + 1 diff --git a/src/decompose_mesh/module_mesh.f90 b/src/decompose_mesh/module_mesh.f90 index 88005d1d2..28b42e49a 100644 --- a/src/decompose_mesh/module_mesh.f90 +++ b/src/decompose_mesh/module_mesh.f90 @@ -359,7 +359,7 @@ subroutine read_mesh_files() ! note: entries in nummaterial_velocity_file can be an unsorted list of all ! defined materials (material_id > 0) and undefined materials (material_id < 0) - do imat=1,count_def_mat + do imat = 1,count_def_mat ! material definitions ! ! format: note that we save the arguments in a slightly different order in mat_prop(:,:) @@ -552,12 +552,12 @@ subroutine read_mesh_files() if (use_poroelastic_file) close(IIN_DB2) close(IIN_DB) - do ispec=1,nspec_glob + do ispec = 1,nspec_glob ! get material_id num_mat = mat(1,ispec) if (num_mat < 0) then ! finds undefined material property - do imat=1,count_undef_mat + do imat = 1,count_undef_mat if (-imat == num_mat) then ! interface if (trim(undef_mat_prop(2,imat)) == 'interface') then @@ -751,7 +751,7 @@ subroutine read_mesh_files() allocate(cpml_regions(nspec_cpml),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 136') if (ier /= 0) stop 'Error allocating array CPML_regions' - do ispec_cpml=1,nspec_cpml + do ispec_cpml = 1,nspec_cpml ! elements are stored with #id_cpml_regions increasing order: ! ! #id_cpml_regions = 1 : X_surface C-PML @@ -773,7 +773,7 @@ subroutine read_mesh_files() if (ier /= 0) call exit_MPI_without_rank('error allocating array 137') if (ier /= 0) stop 'Error allocating array is_CPML' is_CPML(:) = .false. - do ispec_cpml=1,nspec_cpml + do ispec_cpml = 1,nspec_cpml if ((cpml_regions(ispec_cpml) >= 1) .and. (cpml_regions(ispec_cpml) <= 7)) then is_CPML(cpml_to_spec(ispec_cpml)) = .true. endif diff --git a/src/decompose_mesh/module_partition.f90 b/src/decompose_mesh/module_partition.f90 index e3b0c1fcd..3e1bd98cf 100644 --- a/src/decompose_mesh/module_partition.f90 +++ b/src/decompose_mesh/module_partition.f90 @@ -156,7 +156,7 @@ subroutine partition_mesh(elmnts, nodes_coords, load_elmnts, nspec, nnodes, npa call compute_partition(ipart_3, nEipart_3, npart_3, sum_load_3, cri_load_3, & load_elmnts_3, elmnts_center_3, iperm_3, nE_3, ref_point, idir) - do iE=1, nE_3 + do iE = 1, nE_3 p1 = kpart_2 p2 = kpart_3 p3 = ipart_3(iE) @@ -239,7 +239,7 @@ subroutine partition_mesh_distance(elmnts, nodes_coords, nspec, nnodes, npart_1, x_bin = (xmax - xmin)/npart_1 y_bin = (ymax - ymin)/npart_2 z_bin = (zmax - zmin)/npart_3 - do iE=1, nE + do iE = 1, nE p1 = floor((elmnts_center(1,iE)-xmin)/x_bin) + 1 p2 = floor((elmnts_center(2,iE)-ymin)/y_bin) + 1 p3 = floor((elmnts_center(3,iE)-zmin)/z_bin) + 1 @@ -342,7 +342,7 @@ subroutine compute_criteria(cri_load_perm, elmnts_center_tmp, nE_tmp, ref_point, integer :: i - do i=1, nE_tmp + do i = 1, nE_tmp cri_load_perm(i) = abs( elmnts_center_tmp(idir,i) - ref_point(idir) ) enddo @@ -394,7 +394,7 @@ subroutine compute_elmnts_center(elmnts_center, elmnts, nodes_coords, nspec, nno integer :: iE, i elmnts_center(:,:) = 0.d0 - do iE =1, nE + do iE = 1, nE do i = 1, NGNOD elmnts_center(1,iE) = elmnts_center(1,iE) + nodes_coords(1,elmnts(i,iE)) elmnts_center(2,iE) = elmnts_center(2,iE) + nodes_coords(2,elmnts(i,iE)) diff --git a/src/decompose_mesh/part_decompose_mesh_hdf5.F90 b/src/decompose_mesh/part_decompose_mesh_hdf5.F90 index f87a3d215..4bce508e2 100644 --- a/src/decompose_mesh/part_decompose_mesh_hdf5.F90 +++ b/src/decompose_mesh/part_decompose_mesh_hdf5.F90 @@ -521,7 +521,7 @@ subroutine write_cpml_database_h5(iproc, nspec, nspec_cpml, CPML_to_spec, & ! dump mask of C-PML elements for all elements in this partition ! count number of element in this iproc - do i=1,nspec + do i = 1,nspec if (part(i) == iproc) then !write(IIN_database) is_CPML(i) count2 = count2 + 1 @@ -533,7 +533,7 @@ subroutine write_cpml_database_h5(iproc, nspec, nspec_cpml, CPML_to_spec, & if (ier /= 0) stop 'Error allocating array if_cpml' count2 = 1 ! reinitialize counter2 to reuse it below - do i=1,nspec + do i = 1,nspec if (part(i) == iproc) then if (is_CPML(i)) then if_cpml(count2) = 1 diff --git a/src/decompose_mesh/partition_scotch.F90 b/src/decompose_mesh/partition_scotch.F90 index 42f6c8d36..58d68f7a9 100644 --- a/src/decompose_mesh/partition_scotch.F90 +++ b/src/decompose_mesh/partition_scotch.F90 @@ -482,7 +482,7 @@ subroutine remap_partitions(part) enddo ! remap parts, 1 level up. easier to do this as we go up the levels - do ispec=1,nspec + do ispec = 1,nspec if (ispec_p_refine(ispec) == p_level(ilevel + 1)) then part(ispec) = part_remap_inverse(part(ispec)) endif diff --git a/src/decompose_mesh/program_decompose_mesh_mpi.f90 b/src/decompose_mesh/program_decompose_mesh_mpi.f90 index 483c450a8..d96ab9699 100644 --- a/src/decompose_mesh/program_decompose_mesh_mpi.f90 +++ b/src/decompose_mesh/program_decompose_mesh_mpi.f90 @@ -47,7 +47,7 @@ program xdecompose_mesh_mpi ! proc numbers for MPI integer :: myrank,sizeprocs - logical, parameter :: BROADCAST_AFTER_READ=.true. + logical, parameter :: BROADCAST_AFTER_READ = .true. ! number of proc in each direction integer :: npartX, npartY, npartZ @@ -276,7 +276,7 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) integer, intent(in) :: myrank, npart integer, dimension(nspec_glob), intent(in) :: ipart - integer, parameter :: NGNOD_EIGHT_CORNERS=8 + integer, parameter :: NGNOD_EIGHT_CORNERS = 8 integer :: iE, kE, iE_loc, ier, i, j integer :: nE integer :: irank @@ -347,7 +347,7 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) nnodes_in_partition(:)=0 if (myrank == 0 ) then do inode = 1,nnodes_glob - stored_node(:)=.false. + stored_node(:) = .false. do kE = 1,nelmnts_by_node_glob(inode) iE = elmnts_by_node_glob(kE, inode) do irank = 0, npart -1 @@ -393,18 +393,18 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) irank = 0 inode_loc = 0 do inode = 1,nnodes_glob - not_stored=.true. + not_stored = .true. do kE = 1,nelmnts_by_node_glob(inode) iE = elmnts_by_node_glob(kE, inode) if (ipart(iE) == irank +1 .and. not_stored) then - inode_loc=inode_loc+1 + inode_loc = inode_loc+1 elmnts_by_node(:,inode_loc) = elmnts_by_node_glob(:, inode) nelmnts_by_node(inode_loc) = nelmnts_by_node_glob(inode) glob2loc_nodes(inode) = inode_loc loc2glob_nodes(inode_loc) = inode nodes_coords(:,inode_loc) = nodes_coords_glob(:,inode) if (ANY_FAULT) nodes_coords_open_loc(:,inode_loc) = nodes_coords_open(:,inode) - not_stored=.false. + not_stored = .false. endif enddo enddo @@ -431,14 +431,14 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) do kE = 1,nelmnts_by_node_glob(inode) iE = elmnts_by_node_glob(kE, inode) if (ipart(iE) == irank +1 .and. not_stored) then - inode_loc=inode_loc+1 + inode_loc = inode_loc+1 buffer_to_send(:,inode_loc) = elmnts_by_node_glob(:, inode) buffer_to_send1(inode_loc) = nelmnts_by_node_glob(inode) buffer_to_send2(inode_loc) = inode buffer_to_send3(inode) = inode_loc dp_buffer_to_send(:,inode_loc) = nodes_coords_glob(:,inode) if (ANY_FAULT) dp_buffer_to_send_open(:,inode_loc) = nodes_coords_open(:,inode) - not_stored=.false. + not_stored = .false. endif enddo enddo @@ -538,7 +538,7 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) iboundary(:) = -1 i = 0 do iE = 1, nE !! loop over all elements - not_stored=.true. + not_stored = .true. do inode = 1, NGNOD_EIGHT_CORNERS !! loop only on the corner of the element ivertex = elmnts_glob(inode,iE) do j = 1, nelmnts_by_node_glob(ivertex) !! loop on all ivertex connected elements @@ -546,7 +546,7 @@ subroutine send_partition_mesh_to_all(myrank, ipart, npart) if (ipart(iE) /= ipart(kE) .and. not_stored) then i = i + 1 iboundary(iE)=i - not_stored=.false. + not_stored = .false. endif enddo enddo diff --git a/src/generate_databases/create_regions_mesh.f90 b/src/generate_databases/create_regions_mesh.f90 index 9efbaebc5..e09ee313c 100644 --- a/src/generate_databases/create_regions_mesh.f90 +++ b/src/generate_databases/create_regions_mesh.f90 @@ -1460,8 +1460,8 @@ subroutine crm_setup_moho(nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, & ! stores on surface GLL points (assuming NGLLX = NGLLY = NGLLZ) igll = 0 - do j=1,NGLLZ - do i=1,NGLLX + do j = 1,NGLLZ + do i = 1,NGLLX igll = igll+1 ijk_moho_bot(:,igll,ispec2D) = ijk_face(:,i,j) normal_moho_bot(:,igll,ispec2D) = normal_face(:,i,j) @@ -1484,8 +1484,8 @@ subroutine crm_setup_moho(nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, & ! GLL points igll = 0 - do j=1,NGLLZ - do i=1,NGLLX + do j = 1,NGLLZ + do i = 1,NGLLX igll = igll+1 ijk_moho_top(:,igll,ispec) = ijk_face(:,i,j) ! note: top elements have normal pointing into element diff --git a/src/generate_databases/finalize_databases.f90 b/src/generate_databases/finalize_databases.f90 index aecf882d6..7a637d6b9 100644 --- a/src/generate_databases/finalize_databases.f90 +++ b/src/generate_databases/finalize_databases.f90 @@ -214,7 +214,7 @@ subroutine finalize_repartition_info() write(IMAIN,*) write(IMAIN,*) ' load per partition: min/max = ',load_min,load_max write(IMAIN,*) ' load per partition: imbalance = ',load_balance,'%' - write(IMAIN,*)' (0% being totally balanced, 100% being unbalanced)' + write(IMAIN,*) ' (0% being totally balanced, 100% being unbalanced)' write(IMAIN,*) write(IMAIN,*) 'total number of elements in mesh slice 0: ',NSPEC_AB write(IMAIN,*) 'total number of regular elements in mesh slice 0: ',NSPEC_AB - nspec_irregular diff --git a/src/generate_databases/get_coupling_surfaces.f90 b/src/generate_databases/get_coupling_surfaces.f90 index 1be8d0a90..173a3afa5 100644 --- a/src/generate_databases/get_coupling_surfaces.f90 +++ b/src/generate_databases/get_coupling_surfaces.f90 @@ -325,8 +325,8 @@ subroutine get_coupling_surfaces_ac_el(nspec,ibool,elastic_flag) ! normal convention: points away from acoustic, reference element ! switch normal direction if necessary - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX ! directs normals such that they point outwards of element call get_element_face_normal(ispec,iface_ref,xcoord,ycoord,zcoord, & ibool,nspec,nglob_unique, & @@ -343,8 +343,8 @@ subroutine get_coupling_surfaces_ac_el(nspec,ibool,elastic_flag) inum = inum + 1 tmp_ispec(inum) = ispec igll = 0 - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX ! adds all GLL points on this face igll = igll + 1 @@ -362,8 +362,8 @@ subroutine get_coupling_surfaces_ac_el(nspec,ibool,elastic_flag) enddo else ! assumes to be already collected by lower rank process, masks face points - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(ijk_face(1,i,j),ijk_face(2,i,j),ijk_face(3,i,j),ispec) mask_ibool(iglob) = .true. enddo @@ -904,9 +904,9 @@ subroutine get_coupling_surfaces_el_poro(nspec,ibool,elastic_flag) endif ! found_order endif ! if imatch - enddo ! do iface_ref_el=1,6 + enddo ! do iface_ref_el = 1,6 endif ! if (ispec_is_elastic(ispec_el)) then - enddo ! do ispec_el=1,nspec + enddo ! do ispec_el = 1,nspec ! checks if found matching elastic element if (.not. found_elastic_elem) then diff --git a/src/generate_databases/get_perm_color.f90 b/src/generate_databases/get_perm_color.f90 index cfe6adce4..e659ce59c 100644 --- a/src/generate_databases/get_perm_color.f90 +++ b/src/generate_databases/get_perm_color.f90 @@ -147,16 +147,16 @@ subroutine get_color_faster(ibool, is_on_a_slice_edge, ispec_is_d, & nspec_outer = 0 nspec_inner = 0 nspec_domain = 0 - do ispec=1,nspec + do ispec = 1,nspec ! domain elements if (ispec_is_d(ispec)) then ! outer/inner elements if (is_on_a_slice_edge(ispec)) then - nspec_outer=nspec_outer+1 + nspec_outer = nspec_outer+1 else - nspec_inner=nspec_inner+1 + nspec_inner = nspec_inner+1 endif - nspec_domain=nspec_domain+1 + nspec_domain = nspec_domain+1 endif enddo @@ -227,14 +227,14 @@ subroutine get_color_faster(ibool, is_on_a_slice_edge, ispec_is_d, & if (is_on_a_slice_edge(ispec)) then if (color(ispec) == 0) then ! the eight corners of the current element - iglob1=ibool(1,1,1,ispec) - iglob2=ibool(NGLLX,1,1,ispec) - iglob3=ibool(NGLLX,NGLLY,1,ispec) - iglob4=ibool(1,NGLLY,1,ispec) - iglob5=ibool(1,1,NGLLZ,ispec) - iglob6=ibool(NGLLX,1,NGLLZ,ispec) - iglob7=ibool(NGLLX,NGLLY,NGLLZ,ispec) - iglob8=ibool(1,NGLLY,NGLLZ,ispec) + iglob1 = ibool(1,1,1,ispec) + iglob2 = ibool(NGLLX,1,1,ispec) + iglob3 = ibool(NGLLX,NGLLY,1,ispec) + iglob4 = ibool(1,NGLLY,1,ispec) + iglob5 = ibool(1,1,NGLLZ,ispec) + iglob6 = ibool(NGLLX,1,NGLLZ,ispec) + iglob7 = ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob8 = ibool(1,NGLLY,NGLLZ,ispec) if (mask_ibool(iglob1) .or. mask_ibool(iglob2) .or. mask_ibool(iglob3) .or. mask_ibool(iglob4) .or. & mask_ibool(iglob5) .or. mask_ibool(iglob6) .or. mask_ibool(iglob7) .or. mask_ibool(iglob8)) then @@ -293,14 +293,14 @@ subroutine get_color_faster(ibool, is_on_a_slice_edge, ispec_is_d, & if (.not. is_on_a_slice_edge(ispec)) then if (color(ispec) == 0) then ! the eight corners of the current element - iglob1=ibool(1,1,1,ispec) - iglob2=ibool(NGLLX,1,1,ispec) - iglob3=ibool(NGLLX,NGLLY,1,ispec) - iglob4=ibool(1,NGLLY,1,ispec) - iglob5=ibool(1,1,NGLLZ,ispec) - iglob6=ibool(NGLLX,1,NGLLZ,ispec) - iglob7=ibool(NGLLX,NGLLY,NGLLZ,ispec) - iglob8=ibool(1,NGLLY,NGLLZ,ispec) + iglob1 = ibool(1,1,1,ispec) + iglob2 = ibool(NGLLX,1,1,ispec) + iglob3 = ibool(NGLLX,NGLLY,1,ispec) + iglob4 = ibool(1,NGLLY,1,ispec) + iglob5 = ibool(1,1,NGLLZ,ispec) + iglob6 = ibool(NGLLX,1,NGLLZ,ispec) + iglob7 = ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob8 = ibool(1,NGLLY,NGLLZ,ispec) if (mask_ibool(iglob1) .or. mask_ibool(iglob2) .or. mask_ibool(iglob3) .or. mask_ibool(iglob4) .or. & mask_ibool(iglob5) .or. mask_ibool(iglob6) .or. mask_ibool(iglob7) .or. mask_ibool(iglob8)) then @@ -376,14 +376,14 @@ subroutine get_color_faster(ibool, is_on_a_slice_edge, ispec_is_d, & if (ispec_is_d(ispec)) then if (color(ispec) == icolor) then ! the eight corners of the current element - iglob1=ibool(1,1,1,ispec) - iglob2=ibool(NGLLX,1,1,ispec) - iglob3=ibool(NGLLX,NGLLY,1,ispec) - iglob4=ibool(1,NGLLY,1,ispec) - iglob5=ibool(1,1,NGLLZ,ispec) - iglob6=ibool(NGLLX,1,NGLLZ,ispec) - iglob7=ibool(NGLLX,NGLLY,NGLLZ,ispec) - iglob8=ibool(1,NGLLY,NGLLZ,ispec) + iglob1 = ibool(1,1,1,ispec) + iglob2 = ibool(NGLLX,1,1,ispec) + iglob3 = ibool(NGLLX,NGLLY,1,ispec) + iglob4 = ibool(1,NGLLY,1,ispec) + iglob5 = ibool(1,1,NGLLZ,ispec) + iglob6 = ibool(NGLLX,1,NGLLZ,ispec) + iglob7 = ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob8 = ibool(1,NGLLY,NGLLZ,ispec) if (mask_ibool(iglob1) .or. mask_ibool(iglob2) .or. mask_ibool(iglob3) .or. mask_ibool(iglob4) .or. & mask_ibool(iglob5) .or. mask_ibool(iglob6) .or. mask_ibool(iglob7) .or. mask_ibool(iglob8)) then @@ -459,14 +459,14 @@ subroutine count_mesh_valence(ibool,is_on_a_slice_edge,ispec_is_d, & ! outer elements if (is_on_a_slice_edge(ispec)) then ! the eight corners of the current element - iglob1=ibool(1,1,1,ispec) - iglob2=ibool(NGLLX,1,1,ispec) - iglob3=ibool(NGLLX,NGLLY,1,ispec) - iglob4=ibool(1,NGLLY,1,ispec) - iglob5=ibool(1,1,NGLLZ,ispec) - iglob6=ibool(NGLLX,1,NGLLZ,ispec) - iglob7=ibool(NGLLX,NGLLY,NGLLZ,ispec) - iglob8=ibool(1,NGLLY,NGLLZ,ispec) + iglob1 = ibool(1,1,1,ispec) + iglob2 = ibool(NGLLX,1,1,ispec) + iglob3 = ibool(NGLLX,NGLLY,1,ispec) + iglob4 = ibool(1,NGLLY,1,ispec) + iglob5 = ibool(1,1,NGLLZ,ispec) + iglob6 = ibool(NGLLX,1,NGLLZ,ispec) + iglob7 = ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob8 = ibool(1,NGLLY,NGLLZ,ispec) count_ibool(iglob1) = count_ibool(iglob1) + 1 count_ibool(iglob2) = count_ibool(iglob2) + 1 @@ -489,14 +489,14 @@ subroutine count_mesh_valence(ibool,is_on_a_slice_edge,ispec_is_d, & ! inner elements if (.not. is_on_a_slice_edge(ispec)) then ! the eight corners of the current element - iglob1=ibool(1,1,1,ispec) - iglob2=ibool(NGLLX,1,1,ispec) - iglob3=ibool(NGLLX,NGLLY,1,ispec) - iglob4=ibool(1,NGLLY,1,ispec) - iglob5=ibool(1,1,NGLLZ,ispec) - iglob6=ibool(NGLLX,1,NGLLZ,ispec) - iglob7=ibool(NGLLX,NGLLY,NGLLZ,ispec) - iglob8=ibool(1,NGLLY,NGLLZ,ispec) + iglob1 = ibool(1,1,1,ispec) + iglob2 = ibool(NGLLX,1,1,ispec) + iglob3 = ibool(NGLLX,NGLLY,1,ispec) + iglob4 = ibool(1,NGLLY,1,ispec) + iglob5 = ibool(1,1,NGLLZ,ispec) + iglob6 = ibool(NGLLX,1,NGLLZ,ispec) + iglob7 = ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob8 = ibool(1,NGLLY,NGLLZ,ispec) count_ibool(iglob1) = count_ibool(iglob1) + 1 count_ibool(iglob2) = count_ibool(iglob2) + 1 diff --git a/src/generate_databases/model_1d_prem.f90 b/src/generate_databases/model_1d_prem.f90 index 1d1db9413..a4e38e043 100644 --- a/src/generate_databases/model_1d_prem.f90 +++ b/src/generate_databases/model_1d_prem.f90 @@ -130,144 +130,144 @@ subroutine model_1D_prem_iso(xmesh,ymesh,zmesh,rho_prem,vp_prem,vs_prem,qmu_atte ! if (r >= 0.d0 .and. r <= RICB) then drhodr=-2.0d0*8.8381d0*x - rho=13.0885d0-8.8381d0*x*x - vp=11.2622d0-6.3640d0*x*x - vs=3.6678d0-4.4475d0*x*x - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vp = 11.2622d0-6.3640d0*x*x + vs = 3.6678d0-4.4475d0*x*x + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then drhodr=-1.2638d0-2.0d0*3.6426d0*x-3.0d0*5.5281d0*x*x - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x - vs=11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x + vs = 11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! else if (r > R670 .and. r <= R600) then drhodr=-1.4836d0 - rho=5.3197d0-1.4836d0*x - vp=19.0957d0-9.8672d0*x - vs=9.9839d0-4.9324d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 5.3197d0-1.4836d0*x + vp = 19.0957d0-9.8672d0*x + vs = 9.9839d0-4.9324d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R600 .and. r <= R400) then drhodr=-8.0298d0 - rho=11.2494d0-8.0298d0*x - vp=39.7027d0-32.6166d0*x - vs=22.3512d0-18.5856d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 11.2494d0-8.0298d0*x + vp = 39.7027d0-32.6166d0*x + vs = 22.3512d0-18.5856d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then drhodr=-3.8045d0 - rho=7.1089d0-3.8045d0*x - vp=20.3926d0-12.2569d0*x - vs=8.9496d0-4.4597d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 7.1089d0-3.8045d0*x + vp = 20.3926d0-12.2569d0*x + vs = 8.9496d0-4.4597d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R220 .and. r <= R80) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=80.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (CRUSTAL .and. .not. SUPPRESS_CRUSTAL_MESH) then ! fill with PREM mantle and later add CRUST2.0 if (r > R80) then ! density/velocity from mantle just below moho - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x ! shear attenuation for R80 to surface - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else ! use PREM crust if (r > R80 .and. r <= RMOHO) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (SUPPRESS_CRUSTAL_MESH) then !! DK DK extend the Moho up to the surface instead of the crust - drhodr=0.6924d0 + drhodr = 0.6924d0 rho = 2.6910d0+0.6924d0*(RMOHO / R_EARTH) vp = 4.1875d0+3.9382d0*(RMOHO / R_EARTH) vs = 2.1519d0+2.3481d0*(RMOHO / R_EARTH) - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then - drhodr=0.0d0 - rho=2.9d0 - vp=6.8d0 - vs=3.9d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.9d0 + vp = 6.8d0 + vs = 3.9d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! same properties everywhere in PREM crust if we decide to define only one layer in the crust if (ONE_CRUST) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! for density profile for gravity, we do not check that r <= R_EARTH else if (r > ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif endif @@ -303,61 +303,61 @@ subroutine model_1D_PREM_routine_PB(xloc,yloc,zloc,ro_prem,vp_prem,vs_prem,idom) ! local parameters double precision :: r0,r,x_prem - r0=sqrt(xloc**2+yloc**2+zloc**2) - r=r0/1000. + r0 = sqrt(xloc**2+yloc**2+zloc**2) + r = r0/1000. - x_prem=r/6371. ! Radius (normalized to x(surface)=1) + x_prem = r/6371. ! Radius (normalized to x(surface)=1) if (idom == 1) then ! upper crustal layer - ro_prem=2.6 - vp_prem=5.8 - vs_prem=3.2 + ro_prem = 2.6 + vp_prem = 5.8 + vs_prem = 3.2 else if (idom == 2) then - ro_prem=2.9 ! lower crustal layer - vp_prem=6.8 - vs_prem=3.9 + ro_prem = 2.9 ! lower crustal layer + vp_prem = 6.8 + vs_prem = 3.9 else if (idom == 3) then - ro_prem=2.691+.6924*x_prem ! upper mantle - vp_prem=4.1875+3.9382*x_prem - vs_prem=2.1519+2.3481*x_prem + ro_prem = 2.691+.6924*x_prem ! upper mantle + vp_prem = 4.1875+3.9382*x_prem + vs_prem = 2.1519+2.3481*x_prem else if (idom == 4) then - ro_prem=7.1089-3.8045*x_prem - vp_prem=20.3926-12.2569*x_prem - vs_prem=8.9496-4.4597*x_prem + ro_prem = 7.1089-3.8045*x_prem + vp_prem = 20.3926-12.2569*x_prem + vs_prem = 8.9496-4.4597*x_prem else if (idom == 5) then - ro_prem=11.2494-8.0298*x_prem - vp_prem=39.7027-32.6166*x_prem - vs_prem=22.3512-18.5856*x_prem + ro_prem = 11.2494-8.0298*x_prem + vp_prem = 39.7027-32.6166*x_prem + vs_prem = 22.3512-18.5856*x_prem else if (idom == 6) then - ro_prem=5.3197-1.4836*x_prem - vp_prem=19.0957-9.8672*x_prem - vs_prem=9.9839-4.9324*x_prem + ro_prem = 5.3197-1.4836*x_prem + vp_prem = 19.0957-9.8672*x_prem + vs_prem = 9.9839-4.9324*x_prem else if (idom == 7) then !lower mantle - ro_prem=7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 - vp_prem=29.2766-23.6027*x_prem+5.5242*x_prem**2-2.5514*x_prem**3 - vs_prem=22.3459-17.2473*x_prem-2.0834*x_prem**2+0.9783*x_prem**3 + ro_prem = 7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 + vp_prem = 29.2766-23.6027*x_prem+5.5242*x_prem**2-2.5514*x_prem**3 + vs_prem = 22.3459-17.2473*x_prem-2.0834*x_prem**2+0.9783*x_prem**3 else if (idom == 8) then - ro_prem=7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 - vp_prem=24.9520-40.4673*x_prem+51.4832*x_prem**2-26.6419*x_prem**3 - vs_prem=11.1671-13.7818*x_prem+17.4575*x_prem**2-9.2777*x_prem**3 + ro_prem = 7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 + vp_prem = 24.9520-40.4673*x_prem+51.4832*x_prem**2-26.6419*x_prem**3 + vs_prem = 11.1671-13.7818*x_prem+17.4575*x_prem**2-9.2777*x_prem**3 else if (idom == 9) then - ro_prem=7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 - vp_prem=15.3891-5.3181*x_prem+5.5242*x_prem**2-2.5514*x_prem**3 - vs_prem=6.9254+1.4672*x_prem-2.0834*x_prem**2+.9783*x_prem**3 + ro_prem = 7.9565-6.4761*x_prem+5.5283*x_prem**2-3.0807*x_prem**3 + vp_prem = 15.3891-5.3181*x_prem+5.5242*x_prem**2-2.5514*x_prem**3 + vs_prem = 6.9254+1.4672*x_prem-2.0834*x_prem**2+.9783*x_prem**3 else if (idom == 10) then ! outer core - ro_prem=12.5815-1.2638*x_prem-3.6426*x_prem**2-5.5281*x_prem**3 - vp_prem=11.0487-4.0362*x_prem+4.8023*x_prem**2-13.5732*x_prem**3 - vs_prem=0.00 + ro_prem = 12.5815-1.2638*x_prem-3.6426*x_prem**2-5.5281*x_prem**3 + vp_prem = 11.0487-4.0362*x_prem+4.8023*x_prem**2-13.5732*x_prem**3 + vs_prem = 0.00 else if (idom == 11) then ! inner core - ro_prem=13.0885-8.8381*x_prem**2 - vp_prem=11.2622-6.3640*x_prem**2 - vs_prem=3.6678-4.4475*x_prem**2 + ro_prem = 13.0885-8.8381*x_prem**2 + vp_prem = 11.2622-6.3640*x_prem**2 + vs_prem = 3.6678-4.4475*x_prem**2 endif ! print *,'ro,vp,vs passed from routine and not multiplied',ro_prem,vp_prem,vs_prem - ro_prem=ro_prem*1000 - vp_prem=vp_prem*1000 - vs_prem=vs_prem*1000 + ro_prem = ro_prem*1000 + vp_prem = vp_prem*1000 + vs_prem = vs_prem*1000 ! print *,'ro,vp,vs passed from PREM_ROUTINE multiplied by 1000',ro_prem,vp_prem,vs_prem @@ -368,7 +368,7 @@ subroutine model_1D_PREM_routine_PB(xloc,yloc,zloc,ro_prem,vp_prem,vs_prem,idom) ! else if (param=='v_s') then ! prem_sub=vs_prem*1000. ! else - ! write(*,*)'Error in PREM_SUB function:',param,' not an option' + ! write(*,*) 'Error in PREM_SUB function:',param,' not an option' ! stop end subroutine model_1D_PREM_routine_PB diff --git a/src/generate_databases/model_1d_socal.f90 b/src/generate_databases/model_1d_socal.f90 index 8fe4424e4..9a87576e0 100644 --- a/src/generate_databases/model_1d_socal.f90 +++ b/src/generate_databases/model_1d_socal.f90 @@ -61,24 +61,24 @@ subroutine model_1D_socal(xmesh,ymesh,zmesh,rho,vp,vs,qmu_atten,qkappa_atten) ! assigns model parameters if (depth >= 32000.0) then ! moho - vp=7.8_CUSTOM_REAL - vs=4.5_CUSTOM_REAL - rho=3.0_CUSTOM_REAL + vp = 7.8_CUSTOM_REAL + vs = 4.5_CUSTOM_REAL + rho = 3.0_CUSTOM_REAL else if (depth > 16000.0) then ! moho - 16km - vp=6.7_CUSTOM_REAL - vs=3.87_CUSTOM_REAL - rho=2.8_CUSTOM_REAL + vp = 6.7_CUSTOM_REAL + vs = 3.87_CUSTOM_REAL + rho = 2.8_CUSTOM_REAL else if (depth > 5500.0) then ! basement - vp=6.3_CUSTOM_REAL - vs=3.64_CUSTOM_REAL - rho=2.67_CUSTOM_REAL + vp = 6.3_CUSTOM_REAL + vs = 3.64_CUSTOM_REAL + rho = 2.67_CUSTOM_REAL else ! up to topo surface - vp=5.5_CUSTOM_REAL - vs=3.18_CUSTOM_REAL - rho=2.4_CUSTOM_REAL + vp = 5.5_CUSTOM_REAL + vs = 3.18_CUSTOM_REAL + rho = 2.4_CUSTOM_REAL endif ! scale to standard units diff --git a/src/generate_databases/model_external_values.F90 b/src/generate_databases/model_external_values.F90 index 7302fbfd5..e50cb312d 100644 --- a/src/generate_databases/model_external_values.F90 +++ b/src/generate_databases/model_external_values.F90 @@ -224,7 +224,7 @@ subroutine model_external_values(xmesh,ymesh,zmesh,ispec,rho,vp,vs,qkappa_atten, vs = vs + 2720._CUSTOM_REAL * depth ! attenuation: PREM crust value - qmu_atten=600._CUSTOM_REAL + qmu_atten = 600._CUSTOM_REAL ! no Q_Kappa in this model, use a dummy very high value of 9999. as a flag for no QKappa attenuation qkappa_atten = 9999._CUSTOM_REAL diff --git a/src/generate_databases/model_ipati.f90 b/src/generate_databases/model_ipati.f90 index 97fff7685..1862923ab 100644 --- a/src/generate_databases/model_ipati.f90 +++ b/src/generate_databases/model_ipati.f90 @@ -224,7 +224,7 @@ subroutine model_ipati_water(myrank,nspec,LOCAL_PATH) vs_read = vp_read * SCALING_FACTOR ! overwrites only elastic elements - do ispec=1,nspec + do ispec = 1,nspec ! assumes water layer with acoustic elements are set properly ! only overwrites elastic elements if (ispec_is_elastic(ispec)) then diff --git a/src/generate_databases/model_sep.f90 b/src/generate_databases/model_sep.f90 index ab5cb5ba0..c36ba4175 100644 --- a/src/generate_databases/model_sep.f90 +++ b/src/generate_databases/model_sep.f90 @@ -270,15 +270,15 @@ subroutine interpolate_sep_on_mesh(sep_var, xmin, ymin, ni, nj, NZ, & integer :: iglob, i_target, j_target, k_target integer :: ispec, i, j, k - do ispec=1,NSPEC - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ - iglob=ibool(i,j,k,ispec); - i_target=NINT((xstore(i, j, k, ispec)-xmin)/DX)+1 - j_target=NINT((ystore(i, j, k, ispec)-ymin)/DY)+1 + do ispec = 1,NSPEC + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ + iglob = ibool(i,j,k,ispec); + i_target = NINT((xstore(i, j, k, ispec)-xmin)/DX)+1 + j_target = NINT((ystore(i, j, k, ispec)-ymin)/DY)+1 ! in SEP, z-axis is downward; in SPECFEM, z-axis is upward - k_target=NINT(-zstore(i, j, k, ispec)/DZ)+1; !NOT using (z_temp-zmin) + k_target = NINT(-zstore(i, j, k, ispec)/DZ)+1; !NOT using (z_temp-zmin) ! Stay in the computational domain if (i_target < 1) i_target= 1 if (j_target < 1) j_target= 1 @@ -321,20 +321,20 @@ subroutine find_slice_bounds_sep(NX, NY, NZ, OX, OY, OZ, DX, DY, DZ, & zmin=minval(-zstore); zmax=maxval(-zstore); ! Bounds for the SEP model - imin=floor((xmin-OX)/DX+1); imax=ceiling((xmax-OX)/DX+1); - jmin=floor((ymin-OY)/DY+1); jmax=ceiling((ymax-OY)/DY+1); - kmin=floor((zmin-OZ)/DZ+1); kmax=ceiling((zmax-OZ)/DZ+1); + imin = floor((xmin-OX)/DX+1); imax = ceiling((xmax-OX)/DX+1); + jmin = floor((ymin-OY)/DY+1); jmax = ceiling((ymax-OY)/DY+1); + kmin = floor((zmin-OZ)/DZ+1); kmax = ceiling((zmax-OZ)/DZ+1); if (imin < 1) imin= 1; if (jmin < 1) jmin= 1; if (kmin < 1) kmin= 1; - if (imax > NX) imin=NX; if (jmax > NY) jmax=NY; if (kmax > NZ) kmax=NZ; + if (imax > NX) imin = NX; if (jmax > NY) jmax = NY; if (kmax > NZ) kmax = NZ; ! Number of SEP indexes for the current slice - ni=imax-imin+1 - nj=jmax-jmin+1 - nk=kmax-kmin+1 + ni = imax-imin+1 + nj = jmax-jmin+1 + nk = kmax-kmin+1 ! Corrected bounds for the current slice when looking for SEP indexes - xmin=DX*(imin-1)+OX; xmax=DX*(imax-1)+OX; - ymin=DY*(jmin-1)+OY; ymax=DY*(jmax-1)+OY; - zmin=DZ*(kmin-1)+OZ; zmax=DZ*(kmax-1)+OZ; + xmin = DX*(imin-1)+OX; xmax = DX*(imax-1)+OX; + ymin = DY*(jmin-1)+OY; ymax = DY*(jmax-1)+OY; + zmin = DZ*(kmin-1)+OZ; zmax = DZ*(kmax-1)+OZ; end subroutine find_slice_bounds_sep diff --git a/src/generate_databases/pml_set_local_dampingcoeff.f90 b/src/generate_databases/pml_set_local_dampingcoeff.f90 index c7809b782..5c44be8b6 100644 --- a/src/generate_databases/pml_set_local_dampingcoeff.f90 +++ b/src/generate_databases/pml_set_local_dampingcoeff.f90 @@ -1390,9 +1390,9 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) ispec = CPML_to_spec(ispec_CPML) ! loops over all GLL points ! (combines directions to speed up calculations) - do k=1,NGLLZ-1 - do j=1,NGLLY-1 - do i=1,NGLLX-1 + do k = 1,NGLLZ-1 + do j = 1,NGLLY-1 + do i = 1,NGLLX-1 ! reference point iglob1 = ibool(i,j,k,ispec) x1 = xstore(iglob1) @@ -1882,7 +1882,7 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) if (ier /= 0) stop 'error allocating array points_interface_PML_acoustic' points_interface_PML_acoustic = 0 nglob_interface_PML_acoustic = 0 - do ispec=1,nspec + do ispec = 1,nspec if (ispec_is_acoustic(ispec) .and. is_CPML(ispec)) then do k = 1,NGLLZ; do j = 1,NGLLY; do i = 1,NGLLX if (mask_ibool_interior_domain(ibool(i,j,k,ispec))) then @@ -1906,7 +1906,7 @@ subroutine pml_set_local_dampingcoeff(xstore,ystore,zstore) if (ELASTIC_SIMULATION) then - do ispec=1,nspec + do ispec = 1,nspec if (ispec_is_elastic(ispec) .and. is_CPML(ispec)) then do k = 1,NGLLZ; do j = 1,NGLLY; do i = 1,NGLLX if (mask_ibool_interior_domain(ibool(i,j,k,ispec))) then diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index e08f5f8f0..84bc5d9e8 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -344,47 +344,47 @@ subroutine save_arrays_solver_mesh_hdf5() call h5_create_dataset_gen(dset_name,(/NPROC/), 1, CUSTOM_REAL) if (sum(offset_nspec_irregular) > 0) then - dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) - dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/NGLLX,NGLLY,NGLLZ,sum(offset_nspec_irregular(:))/), 4, CUSTOM_REAL) else ! dummy - dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) - dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_create_dataset_gen(dset_name,(/1,1,1,1/), 4, CUSTOM_REAL) endif @@ -916,25 +916,25 @@ subroutine save_arrays_solver_mesh_hdf5() call h5_write_dataset_collect_hyperslab(dset_name,(/xix_regular/),(/myrank/),if_col) dset_name = "jacobian_regular" ! 1 r (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name,(/jacobian_regular/),(/myrank/),if_col) - dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) - dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular=offset_nspec/) + dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) dset_name = "kappastore" ! 4 r (/0,0,0,offset_nspec/) call h5_write_dataset_collect_hyperslab(dset_name,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) @@ -1523,13 +1523,13 @@ subroutine get_connectivity_for_movie(nspec,ibool,elm_conn,o) integer :: ispec,ii,icub,jcub,kcub integer, parameter :: cell_type = 9 - do ispec=1, nspec + do ispec = 1, nspec ! extract information from full GLL grid ! node order follows vtk format - do icub=0,NGLLX-2 - do jcub=0,NGLLY-2 - do kcub=0,NGLLZ-2 + do icub = 0,NGLLX-2 + do jcub = 0,NGLLY-2 + do kcub = 0,NGLLZ-2 ii = 1+(ispec-1)*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1) + (icub*(NGLLY-1)*(NGLLZ-1)+jcub*(NGLLZ-1)+kcub) elm_conn(1, ii) = cell_type elm_conn(2, ii) = ibool(icub+1,jcub+1,kcub+1,ispec)-1+o ! node id starts 0 in xdmf rule diff --git a/src/inverse_problem_for_model/adjoint_source/adjoint_source_mod.f90 b/src/inverse_problem_for_model/adjoint_source/adjoint_source_mod.f90 index 5ae1330af..52606895e 100644 --- a/src/inverse_problem_for_model/adjoint_source/adjoint_source_mod.f90 +++ b/src/inverse_problem_for_model/adjoint_source/adjoint_source_mod.f90 @@ -400,8 +400,8 @@ subroutine compute_elastic_adjoint_source_displacement(irec_local, ievent, acqui case('qtl') trace_cal_2 = trace_cal_1 trace_obs_2 = trace_obs_1 - write(*,*)'ERROR : qtl is not implemented yet' - write(*,*)'NOW STOP' + write(*,*) 'ERROR : qtl is not implemented yet' + write(*,*) 'NOW STOP' stop end select diff --git a/src/inverse_problem_for_model/adjoint_source/instantaneous_phase_envelope_misfit_mod.f90 b/src/inverse_problem_for_model/adjoint_source/instantaneous_phase_envelope_misfit_mod.f90 index 9c0152892..1965ffde9 100644 --- a/src/inverse_problem_for_model/adjoint_source/instantaneous_phase_envelope_misfit_mod.f90 +++ b/src/inverse_problem_for_model/adjoint_source/instantaneous_phase_envelope_misfit_mod.f90 @@ -366,8 +366,8 @@ subroutine compute_instanteneous_phase_adjoint_source_term ft_tmp_vx = cmplx(0.,0.) ft_tmp_vy = cmplx(0.,0.) ft_tmp_vz = cmplx(0.,0.) - do ff=1,nt - do tt=1,nt + do ff = 1,nt + do tt = 1,nt !* Fourier basis tmp_four = cos(-2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & @@ -382,7 +382,7 @@ subroutine compute_instanteneous_phase_adjoint_source_term enddo !* Remove negative freq - do irec=1,nrecloc + do irec = 1,nrecloc ft_tmp_vx(irec,:) = ft_tmp_vx(irec,:) * hh(:) ft_tmp_vy(irec,:) = ft_tmp_vy(irec,:) * hh(:) ft_tmp_vz(irec,:) = ft_tmp_vz(irec,:) * hh(:) @@ -392,8 +392,8 @@ subroutine compute_instanteneous_phase_adjoint_source_term srcterm2_vx = cmplx(0.,0.) srcterm2_vy = cmplx(0.,0.) srcterm2_vz = cmplx(0.,0.) - do tt=1,nt - do ff=1,nt + do tt = 1,nt + do ff = 1,nt !* Fourier basis tmp_four = cos(2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & @@ -538,8 +538,8 @@ subroutine compute_envelope_adjoint_source_term ft_tmp_vx = cmplx(0.,0.) ft_tmp_vy = cmplx(0.,0.) ft_tmp_vz = cmplx(0.,0.) - do ff=1,nt - do tt=1,nt + do ff = 1,nt + do tt = 1,nt !* Fourier basis tmp_four = cos(-2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & @@ -554,7 +554,7 @@ subroutine compute_envelope_adjoint_source_term enddo !* Remove negative freq - do irec=1,nrecloc + do irec = 1,nrecloc ft_tmp_vx(irec,:) = ft_tmp_vx(irec,:) * hh(:) ft_tmp_vy(irec,:) = ft_tmp_vy(irec,:) * hh(:) ft_tmp_vz(irec,:) = ft_tmp_vz(irec,:) * hh(:) @@ -564,8 +564,8 @@ subroutine compute_envelope_adjoint_source_term srcterm2_vx = cmplx(0.,0.) srcterm2_vy = cmplx(0.,0.) srcterm2_vz = cmplx(0.,0.) - do tt=1,nt - do ff=1,nt + do tt = 1,nt + do ff = 1,nt !* Fourier basis tmp_four = cos(2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & @@ -662,8 +662,8 @@ subroutine get_analytic_signal !* DFT - do ff=1,nt - do tt=1,nt + do ff = 1,nt + do tt = 1,nt !* Fourier basis tmp_four = cos(-2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & @@ -692,15 +692,15 @@ subroutine get_analytic_signal hh(1) = 1. hh(floor(nt/2.)+1) = 1. - do ff=2,floor(nt/2.) + do ff = 2,floor(nt/2.) hh(ff) = 2. enddo - do ff=floor(nt/2.)+2,nt + do ff = floor(nt/2.)+2,nt hh(ff) = 0. enddo - do irec=1,nrecloc + do irec = 1,nrecloc ft_dobs_vx(irec,:) = ft_dobs_vx(irec,:) * hh(:) ft_dcal_vx(irec,:) = ft_dcal_vx(irec,:) * hh(:) @@ -722,8 +722,8 @@ subroutine get_analytic_signal an_dcal_vz = cmplx(0.,0.) !* Perform inverse DFT - do tt=1,nt - do ff=1,nt + do tt = 1,nt + do ff = 1,nt !* Fourier basis tmp_four = cos(2. * ipi * real(ff-1.) * real(tt-1.) / nt) + & diff --git a/src/inverse_problem_for_model/adjoint_source/rotations_mod.f90 b/src/inverse_problem_for_model/adjoint_source/rotations_mod.f90 index d596e0c7c..d2009057c 100644 --- a/src/inverse_problem_for_model/adjoint_source/rotations_mod.f90 +++ b/src/inverse_problem_for_model/adjoint_source/rotations_mod.f90 @@ -89,7 +89,7 @@ subroutine rotate_comp_mesh2glob(vx, vy, vz, stalat, stalon, nt, nsta, vz2, vn, lat = deg2rad * stalat lon = deg2rad * stalon - do ista=1,nsta + do ista = 1,nsta !* Equivalence of local and global Cartesian coordinates at (lat=0, lon=0) X2(ista,:) = vz(ista,:) @@ -150,7 +150,7 @@ subroutine rotate_comp_glob2mesh(vz2, vn, ve, stalat, stalon, nt, nsta, vx, vy, lat = deg2rad * stalat lon = deg2rad * stalon - do ista=1,nsta + do ista = 1,nsta !* Define rotation matrix rotc(1,1) = cos(lat(ista)) * cos(lon(ista)) diff --git a/src/inverse_problem_for_model/adjoint_source/signal_processing_mod.f90 b/src/inverse_problem_for_model/adjoint_source/signal_processing_mod.f90 index 93ff589f7..a541ecc0a 100644 --- a/src/inverse_problem_for_model/adjoint_source/signal_processing_mod.f90 +++ b/src/inverse_problem_for_model/adjoint_source/signal_processing_mod.f90 @@ -66,7 +66,7 @@ subroutine bwfilt (x, y, dt, n, irek, norder, f1, f2) integer :: npoles if (norder /= 0) then - npoles=iabs(norder) + npoles = iabs(norder) !determination of filter coefficients call bpcoeff(f1,f2,npoles, dt, a,b1, b2) @@ -114,8 +114,8 @@ subroutine rekurs(x,y,ndat,a,b1,b2,npoles,iflag) do i = 2, npoles z(i) = a(i)*(z(i-1)-z2(i-1))-b1(i)*z1(i)-b2(i)*z2(i) enddo - x2=x1 - x1=x(n) + x2 = x1 + x1 = x(n) do i = 1, npoles z2(i) =z1(i) z1(i) =z(i) @@ -138,11 +138,11 @@ subroutine rekurs(x,y,ndat,a,b1,b2,npoles,iflag) do n = ndat, 1, -1 z(1) = a(1)*(y(n)-x2)-b1(1)*z1(1)-b2(1)*z2(1) - do i =2, npoles + do i = 2, npoles z(i) = a(i)*(z(i-1)-z2(i-1))-b1(i)*z1(i)-b2(i)*z2(i) enddo - x2=x1 - x1=y(n) + x2 = x1 + x1 = y(n) do i = 1,npoles z2(i)=z1(i) z1(i)=z(i) @@ -168,27 +168,27 @@ subroutine bpcoeff(f1,f2,npoles,dt,a,b1,b2) if (npoles > 10) stop 'error: npoles greater than 10' d2= 2.d0/dt - w1=d2*tan(2.d0*pi*f1/d2) - w2=d2*tan(2.d0*pi*f2/d2) - w0=0.5*(w2-w1) + w1 = d2*tan(2.d0*pi*f1/d2) + w2 = d2*tan(2.d0*pi*f2/d2) + w0 = 0.5*(w2-w1) - i=1 - npol2=npoles/2+1 - do n =1,npoles + i = 1 + npol2 = npoles/2+1 + do n = 1,npoles p = cexp(cmplx(0.d0,dble(2*n-1+npoles)*pi/dble(2*npoles))) t1 = p*cmplx(w0,0.d0) t2 = sqrt(t1*t1-cmplx(w1*w2,0.d0)) s(i)=t1+t2 s(i+1)=t1-t2 - i=i+2 + i = i+2 enddo - do n=1,npoles - ssum=2*real(s(n)) - sprod=dble(s(n)*conjg(s(n))) - fact1=d2*d2-d2*ssum+sprod - fact2=2.d0*(sprod-d2*d2) - fact3=d2*d2+d2*ssum+sprod + do n = 1,npoles + ssum = 2*real(s(n)) + sprod = dble(s(n)*conjg(s(n))) + fact1 = d2*d2-d2*ssum+sprod + fact2 = 2.d0*(sprod-d2*d2) + fact3 = d2*d2+d2*ssum+sprod a(n)=2.d0*d2*w0/fact1 b1(n)=fact2/fact1 b2(n)=fact3/fact1 @@ -254,11 +254,11 @@ subroutine convolution_by_wavelet(wavelet, signal, conv_signal, ns, nw) real(kind=CUSTOM_REAL), dimension(:), allocatable, intent(inout) :: conv_signal integer :: i, k, Ni, Ne - do i=1, ns + do i = 1, ns conv_signal(i)=0._CUSTOM_REAL - Ni=max(1,i+1-ns) - Ne=min(i,nw) - do k=Ni, Ne + Ni = max(1,i+1-ns) + Ne = min(i,nw) + do k = Ni, Ne conv_signal(i) = conv_signal(i) + signal(i-k+1) * wavelet(k) enddo enddo @@ -275,7 +275,7 @@ subroutine crosscor_by_wavelet(wavelet, signal, conv_signal, ns, nw) real(kind=CUSTOM_REAL), dimension(:), allocatable, intent(inout) :: conv_signal integer :: i, k, Ni, Ne - do i=1, ns + do i = 1, ns conv_signal(i) = 0._CUSTOM_REAL Ni = max(1,i+1-ns) Ne = min(i,nw) diff --git a/src/inverse_problem_for_model/elastic_tensor_tools_mod.f90 b/src/inverse_problem_for_model/elastic_tensor_tools_mod.f90 index e6efda66c..0f7b78b67 100644 --- a/src/inverse_problem_for_model/elastic_tensor_tools_mod.f90 +++ b/src/inverse_problem_for_model/elastic_tensor_tools_mod.f90 @@ -399,9 +399,9 @@ subroutine get_isotropic_part_fedorov(triclinic,isotropic) real(kind=dp) :: kappa, mu, lambda, c11, c22, c33, c23, c13, c12, c44, c55, c66, lp2m - c11 = triclinic(1); c22=triclinic(2); c33=triclinic(3); - c23 = triclinic(4); c13=triclinic(5); c12=triclinic(6); - c44 = triclinic(7); c55=triclinic(8); c66=triclinic(9); + c11 = triclinic(1); c22 = triclinic(2); c33 = triclinic(3); + c23 = triclinic(4); c13 = triclinic(5); c12 = triclinic(6); + c44 = triclinic(7); c55 = triclinic(8); c66 = triclinic(9); kappa = (c11 + c22 + c33 + 2._dp*(c12 + c13 + c23)) / 9._dp mu = (2._dp*(c11 + c22 + c33 - c12 - c23 - c13) + 6._dp * (c44 + c55 + c66)) / 30._dp @@ -1355,7 +1355,7 @@ subroutine projection_to_isotropic_symmetry(vi,di,vo,vp,vd,dev,k,g) ! Get isotropic constants disum = 0._dp vosum = 0._dp - do i=1,3 + do i = 1,3 disum = disum + di(i,i) vosum = vosum + vo(i,i) enddo @@ -1469,7 +1469,7 @@ subroutine determine_tensor_symmetry_axis(cij,scc) ! Now check for best hexagonal symetry fit ! Basis transfer - scc=transpose(scc) + scc = transpose(scc) ! Loop over permutations ((123),(231),(312)) do p = 1, 3 @@ -1498,7 +1498,7 @@ subroutine determine_tensor_symmetry_axis(cij,scc) ! Choose permutation pos = minloc(dvm,dim=1) - scc = cshift(scc,shift=pos,dim=1) ! to check... + scc = cshift(scc,shift = pos,dim = 1) ! to check... ! Do the rotation bond = define_bond_stress_matrix(scc) diff --git a/src/inverse_problem_for_model/input_output/IO_model_mod.f90 b/src/inverse_problem_for_model/input_output/IO_model_mod.f90 index 68716881d..993536e97 100644 --- a/src/inverse_problem_for_model/input_output/IO_model_mod.f90 +++ b/src/inverse_problem_for_model/input_output/IO_model_mod.f90 @@ -467,7 +467,7 @@ subroutine WriteOutputSEMmodel(inversion_param) ! get model from specfem database if (ELASTIC_SIMULATION) then - do ispec=1, NSPEC_AB !! update just the elastic elements + do ispec = 1, NSPEC_AB !! update just the elastic elements if (ispec_is_elastic(ispec)) then wks_model_rho(:,:,:,ispec) = rho_vs(:,:,:,ispec) * rho_vs(:,:,:,ispec) / mustore(:,:,:,ispec) wks_model_vp(:,:,:,ispec) = (kappastore(:,:,:,ispec) + (4./3.) * mustore(:,:,:,ispec) ) / rho_vp(:,:,:,ispec) @@ -477,7 +477,7 @@ subroutine WriteOutputSEMmodel(inversion_param) endif if (ACOUSTIC_SIMULATION) then - do ispec=1, NSPEC_AB !! update just the acoustic elements + do ispec = 1, NSPEC_AB !! update just the acoustic elements if (ispec_is_acoustic(ispec)) then wks_model_rho(:,:,:,ispec) = rhostore(:,:,:,ispec) wks_model_vp(:,:,:,ispec) = sqrt(kappastore(:,:,:,ispec)/rhostore(:,:,:,ispec)) @@ -811,11 +811,11 @@ subroutine import_FD_model_ACOUSTIC(fd_grid) !! PROJECT FD MODEL IN SEM GRID - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !! nearest neighbor ii = 1+ floor( (xstore(iglob) - ox_fd)/hx_fd) @@ -939,20 +939,20 @@ subroutine import_FD_model_Elastic_ISO(fd_grid) !! PROJECT FD MODEL IN SEM GRID - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !! nearest neighbor ii = 1+ floor( (xstore(iglob) - ox_fd)/hx_fd) jj = 1+ floor( (ystore(iglob) - oy_fd)/hy_fd) kk = 1+ floor( (zstore(iglob) - oz_fd)/hz_fd) - xp=xstore(iglob) - yp=ystore(iglob) - zp=zstore(iglob) + xp = xstore(iglob) + yp = ystore(iglob) + zp = zstore(iglob) !! trilinear interpolation call Get_value_by_trilinear_interp(rh_interp, xp, yp, zp, rho_fd, & @@ -1029,7 +1029,7 @@ subroutine import_FD_model_ANISO(fd_grid, inversion_param) if (ier /= 0) call exit_MPI_without_rank('error allocating array 311') open(4444,file=trim(model_file),access='direct',recl=CUSTOM_REAL*nx_fd*ny_fd*nz_fd) - do i=1,nb_model_to_read + do i = 1,nb_model_to_read read(4444,rec=i) model_fd(:,:,:,i) enddo close(4444) @@ -1100,11 +1100,11 @@ subroutine import_FD_model_ANISO(fd_grid, inversion_param) endif !! PROJECT FD MODEL IN SEM GRID - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !! nearest neighbor ii = 1+ floor( (xstore(iglob) - ox_fd)/hx_fd) @@ -1153,11 +1153,11 @@ subroutine import_FD_model_ANISO(fd_grid, inversion_param) case ('TRISO') !! tansverse isotropic !! PROJECT FD MODEL IN SEM GRID - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !! nearest neighbor ii = 1+ floor( (xstore(iglob) - ox_fd)/hx_fd) @@ -1240,22 +1240,22 @@ subroutine import_FD_model_ANISO(fd_grid, inversion_param) allocate(zcrd_fd(nz_fd),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 315') endif - do i=1,nx_fd + do i = 1,nx_fd xcrd_fd(i) = ox_fd + hx_fd * real(i-1) enddo - do i=1,ny_fd + do i = 1,ny_fd ycrd_fd(i) = oy_fd + hy_fd * real(i-1) enddo - do i=1,nz_fd + do i = 1,nz_fd zcrd_fd(i) = oz_fd + hz_fd * real(i-1) enddo !! PROJECT FD MODEL IN SEM GRID - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !! nearest neighbor !ii = 1+ floor( (xstore(iglob) - ox_fd)/hx_fd) @@ -1265,7 +1265,7 @@ subroutine import_FD_model_ANISO(fd_grid, inversion_param) !! trilinear (not optimized here but can be done if needed, ! (to do so, split trilinear routine such that coefficients ! are computed only once per gll) - do ipar=1,22 + do ipar = 1,22 call trilin_interp(xstore(iglob), ystore(iglob), zstore(iglob), & xcrd_fd, ycrd_fd, zcrd_fd, & diff --git a/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 b/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 index b24081581..378933126 100644 --- a/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 +++ b/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 @@ -88,7 +88,7 @@ subroutine read_acqui_teleseismic_file(acqui_file, acqui_simu, myrank) read(666,'(a)',end=99) line if (DEBUG_MODE) write(IIDD,'(a)') trim(line) !if (is_blank_line(line)) cycle !! no significant line - if (INDEX(line,'event_name') > 0) NEVENT=NEVENT+1 !! new event + if (INDEX(line,'event_name') > 0) NEVENT = NEVENT+1 !! new event enddo 99 close(666) @@ -105,7 +105,7 @@ subroutine read_acqui_teleseismic_file(acqui_file, acqui_simu, myrank) ! open event file open(666,file=trim(acqui_file)) - ievent=0 + ievent = 0 do read(666,'(a)',end=999) line !if (is_blank_line(line)) cycle @@ -156,7 +156,7 @@ subroutine read_acqui_teleseismic_file(acqui_file, acqui_simu, myrank) ! Some checks about source wavelet and traction if (trim(adjustl(acqui_simu(ievent)%source_wavelet_file)) /= 'undef') then - acqui_simu(ievent)%external_source_wavelet=.true. + acqui_simu(ievent)%external_source_wavelet = .true. ! note sure if i should use this one.. allocate(acqui_simu(ievent)%user_source_time_function(1,nt),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 337') diff --git a/src/inverse_problem_for_model/input_output/input_output_mod.f90 b/src/inverse_problem_for_model/input_output/input_output_mod.f90 index e7d2c83d7..a78528f13 100644 --- a/src/inverse_problem_for_model/input_output/input_output_mod.f90 +++ b/src/inverse_problem_for_model/input_output/input_output_mod.f90 @@ -380,14 +380,14 @@ subroutine read_and_distribute_events_for_simultaneous_runs(NUMBER_OF_SIMULTANEO write(*,*) ' NUMBER OF SIMULTANEOUS RUNS > 0 ' write(*,*) call flush_iunit(6) - number_of_events_in_acqui_file_ref=0 + number_of_events_in_acqui_file_ref = 0 open(666,file=trim(acqui_file_ref)) do read(666,'(a)',end=99) line !! no significant line if (is_blank_line(line)) cycle !! new event - if (INDEX(line,'event_name') > 0) number_of_events_in_acqui_file_ref=number_of_events_in_acqui_file_ref+1 + if (INDEX(line,'event_name') > 0) number_of_events_in_acqui_file_ref = number_of_events_in_acqui_file_ref+1 enddo 99 close(666) @@ -397,7 +397,7 @@ subroutine read_and_distribute_events_for_simultaneous_runs(NUMBER_OF_SIMULTANEO allocate(nevent_in_group(NUMBER_OF_SIMULTANEOUS_RUNS),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 392') - do ievent=1,NUMBER_OF_SIMULTANEOUS_RUNS + do ievent = 1,NUMBER_OF_SIMULTANEOUS_RUNS if (ievent <= nevent_remained) then nevent_in_group(ievent)= nevent_per_group+1 else @@ -406,8 +406,8 @@ subroutine read_and_distribute_events_for_simultaneous_runs(NUMBER_OF_SIMULTANEO enddo ievent_global = 0 - ievent_in_group=0 - igroup=1 + ievent_in_group = 0 + igroup = 1 open(666,file=trim(acqui_file_ref)) write(prefix_to_path_tmp,"('run',i4.4,'/')") igroup open(777, file=trim(prefix_to_path_tmp)//'DATA/inverse_problem/acquisition.dat') @@ -421,18 +421,18 @@ subroutine read_and_distribute_events_for_simultaneous_runs(NUMBER_OF_SIMULTANEO ievent_global = ievent_global + 1 write(*,*) write(*,*) ' next event ', ievent_global - ievent_in_group=ievent_in_group+1 + ievent_in_group = ievent_in_group+1 endif !! write lines related to the current event if (ievent_in_group > nevent_in_group(igroup)) then - igroup=igroup+1 + igroup = igroup+1 write(*,*) ' group ', igroup write(prefix_to_path_tmp,"('run',i4.4,'/')") igroup close(777) open(777, file=trim(prefix_to_path_tmp)//'DATA/inverse_problem/acquisition.dat') - ievent_in_group=1 + ievent_in_group = 1 endif write(777, '(a)') trim(line) write(*,*) trim(line) @@ -693,7 +693,7 @@ subroutine write_bin_sismo_on_disk(ievent, acqui_simu, array_to_write, name_file call MPI_RECV(Gather_loc, Nt*nsta_irank*NDIM, CUSTOM_MPI_TYPE, irank, tag, my_local_mpi_comm_world, status, ier) call MPI_RECV(irec_global, nsta_irank, MPI_INTEGER, irank, tag, my_local_mpi_comm_world, status, ier) - do icomp=1,NDIM + do icomp = 1,NDIM do irec_local = 1, nsta_irank Gather(irec_global(irec_local), :, icomp) = Gather_loc(irec_local, :, icomp) enddo @@ -1108,9 +1108,9 @@ subroutine read_pif_data_gather(acqui_simu, inversion_param, myrank) ncomp_inv = 0 data_type_inv = inversion_param%inverted_data_type if (data_type_inv /= data_type_read) then - write(*,*)'ERROR: requested type of inverted data is different from observed data' - write(*,*)' integration of differentiation of observed not implemented yet' - write(*,*)'NOW STOP' + write(*,*) 'ERROR: requested type of inverted data is different from observed data' + write(*,*) ' integration of differentiation of observed not implemented yet' + write(*,*) 'NOW STOP' stop endif if (data_type_inv == 'd') inversion_param%get_synthetic_displacement = .true. @@ -1161,8 +1161,8 @@ subroutine read_pif_data_gather(acqui_simu, inversion_param, myrank) !! Data rotation required to pass in mesh system (zen -> xyz) !call define_mesh_rotation_matrix(lat0,lon0,azi0) !call rotate_comp_glob2mesh(vz2, vn, ve, stalat, stalon, nt, nsta, vx, vy, vz) - write(*,*)'ERROR: qtl is not implemented yet' - write(*,*)'NOW STOP' + write(*,*) 'ERROR: qtl is not implemented yet' + write(*,*) 'NOW STOP' stop end select @@ -1363,7 +1363,7 @@ subroutine write_pif_data_gather(ievent, acqui_simu, inversion_param, array_to_w call MPI_RECV(Gather_loc, Nt*nsta_irank*NDIM, CUSTOM_MPI_TYPE, irank, tag, my_local_mpi_comm_world, status, ier) call MPI_RECV(irec_global, nsta_irank, MPI_INTEGER, irank, tag, my_local_mpi_comm_world, status, ier) - do icomp=1,NDIM + do icomp = 1,NDIM do irec_local = 1, nsta_irank Gather(irec_global(irec_local), :, icomp) = Gather_loc(irec_local, :, icomp) enddo @@ -1385,7 +1385,7 @@ subroutine write_pif_data_gather(ievent, acqui_simu, inversion_param, array_to_w do irec_local = 1, NSTA_LOC irec_global(irec_local) = acqui_simu(ievent)%number_receiver_global(irec_local) !! choose the rigth seismograms_* - do icomp=1,NDIM + do icomp = 1,NDIM Gather_loc(irec_local,:,icomp) = array_to_write(icomp,irec_local,:) enddo enddo @@ -1406,7 +1406,7 @@ subroutine write_pif_data_gather(ievent, acqui_simu, inversion_param, array_to_w !! write gather file if (myrank == 0) then ! main process still needs to gather its own array data - do icomp=1,NDIM + do icomp = 1,NDIM do irec_local = 1, acqui_simu(ievent)%nsta_slice !! choose the right seismograms_* Gather(acqui_simu(ievent)%number_receiver_global(irec_local),:,icomp) = array_to_write(icomp,irec_local,:) @@ -1464,8 +1464,8 @@ subroutine write_pif_data_gather(ievent, acqui_simu, inversion_param, array_to_w !! Data rotation required to pass in mesh system (zen -> xyz) !call define_mesh_rotation_matrix(lat0,lon0,azi0) !call rotate_comp_glob2mesh(vz2, vn, ve, stalat, stalon, nt, nsta, vx, vy, vz) - write(*,*)'ERROR: qtl is not implemented yet' - write(*,*)'NOW STOP' + write(*,*) 'ERROR: qtl is not implemented yet' + write(*,*) 'NOW STOP' stop end select @@ -2553,7 +2553,7 @@ subroutine get_point_source(acqui_simu) !! read source time function if (myrank == 0) then open(IINN, file=trim(acqui_simu(ievent)%source_wavelet_file)) - do it=1,acqui_simu(ievent)%Nt_data + do it = 1,acqui_simu(ievent)%Nt_data read(IINN, *) dt_dummy, acqui_simu(ievent)%user_source_time_function(it,1) enddo close(IINN) @@ -2561,7 +2561,7 @@ subroutine get_point_source(acqui_simu) call MPI_BCAST(acqui_simu(ievent)%user_source_time_function,acqui_simu(ievent)%Nt_data, & CUSTOM_MPI_TYPE,0,my_local_mpi_comm_world,ier) - USE_FORCE_POINT_SOURCE=.false. + USE_FORCE_POINT_SOURCE = .false. case default !! define here reading of source file, and define accordingly the arrays : @@ -2610,7 +2610,7 @@ subroutine get_point_source(acqui_simu) acqui_simu(ievent)%t0 = t0 nsrc_loc = 0 - do isrc=1, NSOURCES + do isrc = 1, NSOURCES if (myrank == acqui_simu(ievent)%islice_selected_source(isrc)) then nsrc_loc = nsrc_loc + 1 !! Warning in this subroutine you must add your case for source source diff --git a/src/inverse_problem_for_model/input_output/interpolation_mod.f90 b/src/inverse_problem_for_model/input_output/interpolation_mod.f90 index b12e31ff5..6ab5f8d68 100644 --- a/src/inverse_problem_for_model/input_output/interpolation_mod.f90 +++ b/src/inverse_problem_for_model/input_output/interpolation_mod.f90 @@ -122,7 +122,7 @@ subroutine bwfilt (x, y, dt, n, irek, norder, f1, f2) iunit = 3 if (norder /= 0) then - npoles=abs(norder) + npoles = abs(norder) !determination of filter coefficients call bpcoeff(f1,f2,npoles, dt, a,b1, b2) if (norder >= 0) then @@ -170,8 +170,8 @@ subroutine rekurs(x,y,ndat,a,b1,b2,npoles,iflag) do i = 2, npoles z(i) = a(i)*(z(i-1)-z2(i-1))-b1(i)*z1(i)-b2(i)*z2(i) enddo - x2=x1 - x1=x(n) + x2 = x1 + x1 = x(n) do i = 1, npoles z2(i) =z1(i) z1(i) =z(i) @@ -195,11 +195,11 @@ subroutine rekurs(x,y,ndat,a,b1,b2,npoles,iflag) do n = ndat, 1, -1 z(1) = a(1)*(y(n)-x2)-b1(1)*z1(1)-b2(1)*z2(1) - do i =2, npoles + do i = 2, npoles z(i) = a(i)*(z(i-1)-z2(i-1))-b1(i)*z1(i)-b2(i)*z2(i) enddo - x2=x1 - x1=y(n) + x2 = x1 + x1 = y(n) do i = 1,npoles z2(i)=z1(i) z1(i)=z(i) @@ -224,27 +224,27 @@ subroutine bpcoeff(f1,f2,npoles,dt,a,b1,b2) endif d2= 2/dt - w1=d2*tan(2.*pi*f1/d2) - w2=d2*tan(2.*pi*f2/d2) - w0=0.5*(w2-w1) + w1 = d2*tan(2.*pi*f1/d2) + w2 = d2*tan(2.*pi*f2/d2) + w0 = 0.5*(w2-w1) - i=1 - npol2=npoles/2+1 - do n =1,npoles + i = 1 + npol2 = npoles/2+1 + do n = 1,npoles p = cexp(cmplx(0.,real(2*n-1+npoles)*pi/real(2*npoles))) t1 = p*cmplx(w0,0.) t2 = sqrt(t1*t1-cmplx(w1*w2,0.)) s(i)=t1+t2 s(i+1)=t1-t2 - i=i+2 + i = i+2 enddo - do n=1,npoles - ssum=2*real(s(n)) - sprod=real(s(n)*conjg(s(n))) - fact1=d2*d2-d2*ssum+sprod - fact2=2.*(sprod-d2*d2) - fact3=d2*d2+d2*ssum+sprod + do n = 1,npoles + ssum = 2*real(s(n)) + sprod = real(s(n)*conjg(s(n))) + fact1 = d2*d2-d2*ssum+sprod + fact2 = 2.*(sprod-d2*d2) + fact3 = d2*d2+d2*ssum+sprod a(n)=2.*d2*w0/fact1 b1(n)=fact2/fact1 b2(n)=fact3/fact1 @@ -314,7 +314,7 @@ subroutine time_deconv(dobs,dcal,dt,nt,nit,src_sum) crosscorr = crosscorr * dt !* Find maximum of correlation - ii = maxloc(abs(crosscorr),dim=1) + ii = maxloc(abs(crosscorr),dim = 1) !* Put local contibution to src_one and src_sum src_one = 0._cp @@ -353,8 +353,8 @@ subroutine myconvolution(sig1,sig2,n1,n2,conv,part) convtmp = zero !*** Convolve - do i1=1,n1 - do i2=1,n2 + do i1 = 1,n1 + do i2 = 1,n2 convtmp(i1+i2-1) = convtmp(i1+i2-1) + sig1(i1) * sig2(i2) enddo enddo @@ -421,7 +421,7 @@ subroutine mycorrelation(sig1,sig2,n1,n2,corr,part) endif !*** Flip second signal - do i=1,n2 + do i = 1,n2 flipsig2(i) = sig2(n2-i+1) enddo @@ -468,7 +468,7 @@ subroutine determine_lag(sig1,sig2,n1,n2,lag) !*** Find delay maxcorr = maxval(abs(corr)) - do it=1,n1 + do it = 1,n1 if (abs(corr(it)) == maxcorr) then lag = it-ind exit @@ -502,7 +502,7 @@ subroutine substalta(sig,n,nsta,nlta,crit,stalta,tpick) tmpsta(nsta+1:nsta+n) = sig(:) tmpsta(nsta+n+1:n+2*nsta) = sig(n) sta = zero - do i=1+nsta,n+nsta + do i = 1+nsta,n+nsta sta(i-nsta) = sum(tmpsta(i-nsta:i+nsta)**2) enddo sta = 0.5 * sta / nsta @@ -512,14 +512,14 @@ subroutine substalta(sig,n,nsta,nlta,crit,stalta,tpick) tmplta(nlta+1:nlta+n) = sig(:) tmplta(nlta+n+1:n+2*nlta) = sig(n) lta = zero - do i=1+nlta,n+nlta + do i = 1+nlta,n+nlta lta(i-nlta) = sum(tmplta(i-nlta:i+nlta)**2) enddo lta = 0.5 * lta / nlta !*** Compute ratio and gives first pick stalta = sta / lta - do i=1,n + do i = 1,n if (stalta(i) >= crit) then tpick = i exit @@ -595,7 +595,7 @@ subroutine trilin_interp(x,y,z,valx,valy,valz,nx,ny,nz,valin,valout)!,indx,indy, call locate_bissection(valz,nz,z,indz) - m=2 + m = 2 kx = min(max(indx-(m-1)/2,1),nx+1-m) ky = min(max(indy-(m-1)/2,1),ny+1-m) kz = min(max(indz-(m-1)/2,1),nz+1-m) @@ -799,9 +799,9 @@ subroutine taper_3D(ndom,taper,isr,sizetapx,sizetapy,sizetapz) tapz(ndom(3)/2:ndom(3))=1. endif - do k=1,ndom(3) - do j=1,ndom(2) - do i=1,ndom(1) + do k = 1,ndom(3) + do j = 1,ndom(2) + do i = 1,ndom(1) taper(i,j,k) = tapx(i) * tapy(j) * tapz(k) enddo enddo @@ -834,14 +834,14 @@ function tuckeywin(N,alpha) result(tuk) tuk(:) = 1. !*** Left part - do i=0,int(0.5*alpha*(N-1)) + do i = 0,int(0.5*alpha*(N-1)) if (i+1 > 0 .and. i+1 <= N) then tuk(i+1) = 0.5*(1+cos(pipi*(2.*i/(alpha*(N-1.))-1.))) endif enddo !*** Right part - do i=int((N-1)*(1-alpha/2.)),N-1 + do i = int((N-1)*(1-alpha/2.)),N-1 if (i+1 > 0 .and. i+1 <= N) then tuk(i+1) = 0.5*(1+cos(pipi*(2.*i/(alpha*(N-1.))-(2./alpha)+1.))) endif diff --git a/src/inverse_problem_for_model/input_output/mesh_tools_mod.f90 b/src/inverse_problem_for_model/input_output/mesh_tools_mod.f90 index f66b5a7fe..0bcc17095 100644 --- a/src/inverse_problem_for_model/input_output/mesh_tools_mod.f90 +++ b/src/inverse_problem_for_model/input_output/mesh_tools_mod.f90 @@ -200,7 +200,7 @@ subroutine get_MPI_slice_and_bcast_to_all(x_to_locate, y_to_locate, z_to_locate, distance_from_target = HUGEVAL - do iproc=0, NPROC-1 + do iproc = 0, NPROC-1 if (distance_from_target >= distance_from_target_all(1,iproc)) then distance_from_target = distance_from_target_all(1,iproc) islice_selected_dummy(1) = iproc @@ -230,15 +230,15 @@ subroutine get_MPI_slice_and_bcast_to_all(x_to_locate, y_to_locate, z_to_locate, call bcast_all_dp(z_found_dummy,1) !! it was just to avoid compler error - islice_selected=islice_selected_dummy(1) - ispec_selected=ispec_selected_dummy(1) - xi=xi_dummy(1) - eta=eta_dummy(1) - gamma=gamma_dummy(1) - x_found=x_found_dummy(1) - y_found=y_found_dummy(1) - z_found=z_found_dummy(1) - distance_from_target=distance_from_target_dummy(1) + islice_selected = islice_selected_dummy(1) + ispec_selected = ispec_selected_dummy(1) + xi = xi_dummy(1) + eta = eta_dummy(1) + gamma = gamma_dummy(1) + x_found = x_found_dummy(1) + y_found = y_found_dummy(1) + z_found = z_found_dummy(1) + distance_from_target = distance_from_target_dummy(1) deallocate(distance_from_target_all, xi_all, eta_all, gamma_all, x_found_all, y_found_all, z_found_all) deallocate(ispec_selected_all) @@ -284,9 +284,9 @@ subroutine get_point_in_mesh(x_to_locate, y_to_locate, z_to_locate, iaddx, iaddy typical_size_squared = (10. * typical_size_squared)**2 ! INITIALIZE LOCATION -------- - x_target=x_to_locate - y_target=y_to_locate - z_target=z_to_locate + x_target = x_to_locate + y_target = y_to_locate + z_target = z_to_locate ! flag to check that we located at least one target element located_target = .false. ispec_selected = 1 !! first element by default @@ -306,11 +306,11 @@ subroutine get_point_in_mesh(x_to_locate, y_to_locate, z_to_locate, iaddx, iaddy if (dist_squared > typical_size_squared) cycle ! exclude elements that are too far from target ! find closest GLL point form target - do k=2, NGLLZ-1 - do j=2, NGLLY-1 - do i=2, NGLLX-1 + do k = 2, NGLLZ-1 + do j = 2, NGLLY-1 + do i = 2, NGLLX-1 - iglob=ibool(i,j,k,ispec) + iglob = ibool(i,j,k,ispec) dist_squared = (x_target - dble(xstore(iglob)))**2 & + (y_target - dble(ystore(iglob)))**2 & + (z_target - dble(zstore(iglob)))**2 @@ -342,7 +342,7 @@ subroutine get_point_in_mesh(x_to_locate, y_to_locate, z_to_locate, iaddx, iaddy gamma = zigll(iz_initial_guess) ! define coordinates of the control points of the element - do ia=1,NGNOD + do ia = 1,NGNOD iax = 0 iay = 0 iaz = 0 @@ -558,13 +558,13 @@ subroutine create_mass_matrices_Stacey_duplication_routine() stop !call create_mass_matrices_pml_acoustic(nspec,ibool) else - do ispec=1,nspec_ab + do ispec = 1,nspec_ab if (ispec_is_acoustic(ispec)) then ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) weight = wxgll(i)*wygll(j)*wzgll(k) @@ -594,13 +594,13 @@ subroutine create_mass_matrices_Stacey_duplication_routine() stop !call create_mass_matrices_pml_elastic(nspec,ibool) else - do ispec=1,nspec_ab + do ispec = 1,nspec_ab if (ispec_is_elastic(ispec)) then ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) weight = wxgll(i)*wygll(j)*wzgll(k) @@ -682,7 +682,7 @@ subroutine create_mass_matrices_Stacey_duplication_routine() k = abs_boundary_ijk(3,igll,iface) ! gets global index - iglob=ibool(i,j,k,ispec) + iglob = ibool(i,j,k,ispec) ! gets associated, weighted jacobian jacobianw = abs_boundary_jacobian2Dw(igll,iface) diff --git a/src/inverse_problem_for_model/input_output/passive_imaging_format_mod.f90 b/src/inverse_problem_for_model/input_output/passive_imaging_format_mod.f90 index 94af0da0a..e2199f06d 100644 --- a/src/inverse_problem_for_model/input_output/passive_imaging_format_mod.f90 +++ b/src/inverse_problem_for_model/input_output/passive_imaging_format_mod.f90 @@ -151,11 +151,11 @@ subroutine read_pif_header_file(filename,mygather) integer :: ier - write(*,*)'Read PIF-file header from ',trim(adjustl(filename)),' ...' + write(*,*) 'Read PIF-file header from ',trim(adjustl(filename)),' ...' open(iunit, file=trim(adjustl(filename)), status='old',action='read', iostat=io_err) if (io_err /= 0) then - write(*,*)'PIF file: ',trim(adjustl(filename)),' does not exist!' + write(*,*) 'PIF file: ',trim(adjustl(filename)),' does not exist!' stop 'PIF file does not exist!' endif @@ -174,62 +174,62 @@ subroutine read_pif_header_file(filename,mygather) select case(trim(keyword)) case('event_name') read(keyval,*) mygather%hdr%event_name - write(*,*)' event_name ',trim(adjustl(mygather%hdr%event_name)) + write(*,*) ' event_name ',trim(adjustl(mygather%hdr%event_name)) case('source_type') keyval = lowcase(keyval) read(keyval,*) mygather%hdr%source_type - write(*,*)' source_type ',trim(adjustl(mygather%hdr%source_type)) + write(*,*) ' source_type ',trim(adjustl(mygather%hdr%source_type)) case('source_components') read(line,*)keyval, mygather%hdr%source_components - write(*,*)' receiver_component ',trim(adjustl(mygather%hdr%source_components)) + write(*,*) ' receiver_component ',trim(adjustl(mygather%hdr%source_components)) case('modeling_tool') read(line,*) keyval, mygather%hdr%modeling_tool, mygather%hdr%modeling_path mygather%hdr%modeling_tool = lowcase(mygather%hdr%modeling_tool) - write(*,*)' modeling_tool ',trim(adjustl(mygather%hdr%modeling_tool)),' ', & + write(*,*) ' modeling_tool ',trim(adjustl(mygather%hdr%modeling_tool)),' ', & trim(adjustl(mygather%hdr%modeling_path)) case('data_components') read(line,*) keyval, mygather%hdr%data_type, mygather%hdr%data_comp mygather%hdr%data_type = lowcase(mygather%hdr%data_type) mygather%hdr%data_comp = lowcase(mygather%hdr%data_comp) - write(*,*)' data_components ',trim(adjustl(mygather%hdr%data_type)),' ', & + write(*,*) ' data_components ',trim(adjustl(mygather%hdr%data_type)),' ', & trim(adjustl(mygather%hdr%data_comp)) case('cartloc_mesh_origin') read(line,*) keyword, mygather%hdr%mesh_origin(1:3) - write(*,*)' cartloc_mesh_origin :',mygather%hdr%mesh_origin + write(*,*) ' cartloc_mesh_origin :',mygather%hdr%mesh_origin case('data_origin_time') read(keyval,*) mygather%hdr%otime - write(*,*)' data_origin_time ',mygather%hdr%otime + write(*,*) ' data_origin_time ',mygather%hdr%otime case('number_of_station') read(keyval,*) mygather%hdr%nsta - write(*,*)' number_of_station ',mygather%hdr%nsta + write(*,*) ' number_of_station ',mygather%hdr%nsta case('data_time_step') read(keyval,*) mygather%hdr%dt - write(*,*)' data_time_step ',mygather%hdr%dt + write(*,*) ' data_time_step ',mygather%hdr%dt case('data_sample_number') read(keyval,*) mygather%hdr%nt - write(*,*)' data_sample_number ',mygather%hdr%nt + write(*,*) ' data_sample_number ',mygather%hdr%nt case('is_time_pick') read(keyval,*) mygather%hdr%is_pick - write(*,*)' is_time_pick ',mygather%hdr%is_pick + write(*,*) ' is_time_pick ',mygather%hdr%is_pick case('time_window') read(line,*) keyval, mygather%hdr%is_window, mygather%hdr%tbef, mygather%hdr%taft - write(*,*)' time_window ',mygather%hdr%is_window,mygather%hdr%tbef,mygather%hdr%taft + write(*,*) ' time_window ',mygather%hdr%is_window,mygather%hdr%tbef,mygather%hdr%taft case('station_coord_system') keyval = lowcase(keyval) read(keyval,*) mygather%hdr%coord_sys - write(*,*)' station_coord_system ',trim(adjustl(mygather%hdr%coord_sys)) + write(*,*) ' station_coord_system ',trim(adjustl(mygather%hdr%coord_sys)) end select @@ -312,13 +312,13 @@ subroutine read_pif_header_file(filename,mygather) end select - if (debug_level > 1) write(*,*)trim(adjustl(line)) + if (debug_level > 1) write(*,*) trim(adjustl(line)) enddo if (k < mygather%hdr%nsta) stop 'Not enough stations in PIF binary file..., check number_of_station' close(iunit) - write(*,*)'Done!' + write(*,*) 'Done!' ! Read CMT file if needed select case (mygather%hdr%source_type) @@ -360,11 +360,11 @@ subroutine read_cmt_solution_file(filename,cmt) character(len=*), intent(in) :: filename type(source_type), intent(out) :: cmt - write(*,*)'Read CMT solution file ...' + write(*,*) 'Read CMT solution file ...' print *,filename open(iunit, file=trim(adjustl(filename)), status='old',action='read', iostat=io_err) if (io_err /= 0) then - write(*,*)'CMT solution file: ',trim(adjustl(filename)),' does not exist!' + write(*,*) 'CMT solution file: ',trim(adjustl(filename)),' does not exist!' stop 'CMT solution file does not exist!' endif @@ -421,7 +421,7 @@ subroutine read_cmt_solution_file(filename,cmt) enddo close(iunit) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine read_cmt_solution_file !-------------------------------------------------------------------------------- @@ -433,10 +433,10 @@ subroutine read_force_solution_file(filename,cmt) character(len=*), intent(in) :: filename type(source_type), intent(out) :: cmt - write(*,*)'Read force solution file ...' + write(*,*) 'Read force solution file ...' open(iunit, file=trim(adjustl(filename)), status='old',action='read', iostat=io_err) if (io_err /= 0) then - write(*,*)'Force solution file: ',trim(adjustl(filename)),' does not exist!' + write(*,*) 'Force solution file: ',trim(adjustl(filename)),' does not exist!' stop 'Force solution file does not exist!' endif @@ -478,7 +478,7 @@ subroutine read_force_solution_file(filename,cmt) enddo close(iunit) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine read_force_solution_file !-------------------------------------------------------------------------------- @@ -493,8 +493,8 @@ subroutine read_binary_data(filename,nrec,nt,data) real(kind=sp), dimension(nrec,nt) :: datas real(kind=cp), dimension(nrec,nt), intent(out) :: data - write(*,*)'Read binary data: ' - write(*,*)' filename, nrec, nt = ',trim(adjustl(filename)),nrec,nt + write(*,*) 'Read binary data: ' + write(*,*) ' filename, nrec, nt = ',trim(adjustl(filename)),nrec,nt nsize = nrec * sp open(iunit,file=trim(adjustl(filename)),access='direct',recl=nsize,status='old') @@ -505,7 +505,7 @@ subroutine read_binary_data(filename,nrec,nt,data) close(iunit) data = real(datas,kind=cp) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine read_binary_data !-------------------------------------------------------------------------------- @@ -520,8 +520,8 @@ subroutine read_binary_source_signature(filename,nt,stf) real(kind=sp), dimension(nt) :: stfs real(kind=cp), dimension(nt), intent(out) :: stf - write(*,*)'Read binary source signature: ' - write(*,*)' filename, nt = ',trim(adjustl(filename)),nt + write(*,*) 'Read binary source signature: ' + write(*,*) ' filename, nt = ',trim(adjustl(filename)),nt nsize = nt * sp @@ -531,7 +531,7 @@ subroutine read_binary_source_signature(filename,nt,stf) stf = real(stfs,kind=cp) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine read_binary_source_signature !-------------------------------------------------------------------------------- @@ -546,8 +546,8 @@ subroutine write_binary_source_signature(filename,nt,stf) real(kind=sp), dimension(nt) :: stfs real(kind=cp), dimension(nt), intent(in) :: stf - write(*,*)'Write binary source signature: ' - write(*,*)' filename, nt = ',trim(adjustl(filename)),nt + write(*,*) 'Write binary source signature: ' + write(*,*) ' filename, nt = ',trim(adjustl(filename)),nt nsize = nt * sp stfs = real(stf,kind=sp) @@ -556,7 +556,7 @@ subroutine write_binary_source_signature(filename,nt,stf) write(iunit,rec=1)stfs(:) close(iunit) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine write_binary_source_signature !-------------------------------------------------------------------------------- @@ -570,8 +570,8 @@ subroutine write_binary_data(filename,nrec,nt,data) integer(kind=si) :: nsize, it real(kind=cp), dimension(nrec,nt), intent(in) :: data - write(*,*)'Write binary data: ' - write(*,*)' filename, nrec, nt = ',trim(adjustl(filename)),nrec,nt + write(*,*) 'Write binary data: ' + write(*,*) ' filename, nrec, nt = ',trim(adjustl(filename)),nrec,nt nsize = nrec * sp open(iunit,file=trim(adjustl(filename)),access='direct',recl=nsize,status='replace') @@ -580,7 +580,7 @@ subroutine write_binary_data(filename,nrec,nt,data) enddo close(iunit) - write(*,*)'Done!' + write(*,*) 'Done!' end subroutine write_binary_data !-------------------------------------------------------------------------------- diff --git a/src/inverse_problem_for_model/inversion_scheme/PrecondFWI_mod.f90 b/src/inverse_problem_for_model/inversion_scheme/PrecondFWI_mod.f90 index e53be5dd3..8c15a61bb 100644 --- a/src/inverse_problem_for_model/inversion_scheme/PrecondFWI_mod.f90 +++ b/src/inverse_problem_for_model/inversion_scheme/PrecondFWI_mod.f90 @@ -64,15 +64,15 @@ subroutine SetPrecond(inversion_param, current_gradient, hess_approxim, fwi_prec endif do ispec = 1, NSPEC_ADJOINT - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX - iglob=ibool(i,j,k,ispec) + iglob = ibool(i,j,k,ispec) - x=xstore(iglob) - y=ystore(iglob) - z=zstore(iglob) + x = xstore(iglob) + y = ystore(iglob) + z = zstore(iglob) !!$ taperx = 1. !!$ tapery = 1. @@ -115,9 +115,9 @@ subroutine SetPrecond(inversion_param, current_gradient, hess_approxim, fwi_prec endif do ispec = 1, NSPEC_ADJOINT - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) z = zstore(iglob) @@ -146,9 +146,9 @@ subroutine SetPrecond(inversion_param, current_gradient, hess_approxim, fwi_prec endif do ispec = 1, NSPEC_ADJOINT - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) z = zstore(iglob) diff --git a/src/inverse_problem_for_model/inversion_scheme/family_parameter_mod.f90 b/src/inverse_problem_for_model/inversion_scheme/family_parameter_mod.f90 index 741c1712a..8a67cd123 100644 --- a/src/inverse_problem_for_model/inversion_scheme/family_parameter_mod.f90 +++ b/src/inverse_problem_for_model/inversion_scheme/family_parameter_mod.f90 @@ -116,12 +116,12 @@ subroutine PrepareArraysfamilyParam(inversion_param) write(INVERSE_LOG_FILE,*) write(INVERSE_LOG_FILE,*) ' full family parameters : ' write(INVERSE_LOG_FILE,*) - do i=1, inversion_param%NfamilyPar + do i = 1, inversion_param%NfamilyPar write(INVERSE_LOG_FILE,*) ' Param ', i, ' : ' , trim(inversion_param%param_ref_name(i)) enddo write(INVERSE_LOG_FILE,*) write(INVERSE_LOG_FILE,*) - do i=1, inversion_param%NinvPar + do i = 1, inversion_param%NinvPar write(INVERSE_LOG_FILE,*) ' inverse parameter ', i, ' : ',trim(inversion_param%param_inv_name(i)) enddo endif diff --git a/src/inverse_problem_for_model/inversion_scheme/inversion_scheme_mod.f90 b/src/inverse_problem_for_model/inversion_scheme/inversion_scheme_mod.f90 index 86bac73a6..bd45b265b 100644 --- a/src/inverse_problem_for_model/inversion_scheme/inversion_scheme_mod.f90 +++ b/src/inverse_problem_for_model/inversion_scheme/inversion_scheme_mod.f90 @@ -411,9 +411,9 @@ subroutine Parallel_ComputeInnerProduct(vect1, vect2, Niv, qp) do ispec = 1, NSPEC_AB ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX weight = wxgll(i) * wygll(j) * wzgll(k) if (ispec_irreg /= 0) jacobianl = jacobianstore(i,j,k,ispec_irreg) ! integrated inner product @@ -484,9 +484,9 @@ subroutine Parallel_ComputeL2normSquare(vect1 , Niv, qp) do ispec = 1, NSPEC_AB ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX weight = wxgll(i) * wygll(j) * wzgll(k) if (ispec_irreg /= 0) jacobianl = jacobianstore(i,j,k,ispec_irreg) ! integrated squared norm value diff --git a/src/inverse_problem_for_model/inversion_scheme/vti_parameters.f90 b/src/inverse_problem_for_model/inversion_scheme/vti_parameters.f90 index a1b9dcb92..d82288513 100644 --- a/src/inverse_problem_for_model/inversion_scheme/vti_parameters.f90 +++ b/src/inverse_problem_for_model/inversion_scheme/vti_parameters.f90 @@ -75,49 +75,49 @@ subroutine selector_vti_family(inversion_param) inversion_param%param_ref_name(5)="delta--(de)" inversion_param%param_ref_name(6)="gamma--(gm)" - is_selected(:)=.false. - ipar_inv=0 - inversion_param%NfamilyPar=6 + is_selected(:) = .false. + ipar_inv = 0 + inversion_param%NfamilyPar = 6 !! look for wanted parameters - do ipar=1, inversion_param%NfamilyPar !! loop on all parameters : rho, vp, vs, ep, gm, de + do ipar = 1, inversion_param%NfamilyPar !! loop on all parameters : rho, vp, vs, ep, gm, de select case(trim(inversion_param%param_inv_name(ipar))) case('rho') if (.not. is_selected(1)) then - ipar_inv=ipar_inv+1 - is_selected(1)=.true. + ipar_inv = ipar_inv+1 + is_selected(1) = .true. endif case('vp') if (.not. is_selected(2)) then - ipar_inv=ipar_inv+1 - is_selected(2)=.true. + ipar_inv = ipar_inv+1 + is_selected(2) = .true. endif case('vs') if (.not. is_selected(3)) then - ipar_inv=ipar_inv+1 - is_selected(3)=.true. + ipar_inv = ipar_inv+1 + is_selected(3) = .true. endif case('ep') if (.not. is_selected(4)) then - ipar_inv=ipar_inv+1 - is_selected(4)=.true. + ipar_inv = ipar_inv+1 + is_selected(4) = .true. endif case('gm') if (.not. is_selected(5)) then - ipar_inv=ipar_inv+1 - is_selected(5)=.true. + ipar_inv = ipar_inv+1 + is_selected(5) = .true. endif case('de') if (.not. is_selected(6)) then - ipar_inv=ipar_inv+1 - is_selected(6)=.true. + ipar_inv = ipar_inv+1 + is_selected(6) = .true. endif end select @@ -125,13 +125,13 @@ subroutine selector_vti_family(inversion_param) enddo !! set wanted parameters in inversion structure - inversion_param%NinvPar=ipar_inv + inversion_param%NinvPar = ipar_inv allocate(inversion_param%Index_Invert(inversion_param%NinvPar),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 563') - ipar_inv=0 - do ipar=1, inversion_param%NfamilyPar !! loop on all parameters : rho, vp, vs, ep, gm, de + ipar_inv = 0 + do ipar = 1, inversion_param%NfamilyPar !! loop on all parameters : rho, vp, vs, ep, gm, de if (is_selected(ipar)) then - ipar_inv=ipar_inv+1 + ipar_inv = ipar_inv+1 inversion_param%Index_Invert(ipar_inv) = ipar inversion_param%param_inv_name(ipar_inv) = vti_family_name(ipar) endif diff --git a/src/inverse_problem_for_model/projection_on_FD_grid/projection_on_FD_grid_mod.f90 b/src/inverse_problem_for_model/projection_on_FD_grid/projection_on_FD_grid_mod.f90 index 552497b8c..81f4b150c 100644 --- a/src/inverse_problem_for_model/projection_on_FD_grid/projection_on_FD_grid_mod.f90 +++ b/src/inverse_problem_for_model/projection_on_FD_grid/projection_on_FD_grid_mod.f90 @@ -75,7 +75,7 @@ subroutine Project_model_FD_grid2SEM(model_on_SEM_mesh, model_on_FD_grid, myrank endif - do ispec =1, NSPEC_AB + do ispec = 1, NSPEC_AB do kgg = 1, NGLLZ do jgg = 1, NGLLY @@ -304,19 +304,19 @@ subroutine compute_interpolation_coeff_FD_SEM(projection_fd, myrank) if (DEBUG_MODE) write(IIDD,*) ' END compute_interpolation_coeff_FD_SEM step 1', nb_fd_point_loc !! allocate projection structure - projection_fd%nx=nx_fd_proj - projection_fd%ny=ny_fd_proj - projection_fd%nz=nz_fd_proj + projection_fd%nx = nx_fd_proj + projection_fd%ny = ny_fd_proj + projection_fd%nz = nz_fd_proj - projection_fd%hx=hx_fd_proj - projection_fd%hy=hy_fd_proj - projection_fd%hz=hz_fd_proj + projection_fd%hx = hx_fd_proj + projection_fd%hy = hy_fd_proj + projection_fd%hz = hz_fd_proj - projection_fd%ox=ox_fd_proj - projection_fd%oy=oy_fd_proj - projection_fd%oz=oz_fd_proj + projection_fd%ox = ox_fd_proj + projection_fd%oy = oy_fd_proj + projection_fd%oz = oz_fd_proj - projection_fd%nb_fd_point=nb_fd_point_loc + projection_fd%nb_fd_point = nb_fd_point_loc allocate(projection_fd%ispec_selected(nb_fd_point_loc),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 148') @@ -329,7 +329,7 @@ subroutine compute_interpolation_coeff_FD_SEM(projection_fd, myrank) allocate(projection_fd%hgamma(NGLLX,nb_fd_point_loc),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 152') - nb_fd_point_loc=0 + nb_fd_point_loc = 0 do kfd = 1, nz_fd_proj do jfd = 1, ny_fd_proj do ifd = 1, nx_fd_proj @@ -338,9 +338,9 @@ subroutine compute_interpolation_coeff_FD_SEM(projection_fd, myrank) nb_fd_point_loc = nb_fd_point_loc + 1 - xi_loc=xi_in_fd(ifd, jfd, kfd) - eta_loc=eta_in_fd(ifd, jfd, kfd) - gamma_loc=gamma_in_fd(ifd, jfd, kfd) + xi_loc = xi_in_fd(ifd, jfd, kfd) + eta_loc = eta_in_fd(ifd, jfd, kfd) + gamma_loc = gamma_in_fd(ifd, jfd, kfd) ispec_selected = point_already_found(ifd, jfd, kfd) call lagrange_any(xi_loc, NGLLX, xigll, hxis, hpxis) @@ -645,7 +645,7 @@ subroutine locate_MPI_slice_and_bcast_to_all_1(x_to_locate, y_to_locate, z_to_lo distance_from_target = HUGEVAL - do iproc=0, NPROC-1 + do iproc = 0, NPROC-1 if (distance_from_target >= distance_from_target_all(1,iproc)) then distance_from_target = distance_from_target_all(1,iproc) islice_selected_dummy(1) = iproc @@ -674,15 +674,15 @@ subroutine locate_MPI_slice_and_bcast_to_all_1(x_to_locate, y_to_locate, z_to_lo call bcast_all_dp(y_dummy,1) call bcast_all_dp(z_dummy,1) !! it was just to avoid compler error - islice_selected=islice_selected_dummy(1) - ispec_selected=ispec_selected_dummy(1) - xi=xi_dummy(1) - eta=eta_dummy(1) - gamma=gamma_dummy(1) - distance_from_target=distance_from_target_dummy(1) - x_found=x_dummy(1) - y_found=y_dummy(1) - z_found=z_dummy(1) + islice_selected = islice_selected_dummy(1) + ispec_selected = ispec_selected_dummy(1) + xi = xi_dummy(1) + eta = eta_dummy(1) + gamma = gamma_dummy(1) + distance_from_target = distance_from_target_dummy(1) + x_found = x_dummy(1) + y_found = y_dummy(1) + z_found = z_dummy(1) !!$ if (DEBUG_MODE .and. distance_from_target > 1.) then !!$ write(IIDD, *) ' warning point no correctly localized :' @@ -741,9 +741,9 @@ subroutine locate_point_in_mesh_simple(x_to_locate, y_to_locate, z_to_locate, ia typical_size_squared = (10. * typical_size_squared)**2 ! INITIALIZE LOCATION -------- - x_target=x_to_locate - y_target=y_to_locate - z_target=z_to_locate + x_target = x_to_locate + y_target = y_to_locate + z_target = z_to_locate ! flag to check that we located at least one target element located_target = .false. ispec_selected = 1 !! first element by default @@ -763,11 +763,11 @@ subroutine locate_point_in_mesh_simple(x_to_locate, y_to_locate, z_to_locate, ia if (dist_squared > typical_size_squared) cycle ! exclude elements that are too far from target ! find closest GLL point form target - do k=2, NGLLZ-1 - do j=2, NGLLY-1 - do i=2, NGLLX-1 + do k = 2, NGLLZ-1 + do j = 2, NGLLY-1 + do i = 2, NGLLX-1 - iglob=ibool(i,j,k,ispec) + iglob = ibool(i,j,k,ispec) dist_squared = (x_target - dble(xstore(iglob)))**2 & + (y_target - dble(ystore(iglob)))**2 & + (z_target - dble(zstore(iglob)))**2 @@ -799,7 +799,7 @@ subroutine locate_point_in_mesh_simple(x_to_locate, y_to_locate, z_to_locate, ia gamma = zigll(iz_initial_guess) ! define coordinates of the control points of the element - do ia=1,NGNOD + do ia = 1,NGNOD iax = 0 iay = 0 iaz = 0 @@ -937,9 +937,9 @@ subroutine locate_point_in_element(x_to_locate, y_to_locate, z_to_locate, iaddx, typical_size_squared = (10. * typical_size_squared)**2 ! INITIALIZE LOCATION -------- - x_target=x_to_locate - y_target=y_to_locate - z_target=z_to_locate + x_target = x_to_locate + y_target = y_to_locate + z_target = z_to_locate ! flag to check that we located at least one target element located_target = .false. ispec_selected = 1 !! first element by default @@ -959,11 +959,11 @@ subroutine locate_point_in_element(x_to_locate, y_to_locate, z_to_locate, iaddx, !if (dist_squared > typical_size_squared) cycle ! exclude elements that are too far from target ! find closest GLL point form target - do k=2, NGLLZ-1 - do j=2, NGLLY-1 - do i=2, NGLLX-1 + do k = 2, NGLLZ-1 + do j = 2, NGLLY-1 + do i = 2, NGLLX-1 - iglob=ibool(i,j,k,ispec) + iglob = ibool(i,j,k,ispec) dist_squared = (x_target - dble(xstore(iglob)))**2 & + (y_target - dble(ystore(iglob)))**2 & + (z_target - dble(zstore(iglob)))**2 @@ -995,7 +995,7 @@ subroutine locate_point_in_element(x_to_locate, y_to_locate, z_to_locate, iaddx, gamma = zigll(iz_initial_guess) ! define coordinates of the control points of the element - do ia=1,NGNOD + do ia = 1,NGNOD iax = 0 iay = 0 iaz = 0 diff --git a/src/inverse_problem_for_model/regularization/regularization_SEM_mod.f90 b/src/inverse_problem_for_model/regularization/regularization_SEM_mod.f90 index bc837af40..22fac53d6 100644 --- a/src/inverse_problem_for_model/regularization/regularization_SEM_mod.f90 +++ b/src/inverse_problem_for_model/regularization/regularization_SEM_mod.f90 @@ -1383,9 +1383,9 @@ subroutine read_partition_files !! all group will read the partition file if (NUMBER_OF_SIMULTANEOUS_RUNS > 1) then write(path_to_add,"('run',i4.4,'/')") 1 - LOCAL_PATH_FOR_READING=trim(path_to_add)//trim(LOCAL_PATH(9:len_trim(LOCAL_PATH))) + LOCAL_PATH_FOR_READING = trim(path_to_add)//trim(LOCAL_PATH(9:len_trim(LOCAL_PATH))) else - LOCAL_PATH_FOR_READING=LOCAL_PATH + LOCAL_PATH_FOR_READING = LOCAL_PATH endif ! read databases about external mesh simulation @@ -1609,7 +1609,7 @@ subroutine read_partition_files if (ier /= 0) call exit_MPI_without_rank('error allocating array 176') if (ier /= 0) stop 'Error allocating array CPML_regions' - do i=1,nspec_cpml + do i = 1,nspec_cpml ! #id_cpml_regions = 1 : X_surface C-PML ! #id_cpml_regions = 2 : Y_surface C-PML ! #id_cpml_regions = 3 : Z_surface C-PML @@ -1622,7 +1622,7 @@ subroutine read_partition_files read(IIN) CPML_to_spec(i), CPML_regions(i) enddo - do i=1,NSPEC_AB + do i = 1,NSPEC_AB read(IIN) is_CPML(i) enddo endif @@ -1787,8 +1787,8 @@ subroutine check_regularization_on_mesh() write(INVERSE_LOG_FILE,*) endif - Nb_test=5 - do itest=1, Nb_test + Nb_test = 5 + do itest = 1, Nb_test length = value_to_test(itest) * elemsize_max_glob lambda = 2* 3.1459265359/length @@ -1914,11 +1914,11 @@ subroutine compute_cosine_field(lambda, field, laplacian_of_field) integer :: i, j, k, ispec, iglob - !if (myrank==0)write (*,*) lambda - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1, NGLLX + !if (myrank==0) write (*,*) lambda + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1, NGLLX iglob = ibool(i,j,k,ispec) field(i,j,k,ispec) = cos( lambda * xstore(iglob) ) * cos( lambda* ystore(iglob) ) * cos( lambda * zstore(iglob) ) & @@ -2078,11 +2078,11 @@ subroutine compute_grad_laplacian_vp_vs_rho(nGrad_vp, nGrad_vs, nGrad_rh, Lap1_v penalty = 0._CUSTOM_REAL !! mean values of field on element boundary - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !!$ field(1,iglob)=field(1,iglob) + current_model_vp(i,j,k,ispec) !!$ field(2,iglob)=field(2,iglob) + current_model_vs(i,j,k,ispec) !!$ field(3,iglob)=field(3,iglob) + current_model_rh(i,j,k,ispec) @@ -2098,11 +2098,11 @@ subroutine compute_grad_laplacian_vp_vs_rho(nGrad_vp, nGrad_vs, nGrad_rh, Lap1_v field_to_derivate(:)=field(1,:) call compute_grad_laplacian(field_to_derivate, laplacian_of_field, norm_grad_of_field) !!!!!!!!! , regularization_fd) - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) nGrad_vp(i,j,k,ispec)=norm_grad_of_field(iglob) Lap1_vp(i,j,k,ispec)=laplacian_of_field(iglob) enddo @@ -2112,11 +2112,11 @@ subroutine compute_grad_laplacian_vp_vs_rho(nGrad_vp, nGrad_vs, nGrad_rh, Lap1_v field_to_derivate(:)=field(2,:) call compute_grad_laplacian(field_to_derivate, laplacian_of_field, norm_grad_of_field) !!!!!!!!! , regularization_fd) - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) nGrad_vs(i,j,k,ispec)=norm_grad_of_field(iglob) Lap1_vs(i,j,k,ispec)=laplacian_of_field(iglob) enddo @@ -2126,11 +2126,11 @@ subroutine compute_grad_laplacian_vp_vs_rho(nGrad_vp, nGrad_vs, nGrad_rh, Lap1_v field_to_derivate(:)=field(3,:) call compute_grad_laplacian(field_to_derivate, laplacian_of_field, norm_grad_of_field) !!!!!!!!! , regularization_fd) - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) nGrad_rh(i,j,k,ispec)=norm_grad_of_field(iglob) Lap1_rh(i,j,k,ispec)=laplacian_of_field(iglob) enddo @@ -2175,14 +2175,14 @@ subroutine compute_laplacian2_vp_vs_rho(Lap1_vp, Lap1_vs, Lap1_rh, Lap2_vp, Lap2 field(:,:)=0._CUSTOM_REAL valence(:)=0._CUSTOM_REAL - penalty=0._CUSTOM_REAL + penalty = 0._CUSTOM_REAL !! mean values of field on element boundary - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) !!$ field(1,iglob)=field(1,iglob) + current_model_vp(i,j,k,ispec) !!$ field(2,iglob)=field(2,iglob) + current_model_vs(i,j,k,ispec) !!$ field(3,iglob)=field(3,iglob) + current_model_rh(i,j,k,ispec) @@ -2197,11 +2197,11 @@ subroutine compute_laplacian2_vp_vs_rho(Lap1_vp, Lap1_vs, Lap1_rh, Lap2_vp, Lap2 field(3,:)=field(3,:)/valence(:) !! VP - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) field_to_derivate(i,j,k,ispec)=field(1,iglob) enddo enddo @@ -2210,11 +2210,11 @@ subroutine compute_laplacian2_vp_vs_rho(Lap1_vp, Lap1_vs, Lap1_rh, Lap2_vp, Lap2 call compute_derivatives_with_interpolation(field_to_derivate, lap1_vp, Lap2_vp) !! VS - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) field_to_derivate(i,j,k,ispec)=field(2,iglob) enddo enddo @@ -2223,11 +2223,11 @@ subroutine compute_laplacian2_vp_vs_rho(Lap1_vp, Lap1_vs, Lap1_rh, Lap2_vp, Lap2 call compute_derivatives_with_interpolation(field_to_derivate, lap1_vs, Lap2_vs) !! rho - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) field_to_derivate(i,j,k,ispec)=field(3,iglob) enddo enddo @@ -2352,10 +2352,10 @@ subroutine compute_mean_values_on_edge(field) valence(:,:) = 0. !! 1/ compute average value on boundary of elements - do ispec=1, NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1, NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) field_wksp(1,iglob) = field_wksp(1,iglob) + field(1,i,j,k,ispec) @@ -2428,18 +2428,18 @@ subroutine setup_interpolation_for_higher_degree() call zwgljd(gll_points, wgll_points, NGLLd,GAUSSALPHA,GAUSSBETA) - do i1=1,NGLLd + do i1 = 1,NGLLd call lagrange_any(gll_points(i1),NGLLX,xigll,h,hprime) hlagrange(:,i1)=h(:) enddo - do i1=1,NGLLd - do i2=1,NGLLd + do i1 = 1,NGLLd + do i2 = 1,NGLLd hlagrange_prime(i2,i1) = lagrange_deriv_GLL(i1-1,i2-1,gll_points,NGLLd) enddo enddo - do i1=1,NGLLX + do i1 = 1,NGLLX call lagrange_any(xigll(i1), NGLLd, gll_points, h1, hprime1) hlagrange_old(:,i1)=h1(:) enddo @@ -2467,13 +2467,13 @@ subroutine interpolation_in_new_gll(field_in_element, field_in_higher_degree) integer :: ih, jh, kh field_in_higher_degree(:,:,:) = 0. - do kh=1,NGLLd - do jh=1,NGLLd - do ih=1,NGLLd + do kh = 1,NGLLd + do jh = 1,NGLLd + do ih = 1,NGLLd - do k=1,NGLLX - do j=1,NGLLX - do i=1,NGLLX + do k = 1,NGLLX + do j = 1,NGLLX + do i = 1,NGLLX field_in_higher_degree(ih,jh,kh) = field_in_higher_degree(ih,jh,kh) + & hlagrange(i,ih)*hlagrange(j,jh)*hlagrange(k,kh)*field_in_element(i,j,k) enddo @@ -2501,12 +2501,12 @@ subroutine interpolation_in_old_gll(field_in_higher_degree, field_in_element) integer :: ih, jh, kh field_in_element(:,:,:) = 0. - do k=1,NGLLX - do j=1,NGLLX - do i=1,NGLLX - do kh=1,NGLLd - do jh=1,NGLLd - do ih=1,NGLLd + do k = 1,NGLLX + do j = 1,NGLLX + do i = 1,NGLLX + do kh = 1,NGLLd + do jh = 1,NGLLd + do ih = 1,NGLLd field_in_element(i,j,k) = field_in_element(i,j,k) + & hlagrange_old(ih,i)*hlagrange_old(jh,j)*hlagrange_old(kh,k)*field_in_higher_degree(ih,jh,kh) enddo @@ -2535,9 +2535,9 @@ subroutine get_shape3D_genric(NGLL, gll_coord, shape_func, dershape_func) double precision :: ra1, ra2, rb1, rb2, rc1, rc2 integer :: i,j,k - do i=1,NGLL - do j=1,NGLL - do k=1,NGLL + do i = 1,NGLL + do j = 1,NGLL + do k = 1,NGLL xi = gll_coord(i) eta = gll_coord(j) @@ -2615,9 +2615,9 @@ subroutine compute_jacobian_one_element(xnode, ynode, znode, Jacobian_shape) double precision :: xmesh, ymesh, zmesh double precision :: jacobian - do k=1,NGLLd - do j=1,NGLLd - do i=1,NGLLd + do k = 1,NGLLd + do j = 1,NGLLd + do i = 1,NGLLd xxi = ZERO xeta = ZERO @@ -2632,7 +2632,7 @@ subroutine compute_jacobian_one_element(xnode, ynode, znode, Jacobian_shape) ymesh = ZERO zmesh = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD xxi = xxi + dershape_function(1,ia,i,j,k)*xnode(ia) xeta = xeta + dershape_function(2,ia,i,j,k)*xnode(ia) xgamma = xgamma + dershape_function(3,ia,i,j,k)*xnode(ia) @@ -2722,42 +2722,42 @@ subroutine compute_derivatives_with_interpolation(field_to_derivate, laplacian_o field_initial(:,:,:) = field_to_derivate(:,:,:,ispec) !! store elements control points - iglob=ibool(1,1,1,ispec) + iglob = ibool(1,1,1,ispec) xnodelm(1)=xstore(iglob) ynodelm(1)=ystore(iglob) znodelm(1)=zstore(iglob) - iglob=ibool(NGLLX,1,1,ispec) + iglob = ibool(NGLLX,1,1,ispec) xnodelm(2)=xstore(iglob) ynodelm(2)=ystore(iglob) znodelm(2)=zstore(iglob) - iglob=ibool(NGLLX,NGLLY,1,ispec) + iglob = ibool(NGLLX,NGLLY,1,ispec) xnodelm(3)=xstore(iglob) ynodelm(3)=ystore(iglob) znodelm(3)=zstore(iglob) - iglob=ibool(1,NGLLY,1,ispec) + iglob = ibool(1,NGLLY,1,ispec) xnodelm(4)=xstore(iglob) ynodelm(4)=ystore(iglob) znodelm(4)=zstore(iglob) - iglob=ibool(1,1,NGLLZ,ispec) + iglob = ibool(1,1,NGLLZ,ispec) xnodelm(5)=xstore(iglob) ynodelm(5)=ystore(iglob) znodelm(5)=zstore(iglob) - iglob=ibool(NGLLX,1,NGLLZ,ispec) + iglob = ibool(NGLLX,1,NGLLZ,ispec) xnodelm(6)=xstore(iglob) ynodelm(6)=ystore(iglob) znodelm(6)=zstore(iglob) - iglob=ibool(NGLLX,NGLLY,NGLLZ,ispec) + iglob = ibool(NGLLX,NGLLY,NGLLZ,ispec) xnodelm(7)=xstore(iglob) ynodelm(7)=ystore(iglob) znodelm(7)=zstore(iglob) - iglob=ibool(1,NGLLY,NGLLZ,ispec) + iglob = ibool(1,NGLLY,NGLLZ,ispec) xnodelm(8)=xstore(iglob) ynodelm(8)=ystore(iglob) znodelm(8)=zstore(iglob) @@ -2799,14 +2799,14 @@ subroutine compute_laplacian_lagrange_element(Laplacian_of_field_in_element, fie double precision :: etaxl, etayl, etazl double precision :: gammaxl, gammayl, gammazl - do k=1,NGLLd - do j=1, NGLLd - do i=1,NGLLd + do k = 1,NGLLd + do j = 1, NGLLd + do i = 1,NGLLd tempx1l = 0.d0 tempx2l = 0.d0 tempx3l = 0.d0 - do l=1,NGLLd + do l = 1,NGLLd hp1 = hlagrange_prime(i,l) tempx1l = tempx1l + field_in_element(l,j,k)*hp1 @@ -2838,9 +2838,9 @@ subroutine compute_laplacian_lagrange_element(Laplacian_of_field_in_element, fie enddo enddo - do k=1,NGLLd - do j=1, NGLLd - do i=1,NGLLd + do k = 1,NGLLd + do j = 1, NGLLd + do i = 1,NGLLd tempx1l = 0.d0 tempx2l = 0.d0 @@ -2851,7 +2851,7 @@ subroutine compute_laplacian_lagrange_element(Laplacian_of_field_in_element, fie tempz1l = 0.d0 tempz2l = 0.d0 tempz3l = 0.d0 - do l=1,NGLLd + do l = 1,NGLLd hp1 = hlagrange_prime(i,l) tempx1l = tempx1l + dfdx(l,j,k)*hp1 @@ -2901,9 +2901,9 @@ subroutine compute_function_to_test_in_one_element(field_to_define) double precision :: x,y,z integer i,j,k - do k=1,NGLLd - do j=1, NGLLd - do i=1,NGLLd + do k = 1,NGLLd + do j = 1, NGLLd + do i = 1,NGLLd x = xstore_interp(i,j,k) y = ystore_interp(i,j,k) z = zstore_interp(i,j,k) @@ -3047,7 +3047,7 @@ subroutine send_recv_blocking(buffer_to_send, buffer_to_recv) real(kind=CUSTOM_REAL), dimension(:), intent(inout) :: buffer_to_send, buffer_to_recv ! local integer :: irank, igll, ishift - integer :: itag=0 + integer :: itag = 0 do irank = 0, NPROC-1 if (struct_comm(irank)%ns > 0) then @@ -3071,7 +3071,7 @@ subroutine send_recv_blocking(buffer_to_send, buffer_to_recv) enddo do irank = 0, NPROC-1 - ishift=struct_comm(irank)%ibegin + ishift = struct_comm(irank)%ibegin if (struct_comm(irank)%nr > 0) then do igll = 1, struct_comm(irank)%nr buffer_to_recv(igll + ishift) = struct_comm(irank)%array_to_recv(igll) @@ -3107,11 +3107,11 @@ subroutine compute_first_derivatives_lagrange(Df, field_to_derivate) real(kind=CUSTOM_REAL) :: gammaxl,gammayl,gammazl integer :: ispec, ispec_irreg, iglob, i, j, k, l - do ispec =1, NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX - iglob=ibool(i,j,k,ispec) + do ispec = 1, NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + iglob = ibool(i,j,k,ispec) dummyloc(i,j,k) = field_to_derivate(iglob) enddo enddo @@ -3119,9 +3119,9 @@ subroutine compute_first_derivatives_lagrange(Df, field_to_derivate) ispec_irreg = irregular_element_number(ispec) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -3129,7 +3129,7 @@ subroutine compute_first_derivatives_lagrange(Df, field_to_derivate) tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + dummyloc(l,j,k)*hp1 @@ -3203,12 +3203,12 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) if (DEBUG_MODE) write(IIDD,*) - do ispec =1, NSPEC_AB + do ispec = 1, NSPEC_AB !! first derivatives - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) F(i,j,k) = field_to_derivate(iglob) enddo @@ -3220,9 +3220,9 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) F(:,:,:) = F(:,:,:)/coef_norm ispec_irreg = irregular_element_number(ispec) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -3230,7 +3230,7 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(l,j,k)*hp1 @@ -3284,9 +3284,9 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) !coef_norm=1. F(:,:,:)=F(:,:,:)/coef_norm - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -3294,7 +3294,7 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(l,j,k)*hp1 @@ -3348,9 +3348,9 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) !coef_norm=1. F(:,:,:)=F(:,:,:)/coef_norm - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -3358,7 +3358,7 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(l,j,k)*hp1 @@ -3409,9 +3409,9 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) !coef_norm=1. F(:,:,:)=F(:,:,:)/coef_norm - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -3419,7 +3419,7 @@ subroutine compute_laplac_lagrange(Lapf, field_to_derivate) tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(l,j,k)*hp1 @@ -3686,10 +3686,10 @@ subroutine compute_grad_laplac_lagrange(nGrad, Lapf, field_to_derivate) call compute_mean_values_on_edge(Derivatives_of_field) ! store norm L2 of gradient - do ispec=1, NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1, NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) nGrad(iglob) = sqrt(Derivatives_of_field(1,i,j,k,ispec)**2 + Derivatives_of_field(2,i,j,k,ispec)**2 +& Derivatives_of_field(3,i,j,k,ispec)**2) @@ -3705,10 +3705,10 @@ subroutine compute_grad_laplac_lagrange(nGrad, Lapf, field_to_derivate) field_to_derivate(:)=field_to_derivate_wks(1,:) call compute_first_derivatives_lagrange(Derivatives_of_field, field_to_derivate) !! store result - do ispec=1, NSPEC_AB - do k=1, NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1, NSPEC_AB + do k = 1, NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) !LapF(iglob) = Derivatives_of_field(1,i,j,k,ispec) Fwks(1,iglob) = Derivatives_of_field(1,i,j,k,ispec) @@ -3721,10 +3721,10 @@ subroutine compute_grad_laplac_lagrange(nGrad, Lapf, field_to_derivate) field_to_derivate(:)=field_to_derivate_wks(2,:) call compute_first_derivatives_lagrange(Derivatives_of_field, field_to_derivate) !! store result - do ispec=1, NSPEC_AB - do k=1, NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1, NSPEC_AB + do k = 1, NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) !LapF(iglob) = LapF(iglob) + Derivatives_of_field(2,i,j,k,ispec) !LapF(iglob) = Derivatives_of_field(2,i,j,k,ispec) @@ -3739,10 +3739,10 @@ subroutine compute_grad_laplac_lagrange(nGrad, Lapf, field_to_derivate) field_to_derivate(:)=field_to_derivate_wks(3,:) call compute_first_derivatives_lagrange(Derivatives_of_field, field_to_derivate) !! store result - do ispec=1, NSPEC_AB - do k=1, NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1, NSPEC_AB + do k = 1, NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) !LapF(iglob) = LapF(iglob) + Derivatives_of_field(3,i,j,k,ispec) !LapF(iglob) = Derivatives_of_field(3,i,j,k,ispec) @@ -4080,20 +4080,20 @@ subroutine compute_laplacian_FD(Dfb, field_input, regularization_fd) call send_recv_blocking(field_to_send, field_overlap) !! 3/ process derivatives in edges by FD - do iglob_index=1, Nb_iglob_on_faces - ncolu=regularization_fd(iglob_index)%nReg+regularization_fd(iglob_index)%nNei + do iglob_index = 1, Nb_iglob_on_faces + ncolu = regularization_fd(iglob_index)%nReg+regularization_fd(iglob_index)%nNei allocate(Values(ncolu),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 202') - ip=0 - do igll=1, regularization_fd(iglob_index)%nReg + ip = 0 + do igll = 1, regularization_fd(iglob_index)%nReg ip = ip + 1 - iglob=regularization_fd(iglob_index)%iglob_regular_point_to_use(igll) + iglob = regularization_fd(iglob_index)%iglob_regular_point_to_use(igll) Values(ip)=field_to_send(iglob) enddo do igll = 1, regularization_fd(iglob_index)%nNei - ip=ip+1 + ip = ip+1 iglob = regularization_fd(iglob_index)%iglob_neighbo_point_to_use(igll) Values(ip) = field_overlap(iglob) enddo @@ -4166,20 +4166,20 @@ subroutine compute_gradient_laplacian_FD(nGrad, Laplac, field_input, regularizat call send_recv_blocking(field_to_send, field_overlap) !! 3/ process derivatives in edges by FD - do iglob_index=1, Nb_iglob_on_faces - ncolu=regularization_fd(iglob_index)%nReg+regularization_fd(iglob_index)%nNei + do iglob_index = 1, Nb_iglob_on_faces + ncolu = regularization_fd(iglob_index)%nReg+regularization_fd(iglob_index)%nNei allocate(Values(ncolu),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 205') - ip=0 - do igll=1, regularization_fd(iglob_index)%nReg + ip = 0 + do igll = 1, regularization_fd(iglob_index)%nReg ip = ip + 1 - iglob=regularization_fd(iglob_index)%iglob_regular_point_to_use(igll) + iglob = regularization_fd(iglob_index)%iglob_regular_point_to_use(igll) Values(ip)=field_to_send(iglob) enddo do igll = 1, regularization_fd(iglob_index)%nNei - ip=ip+1 + ip = ip+1 iglob = regularization_fd(iglob_index)%iglob_neighbo_point_to_use(igll) Values(ip) = field_overlap(iglob) enddo @@ -4320,9 +4320,9 @@ subroutine matrix_times_vector(r, A, b, n, m) integer :: i,k - do i=1,n + do i = 1,n r(i)=0. - do k=1,m + do k = 1,m r(i)=r(i)+A(i,k)*b(k) enddo enddo @@ -4449,10 +4449,10 @@ subroutine write_in_disk_this(f) itest = 1 allocate(dd(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 206') - do ispec=1,nspec_ab - do k=1,ngllz - do j=1,nglly - do i=1,ngllx + do ispec = 1,nspec_ab + do k = 1,ngllz + do j = 1,nglly + do i = 1,ngllx iglob = ibool(i,j,k,ispec) dd(i,j,k,ispec)=f(iglob) enddo @@ -4550,9 +4550,9 @@ subroutine compute_derivative_with_lagrange_polynomials(derivative_of_field, fie do ispec = 1, NSPEC_AB !! store field in local array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX !iglob=ibool(i,j,k,ispec) F(i,j,k)=field_to_derivate(1,i,j,k,ispec) enddo @@ -4560,9 +4560,9 @@ subroutine compute_derivative_with_lagrange_polynomials(derivative_of_field, fie enddo ispec_irreg = irregular_element_number(ispec) !! derivative of field based on lagrange polynomials - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX !iglob = ibool(i,j,k,ispec) @@ -4570,7 +4570,7 @@ subroutine compute_derivative_with_lagrange_polynomials(derivative_of_field, fie tempx2l = 0. tempx3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(l,j,k)*hp1 @@ -4609,9 +4609,9 @@ subroutine compute_derivative_with_lagrange_polynomials(derivative_of_field, fie enddo !! get derivative of field from local array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX derivative_of_field(1,i,j,k,ispec)= dF(1,i,j,k) derivative_of_field(2,i,j,k,ispec)= dF(2,i,j,k) derivative_of_field(3,i,j,k,ispec)= dF(3,i,j,k) @@ -4647,12 +4647,12 @@ subroutine compute_2nd_derivative_with_lagrange_polynomials(derivative_of_field, double precision :: gammaxl,gammayl,gammazl integer :: ispec, ispec_irreg,i, j, k, l - do ispec =1, NSPEC_AB + do ispec = 1, NSPEC_AB !! store field in local array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX F(1,i,j,k)=field_to_derivate(1,i,j,k,ispec) F(2,i,j,k)=field_to_derivate(2,i,j,k,ispec) F(3,i,j,k)=field_to_derivate(3,i,j,k,ispec) @@ -4662,9 +4662,9 @@ subroutine compute_2nd_derivative_with_lagrange_polynomials(derivative_of_field, ispec_irreg = irregular_element_number(ispec) !! derivative of field based on lagrange polynomials - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX !iglob = ibool(i,j,k,ispec) @@ -4680,7 +4680,7 @@ subroutine compute_2nd_derivative_with_lagrange_polynomials(derivative_of_field, tempz2l = 0. tempz3l = 0 - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + F(1,l,j,k)*hp1 @@ -4728,9 +4728,9 @@ subroutine compute_2nd_derivative_with_lagrange_polynomials(derivative_of_field, enddo !! get derivative of field from local array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX derivative_of_field(1,i,j,k,ispec)= dF(1,i,j,k) derivative_of_field(2,i,j,k,ispec)= dF(2,i,j,k) derivative_of_field(3,i,j,k,ispec)= dF(3,i,j,k) diff --git a/src/inverse_problem_for_model/specfem_interface/specfem_interface_mod.F90 b/src/inverse_problem_for_model/specfem_interface/specfem_interface_mod.F90 index d6f61fb36..df1de2445 100644 --- a/src/inverse_problem_for_model/specfem_interface/specfem_interface_mod.F90 +++ b/src/inverse_problem_for_model/specfem_interface/specfem_interface_mod.F90 @@ -1091,7 +1091,7 @@ subroutine InitializeSpecfemForInversion(inversion_param) INVERSE_FWI_FULL_PROBLEM = .true. !! following subroutines are directly from specfem3D git devel version - call initialize_simulation() !! here : we need to initialize with NGLOB_ADJ=NSPEC_ADJ=NSPEC_STRAIN_ONLY=1 + call initialize_simulation() !! here : we need to initialize with NGLOB_ADJ = NSPEC_ADJ=NSPEC_STRAIN_ONLY = 1 if (inversion_param%only_forward) then ! forward diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_constants.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_constants.f90 index 2ced77d7d..7cf7043cd 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_constants.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_constants.f90 @@ -59,7 +59,7 @@ module cmt3d_constants real, parameter :: REF_DIST = 100.0 ! Earth's radius for depth scaling - integer, parameter :: R_EARTH=6371 ! km + integer, parameter :: R_EARTH = 6371 ! km end module cmt3d_constants diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub.f90 index 6d3a87f53..7c1492f12 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub.f90 @@ -27,7 +27,7 @@ subroutine set_parameters(par_file) if (ios /= 0) stop 'Error reading npar' read(line(3:),*,iostat=ios) global_coord ! if no global_coord specified - if (ios /= 0) global_coord=.false. + if (ios /= 0) global_coord = .false. if (.not. global_coord) then ! local coordinates (DEP, LON, LAT) par_name = (/'Mrr','Mtt','Mpp','Mrt','Mrp', 'Mtp','dep','lon','lat', & @@ -67,7 +67,7 @@ subroutine set_parameters(par_file) if (ios /= 0) stop 'Error reading weigh_data_files' read(line(8:),'(l7)',iostat=ios) read_weight - if (ios /= 0) read_weight=.false. + if (ios /= 0) read_weight = .false. ! here we assume that Pnl wave window is the first window out ! of possible two windows selected for Z and R components @@ -239,7 +239,7 @@ subroutine setup_matrix(A,b,npar) if (DEBUG) then ! write matrices write(*,'(/,a)') ' Inversion matrix A is as follows...' - do i=1,npar + do i = 1,npar write(*,'(12e12.3)') (sngl(A(j,i)),j=1,npar) enddo write(*,'(/,a)') ' RHS vector b is as follows...' @@ -396,29 +396,29 @@ subroutine variance_reduction(dm,npar) do j = 1, nw nwint = nwint + 1 read(IOWIN,*) tstart, tend - is=max(floor((tstart-b)/dt),1) - ie=min(ceiling((tend-b)/dt),npts) + is = max(floor((tstart-b)/dt),1) + ie = min(ceiling((tend-b)/dt),npts) if (station_correction) then !!! needs update? call calc_criteria(data_sngl,syn_sngl,npts,is,ie,ishift,cc,dlna) call calc_criteria(data_sngl,new_syn_sngl,npts,is,ie,ishift_new,cc_new,dlna_new) - istart_d=max(1,is+ishift); iend_d=min(npts,ie+ishift) - istart_dn=max(1,is+ishift_new); iend_dn=min(npts,ie+ishift_new) - istart=istart_d-ishift; iend=iend_d-ishift - istart_n=istart_dn-ishift_new; iend_n=iend_dn-ishift_new + istart_d = max(1,is+ishift); iend_d = min(npts,ie+ishift) + istart_dn = max(1,is+ishift_new); iend_dn = min(npts,ie+ishift_new) + istart = istart_d-ishift; iend = iend_d-ishift + istart_n = istart_dn-ishift_new; iend_n = iend_dn-ishift_new else - istart_d=is; istart=is; iend_d=ie; iend=ie - istart_dn=is; istart_n=is; iend_dn=ie; iend_n=ie + istart_d = is; istart = is; iend_d = ie; iend = ie + istart_dn = is; istart_n = is; iend_dn = ie; iend_n = ie endif ! hanning taper do ii = istart,iend taper(ii) = 0.5 * (1-cos(2*pi*(ii-istart)/(iend-istart))) enddo - v1=sum(taper(istart:iend)*(syn_sngl(istart:iend)-data_sngl(istart_d:iend_d))**2) - v2=sum(taper(istart:iend)*(new_syn_sngl(istart_n:iend_n)-data_sngl(istart_dn:iend_dn))**2) - d1=sum(taper(istart:iend)*data_sngl(istart_d:iend_d)**2) - d2=sum(taper(istart:iend)*data_sngl(istart_dn:iend_dn)**2) + v1 = sum(taper(istart:iend)*(syn_sngl(istart:iend)-data_sngl(istart_d:iend_d))**2) + v2 = sum(taper(istart:iend)*(new_syn_sngl(istart_n:iend_n)-data_sngl(istart_dn:iend_dn))**2) + d1 = sum(taper(istart:iend)*data_sngl(istart_d:iend_d)**2) + d2 = sum(taper(istart:iend)*data_sngl(istart_dn:iend_dn)**2) var_all = var_all + 0.5*v1*data_weights(nwint)*dt var_all_new = var_all_new + 0.5*v2*data_weights(nwint)*dt diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub2.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub2.f90 index f6f4f1a33..5acf21d5a 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub2.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub2.f90 @@ -32,11 +32,11 @@ subroutine read_sac_info(file_s, file_o, kstnm, kcmpnm, knetwk, & ! check sample rates are equal if (abs(dt1-dt2) > EPS5) stop 'Sampling rates differ, program stop !!!' dt = dble(dt1) - !write(*,*)'sampling rate dt=',dt + !write(*,*) 'sampling rate dt=',dt ! check start times are equal (LQY: a difference of dt is probably too big) if (abs(b1-b2) > dt) stop ' start times differ, program stop !!!' - b=dble(b1) + b = dble(b1) ! set global npts to the npts of the shortest seismogram npts = min(npts1, npts2) @@ -54,7 +54,7 @@ subroutine read_sac_info(file_s, file_o, kstnm, kcmpnm, knetwk, & call getkhv('kcmpnm', kcmpnm, nerr) call getkhv('knetwk', knetwk, nerr) - cmp=kcmpnm(3:3) + cmp = kcmpnm(3:3) if ((cmp /= 'Z') .and. (cmp /= 'T') .and. (cmp /= 'R')) & stop 'We only deal with Z, R, and T components at the moment' @@ -92,7 +92,7 @@ subroutine compute_data_weights(kcmpnm,azimuth,dist_km,data_weights) nwint = nwint + 1 ! component weights - comp_name=kcmpnm(i) + comp_name = kcmpnm(i) if (comp_name(3:3) == 'Z') then cmp_weight(nwint)=comp_z_weight else if (comp_name(3:3) == 'R') then @@ -165,7 +165,7 @@ subroutine compute_A_b(syn_file,data_file,data_weight,tstart,tend,A1,b1,npar) ! read in data, syn call rsac1(data_file,data_sngl,npts1,t0,dt,NDATAMAX,nerr) call rsac1(syn_file,syn_sngl,npts2,t0,dt,NDATAMAX,nerr) - npts=min(npts1,npts2) + npts = min(npts1,npts2) ! array indices of the start and end of the selected window istart = max(floor((tstart-t0)/dt),1) @@ -180,8 +180,8 @@ subroutine compute_A_b(syn_file,data_file,data_weight,tstart,tend,A1,b1,npar) call calc_criteria(data_sngl,syn_sngl,npts,istart,iend,nshift,cc,dlna) istart_d = max(1,istart + nshift) iend_d = min(npts,iend + nshift) - istart_s=istart_d-nshift - iend_s=iend_d-nshift + istart_s = istart_d-nshift + iend_s = iend_d-nshift else istart_d = istart; iend_d = iend istart_s = istart; iend_s = iend @@ -192,7 +192,7 @@ subroutine compute_A_b(syn_file,data_file,data_weight,tstart,tend,A1,b1,npar) if (i < NML+1) then dsyn_file = trim(syn_file) // '.' // trim(par_name(i)) ! wierd enough, rsac1 can not detect the non-existence of dsyn_file - npts1=0 + npts1 = 0 inquire(file=dsyn_file,exist=lexd) call rsac1(dsyn_file,dsyn_sngl(:,i),npts1,t0_1,dt1,NDATAMAX,nerr) if (.not. lexd .or. nerr /= 0) then @@ -315,7 +315,7 @@ subroutine compute_new_syn(data_file,syn_file,npts,b,dt,dm) ! read in data, syn call rsac1(data_file,data_sngl,npts1,b,dt,NDATAMAX,nerr) call rsac1(syn_file,syn_sngl,npts2,b,dt,NDATAMAX,nerr) - npts=min(npts1,npts2) + npts = min(npts1,npts2) call getkhv('kstnm', kstnm, nerr) call getkhv('kcmpnm', kcmpnm, nerr) @@ -325,7 +325,7 @@ subroutine compute_new_syn(data_file,syn_file,npts,b,dt,dm) do i = 1, npar if (i < NML+1) then dsyn_file = trim(syn_file) // '.' // trim(par_name(i)) - npts1=0 + npts1 = 0 call rsac1(dsyn_file,dsyn_sngl(:,i),npts1,b1,dt1,NDATAMAX,nerr) if (nerr /= 0) stop 'Error reading frechet derivative synthetics' if (npts1 /= npts2 .or. abs(b1-b) > EPS2 .or. abs(dt1-dt) > EPS5) & @@ -398,7 +398,7 @@ subroutine calc_criteria(d,s,npts,i1,i2,ishift,cc_max,dlnA) id_right = min(npts,i2+i) ! right-most point on the data that will be treated norm = sqrt(sum(s_win(id_left-i:id_right-i)**2) * sum(d_win(id_left:id_right)**2)) - cc=sum(s_win(id_left-i:id_right-i)*d_win(id_left:id_right)) + cc = sum(s_win(id_left-i:id_right-i)*d_win(id_left:id_right)) cc = cc/norm diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub4.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub4.f90 index 58a28fa8e..beabe9414 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub4.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/cmt3d_sub4.f90 @@ -32,15 +32,15 @@ subroutine rotate_cmt(cmt_par,npar,elat0,elon0,DIRECTION) moment(1,1)=cmt_par(1); moment(2,2)=cmt_par(2); moment(3,3)=cmt_par(3) moment(1,2)=cmt_par(4); moment(1,3)=cmt_par(5); moment(2,3)=cmt_par(6) moment(2,1)=moment(1,2); moment(3,1)=moment(1,3); moment(3,2)=moment(2,3) - moment=matmul(rmat, matmul(moment,transpose(rmat))) + moment = matmul(rmat, matmul(moment,transpose(rmat))) cmt_par(1)=moment(1,1); cmt_par(2)=moment(2,2); cmt_par(3)=moment(3,3) cmt_par(4)=moment(1,2); cmt_par(5)=moment(1,3); cmt_par(6)=moment(2,3) if (npar > 6) then ! guaranteed to be npar >= 9 - edep=cmt_par(7); elon=cmt_par(8); elat=cmt_par(9) + edep = cmt_par(7); elon = cmt_par(8); elat = cmt_par(9) if (abs(elon-elon0) > EPS5 .or. abs(elat-elat0) > EPS5) stop 'Error lat,lon' loc=(/R_EARTH-edep,0.d1,0.d1/) ! local [R,T,P] - loc=matmul(rmat,loc) ! global [X,Y,Z] + loc = matmul(rmat,loc) ! global [X,Y,Z] cmt_par(7:9)=loc(1:3) ![R,T,P] in local or [X,Y,Z] in global endif @@ -48,17 +48,17 @@ subroutine rotate_cmt(cmt_par,npar,elat0,elon0,DIRECTION) else ! DIRECTION = -1 : global to local coordinates if (npar > 6) then - gl=cmt_par(7:9)/sqrt(sum(cmt_par(7:9)**2)) ! global [X,Y,Z] - th=acos(gl(3)) + gl = cmt_par(7:9)/sqrt(sum(cmt_par(7:9)**2)) ! global [X,Y,Z] + th = acos(gl(3)) if (abs(th) < EPS5 .or. abs(th-pi) < EPS5) then - phi=0 + phi = 0 else - phi=atan2(gl(2)/sin(th),gl(1)/sin(th)) + phi = atan2(gl(2)/sin(th),gl(1)/sin(th)) endif - elon=phi*180/PI; elat=90-th*180/PI - if (elon > 180) elon=elon-360 + elon = phi*180/PI; elat = 90-th*180/PI + if (elon > 180) elon = elon-360 else - elat=elat0; elon=elon0 + elat = elat0; elon = elon0 endif call calc_rot_matrix(elon,elat,rmat) @@ -66,12 +66,12 @@ subroutine rotate_cmt(cmt_par,npar,elat0,elon0,DIRECTION) moment(1,1)=cmt_par(1); moment(2,2)=cmt_par(2); moment(3,3)=cmt_par(3) moment(1,2)=cmt_par(4); moment(1,3)=cmt_par(5); moment(2,3)=cmt_par(6) moment(2,1)=moment(1,2); moment(3,1)=moment(1,3); moment(3,2)=moment(2,3) - moment=matmul(transpose(rmat), matmul(moment,rmat)) + moment = matmul(transpose(rmat), matmul(moment,rmat)) cmt_par(1)=moment(1,1); cmt_par(2)=moment(2,2); cmt_par(3)=moment(3,3) cmt_par(4)=moment(1,2); cmt_par(5)=moment(1,3); cmt_par(6)=moment(2,3) if (npar > 6) then - loc=matmul(transpose(rmat),cmt_par(7:9)) ! moment, loc in [R,T,P] local coord + loc = matmul(transpose(rmat),cmt_par(7:9)) ! moment, loc in [R,T,P] local coord if (abs(loc(2)) > EPS5 .or. abs(loc(3)) > EPS5) stop 'Error loc(2,3)' cmt_par(7)=R_EARTH-loc(1); cmt_par(8)=elon; cmt_par(9)=elat ! [depth,lon,lat] endif @@ -88,7 +88,7 @@ subroutine calc_rot_matrix(elon,elat,rmat) real*8 :: th,phi th=(90-elat)*PI/180 - phi=elon*PI/180 + phi = elon*PI/180 rmat(1,1)=dsin(th)*dcos(phi) rmat(1,2)=dcos(th)*dcos(phi) diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/get_cmt.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/get_cmt.f90 index fa9e13618..f694416d3 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/get_cmt.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/get_cmt.f90 @@ -27,11 +27,11 @@ subroutine get_cmt(cmt_file,yr,mo,jda,ho,mi,sec, & read(1,"(a4,i5,i3,i3,i3,i3,f6.2,f9.4,f10.4,f6.1,f4.1,f4.1,1x,a)",iostat=ios) & datasource,yr,mo,da,ho,mi,sec,elat,elon,depth,mb,ms,reg if (ios /= 0) stop 'Error reading the information line of the CMT file' - jda=julian_day(yr,mo,da) - ios=0 + jda = julian_day(yr,mo,da) + ios = 0 do while(ios == 0) read(1,"(a)",iostat=ios) string - lstr=len_trim(string) + lstr = len_trim(string) if (string(1:10) == 'event name') then else if (string(1:10) == 'time shift') then @@ -76,8 +76,8 @@ integer function julian_day(yr,mo,da) integer :: lpyr - julian_day=da+mon(mo) - if (mo > 2) julian_day=julian_day+lpyr(yr) + julian_day = da+mon(mo) + if (mo > 2) julian_day = julian_day+lpyr(yr) end function julian_day @@ -91,13 +91,13 @@ integer function lpyr(yr) ! !---- returns 1 if yr is a leap year ! - lpyr=0 + lpyr = 0 if (mod(yr,400) == 0) then - lpyr=1 + lpyr = 1 else if (mod(yr,4) == 0) then - lpyr=1 + lpyr = 1 if (mod(yr,100) == 0) then - lpyr=0 + lpyr = 0 endif endif diff --git a/src/inverse_problem_for_source/CMT3D/cmt3d/utm_geo.f90 b/src/inverse_problem_for_source/CMT3D/cmt3d/utm_geo.f90 index a97c3c22f..f8d8b609a 100644 --- a/src/inverse_problem_for_source/CMT3D/cmt3d/utm_geo.f90 +++ b/src/inverse_problem_for_source/CMT3D/cmt3d/utm_geo.f90 @@ -40,11 +40,11 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT double precision rx,ry,rlon,rlat logical SUPPRESS_UTM_PROJECTION - double precision, parameter :: degrad=PI/180.d0, raddeg=180.d0/PI + double precision, parameter :: degrad = PI/180.d0, raddeg = 180.d0/PI !double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 ellipsoid - double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 ellipsoid - double precision, parameter :: scfa=0.9996d0 - double precision, parameter :: north=0.d0, east=500000.d0 + double precision, parameter :: semimaj = 6378137.0d0, semimin = 6356752.314245d0 ! WGS-84 ellipsoid + double precision, parameter :: scfa = 0.9996d0 + double precision, parameter :: north = 0.d0, east = 500000.d0 double precision e2,e4,e6,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d @@ -68,10 +68,10 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT ry_save = ry ! define parameters of reference ellipsoid - e2=1.0-(semimin/semimaj)**2.0 - e4=e2*e2 - e6=e2*e4 - ep2=e2/(1.-e2) + e2 = 1.0-(semimin/semimaj)**2.0 + e4 = e2*e2 + e6 = e2*e4 + ep2 = e2/(1.-e2) if (iway == IUTM2LONGLAT) then xx = rx diff --git a/src/inverse_problem_for_source/CMT3D/grid3d/get_cmt.f90 b/src/inverse_problem_for_source/CMT3D/grid3d/get_cmt.f90 index fa9e13618..f694416d3 100644 --- a/src/inverse_problem_for_source/CMT3D/grid3d/get_cmt.f90 +++ b/src/inverse_problem_for_source/CMT3D/grid3d/get_cmt.f90 @@ -27,11 +27,11 @@ subroutine get_cmt(cmt_file,yr,mo,jda,ho,mi,sec, & read(1,"(a4,i5,i3,i3,i3,i3,f6.2,f9.4,f10.4,f6.1,f4.1,f4.1,1x,a)",iostat=ios) & datasource,yr,mo,da,ho,mi,sec,elat,elon,depth,mb,ms,reg if (ios /= 0) stop 'Error reading the information line of the CMT file' - jda=julian_day(yr,mo,da) - ios=0 + jda = julian_day(yr,mo,da) + ios = 0 do while(ios == 0) read(1,"(a)",iostat=ios) string - lstr=len_trim(string) + lstr = len_trim(string) if (string(1:10) == 'event name') then else if (string(1:10) == 'time shift') then @@ -76,8 +76,8 @@ integer function julian_day(yr,mo,da) integer :: lpyr - julian_day=da+mon(mo) - if (mo > 2) julian_day=julian_day+lpyr(yr) + julian_day = da+mon(mo) + if (mo > 2) julian_day = julian_day+lpyr(yr) end function julian_day @@ -91,13 +91,13 @@ integer function lpyr(yr) ! !---- returns 1 if yr is a leap year ! - lpyr=0 + lpyr = 0 if (mod(yr,400) == 0) then - lpyr=1 + lpyr = 1 else if (mod(yr,4) == 0) then - lpyr=1 + lpyr = 1 if (mod(yr,100) == 0) then - lpyr=0 + lpyr = 0 endif endif diff --git a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_constants.f90 b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_constants.f90 index 46f23a077..a296cc808 100644 --- a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_constants.f90 +++ b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_constants.f90 @@ -14,7 +14,7 @@ module grid3d_constants integer, parameter :: NRAKE_MAX = 40 ! maximum total array dimension 80000 - integer, parameter :: NMEC_MAX=NMW_MAX*NST_MAX*NDIP_MAX*NRAKE_MAX + integer, parameter :: NMEC_MAX = NMW_MAX*NST_MAX*NDIP_MAX*NRAKE_MAX ! maximum number of records (NRECMAX < NWINMAX) integer, parameter :: NRECMAX = 1200 @@ -23,7 +23,7 @@ module grid3d_constants integer, parameter :: NWINMAX = 1800 ! maximum number of data points - integer, parameter :: NDATAMAX=30000 + integer, parameter :: NDATAMAX = 30000 ! number of pars for moment only integer, parameter :: NM = 6 diff --git a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub.f90 b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub.f90 index 166681b6a..ef7395da7 100644 --- a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub.f90 +++ b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub.f90 @@ -26,7 +26,7 @@ subroutine set_parameters(par_file) if (ios /= 0) stop 'Error reading weigh_data_files' read(IOPAR,'(l7)',iostat=ios) read_weight - if (ios /= 0) read_weight=.false. + if (ios /= 0) read_weight = .false. read(IOPAR,*) comp_z_weight, comp_t_weight, comp_r_weight, & az_exp_weight, & @@ -55,7 +55,7 @@ subroutine set_parameters(par_file) call get_cmt(cmt_file,yr,mo,jda,ho,mi,sec, & t_cmt,hdur,elat,elon,depth,moment_tensor) - mw=log10(dsqrt((sum(moment_tensor(1:3)**2)+2*sum(moment_tensor(4:6)**2))/2.))/1.5-10.73 + mw = log10(dsqrt((sum(moment_tensor(1:3)**2)+2*sum(moment_tensor(4:6)**2))/2.))/1.5-10.73 ! these are global search control parameters -- can be adjusted ! 19x10x13x5 @@ -63,16 +63,16 @@ subroutine set_parameters(par_file) s_dip = 0; e_dip = 90; d_dip = 10 s_rake = -180; e_rake = 180; d_rake = 30 s_mw = mw * 0.9; e_mw = mw * 1.1; d_mw = mw * 0.05 - t_strike=1.5; t_dip=1.5; t_rake=1.5; t_mw=1 + t_strike = 1.5; t_dip = 1.5; t_rake = 1.5; t_mw = 1 endif read(IOPAR,*) write_new_cmt - if (write_new_cmt) new_cmt_file=trim(cmt_file)//'_GRD' + if (write_new_cmt) new_cmt_file = trim(cmt_file)//'_GRD' ! convert to radians - s_strike=s_strike*d2r; e_strike=e_strike*d2r; d_strike=d_strike*d2r - s_dip=s_dip*d2r; e_dip=e_dip*d2r; d_dip=d_dip*d2r - s_rake=s_rake*d2r; e_rake=e_rake*d2r; d_rake=d_rake*d2r + s_strike = s_strike*d2r; e_strike = e_strike*d2r; d_strike = d_strike*d2r + s_dip = s_dip*d2r; e_dip = e_dip*d2r; d_dip = d_dip*d2r + s_rake = s_rake*d2r; e_rake = e_rake*d2r; d_rake = d_rake*d2r ! print more information here @@ -206,10 +206,10 @@ subroutine grid_search write(*,*) ' Mw = ', s_mw,e_mw,d_mw endif - n_strike=nint((e_strike-s_strike)/d_strike)+1 - n_dip=nint((e_dip-s_dip)/d_dip)+1 - n_rake=nint((e_rake-s_rake)/d_rake)+1 - n_mw=nint((e_mw-s_mw)/d_mw)+1 + n_strike = nint((e_strike-s_strike)/d_strike)+1 + n_dip = nint((e_dip-s_dip)/d_dip)+1 + n_rake = nint((e_rake-s_rake)/d_rake)+1 + n_mw = nint((e_mw-s_mw)/d_mw)+1 n_total =n_strike*n_dip*n_rake* n_mw @@ -259,7 +259,7 @@ subroutine grid_search print *, ' mw = ', mw, '+/-', d_mw if (write_new_cmt) then - moment=10 ** ((mw + 10.73) * 1.5) + moment = 10 ** ((mw + 10.73) * 1.5) call sdr2moment(strike,dip,rake,moment, & mijn(1),mijn(2),mijn(3),mijn(4),mijn(5),mijn(6)) call write_new_cmtsolution(cmt_file,trim(new_cmt_file),mijn) @@ -267,12 +267,12 @@ subroutine grid_search ! if global search, reassign mw, strike, dip and rake search ranges if (global_search .and. icalc < ncalc) then - s_mw=mw-t_mw*d_mw; e_mw=mw+t_mw*d_mw - s_strike=strike-t_strike*d_strike; e_strike=strike+t_strike*d_strike + s_mw = mw-t_mw*d_mw; e_mw = mw+t_mw*d_mw + s_strike = strike-t_strike*d_strike; e_strike = strike+t_strike*d_strike ! dip is not continuous - s_dip=max(0.,dip-t_dip*d_dip); e_dip = min(pi/2,dip+t_dip*d_dip) - s_rake=rake-t_rake*d_rake; e_rake = rake+t_rake*d_rake - d_mw=d_mw/2; d_strike=d_strike/4; d_dip=d_dip/4; d_rake=d_rake/4 + s_dip = max(0.,dip-t_dip*d_dip); e_dip = min(pi/2,dip+t_dip*d_dip) + s_rake = rake-t_rake*d_rake; e_rake = rake+t_rake*d_rake + d_mw = d_mw/2; d_strike = d_strike/4; d_dip = d_dip/4; d_rake = d_rake/4 endif enddo ! icalc diff --git a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub2.f90 b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub2.f90 index a23970fd1..996ac220e 100644 --- a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub2.f90 +++ b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub2.f90 @@ -35,11 +35,11 @@ subroutine read_sac_info(file_s, file_o, kstnm, kcmpnm, knetwk, & ! check sample rates are equal if (abs(dt1-dt2) > EPS5) stop 'Sampling rates differ, program stop !!!' dt = dble(dt1) - !write(*,*)'sampling rate dt=',dt + !write(*,*) 'sampling rate dt=',dt ! check start times are equal (LQY: a difference of dt is probably too big) if (abs(b1-b2) > dt) stop ' start times differ, program stop !!!' - b=dble(b1) + b = dble(b1) ! set global npts to the npts of the shortest seismogram npts = min(npts1, npts2) @@ -54,7 +54,7 @@ subroutine read_sac_info(file_s, file_o, kstnm, kcmpnm, knetwk, & call getkhv('kcmpnm', kcmpnm, nerr) call getkhv('knetwk', knetwk, nerr) - cmp=kcmpnm(3:3) + cmp = kcmpnm(3:3) if ((cmp /= 'Z') .and. (cmp /= 'T') .and. (cmp /= 'R')) & stop 'We only deal with Z, R, and T components at the moment' @@ -90,7 +90,7 @@ subroutine compute_data_weights(kcmpnm,azimuth,dist_km,data_weights) nwint = nwint + 1 ! component weights - comp_name=kcmpnm(i) + comp_name = kcmpnm(i) if (comp_name(3:3) == 'Z') then cmp_weight(nwint)=comp_z_weight else if (comp_name(3:3) == 'R') then @@ -154,7 +154,7 @@ subroutine compute_mij_from_sdr(s_strike,d_strike,n_strike, & integer :: im,ir,id,it,j ! loop over (mw,rake,dip,strike) to pre-calculate mij's - j=0 + j = 0 do im = 1, n_mw mw = s_mw + (im-1) * d_mw ! equation (9.45) from Modern Global Seismology @@ -165,7 +165,7 @@ subroutine compute_mij_from_sdr(s_strike,d_strike,n_strike, & dip = s_dip + (id-1) * d_dip do it = 1, n_strike strike = s_strike + (it-1) * d_strike - j=j+1 + j = j+1 call sdr2moment(strike,dip,rake,moment, & mij(1,j),mij(2,j),mij(3,j),mij(4,j),mij(5,j),mij(6,j)) enddo @@ -212,17 +212,17 @@ subroutine add_misfit(data_file,syn_file, & enddo ! core computation - ishift=0; ishift_max=nint(tshift_max/dt) + ishift = 0; ishift_max = nint(tshift_max/dt) do j = 1, n_total syn(1:npts) = matmul(mij(:,j),dsyn(:,1:npts)) / dmoment do iw = 1, nw - tt=t1(iw); iss=is(iw);iee=ie(iw) + tt = t1(iw); iss = is(iw);iee = ie(iw) if (station_correction) then call xcorr_calc(data,syn,npts,iss,iee,ishift,cc,ishift_max) - isd=max(1,iss+ishift); ied=min(npts,iee+ishift) - iss=isd-ishift; iee=ied-ishift + isd = max(1,iss+ishift); ied = min(npts,iee+ishift) + iss = isd-ishift; iee = ied-ishift else - isd=iss; ied=iee + isd = iss; ied = iee endif misfit(j) = misfit(j)+tt*sum((syn(iss:iee)-data(isd:ied))**2) enddo @@ -252,13 +252,13 @@ subroutine select_best_solution(icalc,misfit,n_strike,n_dip,n_rake,n_mw, & character(len=150) :: filename real :: min_misfit - n_total=n_strike*n_dip*n_rake*n_mw + n_total = n_strike*n_dip*n_rake*n_mw mm = n_strike*n_dip*n_rake mm2 = n_strike*n_dip mm3 = n_strike jmina = minloc(misfit(1:n_total)) - jmin=jmina(1)-1 + jmin = jmina(1)-1 jm = jmin/mm+1 jmin = jmin-(jm-1)*mm @@ -267,13 +267,13 @@ subroutine select_best_solution(icalc,misfit,n_strike,n_dip,n_rake,n_mw, & jd = jmin/mm3+1 js = jmin-(jd-1)*mm3+1 - strike=s_strike+(js-1)*d_strike - dip=s_dip+(jd-1)*d_dip - rake=s_rake+(jr-1)*d_rake - mw=s_mw+(jm-1)*d_mw + strike = s_strike+(js-1)*d_strike + dip = s_dip+(jd-1)*d_dip + rake = s_rake+(jr-1)*d_rake + mw = s_mw+(jm-1)*d_mw filename='grid3d_misfit' - if (global_search) filename=trim(filename)//'.'//char(icalc+48) + if (global_search) filename = trim(filename)//'.'//char(icalc+48) min_misfit=minval(misfit(1:n_total)) print *, 'minimum misfit value = ', min_misfit diff --git a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub3.f90 b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub3.f90 index 501c1ec0e..a567e11cc 100644 --- a/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub3.f90 +++ b/src/inverse_problem_for_source/CMT3D/grid3d/grid3d_sub3.f90 @@ -24,7 +24,7 @@ subroutine xcorr_calc(dd,ss,npts,i1,i2,ishift,cc_max,ishift_max) real :: cc ! initialise shift - d=0.; s=0.; d(i1:i2)=dd(i1:i2); s(i1:i2)=ss(i1:i2) + d = 0.; s = 0.; d(i1:i2)=dd(i1:i2); s(i1:i2)=ss(i1:i2) ishift = 0; cc_max = SMALL ! length of window (number of points, including ends) @@ -37,10 +37,10 @@ subroutine xcorr_calc(dd,ss,npts,i1,i2,ishift,cc_max,ishift_max) do i = i_left, i_right i11 = max(1,i1+i) i22 = min(npts,i2+i) - cc=sum(s(i11-i:i22-i)*d(i11:i22)) + cc = sum(s(i11-i:i22-i)*d(i11:i22)) if (cc > cc_max) then - cc_max=cc - ishift=i + cc_max = cc + ishift = i endif enddo diff --git a/src/meshfem3D/chunk_earth_mesh_mod.f90 b/src/meshfem3D/chunk_earth_mesh_mod.f90 index 93c71ba00..165b0fe9b 100644 --- a/src/meshfem3D/chunk_earth_mesh_mod.f90 +++ b/src/meshfem3D/chunk_earth_mesh_mod.f90 @@ -14,7 +14,7 @@ module chunk_earth_mod double precision :: dx_elem, dy_elem, dz_elem double precision :: dx_max, dy_max, dz_max - logical :: use_doubling=.false. + logical :: use_doubling = .false. integer :: nb_doubling double precision, dimension(:), allocatable :: layer_doubling, zlayer integer, dimension(:), allocatable :: nzlayer @@ -72,17 +72,17 @@ subroutine mesh_chunk_earth() read(27,'(a)',end=99) line !! INDICES TO READ line ----------------------------------------------- - ipos0=index(line,':')+1 - ipos1=index(line,'#')-1 - if (ipos1 < 0 ) ipos1=len_trim(line) + ipos0 = index(line,':')+1 + ipos1 = index(line,'#')-1 + if (ipos1 < 0 ) ipos1 = len_trim(line) !! STORE KEYWORD ITEM ------------------------------------------------- - keyw=trim(adjustl(line(1:ipos0-2))) + keyw = trim(adjustl(line(1:ipos0-2))) select case (trim(keyw)) case ('system_coordinate') write(*,*) line - system_coordinate=trim(adjustl(line(ipos0:ipos1))) + system_coordinate = trim(adjustl(line(ipos0:ipos1))) end select enddo @@ -127,12 +127,12 @@ subroutine read_metric_params() read(27,'(a)',end=99) line !! INDICES TO READ line ----------------------------------------------- - ipos0=index(line,':')+1 - ipos1=index(line,'#')-1 - if (ipos1 < 0 ) ipos1=len_trim(line) + ipos0 = index(line,':')+1 + ipos1 = index(line,'#')-1 + if (ipos1 < 0 ) ipos1 = len_trim(line) !! STORE KEYWORD ITEM ------------------------------------------------- - keyw=trim(adjustl(line(1:ipos0-2))) + keyw = trim(adjustl(line(1:ipos0-2))) select case (trim(keyw)) case('xmin') @@ -154,7 +154,7 @@ subroutine read_metric_params() case('dz_elem') read(line(ipos0:ipos1),*) dz_elem case('nb_doubling') - use_doubling=.true. + use_doubling = .true. read(line(ipos0:ipos1),*) nb_doubling allocate(layer_doubling(nb_doubling),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1240') @@ -240,19 +240,19 @@ subroutine read_metric_params() if (ier /= 0) call exit_MPI_without_rank('error allocating array 1245') allocate(nzlayer(nb_doubling+1),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1246') - k=0 - do ilayer=2, nb_doubling+1 - k=k+1 + k = 0 + do ilayer = 2, nb_doubling+1 + k = k+1 zlayer(ilayer)=layer_doubling(k) enddo zlayer(1)=zmin_chunk zlayer(nb_doubling+2)=zmax_chunk - nspec_tot=0 - npoint_tot=0 - nx=nx_ref - ny=ny_ref - dz=dz_max + nspec_tot = 0 + npoint_tot = 0 + nx = nx_ref + ny = ny_ref + dz = dz_max !! compute number of elements needed for meshing do ilayer = 1, nb_doubling write(*,*) @@ -270,8 +270,8 @@ subroutine read_metric_params() write(*,*) ' nx, ny, nz ',nx, ny, nzlayer(ilayer) - nx=2*nx - ny=2*ny + nx = 2*nx + ny = 2*ny dz = dz /2.d0 enddo @@ -295,7 +295,7 @@ subroutine read_metric_params() if (ier /= 0) call exit_MPI_without_rank('error allocating array 1247') allocate(EtoV(8,nspec_tot), iboun(6,nspec_tot),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1248') - iboun(:,:)=.false. + iboun(:,:) = .false. EtoV(:,:)=0 end subroutine read_metric_params @@ -310,14 +310,14 @@ subroutine mesh_metric_chunk() double precision :: dx, dy, dz, z double precision, dimension(:,:), allocatable :: top_surface, bottom_surface - ispec=0 - ipoint=0 - nspec_xmin=0 - nspec_xmax=0 - nspec_ymin=0 - nspec_ymax=0 - nspec_zmin=0 - nspec_zmax=0 + ispec = 0 + ipoint = 0 + nspec_xmin = 0 + nspec_xmax = 0 + nspec_ymin = 0 + nspec_ymax = 0 + nspec_zmin = 0 + nspec_zmax = 0 !! mesh all layers with doubling do ilayer = 1, nb_doubling @@ -354,8 +354,8 @@ subroutine mesh_metric_chunk() !! mesh last layer with no doubling fore last layer ilayer = nb_doubling + 1 - nx=nx_ref*(2**(ilayer-1)) - ny=ny_ref*(2**(ilayer-1)) + nx = nx_ref*(2**(ilayer-1)) + ny = ny_ref*(2**(ilayer-1)) nz = nzlayer(ilayer) z = zlayer(ilayer) dx = ( xmax_chunk - xmin_chunk ) / real(nx,8) @@ -399,21 +399,21 @@ subroutine create_mesh_metric_chunk() !! write coords - k=0 + k = 0 filename = trim(MESH)//'nodes_coords_file' open(27,file=trim(filename)) write(27,*) nglob write(*,*) " remaining points in mesh : ", nglob, " total point used in mesh building ", npoint_tot do i = 1, npoint_tot if (ifseg(i)) then - k=k+1 + k = k+1 write(27,'(i14,3x,3(f20.5,1x))') k, x_mesh_point(i), y_mesh_point(i), z_mesh_point(i) endif enddo close(27) !! read again the point to have them in right order - npoint_tot=k + npoint_tot = k write(*,*) " number of point found ", npoint_tot, nglob deallocate(x_mesh_point, y_mesh_point, z_mesh_point) allocate(x_mesh_point(npoint_tot), y_mesh_point(npoint_tot), z_mesh_point(npoint_tot),stat=ier) @@ -431,7 +431,7 @@ subroutine create_mesh_metric_chunk() filename = trim(MESH)//'mesh_file' open(27,file=trim(filename)) write(27,*) nspec_tot - do i =1, nspec_tot + do i = 1, nspec_tot write(27,'(9i15)') i, & iglob((EtoV(1, i))), iglob((EtoV(2, i))), iglob((EtoV(3, i))), iglob((EtoV(4, i))), & iglob((EtoV(5, i))), iglob((EtoV(6, i))), iglob((EtoV(7, i))), iglob((EtoV(8, i))) @@ -446,7 +446,7 @@ subroutine create_mesh_metric_chunk() open(31,file=trim(MESH)//'absorbing_surface_file_bottom'); write(31,*) nspec_zmin open(32,file=trim(MESH)//'free_or_absorbing_surface_file_zmax'); write(32,*) nspec_zmax - do i=1, nspec_tot + do i = 1, nspec_tot if (iboun(1,i)) write(27,'(10(i10,1x))') i, & iglob((EtoV(1, i))), iglob((EtoV(2, i))), iglob((EtoV(6, i))), iglob((EtoV(5, i))) if (iboun(2,i)) write(28,'(10(i10,1x))') i, & @@ -471,7 +471,7 @@ subroutine create_mesh_metric_chunk() !! write materials !! filename = trim(MESH)//'nummaterial_velocity_file' open(27,file=trim(filename)) - do i=1, nb_mat + do i = 1, nb_mat write(27,'(2i6,5f15.5,i6)') 2, Imaterial_domain(i), material_prop(i,1:5), 0 enddo close(27) @@ -481,7 +481,7 @@ subroutine create_mesh_metric_chunk() filename = trim(MESH)//'/materials_file' open(28,file=trim(filename)) - do i=1, nspec_tot + do i = 1, nspec_tot call Find_Domain(idom, i, iglob) write(28,*) i, Imaterial_domain(idom) Imatetrial_ispec(i)= Imaterial_domain(idom) @@ -540,7 +540,7 @@ subroutine mesh_regular_domain_Hex8(ox, oy, oz, dx, dy, dz, nx, ny, nz, top_su !! compute vertically deformed Cartesian grid -------------------------------------------------------------- ip = ipoint - do k = 1, nz + 1 !!loop over depth from bottom surface (k=1) to the top (k=nz+1) + do k = 1, nz + 1 !!loop over depth from bottom surface (k = 1) to the top (k = nz+1) !! loop over (x,y) points do j = 1, ny + 1 @@ -586,33 +586,33 @@ subroutine mesh_regular_domain_Hex8(ox, oy, oz, dx, dy, dz, nx, ny, nz, top_su !! get boundaries -------- if (i == 1) then - iboun(1,ispec)=.true. - nspec_xmin=nspec_xmin+1 + iboun(1,ispec) = .true. + nspec_xmin = nspec_xmin+1 endif if (i == nx) then - iboun(2,ispec)=.true. - nspec_xmax=nspec_xmax+1 + iboun(2,ispec) = .true. + nspec_xmax = nspec_xmax+1 endif if (j == 1) then - iboun(3,ispec)=.true. - nspec_ymin=nspec_ymin+1 + iboun(3,ispec) = .true. + nspec_ymin = nspec_ymin+1 endif if (j == ny) then - iboun(4,ispec)=.true. - nspec_ymax=nspec_ymax+1 + iboun(4,ispec) = .true. + nspec_ymax = nspec_ymax+1 endif if (ilayer == 1 .and. k == 1) then - iboun(5,ispec)=.true. - nspec_zmin=nspec_zmin+1 + iboun(5,ispec) = .true. + nspec_zmin = nspec_zmin+1 endif if (ilayer == nlayer .and. k == nz) then - iboun(6,ispec)=.true. - nspec_zmax=nspec_zmax+1 + iboun(6,ispec) = .true. + nspec_zmax = nspec_zmax+1 endif @@ -670,23 +670,23 @@ subroutine mesh_doubling_domain_Hex8(ox, oy, z, dx, dy, dz, nx, ny, top_surface !! get boundaries -------- if (i == 1) then - iboun(1,ispec)=.true. - nspec_xmin=nspec_xmin+1 + iboun(1,ispec) = .true. + nspec_xmin = nspec_xmin+1 endif if (i == nx) then - iboun(2,ispec)=.true. - nspec_xmax=nspec_xmax+1 + iboun(2,ispec) = .true. + nspec_xmax = nspec_xmax+1 endif if (j == 1) then - iboun(3,ispec)=.true. - nspec_ymin=nspec_ymin+1 + iboun(3,ispec) = .true. + nspec_ymin = nspec_ymin+1 endif if (j == ny) then - iboun(4,ispec)=.true. - nspec_ymax=nspec_ymax+1 + iboun(4,ispec) = .true. + nspec_ymax = nspec_ymax+1 endif enddo @@ -720,7 +720,7 @@ subroutine super_brick_1_Hex8(tupe, dx, dy, dz, x, y, z, ox, oy, top_surface, bo type = tupe + ibri !! 1/ get normalized reference element - elem=elemref(type) + elem = elemref(type) !! 2/ scale and shift the element elem(:,1) = elem(:,1) * dx + x @@ -914,7 +914,7 @@ subroutine Find_Domain(id, i, iglob) integer :: ind(8) double precision :: x, y, z - do k=1, 8 + do k = 1, 8 ind(k)=iglob(EtoV(k,i)); enddo @@ -927,7 +927,7 @@ subroutine Find_Domain(id, i, iglob) if ( x >= domain_boundary(k,1) .and. x <= domain_boundary(k,2) .and. & y >= domain_boundary(k,3) .and. y <= domain_boundary(k,4) .and. & z >= domain_boundary(k,5) .and. z <= domain_boundary(k,6)) then - id=k + id = k return endif enddo diff --git a/src/meshfem3D/create_CPML_regions.f90 b/src/meshfem3D/create_CPML_regions.f90 index 9474c721f..9b8665fb3 100644 --- a/src/meshfem3D/create_CPML_regions.f90 +++ b/src/meshfem3D/create_CPML_regions.f90 @@ -240,7 +240,7 @@ subroutine create_CPML_regions(nspec,nglob,nodes_coords) if (myrank == 0) then write(IMAIN,*) ' Created a total of ',nspec_CPML_total,' unique CPML elements' - write(IMAIN,*)' (i.e., ',100. * nspec_CPML_total / real(nspec_total),'% of the mesh)' + write(IMAIN,*) ' (i.e., ',100. * nspec_CPML_total / real(nspec_total),'% of the mesh)' write(IMAIN,*) endif diff --git a/src/meshfem3D/create_visual_files.f90 b/src/meshfem3D/create_visual_files.f90 index de6a8cbcd..c4da707cc 100644 --- a/src/meshfem3D/create_visual_files.f90 +++ b/src/meshfem3D/create_visual_files.f90 @@ -67,11 +67,11 @@ subroutine create_visual_files(CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FI write(IOUT,'(a8)') '*HEADING' write(IOUT,'(a27)') 'SPECFEM3D meshfem3D(mesh): ' write(IOUT,'(a5)') '*NODE' - do i=1,nglob + do i = 1,nglob write(IOUT,'(i10,3(a,e15.6))') i,',',nodes_coords(i,1),',',nodes_coords(i,2),',',nodes_coords(i,3) enddo write(IOUT,'(a31)') '*ELEMENT, TYPE=C3D8R, ELSET=EB1' - do ispec=1,nspec + do ispec = 1,nspec write(IOUT,'(i10,8(a,i10))') ispec,',',ibool(1,1,NGLLZ_M,ispec),',',ibool(1,1,1,ispec), & ',',ibool(1,NGLLY_M,1,ispec), ',',ibool(1,NGLLY_M,NGLLZ_M,ispec), & ',',ibool(NGLLX_M,1,NGLLZ_M,ispec),',',ibool(NGLLX_M,1,1,ispec), & @@ -102,7 +102,7 @@ subroutine create_visual_files(CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FI write(IOUT,*) 'object 2 class array type int rank 1 shape ',8,' items ',nspec,' data follows' - do ispec=1,nspec + do ispec = 1,nspec ! point order in OpenDX in 2D is 1,4,2,3 *not* 1,2,3,4 as in AVS ! point order in OpenDX in 3D is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS @@ -160,7 +160,7 @@ subroutine create_visual_files(CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FI ! note: indices for vtk start at 0 write(IOUT,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX_M,1,1,ispec)-1, & ibool(NGLLX_M,NGLLY_M,1,ispec)-1,ibool(1,NGLLY_M,1,ispec)-1, & diff --git a/src/meshfem3D/define_subregions.f90 b/src/meshfem3D/define_subregions.f90 index 00e229110..3d64d7590 100644 --- a/src/meshfem3D/define_subregions.f90 +++ b/src/meshfem3D/define_subregions.f90 @@ -58,27 +58,27 @@ subroutine define_model_regions(NEX_PER_PROC_XI,NEX_PER_PROC_ETA,iproc_xi,iproc_ call usual_hex_nodes(NGNOD_EIGHT_CORNERS,iaddx,iaddy,iaddz) - ix1=2*(subregions(isubregion,1) - iproc_xi*NEX_PER_PROC_XI - 1) + ix1 = 2*(subregions(isubregion,1) - iproc_xi*NEX_PER_PROC_XI - 1) if (ix1 < 0) ix1 = 0 - ix2=2*(subregions(isubregion,2) - iproc_xi*NEX_PER_PROC_XI - 1) + ix2 = 2*(subregions(isubregion,2) - iproc_xi*NEX_PER_PROC_XI - 1) if (ix2 > 2*(NEX_PER_PROC_XI - 1)) ix2 = 2*(NEX_PER_PROC_XI - 1) - dix=2 + dix = 2 - iy1=2*(subregions(isubregion,3) - iproc_eta*NEX_PER_PROC_ETA - 1) + iy1 = 2*(subregions(isubregion,3) - iproc_eta*NEX_PER_PROC_ETA - 1) if (iy1 < 0) iy1 = 0 - iy2=2*(subregions(isubregion,4) - iproc_eta*NEX_PER_PROC_ETA - 1) + iy2 = 2*(subregions(isubregion,4) - iproc_eta*NEX_PER_PROC_ETA - 1) if (iy2 > 2*(NEX_PER_PROC_ETA - 1)) iy2 = 2*(NEX_PER_PROC_ETA - 1) - diy=2 + diy = 2 - ir1=2*(subregions(isubregion,5) - 1) - ir2=2*(subregions(isubregion,6) - 1) - dir=2 + ir1 = 2*(subregions(isubregion,5) - 1) + ir2 = 2*(subregions(isubregion,6) - 1) + dir = 2 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 num_material = subregions(isubregion,7) diff --git a/src/meshfem3D/determine_cavity.f90 b/src/meshfem3D/determine_cavity.f90 index 4215865a8..4127751d1 100644 --- a/src/meshfem3D/determine_cavity.f90 +++ b/src/meshfem3D/determine_cavity.f90 @@ -81,7 +81,7 @@ subroutine cmm_determine_cavity(nglob) cavity_file_exists = .false. if (myrank == 0) then write(IMAIN,*) - write(IMAIN,*)'File "'//trim(filename)//'" not found: assume no cavity' + write(IMAIN,*) 'File "'//trim(filename)//'" not found: assume no cavity' write(IMAIN,*) call flush_IMAIN() endif @@ -128,9 +128,9 @@ subroutine cmm_determine_cavity(nglob) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1325') allocate(cavity_z1(ncavity),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1326') - cavity_x0=HUGEVAL; cavity_x1=HUGEVAL - cavity_y0=HUGEVAL; cavity_y1=HUGEVAL - cavity_z0=HUGEVAL; cavity_z1=HUGEVAL + cavity_x0 = HUGEVAL; cavity_x1 = HUGEVAL + cavity_y0 = HUGEVAL; cavity_y1 = HUGEVAL + cavity_z0 = HUGEVAL; cavity_z1 = HUGEVAL ! skip one comment line read(111,*) !read cavity range @@ -141,9 +141,9 @@ subroutine cmm_determine_cavity(nglob) ! user output if (myrank == 0) then - write(IMAIN,*)' cavity range: x min / max = ',cavity_x0(i_cavity),cavity_x1(i_cavity),'(m)' - write(IMAIN,*)' y min / max = ',cavity_y0(i_cavity),cavity_y1(i_cavity),'(m)' - write(IMAIN,*)' z min / max = ',cavity_z0(i_cavity),cavity_z1(i_cavity),'(m)' + write(IMAIN,*) ' cavity range: x min / max = ',cavity_x0(i_cavity),cavity_x1(i_cavity),'(m)' + write(IMAIN,*) ' y min / max = ',cavity_y0(i_cavity),cavity_y1(i_cavity),'(m)' + write(IMAIN,*) ' z min / max = ',cavity_z0(i_cavity),cavity_z1(i_cavity),'(m)' write(IMAIN,*) call flush_IMAIN() endif @@ -206,7 +206,7 @@ subroutine cmm_determine_cavity(nglob) enddo enddo endif - enddo ! ispec=1,nspec + enddo ! ispec = 1,nspec deallocate(cavity_x0,cavity_x1,cavity_y0,cavity_y1,cavity_z0,cavity_z1) @@ -225,7 +225,7 @@ subroutine cmm_determine_cavity(nglob) ! user output if (myrank == 0) then do iproc = 0,NPROC_ETA*NPROC_XI - 1 - write(IMAIN,*)' found ',cavity_num_elements_all(iproc),'cavity elements in slice ',iproc + write(IMAIN,*) ' found ',cavity_num_elements_all(iproc),'cavity elements in slice ',iproc enddo write(IMAIN,*) write(IMAIN,*) ' total cavity elements found = ',num_cav_total diff --git a/src/meshfem3D/earth_chunk.f90 b/src/meshfem3D/earth_chunk.f90 index b00395101..c0b6fab93 100644 --- a/src/meshfem3D/earth_chunk.f90 +++ b/src/meshfem3D/earth_chunk.f90 @@ -361,7 +361,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) do iz = 0, nel_depth - 1 - ilayer_current=current_layer(iz) - 1 ! Caution between pickets and intervals !! + ilayer_current = current_layer(iz) - 1 ! Caution between pickets and intervals !! if (iz /= 0) then if (current_layer(iz-1) /= current_layer(iz)) then @@ -378,8 +378,8 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) '2', index_mat, 'tomography', 'elastic', 'tomography_model.xyz', '1' endif - do ilat=0,nel_lat-1 - do ilon=0,nel_lon-1 + do ilat = 0,nel_lat-1 + do ilon = 0,nel_lon-1 ispec = ispec + 1 ! material file @@ -392,8 +392,8 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! on boundary 1: x=xmin if (ilon == 0) then - iboun(1,ispec)=.true. - ispec2Dxmin=ispec2Dxmin+1 + iboun(1,ispec) = .true. + ispec2Dxmin = ispec2Dxmin+1 write(89,*) ispec,ispec2Dxmin,1 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -403,8 +403,8 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! on boundary 2: xmax if (ilon == nel_lon-1) then - iboun(2,ispec)=.true. - ispec2Dxmax=ispec2Dxmax+1 + iboun(2,ispec) = .true. + ispec2Dxmax = ispec2Dxmax+1 !write(*,*) '------ TOZ',ispec,ilon write(89,*) ispec,ispec2Dxmax,2 @@ -415,8 +415,8 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! on boundary 3: ymin if (ilat == 0) then - iboun(3,ispec)=.true. - ispec2Dymin=ispec2Dymin+1 + iboun(3,ispec) = .true. + ispec2Dymin = ispec2Dymin+1 write(89,*) ispec,ispec2Dymin,3 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -427,7 +427,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ilat == nel_lat-1) then iboun(4,ispec) =.true. - ispec2Dymax=ispec2Dymax+1 + ispec2Dymax = ispec2Dymax+1 write(89,*) ispec,ispec2Dymax,4 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -437,8 +437,8 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! on boundary 5: bottom if (iz == 0) then - iboun(5,ispec)=.true. - ispec2Dzmin=ispec2Dzmin+1 + iboun(5,ispec) = .true. + ispec2Dzmin = ispec2Dzmin+1 write(89,*) ispec,ispec2Dzmin,5 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -448,15 +448,15 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! on boundary 6: top if (iz == nel_depth-1) then ispec2Dzmax= ispec2Dzmax+1 - iboun(6,ispec)=.true. + iboun(6,ispec) = .true. endif ! 8 vertices of the element ispec - do ia=1,NGNOD + do ia = 1,NGNOD - i=iaddx(ia) - j=iaddy(ia) - k=iaddz(ia) + i = iaddx(ia) + j = iaddy(ia) + k = iaddz(ia) z = 1000d0*ProfForGemini(iz,1+k) @@ -519,9 +519,9 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ilon == 0 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilat == nel_lat-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stxmin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) @@ -532,9 +532,9 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ilon == nel_lon - 1 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilat == nel_lat-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stxmax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -544,9 +544,9 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ilat == 0 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilon == nel_lon-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stymin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -555,9 +555,9 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ilat == nel_lat-1 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilon == nel_lon-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stymax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -594,7 +594,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) ! modele 1D open(88,file=trim(MESH)//'model_1D.in') write(88,*) nlayer,4 - do i=1,nlayer + do i = 1,nlayer write(88,*) zlayer(i) write(88,'(4f20.10)') vpv(i,:) write(88,'(4f20.10)') vsv(i,:) @@ -607,13 +607,13 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) !---------------- NUMEROTATION DES POINTS DE LA GRILLE ---- ! on stocke tous les points de tous les elements - do ispec=1,nspec + do ispec = 1,nspec ieoff = 8 * (ispec - 1) ilocnum = 0 - do k=1,2 - do j=1,2 - do i=1,2 + do k = 1,2 + do j = 1,2 + do i = 1,2 ilocnum = ilocnum + 1 xp(ilocnum + ieoff)= xgrid(i,j,k,ispec) @@ -633,13 +633,13 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1293') ! on ne stocke que les points de la grille et leur numeros - do ispec=1,nspec + do ispec = 1,nspec ieoff = 8 * (ispec - 1) ilocnum = 0 - do k=1,2 - do j=1,2 - do i=1,2 - ilocnum=ilocnum+1 + do k = 1,2 + do j = 1,2 + do i = 1,2 + ilocnum = ilocnum+1 inum_loc(i,j,k,ispec) = iglob(ilocnum+ieoff) xp(iglob(ilocnum+ieoff)) = xgrid(i,j,k,ispec) yp(iglob(ilocnum+ieoff)) = ygrid(i,j,k,ispec) @@ -685,14 +685,14 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'nodes_coords_file') write(27,*) nglob ! nb de sommets - do kglob=1,nglob + do kglob = 1,nglob write(27,'(i14,3x,3(f20.5,1x))') kglob,xp(kglob),yp(kglob),zp(kglob) enddo close(27) open(27,file=trim(MESH)//'mesh_file') write(27,*) nspec - do ispec=1,nspec + do ispec = 1,nspec write(27,'(9i15)') ispec,inum_loc(1,1,1,ispec),inum_loc(2,1,1,ispec), & inum_loc(2,2,1,ispec),inum_loc(1,2,1,ispec), & inum_loc(1,1,2,ispec),inum_loc(2,1,2,ispec), & @@ -702,7 +702,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_xmin') write(27,*) ispec2Dxmin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(1,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(1,1,1,ispec),inum_loc(1,2,1,ispec), & inum_loc(1,2,2,ispec),inum_loc(1,1,2,ispec) enddo @@ -710,7 +710,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_xmax') write(27,*) ispec2Dxmax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(2,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(2,1,1,ispec),inum_loc(2,2,1,ispec), & inum_loc(2,2,2,ispec),inum_loc(2,1,2,ispec) enddo @@ -718,7 +718,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_ymin') write(27,*) ispec2Dymin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(3,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(1,1,1,ispec),inum_loc(2,1,1,ispec), & inum_loc(2,1,2,ispec),inum_loc(1,1,2,ispec) enddo @@ -726,7 +726,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_ymax') write(27,*) ispec2Dymax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(4,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(1,2,1,ispec),inum_loc(2,2,1,ispec), & inum_loc(2,2,2,ispec),inum_loc(1,2,2,ispec) enddo @@ -734,7 +734,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_bottom') write(27,*) ispec2Dzmin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(5,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(1,1,1,ispec),inum_loc(1,2,1,ispec), & inum_loc(2,2,1,ispec),inum_loc(2,1,1,ispec) enddo @@ -742,7 +742,7 @@ subroutine earth_chunk_HEX8_Mesher(NGNOD) open(27,file=trim(MESH)//'free_surface') write(27,*) ispec2Dzmax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(6,ispec)) write(27,'(5(i10,1x))') ispec,inum_loc(1,1,2,ispec),inum_loc(1,2,2,ispec), & inum_loc(2,2,2,ispec),inum_loc(2,1,2,ispec) enddo @@ -1161,7 +1161,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) do iz = 0, nel_depth - 1 - ilayer_current=current_layer(iz) - 1 ! Caution between pickets and intervals !! + ilayer_current = current_layer(iz) - 1 ! Caution between pickets and intervals !! if (iz /= 0) then if (current_layer(iz-1) /= current_layer(iz)) then @@ -1178,8 +1178,8 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) '2', index_mat, 'tomography', 'elastic', 'tomography_model.xyz', '1' endif - do ilat=0,nel_lat-1 - do ilon=0,nel_lon-1 + do ilat = 0,nel_lat-1 + do ilon = 0,nel_lon-1 ispec = ispec + 1 ! material file @@ -1192,8 +1192,8 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! on boundary 1: x=xmin if (ilon == 0) then - iboun(1,ispec)=.true. - ispec2Dxmin=ispec2Dxmin+1 + iboun(1,ispec) = .true. + ispec2Dxmin = ispec2Dxmin+1 write(89,*) ispec,ispec2Dxmin,1 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -1203,8 +1203,8 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! on boundary 2: xmax if (ilon == nel_lon-1) then - iboun(2,ispec)=.true. - ispec2Dxmax=ispec2Dxmax+1 + iboun(2,ispec) = .true. + ispec2Dxmax = ispec2Dxmax+1 !write(*,*) '------ TOZ',ispec,ilon write(89,*) ispec,ispec2Dxmax,2 @@ -1215,8 +1215,8 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! on boundary 3: ymin if (ilat == 0) then - iboun(3,ispec)=.true. - ispec2Dymin=ispec2Dymin+1 + iboun(3,ispec) = .true. + ispec2Dymin = ispec2Dymin+1 write(89,*) ispec,ispec2Dymin,3 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -1227,7 +1227,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) if (ilat == nel_lat-1) then iboun(4,ispec) =.true. - ispec2Dymax=ispec2Dymax+1 + ispec2Dymax = ispec2Dymax+1 write(89,*) ispec,ispec2Dymax,4 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -1237,8 +1237,8 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! on boundary 5: bottom if (iz == 0) then - iboun(5,ispec)=.true. - ispec2Dzmin=ispec2Dzmin+1 + iboun(5,ispec) = .true. + ispec2Dzmin = ispec2Dzmin+1 write(89,*) ispec,ispec2Dzmin,5 istore_for_new_outputs = istore_for_new_outputs + 1 @@ -1248,16 +1248,16 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! on boundary 6: top if (iz == nel_depth-1) then ispec2Dzmax= ispec2Dzmax+1 - iboun(6,ispec)=.true. + iboun(6,ispec) = .true. endif - do ia=1,NGNOD + do ia = 1,NGNOD !! MODIF HEX27 LA ----------------------------- - i=iaddx(ia) - j=iaddy(ia) - k=iaddz(ia) + i = iaddx(ia) + j = iaddy(ia) + k = iaddz(ia) SELECT CASE (k) CASE(0) @@ -1329,9 +1329,9 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) if (ilon == 0 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilat == nel_lat-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stxmin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) @@ -1342,9 +1342,9 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) if (ilon == nel_lon - 1 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilat == nel_lat-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stxmax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -1354,9 +1354,9 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) if (ilat == 0 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilon == nel_lon-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stymin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -1365,9 +1365,9 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) if (ilat == nel_lat-1 .and. iz == nel_depth-1) then call calc_gll_points(xelm,yelm,zelm,xstore,ystore,zstore,shape3D,NGNOD,NGLLX,NGLLY,NGLLZ) if (ilon == nel_lon-1) then ! This test is for add the last GLL point - test=.true. + test = .true. else - test=.false. + test = .false. endif call write_stymax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,test) endif @@ -1406,7 +1406,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) ! modele 1D open(88,file=trim(MESH)//'model_1D.in') write(88,*) nlayer,4 - do i=1,nlayer + do i = 1,nlayer write(88,*) zlayer(i) write(88,'(4f20.10)') vpv(i,:) write(88,'(4f20.10)') vsv(i,:) @@ -1419,14 +1419,14 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) !---------------- NUMEROTATION DES POINTS DE LA GRILLE ---- ! on stocke tous les points de tous les elements - do ispec=1,nspec + do ispec = 1,nspec ieoff = 27 * (ispec - 1) ilocnum = 0 - do k=1,3 - do j=1,3 - do i=1,3 + do k = 1,3 + do j = 1,3 + do i = 1,3 ilocnum = ilocnum + 1 xp(ilocnum + ieoff)= xgrid(i,j,k,ispec) @@ -1448,14 +1448,14 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) !! MODIF HEX27 LA ----------------------------- ! on ne stocke que les points de la grille et leur numeros - do ispec=1,nspec + do ispec = 1,nspec ieoff = 27 * (ispec - 1) ilocnum = 0 - do k=1,3 - do j=1,3 - do i=1,3 + do k = 1,3 + do j = 1,3 + do i = 1,3 ilocnum = ilocnum + 1 inum_loc(i,j,k,ispec) = iglob(ilocnum+ieoff) @@ -1506,14 +1506,14 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'nodes_coords_file') write(27,*) nglob ! nb de sommets - do kglob=1,nglob + do kglob = 1,nglob write(27,'(i14,3x,3(f20.5,1x))') kglob,xp(kglob),yp(kglob),zp(kglob) enddo close(27) open(27,file=trim(MESH)//'mesh_file') write(27,*) nspec - do ispec=1,nspec + do ispec = 1,nspec write(27,'(28i15)') ispec, & inum_loc(1,1,1,ispec), inum_loc(3,1,1,ispec), inum_loc(3,3,1,ispec), inum_loc(1,3,1,ispec), & inum_loc(1,1,3,ispec), inum_loc(3,1,3,ispec), inum_loc(3,3,3,ispec), inum_loc(1,3,3,ispec), & @@ -1527,7 +1527,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_xmin') write(27,*) ispec2Dxmin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(1,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(1,1,1,ispec), inum_loc(1,3,1,ispec), & inum_loc(1,3,3,ispec), inum_loc(1,1,3,ispec), & @@ -1539,7 +1539,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_xmax') write(27,*) ispec2Dxmax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(2,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(3,1,1,ispec), inum_loc(3,3,1,ispec), & inum_loc(3,3,3,ispec), inum_loc(3,1,3,ispec), & @@ -1551,7 +1551,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_ymin') write(27,*) ispec2Dymin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(3,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(1,1,1,ispec), inum_loc(3,1,1,ispec), & inum_loc(3,1,3,ispec), inum_loc(1,1,3,ispec), & @@ -1563,7 +1563,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_ymax') write(27,*) ispec2Dymax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(4,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(1,3,1,ispec), inum_loc(3,3,1,ispec), & inum_loc(3,3,3,ispec), inum_loc(1,3,3,ispec), & @@ -1575,7 +1575,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'absorbing_surface_file_bottom') write(27,*) ispec2Dzmin - do ispec=1,nspec + do ispec = 1,nspec if (iboun(5,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(1,1,1,ispec), inum_loc(3,1,1,ispec), & inum_loc(3,3,1,ispec), inum_loc(1,3,1,ispec), & @@ -1587,7 +1587,7 @@ subroutine earth_chunk_HEX27_Mesher(NGNOD) open(27,file=trim(MESH)//'free_surface') write(27,*) ispec2Dzmax - do ispec=1,nspec + do ispec = 1,nspec if (iboun(6,ispec)) write(27,'(10(i10,1x))') ispec, & inum_loc(1,1,3,ispec), inum_loc(3,1,3,ispec), & inum_loc(3,3,3,ispec), inum_loc(1,3,3,ispec), & @@ -1615,13 +1615,13 @@ subroutine earth_chunk_ReadIasp91(vp,vs,rho,rb,n) character(len=2) cnlay character(len=11) format_to_use - do i=1,n + do i = 1,n !qm(i)=0.d0 !qk(i)=0.d0 rb(i)=0.d0 !iflso(i)=0 nco(i)=0 - do j=1,4 + do j = 1,4 rho(i,j)=0.d0 vp(i,j)=0.d0 !vph(i,j)=0.d0 @@ -1630,7 +1630,7 @@ subroutine earth_chunk_ReadIasp91(vp,vs,rho,rb,n) !eta(i,j)=0.d0 enddo enddo - iunit=26 + iunit = 26 open(unit=iunit,file='iasp91',status='old') 1 read(iunit,'(a72)') text @@ -1694,7 +1694,7 @@ subroutine Read_dsm_model(model_file,vp,vs,rho,rb,n) read(iunit,*) nzone - do i=1, nzone + do i = 1, nzone read(iunit,*) vrmin, vrmax, & rho(i,1), rho(i,2), rho(i,3), rho(i,4), & vp(i,1), vp(i,2), vp(i,3), vp(i,4), & @@ -1776,7 +1776,7 @@ subroutine write_gllz_points(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,current_laye updown(:) = 0 if (ilayer == current_layer(iz)) then - do k=2,NGLLZ + do k = 2,NGLLZ profondeur = dsqrt(xstore(1,1,k)**2 + ystore(1,1,k)**2 + (zstore(1,1,k) )**2 ) write(27,*) profondeur/1000., ilayer-1,1 Ndepth = Ndepth + 1 @@ -1785,27 +1785,27 @@ subroutine write_gllz_points(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,current_laye else ! new layer - k=1 + k = 1 profondeur = dsqrt(xstore(1,1,k)**2 + ystore(1,1,k)**2 + (zstore(1,1,k) )**2 ) if (ilayer == 0) then ilayer = current_layer(iz) write(27,*) profondeur/1000., ilayer-1,1 - Ndepth=Ndepth+1 + Ndepth = Ndepth+1 updown(k) = 0 !! for new output mesh files and VM coupling with AxiSEM else ilayer = current_layer(iz) write(27,*) profondeur/1000., ilayer-1,-1 - Ndepth=Ndepth+1 + Ndepth = Ndepth+1 updown(k) = -1 !! for new output mesh files and VM coupling with AxiSEM endif - do k=2,NGLLZ ! on duplique le dernier point + do k = 2,NGLLZ ! on duplique le dernier point profondeur = dsqrt(xstore(1,1,k)**2 + ystore(1,1,k)**2 + (zstore(1,1,k) )**2 ) write(27,*) profondeur/1000., ilayer-1,1 - Ndepth=Ndepth+1 + Ndepth = Ndepth+1 updown(k) = 0 !! for new output mesh files and VM coupling with AxiSEM @@ -1979,9 +1979,9 @@ subroutine write_all_chunk_surface_GLL_in_spherical_and_Cartesian_coords(xstore, kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax ! CF 'earth_chunk_HEX8_Mesher' and 'earth_chunk_HEX27_Mesher' to see files whose units are 91 and 92 @@ -2014,9 +2014,9 @@ subroutine write_all_chunk_surface_GLL_in_spherical_and_Cartesian_coords(xstore, kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax if (INJECTION_TECHNIQUE_TYPE == INJECTION_TECHNIQUE_IS_DSM) then write(92,1000) xstore(i,j,k), ystore(i,j,k), zstore(i,j,k) @@ -2047,9 +2047,9 @@ subroutine write_all_chunk_surface_GLL_in_spherical_and_Cartesian_coords(xstore, kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax if (INJECTION_TECHNIQUE_TYPE == INJECTION_TECHNIQUE_IS_DSM) then write(92,1000) xstore(i,j,k), ystore(i,j,k), zstore(i,j,k) @@ -2080,9 +2080,9 @@ subroutine write_all_chunk_surface_GLL_in_spherical_and_Cartesian_coords(xstore, kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax if (INJECTION_TECHNIQUE_TYPE == INJECTION_TECHNIQUE_IS_DSM) then write(92,1000) xstore(i,j,k), ystore(i,j,k), zstore(i,j,k) @@ -2113,9 +2113,9 @@ subroutine write_all_chunk_surface_GLL_in_spherical_and_Cartesian_coords(xstore, kmin = 1 kmax = 1 - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax if (INJECTION_TECHNIQUE_TYPE == INJECTION_TECHNIQUE_IS_DSM) then write(92,1000) xstore(i,j,k), ystore(i,j,k), zstore(i,j,k) @@ -2157,9 +2157,9 @@ subroutine Cartesian2spheric(xstore,ystore,zstore,rotation_matrix,longitud,latit !---- ! - do kgll=1,NGLLZ - do jgll=1,NGLLY - do igll=1,NGLLX + do kgll = 1,NGLLZ + do jgll = 1,NGLLY + do igll = 1,NGLLX vector_ori(1) = xstore(igll,jgll,kgll) vector_ori(2) = ystore(igll,jgll,kgll) @@ -2216,7 +2216,7 @@ subroutine write_recdepth_dsm(Ndepth,R_EARTH,MESH) allocate(z(Ndepth),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1305') - do i=1,Ndepth + do i = 1,Ndepth read(27,*) prof,ilayer,flag z(Ndepth-i+1)=R_EARTH/1000.d0-prof zindex(Ndepth-i+1)=ilayer @@ -2226,16 +2226,16 @@ subroutine write_recdepth_dsm(Ndepth,R_EARTH,MESH) open(27,file=trim(MESH)//'recdepth') write(27,*) Ndepth - i=1 + i = 1 write(27,*) z(i),zindex(i),ziflag(i) - do i=2,Ndepth-1 + do i = 2,Ndepth-1 if (ziflag(i-1) == -1 ) then write(27,*) z(i),zindex(i),-1 else write(27,*) z(i),zindex(i),1 endif enddo - i=Ndepth + i = Ndepth write(27,*) z(i),zindex(i),ziflag(i) close(27) @@ -2256,8 +2256,8 @@ subroutine write_stxmin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t double precision rayon,x,y,z,deg2rad,long,lati logical test - deg2rad=3.141592653589793d0/180.d0 - NDIM=3 + deg2rad = 3.141592653589793d0/180.d0 + NDIM = 3 if (test) then NGLLY_eff = NGLLY @@ -2265,7 +2265,7 @@ subroutine write_stxmin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t NGLLY_eff = NGLLY - 1 endif - do jgll=1,NGLLY_eff + do jgll = 1,NGLLY_eff vector_ori(1)=xstore(1,jgll,NGLLZ) vector_ori(2)=ystore(1,jgll,NGLLZ) vector_ori(3)=zstore(1,jgll,NGLLZ) @@ -2276,11 +2276,11 @@ subroutine write_stxmin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t vector_rotated(i) = vector_rotated(i) + rotation_matrix(i,j)*vector_ori(j) enddo enddo - x=vector_rotated(1);y=vector_rotated(2);z=vector_rotated(3) + x = vector_rotated(1);y = vector_rotated(2);z = vector_rotated(3) rayon = dsqrt(vector_rotated(1)**2 + vector_rotated(2)**2 + vector_rotated(3)**2) - long=atan2(y,x) - lati=asin(z/rayon) + long = atan2(y,x) + lati = asin(z/rayon) write(28,*) long/deg2rad,lati/deg2rad !,rayon/1000 @@ -2309,10 +2309,10 @@ subroutine write_stxmax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t NGLLY_eff = NGLLY - 1 endif - deg2rad=3.141592653589793d0/180.d0 - NDIM=3 + deg2rad = 3.141592653589793d0/180.d0 + NDIM = 3 - do jgll=1,NGLLY_eff + do jgll = 1,NGLLY_eff vector_ori(1)=xstore(NGLLX,jgll,NGLLZ) vector_ori(2)=ystore(NGLLX,jgll,NGLLZ) vector_ori(3) =zstore(NGLLX,jgll,NGLLZ) @@ -2323,11 +2323,11 @@ subroutine write_stxmax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t vector_rotated(i) = vector_rotated(i) + rotation_matrix(i,j)*vector_ori(j) enddo enddo - x=vector_rotated(1);y=vector_rotated(2);z=vector_rotated(3) + x = vector_rotated(1);y = vector_rotated(2);z = vector_rotated(3) rayon = dsqrt(vector_rotated(1)**2 + vector_rotated(2)**2 + vector_rotated(3)**2) - long=atan2(y,x) - lati=asin(z/rayon) + long = atan2(y,x) + lati = asin(z/rayon) write(29,*) long/deg2rad,lati/deg2rad !,rayon/1000 @@ -2350,8 +2350,8 @@ subroutine write_stymin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t double precision rayon,x,y,z,deg2rad,long,lati logical test - deg2rad=3.141592653589793d0/180.d0 - NDIM=3 + deg2rad = 3.141592653589793d0/180.d0 + NDIM = 3 if (test) then NGLLX_eff = NGLLX @@ -2359,7 +2359,7 @@ subroutine write_stymin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t NGLLX_eff = NGLLX - 1 endif - do jgll=1,NGLLX_eff + do jgll = 1,NGLLX_eff vector_ori(1)=xstore(jgll,1,NGLLZ) vector_ori(2)=ystore(jgll,1,NGLLZ) vector_ori(3) =zstore(jgll,1,NGLLZ) @@ -2370,11 +2370,11 @@ subroutine write_stymin(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t vector_rotated(i) = vector_rotated(i) + rotation_matrix(i,j)*vector_ori(j) enddo enddo - x=vector_rotated(1);y=vector_rotated(2);z=vector_rotated(3) + x = vector_rotated(1);y = vector_rotated(2);z = vector_rotated(3) rayon = dsqrt(vector_rotated(1)**2 + vector_rotated(2)**2 + vector_rotated(3)**2) - long=atan2(y,x) - lati=asin(z/rayon) + long = atan2(y,x) + lati = asin(z/rayon) write(30,*) long/deg2rad,lati/deg2rad !,rayon/1000 enddo @@ -2402,10 +2402,10 @@ subroutine write_stymax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t NGLLX_eff = NGLLX - 1 endif - deg2rad=3.141592653589793d0/180.d0 - NDIM=3 + deg2rad = 3.141592653589793d0/180.d0 + NDIM = 3 - do jgll=1,NGLLX_eff + do jgll = 1,NGLLX_eff vector_ori(1)=xstore(jgll,NGLLY,NGLLZ) vector_ori(2)=ystore(jgll,NGLLY,NGLLZ) vector_ori(3) =zstore(jgll,NGLLY,NGLLZ) @@ -2416,11 +2416,11 @@ subroutine write_stymax(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_matrix,t vector_rotated(i) = vector_rotated(i) + rotation_matrix(i,j)*vector_ori(j) enddo enddo - x=vector_rotated(1);y=vector_rotated(2);z=vector_rotated(3) + x = vector_rotated(1);y = vector_rotated(2);z = vector_rotated(3) rayon = dsqrt(vector_rotated(1)**2 + vector_rotated(2)**2 + vector_rotated(3)**2) - long=atan2(y,x) - lati=asin(z/rayon) + long = atan2(y,x) + lati = asin(z/rayon) write(31,*) long/deg2rad,lati/deg2rad !,rayon/1000 enddo @@ -2445,11 +2445,11 @@ subroutine store_zmin_points(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_mat double precision lon_zmin(nlon_dsm,nlat_dsm),lat_zmin(nlon_dsm,nlat_dsm) - deg2rad=3.141592653589793d0/180.d0 - NDIM=3 + deg2rad = 3.141592653589793d0/180.d0 + NDIM = 3 - do jgll=1,NGLLY - do igll=1,NGLLX + do jgll = 1,NGLLY + do igll = 1,NGLLX vector_ori(1)=xstore(igll,jgll,1) vector_ori(2)=ystore(igll,jgll,1) vector_ori(3) =zstore(igll,jgll,1) @@ -2460,11 +2460,11 @@ subroutine store_zmin_points(xstore,ystore,zstore,NGLLX,NGLLY,NGLLZ,rotation_mat vector_rotated(i) = vector_rotated(i) + rotation_matrix(i,j)*vector_ori(j) enddo enddo - x=vector_rotated(1);y=vector_rotated(2);z=vector_rotated(3) + x = vector_rotated(1);y = vector_rotated(2);z = vector_rotated(3) rayon = dsqrt(vector_rotated(1)**2 + vector_rotated(2)**2 + vector_rotated(3)**2) - long=atan2(y,x) - lati=asin(z/rayon) + long = atan2(y,x) + lati = asin(z/rayon) iglob=(ilon)*(NGLLX-1)+igll jglob=(ilat)*(NGLLY-1)+jgll @@ -2490,8 +2490,8 @@ subroutine write_stzmin(x,y,nx,ny,MESH) open(27,file=trim(MESH)//'stzmin') write(27,*) nx*ny - do j=1,ny - do i=1,nx + do j = 1,ny + do i = 1,nx write(27,*) x(i,j),y(i,j) enddo enddo @@ -2509,8 +2509,8 @@ subroutine write_Igm_file(iunit,ispec2D,NGLL1,NGLL2,ie,je,js,il) integer iunit,ispec2D,NGLL1,NGLL2,ie,je,js,il integer i,j - do j=1,NGLL2 - do i=1,NGLL1 + do j = 1,NGLL2 + do i = 1,NGLL1 write(iunit,*) i,j,ispec2D,(NGLL1-1)*ie+i,(NGLL2-1)*je+j+js,il enddo enddo @@ -2565,18 +2565,18 @@ subroutine rotation_matrix_axe(R,axe,theta) double precision R(3,3) double precision c,s,ux,uy,uz,norme_axe - pi=3.1415926535897932d0 + pi = 3.1415926535897932d0 deg2rad = pi / 180.d0 ! on normalise l'axe - norme_axe=dsqrt(axe(1)**2 + axe(2)**2 + axe(3)**2) + norme_axe = dsqrt(axe(1)**2 + axe(2)**2 + axe(3)**2) ! composantes de l'axe - ux=axe(1)/norme_axe - uy=axe(2)/norme_axe - uz=axe(3)/norme_axe + ux = axe(1)/norme_axe + uy = axe(2)/norme_axe + uz = axe(3)/norme_axe ! on calcule le cos et sin - c=dcos(deg2rad * theta);s=dsin(deg2rad * theta) + c = dcos(deg2rad * theta);s = dsin(deg2rad * theta) ! matrice de rotation complexe R(1,1)=(ux**2 + (1.d0-ux**2)*c) @@ -2615,31 +2615,31 @@ subroutine compose4matrix(R,R00,R0,R1,R2) R(:,:)=0.d0 ! multiplication R=R0*R00 - do j=1,3 - do i=1,3 - do k=1,3 + do j = 1,3 + do i = 1,3 + do k = 1,3 R(i,j)=R(i,j) + R0(i,k)*R00(k,j) enddo enddo enddo ! multiplication R=R1*R - Rtmp=R + Rtmp = R R(:,:)=0.d0 - do j=1,3 - do i=1,3 - do k=1,3 + do j = 1,3 + do i = 1,3 + do k = 1,3 R(i,j)=R(i,j) + R1(i,k)*Rtmp(k,j) enddo enddo enddo ! multiplication R=R2*R - Rtmp=R + Rtmp = R R(:,:)=0.d0 - do j=1,3 - do i=1,3 - do k=1,3 + do j = 1,3 + do i = 1,3 + do k = 1,3 R(i,j)=R(i,j) + R2(i,k)*Rtmp(k,j) enddo enddo @@ -2948,7 +2948,7 @@ subroutine getglob_for_chunk(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,NGNOD if (ier /= 0) call exit_MPI_without_rank('error allocating array 1309') ! establish initial pointers (!! VM changed NGLLCUBE (as in Specfem3D Basin Version 1.1) to NGNOD !!) - do ispec=1,nspec + do ispec = 1,nspec ieoff = NGNOD * (ispec - 1) do ilocnum = 1,NGNOD loc(ilocnum + ieoff) = ilocnum + ieoff @@ -2960,12 +2960,12 @@ subroutine getglob_for_chunk(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,NGNOD ifseg(1) = .true. ninseg(1) = npointot - do j=1,3 !,NDIM + do j = 1,3 !,NDIM ! sort within each segment ioff = 1 - do iseg=1,nseg + do iseg = 1,nseg if (j == 1) then call rank(xp(ioff),ind,ninseg(iseg)) @@ -2985,19 +2985,19 @@ subroutine getglob_for_chunk(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,NGNOD ! compare the coordinates of the points within a small tolerance if (j == 1) then - do i=2,npointot + do i = 2,npointot if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else if (j == 2) then - do i=2,npointot + do i = 2,npointot if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else - do i=2,npointot + do i = 2,npointot if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo @@ -3006,7 +3006,7 @@ subroutine getglob_for_chunk(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,NGNOD ! count up number of different segments nseg = 0 - do i=1,npointot + do i = 1,npointot if (ifseg(i)) then nseg = nseg + 1 ninseg(nseg) = 1 @@ -3019,7 +3019,7 @@ subroutine getglob_for_chunk(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,NGNOD ! assign global node numbers (now sorted lexicographically) ig = 0 - do i=1,npointot + do i = 1,npointot if (ifseg(i)) ig = ig + 1 iglob(loc(i)) = ig @@ -3053,42 +3053,42 @@ subroutine rank(A,IND,N) integer i,j,l,ir,indx double precision q - do j=1,n + do j = 1,n IND(j)=j enddo if (n == 1) return - L=n/2+1 - ir=n + L = n/2+1 + ir = n 100 continue if (l > 1) then - l=l-1 - indx=ind(l) - q=a(indx) + l = l-1 + indx = ind(l) + q = a(indx) ELSE - indx=ind(ir) - q=a(indx) + indx = ind(ir) + q = a(indx) ind(ir)=ind(1) - ir=ir-1 + ir = ir-1 if (ir == 1) then ind(1)=indx return endif endif - i=l - j=l+l + i = l + j = l+l 200 continue if (J <= IR) then if (J < IR) then - if (A(IND(j)) < A(IND(j+1))) j=j+1 + if (A(IND(j)) < A(IND(j+1))) j = j+1 endif if (q < A(IND(j))) then IND(I)=IND(J) - I=J - J=J+J + I = J + J = J+J ELSE - J=IR+1 + J = IR+1 endif goto 200 endif @@ -3115,20 +3115,20 @@ subroutine swap_all(IA,A,B,C,IW,W,ind,n) IW(:) = IA(:) W(:) = A(:) - do i=1,n + do i = 1,n IA(i)=IW(ind(i)) A(i)=W(ind(i)) enddo W(:) = B(:) - do i=1,n + do i = 1,n B(i)=W(ind(i)) enddo W(:) = C(:) - do i=1,n + do i = 1,n C(i)=W(ind(i)) enddo diff --git a/src/meshfem3D/get_flags_boundaries.f90 b/src/meshfem3D/get_flags_boundaries.f90 index 5b136d1dd..41435ed17 100644 --- a/src/meshfem3D/get_flags_boundaries.f90 +++ b/src/meshfem3D/get_flags_boundaries.f90 @@ -100,30 +100,30 @@ subroutine get_flags_boundaries(nspec,iproc_xi,iproc_eta,ispec,idoubling, & ! determine if the element falls on a boundary ! **************************************************** - iboun(:,ispec)=.false. + iboun(:,ispec) = .false. ! on boundary 1: x=xmin target_val = UTM_X_MIN + TOLERANCE_METERS - if (xelm(1) < target_val .and. xelm(4) < target_val .and. xelm(5) < target_val .and. xelm(8) < target_val) iboun(1,ispec)=.true. + if (xelm(1) < target_val .and. xelm(4) < target_val .and. xelm(5) < target_val .and. xelm(8) < target_val) iboun(1,ispec) = .true. ! on boundary 2: xmax target_val = UTM_X_MAX - TOLERANCE_METERS - if (xelm(2) > target_val .and. xelm(3) > target_val .and. xelm(6) > target_val .and. xelm(7) > target_val) iboun(2,ispec)=.true. + if (xelm(2) > target_val .and. xelm(3) > target_val .and. xelm(6) > target_val .and. xelm(7) > target_val) iboun(2,ispec) = .true. ! on boundary 3: ymin target_val = UTM_Y_MIN + TOLERANCE_METERS - if (yelm(1) < target_val .and. yelm(2) < target_val .and. yelm(5) < target_val .and. yelm(6) < target_val) iboun(3,ispec)=.true. + if (yelm(1) < target_val .and. yelm(2) < target_val .and. yelm(5) < target_val .and. yelm(6) < target_val) iboun(3,ispec) = .true. ! on boundary 4: ymax target_val = UTM_Y_MAX - TOLERANCE_METERS - if (yelm(3) > target_val .and. yelm(4) > target_val .and. yelm(7) > target_val .and. yelm(8) > target_val) iboun(4,ispec)=.true. + if (yelm(3) > target_val .and. yelm(4) > target_val .and. yelm(7) > target_val .and. yelm(8) > target_val) iboun(4,ispec) = .true. ! on boundary 5: bottom target_val = Z_DEPTH_BLOCK + TOLERANCE_METERS - if (zelm(1) < target_val .and. zelm(2) < target_val .and. zelm(3) < target_val .and. zelm(4) < target_val) iboun(5,ispec)=.true. + if (zelm(1) < target_val .and. zelm(2) < target_val .and. zelm(3) < target_val .and. zelm(4) < target_val) iboun(5,ispec) = .true. ! on boundary 6: top - if (idoubling == IFLAG_ONE_LAYER_TOPOGRAPHY) iboun(6,ispec)=.true. + if (idoubling == IFLAG_ONE_LAYER_TOPOGRAPHY) iboun(6,ispec) = .true. ! ******************************************************************* ! determine if the element falls on an MPI cut plane along xi @@ -131,7 +131,7 @@ subroutine get_flags_boundaries(nspec,iproc_xi,iproc_eta,ispec,idoubling, & ! detect the MPI cut planes along xi in the cubed sphere - iMPIcut_xi(:,ispec)=.false. + iMPIcut_xi(:,ispec) = .false. ! angular size of a slice along xi sizeslice = (UTM_X_MAX-UTM_X_MIN) / NPROC_XI @@ -141,20 +141,20 @@ subroutine get_flags_boundaries(nspec,iproc_xi,iproc_eta,ispec,idoubling, & target_val = UTM_X_MIN + iproc_xi*sizeslice + TOLERANCE_METERS if (xelm(1) < target_val .and. xelm(4) < target_val .and. xelm(5) < target_val .and. xelm(8) < target_val) & - iMPIcut_xi(1,ispec)=.true. + iMPIcut_xi(1,ispec) = .true. ! right cut-plane in the current slice along X = constant (Xmax of this slice) ! and add geometrical tolerance target_val = UTM_X_MIN + (iproc_xi+1)*sizeslice - TOLERANCE_METERS if (xelm(2) > target_val .and. xelm(3) > target_val .and. xelm(6) > target_val .and. xelm(7) > target_val) & - iMPIcut_xi(2,ispec)=.true. + iMPIcut_xi(2,ispec) = .true. ! ******************************************************************** ! determine if the element falls on an MPI cut plane along eta ! ******************************************************************** - iMPIcut_eta(:,ispec)=.false. + iMPIcut_eta(:,ispec) = .false. ! angular size of a slice along eta sizeslice = (UTM_Y_MAX-UTM_Y_MIN) / NPROC_ETA @@ -164,14 +164,14 @@ subroutine get_flags_boundaries(nspec,iproc_xi,iproc_eta,ispec,idoubling, & target_val = UTM_Y_MIN + iproc_eta*sizeslice + TOLERANCE_METERS if (yelm(1) < target_val .and. yelm(2) < target_val .and. yelm(5) < target_val .and. yelm(6) < target_val) & - iMPIcut_eta(1,ispec)=.true. + iMPIcut_eta(1,ispec) = .true. ! right cut-plane in the current slice along Y = constant (Ymax of this slice) ! and add geometrical tolerance target_val = UTM_Y_MIN + (iproc_eta+1)*sizeslice - TOLERANCE_METERS if (yelm(3) > target_val .and. yelm(4) > target_val .and. yelm(7) > target_val .and. yelm(8) > target_val) & - iMPIcut_eta(2,ispec)=.true. + iMPIcut_eta(2,ispec) = .true. end subroutine get_flags_boundaries diff --git a/src/meshfem3D/save_databases.F90 b/src/meshfem3D/save_databases.F90 index c1e7f6129..de31b2f64 100644 --- a/src/meshfem3D/save_databases.F90 +++ b/src/meshfem3D/save_databases.F90 @@ -70,7 +70,7 @@ subroutine save_databases(nspec,nglob, & ! local parameters ! MPI Cartesian topology ! E for East (= XI_MIN), W for West (= XI_MAX), S for South (= ETA_MIN), N for North (= ETA_MAX) - integer, parameter :: W=1,E=2,S=3,N=4,NW=5,NE=6,SE=7,SW=8 + integer, parameter :: W = 1,E = 2,S = 3,N = 4,NW = 5,NE = 6,SE = 7,SW = 8 ! CPML integer :: nspec_CPML_total,ispec_CPML @@ -1040,7 +1040,7 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & ! modele 1D open(88,file='MESH/model_1D.in') write(88,*) nlayer,4 - do i=1,nlayer + do i = 1,nlayer write(88,*) zlayer(i) write(88,'(4f20.10)') vpv(i,:) write(88,'(4f20.10)') vsv(i,:) @@ -1082,9 +1082,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & close(90) ! xmin - do ielm=1,nspec2D_xmin + do ielm = 1,nspec2D_xmin - ispec=ibelm_xmin(ielm) + ispec = ibelm_xmin(ielm) write(89,*) ispec,ielm,1 @@ -1134,9 +1134,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,1, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) @@ -1148,9 +1148,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & enddo ! xmax - do ielm=1,nspec2D_xmax + do ielm = 1,nspec2D_xmax - ispec=ibelm_xmax(ielm) + ispec = ibelm_xmax(ielm) write(89,*) ispec,ielm,2 @@ -1200,9 +1200,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,2, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) @@ -1214,9 +1214,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & enddo ! ymin - do ielm=1,nspec2D_ymin + do ielm = 1,nspec2D_ymin - ispec=ibelm_ymin(ielm) + ispec = ibelm_ymin(ielm) write(89,*) ispec,ielm,3 @@ -1266,9 +1266,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,3, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) @@ -1280,9 +1280,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & enddo ! ymax - do ielm=1,nspec2D_ymax + do ielm = 1,nspec2D_ymax - ispec=ibelm_ymax(ielm) + ispec = ibelm_ymax(ielm) write(89,*) ispec,ielm,4 @@ -1332,9 +1332,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = 1 kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,4, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) @@ -1346,9 +1346,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & enddo ! bottom - do ielm=1,nspec2D_BOTTOM + do ielm = 1,nspec2D_BOTTOM - ispec=ibelm_bottom(ielm) + ispec = ibelm_bottom(ielm) write(89,*) ispec,ielm,5 @@ -1398,9 +1398,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = 1 kmax = 1 - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,5, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) @@ -1413,9 +1413,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & if (buried_box) then ! top - do ielm=1,nspec2D_TOP + do ielm = 1,nspec2D_TOP - ispec=ibelm_top(ielm) + ispec = ibelm_top(ielm) write(89,*) ispec,ielm,6 @@ -1465,9 +1465,9 @@ subroutine save_output_mesh_files_for_coupled_model(nspec, & kmin = NGLLZ kmax = NGLLZ - do k=kmin,kmax - do j=jmin,jmax - do i=imin,imax + do k = kmin,kmax + do j = jmin,jmax + do i = imin,imax write(92,'(3f25.10,i10,6i3)') xstore(i,j,k),ystore(i,j,k),zstore(i,j,k),ispec,i,j,k,6, & ilayer,updown(k) write(91,1000) radius(i,j,k), latitud(i,j,k), longitud(i,j,k) diff --git a/src/meshfem3D/save_databases_adios.F90 b/src/meshfem3D/save_databases_adios.F90 index ee74d242f..33631c722 100644 --- a/src/meshfem3D/save_databases_adios.F90 +++ b/src/meshfem3D/save_databases_adios.F90 @@ -76,7 +76,7 @@ subroutine save_databases_adios(LOCAL_PATH,sizeprocs, & ! MPI Cartesian topology ! E for East (= XI_MIN), W for West (= XI_MAX), ! S for South (= ETA_MIN), N for North (= ETA_MAX) - integer, parameter :: W=1,E=2,S=3,N=4,NW=5,NE=6,SE=7,SW=8 + integer, parameter :: W = 1,E = 2,S = 3,N = 4,NW = 5,NE = 6,SE = 7,SW = 8 logical,intent(in) :: iMPIcut_xi(2,nspec),iMPIcut_eta(2,nspec) diff --git a/src/meshfem3D/save_databases_hdf5.F90 b/src/meshfem3D/save_databases_hdf5.F90 index 4fd7ca2f5..8183f28ea 100644 --- a/src/meshfem3D/save_databases_hdf5.F90 +++ b/src/meshfem3D/save_databases_hdf5.F90 @@ -80,7 +80,7 @@ subroutine save_databases_hdf5(nspec,nglob, & ! local parameters ! MPI Cartesian topology ! E for East (= XI_MIN), W for West (= XI_MAX), S for South (= ETA_MIN), N for North (= ETA_MAX) - integer, parameter :: W=1,E=2,S=3,N=4,NW=5,NE=6,SE=7,SW=8 + integer, parameter :: W = 1,E = 2,S = 3,N = 4,NW = 5,NE = 6,SE = 7,SW = 8 ! CPML integer :: nspec_CPML_total,ispec_CPML @@ -390,7 +390,7 @@ subroutine save_databases_hdf5(nspec,nglob, & !call h5_open_file_p(name_database_hdf5) ! global nodes - do iglob=1,nglob + do iglob = 1,nglob nodes_coords_this_proc(1,iglob) = nodes_coords(iglob,1) nodes_coords_this_proc(2,iglob) = nodes_coords(iglob,2) nodes_coords_this_proc(3,iglob) = nodes_coords(iglob,3) @@ -470,7 +470,7 @@ subroutine save_databases_hdf5(nspec,nglob, & enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for xmin' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -491,7 +491,7 @@ subroutine save_databases_hdf5(nspec,nglob, & enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for xmax' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -511,7 +511,7 @@ subroutine save_databases_hdf5(nspec,nglob, & endif enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for ymin' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -531,7 +531,7 @@ subroutine save_databases_hdf5(nspec,nglob, & endif enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for ymax' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -551,7 +551,7 @@ subroutine save_databases_hdf5(nspec,nglob, & endif enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for bottom' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -571,7 +571,7 @@ subroutine save_databases_hdf5(nspec,nglob, & endif enddo if (inode /= NGNOD2D) stop 'Invalid number of inodes found for top' - do inode=1,NGNOD2D + do inode = 1,NGNOD2D glob2loc_elms_this_proc(inode+1,count1) = loc_node(inode) enddo count1 = count1 + 1 @@ -597,11 +597,11 @@ subroutine save_databases_hdf5(nspec,nglob, & ncpmls(1) = nspec_CPML_total ncpmls(2) = nspec_CPML if (nspec_CPML_total > 0) then - do ispec_CPML=1,nspec_CPML + do ispec_CPML = 1,nspec_CPML elements_cpml(1,ispec_CPML) = CPML_to_spec(ispec_CPML) elements_cpml(2,ispec_CPML) = CPML_regions(ispec_CPML) enddo - do ispec=1,nspec + do ispec = 1,nspec if (is_CPML(ispec)) then if_cpml(ispec) = 1 else diff --git a/src/meshfem3D/store_boundaries.f90 b/src/meshfem3D/store_boundaries.f90 index c9f2079a7..01eaf17bc 100644 --- a/src/meshfem3D/store_boundaries.f90 +++ b/src/meshfem3D/store_boundaries.f90 @@ -60,46 +60,46 @@ subroutine store_boundaries(iboun,nspec, & ispecb6 = 0 ! determine if the element falls on a boundary - do ispec=1,nspec + do ispec = 1,nspec ! on boundary: xmin if (iboun(1,ispec)) then - ispecb1=ispecb1+1 + ispecb1 = ispecb1+1 if (ispecb1 > NSPEC2DMAX_XMIN_XMAX) stop 'error NSPEC2DMAX_XMIN_XMAX too small' ibelm_xmin(ispecb1)=ispec endif ! on boundary: xmax if (iboun(2,ispec)) then - ispecb2=ispecb2+1 + ispecb2 = ispecb2+1 if (ispecb2 > NSPEC2DMAX_XMIN_XMAX) stop 'error NSPEC2DMAX_XMIN_XMAX too small' ibelm_xmax(ispecb2)=ispec endif ! on boundary: ymin if (iboun(3,ispec)) then - ispecb3=ispecb3+1 + ispecb3 = ispecb3+1 if (ispecb3 > NSPEC2DMAX_YMIN_YMAX) stop 'error NSPEC2DMAX_YMIN_YMAX too small' ibelm_ymin(ispecb3)=ispec endif ! on boundary: ymax if (iboun(4,ispec)) then - ispecb4=ispecb4+1 + ispecb4 = ispecb4+1 if (ispecb4 > NSPEC2DMAX_YMIN_YMAX) stop 'error NSPEC2DMAX_YMIN_YMAX too small' ibelm_ymax(ispecb4)=ispec endif ! on boundary: bottom if (iboun(5,ispec)) then - ispecb5=ispecb5+1 + ispecb5 = ispecb5+1 if (ispecb5 > NSPEC2D_BOTTOM) stop 'error NSPEC2D_BOTTOM too small' ibelm_bottom(ispecb5)=ispec endif ! on boundary: top if (iboun(6,ispec)) then - ispecb6=ispecb6+1 + ispecb6 = ispecb6+1 if (ispecb6 > NSPEC2D_TOP) stop 'error NSPEC2D_TOP too small' ibelm_top(ispecb6)=ispec endif diff --git a/src/shared/check_mesh_resolution.f90 b/src/shared/check_mesh_resolution.f90 index 52443608f..0a94ae223 100644 --- a/src/shared/check_mesh_resolution.f90 +++ b/src/shared/check_mesh_resolution.f90 @@ -1335,7 +1335,7 @@ subroutine check_mesh_distances(myrank,NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zst call max_all_cr(z_max,z_max_glob) ! gets distances for each grid cell - do ispec=1,NSPEC_AB + do ispec = 1,NSPEC_AB ! computes minimum and maximum size of this grid cell call get_elem_minmaxsize(elemsize_min,elemsize_max,ispec, & @@ -1416,9 +1416,9 @@ subroutine get_GLL_minmaxdistance(distance_min,distance_max,ispec, & ! loops over all GLL points ! (combines directions to speed up calculations) - do k=1,NGLLZ-1 - do j=1,NGLLY-1 - do i=1,NGLLX-1 + do k = 1,NGLLZ-1 + do j = 1,NGLLY-1 + do i = 1,NGLLX-1 ! reference point iglob1 = ibool(i,j,k,ispec) x1 = xstore(iglob1) diff --git a/src/shared/define_derivation_matrices.f90 b/src/shared/define_derivation_matrices.f90 index 4ad71e3a4..851d58b99 100644 --- a/src/shared/define_derivation_matrices.f90 +++ b/src/shared/define_derivation_matrices.f90 @@ -60,41 +60,41 @@ subroutine define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, & ! calculate derivatives of the Lagrange polynomials ! and precalculate some products in double precision ! hprime(i,j) = h'_j(xigll_i) by definition of the derivation matrix - do i1=1,NGLLX - do i2=1,NGLLX + do i1 = 1,NGLLX + do i2 = 1,NGLLX hprime_xx(i2,i1) = real(lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX),kind=CUSTOM_REAL) hprimewgll_xx(i2,i1) = real(lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX)*wxgll(i2),kind=CUSTOM_REAL) enddo enddo - do j1=1,NGLLY - do j2=1,NGLLY + do j1 = 1,NGLLY + do j2 = 1,NGLLY hprime_yy(j2,j1) = real(lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY),kind=CUSTOM_REAL) hprimewgll_yy(j2,j1) = real(lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY)*wygll(j2),kind=CUSTOM_REAL) enddo enddo - do k1=1,NGLLZ - do k2=1,NGLLZ + do k1 = 1,NGLLZ + do k2 = 1,NGLLZ hprime_zz(k2,k1) = real(lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ),kind=CUSTOM_REAL) hprimewgll_zz(k2,k1) = real(lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ)*wzgll(k2),kind=CUSTOM_REAL) enddo enddo - do i=1,NGLLX - do j=1,NGLLY + do i = 1,NGLLX + do j = 1,NGLLY wgllwgll_xy(i,j) = real(wxgll(i)*wygll(j),kind=CUSTOM_REAL) enddo enddo - do i=1,NGLLX - do k=1,NGLLZ + do i = 1,NGLLX + do k = 1,NGLLZ wgllwgll_xz(i,k) = real(wxgll(i)*wzgll(k),kind=CUSTOM_REAL) enddo enddo - do j=1,NGLLY - do k=1,NGLLZ + do j = 1,NGLLY + do k = 1,NGLLZ wgllwgll_yz(j,k) = real(wygll(j)*wzgll(k),kind=CUSTOM_REAL) enddo enddo diff --git a/src/shared/define_mass_matrices.f90 b/src/shared/define_mass_matrices.f90 index d10f8e9b3..712cf3407 100644 --- a/src/shared/define_mass_matrices.f90 +++ b/src/shared/define_mass_matrices.f90 @@ -764,7 +764,7 @@ subroutine define_mass_matrices_pml_elastic(nglob,nspec,nspec_irregular,DT,ibool stop 'error in PML mesh file' endif endif - enddo ! do ispec_CPML=1,nspec_cpml + enddo ! do ispec_CPML = 1,nspec_cpml end subroutine define_mass_matrices_pml_elastic @@ -855,7 +855,7 @@ subroutine define_mass_matrices_pml_acoustic(nglob,nspec,nspec_irregular,DT,iboo enddo ! loops over C-PML elements - do ispec_CPML=1,nspec_cpml + do ispec_CPML = 1,nspec_cpml ispec = CPML_to_spec(ispec_CPML) if (is_CPML(ispec) .and. ispec_is_acoustic(ispec)) then @@ -1010,6 +1010,6 @@ subroutine define_mass_matrices_pml_acoustic(nglob,nspec,nspec_irregular,DT,iboo stop 'error in PML mesh file' endif endif - enddo ! do ispec_CPML=1,nspec_cpml + enddo ! do ispec_CPML = 1,nspec_cpml end subroutine define_mass_matrices_pml_acoustic diff --git a/src/shared/detect_surface.f90 b/src/shared/detect_surface.f90 index d3f5dabd5..ce99c2b31 100644 --- a/src/shared/detect_surface.f90 +++ b/src/shared/detect_surface.f90 @@ -400,7 +400,7 @@ subroutine detect_surface_cross_section(NPROC,nglob,nspec,ibool, & midpoint_faces_y(:) = 0.0 midpoint_faces_z(:) = 0.0 - do iface=1,6 + do iface = 1,6 ! face corners do icorner = 1,NGNOD2D_FOUR_CORNERS diff --git a/src/shared/get_attenuation_model.f90 b/src/shared/get_attenuation_model.f90 index bf2a4e681..03673579e 100644 --- a/src/shared/get_attenuation_model.f90 +++ b/src/shared/get_attenuation_model.f90 @@ -327,9 +327,9 @@ subroutine get_attenuation_model(nspec,USE_OLSEN_ATTENUATION,OLSEN_ATTENUATION_R if (ispec_is_elastic(ispec) .eqv. .false.) cycle ! determines attenuation factors for each GLL point - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! initializes Q Q_mu = 0.d0 @@ -1044,10 +1044,10 @@ subroutine attenuation_invert_by_simplex(t2, t1, n, Q_real, tau_s, tau_eps) ! Run a simplex search to determine the optimum values of tau_eps call fminsearch(attenuation_eval, tau_eps, n, iterations, min_value, prnt, err) if (err > 0) then - write(*,*)'Search did not converge for an attenuation of ', Q_real - write(*,*)' Iterations: ', iterations - write(*,*)' Min Value: ', min_value - write(*,*)' Aborting program' + write(*,*) 'Search did not converge for an attenuation of ', Q_real + write(*,*) ' Iterations: ', iterations + write(*,*) ' Min Value: ', min_value + write(*,*) ' Aborting program' call exit_MPI(0,'attenuation_simplex: Search for Strain relaxation times did not converge') endif @@ -1204,12 +1204,12 @@ subroutine attenuation_maxwell(nf,nsls,f,tau_s,tau_eps,B,A) do i = 1,nf w = 2.0d0 * PI * 10**f(i) do j = 1,nsls - ! write(*,*)j,tau_s(j),tau_eps(j) + ! write(*,*) j,tau_s(j),tau_eps(j) denom = 1.0d0 + w**2 * tau_s(j)**2 A(i) = A(i) + (1.0d0 + (w**2 * tau_eps(j) * tau_s(j)))/ denom B(i) = B(i) + w * ( tau_eps(j) - tau_s(j) ) / denom enddo - ! write(*,*)A(i),B(i),10**f(i) + ! write(*,*) A(i),B(i),10**f(i) enddo end subroutine attenuation_maxwell @@ -1344,14 +1344,14 @@ subroutine fminsearch(funk, x, n, itercount, tolf, prnt, err) itercount = 1 func_evals = n+1 if (prnt == 3) then - write(*,*)'Iterations Funk Evals Value How' - write(*,*)itercount, func_evals, fv(1), how + write(*,*) 'Iterations Funk Evals Value How' + write(*,*) itercount, func_evals, fv(1), how endif if (prnt == 4) then - write(*,*)'How: ',how - write(*,*)'V: ', v - write(*,*)'fv: ',fv - write(*,*)'evals: ',func_evals + write(*,*) 'How: ',how + write(*,*) 'V: ', v + write(*,*) 'fv: ',fv + write(*,*) 'evals: ',func_evals endif do while (func_evals < maxfun .and. itercount < maxiter) @@ -1429,7 +1429,7 @@ subroutine fminsearch(funk, x, n, itercount, tolf, prnt, err) endif endif if (how == shrink) then - do j=2,n+1 + do j = 2,n+1 v(:,j)=v(:,1)+sigma*(v(:,j) - v(:,1)) x(:) = v(:,j) fv(j) = funk(x) @@ -1447,22 +1447,22 @@ subroutine fminsearch(funk, x, n, itercount, tolf, prnt, err) itercount = itercount + 1 if (prnt == 3) then - write(*,*)itercount, func_evals, fv(1), how + write(*,*) itercount, func_evals, fv(1), how else if (prnt == 4) then write(*,*) - write(*,*)'How: ',how - write(*,*)'v: ',v - write(*,*)'fv: ',fv - write(*,*)'evals: ',func_evals + write(*,*) 'How: ',how + write(*,*) 'v: ',v + write(*,*) 'fv: ',fv + write(*,*) 'evals: ',func_evals endif enddo if (func_evals > maxfun) then - write(*,*)'function evaluations exceeded prescribed limit', maxfun + write(*,*) 'function evaluations exceeded prescribed limit', maxfun err = 1 endif if (itercount > maxiter) then - write(*,*)'iterations exceeded prescribed limit', maxiter + write(*,*) 'iterations exceeded prescribed limit', maxiter err = 2 endif diff --git a/src/shared/get_element_face.f90 b/src/shared/get_element_face.f90 index 4c9291171..6c6b29a2f 100644 --- a/src/shared/get_element_face.f90 +++ b/src/shared/get_element_face.f90 @@ -191,8 +191,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (1) if (NGLLA /= NGLLY .or. NGLLB /= NGLLZ) stop 'error absorbing face 1 indexing' i_gll = 1 - do k=1,NGLLZ - do j=1,NGLLY + do k = 1,NGLLZ + do j = 1,NGLLY ngll = ngll + 1 ijk_face(1,j,k) = i_gll ijk_face(2,j,k) = j @@ -204,8 +204,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (2) if (NGLLA /= NGLLY .or. NGLLB /= NGLLZ) stop 'error absorbing face 2 indexing' i_gll = NGLLX - do k=1,NGLLZ - do j=1,NGLLY + do k = 1,NGLLZ + do j = 1,NGLLY ngll = ngll + 1 ijk_face(1,j,k) = i_gll ijk_face(2,j,k) = j @@ -217,8 +217,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (3) if (NGLLA /= NGLLX .or. NGLLB /= NGLLZ) stop 'error absorbing face 3 indexing' j_gll = 1 - do k=1,NGLLZ - do i=1,NGLLX + do k = 1,NGLLZ + do i = 1,NGLLX ngll = ngll + 1 ijk_face(1,i,k) = i ijk_face(2,i,k) = j_gll @@ -230,8 +230,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (4) if (NGLLA /= NGLLX .or. NGLLB /= NGLLZ) stop 'error absorbing face 4 indexing' j_gll = NGLLY - do k=1,NGLLZ - do i=1,NGLLX + do k = 1,NGLLZ + do i = 1,NGLLX ngll = ngll + 1 ijk_face(1,i,k) = i ijk_face(2,i,k) = j_gll @@ -243,8 +243,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (5) if (NGLLA /= NGLLX .or. NGLLB /= NGLLY) stop 'error absorbing face 5 indexing' k_gll = 1 - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX ngll = ngll + 1 ijk_face(1,i,j) = i ijk_face(2,i,j) = j @@ -256,8 +256,8 @@ subroutine get_element_face_gll_indices(iface,ijk_face,NGLLA,NGLLB ) case (6) if (NGLLA /= NGLLX .or. NGLLB /= NGLLY) stop 'error absorbing face 6 indexing' k_gll = NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX ngll = ngll + 1 ijk_face(1,i,j) = i ijk_face(2,i,j) = j diff --git a/src/shared/get_global.f90 b/src/shared/get_global.f90 index 04e8848b4..be489b2d9 100644 --- a/src/shared/get_global.f90 +++ b/src/shared/get_global.f90 @@ -117,10 +117,10 @@ subroutine get_global_indirect_addressing(nspec,nglob,ibool) ! reduces misses inumber = 0 - do ispec=1,nspec - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,nspec + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (mask_ibool(copy_ibool_ori(i,j,k,ispec)) == -1) then ! create a new point inumber = inumber + 1 diff --git a/src/shared/get_shape3D.f90 b/src/shared/get_shape3D.f90 index 3b9a7629a..ae0f81629 100644 --- a/src/shared/get_shape3D.f90 +++ b/src/shared/get_shape3D.f90 @@ -63,9 +63,9 @@ subroutine get_shape3D(shape3D,dershape3D,xigll,yigll,zigll,NGNOD,NGLLX,NGLLY,NG ! *** create 3D shape functions and jacobian ! *** - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ xi = xigll(i) eta = yigll(j) @@ -133,16 +133,16 @@ subroutine get_shape3D(shape3D,dershape3D,xigll,yigll,zigll,NGNOD,NGLLX,NGLLY,NG !--- check the shape functions and their derivatives - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ sumshape = ZERO sumdershapexi = ZERO sumdershapeeta = ZERO sumdershapegamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD sumshape = sumshape + shape3D(ia,i,j,k) sumdershapexi = sumdershapexi + dershape3D(1,ia,i,j,k) sumdershapeeta = sumdershapeeta + dershape3D(2,ia,i,j,k) @@ -219,15 +219,15 @@ subroutine eval_shape3D_single(shape3D,xi,eta,gamma,NGNOD) else l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 + l2gamma = ONE-gamma**2 l3gamma=HALF*gamma*(gamma+ONE) ! corner nodes @@ -269,7 +269,7 @@ subroutine eval_shape3D_single(shape3D,xi,eta,gamma,NGNOD) ! check the shape functions sumshape = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD sumshape = sumshape + shape3D(ia) enddo @@ -415,28 +415,28 @@ subroutine get_shape3D_27(NGNOD,NGLLX,NGLLY,NGLLZ,shape3D,dershape3D,xi,eta,gamm double precision l1pxi,l2pxi,l3pxi,l1peta,l2peta,l3peta,l1pgamma,l2pgamma,l3pgamma l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 + l2gamma = ONE-gamma**2 l3gamma=HALF*gamma*(gamma+ONE) - l1pgamma=gamma-HALF + l1pgamma = gamma-HALF l2pgamma=-TWO*gamma - l3pgamma=gamma+HALF + l3pgamma = gamma+HALF ! corner nodes shape3D(1,i,j,k)=l1xi*l1eta*l1gamma diff --git a/src/shared/gll_library.f90 b/src/shared/gll_library.f90 index fa8868778..46cdb18ab 100644 --- a/src/shared/gll_library.f90 +++ b/src/shared/gll_library.f90 @@ -44,7 +44,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -70,7 +70,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -96,7 +96,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -122,7 +122,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -149,7 +149,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -208,7 +208,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -217,11 +217,11 @@ subroutine jacg (xjac,np,alpha,beta) x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -242,12 +242,12 @@ subroutine jacg (xjac,np,alpha,beta) jmin = 0 ! orders xjac array in increasing values - do i=1,np + do i = 1,np xmin = 2.d0 jmin = i ! looks for index with minimum value - do j=i,np + do j = i,np ! note: some compilers (cray) might be too aggressive in optimizing this loop, ! thus we need this temporary array value x to store and compare values x = xjac(j) @@ -305,7 +305,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -436,7 +436,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -463,7 +463,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -507,7 +507,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -534,7 +534,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,tol_zero=1.d-30 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,tol_zero = 1.d-30 integer np double precision alpha,beta @@ -580,7 +580,7 @@ subroutine zwgljd(z,w,np,alpha,beta) endif ! weights - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 5014f53cc..3a0427ef6 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -4848,7 +4848,7 @@ subroutine test_io_hdf5() if (myrank /= 0) return ! initialize - store_x(:) = (/(i,i=1,10)/) + store_x(:) = (/(i,i = 1,10)/) ! hdf5 ! calls the object constructor, i.e. h5io_constructor() diff --git a/src/shared/parallel.f90 b/src/shared/parallel.f90 index 3f6dedfdc..e8515251d 100644 --- a/src/shared/parallel.f90 +++ b/src/shared/parallel.f90 @@ -2193,7 +2193,7 @@ subroutine world_split() print * print *,'make sure to launch program with NPROC * NUMBER_OF_SIMULTANEOUS_RUNS processes' print *,'for example: NPROC = 1 and NUMBER_OF_SIMULTANEOUS_RUNS = 4' - print *,' > mpirun -np 4 ./bin/xspecfem3D' + print *,' > mpirun -np 4 ./bin/xspecfem3D' print * endif stop 'the number of MPI processes is not a multiple of NUMBER_OF_SIMULTANEOUS_RUNS' diff --git a/src/shared/recompute_jacobian.f90 b/src/shared/recompute_jacobian.f90 index 48c56e412..7ea10e8ba 100644 --- a/src/shared/recompute_jacobian.f90 +++ b/src/shared/recompute_jacobian.f90 @@ -81,7 +81,7 @@ subroutine recompute_jacobian(xelm,yelm,zelm,xi,eta,gamma,x,y,z, & zeta = ZERO zgamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD x = x+shape3D(ia)*xelm(ia) y = y+shape3D(ia)*yelm(ia) z = z+shape3D(ia)*zelm(ia) diff --git a/src/shared/write_VTK_data.f90 b/src/shared/write_VTK_data.f90 index 5727c15c3..5d6fb1876 100644 --- a/src/shared/write_VTK_data.f90 +++ b/src/shared/write_VTK_data.f90 @@ -80,14 +80,14 @@ subroutine write_VTK_data_elem_i(nspec,nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e20.12)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) '' ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1,ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & ibool(1,1,NGLLZ,ispec)-1,ibool(NGLLX,1,NGLLZ,ispec)-1,ibool(NGLLX,NGLLY,NGLLZ,ispec)-1,ibool(1,NGLLY,NGLLZ,ispec)-1 @@ -150,14 +150,14 @@ subroutine write_VTK_data_elem_l(nspec,nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e20.12)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) '' ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1,ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & ibool(1,1,NGLLZ,ispec)-1,ibool(NGLLX,1,NGLLZ,ispec)-1,ibool(NGLLX,NGLLY,NGLLZ,ispec)-1,ibool(1,NGLLY,NGLLZ,ispec)-1 @@ -230,14 +230,14 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e20.12)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) '' ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1,ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & ibool(1,1,NGLLZ,ispec)-1,ibool(NGLLX,1,NGLLZ,ispec)-1,ibool(NGLLX,NGLLY,NGLLZ,ispec)-1,ibool(1,NGLLY,NGLLZ,ispec)-1 @@ -256,10 +256,10 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, & endif mask_ibool = .false. - do ispec=1,nspec - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,nspec + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) if (.not. mask_ibool(iglob)) then flag_val(iglob) = gll_data(i,j,k,ispec) @@ -326,14 +326,14 @@ subroutine write_VTK_data_gll_i(nspec,nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e20.12)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) '' ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1,ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & ibool(1,1,NGLLZ,ispec)-1,ibool(NGLLX,1,NGLLZ,ispec)-1,ibool(NGLLX,NGLLY,NGLLZ,ispec)-1,ibool(1,NGLLY,NGLLZ,ispec)-1 @@ -350,10 +350,10 @@ subroutine write_VTK_data_gll_i(nspec,nglob, & if (ier /= 0) stop 'error allocating mask' mask_ibool = .false. - do ispec=1,nspec - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,nspec + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) if (.not. mask_ibool(iglob)) then flag_val(iglob) = gll_data(i,j,k,ispec) @@ -418,7 +418,7 @@ subroutine write_VTK_data_points(nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', num_points_globalindices, ' float' - do i=1,num_points_globalindices + do i = 1,num_points_globalindices iglob = points_globalindices(i) if (iglob <= 0 .or. iglob > nglob) then print *,'error: '//prname_file(1:len_trim(prname_file))//'.vtk' @@ -593,14 +593,14 @@ subroutine write_VTK_data_elem_vectors(nspec,nglob, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e20.12)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) '' ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1,ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & ibool(1,1,NGLLZ,ispec)-1,ibool(NGLLX,1,NGLLZ,ispec)-1,ibool(NGLLX,NGLLY,NGLLZ,ispec)-1,ibool(1,NGLLY,NGLLZ,ispec)-1 @@ -615,7 +615,7 @@ subroutine write_VTK_data_elem_vectors(nspec,nglob, & ! vector data for each cell write(IOUT_VTK,'(a,i12)') "CELL_DATA ",nspec write(IOUT_VTK,'(a)') "VECTORS _vectors_ float" - do i=1,nspec + do i = 1,nspec write(IOUT_VTK,*) elem_vector(1,i),elem_vector(2,i),elem_vector(3,i) enddo write(IOUT_VTK,*) '' @@ -1568,14 +1568,14 @@ subroutine write_VTK_wavefield(nspec,nglob,xstore,ystore,zstore,ibool, & write(IOUT_VTK,'(a)') 'ASCII' write(IOUT_VTK,'(a)') 'DATASET UNSTRUCTURED_GRID' write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nglob, ' float' - do i=1,nglob + do i = 1,nglob write(IOUT_VTK,'(3e18.6)') xstore(i),ystore(i),zstore(i) enddo write(IOUT_VTK,*) "" ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8, & ibool(1,1,1,ispec)-1,ibool(NGLLX,1,1,ispec)-1, & ibool(NGLLX,NGLLY,1,ispec)-1,ibool(1,NGLLY,1,ispec)-1, & diff --git a/src/specfem3D/calendar.f90 b/src/specfem3D/calendar.f90 index 77cc19bed..60bfb034f 100644 --- a/src/specfem3D/calendar.f90 +++ b/src/specfem3D/calendar.f90 @@ -50,11 +50,11 @@ integer function lpyr(yr) ! !---- returns 1 if leap year ! - lpyr=0 + lpyr = 0 if (mod(yr,400) == 0) then - lpyr=1 + lpyr = 1 else if (mod(yr,4) == 0) then - lpyr=1 + lpyr = 1 if (mod(yr,100) == 0) lpyr=0 endif @@ -490,7 +490,7 @@ subroutine calndr(iday,month,iyear,idayct) ! ! Look for out-of-range option values. if ((ioptn == 0) .or. (abs(ioptn) >= 6)) then - write(*,*)'For calndr(), you specified ioptn = ', ioptn + write(*,*) 'For calndr(), you specified ioptn = ', ioptn write(*,*) 'Allowable values are 1 to 5 for the Gregorian calendar' write(*,*) 'and -1 to -5 for the Julian calendar.' stop diff --git a/src/specfem3D/comp_source_time_function.f90 b/src/specfem3D/comp_source_time_function.f90 index ef93ea9b3..c187a46da 100644 --- a/src/specfem3D/comp_source_time_function.f90 +++ b/src/specfem3D/comp_source_time_function.f90 @@ -306,7 +306,7 @@ double precision function comp_source_time_function_smooth_brune(t,f0) double precision, intent(in) :: t,f0 ! local variables - double precision,parameter :: tau0=2.31d0 + double precision,parameter :: tau0 = 2.31d0 double precision :: omega,omegat ! Brune source-time function diff --git a/src/specfem3D/compute_add_sources_acoustic.f90 b/src/specfem3D/compute_add_sources_acoustic.f90 index c9e1de25b..85866872d 100644 --- a/src/specfem3D/compute_add_sources_acoustic.f90 +++ b/src/specfem3D/compute_add_sources_acoustic.f90 @@ -112,9 +112,9 @@ subroutine compute_add_sources_acoustic(potential_dot_dot_acoustic) ! to add minus the source to Chi_dot_dot to get plus the source in pressure ! adds source array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! adds source contribution ! note: acoustic source for pressure gets divided by kappa iglob = ibool(i,j,k,ispec) @@ -381,9 +381,9 @@ subroutine compute_add_sources_acoustic_backward(b_potential_dot_dot_acoustic) stf_used = real(stf,kind=CUSTOM_REAL) ! add source array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! adds source contribution ! note: acoustic source for pressure gets divided by kappa iglob = ibool(i,j,k,ispec) diff --git a/src/specfem3D/compute_add_sources_viscoelastic.F90 b/src/specfem3D/compute_add_sources_viscoelastic.F90 index 3ad6c8b7d..ac1c15bf4 100644 --- a/src/specfem3D/compute_add_sources_viscoelastic.F90 +++ b/src/specfem3D/compute_add_sources_viscoelastic.F90 @@ -132,9 +132,9 @@ subroutine compute_add_sources_viscoelastic(accel) stf_used = real(stf,kind=CUSTOM_REAL) ! adds source array - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) !$OMP ATOMIC accel(1,iglob) = accel(1,iglob) + sourcearrays(isource,1,i,j,k)*stf_used @@ -425,9 +425,9 @@ subroutine compute_add_sources_viscoelastic_backward(b_accel) stf_used = real(stf,kind=CUSTOM_REAL) ! adds source - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) b_accel(:,iglob) = b_accel(:,iglob) + sourcearrays(isource,:,i,j,k) * stf_used enddo diff --git a/src/specfem3D/compute_boundary_kernel.f90 b/src/specfem3D/compute_boundary_kernel.f90 index 08c6648c4..96194ebfa 100644 --- a/src/specfem3D/compute_boundary_kernel.f90 +++ b/src/specfem3D/compute_boundary_kernel.f90 @@ -105,7 +105,7 @@ subroutine compute_boundary_kernel() else if (ispec_bot > 0 .or. ispec_top > 0) then ! loops over surface - do igll=1,NGLLSQUARE + do igll = 1,NGLLSQUARE if (ispec_top > 0) then i = ijk_moho_top(1,igll,ispec2D) diff --git a/src/specfem3D/compute_coupling_viscoelastic_po.f90 b/src/specfem3D/compute_coupling_viscoelastic_po.f90 index eb72086e4..95e22dd30 100644 --- a/src/specfem3D/compute_coupling_viscoelastic_po.f90 +++ b/src/specfem3D/compute_coupling_viscoelastic_po.f90 @@ -345,7 +345,7 @@ subroutine compute_coupling_viscoelastic_po(iphase) tempz3l = 0.0_CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) iglob = ibool(l,j,k,ispec_el) tempx1l = tempx1l + displ(1,iglob)*hp1 diff --git a/src/specfem3D/compute_energy.f90 b/src/specfem3D/compute_energy.f90 index a67d42811..b59883426 100644 --- a/src/specfem3D/compute_energy.f90 +++ b/src/specfem3D/compute_energy.f90 @@ -121,9 +121,9 @@ subroutine compute_energy_generic_slow() !--- if (ispec_is_elastic(ispec)) then - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -132,9 +132,9 @@ subroutine compute_energy_generic_slow() enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -151,7 +151,7 @@ subroutine compute_energy_generic_slow() tempz3(i,j,k) = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1(i,j,k) = tempx1(i,j,k) + dummyx_loc(l,j,k)*hp1 tempy1(i,j,k) = tempy1(i,j,k) + dummyy_loc(l,j,k)*hp1 @@ -335,18 +335,18 @@ subroutine compute_energy_generic_slow() ! velocity is then: v = grad(Chi_dot) / rho (Chi_dot being the time derivative of Chi) ! and pressure is: p = - Chi_dot_dot (Chi_dot_dot being the time second derivative of Chi). - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = potential_dot_acoustic(iglob) enddo enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -355,7 +355,7 @@ subroutine compute_energy_generic_slow() tempx3(i,j,k) = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1(i,j,k) = tempx1(i,j,k) + dummyx_loc(l,j,k)*hp1 @@ -553,9 +553,9 @@ subroutine compute_energy_fast_Deville() !--- if (ispec_is_elastic(ispec)) then - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -581,9 +581,9 @@ subroutine compute_energy_fast_Deville() call mxm7_single_three_arrays_at_a_time_AC(dummyx_loc,m2,hprime_xxT,tempx3,m1,dummyy_loc,tempy3,dummyz_loc,tempz3) endif - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) @@ -754,9 +754,9 @@ subroutine compute_energy_fast_Deville() ! velocity is then: v = grad(Chi_dot) / rho (Chi_dot being the time derivative of Chi) ! and pressure is: p = - Chi_dot_dot (Chi_dot_dot being the time second derivative of Chi). - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = potential_dot_acoustic(iglob) enddo @@ -780,9 +780,9 @@ subroutine compute_energy_fast_Deville() call mxm7_single(dummyx_loc,m2,hprime_xxT,tempx3,m1) endif - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) diff --git a/src/specfem3D/compute_forces_acoustic.F90 b/src/specfem3D/compute_forces_acoustic.F90 index 1ca88b7a3..e2b6b7c50 100644 --- a/src/specfem3D/compute_forces_acoustic.F90 +++ b/src/specfem3D/compute_forces_acoustic.F90 @@ -198,9 +198,9 @@ subroutine compute_forces_acoustic(iphase, & call mxm8_3dmat_single(chi_elem,m1,hprime_xxT,m1,temp2,NGLLX) call mxm8_single(chi_elem,m2,hprime_xxT,temp3,m1) case default - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! derivative along x, y, z ! first double loop over GLL points to compute and store gradients temp1l = 0._CUSTOM_REAL @@ -309,7 +309,7 @@ subroutine compute_forces_acoustic(iphase, & temp2l = 0._CUSTOM_REAL temp3l = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX temp1l = temp1l + temp1(l,j,k) * hprimewgll_xx(l,i) temp2l = temp2l + temp2(i,l,k) * hprimewgll_yy(l,j) temp3l = temp3l + temp3(i,j,l) * hprimewgll_zz(l,k) @@ -931,9 +931,9 @@ subroutine compute_forces_acoustic_PML(iphase, & call mxm8_3comp_3dmat_single(chi_elem,chi_elem_old,chi_elem_new,m1,hprime_xxT,m1,temp2,temp2_old,temp2_new,m1) call mxm8_3comp_singleB(chi_elem,chi_elem_old,chi_elem_new,m2,hprime_xxT,temp3,temp3_old,temp3_new,m1) case default - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! derivative along x, y, z temp1l = 0._CUSTOM_REAL temp2l = 0._CUSTOM_REAL @@ -947,7 +947,7 @@ subroutine compute_forces_acoustic_PML(iphase, & temp2l_new = 0._CUSTOM_REAL temp3l_new = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) temp1l = temp1l + chi_elem(l,j,k)*hp1 temp1l_old = temp1l_old + chi_elem_old(l,j,k)*hp1 @@ -1136,7 +1136,7 @@ subroutine compute_forces_acoustic_PML(iphase, & temp2l = 0._CUSTOM_REAL temp3l = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX temp1l = temp1l + temp1(l,j,k) * hprimewgll_xx(l,i) temp2l = temp2l + temp2(i,l,k) * hprimewgll_yy(l,j) temp3l = temp3l + temp3(i,j,l) * hprimewgll_zz(l,k) diff --git a/src/specfem3D/compute_forces_poro_fluid_part.f90 b/src/specfem3D/compute_forces_poro_fluid_part.f90 index df718ae0e..0c45fab05 100644 --- a/src/specfem3D/compute_forces_poro_fluid_part.f90 +++ b/src/specfem3D/compute_forces_poro_fluid_part.f90 @@ -120,7 +120,7 @@ subroutine compute_forces_poro_fluid_part(iphase, & ! ! first double loop over GLL points to compute and store gradients ! - do k=1,NGLLZ + do k = 1,NGLLZ do j = 1,NGLLY do i = 1,NGLLX @@ -432,7 +432,7 @@ subroutine compute_forces_poro_fluid_part(iphase, & tempz3lw = 0.0_CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1ls = tempx1ls + tempx1(l,j,k)*fac1 tempy1ls = tempy1ls + tempy1(l,j,k)*fac1 diff --git a/src/specfem3D/compute_forces_poro_solid_part.f90 b/src/specfem3D/compute_forces_poro_solid_part.f90 index 2278add7c..43400b935 100644 --- a/src/specfem3D/compute_forces_poro_solid_part.f90 +++ b/src/specfem3D/compute_forces_poro_solid_part.f90 @@ -114,7 +114,7 @@ subroutine compute_forces_poro_solid_part(iphase, & ! ! first double loop over GLL points to compute and store gradients ! - do k=1,NGLLZ + do k = 1,NGLLZ do j = 1,NGLLY do i = 1,NGLLX @@ -428,7 +428,7 @@ subroutine compute_forces_poro_solid_part(iphase, & tempz3lw = 0.0_CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1ls = tempx1ls + tempx1(l,j,k)*fac1 tempy1ls = tempy1ls + tempy1(l,j,k)*fac1 diff --git a/src/specfem3D/compute_forces_viscoelastic.F90 b/src/specfem3D/compute_forces_viscoelastic.F90 index 081222680..3a5fb47e9 100644 --- a/src/specfem3D/compute_forces_viscoelastic.F90 +++ b/src/specfem3D/compute_forces_viscoelastic.F90 @@ -286,9 +286,9 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & ! (through indirect addressing with array ibool()) ! thus, instead of DO_LOOP_IJK we use do k=..;do j=..;do i=.., ! which helps the compiler to unroll the innermost loop - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) + eta * veloc(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) + eta * veloc(2,iglob) @@ -302,9 +302,9 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & ! (through indirect addressing with array ibool()) ! thus, instead of DO_LOOP_IJK we use do k=..;do j=..;do i=.., ! which helps the compiler to unroll the innermost loop - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -346,9 +346,9 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & call mxm8_3comp_3dmat_single(dummyx_loc,dummyy_loc,dummyz_loc,m1,hprime_xxT,m1,tempx2,tempy2,tempz2,m1) call mxm8_3comp_singleB(dummyx_loc,dummyy_loc,dummyz_loc,m2,hprime_xxT,tempx3,tempy3,tempz3,m1) case default - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0._CUSTOM_REAL tempx2l = 0._CUSTOM_REAL tempx3l = 0._CUSTOM_REAL @@ -397,9 +397,9 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & if (ATTENUATION .and. .not. is_CPML(ispec)) then ! use first order Taylor expansion of displacement for local storage of stresses ! at this current time step, to fix attenuation in a consistent way - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc_att(i,j,k) = deltat * veloc(1,iglob) dummyy_loc_att(i,j,k) = deltat * veloc(2,iglob) @@ -752,7 +752,7 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & tempy3l = 0._CUSTOM_REAL tempz3l = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k) * fac1 tempy1l = tempy1l + tempy1(l,j,k) * fac1 @@ -910,9 +910,9 @@ subroutine compute_strain_in_element_att(tempx1_att,tempx2_att,tempx3_att,tempx1 ! use first order Taylor expansion of displacement for local storage of stresses ! at this current time step, to fix attenuation in a consistent way - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = tempx1(i,j,k) tempy1l = tempy1(i,j,k) tempz1l = tempz1(i,j,k) @@ -925,7 +925,7 @@ subroutine compute_strain_in_element_att(tempx1_att,tempx2_att,tempx3_att,tempx1 tempy3l = tempy3(i,j,k) tempz3l = tempz3(i,j,k) ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xxT(l,i) tempx1l = tempx1l + dummyx_loc(l,j,k) * hp1 tempy1l = tempy1l + dummyy_loc(l,j,k) * hp1 @@ -1301,9 +1301,9 @@ subroutine compute_forces_viscoelastic_PML(iphase, & call mxm8_3comp_singleB(dummyx_loc_new,dummyy_loc_new,dummyz_loc_new,m2,hprime_xxT,tempx3_new,tempy3_new,tempz3_new,m1) case default - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0._CUSTOM_REAL tempx2l = 0._CUSTOM_REAL tempx3l = 0._CUSTOM_REAL @@ -1678,7 +1678,7 @@ subroutine compute_forces_viscoelastic_PML(iphase, & tempz3l = 0._CUSTOM_REAL ! we can merge these loops because NGLLX = NGLLY = NGLLZ - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k) * fac1 tempy1l = tempy1l + tempy1(l,j,k) * fac1 diff --git a/src/specfem3D/convert_time.f90 b/src/specfem3D/convert_time.f90 index 3e9602d3e..caf6c7081 100644 --- a/src/specfem3D/convert_time.f90 +++ b/src/specfem3D/convert_time.f90 @@ -163,20 +163,20 @@ subroutine invtime(timestamp,yr,mon,day,hr,minvalue) if (timestamp >= year(MAX_YEAR)) stop 'year too high in invtime' iyr = 1979 - itime=timestamp + itime = timestamp - 10 iyr=iyr+1 + 10 iyr = iyr+1 ttime=itime-year(iyr) if (ttime <= 0) then if (iyr == 1980) iyr=iyr+1 - iyr=iyr-1 + iyr = iyr-1 itime=itime-year(iyr) else goto 10 endif ! assign the return variable - yr=iyr + yr = iyr ! OK, the remaining time is less than one full year, so convert ! by the same method as above into months @@ -187,19 +187,19 @@ subroutine invtime(timestamp,yr,mon,day,hr,minvalue) ! increment the month, and subtract off the minutes from the ! remaining time for a non-leap year - 20 imon=imon+1 + 20 imon = imon+1 tmon=itime-month(imon) if (tmon > 0) then goto 20 else if (tmon < 0) then - imon=imon-1 + imon = imon-1 itime=itime-month(imon) else if (imon > 12) then - imon=imon-12 - yr=yr+1 + imon = imon-12 + yr = yr+1 endif - mon=imon + mon = imon day = 1 hr = 0 minvalue = 0 @@ -210,19 +210,19 @@ subroutine invtime(timestamp,yr,mon,day,hr,minvalue) else ! same thing, same code, but for a leap year - 30 imon=imon+1 + 30 imon = imon+1 tmon=itime-leap_mon(imon) if (tmon > 0) then goto 30 else if (tmon < 0) then - imon=imon-1 + imon = imon-1 itime=itime-month(imon) else if (imon > 12) then - imon=imon-12 - yr=yr+1 + imon = imon-12 + yr = yr+1 endif - mon=imon + mon = imon day = 1 hr = 0 minvalue = 0 @@ -231,39 +231,39 @@ subroutine invtime(timestamp,yr,mon,day,hr,minvalue) endif ! assign the return variable - mon=imon + mon = imon ! any remaining minutes will belong to day/hour/minutes ! OK, let us get the days iday = 0 - 40 iday=iday+1 - ttime=itime-min_day + 40 iday = iday+1 + ttime = itime-min_day if (ttime >= 0) then - itime=ttime + itime = ttime goto 40 endif ! assign the return variable if (is_leap_year(iyr) .and. mon > 2) then - day=iday-1 + day = iday-1 else - day=iday + day = iday endif ! pick off the hours of the days...remember, hours can be 0, so we start at -1 ihour=-1 - 50 ihour=ihour+1 - thour=itime-min_hr + 50 ihour = ihour+1 + thour = itime-min_hr if (thour >= 0) then - itime=thour + itime = thour goto 50 endif ! assign the return variables - hr=ihour + hr = ihour ! the remainder at this point is the minutes, so return them directly - minvalue=itime + minvalue = itime end subroutine invtime diff --git a/src/specfem3D/couple_with_injection.f90 b/src/specfem3D/couple_with_injection.f90 index b8a10688e..572519635 100644 --- a/src/specfem3D/couple_with_injection.f90 +++ b/src/specfem3D/couple_with_injection.f90 @@ -926,7 +926,7 @@ subroutine FK(al, be, mu, H, nlayer, & do ii = 1, nf2 om = 2.0 * PI * fvec(ii) ! propagation matrix - call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness=sum(H) + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness = sum(H) a = N_mat(3,2); b = N_mat(3,4); c = N_mat(4,2); d = N_mat(4,4) delta_mat = a*d - b*c @@ -1107,7 +1107,7 @@ subroutine FK(al, be, mu, H, nlayer, & do ii = 1, nf2 om = 2.0 * PI * fvec(ii) ! propagation matrix - call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness=sum(h) + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness = sum(h) a = N_mat(3,2); b = N_mat(3,4); c = N_mat(4,2); d = N_mat(4,4) delta_mat = a*d - b*c diff --git a/src/specfem3D/create_color_image.f90 b/src/specfem3D/create_color_image.f90 index 47dc09b86..260d01579 100644 --- a/src/specfem3D/create_color_image.f90 +++ b/src/specfem3D/create_color_image.f90 @@ -194,11 +194,11 @@ subroutine write_PNM_initialize() iglob_coord(:) = 0; ispec_coord(:) = 0 countval = 0 - do ispec=1,NSPEC_AB + do ispec = 1,NSPEC_AB if (ispec_is_image_surface(ispec)) then - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) if (iglob_is_image_surface(iglob)) then countval = countval + 1 @@ -330,8 +330,8 @@ subroutine write_PNM_initialize() distance_z2 = 2.0*size_pixel_vertical endif - do j=1,NZ_IMAGE_color - do i=1,NX_IMAGE_color + do j = 1,NZ_IMAGE_color + do i = 1,NX_IMAGE_color ! calculates midpoint of pixel xtmp = xmin_color_image + (i-1)*size_pixel_horizontal ztmp = zmin_color_image + (j-1)*size_pixel_vertical @@ -346,7 +346,7 @@ subroutine write_PNM_initialize() ! looks for closest point to midpoint of pixel dist_min_pixel = HUGEVAL - do iglob=1,num_iglob_image_surface + do iglob = 1,num_iglob_image_surface ! point location with respect to image surface x_loc = xcoord(iglob) z_loc = zcoord(iglob) @@ -376,12 +376,12 @@ subroutine write_PNM_initialize() if (ier /= 0) call exit_mpi(myrank,'error allocating dist pixel recv') dist_pixel_recv(:,:) = HUGEVAL nb_pixel_loc = 0 - do j=1,NZ_IMAGE_color + do j = 1,NZ_IMAGE_color ! compares with other processes call gather_all_all_cr(dist_pixel_image(:,j),dist_pixel_recv,NX_IMAGE_color,NPROC) ! selects entries - do i=1,NX_IMAGE_color + do i = 1,NX_IMAGE_color ! note: minimum location will be between 1 and NPROC locval = minloc(dist_pixel_recv(i,:)) irank = locval(1) - 1 @@ -787,8 +787,8 @@ subroutine write_PNM_data(color_image_2D_data,iglob_image_color_2D, & ! compute background maximum amplitude bg_min = HUGEVAL bg_max = TINYVAL - do iy=1,NY - do ix=1,NX + do iy = 1,NY + do ix = 1,NX if (iglob_image_color_2D(ix,iy) > -1) then bg_min = min(bg_min,image_color_background_display(ix,iy)) bg_max = max(bg_max,image_color_background_display(ix,iy)) @@ -799,8 +799,8 @@ subroutine write_PNM_data(color_image_2D_data,iglob_image_color_2D, & ! color data maximum amplitude_min = HUGEVAL amplitude_max = -HUGEVAL - do iy=1,NY - do ix=1,NX + do iy = 1,NY + do ix = 1,NX if (iglob_image_color_2D(ix,iy) > -1) then amplitude_min = min(amplitude_min,color_image_2D_data(ix,iy)) amplitude_max = max(amplitude_max,color_image_2D_data(ix,iy)) @@ -819,8 +819,8 @@ subroutine write_PNM_data(color_image_2D_data,iglob_image_color_2D, & ! 'amplitude min/max = ',amplitude_min,amplitude_max ! in the PNM format, the image starts in the upper-left corner - do iy=NY,1,-1 - do ix=1,NX + do iy = NY,1,-1 + do ix = 1,NX ! check if pixel is defined or not (can be above topography for instance) if (iglob_image_color_2D(ix,iy) == -1) then ! use white (/ black /light blue) to display undefined region above topography @@ -958,9 +958,9 @@ subroutine get_iglob_vp(iglob,ispec,vp) integer :: i,j,k ! returns first vp encountered for iglob index - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (ibool(i,j,k,ispec) == iglob) then ! calculates vp if (ELASTIC_SIMULATION) then @@ -995,9 +995,9 @@ subroutine get_iglob_vs(iglob,ispec,vs) integer :: i,j,k ! returns first vs encountered for iglob index - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (ibool(i,j,k,ispec) == iglob) then ! calculates vs vs = sqrt( mustore(i,j,k,ispec) / rhostore(i,j,k,ispec) ) @@ -1026,9 +1026,9 @@ subroutine get_iglob_rho(iglob,ispec,rho) integer :: i,j,k ! returns first vs encountered for iglob index - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (ibool(i,j,k,ispec) == iglob) then ! returns rho rho = rhostore(i,j,k,ispec) @@ -1109,9 +1109,9 @@ subroutine get_iglob_veloc(iglob,ispec,val_vector) endif ! returns corresponding iglob velocity entry - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (ibool(i,j,k,ispec) == iglob) then val_vector(:) = val_element(:,i,j,k) return diff --git a/src/specfem3D/fault_solver_common.f90 b/src/specfem3D/fault_solver_common.f90 index aac349303..44f1a3284 100644 --- a/src/specfem3D/fault_solver_common.f90 +++ b/src/specfem3D/fault_solver_common.f90 @@ -37,7 +37,7 @@ module fault_solver_common implicit none type fault_type - integer :: nspec=0, nglob=0 + integer :: nspec = 0, nglob = 0 real(kind=CUSTOM_REAL), dimension(:,:), pointer :: T => null(),V => null(),D => null(),coord => null() real(kind=CUSTOM_REAL), dimension(:,:,:), pointer :: R => null() real(kind=CUSTOM_REAL), dimension(:), pointer :: B => null(),invM1 => null(),invM2 => null(),Z => null() @@ -55,7 +55,7 @@ module fault_solver_common v1 => null(), v2 => null(), & t1 => null(), t2 => null(), t3 => null(), tRUP => null(), tPZ => null() real(kind=CUSTOM_REAL), dimension(:), pointer :: xcoord => null(), ycoord => null(), zcoord => null() - integer :: npoin=0 + integer :: npoin = 0 end type dataXZ_type type swf_type @@ -72,7 +72,7 @@ module fault_solver_common type rsf_type - integer :: StateLaw = 1 ! 1=ageing law, 2=slip law + integer :: StateLaw = 1 ! 1 = ageing law, 2 = slip law real(kind=CUSTOM_REAL), dimension(:), pointer :: V0 => null(), f0 => null(), L => null(), & V_init => null(), & a => null(), b => null(), theta => null(), & @@ -82,7 +82,7 @@ module fault_solver_common ! outputs on selected fault nodes at every time step: type dataT_type - integer :: npoin=0, ndat=0, nt=0 + integer :: npoin = 0, ndat = 0, nt = 0 real(kind=CUSTOM_REAL) :: dt real(kind=CUSTOM_REAL) :: element_size integer, dimension(:), pointer :: iglob => null() ! on-fault global index of output nodes diff --git a/src/specfem3D/fault_solver_dynamic.f90 b/src/specfem3D/fault_solver_dynamic.f90 index ed33b7d42..5c12e85dd 100644 --- a/src/specfem3D/fault_solver_dynamic.f90 +++ b/src/specfem3D/fault_solver_dynamic.f90 @@ -833,10 +833,10 @@ subroutine init_2d_distribution(array,coord,iin,n) call read_para_file(xyzv,filename) num_lines = size(xyzv(1,:)) ! find the nearest point - do ipar=1,size(b) + do ipar = 1,size(b) temp = huge(temp) - do jpar=1,num_lines - dist=sqrt((coord(1,ipar)-xyzv(1,jpar))**2+(coord(2,ipar)-xyzv(2,jpar))**2+(coord(3,ipar)-xyzv(3,jpar))**2) + do jpar = 1,num_lines + dist = sqrt((coord(1,ipar)-xyzv(1,jpar))**2+(coord(2,ipar)-xyzv(2,jpar))**2+(coord(3,ipar)-xyzv(3,jpar))**2) if (dist < temp) then b(ipar) = xyzv(4,jpar) temp = dist @@ -870,7 +870,7 @@ subroutine read_para_file(xyzv,filename) read(IIN_2D,*) num_lines allocate(xyzv(4,num_lines)) - do i=1,num_lines + do i = 1,num_lines read(IIN_2D,*) xyzv(1,i),xyzv(2,i),xyzv(3,i),xyzv(4,i) enddo close(IIN_2D) @@ -2151,7 +2151,7 @@ subroutine rsf_init(f,T0,V,nucFload,coord,IIN_PAR) integer :: nFload ! real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: init_vel integer :: nglob,ier - integer :: InputStateLaw = 1 ! By default using aging law: 1=ageing law, 2=slip law + integer :: InputStateLaw = 1 ! By default using aging law: 1 = ageing law, 2 = slip law NAMELIST / RSF / V0,f0,a,b,L,V_init,theta_init,nV0,nf0,na,nb,nL,nV_init,ntheta_init, & C,T,nC,nForcedRup,Vw,fw,nVw,nfw,InputStateLaw diff --git a/src/specfem3D/fault_solver_kinematic.f90 b/src/specfem3D/fault_solver_kinematic.f90 index 8c2e4c86a..27ede3f35 100644 --- a/src/specfem3D/fault_solver_kinematic.f90 +++ b/src/specfem3D/fault_solver_kinematic.f90 @@ -214,7 +214,7 @@ subroutine BC_KINFLT_init(prname) return -100 if (myrank == 0)write(IMAIN,*) 'Fatal error: did not find BEGIN_FAULT input block in file DATA/Par_file_faults. Abort.' +100 if (myrank == 0) write(IMAIN,*) 'Fatal error: did not find BEGIN_FAULT input block in file DATA/Par_file_faults. Abort.' call exit_MPI(myrank,'Error: BEGIN_FAULT entry missing') end subroutine BC_KINFLT_init diff --git a/src/specfem3D/gravity_perturbation.f90 b/src/specfem3D/gravity_perturbation.f90 index 98b06162a..722582937 100644 --- a/src/specfem3D/gravity_perturbation.f90 +++ b/src/specfem3D/gravity_perturbation.f90 @@ -287,33 +287,33 @@ subroutine recompute_jacobian_gravity(xelm,yelm,zelm,xi,eta,gamma,jacobian) ! compute coordinates and jacobian matrix - x=ZERO - y=ZERO - z=ZERO - xxi=ZERO - xeta=ZERO - xgamma=ZERO - yxi=ZERO - yeta=ZERO - ygamma=ZERO - zxi=ZERO - zeta=ZERO - zgamma=ZERO - - do ia=1,NGNOD - x=x+shape3D(ia)*xelm(ia) - y=y+shape3D(ia)*yelm(ia) - z=z+shape3D(ia)*zelm(ia) - - xxi=xxi+dershape3D(1,ia)*xelm(ia) - xeta=xeta+dershape3D(2,ia)*xelm(ia) - xgamma=xgamma+dershape3D(3,ia)*xelm(ia) - yxi=yxi+dershape3D(1,ia)*yelm(ia) - yeta=yeta+dershape3D(2,ia)*yelm(ia) - ygamma=ygamma+dershape3D(3,ia)*yelm(ia) - zxi=zxi+dershape3D(1,ia)*zelm(ia) - zeta=zeta+dershape3D(2,ia)*zelm(ia) - zgamma=zgamma+dershape3D(3,ia)*zelm(ia) + x = ZERO + y = ZERO + z = ZERO + xxi = ZERO + xeta = ZERO + xgamma = ZERO + yxi = ZERO + yeta = ZERO + ygamma = ZERO + zxi = ZERO + zeta = ZERO + zgamma = ZERO + + do ia = 1,NGNOD + x = x+shape3D(ia)*xelm(ia) + y = y+shape3D(ia)*yelm(ia) + z = z+shape3D(ia)*zelm(ia) + + xxi = xxi+dershape3D(1,ia)*xelm(ia) + xeta = xeta+dershape3D(2,ia)*xelm(ia) + xgamma = xgamma+dershape3D(3,ia)*xelm(ia) + yxi = yxi+dershape3D(1,ia)*yelm(ia) + yeta = yeta+dershape3D(2,ia)*yelm(ia) + ygamma = ygamma+dershape3D(3,ia)*yelm(ia) + zxi = zxi+dershape3D(1,ia)*zelm(ia) + zeta = zeta+dershape3D(2,ia)*zelm(ia) + zgamma = zgamma+dershape3D(3,ia)*zelm(ia) enddo jacobian = xxi*(yeta*zgamma-ygamma*zeta) - xeta*(yxi*zgamma-ygamma*zxi) + xgamma*(yxi*zeta-yeta*zxi) @@ -347,7 +347,7 @@ subroutine gravity_timeseries() allocate(dotP(NGLOB_AB),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 2242') - do istat=1,nstat + do istat = 1,nstat Rg = sqrt((xstore-xstat(istat))**2+(ystore-ystat(istat))**2+(zstore-zstat(istat))**2) dotP = (xstore-xstat(istat))*displ(1,:)+(ystore-ystat(istat))*displ(2,:)+(zstore-zstat(istat))*displ(3,:) diff --git a/src/specfem3D/locate_MPI_slice.f90 b/src/specfem3D/locate_MPI_slice.f90 index 21cdf328b..5305e7f49 100644 --- a/src/specfem3D/locate_MPI_slice.f90 +++ b/src/specfem3D/locate_MPI_slice.f90 @@ -216,7 +216,7 @@ subroutine locate_MPI_slice_and_bcast_to_all_single(x_to_locate, y_to_locate, z_ distance_from_target = HUGEVAL - do iproc=0, NPROC-1 + do iproc = 0, NPROC-1 if (distance_from_target > distance_from_target_all(1,iproc)) then distance_from_target = distance_from_target_all(1,iproc) islice_selected_dummy(1) = iproc diff --git a/src/specfem3D/locate_source.F90 b/src/specfem3D/locate_source.F90 index de2fdfb6c..186858924 100644 --- a/src/specfem3D/locate_source.F90 +++ b/src/specfem3D/locate_source.F90 @@ -382,7 +382,7 @@ subroutine locate_source() ! output source information to a file so that we can load it and write to SU headers later if (myrank == 0) then open(unit=IOUT_SU,file=trim(OUTPUT_FILES)//'/output_list_sources.txt',status='unknown') - do isource=1,NSOURCES + do isource = 1,NSOURCES write(IOUT_SU,*) x_found(isource),y_found(isource),z_found(isource) enddo close(IOUT_SU) diff --git a/src/specfem3D/make_gravity.f90 b/src/specfem3D/make_gravity.f90 index 626ca1eb8..c64401559 100644 --- a/src/specfem3D/make_gravity.f90 +++ b/src/specfem3D/make_gravity.f90 @@ -80,55 +80,55 @@ subroutine make_gravity(nspl,rspl,gspl,gspl2, & r_ocean = ROCEAN_GRAVITY/R_EARTH_GRAVITY r_0 = 1.d0 - do i=1,163 + do i = 1,163 r(i) = r_icb*dble(i-1)/dble(162) enddo - do i=164,323 + do i = 164,323 r(i) = r_icb+(r_cmb-r_icb)*dble(i-164)/dble(159) enddo - do i=324,336 + do i = 324,336 r(i) = r_cmb+(r_topddoubleprime-r_cmb)*dble(i-324)/dble(12) enddo - do i=337,517 + do i = 337,517 r(i) = r_topddoubleprime+(r_771-r_topddoubleprime)*dble(i-337)/dble(180) enddo - do i=518,530 + do i = 518,530 r(i) = r_771+(r_670-r_771)*dble(i-518)/dble(12) enddo - do i=531,540 + do i = 531,540 r(i) = r_670+(r_600-r_670)*dble(i-531)/dble(9) enddo - do i=541,565 + do i = 541,565 r(i) = r_600+(r_400-r_600)*dble(i-541)/dble(24) enddo - do i=566,590 + do i = 566,590 r(i) = r_400+(r_220-r_400)*dble(i-566)/dble(24) enddo - do i=591,609 + do i = 591,609 r(i) = r_220+(r_80-r_220)*dble(i-591)/dble(18) enddo - do i=610,619 + do i = 610,619 r(i) = r_80+(r_moho-r_80)*dble(i-610)/dble(9) enddo - do i=620,626 + do i = 620,626 r(i) = r_moho+(r_middle_crust-r_moho)*dble(i-620)/dble(6) enddo - do i=627,633 + do i = 627,633 r(i) = r_middle_crust+(r_ocean-r_middle_crust)*dble(i-627)/dble(6) enddo - do i=634,NR + do i = 634,NR r(i) = r_ocean+(r_0-r_ocean)*dble(i-634)/dble(6) enddo ! use PREM to get the density profile for ellipticity (fine for other 1D reference models) - do i=1,NR + do i = 1,NR call prem_density(r(i),rho(i), & RICB,RCMB,RTOPDDOUBLEPRIME, & R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN_GRAVITY) enddo g(1)=0.0d0 - do i=2,NR + do i = 2,NR call intgrl(i_rho,r,1,i,rho,s1,s2,s3) g(i)=4.0d0*i_rho/(r(i)*r(i)) enddo @@ -136,18 +136,18 @@ subroutine make_gravity(nspl,rspl,gspl,gspl2, & ! ! get ready to spline g ! - nspl=1 + nspl = 1 rspl(1)=r(1) gspl(1)=g(1) - do i=2,NR + do i = 2,NR if (r(i) /= r(i-1)) then - nspl=nspl+1 + nspl = nspl+1 rspl(nspl)=r(i) gspl(nspl)=g(i) endif enddo yp1=(4.0d0/3.0d0)*rho(1) - ypn=4.0d0*rho(NR)-2.0d0*g(NR)/r(NR) + ypn = 4.0d0*rho(NR)-2.0d0*g(NR)/r(NR) call spline_construction(rspl,gspl,nspl,yp1,ypn,gspl2) end subroutine make_gravity @@ -194,135 +194,135 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu, & ! if (r >= 0.d0 .and. r <= RICB) then drhodr=-2.0d0*8.8381d0*x - rho=13.0885d0-8.8381d0*x*x - vp=11.2622d0-6.3640d0*x*x - vs=3.6678d0-4.4475d0*x*x - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vp = 11.2622d0-6.3640d0*x*x + vs = 3.6678d0-4.4475d0*x*x + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then drhodr=-1.2638d0-2.0d0*3.6426d0*x-3.0d0*5.5281d0*x*x - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x - vs=11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x + vs = 11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! else if (r > R670 .and. r <= R600) then drhodr=-1.4836d0 - rho=5.3197d0-1.4836d0*x - vp=19.0957d0-9.8672d0*x - vs=9.9839d0-4.9324d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 5.3197d0-1.4836d0*x + vp = 19.0957d0-9.8672d0*x + vs = 9.9839d0-4.9324d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R600 .and. r <= R400) then drhodr=-8.0298d0 - rho=11.2494d0-8.0298d0*x - vp=39.7027d0-32.6166d0*x - vs=22.3512d0-18.5856d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 11.2494d0-8.0298d0*x + vp = 39.7027d0-32.6166d0*x + vs = 22.3512d0-18.5856d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then drhodr=-3.8045d0 - rho=7.1089d0-3.8045d0*x - vp=20.3926d0-12.2569d0*x - vs=8.9496d0-4.4597d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 7.1089d0-3.8045d0*x + vp = 20.3926d0-12.2569d0*x + vs = 8.9496d0-4.4597d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R220 .and. r <= R80) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=80.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (CRUSTAL) then ! fill with PREM mantle and later add CRUST2.0 if (r > R80) then ! density/velocity from mantle just below moho - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x ! shear attenuation for R80 to surface - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else ! use PREM crust if (r > R80 .and. r <= RMOHO) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then - drhodr=0.0d0 - rho=2.9d0 - vp=6.8d0 - vs=3.9d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.9d0 + vp = 6.8d0 + vs = 3.9d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! same properties everywhere in PREM crust if we decide to define only one layer in the crust if (ONE_CRUST) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! for density profile for gravity, we do not check that r <= R_EARTH else if (r > ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif endif @@ -331,8 +331,8 @@ subroutine model_prem_iso(x,rho,drhodr,vp,vs,Qkappa,Qmu, & ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - drhodr=drhodr*1000.0d0/RHOAV - rho=rho*1000.0d0/RHOAV + drhodr = drhodr*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) @@ -361,40 +361,40 @@ subroutine prem_density(x,rho, & ! calculates density according to radius if (r <= RICB) then - rho=13.0885d0-8.8381d0*x*x + rho = 13.0885d0-8.8381d0*x*x else if (r > RICB .and. r <= RCMB) then - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > R771 .and. r <= R670) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > R670 .and. r <= R600) then - rho=5.3197d0-1.4836d0*x + rho = 5.3197d0-1.4836d0*x else if (r > R600 .and. r <= R400) then - rho=11.2494d0-8.0298d0*x + rho = 11.2494d0-8.0298d0*x else if (r > R400 .and. r <= R220) then - rho=7.1089d0-3.8045d0*x + rho = 7.1089d0-3.8045d0*x else if (r > R220 .and. r <= R80) then - rho=2.6910d0+0.6924d0*x + rho = 2.6910d0+0.6924d0*x else if (r > R80 .and. r <= RMOHO) then - rho=2.6910d0+0.6924d0*x + rho = 2.6910d0+0.6924d0*x else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then if (ONE_CRUST) then - rho=2.6d0 + rho = 2.6d0 else - rho=2.9d0 + rho = 2.9d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - rho=2.6d0 + rho = 2.6d0 else if (r > ROCEAN) then - rho=2.6d0 + rho = 2.6d0 endif endif - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV end subroutine prem_density @@ -433,7 +433,7 @@ subroutine intgrl(sumval,r,nir,ner,f,s1,s2,s3) call deriv(f,yprime,n,r,ndis,kdis,s1,s2,s3) nir1 = nir + 1 sumval = 0.0d0 - do i=nir1,ner + do i = nir1,ner j = i-1 rji = r(i) - r(j) s1l = s1(j) diff --git a/src/specfem3D/noise_tomography.f90 b/src/specfem3D/noise_tomography.f90 index 0c803d9a1..97a595560 100644 --- a/src/specfem3D/noise_tomography.f90 +++ b/src/specfem3D/noise_tomography.f90 @@ -507,13 +507,13 @@ subroutine check_parameters_noise(NOISE_TOMOGRAPHY,SIMULATION_TYPE,SAVE_FORWARD, if (SIMULATION_TYPE /= 1) & call exit_mpi(myrank,'NOISE_TOMOGRAPHY=2 requires SIMULATION_TYPE=1! check Par_file') if (.not. SAVE_FORWARD) & - call exit_mpi(myrank,'NOISE_TOMOGRAPHY=2 requires SAVE_FORWARD=.true.! check Par_file') + call exit_mpi(myrank,'NOISE_TOMOGRAPHY=2 requires SAVE_FORWARD = .true.! check Par_file') else if (NOISE_TOMOGRAPHY == 3) then if (SIMULATION_TYPE /= 3) & call exit_mpi(myrank,'NOISE_TOMOGRAPHY=3 requires SIMULATION_TYPE=3! check Par_file') if (SAVE_FORWARD) & - call exit_mpi(myrank,'NOISE_TOMOGRAPHY=3 requires SAVE_FORWARD=.false.! check Par_file') + call exit_mpi(myrank,'NOISE_TOMOGRAPHY=3 requires SAVE_FORWARD = .false.! check Par_file') endif if (NOISE_TOMOGRAPHY /= 0) then diff --git a/src/specfem3D/pml_compute_accel_contribution.f90 b/src/specfem3D/pml_compute_accel_contribution.f90 index ef2b5676c..98acfca18 100644 --- a/src/specfem3D/pml_compute_accel_contribution.f90 +++ b/src/specfem3D/pml_compute_accel_contribution.f90 @@ -64,9 +64,9 @@ subroutine pml_compute_accel_contribution_elastic(ispec,ispec_CPML,displ,veloc, ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! coefficients ! alpha_x coef0_x = pml_convolution_coef_alpha(1,i,j,k,ispec_CPML) @@ -189,9 +189,9 @@ subroutine pml_compute_accel_contribution_acoustic(ispec,ispec_CPML, & ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! PML coefficient values A_1 = pml_convolution_coef_abar(1,i,j,k,ispec_CPML) A_2 = pml_convolution_coef_abar(2,i,j,k,ispec_CPML) diff --git a/src/specfem3D/pml_compute_memory_variables.f90 b/src/specfem3D/pml_compute_memory_variables.f90 index 9b6669473..44ab8ef58 100644 --- a/src/specfem3D/pml_compute_memory_variables.f90 +++ b/src/specfem3D/pml_compute_memory_variables.f90 @@ -111,9 +111,9 @@ subroutine pml_compute_memory_variables_elastic(ispec,ispec_CPML, & ispec_irreg = irregular_element_number(ispec) if (ispec_irreg == 0) jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX !---------------------- A6, A7, A8, A9 -------------------------- ! coefficients ! alpha_z @@ -476,9 +476,9 @@ subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML, & real(kind=CUSTOM_REAL) :: coef0_1,coef1_1,coef2_1,coef0_2,coef1_2,coef2_2,coef0_3,coef1_3,coef2_3 integer :: i,j,k,ispec_irreg - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! PML convolution coefficients A6 = pml_convolution_coef_strain(1,i,j,k,ispec_CPML) A7 = pml_convolution_coef_strain(2,i,j,k,ispec_CPML) @@ -593,9 +593,9 @@ subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML, & ispec_irreg = irregular_element_number(ispec) if (ispec_irreg /= 0) then ! irregular element - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX xixl = xixstore(i,j,k,ispec_irreg) xiyl = xiystore(i,j,k,ispec_irreg) xizl = xizstore(i,j,k,ispec_irreg) @@ -621,9 +621,9 @@ subroutine pml_compute_memory_variables_acoustic(ispec,ispec_CPML, & else ! regular element jacobianl = jacobian_regular - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX rho_invl_jacob = jacobianl / rhostore(i,j,k,ispec) temp1(i,j,k) = rho_invl_jacob * xix_regular * dpotentialdxl(i,j,k) diff --git a/src/specfem3D/prepare_attenuation.f90 b/src/specfem3D/prepare_attenuation.f90 index c70c57eee..0f2056afd 100644 --- a/src/specfem3D/prepare_attenuation.f90 +++ b/src/specfem3D/prepare_attenuation.f90 @@ -143,9 +143,9 @@ subroutine prepare_attenuation() if (ispec_is_elastic(ispec) .eqv. .false.) cycle ! determines attenuation factors for each GLL point - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! scales only mu moduli scale_factorl = scale_factor(i,j,k,ispec) diff --git a/src/specfem3D/prepare_gravity.f90 b/src/specfem3D/prepare_gravity.f90 index b381f138d..8771e212d 100644 --- a/src/specfem3D/prepare_gravity.f90 +++ b/src/specfem3D/prepare_gravity.f90 @@ -59,9 +59,9 @@ subroutine prepare_gravity() call gravity_init() ! sets up weights needed for integration of gravity - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = sngl( wxgll(i)*wygll(j)*wzgll(k) ) enddo enddo diff --git a/src/specfem3D/setup_sources_receivers.f90 b/src/specfem3D/setup_sources_receivers.f90 index 44ccfa35a..37e6a8996 100644 --- a/src/specfem3D/setup_sources_receivers.f90 +++ b/src/specfem3D/setup_sources_receivers.f90 @@ -1855,7 +1855,7 @@ subroutine setup_sources_receivers_VTKfile() xmesh = 0.d0 ymesh = 0.d0 zmesh = 0.d0 - do ia=1,NGNOD + do ia = 1,NGNOD xmesh = xmesh + shape3D(ia)*xelm(ia) ymesh = ymesh + shape3D(ia)*yelm(ia) zmesh = zmesh + shape3D(ia)*zelm(ia) @@ -1879,7 +1879,7 @@ subroutine setup_sources_receivers_VTKfile() ! vtk file for receivers only write(system_command, & - "('awk ',a1,'{if (NR < 5) print $0;if (NR == 5)print ',a1,'POINTS',i6,' float',a1,';if & + "('awk ',a1,'{if (NR < 5) print $0;if (NR == 5) print ',a1,'POINTS',i6,' float',a1,';if & &(NR > 5+',i6,')print $0}',a1,'<',a,'>',a)")& "'",'"',nrec,'"',NSOURCES,"'",trim(filename),trim(filename_new) @@ -1887,7 +1887,7 @@ subroutine setup_sources_receivers_VTKfile() filename_new = trim(OUTPUT_FILES)//'/source.vtk' write(system_command1, & - "('awk ',a1,'{if (NR < 5) print $0;if (NR == 5)print ',a1,'POINTS',i6,' float',a1,';')") & + "('awk ',a1,'{if (NR < 5) print $0;if (NR == 5) print ',a1,'POINTS',i6,' float',a1,';')") & "'",'"',NSOURCES,'"' write(system_command2, & diff --git a/src/specfem3D/vtk_window.F90 b/src/specfem3D/vtk_window.F90 index 0a817cc02..d2ef2f7a4 100644 --- a/src/specfem3D/vtk_window.F90 +++ b/src/specfem3D/vtk_window.F90 @@ -290,7 +290,7 @@ subroutine vtk_window_prepare_receivers() xmesh = 0.0 ymesh = 0.0 zmesh = 0.0 - do ia=1,NGNOD + do ia = 1,NGNOD xmesh = xmesh + shape3D(ia)*xelm(ia) ymesh = ymesh + shape3D(ia)*yelm(ia) zmesh = zmesh + shape3D(ia)*zelm(ia) diff --git a/src/specfem3D/write_movie_output.F90 b/src/specfem3D/write_movie_output.F90 index 5cfa8e200..d51083334 100644 --- a/src/specfem3D/write_movie_output.F90 +++ b/src/specfem3D/write_movie_output.F90 @@ -255,9 +255,9 @@ subroutine wmo_get_vel_vector(ispec,iglob,ia,val_element) ! local parameters integer :: i,j,k - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (iglob == ibool(i,j,k,ispec)) then store_val_ux(ia) = val_element(1,i,j,k) store_val_uy(ia) = val_element(2,i,j,k) diff --git a/src/specfem3D/write_movie_output_HDF5.F90 b/src/specfem3D/write_movie_output_HDF5.F90 index 157983f92..7fcd4add3 100644 --- a/src/specfem3D/write_movie_output_HDF5.F90 +++ b/src/specfem3D/write_movie_output_HDF5.F90 @@ -179,7 +179,7 @@ subroutine wmo_save_shakemap_hdf5() implicit none ! local parameters - integer :: ier, nfaces_actual, nfaces_aug=(NGLLX-1)*(NGLLY-1),nnodes_per_face_aug=4 + integer :: ier, nfaces_actual, nfaces_aug=(NGLLX-1)*(NGLLY-1),nnodes_per_face_aug = 4 integer :: len_array_aug, len_array_aug_proc character(len=64) :: dset_name, group_name real(kind=CUSTOM_REAL) :: aug_factor @@ -1902,11 +1902,11 @@ subroutine movie_volume_io_init_hdf5(nelm_par_proc,nglob_par_proc,nglob_par_proc ! count the number of nodes and elements in this IO group nglob_this_io = 0 nelm_this_io = 0 - do iproc=0, nproc_io-1 + do iproc = 0, nproc_io-1 nglob_this_io = nglob_this_io + nglob_par_proc(id_proc_loc2glob(iproc)) nelm_this_io = nelm_this_io + nelm_par_proc (id_proc_loc2glob(iproc)) if (iproc > 0) then - do iproc2=0, iproc-1 + do iproc2 = 0, iproc-1 nglob_par_proc_offset(iproc) = nglob_par_proc_offset(iproc)+nglob_par_proc(id_proc_loc2glob(iproc2)) nelm_par_proc_offset(iproc) = nelm_par_proc_offset(iproc) +nelm_par_proc (id_proc_loc2glob(iproc2)) enddo diff --git a/src/tomography/compute_kernel_integral.f90 b/src/tomography/compute_kernel_integral.f90 index 348412765..a1a695564 100644 --- a/src/tomography/compute_kernel_integral.f90 +++ b/src/tomography/compute_kernel_integral.f90 @@ -120,9 +120,9 @@ subroutine compute_kernel_integral_iso() call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo @@ -368,9 +368,9 @@ subroutine compute_kernel_integral_tiso() call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo @@ -642,9 +642,9 @@ subroutine compute_kernel_integral_tiso_iso() call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/src/tomography/model_update.f90 b/src/tomography/model_update.f90 index ea661da9f..991bf3a76 100644 --- a/src/tomography/model_update.f90 +++ b/src/tomography/model_update.f90 @@ -257,10 +257,10 @@ program model_update ! threshold current model and write out the modified version if (MINMAX_THRESHOLD_OLD) then - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! vs if (model_vs(i,j,k,ispec) < VS_MIN) model_vs(i,j,k,ispec) = VS_MIN if (model_vs(i,j,k,ispec) > VS_MAX) model_vs(i,j,k,ispec) = VS_MAX @@ -407,10 +407,10 @@ program model_update ! threshold model according to minmax values specified above if (MINMAX_THRESHOLD_NEW) then - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! vs if (model_vs_new(i,j,k,ispec) < VS_MIN) model_vs_new(i,j,k,ispec) = VS_MIN if (model_vs_new(i,j,k,ispec) > VS_MAX) model_vs_new(i,j,k,ispec) = VS_MAX @@ -1004,7 +1004,7 @@ subroutine save_new_databases() if (ier /= 0) stop 'Error allocating array dummy etc.' read(IIN,'(9i12)') dummy_num,dummy_l_1,dummy_l_2,dummy_l_3,dummy_l_4, & - dummy_l_5,dummy_l_6,dummy_l_7,dummy_l_8 !8,ibool-1 for ispec=1,nspec + dummy_l_5,dummy_l_6,dummy_l_7,dummy_l_8 !8,ibool-1 for ispec = 1,nspec read(IIN,*) !blank line deallocate(dummy_num,dummy_l_1,dummy_l_2,dummy_l_3,dummy_l_4,dummy_l_5,dummy_l_6,dummy_l_7,dummy_l_8) @@ -1037,10 +1037,10 @@ subroutine save_new_databases() if (ier /= 0) stop 'Error allocating mask' mask_ibool = .false. - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) if (.not. mask_ibool(iglob)) then qmu_attenuation_store(i,j,k,ispec) = flag_val(iglob) diff --git a/src/tomography/postprocess_sensitivity_kernels/clip_sem.f90 b/src/tomography/postprocess_sensitivity_kernels/clip_sem.f90 index 118f688a0..c257e5253 100644 --- a/src/tomography/postprocess_sensitivity_kernels/clip_sem.f90 +++ b/src/tomography/postprocess_sensitivity_kernels/clip_sem.f90 @@ -156,7 +156,7 @@ program clip_sem if (ier /= 0) call exit_MPI_without_rank('error allocating array 977') ! clip kernels - do iker=1,nker + do iker = 1,nker kernel_name = trim(kernel_names(iker)) write(filename,'(a,i6.6,a)') trim(input_dir)//'/proc',myrank,'_'//trim(kernel_name)//'.bin' @@ -176,10 +176,10 @@ program clip_sem endif ! apply thresholds - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (sem_array(i,j,k,ispec) < min_val) sem_array(i,j,k,ispec) = min_val if (sem_array(i,j,k,ispec) > max_val) sem_array(i,j,k,ispec) = max_val enddo diff --git a/src/tomography/postprocess_sensitivity_kernels/combine_sem.f90 b/src/tomography/postprocess_sensitivity_kernels/combine_sem.f90 index 875c795a1..5176852be 100644 --- a/src/tomography/postprocess_sensitivity_kernels/combine_sem.f90 +++ b/src/tomography/postprocess_sensitivity_kernels/combine_sem.f90 @@ -110,7 +110,7 @@ program combine_sem call parse_kernel_names(kernel_names_comma_delimited,kernel_names,nker) ! parse paths from INPUT_FILE - npath=0 + npath = 0 open(unit = IIN, file = trim(input_file), status = 'old',iostat = ier) if (ier /= 0) then print *,'Error opening ',trim(input_file), myrank @@ -169,7 +169,7 @@ program combine_sem print * endif - do iker=1,nker + do iker = 1,nker call combine_sem_array(kernel_names(iker),kernel_paths,output_dir,npath) enddo diff --git a/src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90 b/src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90 index 6d405dc20..7d482547f 100644 --- a/src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90 +++ b/src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90 @@ -203,12 +203,12 @@ program smooth_sem #ifdef FORCE_VECTORIZATION integer :: ijk2 # define INDEX_IJK2 ijk2,1,1 -# define DO_LOOP_IJK2 do ijk2=1,NGLLCUBE +# define DO_LOOP_IJK2 do ijk2 = 1,NGLLCUBE # define ENDDO_LOOP_IJK2 enddo ! NGLLCUBE #else integer :: ii,jj,kk # define INDEX_IJK2 ii,jj,kk -# define DO_LOOP_IJK2 do kk=1,NGLLZ; do jj=1,NGLLY; do ii=1,NGLLX +# define DO_LOOP_IJK2 do kk = 1,NGLLZ; do jj = 1,NGLLY; do ii = 1,NGLLX # define ENDDO_LOOP_IJK2 enddo; enddo; enddo ! NGLLZ,NGLLY,NGLLX #endif @@ -720,9 +720,9 @@ program smooth_sem call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/src/tomography/save_external_bin_m_up.f90 b/src/tomography/save_external_bin_m_up.f90 index 1c0b5cd8a..790766b13 100644 --- a/src/tomography/save_external_bin_m_up.f90 +++ b/src/tomography/save_external_bin_m_up.f90 @@ -432,8 +432,8 @@ subroutine save_external_bin_m_up(nspec,nglob, & if (ier /= 0) call exit_MPI_without_rank('error allocating array 1044') inum = 0 iglob_tmp(:) = 0 - do i=1,num_coupling_ac_el_faces - do j=1,NGLLSQUARE + do i = 1,num_coupling_ac_el_faces + do j = 1,NGLLSQUARE inum = inum+1 iglob_tmp(inum) = ibool(coupling_ac_el_ijk(1,j,i), & coupling_ac_el_ijk(2,j,i), & @@ -450,7 +450,7 @@ subroutine save_external_bin_m_up(nspec,nglob, & ! saves acoustic/elastic flag allocate(v_tmp_i(nspec),stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array 1045') - do i=1,nspec + do i = 1,nspec if (ispec_is_acoustic(i)) then v_tmp_i(i) = 1 else if (ispec_is_elastic(i)) then diff --git a/src/tomography/sum_kernels.f90 b/src/tomography/sum_kernels.f90 index 000049c0a..1dd7159b0 100644 --- a/src/tomography/sum_kernels.f90 +++ b/src/tomography/sum_kernels.f90 @@ -85,7 +85,7 @@ program sum_kernels kernel_list(:) = '' ! reads in event list - nker=0 + nker = 0 open(unit = IIN, file = trim(KERNEL_FILE_LIST), status = 'old',iostat = ier) if (ier /= 0) then print *,'Error opening ',trim(KERNEL_FILE_LIST),myrank diff --git a/src/tomography/sum_preconditioned_kernels.f90 b/src/tomography/sum_preconditioned_kernels.f90 index dfc120721..be8cd3f54 100644 --- a/src/tomography/sum_preconditioned_kernels.f90 +++ b/src/tomography/sum_preconditioned_kernels.f90 @@ -84,7 +84,7 @@ program sum_preconditioned_kernels kernel_list(:) = '' ! reads in event list - nker=0 + nker = 0 open(unit = IIN, file = trim(KERNEL_FILE_LIST), status = 'old',iostat = ier) if (ier /= 0) then print *,'Error opening ',trim(KERNEL_FILE_LIST),myrank From cf2569a28615f4e0b3e738b586a8c58e6521a8f0 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 21 Mar 2024 17:28:53 +0100 Subject: [PATCH 04/56] cleans files --- .../applications/inversion_examples/README.md | 4 +- .../adj_traveltime_filter.f90 | 2 +- .../adj_seismogram.f90 | 6 +- .../random_model_generation.f90 | 10 +- ...e_and_Komatitsch_correct_with_1_over_L.f90 | 192 ++--- ...e_and_Komatitsch_correct_with_1_over_L.f90 | 192 ++--- .../seismoacoustic_bishop2022/README.md | 12 +- .../FORWARD_ADJOINT/COPY_LOCAL/copy_local.f90 | 2 +- .../X01_SRC_SUM_KERNELS/sum_kernels.f90 | 14 +- .../precond_kernels.f90 | 20 +- .../X03_SRC_SMOOTH_KERNELS/gll_library.f90 | 32 +- .../smooth_sem_globe.f90 | 8 +- .../compute_direction_cg.f90 | 14 +- .../compute_direction_lbfgs.f90 | 60 +- .../compute_direction_sd.f90 | 6 +- .../X05_SRC_UPDATE_MODELS/add_model_globe.f90 | 6 +- .../X05_SRC_UPDATE_MODELS/gll_library.f90 | 32 +- .../SRC_MODEL_SLICE_HORIZ/sem_model_slice.f90 | 26 +- .../SRC_MODEL_SLICE_VERT/sem_model_slice.f90 | 28 +- .../correct_syn_time_moment.f90 | 12 +- .../gridsearch_time_moment.f90 | 92 +-- .../codes_18_06Aug2006/gll_library.f90 | 32 +- .../codes_18_06Aug2006/lagrange_poly.f90 | 10 +- .../codes_18_06Aug2006/numerical_recipes.f90 | 88 +-- .../gji_paper/codes_18_06Aug2006/wave2d.f90 | 62 +- .../codes_18_06Aug2006/wave2d_cmap.f90 | 6 +- .../codes_18_06Aug2006/wave2d_constants.f90 | 4 +- .../wave2d_define_der_matrices.f90 | 12 +- .../codes_18_06Aug2006/wave2d_sub.f90 | 4 +- .../codes_18_06Aug2006/wave2d_sub2.f90 | 26 +- .../codes_18_06Aug2006/wave2d_sub3.f90 | 202 ++--- .../SEM2D_iterate/src/gll_library.f90 | 32 +- .../SEM2D_iterate/src/lagrange_poly.f90 | 10 +- .../SEM2D_iterate/src/numerical_recipes.f90 | 88 +-- .../SEM2D_iterate/src/test_smooth.f90 | 4 +- .../iterate_adj/SEM2D_iterate/src/wave2d.f90 | 8 +- .../SEM2D_iterate/src/wave2d_cmap.f90 | 6 +- .../src/wave2d_define_der_matrices.f90 | 12 +- .../SEM2D_iterate/src/wave2d_sub.f90 | 2 +- .../SEM2D_iterate/src/wave2d_sub2.f90 | 26 +- .../cluster/cg_step/src/cg_test.f90 | 10 +- .../cluster/cg_step/src/gll_library.f90 | 32 +- .../cluster/model_pert/src/gll_library.f90 | 32 +- .../cluster/model_pert/src/model_pert.f90 | 6 +- .../cluster/model_slice/locate_receivers.f90 | 18 +- .../read_basin_topo_bathy_file.f90 | 4 +- .../cluster/model_slice/sem_model_slice.f90 | 18 +- .../cluster/model_slice/utm_geo.f90 | 12 +- .../cluster/model_vp_vs/src/add_model.f90 | 22 +- .../cluster/model_vp_vs/src/gll_library.f90 | 32 +- .../cluster/smooth/src/gll_library.f90 | 32 +- .../cluster/smooth/src/smooth_sem_fun.f90 | 12 +- .../subspace_hessian/src/gll_library.f90 | 32 +- .../subspace_hessian/src/subspace_hessian.f90 | 14 +- .../subspace_update/src/gll_library.f90 | 32 +- .../subspace_update/src/subspace_update.f90 | 18 +- .../cluster/sum_kernel/src/sum_kernels.f90 | 8 +- .../sum_kernel/src/sum_kernels_weight.f90 | 10 +- .../combine_vol_data/combine_vol_data_mod.f90 | 6 +- .../measure_adj/ascii_rw.f90 | 6 +- .../measure_adj/ma_sub.f90 | 36 +- .../measure_adj/ma_sub2.f90 | 152 ++-- .../measure_adj/measure_adj.f90 | 2 +- .../ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj.f90 | 18 +- .../mtadj/mtadj_constants.f90 | 2 +- .../mtadj/mtadj_sub.f90 | 32 +- .../mtadj/mtadj_sub2.f90 | 8 +- .../mtadj/mtadj_sub3.f90 | 158 ++-- .../add_CPML_layers_to_an_existing_mesh.f90 | 42 +- .../convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 | 10 +- ..._layers_of_a_given_mesh_to_CPML_layers.f90 | 2 +- .../Paraview/create_slice_VTK.f90 | 4 +- .../visualize_gold/src/read_input.f90 | 34 +- .../visualize_gold/src/string_process.f90 | 50 +- .../Paraview/visualize_gold/src/visualize.f90 | 26 +- .../visualize_gold/src/visualize_collect.f90 | 56 +- .../visualize_gold/src/write_ensight.f90 | 76 +- .../Paraview/visualize_gold/src/write_vtu.f90 | 112 +-- .../opendx_AVS/check_GMT_movie_openDX.f90 | 16 +- .../convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 | 12 +- .../opendx_AVS/convert_avs2dx_quads.f90 | 6 +- .../opendx_AVS/convert_coastline_dx.f90 | 12 +- .../create_OpenDX_files_to_view_a_3D_mesh.f90 | 4 +- .../opendx_AVS/permute_cubit_2_opendx.f90 | 2 +- .../opendx_AVS/resample_CA_coastline_AVS.f90 | 14 +- .../opendx_AVS/resample_CA_highways_AVS.f90 | 14 +- .../opendx_AVS/resample_CA_highways_DX.f90 | 12 +- .../HEX27/visualize_HEX27_chunk_w_medit.f90 | 16 +- .../HEX8/visualize_HEX8_chunk_w_medit.f90 | 16 +- utils/adjoint_sources/SU_adjoint.f90 | 4 +- .../create_movie_GMT/compute_parameters.f90 | 18 +- .../create_movie_GMT/create_movie_GMT.f90 | 72 +- .../create_movie_GMT/utm_geo.f90 | 10 +- .../decimate_mesh/decimate_mesh.f90 | 16 +- .../unused_routines/define_subregions.f90 | 746 +++++++++--------- .../define_subregions_heuristic.f90 | 176 ++--- utils/infos/unused_routines/mesh_vertical.f90 | 22 +- .../opendx_AVS/combine_AVS_DX.f90 | 26 +- .../create_highres_shakemaps_AVS_DX.f90 | 78 +- .../opendx_AVS/extract_shakemap_GMT.f90 | 78 +- utils/infos/unused_routines/read_moho_map.f90 | 4 +- utils/infos/unused_routines/socal_model.f90 | 24 +- .../cmt_frechet/make_cmtsolution_files.f90 | 38 +- utils/scripts/lib/utm_geo.f90 | 10 +- utils/scripts/seis_process/ascii_2_sep.f90 | 4 +- .../add_topography_410_650.f90 | 10 +- .../anisotropic_inner_core_model.f90 | 40 +- .../anisotropic_mantle_model.f90 | 6 +- .../mesher_for_serial/calc_jacobian.f90 | 8 +- .../mesher_for_serial/combine_AVS_DX.f90 | 12 +- .../compute_coordinates_grid.f90 | 4 +- .../compute_element_properties.f90 | 10 +- .../mesher_for_serial/create_header_file.f90 | 2 +- .../mesher_for_serial/create_regions_mesh.F90 | 40 +- .../mesher_for_serial/crustal_model.f90 | 34 +- .../define_derivation_matrices.f90 | 60 +- .../mesher_for_serial/get_MPI_1D_buffers.f90 | 32 +- .../get_MPI_cutplanes_eta.f90 | 24 +- .../get_MPI_cutplanes_xi.f90 | 24 +- .../mesher_for_serial/get_absorb.f90 | 22 +- .../mesher_for_serial/get_cmt.f90 | 8 +- .../mesher_for_serial/get_ellipticity.f90 | 2 +- .../get_jacobian_boundaries.f90 | 52 +- .../mesher_for_serial/get_model.f90 | 104 +-- .../mesher_for_serial/get_perm_color.f90 | 26 +- .../mesher_for_serial/get_shape2D.f90 | 28 +- .../mesher_for_serial/get_shape3D.f90 | 40 +- .../mesher_for_serial/gll_library.f90 | 32 +- .../mesher_for_serial/intgrl.f90 | 76 +- .../mesher_for_serial/jp3d1994_model.f90 | 24 +- .../mesher_for_serial/lagrange_poly.f90 | 10 +- .../mesher_for_serial/lgndr.f90 | 80 +- .../mesher_for_serial/make_ellipticity.f90 | 42 +- .../mesher_for_serial/make_gravity.f90 | 38 +- .../mesher_for_serial/mantle_model.f90 | 150 ++-- .../mesher_for_serial/meshfem3D.F90 | 18 +- .../mesher_for_serial/model_1066a.f90 | 4 +- .../mesher_for_serial/model_ak135.f90 | 4 +- .../mesher_for_serial/model_iasp91.f90 | 102 +-- .../mesher_for_serial/model_jp1d.f90 | 88 +-- .../mesher_for_serial/model_prem.f90 | 428 +++++----- .../mesher_for_serial/model_ref.f90 | 2 +- .../mesher_for_serial/model_sea1d.f90 | 4 +- .../read_compute_parameters.F90 | 60 +- .../mesher_for_serial/recompute_jacobian.f90 | 72 +- .../mesher_for_serial/reduce.f90 | 24 +- .../mesher_for_serial/s362ani.f90 | 676 ++++++++-------- .../mesher_for_serial/save_header_file.f90 | 12 +- .../mesher_for_serial/sea99_s_model.f90 | 4 +- .../sort_array_coordinates.f90 | 16 +- .../mesher_for_serial/stretching_function.f90 | 8 +- .../mesher_for_serial/topo_bathy.f90 | 4 +- .../write_AVS_DX_global_chunks_data.f90 | 18 +- .../write_AVS_DX_global_data.f90 | 6 +- .../write_AVS_DX_global_faces_data.f90 | 6 +- .../write_AVS_DX_surface_data.f90 | 6 +- ...v03_is_the_fastest_with_function_calls.f90 | 40 +- .../serial_specfem3D_22dec2008_NGLOB.f90 | 38 +- .../serial_specfem3D_22dec2008_NSPEC.f90 | 44 +- ...serial_specfem3D_26dec2008_inlined_v01.f90 | 42 +- ...serial_specfem3D_26dec2008_inlined_v02.f90 | 48 +- ...cfem3D_26dec2008_inlined_v04_is_slower.f90 | 46 +- ...dec2008_inlined_v05_displx_y_z_3arrays.f90 | 40 +- ...008_inlined_v06_fac1_merged_not_faster.f90 | 40 +- .../read_arrays_solver.f90 | 72 +- ...test_version_with_Deville_and_inlining.f90 | 58 +- ...how_to_consistently_average_a_gradient.f90 | 30 +- .../specfem3D_normal_no_Deville.f90 | 26 +- .../README.md | 30 +- ...combine_signal_files_into_a_single_one.f90 | 2 +- utils/small_utilities/locate_partition.f90 | 8 +- ...reate_OpenDX_files_to_view_the_3D_mesh.f90 | 4 +- ...sh_a_Y_shaped_crack_oriented_downwards.f90 | 8 +- ...mesh_a_Y_shaped_crack_oriented_upwards.f90 | 20 +- 174 files changed, 3614 insertions(+), 3614 deletions(-) diff --git a/EXAMPLES/applications/inversion_examples/README.md b/EXAMPLES/applications/inversion_examples/README.md index 4b75f2908..fbd80d2b0 100644 --- a/EXAMPLES/applications/inversion_examples/README.md +++ b/EXAMPLES/applications/inversion_examples/README.md @@ -37,8 +37,8 @@ More specific tools: * moment-tensor inversions: - [pycmt3d](https://github.com/wjlei1990/pycmt3d) provided in src/inverse_problem_for_source/ - - CMT3D: original version from [GRD_CMT3D](https://github.com/UTCompSeismo/GRD_CMT3D) - + - CMT3D: original version from [GRD_CMT3D](https://github.com/UTCompSeismo/GRD_CMT3D) + Please consider contributing your own examples. diff --git a/EXAMPLES/applications/noise_tomography/adj_traveltime_filter.f90 b/EXAMPLES/applications/noise_tomography/adj_traveltime_filter.f90 index f03ba55a1..5b1e7c15a 100644 --- a/EXAMPLES/applications/noise_tomography/adj_traveltime_filter.f90 +++ b/EXAMPLES/applications/noise_tomography/adj_traveltime_filter.f90 @@ -316,7 +316,7 @@ program adj_traveltime enddo close(1001) - enddo !do ifreq=1,nfreq + enddo !do ifreq = 1,nfreq ! closes misfit file close(1111) diff --git a/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/adj_seismogram.f90 b/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/adj_seismogram.f90 index 2fafbd765..e69003706 100644 --- a/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/adj_seismogram.f90 +++ b/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/adj_seismogram.f90 @@ -225,17 +225,17 @@ program adj_seismogram !daniel: outputs ascii trace if ( myrank == 0 .and. irec == 196 ) then open(221,file="SEM/syn/"//trim(filename_in)//".ascii",status='unknown') - do i=1,NSTEP + do i = 1,NSTEP write(221,*) i,syn(i) enddo close(221) open(222,file="SEM/dat/"//trim(filename_in)//".ascii",status='unknown') - do i=1,NSTEP + do i = 1,NSTEP write(222,*) i,dat(i) enddo close(222) open(223,file="SEM/"//trim(filename_out)//".adj.ascii",status='unknown') - do i=1,NSTEP + do i = 1,NSTEP write(223,*) i,adj(i) enddo close(223) diff --git a/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/random_model_generation.f90 b/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/random_model_generation.f90 index 3722d7b49..2fc5cdc24 100644 --- a/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/random_model_generation.f90 +++ b/EXAMPLES/benchmarks/BENCHMARK_CLAERBOUT_ADJOINT/random_model_generation.f90 @@ -46,7 +46,7 @@ program random_model !! input parameters if (iargc() /= 2) & - stop 'Usage: ./xrandom_model percent NPROC [percent must be small enough (~1d-5) for F*dm=S(m+dm)-S(m) to be valid]' + stop 'Usage: ./xrandom_model percent NPROC [percent must be small enough (~1d-5) for F*dm = S(m+dm)-S(m) to be valid]' call get_command_argument(1, arg); read(arg,*,iostat=ier) percent; if (ier /= 0) stop 'Error reading percent' call get_command_argument(2, arg); read(arg,*,iostat=ier) NPROC; if (ier /= 0) stop 'Error reading NPROC' @@ -220,9 +220,9 @@ program random_model ! sets Gaussian perturbation into the middle of model: ! dimension (Width x Length x Depth) : 2640.0 m x 2640.0 m x 1.44 km do ispec = 1,nspec - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! GLL point location (given in m: dimension 2640 m x 2640 x x 1440 m) iglob = ibool(i,j,k,ispec) x = xstore(iglob) @@ -236,7 +236,7 @@ program random_model ! Gaussian function: values between [0,1] pert_param(i,j,k,ispec) = exp( - (dist_h*dist_h) / sigma_h2 - (dist_v*dist_v) / sigma_v2 ) - !if (myrank == 0 )print *,pert_param(i,j,k,ispec),x,y,z,dist_v,dist_h + !if (myrank == 0 ) print *,pert_param(i,j,k,ispec),x,y,z,dist_v,dist_h enddo enddo enddo diff --git a/EXAMPLES/benchmarks/attenuation/viscoelastic/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 b/EXAMPLES/benchmarks/attenuation/viscoelastic/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 index c92de70ef..3bd766ba9 100644 --- a/EXAMPLES/benchmarks/attenuation/viscoelastic/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 +++ b/EXAMPLES/benchmarks/attenuation/viscoelastic/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 @@ -183,7 +183,7 @@ program analytical_solution deltat = 1.d0 / (freqmax*dble(iratio)) ! define the spectrum of the source - do ifreq=0,nfreq + do ifreq = 0,nfreq freq = deltafreq * dble(ifreq) omega = 2.d0 * pi * freq @@ -218,7 +218,7 @@ program analytical_solution ! ************** calcul solution analytique **************** ! d'apres Carcione GJI vol 95 p 611 (1988) - do ifreq=0,nfreq + do ifreq = 0,nfreq freq = deltafreq * dble(ifreq) omega = 2.d0 * pi * freq @@ -228,7 +228,7 @@ program analytical_solution ! use standard infinite frequency (unrelaxed) reference, ! in which waves slow down when attenuation is turned on. temp = dcmplx(0.d0,0.d0) - do i=1,Lnu + do i = 1,Lnu temp = temp + (1./Lnu)*dcmplx(1.d0,omega*tau_epsilon_kappa(i)) / dcmplx(1.d0,omega*tau_sigma_kappa(i)) enddo @@ -236,7 +236,7 @@ program analytical_solution Kappa_omega = Kappa_relaxed * temp temp = dcmplx(0.d0,0.d0) - do i=1,Lnu + do i = 1,Lnu temp = temp + (1./Lnu)*dcmplx(1.d0,omega*tau_epsilon_mu(i)) / dcmplx(1.d0,omega*tau_sigma_mu(i)) enddo @@ -291,7 +291,7 @@ program analytical_solution ! use the Fourier values for Ux c(1) = cmplx(phi1(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi1(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi1(ifreq))) enddo @@ -340,7 +340,7 @@ program analytical_solution open(unit=11,file='Ux_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -360,7 +360,7 @@ program analytical_solution ! use the Fourier values for Uy c(1) = cmplx(phi2(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi2(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi2(ifreq))) enddo @@ -408,7 +408,7 @@ program analytical_solution open(unit=11,file='Uy_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -428,7 +428,7 @@ program analytical_solution ! use the Fourier values for Uz c(1) = cmplx(phi3(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi3(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi3(ifreq))) enddo @@ -476,7 +476,7 @@ program analytical_solution open(unit=11,file='Uz_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -572,7 +572,7 @@ subroutine CFFTB1 (N,C,CH,WA,IFAC) NA = 0 L1 = 1 IW = 1 - DO 116 K1=1,NF + DO 116 K1 = 1,NF IP = IFAC(K1+2) L2 = IP*L1 IDO = N/L2 @@ -622,7 +622,7 @@ subroutine CFFTB1 (N,C,CH,WA,IFAC) 116 continue if (NA == 0) return N2 = N+N - DO 117 I=1,N2 + DO 117 I = 1,N2 C(I) = CH(I) 117 continue return @@ -638,66 +638,66 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) IDP = IP*IDO ! if (IDO < L1) goto 106 - DO 103 J=2,IPPH + DO 103 J = 2,IPPH JC = IPP2-J - DO 102 K=1,L1 - DO 101 I=1,IDO + DO 102 K = 1,L1 + DO 101 I = 1,IDO CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 101 continue 102 continue 103 continue - DO 105 K=1,L1 - DO 104 I=1,IDO + DO 105 K = 1,L1 + DO 104 I = 1,IDO CH(I,K,1) = CC(I,1,K) 104 continue 105 continue goto 112 - 106 DO 109 J=2,IPPH + 106 DO 109 J = 2,IPPH JC = IPP2-J - DO 108 I=1,IDO - DO 107 K=1,L1 + DO 108 I = 1,IDO + DO 107 K = 1,L1 CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 107 continue 108 continue 109 continue - DO 111 I=1,IDO - DO 110 K=1,L1 + DO 111 I = 1,IDO + DO 110 K = 1,L1 CH(I,K,1) = CC(I,1,K) 110 continue 111 continue 112 IDL = 2-IDO INC = 0 - DO 116 L=2,IPPH + DO 116 L = 2,IPPH LC = IPP2-L IDL = IDL+IDO - DO 113 IK=1,IDL1 + DO 113 IK = 1,IDL1 C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2) C2(IK,LC) = WA(IDL)*CH2(IK,IP) 113 continue IDLJ = IDL INC = INC+IDO - DO 115 J=3,IPPH + DO 115 J = 3,IPPH JC = IPP2-J IDLJ = IDLJ+INC if (IDLJ > IDP) IDLJ = IDLJ-IDP WAR = WA(IDLJ-1) WAI = WA(IDLJ) - DO 114 IK=1,IDL1 + DO 114 IK = 1,IDL1 C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J) C2(IK,LC) = C2(IK,LC)+WAI*CH2(IK,JC) 114 continue 115 continue 116 continue - DO 118 J=2,IPPH - DO 117 IK=1,IDL1 + DO 118 J = 2,IPPH + DO 117 IK = 1,IDL1 CH2(IK,1) = CH2(IK,1)+CH2(IK,J) 117 continue 118 continue - DO 120 J=2,IPPH + DO 120 J = 2,IPPH JC = IPP2-J - DO 119 IK=2,IDL1,2 + DO 119 IK = 2,IDL1,2 CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC) CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC) CH2(IK,J) = C2(IK,J)+C2(IK-1,JC) @@ -707,22 +707,22 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) NAC = 1 if (IDO == 2) return NAC = 0 - DO 121 IK=1,IDL1 + DO 121 IK = 1,IDL1 C2(IK,1) = CH2(IK,1) 121 continue - DO 123 J=2,IP - DO 122 K=1,L1 + DO 123 J = 2,IP + DO 122 K = 1,L1 C1(1,K,J) = CH(1,K,J) C1(2,K,J) = CH(2,K,J) 122 continue 123 continue if (IDOT > L1) goto 127 IDIJ = 0 - DO 126 J=2,IP + DO 126 J = 2,IP IDIJ = IDIJ+2 - DO 125 I=4,IDO,2 + DO 125 I = 4,IDO,2 IDIJ = IDIJ+2 - DO 124 K=1,L1 + DO 124 K = 1,L1 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J) 124 continue @@ -730,11 +730,11 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) 126 continue return 127 IDJ = 2-IDO - DO 130 J=2,IP + DO 130 J = 2,IP IDJ = IDJ+IDO - DO 129 K=1,L1 + DO 129 K = 1,L1 IDIJ = IDJ - DO 128 I=4,IDO,2 + DO 128 I = 4,IDO,2 IDIJ = IDIJ+2 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J) @@ -747,15 +747,15 @@ subroutine PASSB2 (IDO,L1,CC,CH,WA1) DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), & WA1(1) if (IDO > 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 CH(1,K,1) = CC(1,1,K)+CC(1,2,K) CH(1,K,2) = CC(1,1,K)-CC(1,2,K) CH(2,K,1) = CC(2,1,K)+CC(2,2,K) CH(2,K,2) = CC(2,1,K)-CC(2,2,K) 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K) TR2 = CC(I-1,1,K)-CC(I-1,2,K) CH(I,K,1) = CC(I,1,K)+CC(I,2,K) @@ -771,7 +771,7 @@ subroutine PASSB3 (IDO,L1,CC,CH,WA1,WA2) WA1(1) ,WA2(1) DATA TAUR,TAUI /-.5,.866025403784439/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TR2 = CC(1,2,K)+CC(1,3,K) CR2 = CC(1,1,K)+TAUR*TR2 CH(1,K,1) = CC(1,1,K)+TR2 @@ -786,8 +786,8 @@ subroutine PASSB3 (IDO,L1,CC,CH,WA1,WA2) CH(2,K,3) = CI2-CR3 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TR2 = CC(I-1,2,K)+CC(I-1,3,K) CR2 = CC(I-1,1,K)+TAUR*TR2 CH(I-1,K,1) = CC(I-1,1,K)+TR2 @@ -812,7 +812,7 @@ subroutine PASSB4 (IDO,L1,CC,CH,WA1,WA2,WA3) DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), & WA1(1) ,WA2(1) ,WA3(1) if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI1 = CC(2,1,K)-CC(2,3,K) TI2 = CC(2,1,K)+CC(2,3,K) TR4 = CC(2,4,K)-CC(2,2,K) @@ -831,8 +831,8 @@ subroutine PASSB4 (IDO,L1,CC,CH,WA1,WA2,WA3) CH(2,K,4) = TI1-TI4 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI1 = CC(I,1,K)-CC(I,3,K) TI2 = CC(I,1,K)+CC(I,3,K) TI3 = CC(I,2,K)+CC(I,4,K) @@ -865,7 +865,7 @@ subroutine PASSB5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) DATA TR11,TI11,TR12,TI12 /.309016994374947,.951056516295154, & -.809016994374947,.587785252292473/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI5 = CC(2,2,K)-CC(2,5,K) TI2 = CC(2,2,K)+CC(2,5,K) TI4 = CC(2,3,K)-CC(2,4,K) @@ -894,8 +894,8 @@ subroutine PASSB5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) CH(2,K,5) = CI2-CR5 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI5 = CC(I,2,K)-CC(I,5,K) TI2 = CC(I,2,K)+CC(I,5,K) TI4 = CC(I,3,K)-CC(I,4,K) @@ -964,7 +964,7 @@ subroutine CFFTI1 (N,WA,IFAC) NL = NQ if (NTRY /= 2) goto 107 if (NF == 1) goto 107 - DO 106 I=2,NF + DO 106 I = 2,NF IB = NF-I+2 IFAC(IB+2) = IFAC(IB+1) 106 continue @@ -976,21 +976,21 @@ subroutine CFFTI1 (N,WA,IFAC) ARGH = TPI/FLOAT(N) I = 2 L1 = 1 - DO 110 K1=1,NF + DO 110 K1 = 1,NF IP = IFAC(K1+2) LD = 0 L2 = L1*IP IDO = N/L2 IDOT = IDO+IDO+2 IPM = IP-1 - DO 109 J=1,IPM + DO 109 J = 1,IPM I1 = I WA(I-1) = 1. WA(I) = 0. LD = LD+L1 FI = 0. ARGLD = FLOAT(LD)*ARGH - DO 108 II=4,IDOT,2 + DO 108 II = 4,IDOT,2 I = I+2 FI = FI+1. ARG = FI*ARGLD @@ -1024,7 +1024,7 @@ subroutine CFFTF1 (N,C,CH,WA,IFAC) NA = 0 L1 = 1 IW = 1 - DO 116 K1=1,NF + DO 116 K1 = 1,NF IP = IFAC(K1+2) L2 = IP*L1 IDO = N/L2 @@ -1074,7 +1074,7 @@ subroutine CFFTF1 (N,C,CH,WA,IFAC) 116 continue if (NA == 0) return N2 = N+N - DO 117 I=1,N2 + DO 117 I = 1,N2 C(I) = CH(I) 117 continue return @@ -1090,66 +1090,66 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) IDP = IP*IDO ! if (IDO < L1) goto 106 - DO 103 J=2,IPPH + DO 103 J = 2,IPPH JC = IPP2-J - DO 102 K=1,L1 - DO 101 I=1,IDO + DO 102 K = 1,L1 + DO 101 I = 1,IDO CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 101 continue 102 continue 103 continue - DO 105 K=1,L1 - DO 104 I=1,IDO + DO 105 K = 1,L1 + DO 104 I = 1,IDO CH(I,K,1) = CC(I,1,K) 104 continue 105 continue goto 112 - 106 DO 109 J=2,IPPH + 106 DO 109 J = 2,IPPH JC = IPP2-J - DO 108 I=1,IDO - DO 107 K=1,L1 + DO 108 I = 1,IDO + DO 107 K = 1,L1 CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 107 continue 108 continue 109 continue - DO 111 I=1,IDO - DO 110 K=1,L1 + DO 111 I = 1,IDO + DO 110 K = 1,L1 CH(I,K,1) = CC(I,1,K) 110 continue 111 continue 112 IDL = 2-IDO INC = 0 - DO 116 L=2,IPPH + DO 116 L = 2,IPPH LC = IPP2-L IDL = IDL+IDO - DO 113 IK=1,IDL1 + DO 113 IK = 1,IDL1 C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2) C2(IK,LC) = -WA(IDL)*CH2(IK,IP) 113 continue IDLJ = IDL INC = INC+IDO - DO 115 J=3,IPPH + DO 115 J = 3,IPPH JC = IPP2-J IDLJ = IDLJ+INC if (IDLJ > IDP) IDLJ = IDLJ-IDP WAR = WA(IDLJ-1) WAI = WA(IDLJ) - DO 114 IK=1,IDL1 + DO 114 IK = 1,IDL1 C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J) C2(IK,LC) = C2(IK,LC)-WAI*CH2(IK,JC) 114 continue 115 continue 116 continue - DO 118 J=2,IPPH - DO 117 IK=1,IDL1 + DO 118 J = 2,IPPH + DO 117 IK = 1,IDL1 CH2(IK,1) = CH2(IK,1)+CH2(IK,J) 117 continue 118 continue - DO 120 J=2,IPPH + DO 120 J = 2,IPPH JC = IPP2-J - DO 119 IK=2,IDL1,2 + DO 119 IK = 2,IDL1,2 CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC) CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC) CH2(IK,J) = C2(IK,J)+C2(IK-1,JC) @@ -1159,22 +1159,22 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) NAC = 1 if (IDO == 2) return NAC = 0 - DO 121 IK=1,IDL1 + DO 121 IK = 1,IDL1 C2(IK,1) = CH2(IK,1) 121 continue - DO 123 J=2,IP - DO 122 K=1,L1 + DO 123 J = 2,IP + DO 122 K = 1,L1 C1(1,K,J) = CH(1,K,J) C1(2,K,J) = CH(2,K,J) 122 continue 123 continue if (IDOT > L1) goto 127 IDIJ = 0 - DO 126 J=2,IP + DO 126 J = 2,IP IDIJ = IDIJ+2 - DO 125 I=4,IDO,2 + DO 125 I = 4,IDO,2 IDIJ = IDIJ+2 - DO 124 K=1,L1 + DO 124 K = 1,L1 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J) 124 continue @@ -1182,11 +1182,11 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) 126 continue return 127 IDJ = 2-IDO - DO 130 J=2,IP + DO 130 J = 2,IP IDJ = IDJ+IDO - DO 129 K=1,L1 + DO 129 K = 1,L1 IDIJ = IDJ - DO 128 I=4,IDO,2 + DO 128 I = 4,IDO,2 IDIJ = IDIJ+2 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J) @@ -1199,15 +1199,15 @@ subroutine PASSF2 (IDO,L1,CC,CH,WA1) DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), & WA1(1) if (IDO > 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 CH(1,K,1) = CC(1,1,K)+CC(1,2,K) CH(1,K,2) = CC(1,1,K)-CC(1,2,K) CH(2,K,1) = CC(2,1,K)+CC(2,2,K) CH(2,K,2) = CC(2,1,K)-CC(2,2,K) 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K) TR2 = CC(I-1,1,K)-CC(I-1,2,K) CH(I,K,1) = CC(I,1,K)+CC(I,2,K) @@ -1223,7 +1223,7 @@ subroutine PASSF3 (IDO,L1,CC,CH,WA1,WA2) WA1(1) ,WA2(1) DATA TAUR,TAUI /-.5,-.866025403784439/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TR2 = CC(1,2,K)+CC(1,3,K) CR2 = CC(1,1,K)+TAUR*TR2 CH(1,K,1) = CC(1,1,K)+TR2 @@ -1238,8 +1238,8 @@ subroutine PASSF3 (IDO,L1,CC,CH,WA1,WA2) CH(2,K,3) = CI2-CR3 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TR2 = CC(I-1,2,K)+CC(I-1,3,K) CR2 = CC(I-1,1,K)+TAUR*TR2 CH(I-1,K,1) = CC(I-1,1,K)+TR2 @@ -1264,7 +1264,7 @@ subroutine PASSF4 (IDO,L1,CC,CH,WA1,WA2,WA3) DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), & WA1(1) ,WA2(1) ,WA3(1) if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI1 = CC(2,1,K)-CC(2,3,K) TI2 = CC(2,1,K)+CC(2,3,K) TR4 = CC(2,2,K)-CC(2,4,K) @@ -1283,8 +1283,8 @@ subroutine PASSF4 (IDO,L1,CC,CH,WA1,WA2,WA3) CH(2,K,4) = TI1-TI4 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI1 = CC(I,1,K)-CC(I,3,K) TI2 = CC(I,1,K)+CC(I,3,K) TI3 = CC(I,2,K)+CC(I,4,K) @@ -1317,7 +1317,7 @@ subroutine PASSF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) DATA TR11,TI11,TR12,TI12 /.309016994374947,-.951056516295154, & -.809016994374947,-.587785252292473/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI5 = CC(2,2,K)-CC(2,5,K) TI2 = CC(2,2,K)+CC(2,5,K) TI4 = CC(2,3,K)-CC(2,4,K) @@ -1346,8 +1346,8 @@ subroutine PASSF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) CH(2,K,5) = CI2-CR5 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI5 = CC(I,2,K)-CC(I,5,K) TI2 = CC(I,2,K)+CC(I,5,K) TI4 = CC(I,3,K)-CC(I,4,K) diff --git a/EXAMPLES/benchmarks/check_absolute_amplitude_of_force_source_seismograms/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 b/EXAMPLES/benchmarks/check_absolute_amplitude_of_force_source_seismograms/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 index 169b94966..678f69184 100644 --- a/EXAMPLES/benchmarks/check_absolute_amplitude_of_force_source_seismograms/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 +++ b/EXAMPLES/benchmarks/check_absolute_amplitude_of_force_source_seismograms/analytical_solution_viscoelastic_3D_Carcione_and_Komatitsch_correct_with_1_over_L.f90 @@ -211,7 +211,7 @@ program analytical_solution deltat = 1.d0 / (freqmax*dble(iratio)) ! define the spectrum of the source - do ifreq=0,nfreq + do ifreq = 0,nfreq freq = deltafreq * dble(ifreq) omega = 2.d0 * pi * freq @@ -246,7 +246,7 @@ program analytical_solution ! ************** calcul solution analytique **************** ! d'apres Carcione GJI vol 95 p 611 (1988) - do ifreq=0,nfreq + do ifreq = 0,nfreq freq = deltafreq * dble(ifreq) omega = 2.d0 * pi * freq @@ -256,7 +256,7 @@ program analytical_solution ! use standard infinite frequency (unrelaxed) reference, ! in which waves slow down when attenuation is turned on. temp = dcmplx(0.d0,0.d0) - do i=1,Lnu + do i = 1,Lnu temp = temp + (1./Lnu)*dcmplx(1.d0,omega*tau_epsilon_kappa(i)) / dcmplx(1.d0,omega*tau_sigma_kappa(i)) enddo @@ -264,7 +264,7 @@ program analytical_solution Kappa_omega = Kappa_relaxed * temp temp = dcmplx(0.d0,0.d0) - do i=1,Lnu + do i = 1,Lnu temp = temp + (1./Lnu)*dcmplx(1.d0,omega*tau_epsilon_mu(i)) / dcmplx(1.d0,omega*tau_sigma_mu(i)) enddo @@ -325,7 +325,7 @@ program analytical_solution ! use the Fourier values for Ux c(1) = cmplx(phi1(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi1(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi1(ifreq))) enddo @@ -374,7 +374,7 @@ program analytical_solution open(unit=11,file='Ux_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -394,7 +394,7 @@ program analytical_solution ! use the Fourier values for Uy c(1) = cmplx(phi2(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi2(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi2(ifreq))) enddo @@ -442,7 +442,7 @@ program analytical_solution open(unit=11,file='Uy_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -462,7 +462,7 @@ program analytical_solution ! use the Fourier values for Uz c(1) = cmplx(phi3(0)) - do ifreq=1,nfreq-2 + do ifreq = 1,nfreq-2 c(ifreq+1) = cmplx(phi3(ifreq)) c(nt+1-ifreq) = conjg(cmplx(phi3(ifreq))) enddo @@ -510,7 +510,7 @@ program analytical_solution open(unit=11,file='Uz_time_analytical_solution_viscoelastic.dat',status='unknown') endif endif - do it=1,nt + do it = 1,nt ! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code time = dble(it-1)*deltat - t0 ! the seismograms are very long due to the very large number of FFT points used, @@ -606,7 +606,7 @@ subroutine CFFTB1 (N,C,CH,WA,IFAC) NA = 0 L1 = 1 IW = 1 - DO 116 K1=1,NF + DO 116 K1 = 1,NF IP = IFAC(K1+2) L2 = IP*L1 IDO = N/L2 @@ -656,7 +656,7 @@ subroutine CFFTB1 (N,C,CH,WA,IFAC) 116 continue if (NA == 0) return N2 = N+N - DO 117 I=1,N2 + DO 117 I = 1,N2 C(I) = CH(I) 117 continue return @@ -672,66 +672,66 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) IDP = IP*IDO ! if (IDO < L1) goto 106 - DO 103 J=2,IPPH + DO 103 J = 2,IPPH JC = IPP2-J - DO 102 K=1,L1 - DO 101 I=1,IDO + DO 102 K = 1,L1 + DO 101 I = 1,IDO CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 101 continue 102 continue 103 continue - DO 105 K=1,L1 - DO 104 I=1,IDO + DO 105 K = 1,L1 + DO 104 I = 1,IDO CH(I,K,1) = CC(I,1,K) 104 continue 105 continue goto 112 - 106 DO 109 J=2,IPPH + 106 DO 109 J = 2,IPPH JC = IPP2-J - DO 108 I=1,IDO - DO 107 K=1,L1 + DO 108 I = 1,IDO + DO 107 K = 1,L1 CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 107 continue 108 continue 109 continue - DO 111 I=1,IDO - DO 110 K=1,L1 + DO 111 I = 1,IDO + DO 110 K = 1,L1 CH(I,K,1) = CC(I,1,K) 110 continue 111 continue 112 IDL = 2-IDO INC = 0 - DO 116 L=2,IPPH + DO 116 L = 2,IPPH LC = IPP2-L IDL = IDL+IDO - DO 113 IK=1,IDL1 + DO 113 IK = 1,IDL1 C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2) C2(IK,LC) = WA(IDL)*CH2(IK,IP) 113 continue IDLJ = IDL INC = INC+IDO - DO 115 J=3,IPPH + DO 115 J = 3,IPPH JC = IPP2-J IDLJ = IDLJ+INC if (IDLJ > IDP) IDLJ = IDLJ-IDP WAR = WA(IDLJ-1) WAI = WA(IDLJ) - DO 114 IK=1,IDL1 + DO 114 IK = 1,IDL1 C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J) C2(IK,LC) = C2(IK,LC)+WAI*CH2(IK,JC) 114 continue 115 continue 116 continue - DO 118 J=2,IPPH - DO 117 IK=1,IDL1 + DO 118 J = 2,IPPH + DO 117 IK = 1,IDL1 CH2(IK,1) = CH2(IK,1)+CH2(IK,J) 117 continue 118 continue - DO 120 J=2,IPPH + DO 120 J = 2,IPPH JC = IPP2-J - DO 119 IK=2,IDL1,2 + DO 119 IK = 2,IDL1,2 CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC) CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC) CH2(IK,J) = C2(IK,J)+C2(IK-1,JC) @@ -741,22 +741,22 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) NAC = 1 if (IDO == 2) return NAC = 0 - DO 121 IK=1,IDL1 + DO 121 IK = 1,IDL1 C2(IK,1) = CH2(IK,1) 121 continue - DO 123 J=2,IP - DO 122 K=1,L1 + DO 123 J = 2,IP + DO 122 K = 1,L1 C1(1,K,J) = CH(1,K,J) C1(2,K,J) = CH(2,K,J) 122 continue 123 continue if (IDOT > L1) goto 127 IDIJ = 0 - DO 126 J=2,IP + DO 126 J = 2,IP IDIJ = IDIJ+2 - DO 125 I=4,IDO,2 + DO 125 I = 4,IDO,2 IDIJ = IDIJ+2 - DO 124 K=1,L1 + DO 124 K = 1,L1 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J) 124 continue @@ -764,11 +764,11 @@ subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) 126 continue return 127 IDJ = 2-IDO - DO 130 J=2,IP + DO 130 J = 2,IP IDJ = IDJ+IDO - DO 129 K=1,L1 + DO 129 K = 1,L1 IDIJ = IDJ - DO 128 I=4,IDO,2 + DO 128 I = 4,IDO,2 IDIJ = IDIJ+2 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J) @@ -781,15 +781,15 @@ subroutine PASSB2 (IDO,L1,CC,CH,WA1) DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), & WA1(1) if (IDO > 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 CH(1,K,1) = CC(1,1,K)+CC(1,2,K) CH(1,K,2) = CC(1,1,K)-CC(1,2,K) CH(2,K,1) = CC(2,1,K)+CC(2,2,K) CH(2,K,2) = CC(2,1,K)-CC(2,2,K) 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K) TR2 = CC(I-1,1,K)-CC(I-1,2,K) CH(I,K,1) = CC(I,1,K)+CC(I,2,K) @@ -805,7 +805,7 @@ subroutine PASSB3 (IDO,L1,CC,CH,WA1,WA2) WA1(1) ,WA2(1) DATA TAUR,TAUI /-.5,.866025403784439/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TR2 = CC(1,2,K)+CC(1,3,K) CR2 = CC(1,1,K)+TAUR*TR2 CH(1,K,1) = CC(1,1,K)+TR2 @@ -820,8 +820,8 @@ subroutine PASSB3 (IDO,L1,CC,CH,WA1,WA2) CH(2,K,3) = CI2-CR3 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TR2 = CC(I-1,2,K)+CC(I-1,3,K) CR2 = CC(I-1,1,K)+TAUR*TR2 CH(I-1,K,1) = CC(I-1,1,K)+TR2 @@ -846,7 +846,7 @@ subroutine PASSB4 (IDO,L1,CC,CH,WA1,WA2,WA3) DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), & WA1(1) ,WA2(1) ,WA3(1) if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI1 = CC(2,1,K)-CC(2,3,K) TI2 = CC(2,1,K)+CC(2,3,K) TR4 = CC(2,4,K)-CC(2,2,K) @@ -865,8 +865,8 @@ subroutine PASSB4 (IDO,L1,CC,CH,WA1,WA2,WA3) CH(2,K,4) = TI1-TI4 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI1 = CC(I,1,K)-CC(I,3,K) TI2 = CC(I,1,K)+CC(I,3,K) TI3 = CC(I,2,K)+CC(I,4,K) @@ -899,7 +899,7 @@ subroutine PASSB5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) DATA TR11,TI11,TR12,TI12 /.309016994374947,.951056516295154, & -.809016994374947,.587785252292473/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI5 = CC(2,2,K)-CC(2,5,K) TI2 = CC(2,2,K)+CC(2,5,K) TI4 = CC(2,3,K)-CC(2,4,K) @@ -928,8 +928,8 @@ subroutine PASSB5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) CH(2,K,5) = CI2-CR5 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI5 = CC(I,2,K)-CC(I,5,K) TI2 = CC(I,2,K)+CC(I,5,K) TI4 = CC(I,3,K)-CC(I,4,K) @@ -998,7 +998,7 @@ subroutine CFFTI1 (N,WA,IFAC) NL = NQ if (NTRY /= 2) goto 107 if (NF == 1) goto 107 - DO 106 I=2,NF + DO 106 I = 2,NF IB = NF-I+2 IFAC(IB+2) = IFAC(IB+1) 106 continue @@ -1010,21 +1010,21 @@ subroutine CFFTI1 (N,WA,IFAC) ARGH = TPI/FLOAT(N) I = 2 L1 = 1 - DO 110 K1=1,NF + DO 110 K1 = 1,NF IP = IFAC(K1+2) LD = 0 L2 = L1*IP IDO = N/L2 IDOT = IDO+IDO+2 IPM = IP-1 - DO 109 J=1,IPM + DO 109 J = 1,IPM I1 = I WA(I-1) = 1. WA(I) = 0. LD = LD+L1 FI = 0. ARGLD = FLOAT(LD)*ARGH - DO 108 II=4,IDOT,2 + DO 108 II = 4,IDOT,2 I = I+2 FI = FI+1. ARG = FI*ARGLD @@ -1058,7 +1058,7 @@ subroutine CFFTF1 (N,C,CH,WA,IFAC) NA = 0 L1 = 1 IW = 1 - DO 116 K1=1,NF + DO 116 K1 = 1,NF IP = IFAC(K1+2) L2 = IP*L1 IDO = N/L2 @@ -1108,7 +1108,7 @@ subroutine CFFTF1 (N,C,CH,WA,IFAC) 116 continue if (NA == 0) return N2 = N+N - DO 117 I=1,N2 + DO 117 I = 1,N2 C(I) = CH(I) 117 continue return @@ -1124,66 +1124,66 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) IDP = IP*IDO ! if (IDO < L1) goto 106 - DO 103 J=2,IPPH + DO 103 J = 2,IPPH JC = IPP2-J - DO 102 K=1,L1 - DO 101 I=1,IDO + DO 102 K = 1,L1 + DO 101 I = 1,IDO CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 101 continue 102 continue 103 continue - DO 105 K=1,L1 - DO 104 I=1,IDO + DO 105 K = 1,L1 + DO 104 I = 1,IDO CH(I,K,1) = CC(I,1,K) 104 continue 105 continue goto 112 - 106 DO 109 J=2,IPPH + 106 DO 109 J = 2,IPPH JC = IPP2-J - DO 108 I=1,IDO - DO 107 K=1,L1 + DO 108 I = 1,IDO + DO 107 K = 1,L1 CH(I,K,J) = CC(I,J,K)+CC(I,JC,K) CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K) 107 continue 108 continue 109 continue - DO 111 I=1,IDO - DO 110 K=1,L1 + DO 111 I = 1,IDO + DO 110 K = 1,L1 CH(I,K,1) = CC(I,1,K) 110 continue 111 continue 112 IDL = 2-IDO INC = 0 - DO 116 L=2,IPPH + DO 116 L = 2,IPPH LC = IPP2-L IDL = IDL+IDO - DO 113 IK=1,IDL1 + DO 113 IK = 1,IDL1 C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2) C2(IK,LC) = -WA(IDL)*CH2(IK,IP) 113 continue IDLJ = IDL INC = INC+IDO - DO 115 J=3,IPPH + DO 115 J = 3,IPPH JC = IPP2-J IDLJ = IDLJ+INC if (IDLJ > IDP) IDLJ = IDLJ-IDP WAR = WA(IDLJ-1) WAI = WA(IDLJ) - DO 114 IK=1,IDL1 + DO 114 IK = 1,IDL1 C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J) C2(IK,LC) = C2(IK,LC)-WAI*CH2(IK,JC) 114 continue 115 continue 116 continue - DO 118 J=2,IPPH - DO 117 IK=1,IDL1 + DO 118 J = 2,IPPH + DO 117 IK = 1,IDL1 CH2(IK,1) = CH2(IK,1)+CH2(IK,J) 117 continue 118 continue - DO 120 J=2,IPPH + DO 120 J = 2,IPPH JC = IPP2-J - DO 119 IK=2,IDL1,2 + DO 119 IK = 2,IDL1,2 CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC) CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC) CH2(IK,J) = C2(IK,J)+C2(IK-1,JC) @@ -1193,22 +1193,22 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) NAC = 1 if (IDO == 2) return NAC = 0 - DO 121 IK=1,IDL1 + DO 121 IK = 1,IDL1 C2(IK,1) = CH2(IK,1) 121 continue - DO 123 J=2,IP - DO 122 K=1,L1 + DO 123 J = 2,IP + DO 122 K = 1,L1 C1(1,K,J) = CH(1,K,J) C1(2,K,J) = CH(2,K,J) 122 continue 123 continue if (IDOT > L1) goto 127 IDIJ = 0 - DO 126 J=2,IP + DO 126 J = 2,IP IDIJ = IDIJ+2 - DO 125 I=4,IDO,2 + DO 125 I = 4,IDO,2 IDIJ = IDIJ+2 - DO 124 K=1,L1 + DO 124 K = 1,L1 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J) 124 continue @@ -1216,11 +1216,11 @@ subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA) 126 continue return 127 IDJ = 2-IDO - DO 130 J=2,IP + DO 130 J = 2,IP IDJ = IDJ+IDO - DO 129 K=1,L1 + DO 129 K = 1,L1 IDIJ = IDJ - DO 128 I=4,IDO,2 + DO 128 I = 4,IDO,2 IDIJ = IDIJ+2 C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J) C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J) @@ -1233,15 +1233,15 @@ subroutine PASSF2 (IDO,L1,CC,CH,WA1) DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), & WA1(1) if (IDO > 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 CH(1,K,1) = CC(1,1,K)+CC(1,2,K) CH(1,K,2) = CC(1,1,K)-CC(1,2,K) CH(2,K,1) = CC(2,1,K)+CC(2,2,K) CH(2,K,2) = CC(2,1,K)-CC(2,2,K) 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K) TR2 = CC(I-1,1,K)-CC(I-1,2,K) CH(I,K,1) = CC(I,1,K)+CC(I,2,K) @@ -1257,7 +1257,7 @@ subroutine PASSF3 (IDO,L1,CC,CH,WA1,WA2) WA1(1) ,WA2(1) DATA TAUR,TAUI /-.5,-.866025403784439/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TR2 = CC(1,2,K)+CC(1,3,K) CR2 = CC(1,1,K)+TAUR*TR2 CH(1,K,1) = CC(1,1,K)+TR2 @@ -1272,8 +1272,8 @@ subroutine PASSF3 (IDO,L1,CC,CH,WA1,WA2) CH(2,K,3) = CI2-CR3 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TR2 = CC(I-1,2,K)+CC(I-1,3,K) CR2 = CC(I-1,1,K)+TAUR*TR2 CH(I-1,K,1) = CC(I-1,1,K)+TR2 @@ -1298,7 +1298,7 @@ subroutine PASSF4 (IDO,L1,CC,CH,WA1,WA2,WA3) DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), & WA1(1) ,WA2(1) ,WA3(1) if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI1 = CC(2,1,K)-CC(2,3,K) TI2 = CC(2,1,K)+CC(2,3,K) TR4 = CC(2,2,K)-CC(2,4,K) @@ -1317,8 +1317,8 @@ subroutine PASSF4 (IDO,L1,CC,CH,WA1,WA2,WA3) CH(2,K,4) = TI1-TI4 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI1 = CC(I,1,K)-CC(I,3,K) TI2 = CC(I,1,K)+CC(I,3,K) TI3 = CC(I,2,K)+CC(I,4,K) @@ -1351,7 +1351,7 @@ subroutine PASSF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) DATA TR11,TI11,TR12,TI12 /.309016994374947,-.951056516295154, & -.809016994374947,-.587785252292473/ if (IDO /= 2) goto 102 - DO 101 K=1,L1 + DO 101 K = 1,L1 TI5 = CC(2,2,K)-CC(2,5,K) TI2 = CC(2,2,K)+CC(2,5,K) TI4 = CC(2,3,K)-CC(2,4,K) @@ -1380,8 +1380,8 @@ subroutine PASSF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4) CH(2,K,5) = CI2-CR5 101 continue return - 102 DO 104 K=1,L1 - DO 103 I=2,IDO,2 + 102 DO 104 K = 1,L1 + DO 103 I = 2,IDO,2 TI5 = CC(I,2,K)-CC(I,5,K) TI2 = CC(I,2,K)+CC(I,5,K) TI4 = CC(I,3,K)-CC(I,4,K) diff --git a/EXAMPLES/reproducible_study/seismoacoustic_bishop2022/README.md b/EXAMPLES/reproducible_study/seismoacoustic_bishop2022/README.md index fe853e2e7..a67088c18 100644 --- a/EXAMPLES/reproducible_study/seismoacoustic_bishop2022/README.md +++ b/EXAMPLES/reproducible_study/seismoacoustic_bishop2022/README.md @@ -30,7 +30,7 @@ Step-by-step tutorial: If successful, this will generate the files in setup/: config.h, constants.h, precision.h, among others - - Copy run scripts for your particular cluster from utils/scripts/Cluster/ into SPECFEM3D/, + - Copy run scripts for your particular cluster from utils/scripts/Cluster/ into SPECFEM3D/, e.g., go_mesher_slurm.bash, go_generate_databases_slurm.bash, and go_solver_slurm.bash > cp utils/scripts/Cluster/slurm/*.bash . @@ -107,11 +107,11 @@ Step-by-step tutorial: You can track the progress with the timestamp files generated in OUTPUT_FILES/ - - when the job is complete, you should have 6 velocity seismogram files and 2 pressure seismogram files in the directory OUTPUT_FILES. + - when the job is complete, you should have 6 velocity seismogram files and 2 pressure seismogram files in the directory OUTPUT_FILES. There will also be 330 timestamp****** files (halfspace example) or 67 timestamp****** files (topography example). - > ls OUTPUT_FILES/\*semv | wc -l - > ls OUTPUT_FILES/\*semp | wc -l - > ls OUTPUT_FILES/timestamp\* | wc -l + > ls OUTPUT_FILES/\*semv | wc -l + > ls OUTPUT_FILES/\*semp | wc -l + > ls OUTPUT_FILES/timestamp\* | wc -l 7. Check with the four reference seismograms in SPECFEM3D/EXAMPLES/reproducible_study/seismoacoustic_bishop2022/REF_SEIS_FIG[48]/ @@ -129,7 +129,7 @@ Step-by-step tutorial: - Example: from SPECFEM3D/, quick viewing using xmgrace (if available): - > xmgrace EXAMPLES/reproducible_study/seismoacoustic_bishop2022/REF_SEIS_FIG4/JP.STN83S.FXZ.semv & + > xmgrace EXAMPLES/reproducible_study/seismoacoustic_bishop2022/REF_SEIS_FIG4/JP.STN83S.FXZ.semv & > xmgrace OUTPUT_FILES/JP.STN83S.FXZ.semv & diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/FORWARD_ADJOINT/COPY_LOCAL/copy_local.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/FORWARD_ADJOINT/COPY_LOCAL/copy_local.f90 index 4f53169b0..660b7b731 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/FORWARD_ADJOINT/COPY_LOCAL/copy_local.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/FORWARD_ADJOINT/COPY_LOCAL/copy_local.f90 @@ -38,7 +38,7 @@ program xcopy_local cp = "cp" endif - do iregion_code=1,3 + do iregion_code = 1,3 ! process name write(procname,"('/proc',i6.6,'_reg',i1,'_')") myrank,iregion_code diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X01_SRC_SUM_KERNELS/sum_kernels.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X01_SRC_SUM_KERNELS/sum_kernels.f90 index 4b6a3675b..00ecb1eea 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X01_SRC_SUM_KERNELS/sum_kernels.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X01_SRC_SUM_KERNELS/sum_kernels.f90 @@ -7,8 +7,8 @@ program sum_kernels include '../../SHARE_FILES/HEADER_FILES/constants.h' include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' - integer,parameter:: NSPEC=NSPEC_CRUST_MANTLE - integer,parameter:: NKERNEL=6 !bulk_betah, bulk_betav, bulk_c, eta, rho, hess + integer,parameter:: NSPEC = NSPEC_CRUST_MANTLE + integer,parameter:: NKERNEL = 6 !bulk_betah, bulk_betav, bulk_c, eta, rho, hess integer:: myrank, sizeprocs,ier integer:: ios,nevent,ievent,iker @@ -42,7 +42,7 @@ program sum_kernels kernel_name=(/"reg1_bulk_betah_kernel","reg1_bulk_betav_kernel","reg1_bulk_c_kernel","reg1_eta_kernel","reg1_rho_kernel","reg1_hess_kernel"/) - nevent=0 + nevent = 0 open(unit=1001,file=trim(eventid),status='old',iostat=ios) if ( ios /= 0 ) then print *, 'ERROR OPENING', trim(eventid) @@ -51,16 +51,16 @@ program sum_kernels do while ( 1 == 1) read(1001,'(a)',iostat=ios) line if ( ios /= 0) exit - nevent=nevent+1 + nevent = nevent+1 event_list(nevent)=line enddo close(1001) - do iker=1,NKERNEL - total_kernel=0. + do iker = 1,NKERNEL + total_kernel = 0. - do ievent=1,nevent + do ievent = 1,nevent if (myrank == 0) write(*,*) 'READING IN EVENT KERNEL:',trim(kernel_name(iker)),' FOR ',trim(event_list(ievent)) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X02_SRC_PRECOND_KERNELS/precond_kernels.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X02_SRC_PRECOND_KERNELS/precond_kernels.f90 index f8eeea222..074efb50f 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X02_SRC_PRECOND_KERNELS/precond_kernels.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X02_SRC_PRECOND_KERNELS/precond_kernels.f90 @@ -9,8 +9,8 @@ program precond_kernels include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' include '../../SHARE_FILES/HEADER_FILES/precision.h' - integer,parameter:: NSPEC=NSPEC_CRUST_MANTLE - integer,parameter:: NKERNEL=4 !bulk_betah, bulk_betav, bulk_c, eta + integer,parameter:: NSPEC = NSPEC_CRUST_MANTLE + integer,parameter:: NKERNEL = 4 !bulk_betah, bulk_betav, bulk_c, eta real(kind=CUSTOM_REAL),parameter:: THRESHOLD_HESS=5.e-4 integer:: myrank, sizeprocs,ier @@ -38,10 +38,10 @@ program precond_kernels kernel_name=(/"reg1_bulk_betah_kernel","reg1_bulk_betav_kernel","reg1_bulk_c_kernel","reg1_eta_kernel"/) - do iker=1,NKERNEL - kernel_precond=0. - hess=0. - kernel=0. + do iker = 1,NKERNEL + kernel_precond = 0. + hess = 0. + kernel = 0. write(kernel_file,'(a,i6.6,a)') trim(input_dir)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' write(hess_file,'(a,i6.6,a)') trim(input_dir)//'/proc',myrank,'_reg1_hess_kernel.bin' @@ -70,15 +70,15 @@ program precond_kernels if (myrank == 0) write(*,*) 'MAX Hessian FOR ALL PROCESSORS:',maxh_all ! normalized hess - hess=hess/maxh_all + hess = hess/maxh_all where(hess(:,:,:,:) > THRESHOLD_HESS ) - hess=1.0_CUSTOM_REAL / hess + hess = 1.0_CUSTOM_REAL / hess elsewhere - hess=1.0_CUSTOM_REAL / THRESHOLD_HESS + hess = 1.0_CUSTOM_REAL / THRESHOLD_HESS endwhere - kernel_precond=kernel*hess + kernel_precond = kernel*hess if (myrank == 0) write(*,*) 'WRITING OUT PRECONDITIONED KERNEL FOR:',trim(kernel_name(iker)) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/smooth_sem_globe.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/smooth_sem_globe.f90 index b63b65744..ad51932cb 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/smooth_sem_globe.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X03_SRC_SMOOTH_KERNELS/smooth_sem_globe.f90 @@ -183,9 +183,9 @@ program smooth_sem_globe call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo @@ -303,7 +303,7 @@ program smooth_sem_globe tk = 0.0 bk = 0.0 - kernel_smooth=0.0 + kernel_smooth = 0.0 ! loop over all the slices do iproc = 1, nums diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_CG/compute_direction_cg.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_CG/compute_direction_cg.f90 index 4b7cecaee..a375261c7 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_CG/compute_direction_cg.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_CG/compute_direction_cg.f90 @@ -6,8 +6,8 @@ program xcompute_direction_cg include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' include '../../SHARE_FILES/HEADER_FILES/precision.h' - integer,parameter:: NSPEC=NSPEC_CRUST_MANTLE - integer,parameter:: NKERNEL=4 + integer,parameter:: NSPEC = NSPEC_CRUST_MANTLE + integer,parameter:: NKERNEL = 4 integer:: myrank, sizeprocs,ier integer:: iker,ispec,i,j,k @@ -58,7 +58,7 @@ program xcompute_direction_cg read(1001) gradient_1(:,:,:,1:NSPEC) close(1001) - beta_upper=sum(gradient_1*(gradient_1-gradient_0)) + beta_upper = sum(gradient_1*(gradient_1-gradient_0)) beta_down=sum(gradient_0*gradient_0) call mpi_barrier(MPI_COMM_WORLD,ier) @@ -69,12 +69,12 @@ program xcompute_direction_cg beta_down_all(iker)=beta_down_all_tmp enddo - beta=sum(beta_upper_all)/sum(beta_down_all) + beta = sum(beta_upper_all)/sum(beta_down_all) if (myrank == 0 ) then print *,'before zero',myrank,beta endif if ( beta < 0.0 ) then - beta=0.0 + beta = 0.0 endif @@ -84,7 +84,7 @@ program xcompute_direction_cg do iker = 1,NKERNEL - direction_1=0._CUSTOM_REAL + direction_1 = 0._CUSTOM_REAL write(direction_0_file,'(a,i6.6,a)') trim(direction_0_dir)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' write(direction_1_file,'(a,i6.6,a)') trim(direction_1_dir)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' @@ -121,7 +121,7 @@ program xcompute_direction_cg - do ispec=1,NSPEC + do ispec = 1,NSPEC do k = 1,NGLLZ do j = 1,NGLLY do i = 1,NGLLX diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_LBFGS/compute_direction_lbfgs.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_LBFGS/compute_direction_lbfgs.f90 index fb9c30a82..5e7a9e995 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_LBFGS/compute_direction_lbfgs.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_LBFGS/compute_direction_lbfgs.f90 @@ -7,9 +7,9 @@ module globe_parameter include '../../SHARE_FILES/HEADER_FILES/constants.h' include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' - integer,parameter:: NSPEC=NSPEC_CRUST_MANTLE - integer,parameter:: NGLOB=NGLOB_CRUST_MANTLE - integer,parameter:: NKERNEL=4 + integer,parameter:: NSPEC = NSPEC_CRUST_MANTLE + integer,parameter:: NGLOB = NGLOB_CRUST_MANTLE + integer,parameter:: NKERNEL = 4 integer,parameter:: m_store=5 ! stored model step 3 <= m_store <= 7 integer:: myrank, sizeprocs,ier @@ -83,13 +83,13 @@ program xcompute_direction_lbfgs print *,'************************************************' endif - do istore=iter_current-1,iter_store,-1 + do istore = iter_current-1,iter_store,-1 call get_gradient(istore+1,gradient1) call get_gradient(istore,gradient0) call get_model(istore+1,model1) call get_model(istore,model0) - gradient_diff=gradient1-gradient0 - model_diff=model1-model0 + gradient_diff = gradient1-gradient0 + model_diff = model1-model0 p_tmp=sum(gradient_diff*model_diff) call mpi_allreduce(p_tmp,p_sum,1,CUSTOM_MPI_TYPE,MPI_SUM,MPI_COMM_WORLD,ier) @@ -103,13 +103,13 @@ program xcompute_direction_lbfgs q_vector=q_vector-a(istore)*gradient_diff enddo - istore=iter_current-1 + istore = iter_current-1 call get_gradient(istore+1,gradient1) call get_gradient(istore,gradient0) call get_model(istore+1,model1) call get_model(istore,model0) - gradient_diff=gradient1-gradient0 - model_diff=model1-model0 + gradient_diff = gradient1-gradient0 + model_diff = model1-model0 ! this implements Algorithm 7.4 and equation (7.20) on page 178 of the book of ! Jorge Nocedal and Stephen Wright, "Numerical Optimization", Springer, second edition (2006) @@ -117,10 +117,10 @@ program xcompute_direction_lbfgs p_k_down=sum(gradient_diff*gradient_diff) call mpi_allreduce(p_k_up,p_k_up_sum,1,CUSTOM_MPI_TYPE,MPI_SUM,MPI_COMM_WORLD,ier) call mpi_allreduce(p_k_down,p_k_down_sum,1,CUSTOM_MPI_TYPE,MPI_SUM,MPI_COMM_WORLD,ier) - p_k=p_k_up_sum/p_k_down_sum + p_k = p_k_up_sum/p_k_down_sum if ( myrank == 0) print *,'p_k:',p_k - r_vector=p_k*q_vector + r_vector = p_k*q_vector !r_vector=1.0*q_vector if (myrank == 0) then @@ -129,14 +129,14 @@ program xcompute_direction_lbfgs print *,'******************************************' endif - do istore=iter_store,iter_current-1,1 + do istore = iter_store,iter_current-1,1 call get_gradient(istore+1,gradient1) call get_gradient(istore,gradient0) call get_model(istore+1,model1) call get_model(istore,model0) - gradient_diff=gradient1-gradient0 - model_diff=model1-model0 + gradient_diff = gradient1-gradient0 + model_diff = model1-model0 b_tmp=sum(gradient_diff*r_vector) call mpi_allreduce(b_tmp,b_sum,1,CUSTOM_MPI_TYPE,MPI_SUM,MPI_COMM_WORLD,ier) @@ -144,7 +144,7 @@ program xcompute_direction_lbfgs if (myrank == 0) print *,'a,b:',a(istore),b - r_vector=r_vector+model_diff*(a(istore)-b) + r_vector = r_vector+model_diff*(a(istore)-b) enddo r_vector=-1.0*r_vector @@ -182,7 +182,7 @@ subroutine get_gradient(iter,gradient) real(kind=CUSTOM_REAL),dimension(NGLLX,NGLLY,NGLLZ,NSPEC)::vector real(kind=CUSTOM_REAL),dimension(NKERNEL,NGLOB)::vector_gll - do iker=1,NKERNEL + do iker = 1,NKERNEL write(dirname,'(a,i2.2)') '../SUMMED_KERNEL_M',iter write(filename,'(a,i6.6,a)') trim(dirname)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' open(1001,file=trim(filename),status='old',form='unformatted',iostat=ier) @@ -193,10 +193,10 @@ subroutine get_gradient(iter,gradient) endif read(1001) vector(:,:,:,1:NSPEC) close(1001) - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob=ibool(i,j,k,ispec) vector_gll(iker,iglob)=vector(i,j,k,ispec) enddo @@ -219,7 +219,7 @@ subroutine get_model(iter,model) real(kind=CUSTOM_REAL),dimension(NKERNEL,NGLOB):: vector_gll real(kind=CUSTOM_REAL),dimension(NGLLX,NGLLY,NGLLZ,NSPEC):: vector - do iker=1,NKERNEL + do iker = 1,NKERNEL write(dirname,'(a,i2.2)') '../MODEL_M',iter write(filename,'(a,i6.6,a)') trim(dirname)//'/proc',myrank,'_'//trim(model_name(iker))//'.bin' open(1001,file=trim(filename),status='old',form='unformatted',iostat=ier) @@ -230,10 +230,10 @@ subroutine get_model(iter,model) endif read(1001) vector(:,:,:,1:NSPEC) close(1001) - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob=ibool(i,j,k,ispec) vector_gll(iker,iglob)=vector(i,j,k,ispec) enddo @@ -262,11 +262,11 @@ subroutine write_gradient(iter,gradient) vector_gll(3,1:NGLOB)=gradient(2*NGLOB+1:3*NGLOB) vector_gll(4,1:NGLOB)=gradient(3*NGLOB+1:4*NGLOB) - do iker=1,NKERNEL - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do iker = 1,NKERNEL + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob=ibool(i,j,k,ispec) vector(iker,i,j,k,ispec)=vector_gll(iker,iglob) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_SD/compute_direction_sd.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_SD/compute_direction_sd.f90 index 4b1efc6a9..304d5eb00 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_SD/compute_direction_sd.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X04_SRC_DIRECTION_SD/compute_direction_sd.f90 @@ -6,8 +6,8 @@ program xcompute_direction_sd include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' include '../../SHARE_FILES/HEADER_FILES/precision.h' - integer,parameter:: NSPEC=NSPEC_CRUST_MANTLE - integer,parameter:: NKERNEL=4 + integer,parameter:: NSPEC = NSPEC_CRUST_MANTLE + integer,parameter:: NKERNEL = 4 integer:: myrank, sizeprocs,ier integer:: iker,ispec,i,j,k @@ -32,7 +32,7 @@ program xcompute_direction_sd kernel_name=(/"reg1_bulk_betah_kernel_precond_smooth","reg1_bulk_betav_kernel_precond_smooth","reg1_bulk_c_kernel_precond_smooth","reg1_eta_kernel_precond_smooth"/) do iker = 1,NKERNEL - direction=0._CUSTOM_REAL + direction = 0._CUSTOM_REAL write(direction_file,'(a,i6.6,a)') trim(direction_dir)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' write(gradient_file,'(a,i6.6,a)') trim(gradient_dir)//'/proc',myrank,'_'//trim(kernel_name(iker))//'.bin' diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/add_model_globe.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/add_model_globe.f90 index 47fd7b7f5..51f025f7b 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/add_model_globe.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/add_model_globe.f90 @@ -568,9 +568,9 @@ subroutine compute_volume() call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/ITERATION_UPDATE/X05_SRC_UPDATE_MODELS/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_HORIZ/sem_model_slice.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_HORIZ/sem_model_slice.f90 index 92ee0b5f9..84c0317df 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_HORIZ/sem_model_slice.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_HORIZ/sem_model_slice.f90 @@ -6,9 +6,9 @@ program sem_model_slice include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' include '../../SHARE_FILES/HEADER_FILES/precision.h' -integer,parameter:: NUM_NODES=99 ! for recent mesher 100 processors -integer,parameter:: iregion=1 ! for region one -integer,parameter:: NMAXPTS=10000000 +integer,parameter:: NUM_NODES = 99 ! for recent mesher 100 processors +integer,parameter:: iregion = 1 ! for region one +integer,parameter:: NMAXPTS = 10000000 real(kind=CUSTOM_REAL):: R_CUT_RANGE=0.00785d0 ! dr=0.00785 ~ 50 km depth integer::iproc,ipt,npts @@ -50,9 +50,9 @@ program sem_model_slice open(1001,file=trim(xyz_infile),status='old',iostat=ios) -i=0 +i = 0 do while (1 == 1) - i=i+1 + i = i+1 read(1001,*,iostat=ios) xmesh,ymesh,zmesh R_CUT=sqrt(xmesh**2+ymesh**2+zmesh**2) if (ios /= 0) exit @@ -61,7 +61,7 @@ program sem_model_slice z(i)=zmesh enddo close(1001) -npts=i-1 +npts = i-1 !endif !call MPI_BCAST(npts,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier) @@ -106,7 +106,7 @@ program sem_model_slice distmin(1:npts)=HUGEVAL -do ispec=1,NSPEC_CRUST_MANTLE +do ispec = 1,NSPEC_CRUST_MANTLE if (myrank == 0) write(*,*) 'ispec=',ispec @@ -116,14 +116,14 @@ program sem_model_slice iglob=ibool(i,j,k,ispec) - r1=sqrt((xstore(iglob))**2+(ystore(iglob))**2+(zstore(iglob))**2) + r1 = sqrt((xstore(iglob))**2+(ystore(iglob))**2+(zstore(iglob))**2) if ( abs(r1-R_CUT) < R_CUT_RANGE ) then dist(1:npts) = dsqrt((x(1:npts)-dble(xstore(iglob)))**2 & +(y(1:npts)-dble(ystore(iglob)))**2 & +(z(1:npts)-dble(zstore(iglob)))**2) - do ipt=1,npts + do ipt = 1,npts if (dist(ipt) < distmin(ipt)) then distmin(ipt)=dist(ipt) ispec_found(ipt)=ispec @@ -154,7 +154,7 @@ program sem_model_slice v(1:npts)=0 dist(1:npts)=0. -do i=1,npts +do i = 1,npts if (myrank == nint(out(2,i))) then v(i)=vfound(i) dist(i)=distmin(i) @@ -167,10 +167,10 @@ program sem_model_slice if (myrank == 0) then open(1002, file=gmt_outfile,status='unknown') do i = 1,npts - xmesh=x(i); ymesh=y(i); zmesh=z(i) + xmesh = x(i); ymesh = y(i); zmesh = z(i) call xyz_2_rthetaphi(xmesh,ymesh,zmesh,r,theta,phi) - lat=90.0 - theta*180.0/PI - lon=phi*180.0/PI + lat = 90.0 - theta*180.0/PI + lon = phi*180.0/PI dep=(1.0-r)*R_EARTH_KM ! write(1002,*) lon,lat,dep,vall(i),distall(i) write(1002,*) lon,lat,r,vall(i),distall(i) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_VERT/sem_model_slice.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_VERT/sem_model_slice.f90 index 7e7ac2ddf..19b5126ec 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_VERT/sem_model_slice.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/MODEL_VISULIZATION/SRC_MODEL_SLICE_VERT/sem_model_slice.f90 @@ -6,9 +6,9 @@ program sem_model_slice include '../../SHARE_FILES/HEADER_FILES/values_from_mesher.h' include '../../SHARE_FILES/HEADER_FILES/precision.h' -integer,parameter:: NUM_NODES=99 ! for recent mesher 100 processors -integer,parameter:: iregion=1 ! for region one -integer,parameter:: NMAXPTS=10000000 +integer,parameter:: NUM_NODES = 99 ! for recent mesher 100 processors +integer,parameter:: iregion = 1 ! for region one +integer,parameter:: NMAXPTS = 10000000 real(kind=CUSTOM_REAL):: R_CUT_RANGE=0.00785d0 ! dr=0.00785 ~ 50 km depth integer::iproc,ipt,npts @@ -50,9 +50,9 @@ program sem_model_slice open(1001,file=trim(xyz_infile),status='old',iostat=ios) -i=0 +i = 0 do while (1 == 1) - i=i+1 + i = i+1 read(1001,*,iostat=ios) xmesh,ymesh,zmesh R_CUT=sqrt(xmesh**2+ymesh**2+zmesh**2) if (ios /= 0) exit @@ -61,7 +61,7 @@ program sem_model_slice z(i)=zmesh enddo close(1001) -npts=i-1 +npts = i-1 !endif !call MPI_BCAST(npts,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier) @@ -106,7 +106,7 @@ program sem_model_slice distmin(1:npts)=HUGEVAL -do ispec=1,NSPEC_CRUST_MANTLE +do ispec = 1,NSPEC_CRUST_MANTLE if (myrank == 0) write(*,*) 'ispec=',ispec @@ -116,14 +116,14 @@ program sem_model_slice iglob=ibool(i,j,k,ispec) - r1=sqrt((xstore(iglob))**2+(ystore(iglob))**2+(zstore(iglob))**2) + r1 = sqrt((xstore(iglob))**2+(ystore(iglob))**2+(zstore(iglob))**2) if ( r1 > 0.7 ) then dist(1:npts) = dsqrt((x(1:npts)-dble(xstore(iglob)))**2 & +(y(1:npts)-dble(ystore(iglob)))**2 & +(z(1:npts)-dble(zstore(iglob)))**2) - do ipt=1,npts + do ipt = 1,npts if (dist(ipt) < distmin(ipt)) then distmin(ipt)=dist(ipt) ispec_found(ipt)=ispec @@ -154,7 +154,7 @@ program sem_model_slice v(1:npts)=0 dist(1:npts)=0. -do i=1,npts +do i = 1,npts if (myrank == nint(out(2,i))) then v(i)=vfound(i) dist(i)=distmin(i) @@ -167,15 +167,15 @@ program sem_model_slice if (myrank == 0) then open(1002, file=gmt_outfile,status='unknown') do i = 1,npts - xmesh=x(i); ymesh=y(i); zmesh=z(i) + xmesh = x(i); ymesh = y(i); zmesh = z(i) call xyz_2_rthetaphi(xmesh,ymesh,zmesh,r,theta,phi) - lat=90.0 - theta*180.0/PI - lon=phi*180.0/PI + lat = 90.0 - theta*180.0/PI + lon = phi*180.0/PI dep=(1.0-r)*R_EARTH_KM !strech along radial direction (0.8->0.7) ! rnew=(r-0.1*(1-r)/(1.0-0.8))*6371 - rnew=r*6371.0 + rnew = r*6371.0 ! diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_CORRECT_INITIALTIME_MOMENT/correct_syn_time_moment.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_CORRECT_INITIALTIME_MOMENT/correct_syn_time_moment.f90 index 907605c30..25a2198a2 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_CORRECT_INITIALTIME_MOMENT/correct_syn_time_moment.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_CORRECT_INITIALTIME_MOMENT/correct_syn_time_moment.f90 @@ -2,7 +2,7 @@ program xcorrect_syn implicit none -integer,parameter:: NDIM=80000 +integer,parameter:: NDIM = 80000 real:: dt0,dm0 integer:: nfile,i,j character(len=250):: oldsyn_fnm,newsyn_fnm @@ -23,9 +23,9 @@ program xcorrect_syn do i = 1,nfile - oldsyn=0.0 - newsyn=0.0 - syn_t=0.0 + oldsyn = 0.0 + newsyn = 0.0 + syn_t = 0.0 read(*,'(a)') oldsyn_fnm read(*,'(a)') newsyn_fnm @@ -47,14 +47,14 @@ program xcorrect_syn ! shift and apply scale moment correction for seismograms - ishift=nint(abs(dt0)/dt) + ishift = nint(abs(dt0)/dt) if (dt0 > 0.0 ) then newsyn(1+ishift:npt+ishift)=dm0*oldsyn(1:npt) else newsyn(1:npt)=dm0*oldsyn(1+ishift:npt+ishift) endif - do j =1,npt + do j = 1,npt syn_t(j)=b+(j-1)*dt enddo ! call newhdr() diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_GRIDSEARCH_INITIALTIME_MOMENT/gridsearch_time_moment.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_GRIDSEARCH_INITIALTIME_MOMENT/gridsearch_time_moment.f90 index 5370776bb..268d5f8b1 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_GRIDSEARCH_INITIALTIME_MOMENT/gridsearch_time_moment.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/ADJOINT_TOMOGRAPHY_TOOLKIT/SOURCE_INVERSION/SRC_GRIDSEARCH_INITIALTIME_MOMENT/gridsearch_time_moment.f90 @@ -2,7 +2,7 @@ program xgrid_search_time_moment implicit none - integer,parameter:: NDIM=80000 + integer,parameter:: NDIM = 80000 character(len=256) :: cmt_file, new_cmt_file character(len=256) :: output_minmax, output_misfit @@ -44,21 +44,21 @@ program xgrid_search_time_moment !--------------------------------------------------------- !- setup searching space !--------------------------------------------------------- - n_m0=nint((e_m0-s_m0)/d_m0)+1 - n_t0=nint((e_t0-s_t0)/d_t0)+1 - n_total=n_m0*n_t0 + n_m0 = nint((e_m0-s_m0)/d_m0)+1 + n_t0 = nint((e_t0-s_t0)/d_t0)+1 + n_total = n_m0*n_t0 allocate(misfit(n_total)) allocate(t0(n_total)) allocate(m0(n_total)) - misfit=0.0 - t0=0.0 - m0=0.0 - - i_total=0 - do i=1,n_m0 - do j=1,n_t0 - i_total=i_total+1 + misfit = 0.0 + t0 = 0.0 + m0 = 0.0 + + i_total = 0 + do i = 1,n_m0 + do j = 1,n_t0 + i_total = i_total+1 t0(i_total)=s_t0+d_t0*(j-1) m0(i_total)=s_m0+d_m0*(i-1) enddo @@ -73,7 +73,7 @@ program xgrid_search_time_moment !------------------------------------------------------------ open(1001,file=trim(flexwin_out_file),status='old') read(1001,*) nf,bd_z,bd_r,bd_t,sw_z,sw_r,sw_t - do j=1,nf + do j = 1,nf write(*,*) j,nf read(1001,'(a)') data_file read(1001,'(a)') syn_file @@ -91,39 +91,39 @@ program xgrid_search_time_moment ! decide weight factors if ( trim(bandpass) == trim(body_bandpass) .and. trim(cmp) == 'LHZ' ) then if ( bd_z /= 0 ) then - weight=1.0/bd_z + weight = 1.0/bd_z else - weight=1.0 + weight = 1.0 endif else if ( trim(bandpass) == trim(body_bandpass) .and. trim(cmp) == 'LHR' ) then if ( bd_r /= 0 ) then - weight=1.0/bd_r + weight = 1.0/bd_r else - weight=1.0 + weight = 1.0 endif else if ( trim(bandpass) == trim(body_bandpass) .and. trim(cmp) == 'LHT' ) then if ( bd_t /= 0 ) then - weight=1.0/bd_t + weight = 1.0/bd_t else - weight=1.0 + weight = 1.0 endif else if ( trim(bandpass) == trim(surf_bandpass) .and. trim(cmp) == 'LHZ' ) then if ( sw_z /= 0 ) then - weight=1.0/sw_z + weight = 1.0/sw_z else - weight=1.0 + weight = 1.0 endif else if ( trim(bandpass) == trim(surf_bandpass) .and. trim(cmp) == 'LHR' ) then if ( sw_r /= 0 ) then - weight=1.0/sw_r + weight = 1.0/sw_r else - weight=1.0 + weight = 1.0 endif else if ( trim(bandpass) == trim(surf_bandpass) .and. trim(cmp) == 'LHT' ) then if ( sw_t /= 0) then - weight=1.0/sw_t + weight = 1.0/sw_t else - weight=1.0 + weight = 1.0 endif else stop 'wrong bandpass and component, check input parameters' @@ -131,42 +131,42 @@ program xgrid_search_time_moment read(1001,*) nwin - do k=1,nwin + do k = 1,nwin read(1001,*) tstart,tend - is=max(floor((tstart-b)/dt),1) - ie=min(ceiling((tend-b)/dt),npts) + is = max(floor((tstart-b)/dt),1) + ie = min(ceiling((tend-b)/dt),npts) data_win(:)=0.0 syn_win(:)=0.0 data_win(is:ie)=data(is:ie) syn_win(is:ie)=syn(is:ie) call xcorr_calc(data_win,syn_win,npts,is,ie,cc_shift,cc_max) - deltaT0=cc_shift*dt + deltaT0 = cc_shift*dt - do i=1,n_total + do i = 1,n_total t00=t0(i) m00=m0(i) ishift=nint(t00/dt) - isd=is - ied=ie + isd = is + ied = ie - iss=isd-ishift - iee=ied-ishift + iss = isd-ishift + iee = ied-ishift if ( trim(criteria) == 'waveform' ) then ! full waveform misfit function - misfit_tmp=weight*sum((m00*syn(iss:iee)-data(isd:ied))**2)/sum(sqrt(syn(iss:iee)**2)*sqrt(data(isd:ied)**2)) + misfit_tmp = weight*sum((m00*syn(iss:iee)-data(isd:ied))**2)/sum(sqrt(syn(iss:iee)**2)*sqrt(data(isd:ied)**2)) else if (trim(criteria) == 'phase_amplitude' ) then ! phase and amplitude misfit function - deltaT=deltaT0-t00 - syn_m0=syn*m00 - deltaA=0.5*log(sum(data(isd:ied)*data(isd:ied))/sum(syn_m0(iss:iee)*syn_m0(iss:iee))) + deltaT = deltaT0-t00 + syn_m0 = syn*m00 + deltaA = 0.5*log(sum(data(isd:ied)*data(isd:ied))/sum(syn_m0(iss:iee)*syn_m0(iss:iee))) - misfit_tmp=weight*(fact_tt*(deltaT**2)+fact_am*(deltaA**2)) + misfit_tmp = weight*(fact_tt*(deltaT**2)+fact_am*(deltaA**2)) else stop 'wrong criteria for misfit function, check input parameters' endif @@ -201,20 +201,20 @@ program xgrid_search_time_moment enddo close(1004) - t_cmt_new=t_cmt+t0_best + t_cmt_new = t_cmt+t0_best ! several criteria to negelect selected parameters ! 1. if number of window smaller than 10 ! 2. if new original time is smaller than 0.0 ! 3. for scale moment, only use perturbation linesearch_mbest since its large covariance if (nf < 10 ) then - t0_best=0.0 - m0_best=1.0 + t0_best = 0.0 + m0_best = 1.0 endif if ( t_cmt_new < 0.0 ) then - t0_best=0.0 - m0_best=1.0 + t0_best = 0.0 + m0_best = 1.0 endif m0_best=1.0+(m0_best-1.0)*linesearch_mbest @@ -334,7 +334,7 @@ subroutine write_new_cmtsolution(cmt_file,new_cmt_file,t0_best,m0_best) character(len=*),intent(in):: cmt_file,new_cmt_file real,intent(in):: t0_best,m0_best - integer,parameter:: IOCMT=1009 + integer,parameter:: IOCMT = 1009 character(len=150):: pde_time,event_name,str_tshift,str_hdur,str_lat,str_lon,str_dep real:: t_cmt, t_cmt_new @@ -380,7 +380,7 @@ subroutine write_new_cmtsolution(cmt_file,new_cmt_file,t0_best,m0_best) ! calculate new t0 and Mij !t_cmt_new=t_cmt - t_cmt_new=t_cmt+t0_best + t_cmt_new = t_cmt+t0_best moment_tensor_new(:)=moment_tensor(:)*m0_best ! write out new CMTSOLUTION diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/gll_library.f90 index 24854b241..2ae4d741a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/gll_library.f90 @@ -13,7 +13,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -39,7 +39,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -65,7 +65,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -91,7 +91,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -118,7 +118,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -176,7 +176,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -184,11 +184,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -199,9 +199,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -250,7 +250,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -381,7 +381,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -408,7 +408,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -451,7 +451,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -478,7 +478,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -515,7 +515,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/lagrange_poly.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/lagrange_poly.f90 index 79224d9a0..8f0b6974a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/lagrange_poly.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/lagrange_poly.f90 @@ -11,11 +11,11 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) integer dgr,i,j double precision prod1,prod2 - do dgr=1,NGLL + do dgr = 1,NGLL prod1 = 1.0d0 prod2 = 1.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then prod1 = prod1*(xi-xigll(i)) prod2 = prod2*(xigll(dgr)-xigll(i)) @@ -24,10 +24,10 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) h(dgr)=prod1/prod2 hprime(dgr)=0.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then - prod1=1.0d0 - do j=1,NGLL + prod1 = 1.0d0 + do j = 1,NGLL if (j /= dgr .and. j /= i) prod1 = prod1*(xi-xigll(j)) enddo hprime(dgr) = hprime(dgr)+prod1 diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/numerical_recipes.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/numerical_recipes.f90 index 8187c265d..37cef4c87 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/numerical_recipes.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/numerical_recipes.f90 @@ -33,10 +33,10 @@ double precision function gammp(a,x) if (x < a+1.d0) then call gser(gamser,a,x,gln) - gammp=gamser + gammp = gamser else call gcf(gammcf,a,x,gln) - gammp=1.d0-gammcf + gammp = 1.d0-gammcf endif end function gammp @@ -47,8 +47,8 @@ subroutine gcf(gammcf,a,x,gln) double precision a,gammcf,gln,x - double precision, parameter :: EPS=3.d-7,FPMIN=1.d-30 - integer, parameter :: ITMAX=100 + double precision, parameter :: EPS = 3.d-7,FPMIN = 1.d-30 + integer, parameter :: ITMAX = 100 ! this routine uses routine gammln @@ -58,22 +58,22 @@ subroutine gcf(gammcf,a,x,gln) double precision, external :: gammln gln=gammln(a) - b=x+1.d0-a - c=1.d0/FPMIN - d=1.d0/b - h=d - do i=1,ITMAX + b = x+1.d0-a + c = 1.d0/FPMIN + d = 1.d0/b + h = d + do i = 1,ITMAX an=-i*(i-a) - b=b+2.d0 - d=an*d+b - if (dabs(d) < FPMIN)d=FPMIN - c=b+an/c - if (dabs(c) < FPMIN)c=FPMIN - d=1.d0/d - del=d*c - h=h*del + b = b+2.d0 + d = an*d+b + if (dabs(d) < FPMIN)d = FPMIN + c = b+an/c + if (dabs(c) < FPMIN)c = FPMIN + d = 1.d0/d + del = d*c + h = h*del if (dabs(del-1.d0) < EPS) then - gammcf=exp(-x+a*log(x)-gln)*h + gammcf = exp(-x+a*log(x)-gln)*h return endif enddo @@ -88,8 +88,8 @@ subroutine gser(gamser,a,x,gln) double precision a,gamser,gln,x - integer, parameter :: ITMAX=100 - double precision, parameter :: EPS=3.d-7 + integer, parameter :: ITMAX = 100 + double precision, parameter :: EPS = 3.d-7 ! this routine uses routine gammln @@ -102,20 +102,20 @@ subroutine gser(gamser,a,x,gln) if (x <= 0.d0) then if (x < 0.d0) stop 'x < 0 in gser' - gamser=0.d0 + gamser = 0.d0 return endif - ap=a - sumval=1.d0/a - del=sumval + ap = a + sumval = 1.d0/a + del = sumval - do n=1,ITMAX - ap=ap+1.d0 - del=del*x/ap - sumval=sumval+del + do n = 1,ITMAX + ap = ap+1.d0 + del = del*x/ap + sumval = sumval+del if (dabs(del) < dabs(sumval)*EPS) then - gamser=sumval*exp(-x+a*log(x)-gln) + gamser = sumval*exp(-x+a*log(x)-gln) return endif enddo @@ -142,13 +142,13 @@ double precision function gammln(xx) stp = 2.5066282746310005d0 - x=xx - y=x - tmp=x+5.5d0 + x = xx + y = x + tmp = x+5.5d0 tmp=(x+0.5d0)*log(tmp)-tmp - ser=1.000000000190015d0 - do j=1,6 - y=y+1.d0 + ser = 1.000000000190015d0 + do j = 1,6 + y = y+1.d0 ser=ser+cof(j)/y enddo gammln=tmp+log(stp*ser/x) @@ -177,7 +177,7 @@ subroutine spline(x,y,n,yp1,ypn,y2) y2(1)=-0.5d0 u(1)=(3.d0/(x(2)-x(1)))*((y(2)-y(1))/(x(2)-x(1))-yp1) - do i=2,n-1 + do i = 2,n-1 sig=(x(i)-x(i-1))/(x(i+1)-x(i-1)) p=sig*y2(i-1)+2.d0 y2(i)=(sig-1.d0)/p @@ -185,11 +185,11 @@ subroutine spline(x,y,n,yp1,ypn,y2) /(x(i)-x(i-1)))/(x(i+1)-x(i-1))-sig*u(i-1))/p enddo - qn=0.5d0 + qn = 0.5d0 un=(3.d0/(x(n)-x(n-1)))*(ypn-(y(n)-y(n-1))/(x(n)-x(n-1))) y2(n)=(un-qn*u(n-1))/(qn*y2(n-1)+1.d0) - do k=n-1,1,-1 + do k = n-1,1,-1 y2(k)=y2(k)*y2(k+1)+u(k) enddo @@ -212,23 +212,23 @@ subroutine splint(xa,ya,y2a,n,x,y) integer k,klo,khi double precision h,a,b - KLO=1 - KHI=N + KLO = 1 + KHI = N 1 if (KHI-KLO > 1) then K=(KHI+KLO)/2 if (XA(K) > X) then - KHI=K + KHI = K ELSE - KLO=K + KLO = K endif goto 1 endif - H=XA(KHI)-XA(KLO) + H = XA(KHI)-XA(KLO) if (H == 0.d0) stop 'Bad input in spline evaluation' A=(XA(KHI)-X)/H B=(X-XA(KLO))/H - Y=A*YA(KLO)+B*YA(KHI)+((A**3-A)*Y2A(KLO) + (B**3-B)*Y2A(KHI))*(H**2)/6.d0 + Y = A*YA(KLO)+B*YA(KHI)+((A**3-A)*Y2A(KLO) + (B**3-B)*Y2A(KHI))*(H**2)/6.d0 end subroutine splint diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d.f90 index f077f5d77..b183724f6 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d.f90 @@ -354,10 +354,10 @@ program wave2d write(*,*) ' IKER : ', IKER print * print *, ' GLL weights:' - do i=1,NGLLX + do i = 1,NGLLX print *, wxgll(i) enddo - do i=1,NGLLZ + do i = 1,NGLLZ print *, wzgll(i) enddo @@ -378,7 +378,7 @@ program wave2d print *,'origin (LON_MIN, LAT_MIN):' print *, LON_MIN, LAT_MIN print *, ' lon lat utm_x utm_z' - do i=1,4 + do i = 1,4 call utm_geo(xtemp,ztemp,corners_utm_x(i),corners_utm_z(i),UTM_PROJECTION_ZONE,IUTM2LONGLAT) corners_lon(i) = xtemp corners_lat(i) = ztemp @@ -465,7 +465,7 @@ program wave2d ! factor of 2 is because the scalelength is a 1/2 cycle w_scale = 2*pi/(Nfac*2*c0*t_target) - do iglob=1,NGLOB + do iglob = 1,NGLOB c_glob(iglob) = c0 + c0*afac/100.*(sin(x(iglob)*w_scale) * sin(z(iglob)*w_scale)) !c_glob(iglob) = c0 + c0*afac/100. enddo @@ -579,7 +579,7 @@ program wave2d print * print *, 'SoCal events (label, lon, lat, mag):' - do i=1,nevent + do i = 1,nevent write(*,'(i14,3f14.7)') socal_events_lab(i), socal_events_lon(i), socal_events_lat(i), socal_events_mag(i) enddo @@ -617,7 +617,7 @@ program wave2d otime_dat(:) = origin_time_dat ! assign allowable target events to (x_eve_dat, z_eve_dat) - do i=1,nevent + do i = 1,nevent x_eve_dat(i) = x_eve0_dat(ifilter_eve_dat(i)) z_eve_dat(i) = z_eve0_dat(ifilter_eve_dat(i)) enddo @@ -636,7 +636,7 @@ program wave2d print * print *, 'ievent, x, z, iglob, ispec, xi, gamma' - do i=1,nevent + do i = 1,nevent write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_eve_dat(i), z_eve_dat(i), & eglob_dat(i), ispec_eve_dat(i), xi_eve_dat(i), gamma_eve_dat(i) enddo @@ -649,7 +649,7 @@ program wave2d ! used for plotting purposes, so this is fine. print * print *, 'events [x_eve_lon0_dat, z_eve_lat0_dat, x_eve_lon_dat, x_eve_lat_dat, dist (m)]:' - do i=1,nevent + do i = 1,nevent temp1 = x_eve_lon0_dat(ifilter_eve_dat(i)) temp2 = z_eve_lat0_dat(ifilter_eve_dat(i)) temp3 = x_eve_lon_dat(i) @@ -753,7 +753,7 @@ program wave2d print * print *, 'ievent, x, z, iglob, ispec, xi, gamma' - do i=1,nevent + do i = 1,nevent write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_eve(i), z_eve(i), & eglob(i), ispec_eve(i), xi_eve(i), gamma_eve(i) enddo @@ -764,7 +764,7 @@ program wave2d ! display target events and perturbed events -- and the distance between (in meters) print * print *, 'events [x_eve_lon_dat, z_eve_lat_dat, x_eve_lon, x_eve_lat, dist (m)]:' - do i=1,nevent + do i = 1,nevent temp1 = x_eve_lon_dat(i) temp2 = z_eve_lat_dat(i) temp3 = x_eve_lon(i) @@ -899,7 +899,7 @@ program wave2d allocate(ispec_rec(nrec),xi_rec(nrec),gamma_rec(nrec)) ! assign allowable target receivers to (x_rec, z_rec) - do i=1,nrec + do i = 1,nrec x_rec(i) = x_rec0(ifilter_rec(i)) z_rec(i) = z_rec0(ifilter_rec(i)) enddo @@ -910,7 +910,7 @@ program wave2d print * print *, 'irec, x, z, iglob, ispec, xi, gamma' - do i=1,nrec + do i = 1,nrec write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_rec(i), z_rec(i), rglob(i), ispec_rec(i), xi_rec(i), gamma_rec(i) enddo @@ -922,7 +922,7 @@ program wave2d ! used for plotting purposes, so this is fine. print * print *, ' receivers [x_rec_lon0, z_rec_lat0, x_rec_lon, x_rec_lat, dist (m)] :' - do i=1,nrec + do i = 1,nrec temp1 = x_rec_lon0(ifilter_rec(i)) temp2 = z_rec_lat0(ifilter_rec(i)) temp3 = x_rec_lon(i) @@ -1035,7 +1035,7 @@ program wave2d allocate(x_recf(nrecf),z_recf(nrecf),fglob(nrecf)) ! assign allowable target receivers to (x_rec, z_rec) - do i=1,nrecf + do i = 1,nrecf x_recf(i) = x_recf0(ifilter_recf(i)) z_recf(i) = z_recf0(ifilter_recf(i)) !print *, i, x_recf(i), z_recf(i) @@ -1136,7 +1136,7 @@ program wave2d enddo open(88,file=trim(out_dir2)//'scale_source.dat',status='unknown') - do i=1,nmod_src + do i = 1,nmod_src write(88,'(1e24.12)') m_scale_src(i) enddo close(88) @@ -1161,7 +1161,7 @@ program wave2d enddo open(88,file=trim(out_dir2)//'initial_model_vector.dat',status='unknown') - do i=1,nmod + do i = 1,nmod write(88,'(1e24.12)') m0_vec(i) enddo close(88) @@ -1363,7 +1363,7 @@ program wave2d endif ! ISRC_SPACE - do i=1,nsrc + do i = 1,nsrc print *, x_src_lon0(i), z_src_lat0(i) enddo @@ -1397,7 +1397,7 @@ program wave2d allocate(ispec_src(nsrc),xi_src(nsrc),gamma_src(nsrc)) ! assign allowable target sources to (x_src, z_src) - do i=1,nsrc + do i = 1,nsrc x_src(i) = x_src0(ifilter_src(i)) z_src(i) = z_src0(ifilter_src(i)) enddo @@ -1407,7 +1407,7 @@ program wave2d call locate_targets(nsrc, x_src, z_src, sglob, ispec_src, xi_src, gamma_src) print * - do i=1,nsrc + do i = 1,nsrc write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_src(i), z_src(i), sglob(i), ispec_src(i), xi_src(i), gamma_src(i) enddo @@ -1419,7 +1419,7 @@ program wave2d ! used for plotting purposes, so this is fine. print * print *, 'sources [x_src_lon0, z_src_lat0, x_src_lon, x_src_lat, dist (m)]:' - do i=1,nsrc + do i = 1,nsrc temp1 = x_src_lon0(ifilter_src(i)) temp2 = z_src_lat0(ifilter_src(i)) temp3 = x_src_lon(i) @@ -1511,7 +1511,7 @@ program wave2d call locate_targets(nsrc, x_src, z_src, sglob, ispec_src, xi_src, gamma_src) print * - do i=1,nsrc + do i = 1,nsrc write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_src(i), z_src(i), sglob(i), ispec_src(i), xi_src(i), gamma_src(i) write(*,'(i8,2e18.8,2i8,2e18.8)') i, x_src_dat(i), z_src_dat(i), & sglob_dat(i), ispec_src_dat(i), xi_src_dat(i), gamma_src_dat(i) @@ -1538,7 +1538,7 @@ program wave2d ! source for data and source for synthetic print * print *, 'sources [x_src_lon_dat, z_src_lat_dat, x_src_lon, z_src_lat, dist (m)]:' - do i=1,nsrc + do i = 1,nsrc temp1 = x_src_lon_dat(i) temp2 = z_src_lat_dat(i) temp3 = x_src_lon(i) @@ -1618,7 +1618,7 @@ program wave2d write(*,*) 'Event #', ievent, ', Source #', i write(*,*) ' actual location : ', sngl(x_src_lon(i)), ', ', sngl(z_src_lat(i)) write(*,*) ' closest GLL gridpoint : ', sngl(x_lon(sglob(i))), ', ', sngl(z_lat(sglob(i))) - do itime=1,NSTEP + do itime = 1,NSTEP write(12,'(1f16.6,1e16.6)') ti(itime), samp_dat(itime,icomp,i) enddo close(12) @@ -1670,7 +1670,7 @@ program wave2d write(12,'(a,2f12.6,i10)') ('S ', x_lon(sglob(i)), z_lat(sglob(i)), i, i=1,nsrc) else ! finite area source - do i=1,nsrc + do i = 1,nsrc d = sqrt((x(sglob(i)) - xcen)**2+(z(sglob(i)) - zcen)**2) if ( d > s_radius-dh) then ! get outermost sources write(12,'(a,2f12.6,i10)') 'S ', x_lon(sglob(i)), z_lat(sglob(i)), i @@ -1819,7 +1819,7 @@ program wave2d ! but narrow enough to exclude suprious boundary reflections print * print *, 'cut times for adjoint sources' - do i=1,nrec + do i = 1,nrec d = sqrt( (x(sglob(1)) - x(rglob(i)))**2 + (z(sglob(1)) - z(rglob(i)))**2 ) tcen = tshift + d/c0 @@ -1867,7 +1867,7 @@ program wave2d print *,'chi-tot = ', sum(chi(ievent,:,1,1)) print *,'---------------------------' open(19,file=trim(out_dir)//'chi_r.dat',status='unknown') - do irec=1,nrec + do irec = 1,nrec write(19,'(3e16.6)') x_lon(rglob(irec)), z_lat(rglob(irec)), chi(ievent,irec,1,1) enddo close(19) @@ -1989,7 +1989,7 @@ program wave2d ! summed chi value for each event (nevent by 1) open(19,file=trim(out_dir1)//'summed_chi_e.dat',status='unknown') - do ievent=1,nevent + do ievent = 1,nevent write(19,*) sngl( sum(chi(ievent,:,1,1)) ) !write(19,*) chi_etot(ievent) enddo @@ -1997,7 +1997,7 @@ program wave2d ! summed chi value for each receiver (nrec by 1) open(19,file=trim(out_dir1)//'summed_chi_r.dat',status='unknown') - do irec=1,nrec + do irec = 1,nrec write(19,'(3e16.6)') x_lon(rglob0(irec)), z_lat(rglob0(irec)), sngl( sum(chi(:,irec,1,1)) ) enddo close(19) @@ -2039,7 +2039,7 @@ program wave2d ! summed kernel for all events (NGLOB by 1) open(19,file=trim(out_dir1)//'summed_ker.dat',status='unknown') - do iglob=1,NGLOB + do iglob = 1,NGLOB write(19,'(3e16.6)') x_lon(iglob), z_lat(iglob), sngl(kernel_basis_sum(iglob)) enddo close(19) @@ -2247,7 +2247,7 @@ program wave2d !mt(:) = m0(:) + lam_t_val * pk(:) / da(:) ! structure only (g = K da) itest = 1 - do i=1,nmod + do i = 1,nmod if (i <= nmod_str) then ! structure ! get the new (test) structure model in terms of fractional perturbation @@ -2357,7 +2357,7 @@ program wave2d m0(:) = m0(:) + lam_0_val * pk(:) itest = 0 - do i=1,nmod + do i = 1,nmod if (i <= nmod_str) then ! structure ! get the new structure model in terms of fractional perturbation diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_cmap.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_cmap.f90 index 1c3db490e..101f4c39f 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_cmap.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_cmap.f90 @@ -102,10 +102,10 @@ program wave2d_cmap write(*,*) ' IKER : ', IKER print * print *, ' GLL weights:' - do i=1,NGLLX + do i = 1,NGLLX print *, wxgll(i) enddo - do i=1,NGLLZ + do i = 1,NGLLZ print *, wzgll(i) enddo @@ -288,7 +288,7 @@ program wave2d_cmap k_smooth_global(iglob) = sum( k_temp(:,:,:) ) / k_gaus_int_global(iglob) enddo - do i=1,NGLOB + do i = 1,NGLOB print *, k_gaus_int_global(i) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_constants.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_constants.f90 index df3824be9..86994f285 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_constants.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_constants.f90 @@ -179,7 +179,7 @@ module wave2d_constants double precision, parameter :: FNORM = 1.0d10 ! factors from the multitaper method - integer, parameter :: MAXTAPER=5, NDIM=8000*4, lnpt=14, npt=2**lnpt - double precision, parameter :: wtr=0.02, ZZIGN=-1.0 + integer, parameter :: MAXTAPER = 5, NDIM = 8000*4, lnpt = 14, npt = 2**lnpt + double precision, parameter :: wtr = 0.02, ZZIGN=-1.0 end module wave2d_constants diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_define_der_matrices.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_define_der_matrices.f90 index 6b5cb6d9b..2451264f3 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_define_der_matrices.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_define_der_matrices.f90 @@ -41,20 +41,20 @@ subroutine define_derivative_matrices(xigll,zigll,wxgll,wzgll,hprime_xx,hprime_z ! calculate derivatives of the Lagrange polynomials ! and precalculate some products in double precision ! hprime(i,j) = h'_i(xigll_j) by definition of the derivative matrix - do i1=1,NGLLX - do i2=1,NGLLX + do i1 = 1,NGLLX + do i2 = 1,NGLLX hprime_xx(i1,i2) = lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX) enddo enddo - do k1=1,NGLLZ - do k2=1,NGLLZ + do k1 = 1,NGLLZ + do k2 = 1,NGLLZ hprime_zz(k1,k2) = lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ) enddo enddo - do i=1,NGLLX - do k=1,NGLLZ + do i = 1,NGLLX + do k = 1,NGLLZ wgllwgll_xz(i,k) = wxgll(i)*wzgll(k) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub.f90 index 378e5fe0e..55a799148 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub.f90 @@ -204,7 +204,7 @@ subroutine taper_series(x,nt) ! KEY COMMAND: power of polynomial taper ! higher power means affecting only the ends of the series - pwr = 10 ! Welch : pwr=2 + pwr = 10 ! Welch : pwr = 2 ! Welch taper (in time) do i = 1,nt @@ -318,7 +318,7 @@ subroutine write_spectral_map(seis, nrec, rglob, seis_name, write_spectra) integer :: i, irec, icomp, itime ! frequency domain - integer, parameter :: FFTW_FORWARD=-1, FFTW_ESTIMATE=0 + integer, parameter :: FFTW_FORWARD=-1, FFTW_ESTIMATE = 0 complex*16 :: out(NOUT) double precision :: in(NSTEP),ti(NSTEP) integer :: plan diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub2.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub2.f90 index 55b2d8b2e..a3756758d 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub2.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub2.f90 @@ -50,11 +50,11 @@ subroutine locate_targets(nrec, x_target, z_target, & i_xi_gamma = present(ispec_selected_rec) .and. present(xi_receiver) .and. present(gamma_receiver) ! loop over target points to get the (xi,gamma) for the closest gridpoint - do irec=1,nrec + do irec = 1,nrec dmin = sqrt(LENGTH**2+HEIGHT**2) ! max possible distance - do ispec=1,NSPEC + do ispec = 1,NSPEC ! loop only on points inside the element ! exclude edges to ensure this point is not shared with other elements @@ -186,7 +186,7 @@ subroutine locate_targets(nrec, x_target, z_target, & enddo ! irec ! display information - do irec=1,nrec + do irec = 1,nrec if (final_distance(irec) == HUGEVAL) stop 'error locating receiver' @@ -297,11 +297,11 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) !--------------------------------------------- - do dgr=1,NGLL + do dgr = 1,NGLL prod1 = 1.0 prod2 = 1.0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then prod1 = prod1*(xi-xigll(i)) prod2 = prod2*(xigll(dgr)-xigll(i)) @@ -310,10 +310,10 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) h(dgr)=prod1/prod2 hprime(dgr)=0.0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then - prod1=1.0 - do j=1,NGLL + prod1 = 1.0 + do j = 1,NGLL if (j /= dgr .and. j /= i) prod1 = prod1*(xi-xigll(j)) enddo hprime(dgr) = hprime(dgr)+prod1 @@ -578,14 +578,14 @@ subroutine mesh_geo(npt,rlon,rlat,rx,rz,UTM_PROJECTION_ZONE,iway) integer i if (iway == ILONLAT2MESH) then ! lon-lat to mesh coordinates - do i=1,npt + do i = 1,npt call utm_geo(rlon(i),rlat(i),xtemp,ztemp,UTM_PROJECTION_ZONE,ILONGLAT2UTM) rx(i) = xtemp - utm_xmin rz(i) = ztemp - utm_zmin enddo else ! mesh coordinates to lon-lat - do i=1,npt + do i = 1,npt xtemp = rx(i) + utm_xmin ztemp = rz(i) + utm_zmin call utm_geo(rlon(i),rlat(i),xtemp,ztemp,UTM_PROJECTION_ZONE,IUTM2LONGLAT) @@ -634,12 +634,12 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway) integer UTM_PROJECTION_ZONE,iway double precision rx,ry,rlon,rlat - double precision, parameter :: degrad=PI/180., raddeg=180./PI - double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 original uses this one + double precision, parameter :: degrad = PI/180., raddeg = 180./PI + double precision, parameter :: semimaj = 6378206.4d0, semimin = 6356583.8d0 ! Clarke 1866 original uses this one !double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 double precision, parameter :: scfa=.9996 - double precision, parameter :: north=0., east=500000. + double precision, parameter :: north = 0., east = 500000. double precision e2,e4,e6,e8,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub3.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub3.f90 index 4cc501ad4..3401f752a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub3.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/gji_paper/codes_18_06Aug2006/wave2d_sub3.f90 @@ -87,7 +87,7 @@ subroutine mtm_adj(ipick, ievent, nrec, syn, tstart, tend, adj_syn, data) nlen = iend - istart ! create the time-windowed records for which the measurement is made - do itime=1,NSTEP + do itime = 1,NSTEP dzr(itime) = syn(itime,icomp,irec) ! synthetic dzr2(itime) = data(itime,icomp,irec) ! data enddo @@ -440,7 +440,7 @@ subroutine mtm_adj(ipick, ievent, nrec, syn, tstart, tend, adj_syn, data) qwc_adj(:) = cmplx(0,0) ! compute pj(w) and qj(w) -- j term is in top_p - do i=1,i_right + do i = 1,i_right omega = twopi*df*i ! omega not =0 ! NOTE SIGN @@ -600,55 +600,55 @@ subroutine clogc(n,xi,zzign,dt) integer :: lblock,k,fk,jh,ii,istart integer :: l,iblock,nblock,i,lbhalf,j,lx - zign=zzign + zign = zzign if (zign >= 0.) then - zign=1. + zign = 1. else zign=-1. endif - lx=2**n - do 1 i=1,n + lx = 2**n + do 1 i = 1,n 1 m(i)=2**(n-i) - do 4 l=1,n + do 4 l = 1,n nblock=2**(l-1) - lblock=lx/nblock - lbhalf=lblock/2 - k=0 - do 4 iblock=1,nblock - fk=k - flx=lx - v=zign*2.*PI*fk/flx - wk=cmplx(cos(v),sin(v)) + lblock = lx/nblock + lbhalf = lblock/2 + k = 0 + do 4 iblock = 1,nblock + fk = k + flx = lx + v = zign*2.*PI*fk/flx + wk = cmplx(cos(v),sin(v)) istart=lblock*(iblock-1) - do 2 i=1,lbhalf - j=istart+i - jh=j+lbhalf + do 2 i = 1,lbhalf + j = istart+i + jh = j+lbhalf q=xi(jh)*wk xi(jh)=xi(j)-q xi(j)=xi(j)+q 2 continue - do 3 i=2,n - ii=i + do 3 i = 2,n + ii = i if (k < m(i)) goto 4 3 k=k-m(i) 4 k=k+m(ii) - k=0 - do 7 j=1,lx + k = 0 + do 7 j = 1,lx if (k < j) goto 5 hold=xi(j) xi(j)=xi(k+1) xi(k+1)=hold - 5 do 6 i=1,n - ii=i + 5 do 6 i = 1,n + ii = i if (k < m(i)) goto 7 6 k=k-m(i) 7 k=k+m(ii) if (zign > 0.) goto 9 - flx=flx*dt - do 8 i=1,lx + flx = flx*dt + do 8 i = 1,lx 8 xi(i)=xi(i)/flx return - 9 do 10 i=1,lx + 9 do 10 i = 1,lx 10 xi(i)=xi(i)*dt return @@ -667,12 +667,12 @@ subroutine ftinv(npow,s,zzign,dt,r) double precision :: dt,zzign,zign integer :: npow, nsmp, nhalf, i - nsmp=2**npow - nhalf=nsmp/2 + nsmp = 2**npow + nhalf = nsmp/2 call rspec(s,nhalf) zign = -1.*zzign call clogc(npow,s,zign,dt) - do 10 i=1,nsmp + do 10 i = 1,nsmp 10 r(i)=real(s(i)) return @@ -688,14 +688,14 @@ subroutine rspec(s,np2) complex*16 :: s(NDIM) integer :: np2,n,n1,i - n=2*np2 - n1=np2+1 + n = 2*np2 + n1 = np2+1 s(n1)=0. ! s(1)=0. s(1)= cmplx( real(s(1)),0.) - do 20 i=1,np2 + do 20 i = 1,np2 20 s(np2+i)=conjg(s(np2+2-i)) return @@ -714,16 +714,16 @@ subroutine remo(ny,nm,nd) integer :: ny, nm, nd, mm if (.not. (nm == 1))goto 23220 - nm=0 + nm = 0 23220 continue - mm=nm + mm = nm if (.not. (mm == 0))goto 23222 return 23222 continue - nm=0 + nm = 0 nd=nd+m(mm) if (.not. (mod(ny,4) == 0 .and. mm > 2))goto 23224 - nd=nd+1 + nd = nd+1 23224 continue return @@ -767,34 +767,34 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) if (nt < 2) return nxi=mod(nt,2) lh=(nt/2)+nxi - lp1=nt+1 - om=2.*PI*fw/nt + lp1 = nt+1 + om = 2.*PI*fw/nt com=cos(om) hn=0.5*dble(lp1) - do 10 i=1,lh + do 10 i = 1,lh a(i)=com*(i-hn)**2 10 w(i)=0.5*dble(i*(nt-i)) if (nxi == 0) then - asav=a(lh)-w(lh) + asav = a(lh)-w(lh) a(lh)=a(lh)+w(lh) - rbd=1./(a(lh)+w(lh-1)) + rbd = 1./(a(lh)+w(lh-1)) else asav=w(lh-1) - rbd=1./(w(lh)+w(lh-1)) + rbd = 1./(w(lh)+w(lh-1)) w(lh-1)=r2*w(lh-1) endif - do 15 i=1,lh + do 15 i = 1,lh a(i+lh)=w(i)*rbd w(i)=a(i+lh)**2 15 a(i)=a(i)*rbd - neven=max0((nev+1)/2,1) - nodd=nev-neven + neven = max0((nev+1)/2,1) + nodd = nev-neven ! Do the even tapers call tsturm(nt,lh,a,a(lh+1),w,neven,v,ndim,w(lh+1),0) - do 20 i=1,neven - k=2*i-1 + do 20 i = 1,neven + k = 2*i-1 if (nxi == 1) v(lh,k)=r2*v(lh,k) - do 20 j=1,lh + do 20 j = 1,lh 20 v(lp1-j,k)=v(j,k) if (nodd <= 0) goto 34 ! Do the odd tapers @@ -805,37 +805,37 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) w(lh-1)=asav*asav endif call tsturm(nt,lh-nxi,a,a(lh+1),w,nodd,v,ndim,w(lh+1),1) - do 30 i=1,nodd - k=2*i + do 30 i = 1,nodd + k = 2*i if (nxi == 1) v(lh,k)=0. - do 30 j=1,lh + do 30 j = 1,lh 30 v(lp1-j,k)=-v(j,k) - 34 ntot=neven+nodd + 34 ntot = neven+nodd ! Calculate bandwidth retention parameters - dc=2.*com - sm=0. + dc = 2.*com + sm = 0. s=sin(om) w(1)=om/PI w(2)=s/PI - do 35 j=3,nt - sn=dc*s-sm - sm=s - s=sn + do 35 j = 3,nt + sn = dc*s-sm + sm = s + s = sn 35 w(j)=s/(PI*(j-1)) - do 55 m=1,ntot - vmax=abs(v(1,m)) - kmax=1 - do 40 kk=2,lh + do 55 m = 1,ntot + vmax = abs(v(1,m)) + kmax = 1 + do 40 kk = 2,lh if (abs(v(kk,m)) <= vmax) goto 40 - kmax=kk - vmax=abs(v(kk,m)) + kmax = kk + vmax = abs(v(kk,m)) 40 continue a(m)=0. - nlow=kmax-1 - do 45 j=1,nlow + nlow = kmax-1 + do 45 j = 1,nlow 45 a(m)=a(m)+w(j+1)*v(nlow+1-j,m) - nup=nt-nlow - do 50 j=1,nup + nup = nt-nlow + do 50 j = 1,nup 50 a(m)=a(m)+w(j)*v(nlow+j,m) 55 a(m)=a(m)/v(kmax,m) return @@ -869,48 +869,48 @@ subroutine tsturm(nt,n,a,b,w,nev,r,ndim,ev,ipar) !------------------------- if (n <= 0 .or. nev <= 0) return - umeps=1.-epsi - do 5 i=1,nev + umeps = 1.-epsi + do 5 i = 1,nev 5 ev(i)=-1. - u=1. - do 1000 ik=1,nev - if (ik > 1) u=ev(ik-1)*umeps - el=min(ev(ik),u) + u = 1. + do 1000 ik = 1,nev + if (ik > 1) u = ev(ik-1)*umeps + el = min(ev(ik),u) 10 elam=0.5*(u+el) if (abs(u-el) <= epsi1) goto 35 - iag=0 + iag = 0 q=a(1)-elam if (q >= 0.) iag=iag+1 - do 15 i=2,n + do 15 i = 2,n if (q == 0.) x=abs(b(i-1))/epsi - if (q /= 0.) x=w(i-1)/q + if (q /= 0.) x = w(i-1)/q q=a(i)-elam-x if (q >= 0.) iag=iag+1 if (iag > nev) goto 20 15 continue if (iag >= ik) goto 20 - u=elam + u = elam goto 10 20 if (iag == ik) goto 30 - m=ik+1 - do 25 i=m,iag + m = ik+1 + do 25 i = m,iag 25 ev(i)=elam - el=elam + el = elam goto 10 - 30 el=elam + 30 el = elam call root(u,el,elam,a,b,w,n,ik) 35 ev(ik)=elam - jk=2*ik+ipar-1 + jk = 2*ik+ipar-1 r(1,jk)=1. r(2,jk)=-(a(1)-ev(ik))/b(1) - ddot=1.+r(2,jk)*r(2,jk) - jm1=2 - do 45 j=3,n + ddot = 1.+r(2,jk)*r(2,jk) + jm1 = 2 + do 45 j = 3,n r(j,jk)=-((a(jm1)-ev(ik))*r(jm1,jk)+b(j-2)*r(j-2,jk))/b(jm1) - ddot=ddot+r(j,jk)*r(j,jk) - 45 jm1=j - rnorm=sqrt(nt/(2.*ddot)) - do 50 j=1,n + ddot = ddot+r(j,jk)*r(j,jk) + 45 jm1 = j + rnorm = sqrt(nt/(2.*ddot)) + do 50 j = 1,n 50 r(j,jk)=r(j,jk)*rnorm 1000 continue return @@ -938,27 +938,27 @@ subroutine root(u,el,elam,a,bb,w,n,ik) 5 elam=0.5*(u+el) 10 if (abs(u-el) <= 1.5*epsi1) return an=a(1)-elam - b=0. + b = 0. bn=-1./an - iag=0 + iag = 0 if (an >= 0.) iag=iag+1 - do 20 i=2,n + do 20 i = 2,n if (an == 0.) x=abs(bb(i-1))/epsi - if (an /= 0.) x=w(i-1)/an + if (an /= 0.) x = w(i-1)/an an=a(i)-elam-x if (an == 0.) an=epsi - bm=b - b=bn + bm = b + b = bn bn=((a(i)-elam)*b-bm*x-1.)/an if (an >= 0.) iag=iag+1 20 continue if (iag == ik) goto 25 - u=elam + u = elam goto 30 - 25 el=elam - 30 del=1./bn + 25 el = elam + 30 del = 1./bn if (abs(del) <= epsi1) del=sign(epsi1,del) - elam=elam-del + elam = elam-del if (elam >= u .or. elam <= el) goto 5 goto 10 diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/gll_library.f90 index 24854b241..2ae4d741a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/gll_library.f90 @@ -13,7 +13,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -39,7 +39,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -65,7 +65,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -91,7 +91,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -118,7 +118,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -176,7 +176,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -184,11 +184,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -199,9 +199,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -250,7 +250,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -381,7 +381,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -408,7 +408,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -451,7 +451,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -478,7 +478,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -515,7 +515,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/lagrange_poly.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/lagrange_poly.f90 index 79224d9a0..8f0b6974a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/lagrange_poly.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/lagrange_poly.f90 @@ -11,11 +11,11 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) integer dgr,i,j double precision prod1,prod2 - do dgr=1,NGLL + do dgr = 1,NGLL prod1 = 1.0d0 prod2 = 1.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then prod1 = prod1*(xi-xigll(i)) prod2 = prod2*(xigll(dgr)-xigll(i)) @@ -24,10 +24,10 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) h(dgr)=prod1/prod2 hprime(dgr)=0.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then - prod1=1.0d0 - do j=1,NGLL + prod1 = 1.0d0 + do j = 1,NGLL if (j /= dgr .and. j /= i) prod1 = prod1*(xi-xigll(j)) enddo hprime(dgr) = hprime(dgr)+prod1 diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/numerical_recipes.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/numerical_recipes.f90 index 8187c265d..37cef4c87 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/numerical_recipes.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/numerical_recipes.f90 @@ -33,10 +33,10 @@ double precision function gammp(a,x) if (x < a+1.d0) then call gser(gamser,a,x,gln) - gammp=gamser + gammp = gamser else call gcf(gammcf,a,x,gln) - gammp=1.d0-gammcf + gammp = 1.d0-gammcf endif end function gammp @@ -47,8 +47,8 @@ subroutine gcf(gammcf,a,x,gln) double precision a,gammcf,gln,x - double precision, parameter :: EPS=3.d-7,FPMIN=1.d-30 - integer, parameter :: ITMAX=100 + double precision, parameter :: EPS = 3.d-7,FPMIN = 1.d-30 + integer, parameter :: ITMAX = 100 ! this routine uses routine gammln @@ -58,22 +58,22 @@ subroutine gcf(gammcf,a,x,gln) double precision, external :: gammln gln=gammln(a) - b=x+1.d0-a - c=1.d0/FPMIN - d=1.d0/b - h=d - do i=1,ITMAX + b = x+1.d0-a + c = 1.d0/FPMIN + d = 1.d0/b + h = d + do i = 1,ITMAX an=-i*(i-a) - b=b+2.d0 - d=an*d+b - if (dabs(d) < FPMIN)d=FPMIN - c=b+an/c - if (dabs(c) < FPMIN)c=FPMIN - d=1.d0/d - del=d*c - h=h*del + b = b+2.d0 + d = an*d+b + if (dabs(d) < FPMIN)d = FPMIN + c = b+an/c + if (dabs(c) < FPMIN)c = FPMIN + d = 1.d0/d + del = d*c + h = h*del if (dabs(del-1.d0) < EPS) then - gammcf=exp(-x+a*log(x)-gln)*h + gammcf = exp(-x+a*log(x)-gln)*h return endif enddo @@ -88,8 +88,8 @@ subroutine gser(gamser,a,x,gln) double precision a,gamser,gln,x - integer, parameter :: ITMAX=100 - double precision, parameter :: EPS=3.d-7 + integer, parameter :: ITMAX = 100 + double precision, parameter :: EPS = 3.d-7 ! this routine uses routine gammln @@ -102,20 +102,20 @@ subroutine gser(gamser,a,x,gln) if (x <= 0.d0) then if (x < 0.d0) stop 'x < 0 in gser' - gamser=0.d0 + gamser = 0.d0 return endif - ap=a - sumval=1.d0/a - del=sumval + ap = a + sumval = 1.d0/a + del = sumval - do n=1,ITMAX - ap=ap+1.d0 - del=del*x/ap - sumval=sumval+del + do n = 1,ITMAX + ap = ap+1.d0 + del = del*x/ap + sumval = sumval+del if (dabs(del) < dabs(sumval)*EPS) then - gamser=sumval*exp(-x+a*log(x)-gln) + gamser = sumval*exp(-x+a*log(x)-gln) return endif enddo @@ -142,13 +142,13 @@ double precision function gammln(xx) stp = 2.5066282746310005d0 - x=xx - y=x - tmp=x+5.5d0 + x = xx + y = x + tmp = x+5.5d0 tmp=(x+0.5d0)*log(tmp)-tmp - ser=1.000000000190015d0 - do j=1,6 - y=y+1.d0 + ser = 1.000000000190015d0 + do j = 1,6 + y = y+1.d0 ser=ser+cof(j)/y enddo gammln=tmp+log(stp*ser/x) @@ -177,7 +177,7 @@ subroutine spline(x,y,n,yp1,ypn,y2) y2(1)=-0.5d0 u(1)=(3.d0/(x(2)-x(1)))*((y(2)-y(1))/(x(2)-x(1))-yp1) - do i=2,n-1 + do i = 2,n-1 sig=(x(i)-x(i-1))/(x(i+1)-x(i-1)) p=sig*y2(i-1)+2.d0 y2(i)=(sig-1.d0)/p @@ -185,11 +185,11 @@ subroutine spline(x,y,n,yp1,ypn,y2) /(x(i)-x(i-1)))/(x(i+1)-x(i-1))-sig*u(i-1))/p enddo - qn=0.5d0 + qn = 0.5d0 un=(3.d0/(x(n)-x(n-1)))*(ypn-(y(n)-y(n-1))/(x(n)-x(n-1))) y2(n)=(un-qn*u(n-1))/(qn*y2(n-1)+1.d0) - do k=n-1,1,-1 + do k = n-1,1,-1 y2(k)=y2(k)*y2(k+1)+u(k) enddo @@ -212,23 +212,23 @@ subroutine splint(xa,ya,y2a,n,x,y) integer k,klo,khi double precision h,a,b - KLO=1 - KHI=N + KLO = 1 + KHI = N 1 if (KHI-KLO > 1) then K=(KHI+KLO)/2 if (XA(K) > X) then - KHI=K + KHI = K ELSE - KLO=K + KLO = K endif goto 1 endif - H=XA(KHI)-XA(KLO) + H = XA(KHI)-XA(KLO) if (H == 0.d0) stop 'Bad input in spline evaluation' A=(XA(KHI)-X)/H B=(X-XA(KLO))/H - Y=A*YA(KLO)+B*YA(KHI)+((A**3-A)*Y2A(KLO) + (B**3-B)*Y2A(KHI))*(H**2)/6.d0 + Y = A*YA(KLO)+B*YA(KHI)+((A**3-A)*Y2A(KLO) + (B**3-B)*Y2A(KHI))*(H**2)/6.d0 end subroutine splint diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/test_smooth.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/test_smooth.f90 index 46b991d61..59d2ac15b 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/test_smooth.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/test_smooth.f90 @@ -136,10 +136,10 @@ program test_smooth write(*,*) ' LENGTH * HEIGHT : ', LENGTH * HEIGHT print * print *, ' GLL weights:' - do i=1,NGLLX + do i = 1,NGLLX print *, wxgll(i) enddo - do i=1,NGLLZ + do i = 1,NGLLZ print *, wzgll(i) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d.f90 index 19664f649..96389da75 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d.f90 @@ -473,7 +473,7 @@ program wave2d !============================================ ! KEY COMMAND: scalelength of checker for velocity models (1,2,3) - Nfac = 3 ! use Nfac=3 for one-source examples + Nfac = 3 ! use Nfac = 3 for one-source examples if (READ_IN) then irun0 = IRUNZ @@ -2069,11 +2069,11 @@ program wave2d close(19) open(unit=19,file=trim(out_dir2)//'scaling_values_covm.dat',status='unknown') - do i=1,NVAR + do i = 1,NVAR write(19,*) 'covm_weight_parts', covm_weight_parts(i) enddo write(19,*) 'sum_covm_weight_parts', sum(covm_weight_parts) - do i=1,NVAR + do i = 1,NVAR write(19,*) 'covg_weight_parts', covg_weight_parts(i) enddo write(19,*) 'sum_covg_weight_parts', sum(covg_weight_parts) @@ -2822,7 +2822,7 @@ program wave2d write(*,*) ' closest GLL gridpoint : ', sngl(x(sglob(i))), ', ', sngl(z(sglob(i))) !write(*,*) ' actual location : ', sngl(x_src_lon(i)), ', ', sngl(z_src_lat(i)) !write(*,*) ' closest GLL gridpoint : ', sngl(x_lon(sglob(i))), ', ', sngl(z_lat(sglob(i))) - do itime=1,NSTEP + do itime = 1,NSTEP write(12,'(1f16.6,1e16.6)') ti(itime), samp_dat(itime,icomp,i) enddo close(12) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_cmap.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_cmap.f90 index 1c3db490e..101f4c39f 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_cmap.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_cmap.f90 @@ -102,10 +102,10 @@ program wave2d_cmap write(*,*) ' IKER : ', IKER print * print *, ' GLL weights:' - do i=1,NGLLX + do i = 1,NGLLX print *, wxgll(i) enddo - do i=1,NGLLZ + do i = 1,NGLLZ print *, wzgll(i) enddo @@ -288,7 +288,7 @@ program wave2d_cmap k_smooth_global(iglob) = sum( k_temp(:,:,:) ) / k_gaus_int_global(iglob) enddo - do i=1,NGLOB + do i = 1,NGLOB print *, k_gaus_int_global(i) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_define_der_matrices.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_define_der_matrices.f90 index 6b5cb6d9b..2451264f3 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_define_der_matrices.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_define_der_matrices.f90 @@ -41,20 +41,20 @@ subroutine define_derivative_matrices(xigll,zigll,wxgll,wzgll,hprime_xx,hprime_z ! calculate derivatives of the Lagrange polynomials ! and precalculate some products in double precision ! hprime(i,j) = h'_i(xigll_j) by definition of the derivative matrix - do i1=1,NGLLX - do i2=1,NGLLX + do i1 = 1,NGLLX + do i2 = 1,NGLLX hprime_xx(i1,i2) = lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX) enddo enddo - do k1=1,NGLLZ - do k2=1,NGLLZ + do k1 = 1,NGLLZ + do k2 = 1,NGLLZ hprime_zz(k1,k2) = lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ) enddo enddo - do i=1,NGLLX - do k=1,NGLLZ + do i = 1,NGLLX + do k = 1,NGLLZ wgllwgll_xz(i,k) = wxgll(i)*wzgll(k) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub.f90 index 3c6d71a41..6b9fb6804 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub.f90 @@ -440,7 +440,7 @@ subroutine taper_series(x,nt) ! KEY COMMAND: power of polynomial taper ! higher power means affecting only the ends of the series - pwr = 10 ! Welch : pwr=2 + pwr = 10 ! Welch : pwr = 2 ! Welch taper (in time) do i = 1,nt diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub2.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub2.f90 index 239a029a2..58e17291d 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub2.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/SEM2D_iterate/src/wave2d_sub2.f90 @@ -50,11 +50,11 @@ subroutine locate_targets(nrec, x_target, z_target, & i_xi_gamma = present(ispec_selected_rec) .and. present(xi_receiver) .and. present(gamma_receiver) ! loop over target points to get the (xi,gamma) for the closest gridpoint - do irec=1,nrec + do irec = 1,nrec dmin = sqrt(LENGTH**2+HEIGHT**2) ! max possible distance - do ispec=1,NSPEC + do ispec = 1,NSPEC ! loop only on points inside the element ! exclude edges to ensure this point is not shared with other elements @@ -186,7 +186,7 @@ subroutine locate_targets(nrec, x_target, z_target, & enddo ! irec ! display information - do irec=1,nrec + do irec = 1,nrec if (final_distance(irec) == HUGEVAL) stop 'error locating receiver' @@ -297,11 +297,11 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) !--------------------------------------------- - do dgr=1,NGLL + do dgr = 1,NGLL prod1 = 1.0 prod2 = 1.0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then prod1 = prod1*(xi-xigll(i)) prod2 = prod2*(xigll(dgr)-xigll(i)) @@ -310,10 +310,10 @@ subroutine lagrange_poly(xi,NGLL,xigll,h,hprime) h(dgr)=prod1/prod2 hprime(dgr)=0.0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then - prod1=1.0 - do j=1,NGLL + prod1 = 1.0 + do j = 1,NGLL if (j /= dgr .and. j /= i) prod1 = prod1*(xi-xigll(j)) enddo hprime(dgr) = hprime(dgr)+prod1 @@ -590,14 +590,14 @@ subroutine mesh_geo(npt,rlon,rlat,rx,rz,UTM_PROJECTION_ZONE,iway) integer i if (iway == ILONLAT2MESH) then ! lon-lat to mesh coordinates - do i=1,npt + do i = 1,npt call utm_geo(rlon(i),rlat(i),xtemp,ztemp,UTM_PROJECTION_ZONE,ILONGLAT2UTM) rx(i) = xtemp - utm_xmin rz(i) = ztemp - utm_zmin enddo else ! mesh coordinates to lon-lat - do i=1,npt + do i = 1,npt xtemp = rx(i) + utm_xmin ztemp = rz(i) + utm_zmin call utm_geo(rlon(i),rlat(i),xtemp,ztemp,UTM_PROJECTION_ZONE,IUTM2LONGLAT) @@ -646,12 +646,12 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway) integer UTM_PROJECTION_ZONE,iway double precision rx,ry,rlon,rlat - double precision, parameter :: degrad=PI/180., raddeg=180./PI + double precision, parameter :: degrad = PI/180., raddeg = 180./PI !double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 - double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 + double precision, parameter :: semimaj = 6378137.0d0, semimin = 6356752.314245d0 ! WGS-84 double precision, parameter :: scfa=.9996 - double precision, parameter :: north=0., east=500000. + double precision, parameter :: north = 0., east = 500000. double precision e2,e4,e6,e8,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/cg_test.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/cg_test.f90 index 565b2dd04..40cfcf931 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/cg_test.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/cg_test.f90 @@ -9,8 +9,8 @@ program cg_test ! ====================================================== ! integer, parameter :: NSLICES=168 - integer, parameter :: NSPEC=NSPEC_AB - integer, parameter :: NGLOB=NGLOB_AB + integer, parameter :: NSPEC = NSPEC_AB + integer, parameter :: NGLOB = NGLOB_AB character(len=150) :: sline, k_file, kernel_name logical :: global_code @@ -104,9 +104,9 @@ program cg_test call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/cg_step/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/model_pert.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/model_pert.f90 index 9a774ded0..5f2d32ab0 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/model_pert.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_pert/src/model_pert.f90 @@ -8,7 +8,7 @@ program model_pert ! ====================================================== - integer, parameter :: NSPEC=NSPEC_AB + integer, parameter :: NSPEC = NSPEC_AB character(len=150) :: sline, m_file, fname character(len=150) :: ftag_file_list, ftag_list(10) @@ -22,7 +22,7 @@ program model_pert call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ier) ! read in list of file tags - nfile=0 + nfile = 0 open(unit=20, file='INPUT/ftags', status='old',iostat=ios) if (ios /= 0) then print *,'Error opening ',trim(ftag_file_list) @@ -31,7 +31,7 @@ program model_pert do while (1 == 1) read(20,'(a)',iostat=ios) sline if (ios /= 0) exit - nfile=nfile+1 + nfile = nfile+1 ftag_list(nfile) = sline enddo close(20) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/locate_receivers.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/locate_receivers.f90 index 26e3546e7..eb2252f9d 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/locate_receivers.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/locate_receivers.f90 @@ -191,10 +191,10 @@ subroutine locate_receivers(ibool,myrank,NSPEC_AB,NGLOB_AB, & allocate(final_distance_all(nrec,0:NPROC-1)) ! loop on all the stations - do irec=1,nrec + do irec = 1,nrec ! set distance to huge initial value - distmin=HUGEVAL + distmin = HUGEVAL read(1,*,iostat=ios) station_name(irec),network_name(irec),stlat(irec),stlon(irec),stele(irec),stbur(irec) if (ios /= 0) call exit_mpi(myrank, 'Error reading station file '//trim(rec_filename)) @@ -278,16 +278,16 @@ subroutine locate_receivers(ibool,myrank,NSPEC_AB,NGLOB_AB, & ! examine top of the elements only (receivers always at the surface) ! k = NGLLZ - do ispec=1,NSPEC_AB + do ispec = 1,NSPEC_AB ! modification by Qinya Liu: idoubling is no longer used because receivers can now be in depth ! (in previous versions, receivers were always assumed to be at the surface) ! loop only on points inside the element ! exclude edges to ensure this point is not shared with other elements - do k=2,NGLLZ-1 - do j=2,NGLLY-1 - do i=2,NGLLX-1 + do k = 2,NGLLZ-1 + do j = 2,NGLLY-1 + do i = 2,NGLLX-1 iglob = ibool(i,j,k,ispec) dist = dsqrt((x_target(irec)-dble(xstore(iglob)))**2 & @@ -333,7 +333,7 @@ subroutine locate_receivers(ibool,myrank,NSPEC_AB,NGLOB_AB, & ! define coordinates of the control points of the element - do ia=1,NGNOD + do ia = 1,NGNOD if (iaddx(ia) == 0) then iax = 1 @@ -489,7 +489,7 @@ subroutine locate_receivers(ibool,myrank,NSPEC_AB,NGLOB_AB, & final_distance(irec) = distmin enddo - do irec=1,nrec + do irec = 1,nrec write(IMAIN,*) write(IMAIN,*) 'station # ',irec,' ',station_name(irec),network_name(irec) @@ -542,7 +542,7 @@ subroutine locate_receivers(ibool,myrank,NSPEC_AB,NGLOB_AB, & ! write the list of stations and associated epicentral distance open(unit=27,file=trim(OUTPUT_FILES)//'/output_list_stations.txt',status='unknown') - do irec=1,nrec + do irec = 1,nrec write(27,*) station_name(irec),'.',network_name(irec),' : ',horiz_dist(irec),' km horizontal distance' enddo close(27) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/read_basin_topo_bathy_file.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/read_basin_topo_bathy_file.f90 index aeb38a1f8..61155637b 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/read_basin_topo_bathy_file.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/read_basin_topo_bathy_file.f90 @@ -35,8 +35,8 @@ subroutine read_basin_topo_bathy_file(itopo_bathy_basin,NX_TOPO,NY_TOPO,topo_fil itopo_bathy_basin(:,:) = 0 open(unit=13,file=topo_file,status='old',action='read') - do iy=1,NY_TOPO - do ix=1,NX_TOPO + do iy = 1,NY_TOPO + do ix = 1,NX_TOPO read(13,*) itopo_bathy_basin(ix,iy) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/sem_model_slice.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/sem_model_slice.f90 index 985f9f99a..4583a62f4 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/sem_model_slice.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/sem_model_slice.f90 @@ -41,14 +41,14 @@ program sem_model_slice ! read points to be interpolated open(11,file=xyz_infile,iostat=ios) - i=0 + i = 0 do while (1 == 1) - i=i+1 + i = i+1 read(11,*,iostat=ios) x(i),y(i),z(i) if (ios /= 0) exit enddo close(11) - npts=i-1 + npts = i-1 if (myrank == 0) then if (npts > NMAXPTS .or. npts < 0) call exit_mpi(myrank,'Npts error ...') write(*,*) 'Total number of points = ', npts @@ -84,16 +84,16 @@ program sem_model_slice ! search for local minimum-distance point distmin(1:npts) = HUGEVAL - do ispec=1,NSPEC_AB + do ispec = 1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dist(1:npts)=dsqrt((x(1:npts)-dble(xstore(iglob)))**2 & +(y(1:npts)-dble(ystore(iglob)))**2 & +(z(1:npts)-dble(zstore(iglob)))**2) - do ipt=1,npts + do ipt = 1,npts if (dist(ipt) < distmin(ipt)) then distmin(ipt)=dist(ipt) ispec_min(ipt)=ispec @@ -121,7 +121,7 @@ program sem_model_slice ! enddo ! close(33) - do i=1, npts + do i = 1, npts in(1,i) = distmin(i) in(2,i) = myrank ! myrank is coerced to a double enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/utm_geo.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/utm_geo.f90 index ff9179adb..1a515ca64 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/utm_geo.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_slice/utm_geo.f90 @@ -40,12 +40,12 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT double precision rx,ry,rlon,rlat logical SUPPRESS_UTM_PROJECTION - double precision, parameter :: degrad=PI/180.d0, raddeg=180.d0/PI + double precision, parameter :: degrad = PI/180.d0, raddeg = 180.d0/PI !double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 - double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 + double precision, parameter :: semimaj = 6378137.0d0, semimin = 6356752.314245d0 ! WGS-84 - double precision, parameter :: scfa=0.9996d0 - double precision, parameter :: north=0.d0, east=500000.d0 + double precision, parameter :: scfa = 0.9996d0 + double precision, parameter :: north = 0.d0, east = 500000.d0 double precision e2,e4,e6,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d @@ -70,8 +70,8 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT ! define parameters of reference ellipsoid e2=1.0-(semimin/semimaj)**2.0 - e4=e2*e2 - e6=e2*e4 + e4 = e2*e2 + e6 = e2*e4 ep2=e2/(1.-e2) if (iway == IUTM2LONGLAT) then diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/add_model.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/add_model.f90 index 105f81a96..c2ed78c29 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/add_model.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/add_model.f90 @@ -8,7 +8,7 @@ program add_model ! ====================================================== - integer, parameter :: NSPEC=NSPEC_AB + integer, parameter :: NSPEC = NSPEC_AB logical, parameter :: MINMAX_THRESHOLD_OLD = .false. ! threshold the old model ("current model") logical, parameter :: MINMAX_THRESHOLD_NEW = .true. ! threshold the new model @@ -68,7 +68,7 @@ program add_model !----------------------------------------------------- ! read in list of file tags showing what model iteration you are on - nfile=0 + nfile = 0 open(unit=20, file='INPUT/ftags', status='old',iostat=ios) if (ios /= 0) then print *,'Error opening ',trim(ftag_file_list) @@ -77,7 +77,7 @@ program add_model do while (1 == 1) read(20,'(a)',iostat=ios) sline if (ios /= 0) exit - nfile=nfile+1 + nfile = nfile+1 ftag_list(nfile) = sline enddo close(20) @@ -130,10 +130,10 @@ program add_model ! threshold current model and write out the modified version if (MINMAX_THRESHOLD_OLD) then - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (model_vs(i,j,k,ispec) < VS_MIN) model_vs(i,j,k,ispec) = VS_MIN if (model_vs(i,j,k,ispec) > VS_MAX) model_vs(i,j,k,ispec) = VS_MAX if (model_vp(i,j,k,ispec) < VP_MIN) model_vp(i,j,k,ispec) = VP_MIN @@ -215,10 +215,10 @@ program add_model ! threshold model according to minmax values specified above if (MINMAX_THRESHOLD_NEW) then - do ispec=1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (model_vs_new(i,j,k,ispec) < VS_MIN) model_vs_new(i,j,k,ispec) = VS_MIN if (model_vs_new(i,j,k,ispec) > VS_MAX) model_vs_new(i,j,k,ispec) = VS_MAX if (model_vp_new(i,j,k,ispec) < VP_MIN) model_vp_new(i,j,k,ispec) = VP_MIN diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/model_vp_vs/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/smooth_sem_fun.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/smooth_sem_fun.f90 index fe88ac0fe..cc255cec1 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/smooth_sem_fun.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/smooth/src/smooth_sem_fun.f90 @@ -14,8 +14,8 @@ program smooth_specfem_function ! ====================================================== - integer, parameter :: NSPEC_MAX=NSPEC_AB - integer, parameter :: NGLOB_MAX=NGLOB_AB + integer, parameter :: NSPEC_MAX = NSPEC_AB + integer, parameter :: NGLOB_MAX = NGLOB_AB ! only include the neighboring 3 x 3 slices integer, parameter :: NSLICES = 3 @@ -116,9 +116,9 @@ program smooth_specfem_function call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo @@ -192,7 +192,7 @@ program smooth_specfem_function write(ks_file,'(a,i6.6,a)') trim(scratch_file_dir)//'/proc',myrank,trim(reg_name)//trim(kernel_file_name)//'_smooth.bin' - tk = 0.0; bk = 0.0; kernel_smooth=0.0 + tk = 0.0; bk = 0.0; kernel_smooth = 0.0 ! loop over all the slices do ii = 1, ns diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/subspace_hessian.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/subspace_hessian.f90 index d89b1dc0b..21b813440 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/subspace_hessian.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_hessian/src/subspace_hessian.f90 @@ -9,8 +9,8 @@ program subspace_Hessian ! ====================================================== ! integer, parameter :: NSLICES=168 - integer, parameter :: NSPEC=NSPEC_AB - integer, parameter :: NGLOB=NGLOB_AB + integer, parameter :: NSPEC = NSPEC_AB + integer, parameter :: NGLOB = NGLOB_AB character(len=150) :: kernel_file_list, kernel_list(1000), sline, k_file, kernel_name, kernel_name1, kernel_name2, kdir character(len=150) :: smodel @@ -75,7 +75,7 @@ program subspace_Hessian endif ! read in list of event kernels - nker=0 + nker = 0 open(unit = 20, file = trim(kernel_file_list), status = 'old',iostat = ios) if (ios /= 0) then print *,'Error opening ',trim(kernel_file_list) @@ -84,7 +84,7 @@ program subspace_Hessian do while (1 == 1) read(20,'(a)',iostat=ios) sline if (ios /= 0) exit - nker=nker+1 + nker = nker+1 kernel_list(nker) = sline enddo close(20) @@ -121,9 +121,9 @@ program subspace_Hessian call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA) call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA) call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/gll_library.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/gll_library.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/subspace_update.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/subspace_update.f90 index a6e28f000..5c4bf1135 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/subspace_update.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/subspace_update/src/subspace_update.f90 @@ -8,8 +8,8 @@ program subspace_update ! ====================================================== - integer, parameter :: NSPEC=NSPEC_AB - integer, parameter :: NGLOB=NGLOB_AB + integer, parameter :: NSPEC = NSPEC_AB + integer, parameter :: NGLOB = NGLOB_AB character(len=150) :: kernel_file_list, kernel_list(1000), sline, k_file, kernel_name, dm_file, filename character(len=150) :: dcov_tag, idir, kdir, odir, beta_dir, bulk_dir @@ -73,7 +73,7 @@ program subspace_update ! READ IN FILES ! read in list of event kernels - nsrc=0 + nsrc = 0 open(unit=19,file=trim(kernel_file_list),status='old',iostat=ios) if (ios /= 0) then print *,'Error opening ',trim(kernel_file_list) @@ -82,7 +82,7 @@ program subspace_update do while (1 == 1) read(19,'(a)',iostat=ios) sline if (ios /= 0) exit - nsrc=nsrc+1 + nsrc = nsrc+1 kernel_list(nsrc) = sline enddo close(19) @@ -98,7 +98,7 @@ program subspace_update ! read in the data-norm vector for subspace method if (myrank == 0) write(*,*) 'reading in data_norm' open(unit=22,file=trim(idir)//'data_norm',status='old',iostat=ios) - do i=1,nsrc + do i = 1,nsrc read(22,*) dnorm(i) if (myrank == 0) write(*,*) dnorm(i) enddo @@ -107,7 +107,7 @@ program subspace_update ! read in the number of window picks per event if (myrank == 0) write(*,*) 'reading in window tallies' open(unit=23,file=trim(idir)//'dcov_fac',status='old',iostat=ios) - do i=1,nsrc + do i = 1,nsrc read(23,*) dcov_fac(i) if (myrank == 0) write(*,*) dcov_fac(i) enddo @@ -131,7 +131,7 @@ program subspace_update ! read in the pmax values ! pmax : max singular value for TSVD construction of subspace Hessian - npmax=0 + npmax = 0 open(unit=19,file=trim(idir)//'pmax',status='old',iostat=ios) if (ios /= 0) then print *,'Error opening ',trim(filename) @@ -140,7 +140,7 @@ program subspace_update do while (1 == 1) read(19,*,iostat=ios) ptemp if (ios /= 0) exit - npmax=npmax+1 + npmax = npmax+1 pmax_list(npmax) = ptemp enddo close(19) @@ -173,7 +173,7 @@ program subspace_update if (myrank == 0) write(*,*) 'reading in mu vectors' write(filename,'(a,i3.3)') trim(idir) // 'mu_p', pmax open(unit=20,file=trim(filename),status='old',iostat=ios) - do i=1,nsrc + do i = 1,nsrc read(20,*) mu_beta(i) if (myrank == 0) write(*,*) mu_beta(i) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels.f90 index 2e3d94217..67dfdd1cd 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels.f90 @@ -8,7 +8,7 @@ program sum_kernels ! ====================================================== - integer, parameter :: NSPEC=NSPEC_AB_VAL + integer, parameter :: NSPEC = NSPEC_AB_VAL character(len=150) :: kernel_file_list, kernel_list(1000), sline, k_file, kernel_name, ftagfile, ftag real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: kernel, total_kernel @@ -25,7 +25,7 @@ program sum_kernels ftagfile = 'ftags' ! read in the list of event IDs - nker=0 + nker = 0 open(unit = 20, file = trim(kernel_file_list), status = 'old',iostat = ios) if (ios /= 0) then print *,'Error opening ',trim(kernel_file_list) @@ -34,7 +34,7 @@ program sum_kernels do while (1 == 1) read(20,'(a)',iostat=ios) sline if (ios /= 0) exit - nker=nker+1 + nker = nker+1 kernel_list(nker) = sline enddo close(20) @@ -56,7 +56,7 @@ program sum_kernels !kernel_name = 'mu_kernel_smooth' kernel_name = ftag - total_kernel=0. + total_kernel = 0. do iker = 1, nker if (myrank == 1) write(*,*) 'reading in event kernel for mu: ', iker, ' out of ', nker write(k_file,'(a,i6.6,a)') 'INPUT_KERNELS/'//trim(kernel_list(iker))//'/proc',myrank,'_'//trim(kernel_name)//'.bin' diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels_weight.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels_weight.f90 index a76bb890f..740cde1ca 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels_weight.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/sum_kernel/src/sum_kernels_weight.f90 @@ -8,7 +8,7 @@ program sum_kernels ! ====================================================== - integer, parameter :: NSPEC=NSPEC_AB + integer, parameter :: NSPEC = NSPEC_AB character(len=150) :: kernel_file_list, kernel_list(1000), sline, k_file, kernel_name @@ -30,7 +30,7 @@ program sum_kernels nwin_file_list='m16_window_picks_nwin' ! read in list of kernels - nker=0 + nker = 0 open(unit = 20, file = trim(kernel_file_list), status = 'old',iostat = ios) if (ios /= 0) then print *,'Error opening ',trim(kernel_file_list) @@ -39,7 +39,7 @@ program sum_kernels do while (1 == 1) read(20,'(a)',iostat=ios) sline if (ios /= 0) exit - nker=nker+1 + nker = nker+1 kernel_list(nker) = sline enddo close(20) @@ -67,7 +67,7 @@ program sum_kernels !kernel_name = 'mu_kernel' kernel_name = 'mu_kernel_smooth' - total_kernel=0. + total_kernel = 0. do iker = 1, nker if (myrank == 1) write(*,*) 'reading in event kernel for mu: ', iker, ' out of ', nker write(k_file,'(a,i6.6,a)') 'INPUT_KERNELS/'//trim(kernel_list(iker))//'/proc',myrank,'_'//trim(kernel_name)//'.bin' @@ -90,7 +90,7 @@ program sum_kernels !kernel_name = 'kappa_kernel' kernel_name = 'kappa_kernel_smooth' - total_kernel=0. + total_kernel = 0. do iker = 1, nker if (myrank == 1) write(*,*) 'reading in event kernel for kappa: ', iker, ' out of ', nker write(k_file,'(a,i6.6,a)') 'INPUT_KERNELS/'//trim(kernel_list(iker))//'/proc',myrank,'_'//trim(kernel_name)//'.bin' diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/topo_input/combine_vol_data/combine_vol_data_mod.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/topo_input/combine_vol_data/combine_vol_data_mod.f90 index 9ae3ff340..e2a8c89d2 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/topo_input/combine_vol_data/combine_vol_data_mod.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/iterate_adj/cluster/topo_input/combine_vol_data/combine_vol_data_mod.f90 @@ -163,7 +163,7 @@ program combine_paraview_data call write_integer(npp) endif - do ispec=1,nspec + do ispec = 1,nspec iglob1=ibool(1,1,1,ispec) iglob2=ibool(NGLLX,1,1,ispec) iglob3=ibool(NGLLX,NGLLY,1,ispec) @@ -281,7 +281,7 @@ program combine_paraview_data read(27) zstore close(27) - do ispec=1,nspec + do ispec = 1,nspec do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX @@ -372,7 +372,7 @@ program combine_paraview_data numpoin = 0 mask_ibool = .false. - do ispec=1,nspec + do ispec = 1,nspec do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ascii_rw.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ascii_rw.f90 index abf8b53a1..afa7afb98 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ascii_rw.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ascii_rw.f90 @@ -43,7 +43,7 @@ subroutine drascii(fname,data,npt,b,dt) integer :: ios,i ! get number of lines in the input file - npt=0 + npt = 0 open(10,file=trim(fname),iostat=ios,status='old') if (ios /= 0) then print *,'Error opening ascii file to read: ',trim(fname) @@ -52,13 +52,13 @@ subroutine drascii(fname,data,npt,b,dt) do while (1 == 1) read(10,*,iostat=ios) ttemp, dtemp if (ios /= 0) exit - npt=npt+1 + npt = npt+1 enddo close(10) allocate(ti(npt)) open(10,file=trim(fname),iostat=ios,status='old') - do i=1,npt + do i = 1,npt read(10,*,iostat=ios) ttemp, dtemp ti(i) = ttemp data(i) = dtemp diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub.f90 index d40a06657..957d6e93b 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub.f90 @@ -155,7 +155,7 @@ subroutine mt_measure(datafile,filename,dat_dt,syn_dt,syn_dt_phydisp,t0,dt,npts, call compute_average_error(dat_dtw,syn_dtw_cc,syn_dtw_cc_dt,nlen,dt,sigma_dt_cc,sigma_dlnA_cc) ! write cross-correlation measurement to file - is_mtm_av=2 + is_mtm_av = 2 call write_average_meas(filename,is_mtm_av,tshift,dlnA,sigma_dt_cc,sigma_dlnA_cc) !======================================== @@ -367,7 +367,7 @@ subroutine mt_measure(datafile,filename,dat_dt,syn_dt,syn_dt_phydisp,t0,dt,npts, sigma_dt = sigma_dt_cc ; sigma_dlnA = sigma_dlnA_cc ! write average multitaper measurement to file - is_mtm_av=1 + is_mtm_av = 1 call write_average_meas(filename, is_mtm_av, dtau_wa, dlnA_wa, sigma_dt, sigma_dlnA) !------------------------------------------------------------------------------- @@ -827,19 +827,19 @@ subroutine mt_adj(istart,dat_dtw,syn_dtw,syn_dtw_phydisp,nlen,dt,tshift,dlnA,sig ! waveform if (imeas == 1 .or. imeas == 2) then - tr_adj_src(i1) = -dat_dtw(i)/waveform_d2 * time_window(i) ! imeas=1 + tr_adj_src(i1) = -dat_dtw(i)/waveform_d2 * time_window(i) ! imeas = 1 ! consider normalizing this by waveform_d2 - am_adj_src(i1) = ( syn_dtw(i) - dat_dtw(i) ) * time_window(i) ! imeas=2 + am_adj_src(i1) = ( syn_dtw(i) - dat_dtw(i) ) * time_window(i) ! imeas = 2 ! use pure data waveform in time window if ( NO_WAVEFORM_DIFFERENCE ) then - tr_adj_src(i1) = dat_dtw(i) * time_window(i) ! waveform misfit (imeas=1) + tr_adj_src(i1) = dat_dtw(i) * time_window(i) ! waveform misfit (imeas = 1) endif ! banana-doughnut kernel adjoint source (no measurement) else if (imeas == 3 .or. imeas == 4) then - tr_adj_src(i1) = ft_bar_t(i) * time_window(i) ! imeas=3 - am_adj_src(i1) = fa_bar_t(i) * time_window(i) ! imreas=4 + tr_adj_src(i1) = ft_bar_t(i) * time_window(i) ! imeas = 3 + am_adj_src(i1) = fa_bar_t(i) * time_window(i) ! imreas = 4 ! cross-correlation else if (imeas == 5 .or. imeas == 6) then @@ -1997,59 +1997,59 @@ subroutine get_sacfile_header(data_file,yr,jda,ho,mi,sec,ntw,sta, & call getnhv('nzmin',nsec,nerr) call getnhv('nzmsec',msec,nerr) - sec=nsec+msec/1000.0 + sec = nsec+msec/1000.0 ! string headers call getkhv('knetwk',ntw,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: knetwk' + write(*,*) 'Error reading variable: knetwk' call exit(-1) endif call getkhv('kstnm',sta,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: kstnm' + write(*,*) 'Error reading variable: kstnm' call exit(-1) endif call getkhv('kcmpnm',comp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: kcmpnm' + write(*,*) 'Error reading variable: kcmpnm' call exit(-1) endif ! decimal headers call getfhv('dist',tmp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: dist' + write(*,*) 'Error reading variable: dist' call exit(-1) endif dist = tmp call getfhv('az',tmp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: az' + write(*,*) 'Error reading variable: az' call exit(-1) endif az = tmp call getfhv('baz',tmp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: baz' + write(*,*) 'Error reading variable: baz' call exit(-1) endif baz = tmp call getfhv('stlo',tmp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: stlo' + write(*,*) 'Error reading variable: stlo' call exit(-1) endif slon = tmp call getfhv('stla',tmp,nerr) if (nerr /= 0) then - write(*,*)'Error reading variable: stla' + write(*,*) 'Error reading variable: stla' call exit(-1) endif slat = tmp @@ -2128,7 +2128,7 @@ subroutine setup_weighting(chan_syn) read(21,*,iostat=ios) npairs if (ios /= 0) stop 'Error reading number of pairs of data/syn' ! loops through windows - do ipair=1,npairs + do ipair = 1,npairs ! reads in file names read(21,'(a)',iostat=ios) datafile @@ -2180,7 +2180,7 @@ subroutine setup_weighting(chan_syn) if (ios /= 0) stop 'Error reading windows npicks' ! loops/skips over picks (start/end times) - do ipicks=1,npicks + do ipicks = 1,npicks read(21,*,iostat=ios) tstart, tend if (ios /= 0) stop 'Error reading window pick: tstart and tend' diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub2.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub2.f90 index ccfa3ef56..bb092a9b7 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub2.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/ma_sub2.f90 @@ -5,7 +5,7 @@ module ma_sub2 implicit none ! TOLERRANCE CONTROL - double precision, parameter :: TOL=1e-7 + double precision, parameter :: TOL = 1e-7 contains @@ -41,14 +41,14 @@ subroutine fft(n,xi,zzign,dt) - do 1 i=1,n + do 1 i = 1,n 1 m(i) = 2**(n-i) - do 4 l=1,n + do 4 l = 1,n nblock = 2**(l-1) lblock = lx/nblock lbhalf = lblock/2 k = 0 - do 4 iblock=1,nblock + do 4 iblock = 1,nblock fk = k flx = lx @@ -57,7 +57,7 @@ subroutine fft(n,xi,zzign,dt) wk = cmplx(cos(v),-sin(v)) ! sign change to -sin(v) 17-Nov-2006 istart = lblock*(iblock-1) - do 2 i=1,lbhalf + do 2 i = 1,lbhalf j = istart+i jh = j+lbhalf ! checks bounds @@ -68,20 +68,20 @@ subroutine fft(n,xi,zzign,dt) xi(j) = xi(j)+q 2 continue - do 3 i=2,n + do 3 i = 2,n ii = i if (k < m(i)) goto 4 3 k = k-m(i) 4 k = k+m(ii) k = 0 - do 7 j=1,lx + do 7 j = 1,lx if (k < j) goto 5 hold = xi(j) ! checks bounds if ( k+1 < 1 .or. k+1 > NPT ) stop 'error fft k bounds' xi(j) = xi(k+1) xi(k+1) = hold - 5 do 6 i=1,n + 5 do 6 i = 1,n ii = i if (k < m(i)) goto 7 6 k = k-m(i) @@ -121,7 +121,7 @@ subroutine fftinv(npow,s,zzign,dt,r) nhalf = nsmp/2 call rspec(s,nhalf) ! re-structuring - zign=zzign + zign = zzign call fft(npow,s,zign,dt) ! Fourier transform do i = 1,nsmp @@ -192,34 +192,34 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) if (nt < 2) return nxi=mod(nt,2) lh=(nt/2)+nxi - lp1=nt+1 - om=2.*PI*fw/nt + lp1 = nt+1 + om = 2.*PI*fw/nt com=cos(om) hn=0.5*dble(lp1) - do 10 i=1,lh + do 10 i = 1,lh a(i)=com*(i-hn)**2 10 w(i)=0.5*dble(i*(nt-i)) if (nxi == 0) then - asav=a(lh)-w(lh) + asav = a(lh)-w(lh) a(lh)=a(lh)+w(lh) - rbd=1./(a(lh)+w(lh-1)) + rbd = 1./(a(lh)+w(lh-1)) else asav=w(lh-1) - rbd=1./(w(lh)+w(lh-1)) + rbd = 1./(w(lh)+w(lh-1)) w(lh-1)=r2*w(lh-1) endif - do 15 i=1,lh + do 15 i = 1,lh a(i+lh)=w(i)*rbd w(i)=a(i+lh)**2 15 a(i)=a(i)*rbd - neven=max0((nev+1)/2,1) - nodd=nev-neven + neven = max0((nev+1)/2,1) + nodd = nev-neven ! Do the even tapers call tsturm(nt,lh,a,a(lh+1),w,neven,v,ndim,w(lh+1),0) - do 20 i=1,neven - k=2*i-1 + do 20 i = 1,neven + k = 2*i-1 if (nxi == 1) v(lh,k)=r2*v(lh,k) - do 20 j=1,lh + do 20 j = 1,lh 20 v(lp1-j,k)=v(j,k) if (nodd <= 0) goto 34 ! Do the odd tapers @@ -230,37 +230,37 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) w(lh-1)=asav*asav endif call tsturm(nt,lh-nxi,a,a(lh+1),w,nodd,v,ndim,w(lh+1),1) - do 30 i=1,nodd - k=2*i + do 30 i = 1,nodd + k = 2*i if (nxi == 1) v(lh,k)=0. - do 30 j=1,lh + do 30 j = 1,lh 30 v(lp1-j,k)=-v(j,k) - 34 ntot=neven+nodd + 34 ntot = neven+nodd ! Calculate bandwidth retention parameters - dc=2.*com - sm=0. + dc = 2.*com + sm = 0. s=sin(om) w(1)=om/PI w(2)=s/PI - do 35 j=3,nt - sn=dc*s-sm - sm=s - s=sn + do 35 j = 3,nt + sn = dc*s-sm + sm = s + s = sn 35 w(j)=s/(PI*(j-1)) - do 55 m=1,ntot - vmax=abs(v(1,m)) - kmax=1 - do 40 kk=2,lh + do 55 m = 1,ntot + vmax = abs(v(1,m)) + kmax = 1 + do 40 kk = 2,lh if (abs(v(kk,m)) <= vmax) goto 40 - kmax=kk - vmax=abs(v(kk,m)) + kmax = kk + vmax = abs(v(kk,m)) 40 continue a(m)=0. - nlow=kmax-1 - do 45 j=1,nlow + nlow = kmax-1 + do 45 j = 1,nlow 45 a(m)=a(m)+w(j+1)*v(nlow+1-j,m) - nup=nt-nlow - do 50 j=1,nup + nup = nt-nlow + do 50 j = 1,nup 50 a(m)=a(m)+w(j)*v(nlow+j,m) 55 a(m)=a(m)/v(kmax,m) return @@ -294,48 +294,48 @@ subroutine tsturm(nt,n,a,b,w,nev,r,ndim,ev,ipar) !------------------------- if (n <= 0 .or. nev <= 0) return - umeps=1.-epsi - do 5 i=1,nev + umeps = 1.-epsi + do 5 i = 1,nev 5 ev(i)=-1. - u=1. - do 1000 ik=1,nev - if (ik > 1) u=ev(ik-1)*umeps - el=min(ev(ik),u) + u = 1. + do 1000 ik = 1,nev + if (ik > 1) u = ev(ik-1)*umeps + el = min(ev(ik),u) 10 elam=0.5*(u+el) if (abs(u-el) <= epsi1) goto 35 - iag=0 + iag = 0 q=a(1)-elam if (q >= 0.) iag=iag+1 - do 15 i=2,n + do 15 i = 2,n if (q == 0.) x=abs(b(i-1))/epsi - if (q /= 0.) x=w(i-1)/q + if (q /= 0.) x = w(i-1)/q q=a(i)-elam-x if (q >= 0.) iag=iag+1 if (iag > nev) goto 20 15 continue if (iag >= ik) goto 20 - u=elam + u = elam goto 10 20 if (iag == ik) goto 30 - m=ik+1 - do 25 i=m,iag + m = ik+1 + do 25 i = m,iag 25 ev(i)=elam - el=elam + el = elam goto 10 - 30 el=elam + 30 el = elam call root(u,el,elam,a,b,w,n,ik) 35 ev(ik)=elam - jk=2*ik+ipar-1 + jk = 2*ik+ipar-1 r(1,jk)=1. r(2,jk)=-(a(1)-ev(ik))/b(1) - ddot=1.+r(2,jk)*r(2,jk) - jm1=2 - do 45 j=3,n + ddot = 1.+r(2,jk)*r(2,jk) + jm1 = 2 + do 45 j = 3,n r(j,jk)=-((a(jm1)-ev(ik))*r(jm1,jk)+b(j-2)*r(j-2,jk))/b(jm1) - ddot=ddot+r(j,jk)*r(j,jk) - 45 jm1=j - rnorm=sqrt(nt/(2.*ddot)) - do 50 j=1,n + ddot = ddot+r(j,jk)*r(j,jk) + 45 jm1 = j + rnorm = sqrt(nt/(2.*ddot)) + do 50 j = 1,n 50 r(j,jk)=r(j,jk)*rnorm 1000 continue return @@ -363,27 +363,27 @@ subroutine root(u,el,elam,a,bb,w,n,ik) 5 elam=0.5*(u+el) 10 if (abs(u-el) <= 1.5*epsi1) return an=a(1)-elam - b=0. + b = 0. bn=-1./an - iag=0 + iag = 0 if (an >= 0.) iag=iag+1 - do 20 i=2,n + do 20 i = 2,n if (an == 0.) x=abs(bb(i-1))/epsi - if (an /= 0.) x=w(i-1)/an + if (an /= 0.) x = w(i-1)/an an=a(i)-elam-x if (an == 0.) an=epsi - bm=b - b=bn + bm = b + b = bn bn=((a(i)-elam)*b-bm*x-1.)/an if (an >= 0.) iag=iag+1 20 continue if (iag == ik) goto 25 - u=elam + u = elam goto 30 - 25 el=elam - 30 del=1./bn + 25 el = elam + 30 del = 1./bn if (abs(del) <= epsi1) del=sign(epsi1,del) - elam=elam-del + elam = elam-del if (elam >= u .or. elam <= el) goto 5 goto 10 @@ -467,7 +467,7 @@ end subroutine root !!$ tshift=ishift*dt !!$ !!$! apply time shift to synthetic seismogram -!!$! write(*,*)'shift synth seismogram by ', tshift, 'seconds' +!!$! write(*,*) 'shift synth seismogram by ', tshift, 'seconds' !!$ do i = 1, npts_win !!$ s_cor(i) = 0 !!$ if ( (i1-1+i-ishift) > 1 .and. (i1-1+i-ishift) < npts ) s_cor(i) = s(i1-1+i-ishift) @@ -630,7 +630,7 @@ subroutine costaper(ipoint, ndata, tas) pi = asin(1.0d0)*2 sum = 0. - do i =1,ipoint + do i = 1,ipoint tas(i,1) = 1 - cos( 2*pi*i/ipoint) tas(i,1) = tas(i,1) / sqrt(1.5) enddo @@ -646,7 +646,7 @@ subroutine boxcar(ipoint, ndata, tas) double precision tas(ndata,*) integer i - do i =1,ipoint + do i = 1,ipoint tas(i,1) = 1.0 enddo return diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/measure_adj.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/measure_adj.f90 index e04ace2b2..0bb1d77c7 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/measure_adj.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/measure_adj/measure_adj.f90 @@ -76,7 +76,7 @@ program measure_adj open(12,file='window_index',status='unknown',iostat=ios) open(13,file='window_chi',status='unknown',iostat=ios) - nwin = 0; all_chi=0. + nwin = 0; all_chi = 0. do ipair = 1, npairs data(:) = 0.0 diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj.f90 index d8660e8ca..601cf19f9 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj.f90 @@ -36,9 +36,9 @@ program mtadj ! --- PROGRAM STARTS HERE --- ! read parameter file call read_mtadj_par('MTADJ.PAR') - fstart_dble=fstart - fend_dble=fend_dble - dt_adj_dble=dt_adj + fstart_dble = fstart + fend_dble = fend_dble + dt_adj_dble = dt_adj ! loop over measurement file open(11,file='MEASUREMENT.WINDOWS',status='old',iostat=ios) @@ -47,7 +47,7 @@ program mtadj if (ios /= 0) stop 'Error reading number of pairs of data/syn' - nwin_total=0 + nwin_total = 0 do ipair = 1, npairs ! read data and syn pair @@ -60,9 +60,9 @@ program mtadj call read_data_syn(datafile,synfile,sta,net,chan) ! output file prefix - file_prefix=trim(sta)//'.'//trim(net)//'.'//trim(chan) + file_prefix = trim(sta)//'.'//trim(net)//'.'//trim(chan) - dt_dble=dt + dt_dble = dt ! filter data and synthetics (check xapiir() usage in sac lib) if (BANDPASS) then call xapiir(data,npts,'BU',TRBDNDW,APARM,IORD,'BP',fstart_dble,fend_dble,dt_dble,PASSES) @@ -114,11 +114,11 @@ program mtadj fstart_dble,fend_dble,dt_adj_dble,PASSES) endif if (iker /= IKER_FD) then - adj_prefix=trim(CKER(iker+1))//'.adj' + adj_prefix = trim(CKER(iker+1))//'.adj' else - adj_prefix=trim(CTAP(itap+1))//'.adj' + adj_prefix = trim(CTAP(itap+1))//'.adj' endif - adj_prefix=trim(adj_dir)//'/'//trim(file_prefix)//'.'//trim(adj_prefix) + adj_prefix = trim(adj_dir)//'/'//trim(file_prefix)//'.'//trim(adj_prefix) call wsac1(trim(adj_prefix),dt_adj_src_all,npts_adj,b_adj,dt_adj,nerr) ! write amplitude adjoint sources here diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_constants.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_constants.f90 index 740cf8f60..66474f2ff 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_constants.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_constants.f90 @@ -26,7 +26,7 @@ module mtadj_constants real, parameter :: TWOPI = 2.0 * PI complex ,parameter :: CCI = cmplx(0.,1.) real, parameter :: LARGE_VAL = 1.0d8 - real, parameter :: EPS_dt=1.0e-4 + real, parameter :: EPS_dt = 1.0e-4 ! FFT parameters integer, parameter :: LNPT = 13, NPT = 2**LNPT, NDIM = 40000 diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub.f90 index d2306efa0..fc8a45bf9 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub.f90 @@ -132,9 +132,9 @@ subroutine read_data_syn(datafile,synfile,sta,chan,net) call rsac1(synfile,syn,npts2,b2,dt2,NDIM,nerr) if (nerr > 0) stop ' Error reading data file ' if (npts1 /= npts2 .or. abs(b1-b2) > dt1 .or. abs(dt1-dt2) > EPS_dt) & - stop 'check if npts1=npts2, b1=b2 and dt1=dt2' + stop 'check if npts1 = npts2, b1 = b2 and dt1 = dt2' - npts=npts1; b=b1; dt=dt1 + npts = npts1; b = b1; dt = dt1 ! sac header sta.net.chan, and file prefixes call getkhv('kstnm', sta, nerr) @@ -167,11 +167,11 @@ subroutine cc_fd_measure(file_prefix,tstart,tend) ! set measurement file prefix if (iker /= IKER_FD) then - meas_prefix=trim(CKER(iker+1)) + meas_prefix = trim(CKER(iker+1)) else - meas_prefix=trim(CTAP(itap+1)) + meas_prefix = trim(CTAP(itap+1)) endif - meas_prefix=trim(meas_dir)//'/'//trim(file_prefix)//'.'//trim(meas_prefix) + meas_prefix = trim(meas_dir)//'/'//trim(file_prefix)//'.'//trim(meas_prefix) ! at least 10 points within the window if (tend-tstart < 10*dt) stop 'Check if tend > tstart+10*dt' @@ -234,10 +234,10 @@ subroutine cc_fd_measure(file_prefix,tstart,tend) ! ------- ! frequency vector from fft - f0=0; df=1./(NPT*dt); nf=floor(NPT/2.)+1 + f0 = 0; df = 1./(NPT*dt); nf = floor(NPT/2.)+1 ! true independent frequency spacing for nlen - df_new=1./(tend-tstart); idf_new = int(df_new/df) + df_new = 1./(tend-tstart); idf_new = int(df_new/df) ! FFT windowed data (shifted) and syn cdataw = cmplx(0.,0.); csynw = cmplx(0.,0.) @@ -288,7 +288,7 @@ subroutine cc_fd_measure(file_prefix,tstart,tend) else ! ignore first few points for cosine and boxcar tapers df_fd = df_new; idf_fd = floor(df_fd/df); i_left= floor(npi*df_fd/df) endif - f_left=df_fd + f_left = df_fd if (DEBUG) then print *, 'Frequency of max power in windowed synthetic:' @@ -307,7 +307,7 @@ subroutine cc_fd_measure(file_prefix,tstart,tend) else if (itap == ITAP_BC) then call boxcar(nlen, NPT, tas_dp) endif - tas=tas_dp + tas = tas_dp ! compute transfer function for freq-dep measurements top_fdm(:) = cmplx(0.,0.) @@ -350,7 +350,7 @@ subroutine cc_fd_measure(file_prefix,tstart,tend) call compute_dtau_dlnA(trans_fdm,dt,tshift_cc,dtau_fdm,dlnA_fdm,i_right) ! reconstruct syn with transfer function - csynw_sngl=csynw + csynw_sngl = csynw call reconstruct_syn_fd(csynw_sngl,dtau_fdm,dlnA_fdm,i_right,synw_rc_fd,dt,nlen) if (DEBUG) then @@ -402,8 +402,8 @@ subroutine select_cc_fd_measure(tstart, tend, use_window) real, dimension(NPT) :: fvec - use_window=.true. - df = 1./(dt*NPT); nf=floor(NPT/2.)+1 + use_window = .true. + df = 1./(dt*NPT); nf = floor(NPT/2.)+1 do j = 1, nf fvec(j) = df*(j-1) enddo @@ -470,11 +470,11 @@ subroutine mt_adj_src(file_prefix,iwin,tstart,dt_adj_src,amp_adj_src,dt_chi,amp_ integer :: ictaper, i, nerr if (iker /= IKER_FD) then - file=trim(CKER(iker+1)) + file = trim(CKER(iker+1)) else - file=trim(CTAP(itap+1)) + file = trim(CTAP(itap+1)) endif - file=trim(adj_dir)//'/'//trim(file_prefix)//'.'//trim(file)// '.'//char(iwin+48) + file = trim(adj_dir)//'/'//trim(file_prefix)//'.'//trim(file)// '.'//char(iwin+48) ! IKER_WF if (iker == IKER_WF) then @@ -513,7 +513,7 @@ subroutine mt_adj_src(file_prefix,iwin,tstart,dt_adj_src,amp_adj_src,dt_chi,amp_ wf_taper(i) = 1. - cos(PI*(i-i_left)/(i_right-i_left))**ipwr_w ! cosine enddo ! normalize freq taper - ffac=2*df*sum(wf_taper(i_left:i_right)) + ffac = 2*df*sum(wf_taper(i_left:i_right)) wf_taper(i_left:i_right) = wf_taper(i_left:i_right) / ffac ! water level of FD measurements based on average (LQY:can be smaller for mtm!!) diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub2.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub2.f90 index 6e8063125..121704a28 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub2.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub2.f90 @@ -90,7 +90,7 @@ subroutine compute_cc_error(dataw,synw,nlen,dt,i_pmax,dlnA, & if (i_pmax <= 0) stop 'Check if the maximum f has been identified' Tmax=1./(df*i_pmax) - misfit=sum((dataw(1:nlen)-synw(1:nlen))**2)/sum(dataw(1:nlen)**2) + misfit = sum((dataw(1:nlen)-synw(1:nlen))**2)/sum(dataw(1:nlen)**2) sigma_tshift_cc = max(MIN_SIGMA_TSHIFT_CC,Tmax*misfit*SIGMA_TSHIFT_CC_SCALE) sigma_dlnA_cc = max(MIN_SIGMA_dlnA_CC,abs(dlnA)*misfit*SIGMA_TSHIFT_CC_SCALE) @@ -115,7 +115,7 @@ subroutine reconstruct_syn_fd(csynw,dtau_fdm,dlnA_fdm,i_right, & complex*16,dimension(NPT) :: csynw_recon real*8,dimension(NPT) :: synw_rc_fd_dp - df = 1./(dt*NPT); nf=floor(NPT/2.)+1 + df = 1./(dt*NPT); nf = floor(NPT/2.)+1 do j = 1, nf fvec(j) = df*(j-1) enddo @@ -143,7 +143,7 @@ subroutine compute_dtau_dlnA(trans_fdm,dt,tshift_cc,dtau_fdm,dlnA_fdm,i_right) real, dimension(NPT) :: fvec, phi_wt, abs_wt integer :: nf, j, i - df = 1./(dt*NPT); nf=floor(NPT/2.)+1 + df = 1./(dt*NPT); nf = floor(NPT/2.)+1 do j = 1, nf fvec(j) = df*(j-1) enddo @@ -299,7 +299,7 @@ subroutine compute_fd_error(npi,nlen,i_right,dt,dtau_fdm,dlnA_fdm, & df = 1./(dt*NPT) * npi idf_new = floor(1./(nlen)/df) - do i=1, i_right-idf_new + do i = 1, i_right-idf_new sigma_dtau_fdm(i) = maxval(abs(dtau_fdm(i)-dtau_fdm(i:i+idf_new))) sigma_dlnA_fdm(i) = maxval(abs(dlnA_fdm(i)-dlnA_fdm(i:i+idf_new))) enddo diff --git a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub3.f90 b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub3.f90 index 1980a4a79..ae6c9353a 100644 --- a/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub3.f90 +++ b/utils/ADJOINT_TOMOGRAPHY_TOOLS/mtadj/mtadj_sub3.f90 @@ -13,7 +13,7 @@ module mtadj_sub3 implicit none ! TOLERRANCE CONTROL - double precision, parameter :: TOL=1e-7 + double precision, parameter :: TOL = 1e-7 contains @@ -43,14 +43,14 @@ subroutine fft(n,xi,zzign,dt) endif lx = 2**n - do 1 i=1,n + do 1 i = 1,n 1 m(i) = 2**(n-i) - do 4 l=1,n + do 4 l = 1,n nblock = 2**(l-1) lblock = lx/nblock lbhalf = lblock/2 k = 0 - do 4 iblock=1,nblock + do 4 iblock = 1,nblock fk = k flx = lx @@ -59,7 +59,7 @@ subroutine fft(n,xi,zzign,dt) wk = cmplx(cos(v),-sin(v)) ! sign change to -sin(v) 17-Nov-2006 istart = lblock*(iblock-1) - do 2 i=1,lbhalf + do 2 i = 1,lbhalf j = istart+i jh = j+lbhalf q = xi(jh)*wk @@ -67,18 +67,18 @@ subroutine fft(n,xi,zzign,dt) xi(j) = xi(j)+q 2 continue - do 3 i=2,n + do 3 i = 2,n ii = i if (k < m(i)) goto 4 3 k = k-m(i) 4 k = k+m(ii) k = 0 - do 7 j=1,lx + do 7 j = 1,lx if (k < j) goto 5 hold = xi(j) xi(j) = xi(k+1) xi(k+1) = hold - 5 do 6 i=1,n + 5 do 6 i = 1,n ii = i if (k < m(i)) goto 7 6 k = k-m(i) @@ -118,7 +118,7 @@ subroutine fftinv(npow,s,zzign,dt,r) nhalf = nsmp/2 call rspec(s,nhalf) ! re-structuring - zign=zzign + zign = zzign call fft(npow,s,zign,dt) ! Fourier transform do i = 1,nsmp @@ -189,34 +189,34 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) if (nt < 2) return nxi=mod(nt,2) lh=(nt/2)+nxi - lp1=nt+1 - om=2.*PI*fw/nt + lp1 = nt+1 + om = 2.*PI*fw/nt com=cos(om) hn=0.5*dble(lp1) - do 10 i=1,lh + do 10 i = 1,lh a(i)=com*(i-hn)**2 10 w(i)=0.5*dble(i*(nt-i)) if (nxi == 0) then - asav=a(lh)-w(lh) + asav = a(lh)-w(lh) a(lh)=a(lh)+w(lh) - rbd=1./(a(lh)+w(lh-1)) + rbd = 1./(a(lh)+w(lh-1)) else asav=w(lh-1) - rbd=1./(w(lh)+w(lh-1)) + rbd = 1./(w(lh)+w(lh-1)) w(lh-1)=r2*w(lh-1) endif - do 15 i=1,lh + do 15 i = 1,lh a(i+lh)=w(i)*rbd w(i)=a(i+lh)**2 15 a(i)=a(i)*rbd - neven=max0((nev+1)/2,1) - nodd=nev-neven + neven = max0((nev+1)/2,1) + nodd = nev-neven ! Do the even tapers call tsturm(nt,lh,a,a(lh+1),w,neven,v,ndim,w(lh+1),0) - do 20 i=1,neven - k=2*i-1 + do 20 i = 1,neven + k = 2*i-1 if (nxi == 1) v(lh,k)=r2*v(lh,k) - do 20 j=1,lh + do 20 j = 1,lh 20 v(lp1-j,k)=v(j,k) if (nodd <= 0) goto 34 ! Do the odd tapers @@ -227,37 +227,37 @@ subroutine staper(nt, fw, nev, v, ndim, a, w) w(lh-1)=asav*asav endif call tsturm(nt,lh-nxi,a,a(lh+1),w,nodd,v,ndim,w(lh+1),1) - do 30 i=1,nodd - k=2*i + do 30 i = 1,nodd + k = 2*i if (nxi == 1) v(lh,k)=0. - do 30 j=1,lh + do 30 j = 1,lh 30 v(lp1-j,k)=-v(j,k) - 34 ntot=neven+nodd + 34 ntot = neven+nodd ! Calculate bandwidth retention parameters - dc=2.*com - sm=0. + dc = 2.*com + sm = 0. s=sin(om) w(1)=om/PI w(2)=s/PI - do 35 j=3,nt - sn=dc*s-sm - sm=s - s=sn + do 35 j = 3,nt + sn = dc*s-sm + sm = s + s = sn 35 w(j)=s/(PI*(j-1)) - do 55 m=1,ntot - vmax=abs(v(1,m)) - kmax=1 - do 40 kk=2,lh + do 55 m = 1,ntot + vmax = abs(v(1,m)) + kmax = 1 + do 40 kk = 2,lh if (abs(v(kk,m)) <= vmax) goto 40 - kmax=kk - vmax=abs(v(kk,m)) + kmax = kk + vmax = abs(v(kk,m)) 40 continue a(m)=0. - nlow=kmax-1 - do 45 j=1,nlow + nlow = kmax-1 + do 45 j = 1,nlow 45 a(m)=a(m)+w(j+1)*v(nlow+1-j,m) - nup=nt-nlow - do 50 j=1,nup + nup = nt-nlow + do 50 j = 1,nup 50 a(m)=a(m)+w(j)*v(nlow+j,m) 55 a(m)=a(m)/v(kmax,m) return @@ -291,48 +291,48 @@ subroutine tsturm(nt,n,a,b,w,nev,r,ndim,ev,ipar) !------------------------- if (n <= 0 .or. nev <= 0) return - umeps=1.-epsi - do 5 i=1,nev + umeps = 1.-epsi + do 5 i = 1,nev 5 ev(i)=-1. - u=1. - do 1000 ik=1,nev - if (ik > 1) u=ev(ik-1)*umeps - el=min(ev(ik),u) + u = 1. + do 1000 ik = 1,nev + if (ik > 1) u = ev(ik-1)*umeps + el = min(ev(ik),u) 10 elam=0.5*(u+el) if (abs(u-el) <= epsi1) goto 35 - iag=0 + iag = 0 q=a(1)-elam if (q >= 0.) iag=iag+1 - do 15 i=2,n + do 15 i = 2,n if (q == 0.) x=abs(b(i-1))/epsi - if (q /= 0.) x=w(i-1)/q + if (q /= 0.) x = w(i-1)/q q=a(i)-elam-x if (q >= 0.) iag=iag+1 if (iag > nev) goto 20 15 continue if (iag >= ik) goto 20 - u=elam + u = elam goto 10 20 if (iag == ik) goto 30 - m=ik+1 - do 25 i=m,iag + m = ik+1 + do 25 i = m,iag 25 ev(i)=elam - el=elam + el = elam goto 10 - 30 el=elam + 30 el = elam call root(u,el,elam,a,b,w,n,ik) 35 ev(ik)=elam - jk=2*ik+ipar-1 + jk = 2*ik+ipar-1 r(1,jk)=1. r(2,jk)=-(a(1)-ev(ik))/b(1) - ddot=1.+r(2,jk)*r(2,jk) - jm1=2 - do 45 j=3,n + ddot = 1.+r(2,jk)*r(2,jk) + jm1 = 2 + do 45 j = 3,n r(j,jk)=-((a(jm1)-ev(ik))*r(jm1,jk)+b(j-2)*r(j-2,jk))/b(jm1) - ddot=ddot+r(j,jk)*r(j,jk) - 45 jm1=j - rnorm=sqrt(nt/(2.*ddot)) - do 50 j=1,n + ddot = ddot+r(j,jk)*r(j,jk) + 45 jm1 = j + rnorm = sqrt(nt/(2.*ddot)) + do 50 j = 1,n 50 r(j,jk)=r(j,jk)*rnorm 1000 continue return @@ -360,27 +360,27 @@ subroutine root(u,el,elam,a,bb,w,n,ik) 5 elam=0.5*(u+el) 10 if (abs(u-el) <= 1.5*epsi1) return an=a(1)-elam - b=0. + b = 0. bn=-1./an - iag=0 + iag = 0 if (an >= 0.) iag=iag+1 - do 20 i=2,n + do 20 i = 2,n if (an == 0.) x=abs(bb(i-1))/epsi - if (an /= 0.) x=w(i-1)/an + if (an /= 0.) x = w(i-1)/an an=a(i)-elam-x if (an == 0.) an=epsi - bm=b - b=bn + bm = b + b = bn bn=((a(i)-elam)*b-bm*x-1.)/an if (an >= 0.) iag=iag+1 20 continue if (iag == ik) goto 25 - u=elam + u = elam goto 30 - 25 el=elam - 30 del=1./bn + 25 el = elam + 30 del = 1./bn if (abs(del) <= epsi1) del=sign(epsi1,del) - elam=elam-del + elam = elam-del if (elam >= u .or. elam <= el) goto 5 goto 10 @@ -399,7 +399,7 @@ subroutine costaper(ipoint, ndata, tas) pi = asin(1.0d0)*2 sum = 0. - do i =1,ipoint + do i = 1,ipoint tas(i,1) = 1 - cos( 2*pi*i/ipoint) tas(i,1) = tas(i,1) / sqrt(1.5) enddo @@ -415,7 +415,7 @@ subroutine boxcar(ipoint, ndata, tas) double precision tas(ndata,*) integer i - do i =1,ipoint + do i = 1,ipoint tas(i,1) = 1.0 enddo return @@ -434,7 +434,7 @@ subroutine rmean(dat,npts) integer i - sum=0 + sum = 0 do i = 1, npts sum = sum + dat(i) enddo @@ -497,7 +497,7 @@ subroutine taper (a, n, start, end, b) m2 = m1 + 1 if (m1 > 0) then ang = 3.1415926 / float(m1) - do i=1, m1 + do i = 1, m1 xi = i cs = (1.0-cos(xi*ang))/2.0 b(i) = a(i)*cs @@ -510,13 +510,13 @@ subroutine taper (a, n, start, end, b) if (m3 > 0) then ang = 3.1415926 / float (m3) - do i=m4,n + do i = m4,n xi = i-n-1 cs = (1.0-cos(xi*ang))/2.0 b(i) = a(i)*cs enddo endif - do i=m2, m5 + do i = m2, m5 b(i) = a(i) enddo diff --git a/utils/CPML/add_CPML_layers_to_an_existing_mesh.f90 b/utils/CPML/add_CPML_layers_to_an_existing_mesh.f90 index 950dee0fb..0cc4c4b16 100644 --- a/utils/CPML/add_CPML_layers_to_an_existing_mesh.f90 +++ b/utils/CPML/add_CPML_layers_to_an_existing_mesh.f90 @@ -1449,7 +1449,7 @@ program add_CPML_layers_to_a_given_mesh allocate(y_copy(NGNOD,nspec)) allocate(z_copy(NGNOD,nspec)) - do ispec=1,nspec + do ispec = 1,nspec ieoff = NGNOD * (ispec-1) ilocnum = 0 do ia = 1,NGNOD @@ -1663,9 +1663,9 @@ subroutine get_shape3D(dershape3D,xigll,yigll,zigll,NGNOD,NGLLX,NGLLY,NGLLZ,NDIM ! *** create 3D shape functions and jacobian ! *** - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ xi = xigll(i) eta = yigll(j) @@ -1724,15 +1724,15 @@ subroutine get_shape3D(dershape3D,xigll,yigll,zigll,NGNOD,NGLLX,NGLLY,NGLLZ,NDIM !--- check the shape functions and their derivatives - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ sumdershapexi = ZERO sumdershapeeta = ZERO sumdershapegamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD sumdershapexi = sumdershapexi + dershape3D(1,ia,i,j,k) sumdershapeeta = sumdershapeeta + dershape3D(2,ia,i,j,k) sumdershapegamma = sumdershapegamma + dershape3D(3,ia,i,j,k) @@ -1774,28 +1774,28 @@ subroutine get_shape3D_27(NDIM,NGNOD,NGLLX,NGLLY,NGLLZ,dershape3D,xi,eta,gamma,i double precision l1pxi,l2pxi,l3pxi,l1peta,l2peta,l3peta,l1pgamma,l2pgamma,l3pgamma l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 + l2gamma = ONE-gamma**2 l3gamma=HALF*gamma*(gamma+ONE) - l1pgamma=gamma-HALF + l1pgamma = gamma-HALF l2pgamma=-TWO*gamma - l3pgamma=gamma+HALF + l3pgamma = gamma+HALF ! corner nodes @@ -1926,9 +1926,9 @@ subroutine calc_jacobian(xelm,yelm,zelm,dershape3D,found_a_negative_jacobian,NDI ! do i=1,NGLLX ! for this CPML mesh extrusion routine it is sufficient to test the 8 corners of each element to reduce the cost ! because we just want to detect if the element is flipped or not, and if so flip it back - do k=1,NGLLZ,NGLLZ-1 - do j=1,NGLLY,NGLLY-1 - do i=1,NGLLX,NGLLX-1 + do k = 1,NGLLZ,NGLLZ-1 + do j = 1,NGLLY,NGLLY-1 + do i = 1,NGLLX,NGLLX-1 xxi = ZERO xeta = ZERO @@ -1940,7 +1940,7 @@ subroutine calc_jacobian(xelm,yelm,zelm,dershape3D,found_a_negative_jacobian,NDI zeta = ZERO zgamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD xxi = xxi + dershape3D(1,ia,i,j,k)*xelm(ia) xeta = xeta + dershape3D(2,ia,i,j,k)*xelm(ia) xgamma = xgamma + dershape3D(3,ia,i,j,k)*xelm(ia) diff --git a/utils/CPML/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 b/utils/CPML/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 index 9b470dca8..ef2f68891 100644 --- a/utils/CPML/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 +++ b/utils/CPML/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 @@ -73,7 +73,7 @@ program convert_CUBIT_SPECFEM_to_DX write(11,*) 'object 1 class array type float rank 1 shape 3 items ',npoin,' data follows' ! read local points in this slice and output global DX points - do ipoin=1,npoin + do ipoin = 1,npoin write(11,*) x(ipoin),y(ipoin),z(ipoin) enddo @@ -89,7 +89,7 @@ program convert_CUBIT_SPECFEM_to_DX write(11,*) 'object 2 class array type int rank 1 shape 8 items ',nspec,' data follows' ! read local elements in this slice and output global DX elements - do ispec=1,nspec + do ispec = 1,nspec read(23,*) ispec_read,i1,i2,i3,i4,i5,i6,i7,i8 ibool(1,ispec_read) = i1 ibool(2,ispec_read) = i2 @@ -103,7 +103,7 @@ program convert_CUBIT_SPECFEM_to_DX ! point order in OpenDX is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS or SPECFEM ! and point numbers start at 0 rather than 1 - do ispec=1,nspec + do ispec = 1,nspec write(11,"(i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9)") & ibool(4,ispec)-1,ibool(1,ispec)-1,ibool(8,ispec)-1,ibool(5,ispec)-1, & ibool(3,ispec)-1,ibool(2,ispec)-1,ibool(7,ispec)-1,ibool(6,ispec)-1 @@ -120,14 +120,14 @@ program convert_CUBIT_SPECFEM_to_DX ! read local elements in this slice and output global DX elements open(unit=23,file='materials_file',status='old',action='read') - do ispec=1,nspec + do ispec = 1,nspec ! beware: elements may not be listed in increasing order, they can appear in any order read(23,*) ispec_read,imat_read imat(ispec_read) = imat_read enddo close(23) - do ispec=1,nspec + do ispec = 1,nspec val_color = imat(ispec) ! use material property read to color the elements write(11,*) val_color enddo diff --git a/utils/CPML/convert_external_layers_of_a_given_mesh_to_CPML_layers.f90 b/utils/CPML/convert_external_layers_of_a_given_mesh_to_CPML_layers.f90 index 49ae6c9fd..d2e0a857c 100644 --- a/utils/CPML/convert_external_layers_of_a_given_mesh_to_CPML_layers.f90 +++ b/utils/CPML/convert_external_layers_of_a_given_mesh_to_CPML_layers.f90 @@ -443,7 +443,7 @@ program convert_mesh_to_CPML write(24,*) number_of_CPML_elements ! write the CPML flag for each CPML element - do ispec=1,nspec + do ispec = 1,nspec if (is_X_CPML(ispec) .and. is_Y_CPML(ispec) .and. is_Z_CPML(ispec)) then write(24,*) ispec,CPML_XYZ diff --git a/utils/Visualization/Paraview/create_slice_VTK.f90 b/utils/Visualization/Paraview/create_slice_VTK.f90 index f8da2d783..85998c473 100644 --- a/utils/Visualization/Paraview/create_slice_VTK.f90 +++ b/utils/Visualization/Paraview/create_slice_VTK.f90 @@ -221,7 +221,7 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, & ! writes out all points for each element, not just global ones write(IOUT_VTK, '(a,i12,a)') 'POINTS ', nspec*8, ' float' - do ispec=1,nspec + do ispec = 1,nspec i = ibool(1,1,1,ispec) write(IOUT_VTK,'(3e18.6)') xstore(i),ystore(i),zstore(i) @@ -250,7 +250,7 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, & ! note: indices for vtk start at 0 write(IOUT_VTK,'(a,i12,i12)') "CELLS ",nspec,nspec*9 - do ispec=1,nspec + do ispec = 1,nspec write(IOUT_VTK,'(9i12)') 8,(ispec-1)*8,(ispec-1)*8+1,(ispec-1)*8+2,(ispec-1)*8+3, & (ispec-1)*8+4,(ispec-1)*8+5,(ispec-1)*8+6,(ispec-1)*8+7 enddo diff --git a/utils/Visualization/Paraview/visualize_gold/src/read_input.f90 b/utils/Visualization/Paraview/visualize_gold/src/read_input.f90 index fbfc7c276..153529b2b 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/read_input.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/read_input.f90 @@ -19,8 +19,8 @@ subroutine read_input (inp_fname) integer :: input_stat,output_stat,procinfo_stat,proclist_stat,server_stat integer,dimension(3) :: proc_ind ! indicial parameters for processor list -slice_count1=0 -slice_count2=0 +slice_count1 = 0 +slice_count2 = 0 input_stat=-1 output_stat=-1 @@ -50,9 +50,9 @@ subroutine read_input (inp_fname) call last_char(line,tmp_char,ind) if (tmp_char == '&') then slen=len(line) - tag=trim(line(1:ind-1)) + tag = trim(line(1:ind-1)) read(11,'(a)',iostat=ios)line ! This will read a line and proceed to next line - tag=trim(tag)//trim(line) + tag = trim(tag)//trim(line) endif call first_token(tag,token) @@ -65,7 +65,7 @@ subroutine read_input (inp_fname) t_start=get_integer('start',args,narg) t_inc=get_integer('step',args,narg) t_width=get_integer('width',args,narg) - inp_ncomp=get_integer('ncomp',args,narg); allocate(inp_head(inp_ncomp)) + inp_ncomp = get_integer('ncomp',args,narg); allocate(inp_head(inp_ncomp)) if (inp_ncomp == 1) then inp_head=get_string('head',args,narg) else if (inp_ncomp == 3) then ! vector @@ -76,10 +76,10 @@ subroutine read_input (inp_fname) write(*,'(/,a)')'ERROR: wrong ncomp value in input: line!' stop endif - inp_ext=get_string('ext',args,narg); inp_ext='.'//trim(inp_ext) + inp_ext = get_string('ext',args,narg); inp_ext='.'//trim(inp_ext) dat_topo=get_integer('topo',args,narg) !print *,narg,arg - input_stat=0 + input_stat = 0 cycle endif @@ -88,7 +88,7 @@ subroutine read_input (inp_fname) call split_string(tag,',',args,narg) !out_path=get_string('path',args,narg) call seek_string('path',strval,args,narg) - if (.not. isblank(strval))out_path=trim(strval) + if (.not. isblank(strval))out_path = trim(strval) out_ncomp=get_integer('ncomp',args,narg) !stop out_head=get_string('head',args,narg) @@ -96,7 +96,7 @@ subroutine read_input (inp_fname) out_res=get_integer('res',args,narg) out_format=get_integer('form',args,narg) !print *,narg,arg - output_stat=0 + output_stat = 0 cycle endif @@ -114,7 +114,7 @@ subroutine read_input (inp_fname) allocate(server_name(out_nslice)) allocate(server_exec(out_nslice)) endif - procinfo_stat=0 + procinfo_stat = 0 cycle endif @@ -122,7 +122,7 @@ subroutine read_input (inp_fname) if (trim(token) == 'proclist:') then proclist_stat=-1 call split_string(tag,',',args,narg) - slice_count1=slice_count1+1 + slice_count1 = slice_count1+1 if (slice_count1 > out_nslice) then write(*,'(/,a)')'ERROR: number of slices exceeds the actual number!' stop @@ -135,9 +135,9 @@ subroutine read_input (inp_fname) else if (proc_mode == 1) then ! Indicial proc_ind=get_integer_vect('list',3,args,narg) ! start, end, step - proc_count=0 - do i_proc=proc_ind(1),proc_ind(2),proc_ind(3) - proc_count=proc_count+1 + proc_count = 0 + do i_proc = proc_ind(1),proc_ind(2),proc_ind(3) + proc_count = proc_count+1 if (proc_count > slice_npmax) then write(*,'(/,a)')'ERROR: number of processors per slice exceeds the maximum number!' stop @@ -151,7 +151,7 @@ subroutine read_input (inp_fname) stop endif - proclist_stat=0 + proclist_stat = 0 cycle endif @@ -160,14 +160,14 @@ subroutine read_input (inp_fname) if (trim(token) == 'server:') then server_stat=-1 call split_string(tag,',',args,narg) - slice_count2=slice_count2+1 + slice_count2 = slice_count2+1 if (slice_count2 > out_nslice) then write(*,'(/,a)')'ERROR: number of slices exceeds the actual number!' stop endif server_name(slice_count2)=get_string('name',args,narg) server_exec(slice_count2)=get_string('exec',args,narg) - server_stat=0 + server_stat = 0 cycle endif endif diff --git a/utils/Visualization/Paraview/visualize_gold/src/string_process.f90 b/utils/Visualization/Paraview/visualize_gold/src/string_process.f90 index ce03fcdfc..8a873b899 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/string_process.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/string_process.f90 @@ -13,9 +13,9 @@ module string_process logical function isblank(str) character(len=*) :: str -isblank=.false. +isblank = .false. -if (len(trim(str)) == 0)isblank=.true. +if (len(trim(str)) == 0)isblank = .true. return end function isblank !===================================================== @@ -29,9 +29,9 @@ logical function iscomment(str,rch) call first_char(str,ch,ind) -iscomment=.false. +iscomment = .false. -if (ch == rch)iscomment=.true. +if (ch == rch) iscomment = .true. return end function iscomment @@ -45,15 +45,15 @@ subroutine first_token(str,token) character(len=*),intent(out) :: token integer :: i,slen -tmp_str=trim(adjustl(str)) +tmp_str = trim(adjustl(str)) slen=len(tmp_str) ! set default values -token=tmp_str +token = tmp_str str=' ' ! first token is a word before first space -do i=1,slen +do i = 1,slen if (tmp_str(i:i) == ' ') then token=tmp_str(1:i-1) str=tmp_str(i+1:slen) @@ -78,13 +78,13 @@ subroutine first_char(str,ch,ind) ! set default values ch=str(1:1) -ind=1 +ind = 1 ! find first character -do i=1,slen +do i = 1,slen if (str(i:i) /= ' ') then ch=str(i:i) - ind=i + ind = i exit endif enddo @@ -104,13 +104,13 @@ subroutine last_char(str,ch,ind) ! set default values ch=str(slen:slen) -ind=slen +ind = slen ! find last character -do i=slen,1,-1 +do i = slen,1,-1 if (str(i:i) /= ' ') then ch=str(i:i) - ind=i + ind = i exit endif enddo @@ -134,19 +134,19 @@ subroutine split_string(str,delm,args,narg) tmp_str=trim(str) ! find and count indices of all delimeters -narg=0 -do i=1,slen +narg = 0 +do i = 1,slen if (tmp_str(i:i) == delm) then - narg=narg+1 + narg = narg+1 ind(narg)=i endif enddo -narg=narg+1 +narg = narg+1 ind(narg)=slen+1 ! split string and set to args -i1=1 -do i=1,narg +i1 = 1 +do i = 1,narg args(i)=tmp_str(i1:ind(i)-1) i1=ind(i)+1 enddo @@ -164,7 +164,7 @@ end subroutine split_string character(len=80),dimension(2) :: args integer :: i,narg -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then @@ -192,7 +192,7 @@ subroutine seek_string(vname,strval,slist,nvar) strval='' -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then @@ -217,7 +217,7 @@ function get_string_vect(vname,n,slist,nvar) character(len=80),dimension(2) :: args integer :: i,narg -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then @@ -240,7 +240,7 @@ integer function get_integer(vname,slist,nvar) character(len=80),dimension(2) :: args integer :: i,narg -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then @@ -266,7 +266,7 @@ function get_integer_vect(vname,n,slist,nvar) character(len=80),dimension(2) :: args integer :: i,narg -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then @@ -289,7 +289,7 @@ real function get_real(vname,slist,nvar) character(len=80),dimension(2) :: args integer :: i,narg -do i=1,nvar +do i = 1,nvar call split_string(slist(i),'=',args,narg) if (narg /= 2)cycle if (vname == trim(adjustl(args(1)))) then diff --git a/utils/Visualization/Paraview/visualize_gold/src/visualize.f90 b/utils/Visualization/Paraview/visualize_gold/src/visualize.f90 index 7ba963382..6d5aced12 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/visualize.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/visualize.f90 @@ -50,7 +50,7 @@ program visualize integer :: i_slice character(len=80) :: inp_fname -!write(*,*)iargc() +!write(*,*) iargc() if (iargc() <= 0) then write(*,'(/,a)')'ERROR: no input file!' stop! counts total number of nodes and elementsp @@ -84,9 +84,9 @@ program visualize ! Display key information write(*,'(a)')'-------------------------------' -!write(*,*)'Number of data slices: ',nproc -write(*,*)'number of image frames: ',t_nstep -write(*,*)'input directory:',inp_path +!write(*,*) 'Number of data slices: ',nproc +write(*,*) 'number of image frames: ',t_nstep +write(*,*) 'input directory:',inp_path if (inp_ncomp == 1) then write(*,*) 'input data type: SCALAR' else if (inp_ncomp == 3) then @@ -97,7 +97,7 @@ program visualize write(*,'(/,a)')'ERROR: unsupported data type!' stop endif -write(*,*)'output directory:',out_path +write(*,*) 'output directory:',out_path if (out_ncomp == 1) then write(*,*) 'output data type: SCALAR' else if (out_ncomp == 3) then @@ -109,25 +109,25 @@ program visualize stop endif if (out_format == 0) then - write(*,*)'output format: VTK' + write(*,*) 'output format: VTK' else if (out_format == 1) then - write(*,*)'output format: Ensight Gold' + write(*,*) 'output format: Ensight Gold' else write(*,'(/,a)')'ERROR: unsupported output format!' stop endif if (out_res == 0) then - write(*,*)'resolution: LOW' + write(*,*) 'resolution: LOW' else if (out_res == 1) then - write(*,*)'resolution: MEDIUM' + write(*,*) 'resolution: MEDIUM' else if (out_res == 2) then - write(*,*)'resolution: HIGH' + write(*,*) 'resolution: HIGH' else write(*,'(/,a)')'ERROR: unsupported resolution!' stop endif -write(*,*)'number of output slices: ',out_nslice +write(*,*) 'number of output slices: ',out_nslice write(*,'(a)')'-------------------------------' write(*,'(a)',advance='no')'counting meshes...' @@ -136,7 +136,7 @@ program visualize allocate(slice_nnode(out_nslice)) allocate(slice_nelmt(out_nslice)) ! Loop over output slices -do i_slice=1,out_nslice +do i_slice = 1,out_nslice slice_nnode(i_slice) = 0 slice_nelmt(i_slice) = 0 @@ -144,7 +144,7 @@ program visualize call cvd_count_totals_ext_mesh(slice_nproc(i_slice), & slice_proc_list(i_slice,1:slice_nproc(i_slice)),proc_width, & inp_path,slice_nnode(i_slice),slice_nelmt(i_slice),out_res) - !write(*,*)i_slice,slice_nnode(i_slice),slice_nelmt(i_slice) + !write(*,*) i_slice,slice_nnode(i_slice),slice_nelmt(i_slice) enddo write(*,'(a)')'complete!' diff --git a/utils/Visualization/Paraview/visualize_gold/src/visualize_collect.f90 b/utils/Visualization/Paraview/visualize_gold/src/visualize_collect.f90 index 7b193bffe..3954ad824 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/visualize_collect.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/visualize_collect.f90 @@ -96,7 +96,7 @@ subroutine cvd_count_totals_ext_mesh(nproc,proc_list,proc_width,inp_dir, & ! mark element corners (global AVS or DX points) allocate(mask_ibool(NGLOB_AB)) mask_ibool = .false. - do i_spec=1,NSPEC_AB + do i_spec = 1,NSPEC_AB ! Bottom corners iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -161,7 +161,7 @@ subroutine cvd_count_totals_ext_mesh(nproc,proc_list,proc_width,inp_dir, & ! mark element corners (global AVS or DX points) allocate(mask_ibool(NGLOB_AB)) mask_ibool = .false. - do i_spec=1,NSPEC_AB + do i_spec = 1,NSPEC_AB iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) iglob(3)=ibool(NGLLX,NGLLY,1,i_spec) @@ -228,7 +228,7 @@ subroutine cvd_write_corners_only(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) iglob(3)=ibool(NGLLX,NGLLY,1,i_spec) @@ -238,7 +238,7 @@ subroutine cvd_write_corners_only(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, iglob(7)=ibool(NGLLX,NGLLY,NGLLZ,i_spec) iglob(8)=ibool(1,NGLLY,NGLLZ,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 x = xstore(iglob(i_node)) @@ -282,7 +282,7 @@ subroutine cvd_write_hexa20_only(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB ! Bottom corners iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -313,7 +313,7 @@ subroutine cvd_write_hexa20_only(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, & iglob(19)=ibool(NGLLX,NGLLY,NGLLZ_MID,i_spec) iglob(20)=ibool(1,NGLLY,NGLLZ_MID,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 x = xstore(iglob(i_node)) @@ -357,7 +357,7 @@ subroutine cvd_write_GLL_points_only(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstor allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX @@ -406,7 +406,7 @@ subroutine cvd_write_corners_data(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) iglob(3)=ibool(NGLLX,NGLLY,1,i_spec) @@ -426,7 +426,7 @@ subroutine cvd_write_corners_data(NSPEC_AB,NGLOB_AB,ibool,dat, & tmp_dat(7)=dat(NGLLX,NGLLY,NGLLZ,i_spec) tmp_dat(8)=dat(1,NGLLY,NGLLZ,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 call write_real(tmp_dat(i_node),fd) @@ -464,7 +464,7 @@ subroutine cvd_write_corners_data_glob(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) iglob(3)=ibool(NGLLX,NGLLY,1,i_spec) @@ -474,7 +474,7 @@ subroutine cvd_write_corners_data_glob(NSPEC_AB,NGLOB_AB,ibool,dat, & iglob(7)=ibool(NGLLX,NGLLY,NGLLZ,i_spec) iglob(8)=ibool(1,NGLLY,NGLLZ,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 call write_real(dat(iglob(i_node)),fd) @@ -513,7 +513,7 @@ subroutine cvd_write_hexa20_data(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB ! Bottom corners iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -575,7 +575,7 @@ subroutine cvd_write_hexa20_data(NSPEC_AB,NGLOB_AB,ibool,dat, & tmp_dat(19)=dat(NGLLX,NGLLY,NGLLZ_MID,i_spec) tmp_dat(20)=dat(1,NGLLY,NGLLZ_MID,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 call write_real(tmp_dat(i_node),fd) @@ -613,7 +613,7 @@ subroutine cvd_write_hexa20_data_glob(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB ! Bottom corners iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -644,7 +644,7 @@ subroutine cvd_write_hexa20_data_glob(NSPEC_AB,NGLOB_AB,ibool,dat, & iglob(19)=ibool(NGLLX,NGLLY,NGLLZ_MID,i_spec) iglob(20)=ibool(1,NGLLY,NGLLZ_MID,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 call write_real(dat(iglob(i_node)),fd) @@ -681,7 +681,7 @@ subroutine cvd_write_GLL_points_data(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX @@ -723,7 +723,7 @@ subroutine cvd_write_GLL_points_data_glob(NSPEC_AB,NGLOB_AB,ibool,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX @@ -768,7 +768,7 @@ subroutine cvd_write_corner_elements(NSPEC_AB,NGLOB_AB,ibool, & mask_ibool(:) = .false. num_ibool(:) = 0 numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB ! gets corner indices iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -780,14 +780,14 @@ subroutine cvd_write_corner_elements(NSPEC_AB,NGLOB_AB,ibool, & iglob(8)=ibool(1,NGLLY,NGLLZ,i_spec) ! sets increasing numbering - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 num_ibool(iglob(i_node)) = numpoin mask_ibool(iglob(i_node)) = .true. endif enddo - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT inode = num_ibool(iglob(i_node)) + np ! -1 call write_integer(inode,fd) enddo @@ -829,7 +829,7 @@ subroutine cvd_write_hexa20_elements(NSPEC_AB,NGLOB_AB,ibool, & mask_ibool(:) = .false. num_ibool(:) = 0 numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB ! Bottom corners iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) @@ -861,14 +861,14 @@ subroutine cvd_write_hexa20_elements(NSPEC_AB,NGLOB_AB,ibool, & iglob(20)=ibool(1,NGLLY,NGLLZ_MID,i_spec) ! sets increasing numbering - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 num_ibool(iglob(i_node)) = numpoin mask_ibool(iglob(i_node)) = .true. endif enddo - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT inode = num_ibool(iglob(i_node)) + np ! -1 call write_integer(inode,fd) enddo @@ -912,7 +912,7 @@ subroutine cvd_write_GLL_elements(NSPEC_AB,NGLOB_AB,ibool, & mask_ibool(:) = .false. num_ibool(:) = 0 numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX @@ -940,7 +940,7 @@ subroutine cvd_write_GLL_elements(NSPEC_AB,NGLOB_AB,ibool, & iglob(6) = ibool(i+1,j,k+1,i_spec) iglob(7) = ibool(i+1,j+1,k+1,i_spec) iglob(8) = ibool(i,j+1,k+1,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT inode = num_ibool(iglob(i_node)) + np ! -1 call write_integer(inode,fd) enddo @@ -992,7 +992,7 @@ subroutine cvd_write_corners(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore,dat, & allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB iglob(1)=ibool(1,1,1,i_spec) iglob(2)=ibool(NGLLX,1,1,i_spec) iglob(3)=ibool(NGLLX,NGLLY,1,i_spec) @@ -1011,7 +1011,7 @@ subroutine cvd_write_corners(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore,dat, & tmp_dat(7)=dat(NGLLX,NGLLY,NGLLZ,i_spec) tmp_dat(8)=dat(1,NGLLY,NGLLZ,i_spec) - do i_node=1,NENOD_OUT + do i_node = 1,NENOD_OUT if (.not. mask_ibool(iglob(i_node))) then numpoin = numpoin + 1 x = xstore(iglob(i_node)) @@ -1060,7 +1060,7 @@ subroutine cvd_write_GLL_points(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore,dat allocate(mask_ibool(NGLOB_AB)) mask_ibool(:) = .false. numpoin = 0 -do i_spec=1,NSPEC_AB +do i_spec = 1,NSPEC_AB do k = 1, NGLLZ do j = 1, NGLLY do i = 1, NGLLX diff --git a/utils/Visualization/Paraview/visualize_gold/src/write_ensight.f90 b/utils/Visualization/Paraview/visualize_gold/src/write_ensight.f90 index 7957f2bd2..f863fbbbe 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/write_ensight.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/write_ensight.f90 @@ -43,14 +43,14 @@ subroutine write_ensight () write(121,'(a,i2,/)')'number of servers: ',out_nslice ! Loop over output slices - do i_slice=1,out_nslice + do i_slice = 1,out_nslice write(121,'(a,i2)')'#Server ',i_slice write(121,'(a)')'machine id: '//trim(server_name(i_slice)) write(121,'(a)')'executable: '//trim(server_exec(i_slice)) write(121,'(a)')'#login id: ' write(121,'(a)')'#data_path: ' write(tmp_str,*)i_slice - file_head=trim(out_head)//'_server'//trim(adjustl(tmp_str)) + file_head = trim(out_head)//'_server'//trim(adjustl(tmp_str)) write(121,'(a,/)')'casefile: '//trim(file_head)//'.case' enddo close(121) @@ -58,8 +58,8 @@ subroutine write_ensight () write(*,'(a)')'writing ensight gold files...' ! Loop over output slices -do i_slice=1,out_nslice - !write(*,*)'slice: ',i_slice +do i_slice = 1,out_nslice + !write(*,*) 'slice: ',i_slice ! counts total number of points !nnode = 0 !nelmt = 0 @@ -68,8 +68,8 @@ subroutine write_ensight () !slice_proc_list(i_slice,1:slice_nproc(i_slice)),proc_width, & !inp_path,nnode,nelmt,out_res) !write(*,'(a)')'complete!' - !write(*,*)' Total number of nodes: ',nnode - !write(*,*)' Total number of elements: ',nelmt + !write(*,*) ' Total number of nodes: ',nnode + !write(*,*) ' Total number of elements: ',nelmt ! Ensight Gold files call write_ensight_serial(i_slice,slice_nproc(i_slice),slice_proc_list(i_slice,1:slice_nproc(i_slice))) @@ -122,10 +122,10 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) endif write(tmp_str,*)i_slice -file_head=trim(out_head)//'_server'//trim(adjustl(tmp_str)) +file_head = trim(out_head)//'_server'//trim(adjustl(tmp_str)) ! write Ensight Gold case file -ts=1 ! Time set +ts = 1 ! Time set !write(*,'(a)',advance='no')'writing Ensight case file...' open(unit=11, file=trim(out_path)// '/' // trim(file_head)//'.case', status='replace', action='write', iostat=ios) @@ -160,7 +160,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) write(11,'(a,i10)')'filename increment:',t_inc write(11,'(a)',advance='no')'time values: ' -do i=1,t_nstep +do i = 1,t_nstep write(11,'(e12.5)',advance='yes')(t_start+(i-1)*t_inc)*DT enddo close(11) @@ -172,11 +172,11 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) !write(*,*) proc_list(1:nproc) ! open Ensight Gold geo file to store mesh data -geo_file = trim(out_path) // '/' // trim(file_head)//'.geo' !; write(*,*)geo_file +geo_file = trim(out_path) // '/' // trim(file_head)//'.geo' !; write(*,*) geo_file call open_file2write(trim(geo_file)//char(0),fd) -npart=1 -!write(*,*)nnode,nelmt +npart = 1 +!write(*,*) nnode,nelmt buffer='C Binary' call write_string(buffer//char(0),fd) buffer='Created by write_ensight Routine' @@ -262,7 +262,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) stop endif - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written node_count = node_count + nnode @@ -285,9 +285,9 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) !write coordinates to file !call open_file2read('tmp_x'//char(0),fd_x) call open_file2read('../tmp/tmp_x'//char(0),fd_x) -do i=1,slice_nnode(i_slice) +do i = 1,slice_nnode(i_slice) call read_float(tmp_real,fd_x) - !write(*,*)'new:',tmp_real + !write(*,*) 'new:',tmp_real !stop call write_float(tmp_real,fd) enddo @@ -296,14 +296,14 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) call open_file2read('../tmp/tmp_y'//char(0),fd_y) -do i=1,slice_nnode(i_slice) +do i = 1,slice_nnode(i_slice) call read_float(tmp_real,fd_y) call write_float(tmp_real,fd) enddo call close_delete_file('../tmp/tmp_y'//char(0),fd_y) call open_file2read('../tmp/tmp_z'//char(0),fd_z) -do i=1,slice_nnode(i_slice) +do i = 1,slice_nnode(i_slice) call read_float(tmp_real,fd_z) call write_float(tmp_real,fd) enddo @@ -311,7 +311,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) ! writes element information -buffer=ensight_etype +buffer = ensight_etype call write_string(buffer//char(0),fd) call write_integer(slice_nelmt(i_slice),fd) elmt_count = 0 @@ -352,8 +352,8 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) stop endif - !write(*,*)' elements:',elmt_count,nelmt - !write(*,*)' points : ',node_count,nnode + !write(*,*) ' elements:',elmt_count,nelmt + !write(*,*) ' points : ',node_count,nnode elmt_count = elmt_count + nelmt @@ -382,7 +382,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) write(tmp_str,*)ceiling(log10(real(t_nstep)+1)) format_str3='(a,a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str)) write(tmp_str,*)ceiling(log10(real(out_nslice)+1)) -format_str3=trim(format_str3)//',a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str))//')' +format_str3 = trim(format_str3)//',a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str))//')' if (out_ncomp == 1) then out_ext='.scl' @@ -396,12 +396,12 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) endif !write(*,'(a)',advance='no')'time step: ' -do i_t=1,t_nstep +do i_t = 1,t_nstep tstep=t_start + (i_t-1)*t_inc ! Open Ensight Gold data file to store data write(out_fname,fmt=format_str1)trim(out_path) // '/'//trim(file_head)//'_',tstep,trim(out_ext) - npart=1; + npart = 1; call open_file2write(trim(out_fname)//char(0),fd) buffer='Scalar data' call write_string(buffer//char(0),fd) @@ -417,7 +417,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) if (out_ncomp > 1) then - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp node_count = 0 do i_proc = 1, nproc @@ -441,7 +441,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) open(unit = 11,file = trim(inp_fname),status='old', & action='read', iostat = ios,form ='unformatted') if (ios /= 0) then - write(*,*)'Error opening '//trim(inp_fname) + write(*,*) 'Error opening '//trim(inp_fname) stop endif @@ -472,7 +472,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) open(unit = 11,file = trim(inp_fname),status='old', & action='read', iostat = ios,form ='unformatted') if (ios /= 0) then - write(*,*)'Error opening ',trim(inp_fname) + write(*,*) 'Error opening ',trim(inp_fname) stop endif @@ -497,7 +497,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) endif ! if dat_topo == 0 deallocate(ibool) - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written node_count = node_count + nnode @@ -527,25 +527,25 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) if (dat_topo == 0) then allocate(tmp_dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) allocate(dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) - tmp_dat=0.0 - do i_comp=1,inp_ncomp + tmp_dat = 0.0 + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) open(unit = 222,file = trim(inp_fname),status='old', & action='read', iostat = ios,form ='unformatted') if (ios /= 0) then - write(*,*)'Error opening '//trim(inp_fname) + write(*,*) 'Error opening '//trim(inp_fname) stop endif read(222) dat close(222) tmp_dat=tmp_dat+real(dat) - !write(*,*)inp_fname + !write(*,*) inp_fname enddo if (inp_ncomp == 3 .and. out_ncomp == 1) then - tmp_dat=0.5*tmp_dat ! Equivalent to S-wave potential + tmp_dat = 0.5*tmp_dat ! Equivalent to S-wave potential endif ! writes point coordinates and scalar value to mesh file @@ -567,8 +567,8 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) else if (dat_topo == 1) then allocate(tmp_dat_glob(NGLOB_AB)) allocate(dat_glob(NGLOB_AB)) - tmp_dat=0.0 - do i_comp=1,inp_ncomp + tmp_dat = 0.0 + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) @@ -581,10 +581,10 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) read(11) dat_glob tmp_dat_glob=tmp_dat_glob+real(dat_glob) - !write(*,*)inp_fname + !write(*,*) inp_fname enddo if (inp_ncomp == 3 .and. out_ncomp == 1) then - tmp_dat_glob=0.5*tmp_dat_glob ! Equivalent to S-wave potential + tmp_dat_glob = 0.5*tmp_dat_glob ! Equivalent to S-wave potential endif ! writes point coordinates and scalar value to mesh file @@ -605,7 +605,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) deallocate(ibool,dat_glob,tmp_dat_glob) endif ! if dat_topo == 0 - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written node_count = node_count + nnode @@ -626,7 +626,7 @@ subroutine write_ensight_serial (i_slice,nproc,proc_list) ! Display progress write(*,fmt=format_str3,advance='no')CR,' slice: ',i_slice,'/',out_nslice,', time step: ',i_t,'/',t_nstep -enddo ! do i_t=1,t_nstep +enddo ! do i_t = 1,t_nstep !write(*,'(a)')' complete!' diff --git a/utils/Visualization/Paraview/visualize_gold/src/write_vtu.f90 b/utils/Visualization/Paraview/visualize_gold/src/write_vtu.f90 index 3da36790c..29e35aa69 100644 --- a/utils/Visualization/Paraview/visualize_gold/src/write_vtu.f90 +++ b/utils/Visualization/Paraview/visualize_gold/src/write_vtu.f90 @@ -26,7 +26,7 @@ subroutine write_vtu integer,parameter :: plot_nvar = 5 integer :: endian integer,dimension(10) :: bytes,off -integer,parameter :: LE=0,BE=1 +integer,parameter :: LE = 0,BE = 1 integer :: i,j,i_t,i_proc,iproc,i_slice integer :: ios integer :: tstep @@ -42,7 +42,7 @@ subroutine write_vtu character(len=12) :: byte_order !character(len=60) :: tmp_str, character(len=256) :: buffer,pvd_file,pvtu_file,vtu_file,mesh_file -integer,parameter :: pvd_unit=11,pvtu_unit=22,vtu_unit=33 +integer,parameter :: pvd_unit = 11,pvtu_unit = 22,vtu_unit = 33 character(len=80) :: file_head,inp_fname integer :: nnode,nelmt,tmp_nnode !,tmp_nelmt @@ -62,11 +62,11 @@ subroutine write_vtu if (out_res == 1) then ! Medium resolution ! 20-noded hexahedra - vtk_etype=25 + vtk_etype = 25 else ! Low and high resolution ! 12-noded hexahedra - vtk_etype=12 + vtk_etype = 12 endif write(tmp_str,*)proc_width @@ -80,13 +80,13 @@ subroutine write_vtu write(tmp_str,*)ceiling(log10(real(t_nstep)+1)) format_str3='(a,a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str)) write(tmp_str,*)ceiling(log10(real(out_nslice)+1)) -format_str3=trim(format_str3)//',a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str))//')' +format_str3 = trim(format_str3)//',a,i'//trim(adjustl(tmp_str))//',a,i'//trim(adjustl(tmp_str))//')' out_ext='.vtu' -!write(*,*)file_head +!write(*,*) file_head !stop ! Open pvd file -pvd_file=trim(out_path)//'/'// trim(out_head)//'.pvd' +pvd_file = trim(out_path)//'/'// trim(out_head)//'.pvd' open(unit=pvd_unit, file=trim(pvd_file), status='replace', action='write', iostat=ios) if (ios /= 0) then write(*,'(/,a)')'ERROR: output file "'//trim(pvd_file)//'" cannot be opened!' @@ -101,7 +101,7 @@ subroutine write_vtu !slice_nnode=0 !slice_nelmt=0 -do i_t=1,t_nstep +do i_t = 1,t_nstep tstep=t_start + (i_t-1)*t_inc @@ -159,7 +159,7 @@ subroutine write_vtu write(pvtu_unit,'(a)')trim(buffer) - do i_slice=1,out_nslice ! out processors + do i_slice = 1,out_nslice ! out processors ! counts total number of points in each slice !slice_nnode(i_slice) = 0 @@ -169,8 +169,8 @@ subroutine write_vtu !slice_proc_list(i_slice,1:slice_nproc(i_slice)),proc_width, & !inp_path,nnode,nelmt,out_res) !write(*,'(a)')'complete!' - !write(*,*)' Total number of nodes: ',nnode - !write(*,*)' Total number of elements: ',nelmt + !write(*,*) ' Total number of nodes: ',nnode + !write(*,*) ' Total number of elements: ',nelmt !slice_nnode(i_slice)=nnode !slice_nelmt(i_slice)=nelmt @@ -183,7 +183,7 @@ subroutine write_vtu bytes(5) = (out_ncomp*slice_nnode(i_slice))*size_float ! Nodal values off(1)=0; ! 1st offset - do i=1,plot_nvar + do i = 1,plot_nvar if (i < plot_nvar) then off(i+1)=off(i)+size_int+bytes(i) endif @@ -192,9 +192,9 @@ subroutine write_vtu ! create vtu file write(tmp_str,*)i_slice - file_head=trim(out_head)//'_server'//trim(adjustl(tmp_str)) + file_head = trim(out_head)//'_server'//trim(adjustl(tmp_str)) write(out_fname,fmt=format_str1)trim(file_head)//'_',tstep,trim(out_ext) - !write(*,*)tstep,trim(out_fname) + !write(*,*) tstep,trim(out_fname) ! write vtu file to pvtu file buffer='' write(pvtu_unit,'(a)')trim(buffer) @@ -202,7 +202,7 @@ subroutine write_vtu ! open vtu file vtu_file = trim(out_path) // '/' // trim(out_fname) open(unit=vtu_unit, file=trim(vtu_file), action='write', status='replace',iostat=ios) - !write(*,*)trim(vtu_file),vtu_unit + !write(*,*) trim(vtu_file),vtu_unit if (ios /= 0) then write(*,'(/,a)')'ERROR: file '//trim(vtu_file)//' cannot be opened!' stop @@ -316,7 +316,7 @@ subroutine write_vtu stop endif - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written tmp_nnode = tmp_nnode + nnode @@ -345,15 +345,15 @@ subroutine write_vtu endif deallocate(ibool) - !write(*,*)' elements:',elmt_count,nelmt - !write(*,*)' points : ',node_count,nnode - !write(*,*)tmp_nnode,node_count + !write(*,*) ' elements:',elmt_count,nelmt + !write(*,*) ' points : ',node_count,nnode + !write(*,*) tmp_nnode,node_count if (tmp_nnode /= node_count) then write(*,'(/,a)')'ERROR: inconsistent number of nodes!' stop endif - !write(*,*)node_count + !write(*,*) node_count !node_count = node_count + nnode elmt_count = elmt_count + nelmt @@ -364,26 +364,26 @@ subroutine write_vtu call close_file(fd_z) call close_file(fd_con) - !write(*,*)node_count,slice_nnode(i_slice) + !write(*,*) node_count,slice_nnode(i_slice) if (node_count /= slice_nnode(i_slice)) stop 'Error: Number of total points are not consistent' ! checks with total number of elements if (elmt_count /= slice_nelmt(i_slice)) then !write(*,'(/,a)')'ERROR: number of elements counted:',elmt_count,'total:',slice_nelmt(i_slice) - write(*,*)'Number of total elements are not consistent!' + write(*,*) 'Number of total elements are not consistent!' stop endif endif - !write(*,*)trim(vtu_file) + !write(*,*) trim(vtu_file) ! write coordinates to vtu file call open_file2append(trim(vtu_file)//char(0),fd) - !write(*,*)'hi' + !write(*,*) 'hi' call write_integer(bytes(1),fd) write(tmp_str,*)i_slice call open_file2read('../tmp/tmp_x_slice'//trim(adjustl(tmp_str))//char(0),fd_x) call open_file2read('../tmp/tmp_y_slice'//trim(adjustl(tmp_str))//char(0),fd_y) call open_file2read('../tmp/tmp_z_slice'//trim(adjustl(tmp_str))//char(0),fd_z) - do i=1,slice_nnode(i_slice) + do i = 1,slice_nnode(i_slice) call read_float(tmp_real,fd_x); call write_float(tmp_real,fd) call read_float(tmp_real,fd_y); call write_float(tmp_real,fd) call read_float(tmp_real,fd_z); call write_float(tmp_real,fd) @@ -395,26 +395,26 @@ subroutine write_vtu ! write connectivity to vtu file call write_integer(bytes(2),fd) call open_file2read('../tmp/tmp_con_slice'//trim(adjustl(tmp_str))//char(0),fd_con) - do i=1,slice_nelmt(i_slice) - do j=1,NENOD_OUT + do i = 1,slice_nelmt(i_slice) + do j = 1,NENOD_OUT call read_integer(tmp_int,fd_con) call write_integer(tmp_int-1,fd) - !write(*,*)tmp_int-1 + !write(*,*) tmp_int-1 enddo enddo call close_file(fd_con) ! write offsets call write_integer(bytes(3),fd) - tmp_int=0 - do i=1,slice_nelmt(i_slice) - tmp_int=tmp_int+NENOD_OUT + tmp_int = 0 + do i = 1,slice_nelmt(i_slice) + tmp_int = tmp_int+NENOD_OUT call write_integer(tmp_int,fd) enddo ! Write element types call write_integer(bytes(4),fd) - do i=1,slice_nelmt(i_slice) + do i = 1,slice_nelmt(i_slice) call write_integer(vtk_etype,fd) enddo @@ -427,11 +427,11 @@ subroutine write_vtu allocate(tmp_rvect(out_ncomp)) endif ! open temporary files - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp write(tmp_str,*)i_comp call open_file2write('../tmp/tmp_data_comp'//trim(adjustl(tmp_str))//char(0),fd_array(i_comp)) enddo - node_count=0 + node_count = 0 do i_proc = 1, slice_nproc(i_slice) iproc=slice_proc_list(i_slice,i_proc) @@ -454,7 +454,7 @@ subroutine write_vtu if (dat_topo == 0) then ! Data from local points allocate(dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) - do i_comp=1,inp_ncomp + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) @@ -490,7 +490,7 @@ subroutine write_vtu else if (dat_topo == 1) then ! Data from global points allocate(dat_glob(NGLOB_AB)) - do i_comp=1,inp_ncomp + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) @@ -525,7 +525,7 @@ subroutine write_vtu endif ! if dat_topo == 0 deallocate(ibool) - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written node_count = node_count + nnode @@ -537,27 +537,27 @@ subroutine write_vtu endif ! close temporary files - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp call close_file(fd_array(i_comp)) enddo ! open temporary files to read - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp write(tmp_str,*)i_comp call open_file2read('../tmp/tmp_data_comp'//trim(adjustl(tmp_str))//char(0),fd_array(i_comp)) enddo if (out_ncomp == 3) then ! vector - do i=1,slice_nnode(i_slice) - do i_comp=1,out_ncomp + do i = 1,slice_nnode(i_slice) + do i_comp = 1,out_ncomp call read_float(tmp_real,fd_array(i_slice)) call write_float(tmp_real,fd) enddo enddo else if (out_ncomp == 6) then ! 9-component symmetric tensor - do i=1,slice_nnode(i_slice) - do i_comp=1,out_ncomp + do i = 1,slice_nnode(i_slice) + do i_comp = 1,out_ncomp call read_float(tmp_rvect(i_comp),fd_array(i_slice)) enddo call write_float(tmp_rvect(1),fd); call write_float(tmp_rvect(4),fd); call write_float(tmp_rvect(5),fd) @@ -569,12 +569,12 @@ subroutine write_vtu stop endif ! close temporary data files - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp call close_file(fd_array(i_comp)) enddo else ! out_ncomp - node_count=0 + node_count = 0 do i_proc = 1, slice_nproc(i_slice) iproc=slice_proc_list(i_slice,i_proc) @@ -597,8 +597,8 @@ subroutine write_vtu if (dat_topo == 0) then ! Data from local points allocate(tmp_dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) allocate(dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) - tmp_dat=0.0 - do i_comp=1,inp_ncomp + tmp_dat = 0.0 + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) @@ -612,10 +612,10 @@ subroutine write_vtu read(222) dat close(222) tmp_dat=tmp_dat+real(dat) - !write(*,*)inp_fname + !write(*,*) inp_fname enddo if (inp_ncomp == 3 .and. out_ncomp == 1) then - tmp_dat=0.5*tmp_dat ! Equivalent to S-wave potential + tmp_dat = 0.5*tmp_dat ! Equivalent to S-wave potential endif ! writes point data to file @@ -637,8 +637,8 @@ subroutine write_vtu else if (dat_topo == 1) then ! Data from global points allocate(tmp_dat_glob(NGLOB_AB)) allocate(dat_glob(NGLOB_AB)) - tmp_dat=0.0 - do i_comp=1,inp_ncomp + tmp_dat = 0.0 + do i_comp = 1,inp_ncomp ! data file write(inp_fname,fmt=format_str2)trim(out_path)//'/'//trim(proc_head), & iproc,trim(inp_head(i_comp)),tstep,trim(inp_ext) @@ -651,10 +651,10 @@ subroutine write_vtu read(11) dat_glob tmp_dat_glob=tmp_dat_glob+real(dat_glob) - !write(*,*)inp_fname + !write(*,*) inp_fname enddo if (inp_ncomp == 3 .and. out_ncomp == 1) then - tmp_dat_glob=0.5*tmp_dat_glob ! Equivalent to S-wave potential + tmp_dat_glob = 0.5*tmp_dat_glob ! Equivalent to S-wave potential endif ! writes point coordinates and scalar value to mesh file @@ -675,7 +675,7 @@ subroutine write_vtu deallocate(ibool,dat_glob,tmp_dat_glob) endif ! if dat_topo == 0 - !write(*,*)' points:',node_count,nnode + !write(*,*) ' points:',node_count,nnode ! stores total number of points written node_count = node_count + nnode @@ -722,7 +722,7 @@ subroutine write_vtu close(pvd_unit); ! delete temporary mesh files -do i_slice=1,out_nslice +do i_slice = 1,out_nslice write(tmp_str,*)i_slice call delete_file('../tmp/tmp_x_slice'//trim(adjustl(tmp_str))//char(0)) call delete_file('../tmp/tmp_y_slice'//trim(adjustl(tmp_str))//char(0)) @@ -734,7 +734,7 @@ subroutine write_vtu ! free memory deallocate(fd_array,tmp_rvect) ! delete temporary data files - do i_comp=1,out_ncomp + do i_comp = 1,out_ncomp write(tmp_str,*)i_comp call delete_file('../tmp/tmp_data_comp'//trim(adjustl(tmp_str))//char(0)) enddo diff --git a/utils/Visualization/opendx_AVS/check_GMT_movie_openDX.f90 b/utils/Visualization/opendx_AVS/check_GMT_movie_openDX.f90 index 49240d9c8..ba5c25322 100644 --- a/utils/Visualization/opendx_AVS/check_GMT_movie_openDX.f90 +++ b/utils/Visualization/opendx_AVS/check_GMT_movie_openDX.f90 @@ -15,8 +15,8 @@ program check_GMT_movie ! read file open(unit=13,file='gmt_movie_000001.xyz',status='old') - do iy=1,NEX_ETA - do ix=1,NEX_XI + do iy = 1,NEX_ETA + do ix = 1,NEX_XI read(13,*) long(ix,iy),lat(ix,iy),uz(ix,iy) enddo enddo @@ -26,16 +26,16 @@ program check_GMT_movie open(unit=3,file='gmt_movie.dx',status='unknown') write(3,*) 'object 1 class array type float rank 1 shape 3 items ',NEX_XI*NEX_ETA,' data follows' - do iy=1,NEX_ETA - do ix=1,NEX_XI + do iy = 1,NEX_ETA + do ix = 1,NEX_XI write(3,*) sngl(long(ix,iy)),sngl(lat(ix,iy)),' 0' enddo enddo write(3,*) 'object 2 class array type int rank 1 shape 4 items ',(NEX_XI-1)*(NEX_ETA-1),' data follows' - do iy=1,NEX_ETA-1 - do ix=1,NEX_XI-1 + do iy = 1,NEX_ETA-1 + do ix = 1,NEX_XI-1 iglob1 = (iy-1)*NEX_XI + ix iglob2 = (iy-1)*NEX_XI + ix+1 iglob3 = (iy+1-1)*NEX_XI + ix+1 @@ -48,8 +48,8 @@ program check_GMT_movie write(3,*) 'attribute "ref" string "positions"' write(3,*) 'object 3 class array type float rank 0 items ',NEX_XI*NEX_ETA,' data follows' - do iy=1,NEX_ETA - do ix=1,NEX_XI + do iy = 1,NEX_ETA + do ix = 1,NEX_XI write(3,*) uz(ix,iy) enddo enddo diff --git a/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 b/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 index a9eb70938..0dde900ba 100644 --- a/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 +++ b/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90 @@ -51,7 +51,7 @@ program convert_CUBIT_SPECFEM_to_DX write(11,*) 'object 1 class array type float rank 1 shape 3 items ',npoin,' data follows' ! read local points in this slice and output global DX points - do ipoin=1,npoin + do ipoin = 1,npoin write(11,*) x(ipoin),y(ipoin),z(ipoin) enddo @@ -66,7 +66,7 @@ program convert_CUBIT_SPECFEM_to_DX write(11,*) 'object 2 class array type int rank 1 shape 8 items ',nspec,' data follows' ! read local elements in this slice and output global DX elements - do ispec=1,nspec + do ispec = 1,nspec read(23,*) ispec_read,i1,i2,i3,i4,i5,i6,i7,i8 ibool(1,ispec_read) = i1 ibool(2,ispec_read) = i2 @@ -80,7 +80,7 @@ program convert_CUBIT_SPECFEM_to_DX ! point order in OpenDX is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS or SPECFEM ! and point numbers start at 0 rather than 1 - do ispec=1,nspec + do ispec = 1,nspec write(11,"(i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9)") & ibool(4,ispec)-1,ibool(1,ispec)-1,ibool(8,ispec)-1,ibool(5,ispec)-1, & ibool(3,ispec)-1,ibool(2,ispec)-1,ibool(7,ispec)-1,ibool(6,ispec)-1 @@ -98,7 +98,7 @@ program convert_CUBIT_SPECFEM_to_DX ! read local elements in this slice and output global DX elements if (iflag == 1) then open(unit=23,file='materials_file',status='old',action='read') - do ispec=1,nspec + do ispec = 1,nspec ! beware: elements may not be listed in increasing order, they can appear in any order read(23,*) ispec_read,imat_read imat(ispec_read) = imat_read @@ -109,7 +109,7 @@ program convert_CUBIT_SPECFEM_to_DX open(unit=23,file='absorbing_cpml_file',status='old',action='read') read(23,*) nspec_CPML if (nspec_CPML < 1 .or. nspec_CPML > nspec) stop 'incorrect value of nspec_CPML read' - do ispec=1,nspec_CPML + do ispec = 1,nspec_CPML ! beware: elements may not be listed in increasing order, they can appear in any order read(23,*) ispec_read,imat_read imat(ispec_read) = imat_read @@ -117,7 +117,7 @@ program convert_CUBIT_SPECFEM_to_DX close(23) endif - do ispec=1,nspec + do ispec = 1,nspec val_color = imat(ispec) ! use material property read to color the elements write(11,*) val_color enddo diff --git a/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90 b/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90 index 88dd81eed..566a023a8 100644 --- a/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90 +++ b/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90 @@ -26,14 +26,14 @@ program convert_avs2dx_quads read(55,*) npoin,nspec print *,'object 1 class array type float rank 1 shape 3 items ',npoin,' data follows' - do ipoin=1,npoin + do ipoin = 1,npoin read(55,*) i1,x(ipoin),y(ipoin),z(ipoin) icorresp(i1) = ipoin print *,x(ipoin),y(ipoin),z(ipoin) enddo print *,'object 2 class array type int rank 1 shape 4 items ',nspec,' data follows' - do ispec=1,nspec + do ispec = 1,nspec read(55,*) idum1,idum2,i1,i2,i3,i4 ! point order in OpenDX is 1,4,2,3 *not* 1,2,3,4 as in AVS print *,icorresp(i1)-1,icorresp(i4)-1,icorresp(i2)-1,icorresp(i3)-1 @@ -48,7 +48,7 @@ program convert_avs2dx_quads print *,'attribute "element type" string "quads"' print *,'attribute "ref" string "positions"' print *,'object 3 class array type float rank 0 items ',npoin,' data follows' - do ipoin=1,npoin + do ipoin = 1,npoin print *,ipoin enddo diff --git a/utils/Visualization/opendx_AVS/convert_coastline_dx.f90 b/utils/Visualization/opendx_AVS/convert_coastline_dx.f90 index 57336e719..59f8d3a1a 100644 --- a/utils/Visualization/opendx_AVS/convert_coastline_dx.f90 +++ b/utils/Visualization/opendx_AVS/convert_coastline_dx.f90 @@ -9,27 +9,27 @@ program jdjfdf nelem = 7823 npoin = 8391 -do ipoin=1,npoin +do ipoin = 1,npoin read(*,*) ibool(ipoin),x(ipoin),y(ipoin),z(ipoin) enddo -do ielem=1,nelem +do ielem = 1,nelem read(*,*) idummy1,idummy2,i1(ielem),i2(ielem) enddo -do ielem=1,nelem +do ielem = 1,nelem read(*,*) idummy1,idata(ielem) enddo print *,'aaaa' -do ipoin=1,npoin +do ipoin = 1,npoin !!!!!!!! write(*,*) x(ipoin),y(ipoin),z(ipoin) !!! DK DK no z for flat surface write(*,*) x(ipoin),y(ipoin),' 0' enddo print *,'aaaa' -do ielem=1,nelem +do ielem = 1,nelem ! locate point in list do ipoin = 1,npoin if (i1(ielem) == ibool(ipoin)) goto 700 @@ -44,7 +44,7 @@ program jdjfdf enddo print *,'aaaa' -do ielem=1,nelem +do ielem = 1,nelem write(*,*) idata(ielem) enddo diff --git a/utils/Visualization/opendx_AVS/create_OpenDX_files_to_view_a_3D_mesh.f90 b/utils/Visualization/opendx_AVS/create_OpenDX_files_to_view_a_3D_mesh.f90 index 267f75285..414409e18 100644 --- a/utils/Visualization/opendx_AVS/create_OpenDX_files_to_view_a_3D_mesh.f90 +++ b/utils/Visualization/opendx_AVS/create_OpenDX_files_to_view_a_3D_mesh.f90 @@ -138,7 +138,7 @@ program create_OpenDX_file_to_view_the_mesh write(11,*) 'object 2 class array type int rank 1 shape 8 items ',nspec,' data follows' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec ! point order in OpenDX in 2D is 1,4,2,3 *not* 1,2,3,4 as in AVS ! point order in OpenDX in 3D is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS ! in the case of OpenDX, node numbers start at zero @@ -155,7 +155,7 @@ program create_OpenDX_file_to_view_the_mesh write(11,*) 'object 3 class array type float rank 0 items ',nspec,' data follows' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec write(11,*) imaterial(ispec) enddo diff --git a/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90 b/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90 index 78a060645..2026f246a 100644 --- a/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90 +++ b/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90 @@ -10,7 +10,7 @@ program permute_cubit_2_opendx ! number of elements in CUBIT mesh nspec = 13 - do ispec=1,nspec + do ispec = 1,nspec read(*,*) iglob1,iglob2,iglob3,iglob4,iglob5,iglob6,iglob7,iglob8 diff --git a/utils/Visualization/opendx_AVS/resample_CA_coastline_AVS.f90 b/utils/Visualization/opendx_AVS/resample_CA_coastline_AVS.f90 index f7f489ce1..5729dfe64 100644 --- a/utils/Visualization/opendx_AVS/resample_CA_coastline_AVS.f90 +++ b/utils/Visualization/opendx_AVS/resample_CA_coastline_AVS.f90 @@ -28,7 +28,7 @@ program dfdfd ! read points read(5,*) - do ipoin=0,npoin-1 + do ipoin = 0,npoin-1 ! ignore Z, which we will set to high value to be above topography on display read(5,*) x(ipoin),y(ipoin) xval = x(ipoin) @@ -43,7 +43,7 @@ program dfdfd ! read elements read(5,*) - do ielem=1,nelem + do ielem = 1,nelem read(5,*) i1(ielem),i2(ielem) enddo @@ -52,14 +52,14 @@ program dfdfd read(5,*) ! read data - do ielem=1,nelem + do ielem = 1,nelem read(5,*) dataval(ielem) enddo ! first count number of elements to keep ! exclude elements that are outside of clipping box, or wrong data value nelemnew = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -79,14 +79,14 @@ program dfdfd ! write points write(*,*) npoin,nelemnew,' 0 1 0' - do ipoin=0,npoin-1 + do ipoin = 0,npoin-1 write(*,*) ipoin+1,x(ipoin),y(ipoin),IZ_VALUE enddo ! then write elements kept ! exclude elements that are outside of clipping box, or wrong data value ielemreal = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -113,7 +113,7 @@ program dfdfd ! then write element data for elements kept ! exclude elements that are outside of clipping box, or wrong data value ielemreal = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else diff --git a/utils/Visualization/opendx_AVS/resample_CA_highways_AVS.f90 b/utils/Visualization/opendx_AVS/resample_CA_highways_AVS.f90 index 043dff7a4..ec7d11874 100644 --- a/utils/Visualization/opendx_AVS/resample_CA_highways_AVS.f90 +++ b/utils/Visualization/opendx_AVS/resample_CA_highways_AVS.f90 @@ -28,7 +28,7 @@ program dfdfd ! read points read(5,*) - do ipoin=0,npoin-1 + do ipoin = 0,npoin-1 ! ignore Z, which we will set to high value to be above topography on display read(5,*) x(ipoin),y(ipoin) xval = x(ipoin) @@ -43,7 +43,7 @@ program dfdfd ! read elements read(5,*) - do ielem=1,nelem + do ielem = 1,nelem read(5,*) i1(ielem),i2(ielem) enddo @@ -52,14 +52,14 @@ program dfdfd read(5,*) ! read data - do ielem=1,nelem + do ielem = 1,nelem read(5,*) dataval(ielem) enddo ! first count number of elements to keep ! exclude elements that are outside of clipping box, or wrong data value nelemnew = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -78,14 +78,14 @@ program dfdfd ! write points write(*,*) npoin,nelemnew,' 0 1 0' - do ipoin=0,npoin-1 + do ipoin = 0,npoin-1 write(*,*) ipoin+1,x(ipoin),y(ipoin),IZ_VALUE enddo ! then write elements kept ! exclude elements that are outside of clipping box, or wrong data value ielemreal = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -111,7 +111,7 @@ program dfdfd ! then write element data for elements kept ! exclude elements that are outside of clipping box, or wrong data value ielemreal = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else diff --git a/utils/Visualization/opendx_AVS/resample_CA_highways_DX.f90 b/utils/Visualization/opendx_AVS/resample_CA_highways_DX.f90 index 5c11251ec..06a844417 100644 --- a/utils/Visualization/opendx_AVS/resample_CA_highways_DX.f90 +++ b/utils/Visualization/opendx_AVS/resample_CA_highways_DX.f90 @@ -29,7 +29,7 @@ program dfdfd read(5,*) write(*,*) 'object 1 class array type float rank 1 shape 3 items ',npoin,' data follows' - do ipoin=0,npoin-1 + do ipoin = 0,npoin-1 ! ignore Z, which we will set to high value to be above topography on display read(5,*) x(ipoin),y(ipoin) xval = x(ipoin) @@ -43,7 +43,7 @@ program dfdfd ! read elements read(5,*) - do ielem=1,nelem + do ielem = 1,nelem read(5,*) i1(ielem),i2(ielem) enddo @@ -52,14 +52,14 @@ program dfdfd read(5,*) ! read data - do ielem=1,nelem + do ielem = 1,nelem read(5,*) dataval(ielem) enddo ! first count number of elements to keep ! exclude elements that are outside of clipping box, or wrong data value nelemnew = 0 - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -79,7 +79,7 @@ program dfdfd ! then write elements kept ! exclude elements that are outside of clipping box, or wrong data value - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else @@ -103,7 +103,7 @@ program dfdfd ! then write element data for elements kept ! exclude elements that are outside of clipping box, or wrong data value - do ielem=1,nelem + do ielem = 1,nelem if (x(i1(ielem)) < xmin .or. x(i1(ielem)) > xmax .or. y(i1(ielem)) < ymin .or. y(i1(ielem)) > ymax) then p1outside = .true. else diff --git a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90 b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90 index 1637ae0cc..3cb411a1f 100755 --- a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90 +++ b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90 @@ -37,7 +37,7 @@ PROGRAM visualize_HEX27_chunk_w_medit WRITE(20,*) 'Vertices' WRITE(20,*) np - DO i=1,np + DO i = 1,np READ(10,*) nsph, p1, p2, p3 WRITE(20,*) p1, p2, p3, 1 enddo @@ -47,42 +47,42 @@ PROGRAM visualize_HEX27_chunk_w_medit WRITE(20,*) nqdecoup - DO i=1,nq1 + DO i = 1,nq1 READ(31,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 2 WRITE(20,*) sf5, sf2, sf6, sf9, 2 WRITE(20,*) sf9, sf6, sf3, sf7, 2 WRITE(20,*) sf8, sf9, sf7, sf4, 2 enddo - DO i=1,nq2 + DO i = 1,nq2 READ(32,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 2 WRITE(20,*) sf5, sf2, sf6, sf9, 2 WRITE(20,*) sf9, sf6, sf3, sf7, 2 WRITE(20,*) sf8, sf9, sf7, sf4, 2 enddo - DO i=1,nq3 + DO i = 1,nq3 READ(33,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 2 WRITE(20,*) sf5, sf2, sf6, sf9, 2 WRITE(20,*) sf9, sf6, sf3, sf7, 2 WRITE(20,*) sf8, sf9, sf7, sf4, 2 enddo - DO i=1,nq4 + DO i = 1,nq4 READ(34,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 2 WRITE(20,*) sf5, sf2, sf6, sf9, 2 WRITE(20,*) sf9, sf6, sf3, sf7, 2 WRITE(20,*) sf8, sf9, sf7, sf4, 2 enddo - DO i=1,nq5 + DO i = 1,nq5 READ(35,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 2 WRITE(20,*) sf5, sf2, sf6, sf9, 2 WRITE(20,*) sf9, sf6, sf3, sf7, 2 WRITE(20,*) sf8, sf9, sf7, sf4, 2 enddo - DO i=1,nq6 + DO i = 1,nq6 READ(36,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9 WRITE(20,*) sf1, sf5, sf9, sf8, 3 WRITE(20,*) sf5, sf2, sf6, sf9, 3 @@ -94,7 +94,7 @@ PROGRAM visualize_HEX27_chunk_w_medit WRITE(20,*) 'Hexahedra' WRITE(20,*) nhexdecoup - DO i=1,nhex + DO i = 1,nhex READ(11,*) nsph, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, & s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27 ! diff --git a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90 b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90 index 739d89bf9..a7a6e262b 100755 --- a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90 +++ b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90 @@ -35,7 +35,7 @@ PROGRAM visualize_HEX8_chunk_w_medit WRITE(20,*) 'Vertices' WRITE(20,*) np - DO i=1,np + DO i = 1,np READ(10,*) nsph, p1, p2, p3 WRITE(20,*) p1, p2, p3, 1 enddo @@ -45,27 +45,27 @@ PROGRAM visualize_HEX8_chunk_w_medit WRITE(20,*) nquad - DO i=1,nq1 + DO i = 1,nq1 READ(31,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 2 enddo - DO i=1,nq2 + DO i = 1,nq2 READ(32,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 2 enddo - DO i=1,nq3 + DO i = 1,nq3 READ(33,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 2 enddo - DO i=1,nq4 + DO i = 1,nq4 READ(34,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 2 enddo - DO i=1,nq5 + DO i = 1,nq5 READ(35,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 2 enddo - DO i=1,nq6 + DO i = 1,nq6 READ(36,*) nsph, sf1, sf2, sf3, sf4 WRITE(20,*) sf1, sf2, sf3, sf4, 3 enddo @@ -74,7 +74,7 @@ PROGRAM visualize_HEX8_chunk_w_medit WRITE(20,*) 'Hexahedra' WRITE(20,*) nhex - DO i=1,nhex + DO i = 1,nhex READ(11,*) nsph, s1, s2, s3, s4, s5, s6, s7, s8 WRITE(20,*) s1, s2, s3, s4, s5, s6, s7, s8, 1 enddo diff --git a/utils/adjoint_sources/SU_adjoint.f90 b/utils/adjoint_sources/SU_adjoint.f90 index 6a48e9669..7052ab775 100644 --- a/utils/adjoint_sources/SU_adjoint.f90 +++ b/utils/adjoint_sources/SU_adjoint.f90 @@ -148,7 +148,7 @@ program SU_adjoint endif ! loops over all records - irec=1 + irec = 1 do while(ios == 0) ! reads in data read(11,rec=irec,iostat=ios) r4head,dat @@ -165,7 +165,7 @@ program SU_adjoint write(33,rec=irec,iostat=ios) r4head,adj if (ios /= 0) cycle - irec=irec+1 + irec = irec+1 enddo close(11) close(22) diff --git a/utils/infos/unused_routines/create_movie_GMT/compute_parameters.f90 b/utils/infos/unused_routines/create_movie_GMT/compute_parameters.f90 index 7ccf89e63..a4dd17244 100644 --- a/utils/infos/unused_routines/create_movie_GMT/compute_parameters.f90 +++ b/utils/infos/unused_routines/create_movie_GMT/compute_parameters.f90 @@ -140,10 +140,10 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, & NPROC = NPROC_XI * NPROC_ETA ! number of spectral elements at the bottom of the doubling below the moho - NEX_DOUBLING_SEDIM_XI=NEX_XI/2 - NEX_DOUBLING_SEDIM_ETA=NEX_ETA/2 - NEX_DOUBLING_SEDIM_PER_PROC_XI=NEX_PER_PROC_XI/2 - NEX_DOUBLING_SEDIM_PER_PROC_ETA=NEX_PER_PROC_ETA/2 + NEX_DOUBLING_SEDIM_XI = NEX_XI/2 + NEX_DOUBLING_SEDIM_ETA = NEX_ETA/2 + NEX_DOUBLING_SEDIM_PER_PROC_XI = NEX_PER_PROC_XI/2 + NEX_DOUBLING_SEDIM_PER_PROC_ETA = NEX_PER_PROC_ETA/2 ! exact number of spectral elements without doubling layers NSPEC_NO_DOUBLING = & @@ -159,7 +159,7 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, & +NEX_DOUBLING_SEDIM_XI*NEX_DOUBLING_SEDIM_ETA)/4 ! for type AB, each doubling brick contains 40 elements on 3 levels - NSPEC_DOUBLING_AB=40*NUM_DOUBLING_BRICKS + NSPEC_DOUBLING_AB = 40*NUM_DOUBLING_BRICKS ! %%%%%%%%%%%%%% surface elements %%%%%%%%%%%%%%%%%%% @@ -187,12 +187,12 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, & +NEX_DOUBLING_SEDIM_PER_PROC_ETA)/2 ! for type A, each doubling brick contains 10 elements on 3 levels - NSPEC2D_DOUBLING_A_XI=10*NUM2D_DOUBLING_BRICKS_XI - NSPEC2D_DOUBLING_A_ETA=10*NUM2D_DOUBLING_BRICKS_ETA + NSPEC2D_DOUBLING_A_XI = 10*NUM2D_DOUBLING_BRICKS_XI + NSPEC2D_DOUBLING_A_ETA = 10*NUM2D_DOUBLING_BRICKS_ETA ! for type B, each doubling brick contains 12 elements on 3 levels - NSPEC2D_DOUBLING_B_XI=12*NUM2D_DOUBLING_BRICKS_XI - NSPEC2D_DOUBLING_B_ETA=12*NUM2D_DOUBLING_BRICKS_ETA + NSPEC2D_DOUBLING_B_XI = 12*NUM2D_DOUBLING_BRICKS_XI + NSPEC2D_DOUBLING_B_ETA = 12*NUM2D_DOUBLING_BRICKS_ETA ! exact number of spectral elements NSPEC_AB = (NSPEC_NO_DOUBLING + NSPEC_DOUBLING_AB) / NPROC diff --git a/utils/infos/unused_routines/create_movie_GMT/create_movie_GMT.f90 b/utils/infos/unused_routines/create_movie_GMT/create_movie_GMT.f90 index 114a3920f..c5a508075 100644 --- a/utils/infos/unused_routines/create_movie_GMT/create_movie_GMT.f90 +++ b/utils/infos/unused_routines/create_movie_GMT/create_movie_GMT.f90 @@ -463,7 +463,7 @@ program create_movie_GMT igmt = 1 ! output list of points mask_point = .false. - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX @@ -572,24 +572,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI allocate(work(npointot)) ! establish initial pointers - do ispec=1,nspec + do ispec = 1,nspec ieoff=NGNOD2D_AVS_DX*(ispec-1) - do ilocnum=1,NGNOD2D_AVS_DX + do ilocnum = 1,NGNOD2D_AVS_DX loc(ilocnum+ieoff)=ilocnum+ieoff enddo enddo - ifseg(:)=.false. + ifseg(:) = .false. - nseg=1 - ifseg(1)=.true. + nseg = 1 + ifseg(1) = .true. ninseg(1)=npointot - do j=1,NDIM + do j = 1,NDIM ! sort within each segment - ioff=1 - do iseg=1,nseg + ioff = 1 + do iseg = 1,nseg if (j == 1) then call rank(xp(ioff),ind,ninseg(iseg)) else if (j == 2) then @@ -604,24 +604,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI ! check for jumps in current coordinate ! compare the coordinates of the points within a small tolerance if (j == 1) then - do i=2,npointot - if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else if (j == 2) then - do i=2,npointot - if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else - do i=2,npointot - if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo endif ! count up number of different segments - nseg=0 - do i=1,npointot + nseg = 0 + do i = 1,npointot if (ifseg(i)) then - nseg=nseg+1 + nseg = nseg+1 ninseg(nseg)=1 else ninseg(nseg)=ninseg(nseg)+1 @@ -630,13 +630,13 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI enddo ! assign global node numbers (now sorted lexicographically) - ig=0 - do i=1,npointot - if (ifseg(i)) ig=ig+1 + ig = 0 + do i = 1,npointot + if (ifseg(i)) ig = ig+1 iglob(loc(i))=ig enddo - nglob=ig + nglob = ig ! deallocate arrays deallocate(ind) @@ -663,42 +663,42 @@ subroutine rank(A,IND,N) integer i,j,l,ir,indx double precision q - do j=1,n + do j = 1,n IND(j)=j enddo if (n == 1) return - L=n/2+1 - ir=n + L = n/2+1 + ir = n 100 continue if (l > 1) then - l=l-1 + l = l-1 indx=ind(l) q=a(indx) ELSE indx=ind(ir) q=a(indx) ind(ir)=ind(1) - ir=ir-1 + ir = ir-1 if (ir == 1) then ind(1)=indx return endif endif - i=l - j=l+l + i = l + j = l+l 200 continue if (J <= IR) then if (J < IR) then - if ( A(IND(j)) < A(IND(j+1)) ) j=j+1 + if ( A(IND(j)) < A(IND(j+1)) ) j = j+1 endif if (q < A(IND(j))) then IND(I)=IND(J) - I=J - J=J+J + I = J + J = J+J ELSE - J=IR+1 + J = IR+1 endif goto 200 endif @@ -725,20 +725,20 @@ subroutine swap_all(IA,A,B,C,IW,W,ind,n) IW(:) = IA(:) W(:) = A(:) - do i=1,n + do i = 1,n IA(i)=IW(ind(i)) A(i)=W(ind(i)) enddo W(:) = B(:) - do i=1,n + do i = 1,n B(i)=W(ind(i)) enddo W(:) = C(:) - do i=1,n + do i = 1,n C(i)=W(ind(i)) enddo diff --git a/utils/infos/unused_routines/create_movie_GMT/utm_geo.f90 b/utils/infos/unused_routines/create_movie_GMT/utm_geo.f90 index 46a8e9ce4..4e7ab01c9 100644 --- a/utils/infos/unused_routines/create_movie_GMT/utm_geo.f90 +++ b/utils/infos/unused_routines/create_movie_GMT/utm_geo.f90 @@ -40,12 +40,12 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT double precision rx,ry,rlon,rlat logical SUPPRESS_UTM_PROJECTION - double precision, parameter :: degrad=PI/180., raddeg=180./PI + double precision, parameter :: degrad = PI/180., raddeg = 180./PI !double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 - double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 + double precision, parameter :: semimaj = 6378137.0d0, semimin = 6356752.314245d0 ! WGS-84 double precision, parameter :: scfa=.9996d0 - double precision, parameter :: north=0.d0, east=500000.d0 + double precision, parameter :: north = 0.d0, east = 500000.d0 double precision e2,e4,e6,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d @@ -70,8 +70,8 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway,SUPPRESS_UTM_PROJECT ! define parameters of reference ellipsoid e2=1.0-(semimin/semimaj)**2.0 - e4=e2*e2 - e6=e2*e4 + e4 = e2*e2 + e6 = e2*e4 ep2=e2/(1.-e2) if (iway == IUTM2LONGLAT) then diff --git a/utils/infos/unused_routines/decimate_mesh/decimate_mesh.f90 b/utils/infos/unused_routines/decimate_mesh/decimate_mesh.f90 index c59f47d5a..94994b3f2 100644 --- a/utils/infos/unused_routines/decimate_mesh/decimate_mesh.f90 +++ b/utils/infos/unused_routines/decimate_mesh/decimate_mesh.f90 @@ -78,7 +78,7 @@ program decimate_mesh ! set up local geometric tolerances xtypdist=+HUGEVAL - do ispec=1,nelmnts_ext_mesh + do ispec = 1,nelmnts_ext_mesh xminval=+HUGEVAL yminval=+HUGEVAL @@ -88,12 +88,12 @@ program decimate_mesh zmaxval=-HUGEVAL do inode = 1, 8 - xmaxval=max(nodes_coords_ext_mesh(1,elmnts_ext_mesh(inode,ispec)),xmaxval) - xminval=min(nodes_coords_ext_mesh(1,elmnts_ext_mesh(inode,ispec)),xminval) - ymaxval=max(nodes_coords_ext_mesh(2,elmnts_ext_mesh(inode,ispec)),ymaxval) - yminval=min(nodes_coords_ext_mesh(2,elmnts_ext_mesh(inode,ispec)),yminval) - zmaxval=max(nodes_coords_ext_mesh(3,elmnts_ext_mesh(inode,ispec)),zmaxval) - zminval=min(nodes_coords_ext_mesh(3,elmnts_ext_mesh(inode,ispec)),zminval) + xmaxval = max(nodes_coords_ext_mesh(1,elmnts_ext_mesh(inode,ispec)),xmaxval) + xminval = min(nodes_coords_ext_mesh(1,elmnts_ext_mesh(inode,ispec)),xminval) + ymaxval = max(nodes_coords_ext_mesh(2,elmnts_ext_mesh(inode,ispec)),ymaxval) + yminval = min(nodes_coords_ext_mesh(2,elmnts_ext_mesh(inode,ispec)),yminval) + zmaxval = max(nodes_coords_ext_mesh(3,elmnts_ext_mesh(inode,ispec)),zmaxval) + zminval = min(nodes_coords_ext_mesh(3,elmnts_ext_mesh(inode,ispec)),zminval) enddo ! compute the minimum typical "size" of an element in the mesh @@ -105,7 +105,7 @@ program decimate_mesh enddo ! define a tolerance, small with respect to the minimum size - xtol=smallval_tol*xtypdist*1.d7 + xtol = smallval_tol*xtypdist*1.d7 print *, 'xtypdist' , xtypdist print *, 'facteur de tolerance XTOL = ', xtol diff --git a/utils/infos/unused_routines/define_subregions.f90 b/utils/infos/unused_routines/define_subregions.f90 index f96ef076d..dbd77c61e 100644 --- a/utils/infos/unused_routines/define_subregions.f90 +++ b/utils/infos/unused_routines/define_subregions.f90 @@ -63,21 +63,21 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-2 - diy=2 + iy1 = 0 + iy2 = npy-2 + diy = 2 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - ir1=0 + ir1 = 0 ir2=2*(NER - 2) - dir=2 + dir = 2 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 doubling_index = IFLAG_BASEMENT_TOPO @@ -85,21 +85,21 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-2 - diy=2 + iy1 = 0 + iy2 = npy-2 + diy = 2 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 ir1=2*(NER - 1) - ir2=ir1 - dir=2 + ir2 = ir1 + dir = 2 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 doubling_index = IFLAG_ONE_LAYER_TOPOGRAPHY @@ -119,21 +119,21 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-2 - diy=2 + iy1 = 0 + iy2 = npy-2 + diy = 2 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 ir1=2*(NER - NER_SEDIM) ir2=2*(NER - 2) - dir=2 + dir = 2 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 doubling_index = IFLAG_BASEMENT_TOPO @@ -141,21 +141,21 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-2 - diy=2 + iy1 = 0 + iy2 = npy-2 + diy = 2 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 ir1=2*(NER - 1) - ir2=ir1 - dir=2 + ir2 = ir1 + dir = 2 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 doubling_index = IFLAG_ONE_LAYER_TOPOGRAPHY @@ -163,21 +163,21 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 ir1= 0 ir2= 2*NER_BOTTOM_MOHO-8 - dir=8 + dir = 8 - iax=4 - iay=4 - iar=4 + iax = 4 + iay = 4 + iar = 4 doubling_index= IFLAG_HALFSPACE_MOHO @@ -187,24 +187,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 2 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-16 - dix=16 + ix1 = 0 + ix2 = npx-16 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 26) then @@ -212,24 +212,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 3 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=8 - ix2=npx-8 - dix=16 + ix1 = 8 + ix2 = npx-8 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 25) then @@ -237,24 +237,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 4 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-16 - dix=16 + ix1 = 0 + ix2 = npx-16 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 24) then @@ -262,24 +262,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 5 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=12 - ix2=npx-4 - dix=16 + ix1 = 12 + ix2 = npx-4 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 23) then @@ -287,24 +287,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 6 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=4 - ix2=npx-12 - dix=16 + ix1 = 4 + ix2 = npx-12 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 22) then @@ -312,24 +312,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 7 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=8 - ix2=npx-8 - dix=16 + ix1 = 8 + ix2 = npx-8 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 21) then @@ -337,24 +337,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 8 of the mesh doubling below 670 - iy1=8 - iy2=npy-8 - diy=16 + iy1 = 8 + iy2 = npy-8 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 20) then @@ -362,24 +362,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 9 of the mesh doubling below 670 - iy1=0 - iy2=npy-16 - diy=16 + iy1 = 0 + iy2 = npy-16 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 19) then @@ -387,24 +387,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 10 of the mesh doubling below 670 - iy1=8 - iy2=npy-8 - diy=16 + iy1 = 8 + iy2 = npy-8 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 18) then @@ -412,24 +412,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 11 of the mesh doubling below 670 - iy1=4 - iy2=npy-12 - diy=16 + iy1 = 4 + iy2 = npy-12 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 17) then @@ -437,24 +437,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 12 of the mesh doubling below 670 - iy1=12 - iy2=npy-4 - diy=16 + iy1 = 12 + iy2 = npy-4 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 16) then @@ -462,45 +462,45 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 13 of the mesh doubling below 670 - iy1=0 - iy2=npy-16 - diy=16 + iy1 = 0 + iy2 = npy-16 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_16km_BASEMENT + doubling_index = IFLAG_16km_BASEMENT else if (isubregion == 15) then call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 ! honor So-Cal model discontinuity at 16 km for accuracy - ir1=2*NER_BOTTOM_MOHO + ir1 = 2*NER_BOTTOM_MOHO ir2=2*(NER_BOTTOM_MOHO+NER_MOHO_16) - 4 - dir=4 + dir = 4 - iax=4 - iay=4 - iar=2 + iax = 4 + iay = 4 + iar = 2 doubling_index = IFLAG_MOHO_16km @@ -508,22 +508,22 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & call usual_hex_nodes(iaddx,iaddy,iaddz) - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 ! honor So-Cal model discontinuity at 16 km for accuracy ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16) ir2=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT)-12 - dir=4 + dir = 4 - iax=4 - iay=4 - iar=2 + iax = 4 + iay = 4 + iar = 2 doubling_index = IFLAG_16km_BASEMENT @@ -534,23 +534,23 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 1 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT) ir2=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-12 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=2 + iax = 2 + iay = 2 + iar = 2 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 12) then @@ -558,24 +558,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 2 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 11) then @@ -583,24 +583,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 3 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=4 - ix2=npx-4 - dix=8 + ix1 = 4 + ix2 = npx-4 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 10) then @@ -608,24 +608,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 4 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-8 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 9) then @@ -633,24 +633,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 5 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=6 - ix2=npx-2 - dix=8 + ix1 = 6 + ix2 = npx-2 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 8) then @@ -658,24 +658,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 6 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=2 - ix2=npx-6 - dix=8 + ix1 = 2 + ix2 = npx-6 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 7) then @@ -683,24 +683,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 7 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=4 - ix2=npx-4 - dix=8 + ix1 = 4 + ix2 = npx-4 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-6 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 6) then @@ -708,24 +708,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 8 of the mesh doubling below the Moho - iy1=4 - iy2=npy-4 - diy=8 + iy1 = 4 + iy2 = npy-4 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 5) then @@ -733,24 +733,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 9 of the mesh doubling below the Moho - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 4) then @@ -758,24 +758,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 10 of the mesh doubling below the Moho - iy1=4 - iy2=npy-4 - diy=8 + iy1 = 4 + iy2 = npy-4 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 3) then @@ -783,24 +783,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 11 of the mesh doubling below the Moho - iy1=2 - iy2=npy-6 - diy=8 + iy1 = 2 + iy2 = npy-6 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 2) then @@ -808,24 +808,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 12 of the mesh doubling below the Moho - iy1=6 - iy2=npy-2 - diy=8 + iy1 = 6 + iy2 = npy-2 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-2 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else if (isubregion == 1) then @@ -833,24 +833,24 @@ subroutine define_subregions(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 13 of the mesh doubling below the Moho - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-4 - ir2=ir1 + ir2 = ir1 - doubling_index=IFLAG_BASEMENT_TOPO + doubling_index = IFLAG_BASEMENT_TOPO else diff --git a/utils/infos/unused_routines/define_subregions_heuristic.f90 b/utils/infos/unused_routines/define_subregions_heuristic.f90 index f6729fd8f..a693d5a5f 100644 --- a/utils/infos/unused_routines/define_subregions_heuristic.f90 +++ b/utils/infos/unused_routines/define_subregions_heuristic.f90 @@ -64,22 +64,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 2 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-16 - dix=16 + ix1 = 0 + ix2 = npx-16 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 8 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_1 @@ -89,22 +89,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 3 of the mesh doubling below 670 - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=8 - ix2=npx-8 - dix=16 + ix1 = 8 + ix2 = npx-8 + dix = 16 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 8 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_1p @@ -114,22 +114,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 8 of the mesh doubling below 670 - iy1=8 - iy2=npy-8 - diy=16 + iy1 = 8 + iy2 = npy-8 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 4 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_4 @@ -139,22 +139,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 9 of the mesh doubling below 670 - iy1=0 - iy2=npy-16 - diy=16 + iy1 = 0 + iy2 = npy-16 + diy = 16 - ix1=0 - ix2=npx-4 - dix=4 + ix1 = 0 + ix2 = npx-4 + dix = 4 - dir=4 + dir = 4 - iax=2 - iay=2 - iar=1 + iax = 2 + iay = 2 + iar = 1 ir1=2*(NER_BOTTOM_MOHO + NER_MOHO_16 + NER_16_BASEMENT) - 4 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_4p @@ -164,22 +164,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 2 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=0 - ix2=npx-8 - dix=8 + ix1 = 0 + ix2 = npx-8 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-8 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_1 @@ -189,22 +189,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 3 of the mesh doubling below the Moho - iy1=0 - iy2=npy-4 - diy=4 + iy1 = 0 + iy2 = npy-4 + diy = 4 - ix1=4 - ix2=npx-4 - dix=8 + ix1 = 4 + ix2 = npx-4 + dix = 8 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-8 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_1p @@ -214,22 +214,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 8 of the mesh doubling below the Moho - iy1=4 - iy2=npy-4 - diy=8 + iy1 = 4 + iy2 = npy-4 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-4 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_4 @@ -239,22 +239,22 @@ subroutine define_subregions_heuristic(myrank,isubregion,iaddx,iaddy,iaddz, & ! generating stage 9 of the mesh doubling below the Moho - iy1=0 - iy2=npy-8 - diy=8 + iy1 = 0 + iy2 = npy-8 + diy = 8 - ix1=0 - ix2=npx-2 - dix=2 + ix1 = 0 + ix2 = npx-2 + dix = 2 - dir=4 + dir = 4 - iax=1 - iay=1 - iar=1 + iax = 1 + iay = 1 + iar = 1 ir1=2*(NER_BOTTOM_MOHO+NER_MOHO_16+NER_16_BASEMENT+NER_BASEMENT_SEDIM)-4 - ir2=ir1 + ir2 = ir1 itype_element = ITYPE_UNUSUAL_4p diff --git a/utils/infos/unused_routines/mesh_vertical.f90 b/utils/infos/unused_routines/mesh_vertical.f90 index d4aa55797..4539bee54 100644 --- a/utils/infos/unused_routines/mesh_vertical.f90 +++ b/utils/infos/unused_routines/mesh_vertical.f90 @@ -52,8 +52,8 @@ subroutine mesh_vertical(myrank,rn,NER,NER_BOTTOM_MOHO,NER_MOHO_16, & ! !--- bottom of the mesh (Z_DEPTH_BLOCK) to Moho ! - do ir=0,2*NER_BOTTOM_MOHO-1 - npr=npr+1 + do ir = 0,2*NER_BOTTOM_MOHO-1 + npr = npr+1 rn(npr)=(Z_DEPTH_MOHO-Z_DEPTH_BLOCK)*dble(ir)/dble(2*NER_BOTTOM_MOHO) enddo @@ -63,8 +63,8 @@ subroutine mesh_vertical(myrank,rn,NER,NER_BOTTOM_MOHO,NER_MOHO_16, & ! !--- Moho to modified basement surface ! - do ir=0,2*(NER_MOHO_16+NER_16_BASEMENT)-1 - npr=npr+1 + do ir = 0,2*(NER_MOHO_16+NER_16_BASEMENT)-1 + npr = npr+1 rn(npr)=(Z_DEPTH_MOHO-Z_DEPTH_BLOCK) + (Z_BASEMENT_SURFACE-Z_DEPTH_MOHO)*dble(ir)/dble(2*(NER_MOHO_16+NER_16_BASEMENT)) enddo @@ -72,15 +72,15 @@ subroutine mesh_vertical(myrank,rn,NER,NER_BOTTOM_MOHO,NER_MOHO_16, & ! !--- Moho to d16km ! - do ir=0,2*NER_MOHO_16-1 - npr=npr+1 + do ir = 0,2*NER_MOHO_16-1 + npr = npr+1 rn(npr)=(Z_DEPTH_MOHO-Z_DEPTH_BLOCK) + (DEPTH_16km_SOCAL-Z_DEPTH_MOHO)*dble(ir)/dble(2*NER_MOHO_16) enddo ! !--- d16km to modified basement surface ! - do ir=0,2*NER_16_BASEMENT-1 - npr=npr+1 + do ir = 0,2*NER_16_BASEMENT-1 + npr = npr+1 rn(npr)=(DEPTH_16km_SOCAL-Z_DEPTH_BLOCK) + (Z_BASEMENT_SURFACE-DEPTH_16km_SOCAL)*dble(ir)/dble(2*NER_16_BASEMENT) enddo @@ -91,8 +91,8 @@ subroutine mesh_vertical(myrank,rn,NER,NER_BOTTOM_MOHO,NER_MOHO_16, & ! ! also create last point exactly at the surface ! other regions above stop one point below - do ir=0,2*(NER_BASEMENT_SEDIM+NER_SEDIM) - 0 - npr=npr+1 + do ir = 0,2*(NER_BASEMENT_SEDIM+NER_SEDIM) - 0 + npr = npr+1 rn(npr)=(Z_BASEMENT_SURFACE-Z_DEPTH_BLOCK) + & !! DK DK UGLY modif z_top by Emmanuel Chaljub here !! DK DK UGLY suppressed Manu's modif and put old code back because better mesh @@ -113,7 +113,7 @@ subroutine mesh_vertical(myrank,rn,NER,NER_BOTTOM_MOHO,NER_MOHO_16, & if (npr /= 2*NER) call exit_MPI(myrank,'incorrect intervals for model') ! check that vertical spacing makes sense - do ir=0,2*NER-1 + do ir = 0,2*NER-1 if (rn(ir+1) < rn(ir)) call exit_MPI(myrank,'incorrect vertical spacing for model') enddo diff --git a/utils/infos/unused_routines/opendx_AVS/combine_AVS_DX.f90 b/utils/infos/unused_routines/opendx_AVS/combine_AVS_DX.f90 index f687121af..909d67e60 100644 --- a/utils/infos/unused_routines/opendx_AVS/combine_AVS_DX.f90 +++ b/utils/infos/unused_routines/opendx_AVS/combine_AVS_DX.f90 @@ -243,7 +243,7 @@ program combine_AVS_DX ! initialize random colors allocate(random_colors(0:NPROC-1)) - do iproc=0,NPROC-1 + do iproc = 0,NPROC-1 call random_number(random_val) ival_color = nint(random_val*NPROC) if (ival_color < 0) ival_color = 0 @@ -314,7 +314,7 @@ program combine_AVS_DX iglobpointoffset = 0 ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc @@ -331,7 +331,7 @@ program combine_AVS_DX print *,'There are ',npoin,' global AVS or DX points in the slice' ! read local points in this slice and output global AVS or DX points - do ipoin=1,npoin + do ipoin = 1,npoin read(10,*) numpoin,xval,yval,zval if (numpoin /= ipoin) stop 'incorrect point number' ! write to AVS or DX global file with correct offset @@ -370,7 +370,7 @@ program combine_AVS_DX write(11,*) 'object 2 class array type int rank 1 shape 4 items ',ntotspecAVS_DX,' data follows' ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc @@ -392,7 +392,7 @@ program combine_AVS_DX print *,'There are ',npoin,' global AVS or DX points in the slice' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4 if (numelem /= ispec) stop 'incorrect element number' ! compute max of the doubling flag @@ -459,7 +459,7 @@ program combine_AVS_DX iglobelemoffset = 0 ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc @@ -476,7 +476,7 @@ program combine_AVS_DX print *,'There are ',nspec,' AVS or DX elements in the slice' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4 if (numelem /= ispec) stop 'incorrect element number' @@ -514,7 +514,7 @@ program combine_AVS_DX iglobpointoffset = 0 ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc @@ -527,7 +527,7 @@ program combine_AVS_DX print *,'There are ',npoin,' global AVS or DX points in the slice' ! read local points in this slice and output global AVS or DX points - do ipoin=1,npoin + do ipoin = 1,npoin read(10,*) numpoin,xval,yval,zval if (numpoin /= ipoin) stop 'incorrect point number' ! write to AVS or DX global file with correct offset @@ -642,7 +642,7 @@ program combine_AVS_DX ! loop on all the stations open(unit=11,file=filtered_rec_filename,status='old',action='read') - do irec=1,nrec + do irec = 1,nrec read(11,*) station_name(irec),network_name(irec),stlat(irec),stlon(irec),stele(irec),stbur(irec) ! points for the receivers are put at the surface for clarity (depth ignored) @@ -669,7 +669,7 @@ program combine_AVS_DX sngl(y_target_source+small_offset),' ',sngl(z_target_source+small_offset) write(11,*) '3 ',sngl(x_target_source+small_offset),' ', & sngl(y_target_source+small_offset),' ',sngl(z_target_source+small_offset) - do ir=1,nrec + do ir = 1,nrec write(11,*) 4+2*(ir-1),' ',sngl(x_target(ir)),' ',sngl(y_target(ir)),' ',sngl(z_target(ir)) write(11,*) 4+2*(ir-1)+1,' ',sngl(x_target(ir)+small_offset),' ', & sngl(y_target(ir)+small_offset),' ',sngl(z_target(ir)+small_offset) @@ -677,7 +677,7 @@ program combine_AVS_DX ! add source and receivers (small AVS or DX lines) write(11,*) '1 1 line 1 2' - do ir=1,nrec + do ir = 1,nrec write(11,*) ir+1,' 1 line ',4+2*(ir-1),' ',4+2*(ir-1)+1 enddo ! duplicate source to have right color normalization in AVS_DX @@ -689,7 +689,7 @@ program combine_AVS_DX ! add source and receiver data write(11,*) '1 1.' - do ir=1,nrec + do ir = 1,nrec write(11,*) ir+1,' 255.' enddo ! duplicate source to have right color normalization in AVS_DX diff --git a/utils/infos/unused_routines/opendx_AVS/create_highres_shakemaps_AVS_DX.f90 b/utils/infos/unused_routines/opendx_AVS/create_highres_shakemaps_AVS_DX.f90 index 20675a54b..991ee4b72 100644 --- a/utils/infos/unused_routines/opendx_AVS/create_highres_shakemaps_AVS_DX.f90 +++ b/utils/infos/unused_routines/opendx_AVS/create_highres_shakemaps_AVS_DX.f90 @@ -548,7 +548,7 @@ program create_movie_AVS_DX ! output list of points mask_point = .false. ipoin = 0 - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -664,7 +664,7 @@ program create_movie_AVS_DX ! output list of points mask_point = .false. ipoin = 0 - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -689,7 +689,7 @@ program create_movie_AVS_DX write(11,*) 'object 2 class array type int rank 1 shape 4 items ',nspectot_AVS_max,' data follows' ! output list of elements - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element ibool_number1 = iglob(ieoff + 1) @@ -743,7 +743,7 @@ program create_movie_AVS_DX mask_point = .false. ! output point data - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -852,24 +852,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI allocate(work(npointot)) ! establish initial pointers - do ispec=1,nspec + do ispec = 1,nspec ieoff=NGNOD2D_AVS_DX_HIGHRES*(ispec-1) - do ilocnum=1,NGNOD2D_AVS_DX_HIGHRES + do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES loc(ilocnum+ieoff)=ilocnum+ieoff enddo enddo - ifseg(:)=.false. + ifseg(:) = .false. - nseg=1 - ifseg(1)=.true. + nseg = 1 + ifseg(1) = .true. ninseg(1)=npointot - do j=1,NDIM + do j = 1,NDIM ! sort within each segment - ioff=1 - do iseg=1,nseg + ioff = 1 + do iseg = 1,nseg if (j == 1) then call rank(xp(ioff),ind,ninseg(iseg)) else if (j == 2) then @@ -884,24 +884,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI ! check for jumps in current coordinate ! compare the coordinates of the points within a small tolerance if (j == 1) then - do i=2,npointot - if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else if (j == 2) then - do i=2,npointot - if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else - do i=2,npointot - if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo endif ! count up number of different segments - nseg=0 - do i=1,npointot + nseg = 0 + do i = 1,npointot if (ifseg(i)) then - nseg=nseg+1 + nseg = nseg+1 ninseg(nseg)=1 else ninseg(nseg)=ninseg(nseg)+1 @@ -910,13 +910,13 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI enddo ! assign global node numbers (now sorted lexicographically) - ig=0 - do i=1,npointot - if (ifseg(i)) ig=ig+1 + ig = 0 + do i = 1,npointot + if (ifseg(i)) ig = ig+1 iglob(loc(i))=ig enddo - nglob=ig + nglob = ig ! deallocate arrays deallocate(ind) @@ -943,42 +943,42 @@ subroutine rank(A,IND,N) integer i,j,l,ir,indx double precision q - do j=1,n + do j = 1,n IND(j)=j enddo if (n == 1) return - L=n/2+1 - ir=n + L = n/2+1 + ir = n 100 continue if (l > 1) then - l=l-1 + l = l-1 indx=ind(l) q=a(indx) ELSE indx=ind(ir) q=a(indx) ind(ir)=ind(1) - ir=ir-1 + ir = ir-1 if (ir == 1) then ind(1)=indx return endif endif - i=l - j=l+l + i = l + j = l+l 200 continue if (J <= IR) then if (J < IR) then - if ( A(IND(j)) < A(IND(j+1)) ) j=j+1 + if ( A(IND(j)) < A(IND(j+1)) ) j = j+1 endif if (q < A(IND(j))) then IND(I)=IND(J) - I=J - J=J+J + I = J + J = J+J ELSE - J=IR+1 + J = IR+1 endif goto 200 endif @@ -1005,20 +1005,20 @@ subroutine swap_all(IA,A,B,C,IW,W,ind,n) IW(:) = IA(:) W(:) = A(:) - do i=1,n + do i = 1,n IA(i)=IW(ind(i)) A(i)=W(ind(i)) enddo W(:) = B(:) - do i=1,n + do i = 1,n B(i)=W(ind(i)) enddo W(:) = C(:) - do i=1,n + do i = 1,n C(i)=W(ind(i)) enddo diff --git a/utils/infos/unused_routines/opendx_AVS/extract_shakemap_GMT.f90 b/utils/infos/unused_routines/opendx_AVS/extract_shakemap_GMT.f90 index 04f4633f5..f0d972d23 100644 --- a/utils/infos/unused_routines/opendx_AVS/extract_shakemap_GMT.f90 +++ b/utils/infos/unused_routines/opendx_AVS/extract_shakemap_GMT.f90 @@ -549,7 +549,7 @@ program create_movie_AVS_DX ! output list of points mask_point = .false. ipoin = 0 - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -665,7 +665,7 @@ program create_movie_AVS_DX ! output list of points mask_point = .false. ipoin = 0 - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -690,7 +690,7 @@ program create_movie_AVS_DX write(11,*) 'object 2 class array type int rank 1 shape 4 items ',nspectot_AVS_max,' data follows' ! output list of elements - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element ibool_number1 = iglob(ieoff + 1) @@ -744,7 +744,7 @@ program create_movie_AVS_DX mask_point = .false. ! output point data - do ispec=1,nspectot_AVS_max + do ispec = 1,nspectot_AVS_max ieoff = NGNOD2D_AVS_DX_HIGHRES*(ispec-1) ! four points for each element do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES @@ -853,24 +853,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI allocate(work(npointot)) ! establish initial pointers - do ispec=1,nspec + do ispec = 1,nspec ieoff=NGNOD2D_AVS_DX_HIGHRES*(ispec-1) - do ilocnum=1,NGNOD2D_AVS_DX_HIGHRES + do ilocnum = 1,NGNOD2D_AVS_DX_HIGHRES loc(ilocnum+ieoff)=ilocnum+ieoff enddo enddo - ifseg(:)=.false. + ifseg(:) = .false. - nseg=1 - ifseg(1)=.true. + nseg = 1 + ifseg(1) = .true. ninseg(1)=npointot - do j=1,NDIM + do j = 1,NDIM ! sort within each segment - ioff=1 - do iseg=1,nseg + ioff = 1 + do iseg = 1,nseg if (j == 1) then call rank(xp(ioff),ind,ninseg(iseg)) else if (j == 2) then @@ -885,24 +885,24 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI ! check for jumps in current coordinate ! compare the coordinates of the points within a small tolerance if (j == 1) then - do i=2,npointot - if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(xp(i)-xp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else if (j == 2) then - do i=2,npointot - if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(yp(i)-yp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo else - do i=2,npointot - if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i)=.true. + do i = 2,npointot + if (dabs(zp(i)-zp(i-1)) > SMALLVALTOL) ifseg(i) = .true. enddo endif ! count up number of different segments - nseg=0 - do i=1,npointot + nseg = 0 + do i = 1,npointot if (ifseg(i)) then - nseg=nseg+1 + nseg = nseg+1 ninseg(nseg)=1 else ninseg(nseg)=ninseg(nseg)+1 @@ -911,13 +911,13 @@ subroutine get_global_AVS(nspec,xp,yp,zp,iglob,loc,ifseg,nglob,npointot,UTM_X_MI enddo ! assign global node numbers (now sorted lexicographically) - ig=0 - do i=1,npointot - if (ifseg(i)) ig=ig+1 + ig = 0 + do i = 1,npointot + if (ifseg(i)) ig = ig+1 iglob(loc(i))=ig enddo - nglob=ig + nglob = ig ! deallocate arrays deallocate(ind) @@ -944,42 +944,42 @@ subroutine rank(A,IND,N) integer i,j,l,ir,indx double precision q - do j=1,n + do j = 1,n IND(j)=j enddo if (n == 1) return - L=n/2+1 - ir=n + L = n/2+1 + ir = n 100 continue if (l > 1) then - l=l-1 + l = l-1 indx=ind(l) q=a(indx) ELSE indx=ind(ir) q=a(indx) ind(ir)=ind(1) - ir=ir-1 + ir = ir-1 if (ir == 1) then ind(1)=indx return endif endif - i=l - j=l+l + i = l + j = l+l 200 continue if (J <= IR) then if (J < IR) then - if ( A(IND(j)) < A(IND(j+1)) ) j=j+1 + if ( A(IND(j)) < A(IND(j+1)) ) j = j+1 endif if (q < A(IND(j))) then IND(I)=IND(J) - I=J - J=J+J + I = J + J = J+J ELSE - J=IR+1 + J = IR+1 endif goto 200 endif @@ -1006,20 +1006,20 @@ subroutine swap_all(IA,A,B,C,IW,W,ind,n) IW(:) = IA(:) W(:) = A(:) - do i=1,n + do i = 1,n IA(i)=IW(ind(i)) A(i)=W(ind(i)) enddo W(:) = B(:) - do i=1,n + do i = 1,n B(i)=W(ind(i)) enddo W(:) = C(:) - do i=1,n + do i = 1,n C(i)=W(ind(i)) enddo diff --git a/utils/infos/unused_routines/read_moho_map.f90 b/utils/infos/unused_routines/read_moho_map.f90 index 7e281bdcb..2da139f85 100644 --- a/utils/infos/unused_routines/read_moho_map.f90 +++ b/utils/infos/unused_routines/read_moho_map.f90 @@ -48,8 +48,8 @@ subroutine read_moho_map(imoho_depth) 'DATA/moho_map/moho_lupei_zhu.dat') open(unit=13,file=MOHO_MAP_FILE,status='old',action='read') ! file starts from North-West corner - do iy=NY_MOHO,1,-1 - do ix=1,NX_MOHO + do iy = NY_MOHO,1,-1 + do ix = 1,NX_MOHO read(13,*) long,lat,depth_km ! convert depth to meters imoho_depth(ix,iy) = nint(depth_km * 1000.d0) diff --git a/utils/infos/unused_routines/socal_model.f90 b/utils/infos/unused_routines/socal_model.f90 index 0dcb5d2b3..f55c3c96f 100644 --- a/utils/infos/unused_routines/socal_model.f90 +++ b/utils/infos/unused_routines/socal_model.f90 @@ -35,24 +35,24 @@ subroutine socal_model(idoubling,rho,vp,vs) double precision rho,vp,vs if (idoubling == IFLAG_HALFSPACE_MOHO) then - vp=7.8d0 - vs=4.5d0 - rho=3.0d0 + vp = 7.8d0 + vs = 4.5d0 + rho = 3.0d0 else if (idoubling == IFLAG_MOHO_16km) then - vp=6.7d0 - vs=3.87d0 - rho=2.8d0 + vp = 6.7d0 + vs = 3.87d0 + rho = 2.8d0 else if (idoubling == IFLAG_ONE_LAYER_TOPOGRAPHY .or. idoubling == IFLAG_BASEMENT_TOPO) then - vp=5.5d0 - vs=3.18d0 - rho=2.4d0 + vp = 5.5d0 + vs = 3.18d0 + rho = 2.4d0 else - vp=6.3d0 - vs=3.64d0 - rho=2.67d0 + vp = 6.3d0 + vs = 3.64d0 + rho = 2.67d0 endif ! scale to standard units diff --git a/utils/scripts/CMTs/cmt_frechet/make_cmtsolution_files.f90 b/utils/scripts/CMTs/cmt_frechet/make_cmtsolution_files.f90 index bb43b8b4a..dbb3d0a6d 100644 --- a/utils/scripts/CMTs/cmt_frechet/make_cmtsolution_files.f90 +++ b/utils/scripts/CMTs/cmt_frechet/make_cmtsolution_files.f90 @@ -59,14 +59,14 @@ program make_cmts read(1,"(a4,i5,i3,i3,i3,i3,f6.2,f9.4,f10.4,f6.1,f4.1,f4.1,1x,a)") & datasource,yr,mo,da,ho,mi,sec,lat,long,depth,mb,ms,reg - do iu=2,10 + do iu = 2,10 write(iu,"(a3,i5,i3,i3,i3,i3,f6.2,f9.4,f10.4,f6.1,f4.1,f4.1,1x,a)") & datasource,yr,mo,da,ho,mi,sec,lat,long,depth,mb,ms,reg enddo jda=julian_day(yr,mo,da) - ios=0 + ios = 0 do while(ios == 0) read(1,"(a)",iostat=ios) string @@ -76,17 +76,17 @@ program make_cmts lstr=len_trim(string) if (string(1:10) == 'event name') then - do iu=2,10 + do iu = 2,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:10) == 'time shift') then read(string(12:lstr),*) tshift_cmt - do iu=2,10 + do iu = 2,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:13) == 'half duration') then read(string(15:lstr),*) hdur - do iu=2,10 + do iu = 2,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:8) == 'latitude') then @@ -94,7 +94,7 @@ program make_cmts latp = lat + DDELTA if (latp > 90.0) latp = 180.0 - latp write(2,"(a9,5x,f9.4)") string(1:9),latp - do iu=3,10 + do iu = 3,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:9) == 'longitude') then @@ -103,7 +103,7 @@ program make_cmts longp = long + DDELTA if (longp > 180.0) longp = longp - 360.0 write(3,"(a10,4x,f9.4)") string(1:10),longp - do iu=4,10 + do iu = 4,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:5) == 'depth') then @@ -111,12 +111,12 @@ program make_cmts write(2,"(a)") string(1:lstr) write(3,"(a)") string(1:lstr) write(4,"(a6,8x,f9.4)") string(1:6),depth+DDEPTH - do iu=5,10 + do iu = 5,10 write(iu,"(a)") string(1:lstr) enddo else if (string(1:3) == 'Mrr') then read(string(5:lstr),*) moment_tensor(1) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),MOMENT @@ -127,7 +127,7 @@ program make_cmts write(10,"(a4,4x,e15.6)") string(1:4),0.0 else if (string(1:3) == 'Mtt') then read(string(5:lstr),*) moment_tensor(2) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),0.0 @@ -138,7 +138,7 @@ program make_cmts write(10,"(a4,4x,e15.6)") string(1:4),0.0 else if (string(1:3) == 'Mpp') then read(string(5:lstr),*) moment_tensor(3) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),0.0 @@ -149,7 +149,7 @@ program make_cmts write(10,"(a4,4x,e15.6)") string(1:4),0.0 else if (string(1:3) == 'Mrt') then read(string(5:lstr),*) moment_tensor(4) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),0.0 @@ -160,7 +160,7 @@ program make_cmts write(10,"(a4,4x,e15.6)") string(1:4),0.0 else if (string(1:3) == 'Mrp') then read(string(5:lstr),*) moment_tensor(5) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),0.0 @@ -171,7 +171,7 @@ program make_cmts write(10,"(a4,4x,e15.6)") string(1:4),0.0 else if (string(1:3) == 'Mtp') then read(string(5:lstr),*) moment_tensor(6) - do iu=2,4 + do iu = 2,4 write(iu,"(a)") string(1:lstr) enddo write(5,"(a4,4x,e15.6)") string(1:4),0.0 @@ -210,7 +210,7 @@ integer function julian_day(yr,mo,da) data mon /0,31,59,90,120,151,181,212,243,273,304,334/ julian_day=da+mon(mo) - if (mo > 2) julian_day=julian_day+lpyr(yr) + if (mo > 2) julian_day = julian_day+lpyr(yr) end function julian_day @@ -221,13 +221,13 @@ integer function lpyr(yr) ! !---- returns 1 if yr is a leap year ! - lpyr=0 + lpyr = 0 if (mod(yr,400) == 0) then - lpyr=1 + lpyr = 1 else if (mod(yr,4) == 0) then - lpyr=1 + lpyr = 1 if (mod(yr,100) == 0) then - lpyr=0 + lpyr = 0 endif endif diff --git a/utils/scripts/lib/utm_geo.f90 b/utils/scripts/lib/utm_geo.f90 index 72e736322..f9fa9ba15 100644 --- a/utils/scripts/lib/utm_geo.f90 +++ b/utils/scripts/lib/utm_geo.f90 @@ -39,11 +39,11 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway) integer UTM_PROJECTION_ZONE,iway double precision rx,ry,rlon,rlat - double precision, parameter :: degrad=PI/180., raddeg=180./PI + double precision, parameter :: degrad = PI/180., raddeg = 180./PI !double precision, parameter :: semimaj=6378206.4d0, semimin=6356583.8d0 ! Clarke 1866 - double precision, parameter :: semimaj=6378137.0d0, semimin=6356752.314245d0 ! WGS-84 + double precision, parameter :: semimaj = 6378137.0d0, semimin = 6356752.314245d0 ! WGS-84 double precision, parameter :: scfa=.9996d0 - double precision, parameter :: north=0.d0, east=500000.d0 + double precision, parameter :: north = 0.d0, east = 500000.d0 double precision e2,e4,e6,ep2,xx,yy,dlat,dlon,zone,cm,cmr,delam double precision f1,f2,f3,f4,rm,rn,t,c,a,e1,u,rlat1,dlat1,c1,t1,rn1,r1,d @@ -68,8 +68,8 @@ subroutine utm_geo(rlon,rlat,rx,ry,UTM_PROJECTION_ZONE,iway) ! define parameters of reference ellipsoid e2=1.0-(semimin/semimaj)**2.0 - e4=e2*e2 - e6=e2*e4 + e4 = e2*e2 + e6 = e2*e4 ep2=e2/(1.-e2) if (iway == IUTM2LONGLAT) then diff --git a/utils/scripts/seis_process/ascii_2_sep.f90 b/utils/scripts/seis_process/ascii_2_sep.f90 index e7d6ad2db..49107e0ce 100644 --- a/utils/scripts/seis_process/ascii_2_sep.f90 +++ b/utils/scripts/seis_process/ascii_2_sep.f90 @@ -19,8 +19,8 @@ program ascii_2_sep print *,'Reading seismograms in text format' open(unit=11,file='U_file.txt',status='unknown') - do ir=1,nr - do it=1,ntime + do ir = 1,nr + do it = 1,ntime read(11,*) sy(it,ir) ! invert sign of vertical component if needed depending on the reference frame convention diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/add_topography_410_650.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/add_topography_410_650.f90 index 83f7d9bc6..eac408fb9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/add_topography_410_650.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/add_topography_410_650.f90 @@ -52,11 +52,11 @@ subroutine add_topography_410_650(myrank,xelm,yelm,zelm,R220,R400,R670,R771, & double precision r,theta,phi double precision gamma - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_inner_core_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_inner_core_model.f90 index 7e3cf38cc..cb921860e 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_inner_core_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_inner_core_model.f90 @@ -53,24 +53,24 @@ subroutine aniso_inner_core_model(x,c11,c33,c12,c13,c44,REFERENCE_1D_MODEL) double precision scale_fac if (REFERENCE_1D_MODEL == REFERENCE_MODEL_IASP91) then - vp=11.24094d0-4.09689d0*x*x - vs=3.56454d0-3.45241d0*x*x - rho=13.0885d0-8.8381d0*x*x + vp = 11.24094d0-4.09689d0*x*x + vs = 3.56454d0-3.45241d0*x*x + rho = 13.0885d0-8.8381d0*x*x ! values at center - vp0=11.24094d0 - vs0=3.56454d0 - rho0=13.0885d0 + vp0 = 11.24094d0 + vs0 = 3.56454d0 + rho0 = 13.0885d0 else if (REFERENCE_1D_MODEL == REFERENCE_MODEL_PREM) then - vp=11.2622d0-6.3640d0*x*x - vs=3.6678d0-4.4475d0*x*x - rho=13.0885d0-8.8381d0*x*x + vp = 11.2622d0-6.3640d0*x*x + vs = 3.6678d0-4.4475d0*x*x + rho = 13.0885d0-8.8381d0*x*x ! values at center - vp0=11.2622d0 - vs0=3.6678d0 - rho0=13.0885d0 + vp0 = 11.2622d0 + vs0 = 3.6678d0 + rho0 = 13.0885d0 else stop 'unknown 1D reference Earth model in anisotropic inner core' @@ -104,7 +104,7 @@ subroutine aniso_inner_core_model(x,c11,c33,c12,c13,c44,REFERENCE_1D_MODEL) ! c66 = mu ! non-dimensionalization of elastic parameters - scale_fac=RHOAV*R_EARTH*R_EARTH*PI*GRAV*RHOAV + scale_fac = RHOAV*R_EARTH*R_EARTH*PI*GRAV*RHOAV ! Ishii et al. (2002): ! @@ -133,14 +133,14 @@ subroutine aniso_inner_core_model(x,c11,c33,c12,c13,c44,REFERENCE_1D_MODEL) ! 1200 5527 12.77 1559 1155 1257 1670 141 1343 169 ! - c11=rho*vp*vp*1.d9/scale_fac - c66=rho*vs*vs*1.d9/scale_fac + c11 = rho*vp*vp*1.d9/scale_fac + c66 = rho*vs*vs*1.d9/scale_fac - A0=rho0*vp0*vp0*1.d9/scale_fac - c33=c11+0.0349d0*A0 - c44=c66+0.00988d0*A0 - c12=c11-2.0d0*c66 - c13=c12-0.00881d0*A0 + A0 = rho0*vp0*vp0*1.d9/scale_fac + c33 = c11+0.0349d0*A0 + c44 = c66+0.00988d0*A0 + c12 = c11-2.0d0*c66 + c13 = c12-0.00881d0*A0 end subroutine aniso_inner_core_model diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_mantle_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_mantle_model.f90 index efcc96606..ca91c31ea 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_mantle_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/anisotropic_mantle_model.f90 @@ -394,8 +394,8 @@ subroutine read_aniso_mantle_model(AMM_V) if (nf <= 3 .or. nf >= 6) then bet2(ipa,idep,ilat,ilon) = AMM_V%beta(ipa,idep,ilat,ilon)*0.01*ppp + ppp else - if (nf == 4)bet2(ipa,idep,ilat,ilon) = AMM_V%beta(ipa,idep,ilat,ilon)*0.01 + 1. - if (nf == 5)bet2(ipa,idep,ilat,ilon) = - AMM_V%beta(ipa,idep,ilat,ilon)*0.01 + 1. + if (nf == 4) bet2(ipa,idep,ilat,ilon) = AMM_V%beta(ipa,idep,ilat,ilon)*0.01 + 1. + if (nf == 5) bet2(ipa,idep,ilat,ilon) = - AMM_V%beta(ipa,idep,ilat,ilon)*0.01 + 1. endif enddo @@ -432,7 +432,7 @@ subroutine read_aniso_mantle_model(AMM_V) read(15,"(17f7.2)",end = 888) (alph(ilon,ilat),ilon = 1,ny) enddo - do ilat=1,nx + do ilat = 1,nx read(15,"(17f7.2)",end = 888) (ph(ilon,ilat),ilon = 1,ny) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/calc_jacobian.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/calc_jacobian.f90 index d3cff631d..8fb1bf433 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/calc_jacobian.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/calc_jacobian.f90 @@ -67,9 +67,9 @@ subroutine calc_jacobian(myrank,xixstore,xiystore,xizstore, & double precision xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz double precision jacobian - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX xxi = ZERO xeta = ZERO @@ -84,7 +84,7 @@ subroutine calc_jacobian(myrank,xixstore,xiystore,xizstore, & ymesh = ZERO zmesh = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD xxi = xxi + dershape3D(1,ia,i,j,k)*xelm(ia) * R_EARTH xeta = xeta + dershape3D(2,ia,i,j,k)*xelm(ia) * R_EARTH xgamma = xgamma + dershape3D(3,ia,i,j,k)*xelm(ia) * R_EARTH diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/combine_AVS_DX.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/combine_AVS_DX.f90 index a91cbd7dd..7af5837f9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/combine_AVS_DX.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/combine_AVS_DX.f90 @@ -455,7 +455,7 @@ program combine_AVS_DX do iregion_code = region_min,region_max ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc,' in region ',iregion_code @@ -476,7 +476,7 @@ program combine_AVS_DX print *,'There are ',npoin,' global AVS or DX points in the slice' ! read local points in this slice and output global AVS or DX points - do ipoin=1,npoin + do ipoin = 1,npoin read(10,*) numpoin,xval,yval,zval if (ivalue == 2) then read(12,*) numpoin2,vmin,vmax @@ -529,7 +529,7 @@ program combine_AVS_DX do iregion_code = region_min,region_max ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc,' in region ',iregion_code @@ -556,7 +556,7 @@ program combine_AVS_DX print *,'There are ',nspec,' AVS or DX elements in the slice' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4 if (icolor == 5 .or. icolor == 6) then read(13,*) numelem2,deltavp,deltavs @@ -851,7 +851,7 @@ program combine_AVS_DX do iregion_code = region_min,region_max ! loop on the selected range of processors - do iproc=proc_p1,proc_p2 + do iproc = proc_p1,proc_p2 print *,'Reading slice ',iproc,' in region ',iregion_code @@ -871,7 +871,7 @@ program combine_AVS_DX print *,'There are ',nspec,' AVS or DX elements in the slice' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4 if (numelem /= ispec) stop 'incorrect element number' diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_coordinates_grid.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_coordinates_grid.f90 index cc6f6dad6..5d16cef3e 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_coordinates_grid.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_coordinates_grid.f90 @@ -64,8 +64,8 @@ subroutine compute_coord_main_mesh(offset_x,offset_y,offset_z,xelm,yelm,zelm, & ! this to avoid compilation warnings - x_=0 - y_=0 + x_ = 0 + y_ = 0 ! loop on all the nodes in this element do ignod = 1,NGNOD diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_element_properties.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_element_properties.f90 index 8995cb9c1..b6487dcd9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_element_properties.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/compute_element_properties.f90 @@ -297,11 +297,11 @@ subroutine compute_element_properties(ispec,iregion_code,idoubling, & double precision, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: Qmu_store double precision, dimension(N_SLS,NGLLX,NGLLY,NGLLZ,nspec) :: tau_e_store - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_header_file.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_header_file.f90 index 3eafca5dc..31f2a50ec 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_header_file.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_header_file.f90 @@ -146,7 +146,7 @@ program xcreate_header_file ! count the total number of sources in the CMTSOLUTION file call count_number_of_sources(NSOURCES) - do iregion=1,MAX_NUM_REGIONS + do iregion = 1,MAX_NUM_REGIONS NGLOB1D_RADIAL_CORNER(iregion,:) = NGLOB1D_RADIAL(iregion) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_regions_mesh.F90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_regions_mesh.F90 index a7d03a118..2ba661bb6 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_regions_mesh.F90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/create_regions_mesh.F90 @@ -465,11 +465,11 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & integer :: nb_layer_above_aniso,FIRST_ELT_ABOVE_ANISO - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof @@ -715,16 +715,16 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & ! to consider anisotropic elements first and to build the mesh from the bottom to the top of the region if (ONE_CRUST) then - first_layer_aniso=2 - last_layer_aniso=3 + first_layer_aniso = 2 + last_layer_aniso = 3 nb_layer_above_aniso = 1 else - first_layer_aniso=3 - last_layer_aniso=4 + first_layer_aniso = 3 + last_layer_aniso = 4 nb_layer_above_aniso = 2 endif allocate (perm_layer(ifirst_region:ilast_region)) - perm_layer = (/ (i, i=ilast_region,ifirst_region,-1) /) + perm_layer = (/ (i, i = ilast_region,ifirst_region,-1) /) ! if (iregion_code == IREGION_CRUST_MANTLE) then ! cpt=3 ! perm_layer(1)=first_layer_aniso @@ -1132,7 +1132,7 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & rmax = R_CENTRAL_CUBE / R_EARTH ! loop over the NGNOD nodes - do ia=1,NGNOD + do ia = 1,NGNOD ! flat cubed sphere with correct mapping call compute_coord_central_cube(ix+iaddx(ia),iy+iaddy(ia),iz+iaddz(ia), & @@ -1277,12 +1277,12 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & ! we need to create a copy of the x, y and z arrays because sorting in get_global will swap ! these arrays and therefore destroy them - do ispec=1,nspec + do ispec = 1,nspec ieoff = NGLLX * NGLLY * NGLLZ * (ispec-1) ilocnum = 0 - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ilocnum = ilocnum + 1 xp(ilocnum+ieoff) = xstore(i,j,k,ispec) yp(ilocnum+ieoff) = ystore(i,j,k,ispec) @@ -1316,10 +1316,10 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & copy_ibool_ori(:,:,:,:) = ibool(:,:,:,:) inumber = 0 - do ispec=1,nspec - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,nspec + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX if (mask_ibool(copy_ibool_ori(i,j,k,ispec)) == -1) then ! create a new point inumber = inumber + 1 @@ -1659,7 +1659,7 @@ subroutine create_regions_mesh(iregion_code,ibool,idoubling, & rmass(:) = 0._CUSTOM_REAL - do ispec=1,nspec + do ispec = 1,nspec ! suppress fictitious elements in central cube if (idoubling(ispec) == IFLAG_IN_FICTITIOUS_CUBE) cycle diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/crustal_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/crustal_model.f90 index 624f71760..f7d5d07d9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/crustal_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/crustal_model.f90 @@ -136,22 +136,22 @@ subroutine read_crustal_model(CM_V) call get_value_string(CNtype2_key_modif, 'model.CNtype2_key_modif', 'DATA/crust2.0/CNtype2_key_modif.txt') open(unit=1,file=CNtype2,status='old',action='read') - do ila=1,NCAP_CRUST/2 + do ila = 1,NCAP_CRUST/2 read(1,*) icolat,(CM_V%abbreviation(ila,i),i=1,NCAP_CRUST) enddo close(1) open(unit=1,file=CNtype2_key_modif,status='old',action='read') - h_moho_min=HUGEVAL + h_moho_min = HUGEVAL h_moho_max=-HUGEVAL - do ikey=1,NKEYS_CRUST + do ikey = 1,NKEYS_CRUST read (1,"(a2)") CM_V%code(ikey) read (1,*) (CM_V%velocp(ikey,i),i=1,NLAYERS_CRUST) read (1,*) (CM_V%velocs(ikey,i),i=1,NLAYERS_CRUST) read (1,*) (CM_V%dens(ikey,i),i=1,NLAYERS_CRUST) read (1,*) (CM_V%thlr(ikey,i),i=1,NLAYERS_CRUST-1),CM_V%thlr(ikey,NLAYERS_CRUST) - if (CM_V%thlr(ikey,NLAYERS_CRUST) > h_moho_max) h_moho_max=CM_V%thlr(ikey,NLAYERS_CRUST) - if (CM_V%thlr(ikey,NLAYERS_CRUST) < h_moho_min) h_moho_min=CM_V%thlr(ikey,NLAYERS_CRUST) + if (CM_V%thlr(ikey,NLAYERS_CRUST) > h_moho_max) h_moho_max = CM_V%thlr(ikey,NLAYERS_CRUST) + if (CM_V%thlr(ikey,NLAYERS_CRUST) < h_moho_min) h_moho_min = CM_V%thlr(ikey,NLAYERS_CRUST) enddo close(1) @@ -259,9 +259,9 @@ subroutine crust(lat,lon,velp,vels,rho,thick,abbreviation,code,thlr,velocp,veloc xc(2) = sint*sinp xc(3) = cost ! get x,y,z coordinates in cap around point of interest - do j=1,3 + do j = 1,3 x(j) = 0.0 - do k=1,3 + do k = 1,3 x(j) = x(j)+rotation_matrix(j,k)*xc(k) enddo enddo @@ -280,20 +280,20 @@ subroutine crust(lat,lon,velp,vels,rho,thick,abbreviation,code,thlr,velocp,veloc npoints = i - do j=1,NLAYERS_CRUST + do j = 1,NLAYERS_CRUST rho(j)=0.0d0 thick(j)=0.0d0 velp(j)=0.0d0 vels(j)=0.0d0 enddo - do i=1,npoints + do i = 1,npoints call icolat_ilon(xlat(i),xlon(i),icolat,ilon) crustaltype=abbreviation(icolat,ilon) call get_crust_structure(crustaltype,velpl,velsl,rhol,thickl, & code,thlr,velocp,velocs,dens,ierr) if (ierr /= 0) stop 'error in routine get_crust_structure' - do j=1,NLAYERS_CRUST + do j = 1,NLAYERS_CRUST rho(j)=rho(j)+weight(i)*rhol(j) thick(j)=thick(j)+weight(i)*thickl(j) velp(j)=velp(j)+weight(i)*velpl(j) @@ -316,9 +316,9 @@ subroutine icolat_ilon(xlat,xlon,icolat,ilon) if (xlat > 90.0d0 .or. xlat < -90.0d0 .or. xlon > 180.0d0 .or. xlon < -180.0d0) & stop 'error in latitude/longitude range in icolat_ilon' - icolat=int(1+((90.d0-xlat)/2.d0)) + icolat = int(1+((90.d0-xlat)/2.d0)) if (icolat == 91) icolat=90 - ilon=int(1+((180.d0+xlon)/2.d0)) + ilon = int(1+((180.d0+xlon)/2.d0)) if (ilon == 181) ilon=1 if (icolat > 90 .or. icolat < 1) stop 'error in routine icolat_ilon' @@ -346,20 +346,20 @@ subroutine get_crust_structure(type,vptyp,vstyp,rhtyp,thtp, & ! local variables integer i,ikey - ierr=1 - do ikey=1,NKEYS_CRUST + ierr = 1 + do ikey = 1,NKEYS_CRUST if (code(ikey) == type) then - do i=1,NLAYERS_CRUST + do i = 1,NLAYERS_CRUST vptyp(i)=velocp(ikey,i) vstyp(i)=velocs(ikey,i) rhtyp(i)=dens(ikey,i) enddo - do i=1,NLAYERS_CRUST-1 + do i = 1,NLAYERS_CRUST-1 thtp(i)=thlr(ikey,i) enddo ! get distance to Moho from the bottom of the ocean or the ice thtp(NLAYERS_CRUST)=thlr(ikey,NLAYERS_CRUST)-thtp(1)-thtp(2) - ierr=0 + ierr = 0 endif enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/define_derivation_matrices.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/define_derivation_matrices.f90 index 4f8f6c4cf..338ca1847 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/define_derivation_matrices.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/define_derivation_matrices.f90 @@ -73,48 +73,48 @@ subroutine define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, & ! calculate derivatives of the Lagrange polynomials ! and precalculate some products in double precision ! hprime(i,j) = h'_j(xigll_i) by definition of the derivation matrix - do i1=1,NGLLX - do i2=1,NGLLX + do i1 = 1,NGLLX + do i2 = 1,NGLLX hprime_xx(i2,i1) = sngl(lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX)) hprimewgll_xx(i2,i1) = sngl(lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX)*wxgll(i2)) enddo enddo - do j1=1,NGLLY - do j2=1,NGLLY + do j1 = 1,NGLLY + do j2 = 1,NGLLY hprime_yy(j2,j1) = sngl(lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY)) hprimewgll_yy(j2,j1) = sngl(lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY)*wygll(j2)) enddo enddo - do k1=1,NGLLZ - do k2=1,NGLLZ + do k1 = 1,NGLLZ + do k2 = 1,NGLLZ hprime_zz(k2,k1) = sngl(lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ)) hprimewgll_zz(k2,k1) = sngl(lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ)*wzgll(k2)) enddo enddo - do i=1,NGLLX - do j=1,NGLLY + do i = 1,NGLLX + do j = 1,NGLLY wgllwgll_xy(i,j) = sngl(wxgll(i)*wygll(j)) enddo enddo - do i=1,NGLLX - do k=1,NGLLZ + do i = 1,NGLLX + do k = 1,NGLLZ wgllwgll_xz(i,k) = sngl(wxgll(i)*wzgll(k)) enddo enddo - do j=1,NGLLY - do k=1,NGLLZ + do j = 1,NGLLY + do k = 1,NGLLZ wgllwgll_yz(j,k) = sngl(wygll(j)*wzgll(k)) enddo enddo - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo @@ -125,48 +125,48 @@ subroutine define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, & ! calculate derivatives of the Lagrange polynomials ! and precalculate some products in double precision ! hprime(i,j) = h'_j(xigll_i) by definition of the derivation matrix - do i1=1,NGLLX - do i2=1,NGLLX + do i1 = 1,NGLLX + do i2 = 1,NGLLX hprime_xx(i2,i1) = lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX) hprimewgll_xx(i2,i1) = lagrange_deriv_GLL(i1-1,i2-1,xigll,NGLLX)*wxgll(i2) enddo enddo - do j1=1,NGLLY - do j2=1,NGLLY + do j1 = 1,NGLLY + do j2 = 1,NGLLY hprime_yy(j2,j1) = lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY) hprimewgll_yy(j2,j1) = lagrange_deriv_GLL(j1-1,j2-1,yigll,NGLLY)*wygll(j2) enddo enddo - do k1=1,NGLLZ - do k2=1,NGLLZ + do k1 = 1,NGLLZ + do k2 = 1,NGLLZ hprime_zz(k2,k1) = lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ) hprimewgll_zz(k2,k1) = lagrange_deriv_GLL(k1-1,k2-1,zigll,NGLLZ)*wzgll(k2) enddo enddo - do i=1,NGLLX - do j=1,NGLLY + do i = 1,NGLLX + do j = 1,NGLLY wgllwgll_xy(i,j) = wxgll(i)*wygll(j) enddo enddo - do i=1,NGLLX - do k=1,NGLLZ + do i = 1,NGLLX + do k = 1,NGLLZ wgllwgll_xz(i,k) = wxgll(i)*wzgll(k) enddo enddo - do j=1,NGLLY - do k=1,NGLLZ + do j = 1,NGLLY + do k = 1,NGLLZ wgllwgll_yz(j,k) = wygll(j)*wzgll(k) enddo enddo - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ wgll_cube(i,j,k) = wxgll(i)*wygll(j)*wzgll(k) enddo enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_1D_buffers.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_1D_buffers.f90 index dd646a7e3..6875213f5 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_1D_buffers.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_1D_buffers.f90 @@ -81,9 +81,9 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, npoin1D = 0 ! nb of elements in this 1D buffer - ispeccount=0 + ispeccount = 0 - do ispec=1,nspec + do ispec = 1,nspec ! remove central cube for chunk buffers if (idoubling(ispec) == IFLAG_MIDDLE_CENTRAL_CUBE .or. & idoubling(ispec) == IFLAG_BOTTOM_CENTRAL_CUBE .or. & @@ -91,11 +91,11 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, idoubling(ispec) == IFLAG_IN_FICTITIOUS_CUBE) cycle ! corner detection here if (iMPIcut_xi(1,ispec) .and. iMPIcut_eta(1,ispec)) then - ispeccount=ispeccount+1 + ispeccount = ispeccount+1 ! loop on all the points ix = 1 iy = 1 - do iz=1,NGLLZ + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -131,8 +131,8 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, npoin1D = 0 ! nb of elements in this 1D buffer - ispeccount=0 - do ispec=1,nspec + ispeccount = 0 + do ispec = 1,nspec ! remove central cube for chunk buffers if (idoubling(ispec) == IFLAG_MIDDLE_CENTRAL_CUBE .or. & idoubling(ispec) == IFLAG_BOTTOM_CENTRAL_CUBE .or. & @@ -140,11 +140,11 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, idoubling(ispec) == IFLAG_IN_FICTITIOUS_CUBE) cycle ! corner detection here if (iMPIcut_xi(2,ispec) .and. iMPIcut_eta(1,ispec)) then - ispeccount=ispeccount+1 + ispeccount = ispeccount+1 ! loop on all the points ix = NGLLX iy = 1 - do iz=1,NGLLZ + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -184,9 +184,9 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, npoin1D = 0 ! nb of elements in this 1D buffer - ispeccount=0 + ispeccount = 0 - do ispec=1,nspec + do ispec = 1,nspec ! remove central cube for chunk buffers if (idoubling(ispec) == IFLAG_MIDDLE_CENTRAL_CUBE .or. & @@ -197,12 +197,12 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, ! corner detection here if (iMPIcut_xi(1,ispec) .and. iMPIcut_eta(2,ispec)) then - ispeccount=ispeccount+1 + ispeccount = ispeccount+1 ! loop on all the points ix = 1 iy = NGLLY - do iz=1,NGLLZ + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then @@ -239,9 +239,9 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, npoin1D = 0 ! nb of elements in this 1D buffer - ispeccount=0 + ispeccount = 0 - do ispec=1,nspec + do ispec = 1,nspec ! remove central cube for chunk buffers if (idoubling(ispec) == IFLAG_MIDDLE_CENTRAL_CUBE .or. & @@ -252,12 +252,12 @@ subroutine get_MPI_1D_buffers(myrank,prname,nspec,iMPIcut_xi,iMPIcut_eta,ibool, ! corner detection here if (iMPIcut_xi(2,ispec) .and. iMPIcut_eta(2,ispec)) then - ispeccount=ispeccount+1 + ispeccount = ispeccount+1 ! loop on all the points ix = NGLLX iy = NGLLY - do iz=1,NGLLZ + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_eta.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_eta.f90 index 161428f08..774ede5ce 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_eta.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_eta.f90 @@ -107,15 +107,15 @@ subroutine get_MPI_cutplanes_eta(myrank,prname,nspec,iMPIcut_eta,ibool, & npoin2D_eta = 0 ! nb of elements in this cut-plane - ispecc1=0 + ispecc1 = 0 - do ispec=1,nspec + do ispec = 1,nspec if (iMPIcut_eta(1,ispec)) then - ispecc1=ispecc1+1 + ispecc1 = ispecc1+1 ! loop on all the points in that 2-D element, including edges iy = 1 - do ix=1,NGLLX - do iz=1,NGLLZ + do ix = 1,NGLLX + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -138,7 +138,7 @@ subroutine get_MPI_cutplanes_eta(myrank,prname,nspec,iMPIcut_eta,ibool, & call sort_array_coordinates(npoin2D_eta,xstore_selected,ystore_selected,zstore_selected, & ibool_selected,iglob,locval,ifseg,nglob,ninseg) - do ipoin2D=1,npoin2D_eta + do ipoin2D = 1,npoin2D_eta write(10,*) ibool_selected(ipoin2D) mask_ibool2(ibool_selected(ipoin2D)) = .true. enddo @@ -170,15 +170,15 @@ subroutine get_MPI_cutplanes_eta(myrank,prname,nspec,iMPIcut_eta,ibool, & npoin2D_eta = 0 ! nb of elements in this cut-plane - ispecc2=0 + ispecc2 = 0 - do ispec=1,nspec + do ispec = 1,nspec if (iMPIcut_eta(2,ispec)) then - ispecc2=ispecc2+1 + ispecc2 = ispecc2+1 ! loop on all the points in that 2-D element, including edges iy = NGLLY - do ix=1,NGLLX - do iz=1,NGLLZ + do ix = 1,NGLLX + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -201,7 +201,7 @@ subroutine get_MPI_cutplanes_eta(myrank,prname,nspec,iMPIcut_eta,ibool, & call sort_array_coordinates(npoin2D_eta,xstore_selected,ystore_selected,zstore_selected, & ibool_selected,iglob,locval,ifseg,nglob,ninseg) - do ipoin2D=1,npoin2D_eta + do ipoin2D = 1,npoin2D_eta write(10,*) ibool_selected(ipoin2D) mask_ibool2(ibool_selected(ipoin2D)) = .true. enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_xi.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_xi.f90 index 06ce1c0cb..576309e42 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_xi.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_MPI_cutplanes_xi.f90 @@ -105,15 +105,15 @@ subroutine get_MPI_cutplanes_xi(myrank,prname,nspec,iMPIcut_xi,ibool, & npoin2D_xi = 0 ! nb of elements in this cut-plane - ispecc1=0 + ispecc1 = 0 - do ispec=1,nspec + do ispec = 1,nspec if (iMPIcut_xi(1,ispec)) then - ispecc1=ispecc1+1 + ispecc1 = ispecc1+1 ! loop on all the points in that 2-D element, including edges ix = 1 - do iy=1,NGLLY - do iz=1,NGLLZ + do iy = 1,NGLLY + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -136,7 +136,7 @@ subroutine get_MPI_cutplanes_xi(myrank,prname,nspec,iMPIcut_xi,ibool, & call sort_array_coordinates(npoin2D_xi,xstore_selected,ystore_selected,zstore_selected, & ibool_selected,iglob,locval,ifseg,nglob,ninseg) - do ipoin2D=1,npoin2D_xi + do ipoin2D = 1,npoin2D_xi write(10,*) ibool_selected(ipoin2D) mask_ibool2(ibool_selected(ipoin2D)) = .true. enddo @@ -170,15 +170,15 @@ subroutine get_MPI_cutplanes_xi(myrank,prname,nspec,iMPIcut_xi,ibool, & npoin2D_xi = 0 ! nb of elements in this cut-plane - ispecc2=0 + ispecc2 = 0 - do ispec=1,nspec + do ispec = 1,nspec if (iMPIcut_xi(2,ispec)) then - ispecc2=ispecc2+1 + ispecc2 = ispecc2+1 ! loop on all the points in that 2-D element, including edges ix = NGLLX - do iy=1,NGLLY - do iz=1,NGLLZ + do iy = 1,NGLLY + do iz = 1,NGLLZ ! select point, if not already selected if (.not. mask_ibool(ibool(ix,iy,iz,ispec))) then mask_ibool(ibool(ix,iy,iz,ispec)) = .true. @@ -201,7 +201,7 @@ subroutine get_MPI_cutplanes_xi(myrank,prname,nspec,iMPIcut_xi,ibool, & call sort_array_coordinates(npoin2D_xi,xstore_selected,ystore_selected,zstore_selected, & ibool_selected,iglob,locval,ifseg,nglob,ninseg) - do ipoin2D=1,npoin2D_xi + do ipoin2D = 1,npoin2D_xi write(10,*) ibool_selected(ipoin2D) mask_ibool2(ibool_selected(ipoin2D)) = .true. enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_absorb.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_absorb.f90 index 7448f9568..6c52f6c95 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_absorb.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_absorb.f90 @@ -56,20 +56,20 @@ subroutine get_absorb(myrank,iboun,nspec, & ! processor identification !!!!!!!!!!!!! character(len=150) prname - ispecb1=0 - ispecb2=0 - ispecb3=0 - ispecb4=0 - ispecb5=0 + ispecb1 = 0 + ispecb2 = 0 + ispecb3 = 0 + ispecb4 = 0 + ispecb5 = 0 - do ispecg=1,nspec + do ispecg = 1,nspec ! determine if the element falls on an absorbing boundary if (iboun(1,ispecg)) then ! on boundary 1: xmin - ispecb1=ispecb1+1 + ispecb1 = ispecb1+1 ! this is useful even if it is constant because it can be zero inside the slices njmin(1,ispecb1)=1 @@ -83,7 +83,7 @@ subroutine get_absorb(myrank,iboun,nspec, & if (iboun(2,ispecg)) then ! on boundary 2: xmax - ispecb2=ispecb2+1 + ispecb2 = ispecb2+1 ! this is useful even if it is constant because it can be zero inside the slices njmin(2,ispecb2)=1 @@ -97,7 +97,7 @@ subroutine get_absorb(myrank,iboun,nspec, & if (iboun(3,ispecg)) then ! on boundary 3: ymin - ispecb3=ispecb3+1 + ispecb3 = ispecb3+1 ! check for ovelap with other boundaries nimin(1,ispecb3)=1 @@ -111,7 +111,7 @@ subroutine get_absorb(myrank,iboun,nspec, & if (iboun(4,ispecg)) then ! on boundary 4: ymax - ispecb4=ispecb4+1 + ispecb4 = ispecb4+1 ! check for ovelap with other boundaries nimin(2,ispecb4)=1 @@ -123,7 +123,7 @@ subroutine get_absorb(myrank,iboun,nspec, & endif ! on boundary 5: bottom - if (iboun(5,ispecg)) ispecb5=ispecb5+1 + if (iboun(5,ispecg)) ispecb5 = ispecb5+1 enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_cmt.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_cmt.f90 index f25b65aeb..9b4739bdc 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_cmt.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_cmt.f90 @@ -56,7 +56,7 @@ subroutine get_cmt(yr,jda,ho,mi,sec,t_cmt,hdur,lat,long,depth,moment_tensor,DT,N open(unit=1,file=CMTSOLUTION,status='old',action='read') ! read source number isource - do isource=1,NSOURCES + do isource = 1,NSOURCES ! read header with event information read(1,"(a4,i5,i3,i3,i3,i3,f6.2)") datasource,yr,mo,da,ho,mi,sec @@ -157,11 +157,11 @@ integer function lpyr(yr) ! !---- returns 1 if leap year ! - lpyr=0 + lpyr = 0 if (mod(yr,400) == 0) then - lpyr=1 + lpyr = 1 else if (mod(yr,4) == 0) then - lpyr=1 + lpyr = 1 if (mod(yr,100) == 0) lpyr=0 endif diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_ellipticity.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_ellipticity.f90 index 4cf3cc5be..c58f1946c 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_ellipticity.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_ellipticity.f90 @@ -43,7 +43,7 @@ subroutine get_ellipticity(xelm,yelm,zelm,nspl,rspl,espl,espl2) double precision r,theta,phi,factor double precision cost,p20 - do ia=1,NGNOD + do ia = 1,NGNOD call xyz_2_rthetaphi_dble(xelm(ia),yelm(ia),zelm(ia),r,theta,phi) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_jacobian_boundaries.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_jacobian_boundaries.f90 index 018e842a1..df2ecc3fc 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_jacobian_boundaries.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_jacobian_boundaries.f90 @@ -94,7 +94,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & ispecb5 = 0 ispecb6 = 0 - do ispec=1,nspec + do ispec = 1,nspec ! determine if the element falls on a boundary @@ -102,7 +102,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(1,ispec)) then - ispecb1=ispecb1+1 + ispecb1 = ispecb1+1 ibelm_xmin(ispecb1)=ispec ! specify the 9 nodes for the 2-D boundary element @@ -143,7 +143,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(2,ispec)) then - ispecb2=ispecb2+1 + ispecb2 = ispecb2+1 ibelm_xmax(ispecb2)=ispec ! specify the 9 nodes for the 2-D boundary element @@ -184,7 +184,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(3,ispec)) then - ispecb3=ispecb3+1 + ispecb3 = ispecb3+1 ibelm_ymin(ispecb3)=ispec ! specify the 9 nodes for the 2-D boundary element @@ -225,7 +225,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(4,ispec)) then - ispecb4=ispecb4+1 + ispecb4 = ispecb4+1 ibelm_ymax(ispecb4)=ispec ! specify the 9 nodes for the 2-D boundary element @@ -266,7 +266,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(5,ispec)) then - ispecb5=ispecb5+1 + ispecb5 = ispecb5+1 ibelm_bottom(ispecb5)=ispec xelm(1)=xstore(1,1,1,ispec) @@ -306,7 +306,7 @@ subroutine get_jacobian_boundaries(myrank,iboun,nspec,xstore,ystore,zstore, & if (iboun(6,ispec)) then - ispecb6=ispecb6+1 + ispecb6 = ispecb6+1 ibelm_top(ispecb6)=ispec xelm(1)=xstore(1,1,NGLLZ,ispec) @@ -382,28 +382,28 @@ subroutine compute_jacobian_2D(myrank,ispecb,xelm,yelm,zelm,dershape2D,jacobian2 double precision xxi,xeta,yxi,yeta,zxi,zeta double precision unx,uny,unz,jacobian - do j=1,NGLLB - do i=1,NGLLA - - xxi=ZERO - xeta=ZERO - yxi=ZERO - yeta=ZERO - zxi=ZERO - zeta=ZERO - do ia=1,NGNOD2D - xxi=xxi+dershape2D(1,ia,i,j)*xelm(ia) - xeta=xeta+dershape2D(2,ia,i,j)*xelm(ia) - yxi=yxi+dershape2D(1,ia,i,j)*yelm(ia) - yeta=yeta+dershape2D(2,ia,i,j)*yelm(ia) - zxi=zxi+dershape2D(1,ia,i,j)*zelm(ia) - zeta=zeta+dershape2D(2,ia,i,j)*zelm(ia) + do j = 1,NGLLB + do i = 1,NGLLA + + xxi = ZERO + xeta = ZERO + yxi = ZERO + yeta = ZERO + zxi = ZERO + zeta = ZERO + do ia = 1,NGNOD2D + xxi = xxi+dershape2D(1,ia,i,j)*xelm(ia) + xeta = xeta+dershape2D(2,ia,i,j)*xelm(ia) + yxi = yxi+dershape2D(1,ia,i,j)*yelm(ia) + yeta = yeta+dershape2D(2,ia,i,j)*yelm(ia) + zxi = zxi+dershape2D(1,ia,i,j)*zelm(ia) + zeta = zeta+dershape2D(2,ia,i,j)*zelm(ia) enddo ! calculate the unnormalized normal to the boundary - unx=yxi*zeta-yeta*zxi - uny=zxi*xeta-zeta*xxi - unz=xxi*yeta-xeta*yxi + unx = yxi*zeta-yeta*zxi + uny = zxi*xeta-zeta*xxi + unz = xxi*yeta-xeta*yxi jacobian=dsqrt(unx**2+uny**2+unz**2) if (jacobian == ZERO) call exit_MPI(myrank,'2D Jacobian undefined') diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_model.f90 index 244cc8666..2e25119b9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_model.f90 @@ -293,11 +293,11 @@ subroutine get_model(myrank,iregion_code,nspec, & logical found_crust - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof @@ -327,13 +327,13 @@ subroutine get_model(myrank,iregion_code,nspec, & character(len=80) kerstr character(len=40) varstr(maxker) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX xmesh = ZERO ymesh = ZERO zmesh = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD xmesh = xmesh + shape3D(ia,i,j,k)*xelm(ia) ymesh = ymesh + shape3D(ia,i,j,k)*yelm(ia) zmesh = zmesh + shape3D(ia,i,j,k)*zelm(ia) @@ -497,22 +497,22 @@ subroutine get_model(myrank,iregion_code,nspec, & nconpt,iver,iconpt,conpt,xlaspl,xlospl,radspl, & coe,vercof,vercofd,ylmcof,wk1,wk2,wk3,kerstr,varstr) if (TRANSVERSE_ISOTROPY) then - vpv=vpv*(1.0d0+dble(dvpv)) - vph=vph*(1.0d0+dble(dvph)) - vsv=vsv*(1.0d0+dble(dvsv)) - vsh=vsh*(1.0d0+dble(dvsh)) + vpv = vpv*(1.0d0+dble(dvpv)) + vph = vph*(1.0d0+dble(dvph)) + vsv = vsv*(1.0d0+dble(dvsv)) + vsh = vsh*(1.0d0+dble(dvsh)) else - vpv=vpv+dvpv - vph=vph+dvph - vsv=vsv+dvsv - vsh=vsh+dvsh + vpv = vpv+dvpv + vph = vph+dvph + vsv = vsv+dvsv + vsh = vsh+dvsh vp = sqrt(((8.d0+4.d0*eta_aniso)*vph*vph + 3.d0*vpv*vpv + (8.d0 - 8.d0*eta_aniso)*vsv*vsv)/15.d0) vs = sqrt(((1.d0-2.d0*eta_aniso)*vph*vph + vpv*vpv + 5.d0*vsh*vsh + (6.d0+4.d0*eta_aniso)*vsv*vsv)/15.d0) - vpv=vp - vph=vp - vsv=vs - vsh=vs - eta_aniso=1.0d0 + vpv = vp + vph = vp + vsv = vs + vsh = vs + eta_aniso = 1.0d0 endif else stop 'unknown 3D Earth model in get_model' @@ -594,22 +594,22 @@ subroutine get_model(myrank,iregion_code,nspec, & nconpt,iver,iconpt,conpt,xlaspl,xlospl,radspl, & coe,vercof,vercofd,ylmcof,wk1,wk2,wk3,kerstr,varstr) if (TRANSVERSE_ISOTROPY) then - vpv=vpv*(1.0d0+dble(dvpv)) - vph=vph*(1.0d0+dble(dvph)) - vsv=vsv*(1.0d0+dble(dvsv)) - vsh=vsh*(1.0d0+dble(dvsh)) + vpv = vpv*(1.0d0+dble(dvpv)) + vph = vph*(1.0d0+dble(dvph)) + vsv = vsv*(1.0d0+dble(dvsv)) + vsh = vsh*(1.0d0+dble(dvsh)) else - vpv=vpv+dvpv - vph=vph+dvph - vsv=vsv+dvsv - vsh=vsh+dvsh + vpv = vpv+dvpv + vph = vph+dvph + vsv = vsv+dvsv + vsh = vsh+dvsh vp = sqrt(((8.d0+4.d0*eta_aniso)*vph*vph + 3.d0*vpv*vpv + (8.d0 - 8.d0*eta_aniso)*vsv*vsv)/15.d0) vs = sqrt(((1.d0-2.d0*eta_aniso)*vph*vph + vpv*vpv + 5.d0*vsh*vsh + (6.d0+4.d0*eta_aniso)*vsv*vsv)/15.d0) - vpv=vp - vph=vp - vsv=vs - vsh=vs - eta_aniso=1.0d0 + vpv = vp + vph = vp + vsv = vs + vsh = vs + eta_aniso = 1.0d0 endif else stop 'unknown 3D Earth model in get_model' @@ -685,10 +685,10 @@ subroutine get_model(myrank,iregion_code,nspec, & if (r > (R_EARTH - DEP_MAX*1000.d0)/R_EARTH) then call iso3d_dpzhao_model(r,theta,phi,vpc,vsc,dvp,dvs,rhoc,found_crust,JP3DM_V) if (found_crust) then - vpv=vpc - vph=vpc - vsv=vsc - vsh=vsc + vpv = vpc + vph = vpc + vsv = vsc + vsh = vsc ! rho=rhoc if (ANISOTROPIC_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then c11 = rho*vpv*vpv @@ -717,16 +717,16 @@ subroutine get_model(myrank,iregion_code,nspec, & endif else lat=(PI/2.0d0-theta)*180.0d0/PI - lon=phi*180.0d0/PI + lon = phi*180.0d0/PI if (lon > 180.0d0) lon=lon-360.0d0 call crustal_model(lat,lon,r,vpc,vsc,rhoc,moho,found_crust,CM_V) if (found_crust) then - vpv=vpc - vph=vpc - vsv=vsc - vsh=vsc - rho=rhoc - eta_aniso=1.0d0 + vpv = vpc + vph = vpc + vsv = vsc + vsh = vsc + rho = rhoc + eta_aniso = 1.0d0 if (ANISOTROPIC_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then c11 = rho*vpv*vpv c12 = rho*(vpv*vpv-2.*vsv*vsv) @@ -754,15 +754,15 @@ subroutine get_model(myrank,iregion_code,nspec, & endif else lat=(PI/2.0d0-theta)*180.0d0/PI - lon=phi*180.0d0/PI + lon = phi*180.0d0/PI if (lon > 180.0d0) lon=lon-360.0d0 call crustal_model(lat,lon,r,vpc,vsc,rhoc,moho,found_crust,CM_V) if (found_crust) then - vpv=vpc - vph=vpc - vsv=vsc - vsh=vsc - rho=rhoc + vpv = vpc + vph = vpc + vsv = vsc + vsh = vsc + rho = rhoc if (ANISOTROPIC_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then c11 = rho*vpv*vpv c12 = rho*(vpv*vpv-2.*vsv*vsv) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_perm_color.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_perm_color.f90 index fbe316b41..2ab805577 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_perm_color.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_perm_color.f90 @@ -54,7 +54,7 @@ subroutine get_perm_color(is_on_a_slice_edge,ibool,perm,nspec,nglob, & if (myrank == 0) & write(IMAIN,*) 'calling form_elt_connectivity_foelco to perform mesh coloring and inner/outer element splitting' call form_elt_connectivity_foelco(mn,mp,nspec,global_corner_number,nglob_GLL_full,ibool,nglob_eight_corners_only) - do i=1,nspec + do i = 1,nspec istart = mp(i) istop = mp(i+1) - 1 enddo @@ -75,7 +75,7 @@ subroutine get_perm_color(is_on_a_slice_edge,ibool,perm,nspec,nglob, & count_only = .false. if (myrank == 0) write(IMAIN,*) 'calling form_node_connectivity_fonoco to actually create the table' call form_node_connectivity_fonoco(mn,mp,ne,np,nglob_eight_corners_only,nspec,count_only,total_size_ne) - do i=1,nglob_eight_corners_only + do i = 1,nglob_eight_corners_only istart = np(i) istop = np(i+1) - 1 enddo @@ -98,7 +98,7 @@ subroutine get_perm_color(is_on_a_slice_edge,ibool,perm,nspec,nglob, & call create_adjacency_table_adjncy(mn,mp,ne,np,adj,xadj,maskel,nspec,nglob_eight_corners_only, & count_only,total_size_ne,total_size_adj,.false.) - do i=1,nspec + do i = 1,nspec istart = xadj(i) istop = xadj(i+1) - 1 number_of_neighbors = istop-istart+1 @@ -168,10 +168,10 @@ subroutine get_color(adj,xadj,color,nspec,total_size_adj,is_on_a_slice_edge, & is_outer_element(:) = .false. - do ispec=1,nspec + do ispec = 1,nspec if (is_on_a_slice_edge(ispec)) then is_outer_element(ispec) = .true. - nspec_outer=nspec_outer+1 + nspec_outer = nspec_outer+1 endif enddo @@ -284,7 +284,7 @@ subroutine form_elt_connectivity_foelco(mn,mp,nspec,global_corner_number, & nglob_eight_corners_only = 0 global_corner_number(:) = -1 - do ispec=1,nspec + do ispec = 1,nspec inumcorner = 0 do iz = 1,NGLLZ,NGLLZ-1 @@ -301,7 +301,7 @@ subroutine form_elt_connectivity_foelco(mn,mp,nspec,global_corner_number, & endif node = global_corner_number(ibool(ix,iy,iz,ispec)) - do k=nsum,ninter-1 + do k = nsum,ninter-1 if (node == mn(k)) goto 200 enddo @@ -367,10 +367,10 @@ subroutine form_node_connectivity_fonoco(mn,mp,ne,np,nglob_eight_corners_only, & nsum = 1 np(1) = 1 - do inode=1,nglob_eight_corners_only - do 200 ispec=1,nspec + do inode = 1,nglob_eight_corners_only + do 200 ispec = 1,nspec - do j=mp(ispec),mp(ispec + 1) - 1 + do j = mp(ispec),mp(ispec + 1) - 1 if (mn(j) == inode) then if (count_only) then total_size_ne = nsum @@ -437,7 +437,7 @@ subroutine create_adjacency_table_adjncy(mn,mp,ne,np,adj,xadj,maskel,nspec,nglob xadj(1) = 1 iad = 1 - do ispec=1,nspec + do ispec = 1,nspec ! reset mask maskel(:) = .false. @@ -448,11 +448,11 @@ subroutine create_adjacency_table_adjncy(mn,mp,ne,np,adj,xadj,maskel,nspec,nglob istart = mp(ispec) istop = mp(ispec+1) - 1 - do ino=istart,istop + do ino = istart,istop node = mn(ino) jstart = np(node) jstop = np(node + 1) - 1 - do 120 jel=jstart,jstop + do 120 jel = jstart,jstop nelem = ne(jel) if (maskel(nelem)) goto 120 if (face) then diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape2D.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape2D.f90 index 788931b59..6aa642e9d 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape2D.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape2D.f90 @@ -57,29 +57,29 @@ subroutine get_shape2D(myrank,shape2D,dershape2D,xigll,yigll,NGLLA,NGLLB) if (NGNOD2D /= 9) call exit_MPI(myrank,'surface elements should have 9 control nodes') ! generate the 2D shape functions and their derivatives (9 nodes) - do i=1,NGLLA + do i = 1,NGLLA xi=xigll(i) l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF - do j=1,NGLLB + do j = 1,NGLLB eta=yigll(j) l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF ! corner nodes @@ -126,15 +126,15 @@ subroutine get_shape2D(myrank,shape2D,dershape2D,xigll,yigll,NGLLA,NGLLB) enddo ! check the 2D shape functions - do i=1,NGLLA - do j=1,NGLLB + do i = 1,NGLLA + do j = 1,NGLLB - sumshape=ZERO + sumshape = ZERO - sumdershapexi=ZERO - sumdershapeeta=ZERO + sumdershapexi = ZERO + sumdershapeeta = ZERO - do ia=1,NGNOD2D + do ia = 1,NGNOD2D sumshape=sumshape+shape2D(ia,i,j) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape3D.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape3D.f90 index a89786374..608d63fdb 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape3D.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/get_shape3D.f90 @@ -56,41 +56,41 @@ subroutine get_shape3D(myrank,shape3D,dershape3D,xigll,yigll,zigll) if (NGNOD /= 27) call exit_MPI(myrank,'elements should have 27 control nodes') ! generate the 3D shape functions and their derivatives (27 nodes) - do i=1,NGLLX + do i = 1,NGLLX xi=xigll(i) l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF - do j=1,NGLLY + do j = 1,NGLLY eta=yigll(j) l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF - do k=1,NGLLZ + do k = 1,NGLLZ gamma=zigll(k) l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 + l2gamma = ONE-gamma**2 l3gamma=HALF*gamma*(gamma+ONE) - l1pgamma=gamma-HALF + l1pgamma = gamma-HALF l2pgamma=-TWO*gamma - l3pgamma=gamma+HALF + l3pgamma = gamma+HALF ! corner nodes @@ -227,17 +227,17 @@ subroutine get_shape3D(myrank,shape3D,dershape3D,xigll,yigll,zigll) enddo ! check the shape functions - do i=1,NGLLX - do j=1,NGLLY - do k=1,NGLLZ + do i = 1,NGLLX + do j = 1,NGLLY + do k = 1,NGLLZ - sumshape=ZERO + sumshape = ZERO - sumdershapexi=ZERO - sumdershapeeta=ZERO - sumdershapegamma=ZERO + sumdershapexi = ZERO + sumdershapeeta = ZERO + sumdershapegamma = ZERO - do ia=1,NGNOD + do ia = 1,NGNOD sumshape=sumshape+shape3D(ia,i,j,k) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/gll_library.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/gll_library.f90 index 657c0c16c..566ba8a19 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/gll_library.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/gll_library.f90 @@ -14,7 +14,7 @@ double precision function endw1(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -40,7 +40,7 @@ double precision function endw1(n,alpha,beta) endw1 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -66,7 +66,7 @@ double precision function endw2(n,alpha,beta) integer n double precision alpha,beta - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0,three=3.d0,four=4.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0,three = 3.d0,four = 4.d0 double precision apb,f1,fint1,fint2,f2,di,abn,abnn,a1,a2,a3,f3 double precision, external :: gammaf integer i @@ -92,7 +92,7 @@ double precision function endw2(n,alpha,beta) endw2 = f2 return endif - do i=3,n + do i = 3,n di = dble(i-1) abn = alpha+beta+di abnn = abn+di @@ -119,7 +119,7 @@ double precision function gammaf (x) double precision x - double precision, parameter :: half=0.5d0,one=1.d0,two=2.d0 + double precision, parameter :: half = 0.5d0,one = 1.d0,two = 2.d0 gammaf = one @@ -177,7 +177,7 @@ subroutine jacg (xjac,np,alpha,beta) p = 0.d0 pd = 0.d0 jmin = 0 - do j=1,np + do j = 1,np if (j == 1) then x = dcos((2.d0*(dble(j)-1.d0)+1.d0)*dth) else @@ -185,11 +185,11 @@ subroutine jacg (xjac,np,alpha,beta) x2 = xlast x = (x1+x2)/2.d0 endif - do k=1,K_MAX_ITER + do k = 1,K_MAX_ITER call jacobf (p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x) recsum = 0.d0 jm = j-1 - do i=1,jm + do i = 1,jm recsum = recsum+1.d0/(x-xjac(np-i+1)) enddo delx = -p/(pd-recsum*p) @@ -200,9 +200,9 @@ subroutine jacg (xjac,np,alpha,beta) xjac(np-j+1) = x xlast = x enddo - do i=1,np + do i = 1,np xmin = 2.d0 - do j=i,np + do j = i,np if (xjac(j) < xmin) then xmin = xjac(j) jmin = j @@ -251,7 +251,7 @@ subroutine jacobf (poly,pder,polym1,pderm1,polym2,pderm2,n,alp,bet,x) pder = (apb+2.d0)/2.d0 if (n == 1) return - do k=2,n + do k = 2,n dk = dble(k) a1 = 2.d0*dk*(dk+apb)*(2.d0*dk+apb-2.d0) a2 = (2.d0*dk+apb-1.d0)*(alp**2-bet**2) @@ -382,7 +382,7 @@ double precision function pnormj (n,alpha,beta) prod = prod*(one+alpha)*(two+alpha) prod = prod*(one+beta)*(two+beta) - do i=3,n + do i = 3,n dindx = dble(i) frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta)) prod = prod*frac @@ -409,7 +409,7 @@ subroutine zwgjd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision z(np),w(np) @@ -452,7 +452,7 @@ subroutine zwgjd(z,w,np,alpha,beta) fac3 = fac2+one fnorm = pnormj(np1,alpha,beta) rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2) - do i=1,np + do i = 1,np call jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i)) w(i) = -rcoef/(p*pdm1) enddo @@ -479,7 +479,7 @@ subroutine zwgljd(z,w,np,alpha,beta) implicit none - double precision, parameter :: zero=0.d0,one=1.d0,two=2.d0 + double precision, parameter :: zero = 0.d0,one = 1.d0,two = 2.d0 integer np double precision alpha,beta @@ -516,7 +516,7 @@ subroutine zwgljd(z,w,np,alpha,beta) z(1) = - one z(np) = one - do i=2,np-1 + do i = 2,np-1 w(i) = w(i)/(one-z(i)**2) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/intgrl.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/intgrl.f90 index 1eda183c6..30f074801 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/intgrl.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/intgrl.f90 @@ -54,10 +54,10 @@ subroutine intgrl(sum,r,nir,ner,f,s1,s2,s3) call deriv(f,yprime,n,r,ndis,kdis,s1,s2,s3) nir1 = nir + 1 sum = 0.0d0 - do i=nir1,ner + do i = nir1,ner j = i-1 rji = r(i) - r(j) - sum=sum+r(j)*r(j)*rji*(f(j)+rji*(.50d0*s1(j)+rji*(third*s2(j)+rji* & + sum = sum+r(j)*r(j)*rji*(f(j)+rji*(.50d0*s1(j)+rji*(third*s2(j)+rji* & .250d0*s3(j))))+2.0d0*r(j)*rji*rji*(.50d0*f(j)+rji*(third*s1(j)+rji* & (.250d0*s2(j)+rji*fifth*s3(j))))+rji*rji*rji*(third*f(j)+rji* & (.250d0*s1(j)+rji*(fifth*s2(j)+rji*sixth*s3(j)))) @@ -88,20 +88,20 @@ subroutine deriv(y,yprime,n,r,ndis,kdis,s1,s2,s3) yy(2) = 0.d0 yy(3) = 0.d0 - ndp=ndis+1 - do 3 nd=1,ndp + ndp = ndis+1 + do 3 nd = 1,ndp if (nd == 1) goto 4 if (nd == ndp) goto 5 j1=kdis(nd-1)+1 j2=kdis(nd)-2 goto 6 - 4 j1=1 + 4 j1 = 1 j2=kdis(1)-2 goto 6 5 j1=kdis(ndis)+1 - j2=n-2 + j2 = n-2 6 if ((j2+1-j1) > 0) goto 11 - j2=j2+2 + j2 = j2+2 yy(1)=(y(j2)-y(j1))/(r(j2)-r(j1)) s1(j1)=yy(1) s1(j2)=yy(1) @@ -110,28 +110,28 @@ subroutine deriv(y,yprime,n,r,ndis,kdis,s1,s2,s3) s3(j1)=yy(3) s3(j2)=yy(3) goto 3 - 11 a0=0.0d0 + 11 a0 = 0.0d0 if (j1 == 1) goto 7 - h=r(j1+1)-r(j1) - h2=r(j1+2)-r(j1) + h = r(j1+1)-r(j1) + h2 = r(j1+2)-r(j1) yy(1)=h*h2*(h2-h) - h=h*h - h2=h2*h2 + h = h*h + h2 = h2*h2 b0=(y(j1)*(h-h2)+y(j1+1)*h2-y(j1+2)*h)/yy(1) goto 8 - 7 b0=0.0d0 - 8 b1=b0 + 7 b0 = 0.0d0 + 8 b1 = b0 if (j2 > 1000) stop 'error in subroutine deriv for j2' - do i=j1,j2 - h=r(i+1)-r(i) + do i = j1,j2 + h = r(i+1)-r(i) yy(1)=y(i+1)-y(i) - h2=h*h - ha=h-a0 - h2a=h-2.0d0*a0 - h3a=2.0d0*h-3.0d0*a0 - h2b=h2*b0 + h2 = h*h + ha = h-a0 + h2a = h-2.0d0*a0 + h3a = 2.0d0*h-3.0d0*a0 + h2b = h2*b0 s1(i)=h2/ha s2(i)=-ha/(h2a*h2) s3(i)=-h*h2a/h3a @@ -142,42 +142,42 @@ subroutine deriv(y,yprime,n,r,ndis,kdis,s1,s2,s3) b0=f(3,i) enddo - i=j2+1 - h=r(i+1)-r(i) + i = j2+1 + h = r(i+1)-r(i) yy(1)=y(i+1)-y(i) - h2=h*h - ha=h-a0 - h2a=h*ha - h2b=h2*b0-yy(1)*(2.d0*h-a0) + h2 = h*h + ha = h-a0 + h2a = h*ha + h2b = h2*b0-yy(1)*(2.d0*h-a0) s1(i)=h2/ha f(1,i)=(yy(1)-h*b0)/h2a - ha=r(j2)-r(i+1) + ha = r(j2)-r(i+1) yy(1)=-h*ha*(ha+h) - ha=ha*ha + ha = ha*ha yy(1)=(y(i+1)*(h2-ha)+y(i)*ha-y(j2)*h2)/yy(1) s3(i)=(yy(1)*h2a+h2b)/(h*h2*(h-2.0d0*a0)) - s13=s1(i)*s3(i) + s13 = s1(i)*s3(i) s2(i)=f(1,i)-s13 - do j=j1,j2 - k=i-1 - s32=s3(k)*s2(i) + do j = j1,j2 + k = i-1 + s32 = s3(k)*s2(i) s1(i)=f(3,k)-s32 - s21=s2(k)*s1(i) + s21 = s2(k)*s1(i) s3(k)=f(2,k)-s21 - s13=s1(k)*s3(k) + s13 = s1(k)*s3(k) s2(k)=f(1,k)-s13 - i=k + i = k enddo s1(i)=b1 - j2=j2+2 + j2 = j2+2 s1(j2)=yy(1) s2(j2)=yy(2) s3(j2)=yy(3) 3 continue - do i=1,n + do i = 1,n yprime(i)=s1(i) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/jp3d1994_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/jp3d1994_model.f90 index 40aa7d9ac..0ee88be8b 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/jp3d1994_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/jp3d1994_model.f90 @@ -249,10 +249,10 @@ subroutine iso3d_dpzhao_model(radius,theta,phi,vp,vs,dvp,dvs,rho,found_crust,JP3 ! determine rho if (LAY == 1) then - rho=2.6 + rho = 2.6 endif if (LAY == 2) then - rho=2.9 + rho = 2.9 endif if (LAY > 2) then rho=3.3+(vs-4.4)*0.66667 @@ -260,7 +260,7 @@ subroutine iso3d_dpzhao_model(radius,theta,phi,vp,vs,dvp,dvs,rho,found_crust,JP3 ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) end subroutine iso3d_dpzhao_model @@ -352,12 +352,12 @@ subroutine PUT1(NPX,NRX,NHX,PNX,RNX,HNX,VELXP) integer :: NPX,NRX,NHX,K,I,J double precision :: VELXP(NPX,NRX,NHX), & PNX(NPX),RNX(NRX),HNX(NHX) - READ(2,110) (PNX(I),I=1,NPX) - READ(2,110) (RNX(I),I=1,NRX) - READ(2,120) (HNX(I),I=1,NHX) + READ(2,110) (PNX(I),I = 1,NPX) + READ(2,110) (RNX(I),I = 1,NRX) + READ(2,120) (HNX(I),I = 1,NHX) DO K = 1,NHX DO I = 1,NPX - READ(2,140) (VELXP(I,J,K),J=1,NRX) + READ(2,140) (VELXP(I,J,K),J = 1,NRX) 110 FORMAT(6(9F7.2/)) 120 FORMAT(3(8F7.2/)) 140 FORMAT(4(14F5.2/)) @@ -440,16 +440,16 @@ subroutine INPUT2(JP3DM_V) integer :: NP,NNR,I,J READ(3,100) NP,NNR - READ(3,110) (JP3DM_V%PN(I),I=1,NP) - READ(3,120) (JP3DM_V%RRN(I),I=1,NNR) + READ(3,110) (JP3DM_V%PN(I),I = 1,NP) + READ(3,120) (JP3DM_V%RRN(I),I = 1,NNR) DO 1 I = NP,1,-1 - READ(3,130) (JP3DM_V%DEPA(I,J),J=1,NNR) + READ(3,130) (JP3DM_V%DEPA(I,J),J = 1,NNR) 1 continue DO 2 I = NP,1,-1 - READ(3,130) (JP3DM_V%DEPB(I,J),J=1,NNR) + READ(3,130) (JP3DM_V%DEPB(I,J),J = 1,NNR) 2 continue DO 3 I = NP,1,-1 - READ(3,130) (JP3DM_V%DEPC(I,J),J=1,NNR) + READ(3,130) (JP3DM_V%DEPC(I,J),J = 1,NNR) 3 continue 100 FORMAT(2I6) 110 FORMAT(5(10F7.2/),F7.2) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lagrange_poly.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lagrange_poly.f90 index 1dee2afea..14b85bc59 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lagrange_poly.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lagrange_poly.f90 @@ -38,11 +38,11 @@ subroutine lagrange_any(xi,NGLL,xigll,h,hprime) integer dgr,i,j double precision prod1,prod2 - do dgr=1,NGLL + do dgr = 1,NGLL prod1 = 1.0d0 prod2 = 1.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then prod1 = prod1*(xi-xigll(i)) prod2 = prod2*(xigll(dgr)-xigll(i)) @@ -51,10 +51,10 @@ subroutine lagrange_any(xi,NGLL,xigll,h,hprime) h(dgr)=prod1/prod2 hprime(dgr)=0.0d0 - do i=1,NGLL + do i = 1,NGLL if (i /= dgr) then - prod1=1.0d0 - do j=1,NGLL + prod1 = 1.0d0 + do j = 1,NGLL if (j /= dgr .and. j /= i) prod1 = prod1*(xi-xigll(j)) enddo hprime(dgr) = hprime(dgr)+prod1 diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lgndr.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lgndr.f90 index 53064c63f..51e7b83d8 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lgndr.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/lgndr.f90 @@ -61,46 +61,46 @@ subroutine lgndr(l,c,s,x,dx) sqroot2over2 = 0.707106781186550d0 if (s >= 1.0d0-tol) s=1.0d0-tol - lsave=l + lsave = l if (l < 0) l=-1-l if (l > 0) goto 1 x(1)=rfpi dx(1)=0.0d0 - l=lsave + l = lsave return 1 if (l /= 1) goto 2 - c1=sqroot3*rfpi - c2=sqroot2over2*c1 + c1 = sqroot3*rfpi + c2 = sqroot2over2*c1 x(1)=c1*c x(2)=-c2*s dx(1)=-c1*s dx(2)=-c2*c - l=lsave + l = lsave return - 2 sos=s + 2 sos = s if (s < tol) s=tol - cot=c/s - ct=2.0d0*c - ss=s*s - lp1=l+1 - g3=0.0d0 - g2=1.0d0 - f3=0.0d0 + cot = c/s + ct = 2.0d0*c + ss = s*s + lp1 = l+1 + g3 = 0.0d0 + g2 = 1.0d0 + f3 = 0.0d0 ! evaluate m=l value, sans (sin(theta))**l - do i=1,l - g2=g2*(1.0d0-1.0d0/(2.0d0*i)) + do i = 1,l + g2 = g2*(1.0d0-1.0d0/(2.0d0*i)) enddo - g2=rfpi*dsqrt((2*l+1)*g2) - f2=l*cot*g2 + g2 = rfpi*dsqrt((2*l+1)*g2) + f2 = l*cot*g2 x(lp1)=g2 dx(lp1)=f2 - v=1.0d0 - y=2.0d0*l + v = 1.0d0 + y = 2.0d0*l d=dsqrt(v*y) - t=0.0d0 - mp1=l - m=l-1 + t = 0.0d0 + mp1 = l + m = l-1 ! these recursions are similar to ordinary m-recursions, but since we ! have taken the s**m factor out of the xlm's, the recursion has the powers @@ -110,43 +110,43 @@ subroutine lgndr(l,c,s,x,dx) x(mp1)=g1 dx(mp1)=f1 if (m == 0) goto 4 - mp1=m - m=m-1 - v=v+1.0d0 - y=y-1.0d0 - t=d + mp1 = m + m = m-1 + v = v+1.0d0 + y = y-1.0d0 + t = d d=dsqrt(v*y) - g3=g2 - g2=g1 - f3=f2 - f2=f1 + g3 = g2 + g2 = g1 + f3 = f2 + f2 = f1 goto 3 ! explicit conversion to integer added - 4 maxsin=int(-72.0d0/log10(s)) + 4 maxsin = int(-72.0d0/log10(s)) ! maxsin is the max exponent of sin(theta) without underflow lpsafe=min0(lp1,maxsin) - stom=1.0d0 - fac=sign(1.0d0,dble((l/2)*2-l) + 0.50d0) + stom = 1.0d0 + fac = sign(1.0d0,dble((l/2)*2-l) + 0.50d0) ! multiply xlm by sin**m - do m=1,lpsafe + do m = 1,lpsafe x(m)=fac*x(m)*stom dx(m)=fac*dx(m)*stom - stom=stom*s + stom = stom*s enddo ! set any remaining xlm to zero if (maxsin <= l) then - mmm=maxsin+1 - do m=mmm,lp1 + mmm = maxsin+1 + do m = mmm,lp1 x(m)=0.0d0 dx(m)=0.0d0 enddo endif - s=sos - l=lsave + s = sos + l = lsave end subroutine lgndr diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_ellipticity.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_ellipticity.f90 index a261d7c5b..49fdfa2a7 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_ellipticity.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_ellipticity.f90 @@ -84,49 +84,49 @@ subroutine make_ellipticity(nspl,rspl,espl,espl2,ONE_CRUST) r_ocean = ROCEAN_ELLIPTICITY/R_EARTH_ELLIPTICITY r_0 = 1.d0 - do i=1,163 + do i = 1,163 r(i) = r_icb*dble(i-1)/dble(162) enddo - do i=164,323 + do i = 164,323 r(i) = r_icb+(r_cmb-r_icb)*dble(i-164)/dble(159) enddo - do i=324,336 + do i = 324,336 r(i) = r_cmb+(r_topddoubleprime-r_cmb)*dble(i-324)/dble(12) enddo - do i=337,517 + do i = 337,517 r(i) = r_topddoubleprime+(r_771-r_topddoubleprime)*dble(i-337)/dble(180) enddo - do i=518,530 + do i = 518,530 r(i) = r_771+(r_670-r_771)*dble(i-518)/dble(12) enddo - do i=531,540 + do i = 531,540 r(i) = r_670+(r_600-r_670)*dble(i-531)/dble(9) enddo - do i=541,565 + do i = 541,565 r(i) = r_600+(r_400-r_600)*dble(i-541)/dble(24) enddo - do i=566,590 + do i = 566,590 r(i) = r_400+(r_220-r_400)*dble(i-566)/dble(24) enddo - do i=591,609 + do i = 591,609 r(i) = r_220+(r_80-r_220)*dble(i-591)/dble(18) enddo - do i=610,619 + do i = 610,619 r(i) = r_80+(r_moho-r_80)*dble(i-610)/dble(9) enddo - do i=620,626 + do i = 620,626 r(i) = r_moho+(r_middle_crust-r_moho)*dble(i-620)/dble(6) enddo - do i=627,633 + do i = 627,633 r(i) = r_middle_crust+(r_ocean-r_middle_crust)*dble(i-627)/dble(6) enddo - do i=634,NR + do i = 634,NR r(i) = r_ocean+(r_0-r_ocean)*dble(i-634)/dble(6) enddo ! use PREM to get the density profile for ellipticity (fine for other 1D reference models) - do i=1,NR + 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) radau(i)=rho(i)*r(i)*r(i) @@ -136,7 +136,7 @@ subroutine make_ellipticity(nspl,rspl,espl,espl2,ONE_CRUST) k(1)=0.0d0 - do i=2,NR + do i = 2,NR call intgrl(i_rho,r,1,i,rho,s1,s2,s3) call intgrl(i_radau,r,1,i,radau,s1,s2,s3) z=(2.0d0/3.0d0)*i_radau/(i_rho*r(i)*r(i)) @@ -144,30 +144,30 @@ subroutine make_ellipticity(nspl,rspl,espl,espl2,ONE_CRUST) k(i)=eta(i)/(r(i)**3.0d0) enddo - g_a=4.0D0*i_rho + g_a = 4.0D0*i_rho bom=TWO_PI/(24.0d0*3600.0d0) bom=bom/sqrt(PI*GRAV*RHOAV) epsilonval(NR)=15.0d0*(bom**2.0d0)/(24.0d0*i_rho*(eta(NR)+2.0d0)) - do i=1,NR-1 + do i = 1,NR-1 call intgrl(exponentval,r,i,NR,k,s1,s2,s3) epsilonval(i)=epsilonval(NR)*exp(-exponentval) enddo ! get ready to spline epsilonval - nspl=1 + nspl = 1 rspl(1)=r(1) espl(1)=epsilonval(1) - do i=2,NR + do i = 2,NR if (r(i) /= r(i-1)) then - nspl=nspl+1 + nspl = nspl+1 rspl(nspl)=r(i) espl(nspl)=epsilonval(i) endif enddo ! spline epsilonval - yp1=0.0d0 + yp1 = 0.0d0 ypn=(5.0d0/2.0d0)*(bom**2)/g_a-2.0d0*epsilonval(NR) call spline_construction(rspl,espl,nspl,yp1,ypn,espl2) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_gravity.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_gravity.f90 index 3af1062f8..6f612393c 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_gravity.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/make_gravity.f90 @@ -83,54 +83,54 @@ subroutine make_gravity(nspl,rspl,gspl,gspl2,ONE_CRUST) r_ocean = ROCEAN_GRAVITY/R_EARTH_GRAVITY r_0 = 1.d0 - do i=1,163 + do i = 1,163 r(i) = r_icb*dble(i-1)/dble(162) enddo - do i=164,323 + do i = 164,323 r(i) = r_icb+(r_cmb-r_icb)*dble(i-164)/dble(159) enddo - do i=324,336 + do i = 324,336 r(i) = r_cmb+(r_topddoubleprime-r_cmb)*dble(i-324)/dble(12) enddo - do i=337,517 + do i = 337,517 r(i) = r_topddoubleprime+(r_771-r_topddoubleprime)*dble(i-337)/dble(180) enddo - do i=518,530 + do i = 518,530 r(i) = r_771+(r_670-r_771)*dble(i-518)/dble(12) enddo - do i=531,540 + do i = 531,540 r(i) = r_670+(r_600-r_670)*dble(i-531)/dble(9) enddo - do i=541,565 + do i = 541,565 r(i) = r_600+(r_400-r_600)*dble(i-541)/dble(24) enddo - do i=566,590 + do i = 566,590 r(i) = r_400+(r_220-r_400)*dble(i-566)/dble(24) enddo - do i=591,609 + do i = 591,609 r(i) = r_220+(r_80-r_220)*dble(i-591)/dble(18) enddo - do i=610,619 + do i = 610,619 r(i) = r_80+(r_moho-r_80)*dble(i-610)/dble(9) enddo - do i=620,626 + do i = 620,626 r(i) = r_moho+(r_middle_crust-r_moho)*dble(i-620)/dble(6) enddo - do i=627,633 + do i = 627,633 r(i) = r_middle_crust+(r_ocean-r_middle_crust)*dble(i-627)/dble(6) enddo - do i=634,NR + do i = 634,NR r(i) = r_ocean+(r_0-r_ocean)*dble(i-634)/dble(6) enddo ! use PREM to get the density profile for ellipticity (fine for other 1D reference models) - do i=1,NR + 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) enddo g(1)=0.0d0 - do i=2,NR + do i = 2,NR call intgrl(i_rho,r,1,i,rho,s1,s2,s3) g(i)=4.0d0*i_rho/(r(i)*r(i)) enddo @@ -138,18 +138,18 @@ subroutine make_gravity(nspl,rspl,gspl,gspl2,ONE_CRUST) ! ! get ready to spline g ! - nspl=1 + nspl = 1 rspl(1)=r(1) gspl(1)=g(1) - do i=2,NR + do i = 2,NR if (r(i) /= r(i-1)) then - nspl=nspl+1 + nspl = nspl+1 rspl(nspl)=r(i) gspl(nspl)=g(i) endif enddo yp1=(4.0d0/3.0d0)*rho(1) - ypn=4.0d0*rho(NR)-2.0d0*g(NR)/r(NR) + ypn = 4.0d0*rho(NR)-2.0d0*g(NR)/r(NR) call spline_construction(rspl,gspl,nspl,yp1,ypn,gspl2) end subroutine make_gravity diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/mantle_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/mantle_model.f90 index 5b47f1b95..0055561ac 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/mantle_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/mantle_model.f90 @@ -55,8 +55,8 @@ subroutine read_mantle_model(D3MM_V) ! S20RTS degree 20 S model from Ritsema open(unit=10,file=S20RTS,status='old',action='read') - do k=0,NK - do l=0,NS + do k = 0,NK + do l = 0,NS read(10,*) D3MM_V%dvs_a(k,l,0),(D3MM_V%dvs_a(k,l,m),D3MM_V%dvs_b(k,l,m),m=1,l) enddo enddo @@ -64,13 +64,13 @@ subroutine read_mantle_model(D3MM_V) ! P12 degree 12 P model from Ritsema open(unit=10,file=P12,status='old',action='read') - do k=0,NK - do l=0,12 + do k = 0,NK + do l = 0,12 read(10,*) D3MM_V%dvp_a(k,l,0),(D3MM_V%dvp_a(k,l,m),D3MM_V%dvp_b(k,l,m),m=1,l) enddo - do l=13,NS + do l = 13,NS D3MM_V%dvp_a(k,l,0) = 0.0d0 - do m=1,l + do m = 1,l D3MM_V%dvp_a(k,l,m) = 0.0d0 D3MM_V%dvp_b(k,l,m) = 0.0d0 enddo @@ -132,35 +132,35 @@ subroutine mantle_model(radius,theta,phi,dvs,dvp,drho,D3MM_V) if (radius >= r_moho .or. radius <= r_cmb) return xr=-1.0d0+2.0d0*(radius-r_cmb)/(r_moho-r_cmb) - do k=0,NK + do k = 0,NK radial_basis(k)=rsple(1,NK+1,D3MM_V%spknt(1),D3MM_V%qq0(1,NK+1-k),D3MM_V%qq(1,1,NK+1-k),xr) enddo - do l=0,NS + do l = 0,NS sint=dsin(theta) cost=dcos(theta) call lgndr(l,cost,sint,x,dx) - dvs_alm=0.0d0 - dvp_alm=0.0d0 - do k=0,NK - dvs_alm=dvs_alm+radial_basis(k)*D3MM_V%dvs_a(k,l,0) - dvp_alm=dvp_alm+radial_basis(k)*D3MM_V%dvp_a(k,l,0) + dvs_alm = 0.0d0 + dvp_alm = 0.0d0 + do k = 0,NK + dvs_alm = dvs_alm+radial_basis(k)*D3MM_V%dvs_a(k,l,0) + dvp_alm = dvp_alm+radial_basis(k)*D3MM_V%dvp_a(k,l,0) enddo dvs=dvs+dvs_alm*x(1) dvp=dvp+dvp_alm*x(1) - do m=1,l - dvs_alm=0.0d0 - dvp_alm=0.0d0 - dvs_blm=0.0d0 - dvp_blm=0.0d0 - do k=0,NK - dvs_alm=dvs_alm+radial_basis(k)*D3MM_V%dvs_a(k,l,m) - dvp_alm=dvp_alm+radial_basis(k)*D3MM_V%dvp_a(k,l,m) - dvs_blm=dvs_blm+radial_basis(k)*D3MM_V%dvs_b(k,l,m) - dvp_blm=dvp_blm+radial_basis(k)*D3MM_V%dvp_b(k,l,m) + do m = 1,l + dvs_alm = 0.0d0 + dvp_alm = 0.0d0 + dvs_blm = 0.0d0 + dvp_blm = 0.0d0 + do k = 0,NK + dvs_alm = dvs_alm+radial_basis(k)*D3MM_V%dvs_a(k,l,m) + dvp_alm = dvp_alm+radial_basis(k)*D3MM_V%dvp_a(k,l,m) + dvs_blm = dvs_blm+radial_basis(k)*D3MM_V%dvs_b(k,l,m) + dvp_blm = dvp_blm+radial_basis(k)*D3MM_V%dvp_b(k,l,m) enddo - dvs=dvs+(dvs_alm*dcos(dble(m)*phi)+dvs_blm*dsin(dble(m)*phi))*x(m+1) - dvp=dvp+(dvp_alm*dcos(dble(m)*phi)+dvp_blm*dsin(dble(m)*phi))*x(m+1) + dvs = dvs+(dvs_alm*dcos(dble(m)*phi)+dvs_blm*dsin(dble(m)*phi))*x(m+1) + dvp = dvp+(dvp_alm*dcos(dble(m)*phi)+dvp_blm*dsin(dble(m)*phi))*x(m+1) enddo enddo @@ -218,8 +218,8 @@ subroutine splhsetup(D3MM_V)!!!!!!!!!!!!!!(spknt,qq0,qq) D3MM_V%spknt(20) = 0.96512d0 D3MM_V%spknt(21) = 1.00000d0 - do i=1,NK+1 - do j=1,NK+1 + do i = 1,NK+1 + do j = 1,NK+1 if (i == j) then D3MM_V%qq0(j,i)=1.0d0 else @@ -227,7 +227,7 @@ subroutine splhsetup(D3MM_V)!!!!!!!!!!!!!!(spknt,qq0,qq) endif enddo enddo - do i=1,NK+1 + do i = 1,NK+1 call rspln(1,NK+1,D3MM_V%spknt(1),D3MM_V%qq0(1,i),D3MM_V%qq(1,1,i),qqwk(1,1)) enddo @@ -255,7 +255,7 @@ double precision function rsple(I1,I2,X,Y,Q,S) double precision h i = 1 - II=I2-1 + II = I2-1 ! GUARANTEE I WITHIN BOUNDS. I=MAX0(I,I1) @@ -269,7 +269,7 @@ double precision function rsple(I1,I2,X,Y,Q,S) 1 if (S-X(I) <= 0) goto 3 if (S-X(I) > 0) goto 4 - 4 I=I-1 + 4 I = I-1 if (I-I1 < 0) goto 11 if (I-I1 == 0) goto 6 @@ -278,7 +278,7 @@ double precision function rsple(I1,I2,X,Y,Q,S) 3 if (S-X(I+1) < 0) goto 5 if (S-X(I+1) >= 0) goto 6 - 5 I=I+1 + 5 I = I+1 if (I-II < 0) goto 3 if (I-II == 0) goto 6 @@ -288,7 +288,7 @@ double precision function rsple(I1,I2,X,Y,Q,S) 2 if (S-X(I+1) <= 0) goto 8 if (S-X(I+1) > 0) goto 9 - 9 I=I+1 + 9 I = I+1 if (I-II < 0) goto 2 if (I-II == 0) goto 6 @@ -297,18 +297,18 @@ double precision function rsple(I1,I2,X,Y,Q,S) 8 if (S-X(I) < 0) goto 10 if (S-X(I) >= 0) goto 6 - 10 I=I-1 + 10 I = I-1 if (I-I1 < 0) goto 11 if (I-I1 == 0) goto 6 if (I-I1 > 0) goto 8 - 7 I=II + 7 I = II goto 6 - 11 I=I1 + 11 I = I1 ! CALCULATE RSPLE USING SPLINE COEFFICIENTS IN Y AND Q. 6 H=S-X(I) - RSPLE=Y(I)+H*(Q(1,I)+H*(Q(2,I)+H*Q(3,I))) + RSPLE = Y(I)+H*(Q(1,I)+H*(Q(2,I)+H*Q(3,I))) end function rsple @@ -338,8 +338,8 @@ subroutine rspln(I1,I2,X,Y,Q,F) equivalence (YY(1),Y0) data SMALL/1.0d-08/,YY/0.0d0,0.0d0,0.0d0/ - J1=I1+1 - Y0=0.0d0 + J1 = I1+1 + Y0 = 0.0d0 ! BAIL OUT IF THERE ARE LESS THAN TWO POINTS TOTAL if (I2-I1 < 0) return @@ -348,50 +348,50 @@ subroutine rspln(I1,I2,X,Y,Q,F) 8 A0=X(J1-1) ! SEARCH FOR DISCONTINUITIES. - DO 3 I=J1,I2 - B0=A0 + DO 3 I = J1,I2 + B0 = A0 A0=X(I) if (DABS((A0-B0)/DMAX1(A0,B0)) < SMALL) goto 4 3 continue - 17 J1=J1-1 - J2=I2-2 + 17 J1 = J1-1 + J2 = I2-2 goto 5 - 4 J1=J1-1 - J2=I-3 + 4 J1 = J1-1 + J2 = I-3 ! SEE IF THERE ARE ENOUGH POINTS TO INTERPOLATE (AT LEAST THREE). 5 if (J2+1-J1 < 0) goto 9 if (J2+1-J1 == 0) goto 10 if (J2+1-J1 > 0) goto 11 ! ONLY TWO POINTS. USE LINEAR INTERPOLATION. - 10 J2=J2+2 + 10 J2 = J2+2 Y0=(Y(J2)-Y(J1))/(X(J2)-X(J1)) - DO J=1,3 + DO J = 1,3 Q(J,J1)=YY(J) Q(J,J2)=YY(J) enddo goto 12 ! MORE THAN TWO POINTS. DO SPLINE INTERPOLATION. - 11 A0=0. - H=X(J1+1)-X(J1) - H2=X(J1+2)-X(J1) + 11 A0 = 0. + H = X(J1+1)-X(J1) + H2 = X(J1+2)-X(J1) Y0=H*H2*(H2-H) - H=H*H - H2=H2*H2 + H = H*H + H2 = H2*H2 ! CALCULATE DERIVITIVE AT NEAR END. B0=(Y(J1)*(H-H2)+Y(J1+1)*H2-Y(J1+2)*H)/Y0 - B1=B0 + B1 = B0 ! EXPLICITLY REDUCE BANDED MATRIX TO AN UPPER BANDED MATRIX. - DO I=J1,J2 - H=X(I+1)-X(I) - Y0=Y(I+1)-Y(I) - H2=H*H - HA=H-A0 - H2A=H-2.0d0*A0 - H3A=2.0d0*H-3.0d0*A0 - H2B=H2*B0 + DO I = J1,J2 + H = X(I+1)-X(I) + Y0 = Y(I+1)-Y(I) + H2 = H*H + HA = H-A0 + H2A = H-2.0d0*A0 + H3A = 2.0d0*H-3.0d0*A0 + H2B = H2*B0 Q(1,I)=H2/HA Q(2,I)=-HA/(H2A*H2) Q(3,I)=-H*H2A/H3A @@ -403,18 +403,18 @@ subroutine rspln(I1,I2,X,Y,Q,F) enddo ! TAKE CARE OF LAST TWO ROWS. - I=J2+1 - H=X(I+1)-X(I) - Y0=Y(I+1)-Y(I) - H2=H*H - HA=H-A0 - H2A=H*HA + I = J2+1 + H = X(I+1)-X(I) + Y0 = Y(I+1)-Y(I) + H2 = H*H + HA = H-A0 + H2A = H*HA H2B=H2*B0-Y0*(2.0d0*H-A0) Q(1,I)=H2/HA F(1,I)=(Y0-H*B0)/H2A - HA=X(J2)-X(I+1) + HA = X(J2)-X(I+1) Y0=-H*HA*(HA+H) - HA=HA*HA + HA = HA*HA ! CALCULATE DERIVATIVE AT FAR END. Y0=(Y(I+1)*(H2-HA)+Y(I)*HA-Y(J2)*H2)/Y0 @@ -422,17 +422,17 @@ subroutine rspln(I1,I2,X,Y,Q,F) Q(2,I)=F(1,I)-Q(1,I)*Q(3,I) ! SOLVE UPPER BANDED MATRIX BY REVERSE ITERATION. - DO J=J1,J2 - K=I-1 + DO J = J1,J2 + K = I-1 Q(1,I)=F(3,K)-Q(3,K)*Q(2,I) Q(3,K)=F(2,K)-Q(2,K)*Q(1,I) Q(2,K)=F(1,K)-Q(1,K)*Q(3,K) - I=K + I = K enddo Q(1,I)=B1 ! FILL IN THE LAST POINT WITH A LINEAR EXTRAPOLATION. - 9 J2=J2+2 - DO J=1,3 + 9 J2 = J2+2 + DO J = 1,3 Q(J,J2)=YY(J) enddo @@ -444,12 +444,12 @@ subroutine rspln(I1,I2,X,Y,Q,F) endif ! NO. GO BACK FOR MORE. - 6 J1=J2+2 + 6 J1 = J2+2 if (J1-I2 <= 0) goto 8 if (J1-I2 > 0) goto 7 ! THERE IS ONLY ONE POINT LEFT AFTER THE LATEST DISCONTINUITY. - 7 DO J=1,3 + 7 DO J = 1,3 Q(J,I2)=YY(J) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/meshfem3D.F90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/meshfem3D.F90 index 37146a250..5da73c5f5 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/meshfem3D.F90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/meshfem3D.F90 @@ -470,11 +470,11 @@ program xmeshfem3D double precision, dimension(30) :: bcast_double_precision logical, dimension(26) :: bcast_logical - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof @@ -816,8 +816,8 @@ program xmeshfem3D write(IMAIN,*) endif do ichunk = 1,NCHUNKS - do iproc_eta=0,NPROC_ETA-1 - do iproc_xi=0,NPROC_XI-1 + do iproc_eta = 0,NPROC_ETA-1 + do iproc_xi = 0,NPROC_XI-1 iprocnum = (ichunk-1)*NPROC + iproc_eta * NPROC_XI + iproc_xi addressing(ichunk,iproc_xi,iproc_eta) = iprocnum ichunk_slice(iprocnum) = ichunk @@ -832,7 +832,7 @@ program xmeshfem3D if (myrank == 0) close(IOUT) ! this for the different counters (which are now different if the superbrick is cut in the outer core) - do iregion=1,MAX_NUM_REGIONS + do iregion = 1,MAX_NUM_REGIONS NSPEC1D_RADIAL_CORNER(iregion,:) = NSPEC1D_RADIAL(iregion) NSPEC2D_XI_FACE(iregion,:) = NSPEC2D_XI(iregion) NSPEC2D_ETA_FACE(iregion,:) = NSPEC2D_ETA(iregion) @@ -981,7 +981,7 @@ program xmeshfem3D write(IMAIN,*) if (ATTENUATION) then write(IMAIN,*) 'incorporating attenuation using ',N_SLS,' standard linear solids' - if (ATTENUATION_3D) write(IMAIN,*)'using 3D attenuation' + if (ATTENUATION_3D) write(IMAIN,*) 'using 3D attenuation' else write(IMAIN,*) 'no attenuation' endif diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_1066a.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_1066a.f90 index a195ac279..c6812de6a 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_1066a.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_1066a.f90 @@ -111,7 +111,7 @@ subroutine model_1066a(x,rho,vp,vs,Qkappa,Qmu,iregion_code,M1066a_V) ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) @@ -1118,7 +1118,7 @@ subroutine define_model_1066a(USE_EXTERNAL_CRUSTAL_MODEL,M1066a_V) ! strip the crust and replace it by mantle if we use an external crustal model if (USE_EXTERNAL_CRUSTAL_MODEL) then - do i=NR_1066A-3,NR_1066A + do i = NR_1066A-3,NR_1066A M1066a_V%density_1066a(i) = M1066a_V%density_1066a(NR_1066A-4) M1066a_V%vp_1066a(i) = M1066a_V%vp_1066a(NR_1066A-4) M1066a_V%vs_1066a(i) = M1066a_V%vs_1066a(NR_1066A-4) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ak135.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ak135.f90 index 68ad024af..6aaea2e7b 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ak135.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ak135.f90 @@ -114,7 +114,7 @@ subroutine model_ak135(x,rho,vp,vs,Qkappa,Qmu,iregion_code,Mak135_V) ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) @@ -1025,7 +1025,7 @@ subroutine define_model_ak135(USE_EXTERNAL_CRUSTAL_MODEL,Mak135_V) ! strip the crust and replace it by mantle if (USE_EXTERNAL_CRUSTAL_MODEL) then - do i=NR_AK135-8,NR_AK135 + do i = NR_AK135-8,NR_AK135 Mak135_V%density_ak135(i) = Mak135_V%density_ak135(NR_AK135-9) Mak135_V%vp_ak135(i) = Mak135_V%vp_ak135(NR_AK135-9) Mak135_V%vs_ak135(i) = Mak135_V%vs_ak135(NR_AK135-9) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_iasp91.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_iasp91.f90 index c724c7aa5..2075e4c19 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_iasp91.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_iasp91.f90 @@ -109,60 +109,60 @@ subroutine model_iasp91(myrank,x,rho,vp,vs,Qkappa,Qmu,idoubling,ONE_CRUST,check_ !--- inner core ! if (r >= 0.d0 .and. r <= RICB) then - rho=13.0885d0-8.8381d0*x*x - vp=11.24094-4.09689*x**2 - vs=3.56454-3.45241*x**2 - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vp = 11.24094-4.09689*x**2 + vs = 3.56454-3.45241*x**2 + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=10.03904+3.75665*x-13.67046*x**2 - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 10.03904+3.75665*x-13.67046*x**2 + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=14.49470-1.47089*x - vs=8.16616-1.58206*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 14.49470-1.47089*x + vs = 8.16616-1.58206*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=25.1486-41.1538*x+51.9932*x**2-26.6083*x**3 - vs=12.9303-21.2590*x+27.8988*x**2-14.1080*x**3 - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 25.1486-41.1538*x+51.9932*x**2-26.6083*x**3 + vs = 12.9303-21.2590*x+27.8988*x**2-14.1080*x**3 + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=25.96984-16.93412*x - vs=20.76890-16.53147*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 25.96984-16.93412*x + vs = 20.76890-16.53147*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! else if (r > R670 .and. r <= R400) then - rho=5.3197d0-1.4836d0*x - vp=29.38896-21.40656*x - vs=17.70732-13.50652*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 5.3197d0-1.4836d0*x + vp = 29.38896-21.40656*x + vs = 17.70732-13.50652*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then - rho=7.1089d0-3.8045d0*x - vp=30.78765-23.25415*x - vs=15.24213-11.08552*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 7.1089d0-3.8045d0*x + vp = 30.78765-23.25415*x + vs = 15.24213-11.08552*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 ! from Sebastien Chevrot: for the IASP91 model ! Depth R Vp Vs @@ -172,56 +172,56 @@ subroutine model_iasp91(myrank,x,rho,vp,vs,Qkappa,Qmu,idoubling,ONE_CRUST,check_ ! with x = r / 6371 else if (r > R220 .and. r <= R120) then - rho=2.6910d0+0.6924d0*x - vp=25.41389-17.69722*x - vs=5.75020-1.27420*x - Qmu=80.0d0 - Qkappa=57827.0d0 + rho = 2.6910d0+0.6924d0*x + vp = 25.41389-17.69722*x + vs = 5.75020-1.27420*x + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (r > R120 .and. r <= RMOHO) then vp = 8.78541d0-0.74953d0*x vs = 6.706231d0-2.248585d0*x rho = 3.3713d0 + (3.3198d0-3.3713d0)*(x-x1)/(x2-x1) if (rho < 3.30d0 .or. rho > 3.38d0) stop 'incorrect density computed for IASP91' - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (SUPPRESS_CRUSTAL_MESH) then !! DK DK extend the Moho up to the surface instead of the crust vp = 8.78541d0-0.74953d0*(RMOHO / R_EARTH) vs = 6.706231d0-2.248585d0*(RMOHO / R_EARTH) rho = 3.3198d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then vp = 6.5d0 vs = 3.75d0 rho = 2.92d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! same properties everywhere in PREM crust if we decide to define only one layer in the crust if (ONE_CRUST) then vp = 5.8d0 vs = 3.36d0 rho = 2.72d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else vp = 5.8d0 vs = 3.36d0 rho = 2.72d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_jp1d.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_jp1d.f90 index 507c18278..ee24c2551 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_jp1d.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_jp1d.f90 @@ -104,44 +104,44 @@ subroutine model_jp1d(myrank,x,rho,vp,vs,Qkappa,Qmu,idoubling, & !--- inner core ! if (r >= 0.d0 .and. r <= RICB) then - rho=13.0885d0-8.8381d0*x*x - vp=11.24094-4.09689*x**2 - vs=3.56454-3.45241*x**2 - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vp = 11.24094-4.09689*x**2 + vs = 3.56454-3.45241*x**2 + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=10.03904+3.75665*x-13.67046*x**2 - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 10.03904+3.75665*x-13.67046*x**2 + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=14.49470-1.47089*x - vs=8.16616-1.58206*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 14.49470-1.47089*x + vs = 8.16616-1.58206*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x vp=-355.58324*x**4 + 1002.03178*x**3 - 1057.3873425*x**2 + 487.0891011*x - 68.520645 vs=-243.33862*x**4 + 668.06411*x**3 - 685.20113*x**2 + 308.04893*x - 43.737642 - Qmu=312.0d0 - Qkappa=57827.0d0 + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x vp=-174.468866*x**2 + 286.37769*x - 106.034798 vs=-81.0865*x*x + 129.67095*x - 45.268933 - Qmu=312.0d0 - Qkappa=57827.0d0 + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! @@ -149,56 +149,56 @@ subroutine model_jp1d(myrank,x,rho,vp,vs,Qkappa,Qmu,idoubling, & vp=-300.510146*x*x + 511.17372648*x - 206.265832 vs=-139.78275*x*x + 233.3097462*x - 91.0129372 rho=3.3d0 + (vs-4.4d0)*0.7d0 - Qmu=143.0d0 - Qkappa=57827.0d0 + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > 5871000.d0 .and. r <= R400) then vp=-601.0202917*x*x + 1063.3823*x - 459.9388738 vs=-145.2465705*x*x + 243.2807524*x - 95.561877 rho=3.3d0 + (vs - 4.4d0)*0.7d0 - Qmu=143.0d0 - Qkappa=57827.0d0 + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then - vp=25.042512155*x*x - 68.8367583*x + 51.4120272 - vs=15.540158021*x*x - 40.2087657*x + 28.9578929 + vp = 25.042512155*x*x - 68.8367583*x + 51.4120272 + vs = 15.540158021*x*x - 40.2087657*x + 28.9578929 rho=3.3d0 + (vs - 4.4d0)*0.7d0 - Qmu=143.0d0 - Qkappa=57827.0d0 + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R220 .and. r <= R80) then - vp=27.0989608 - 19.473338*x - vs=13.920596 - 9.6309917*x + vp = 27.0989608 - 19.473338*x + vs = 13.920596 - 9.6309917*x rho=3.3d0 + (vs - 4.4d0)*0.7d0 - Qmu=80.0d0 - Qkappa=57827.0d0 + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (r > R80 .and. r <= RMOHO) then - vp=26.7663028 - 19.13645*x - vs=13.4601434 - 9.164683*x + vp = 26.7663028 - 19.13645*x + vs = 13.4601434 - 9.164683*x rho=3.3d0 + (vs - 4.4d0)*0.7d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then - rho=2.9d0 + rho = 2.9d0 vp = 6.7d0 vs = 3.8d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else - rho=2.6d0 + rho = 2.6d0 vp = 6.0d0 vs = 3.5d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) end subroutine model_jp1d diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_prem.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_prem.f90 index 184fbe7ec..86e731880 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_prem.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_prem.f90 @@ -106,152 +106,152 @@ subroutine prem_iso(myrank,x,rho,drhodr,vp,vs,Qkappa,Qmu,idoubling,CRUSTAL, & ! if (r >= 0.d0 .and. r <= RICB) then drhodr=-2.0d0*8.8381d0*x - rho=13.0885d0-8.8381d0*x*x - vp=11.2622d0-6.3640d0*x*x - vs=3.6678d0-4.4475d0*x*x - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vp = 11.2622d0-6.3640d0*x*x + vs = 3.6678d0-4.4475d0*x*x + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then drhodr=-1.2638d0-2.0d0*3.6426d0*x-3.0d0*5.5281d0*x*x - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x - vs=11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x + vs = 11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then drhodr=-6.4761d0+2.0d0*5.5283d0*x-3.0d0*3.0807d0*x*x - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vp=29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vs=22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vp = 29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vs = 22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! else if (r > R670 .and. r <= R600) then drhodr=-1.4836d0 - rho=5.3197d0-1.4836d0*x - vp=19.0957d0-9.8672d0*x - vs=9.9839d0-4.9324d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 5.3197d0-1.4836d0*x + vp = 19.0957d0-9.8672d0*x + vs = 9.9839d0-4.9324d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R600 .and. r <= R400) then drhodr=-8.0298d0 - rho=11.2494d0-8.0298d0*x - vp=39.7027d0-32.6166d0*x - vs=22.3512d0-18.5856d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 11.2494d0-8.0298d0*x + vp = 39.7027d0-32.6166d0*x + vs = 22.3512d0-18.5856d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then drhodr=-3.8045d0 - rho=7.1089d0-3.8045d0*x - vp=20.3926d0-12.2569d0*x - vs=8.9496d0-4.4597d0*x - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 7.1089d0-3.8045d0*x + vp = 20.3926d0-12.2569d0*x + vs = 8.9496d0-4.4597d0*x + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R220 .and. r <= R80) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=80.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (CRUSTAL .and. .not. SUPPRESS_CRUSTAL_MESH) then ! fill with PREM mantle and later add CRUST2.0 if (r > R80) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else ! use PREM crust if (r > R80 .and. r <= RMOHO) then - drhodr=0.6924d0 - rho=2.6910d0+0.6924d0*x - vp=4.1875d0+3.9382d0*x - vs=2.1519d0+2.3481d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.6924d0 + rho = 2.6910d0+0.6924d0*x + vp = 4.1875d0+3.9382d0*x + vs = 2.1519d0+2.3481d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (SUPPRESS_CRUSTAL_MESH) then !! DK DK extend the Moho up to the surface instead of the crust - drhodr=0.6924d0 + drhodr = 0.6924d0 rho = 2.6910d0+0.6924d0*(RMOHO / R_EARTH) vp = 4.1875d0+3.9382d0*(RMOHO / R_EARTH) vs = 2.1519d0+2.3481d0*(RMOHO / R_EARTH) - Qmu=600.0d0 - Qkappa=57827.0d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then - drhodr=0.0d0 - rho=2.9d0 - vp=6.8d0 - vs=3.9d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.9d0 + vp = 6.8d0 + vs = 3.9d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! same properties everywhere in PREM crust if we decide to define only one layer in the crust if (ONE_CRUST) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! for density profile for gravity, we do not check that r <= R_EARTH else if (r > ROCEAN) then - drhodr=0.0d0 - rho=2.6d0 - vp=5.8d0 - vs=3.2d0 - Qmu=600.0d0 - Qkappa=57827.0d0 + drhodr = 0.0d0 + rho = 2.6d0 + vp = 5.8d0 + vs = 3.2d0 + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif endif endif ! non-dimensionalize - rho=rho*1000.0d0 - vp=vp*1000.0d0 - vs=vs*1000.0d0 + rho = rho*1000.0d0 + vp = vp*1000.0d0 + vs = vs*1000.0d0 end subroutine prem_iso @@ -338,106 +338,106 @@ subroutine prem_aniso(myrank,x,rho,vpv,vph,vsv,vsh,eta_aniso,Qkappa,Qmu, & !--- inner core ! if (r >= 0.d0 .and. r <= RICB) then - rho=13.0885d0-8.8381d0*x*x - vpv=11.2622d0-6.3640d0*x*x - vsv=3.6678d0-4.4475d0*x*x - vph=vpv - vsh=vsv - Qmu=84.6d0 - Qkappa=1327.7d0 + rho = 13.0885d0-8.8381d0*x*x + vpv = 11.2622d0-6.3640d0*x*x + vsv = 3.6678d0-4.4475d0*x*x + vph = vpv + vsh = vsv + Qmu = 84.6d0 + Qkappa = 1327.7d0 ! !--- outer core ! else if (r > RICB .and. r <= RCMB) then - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vpv=11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x - vsv=0.0d0 - vph=vpv - vsh=vsv - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vpv = 11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x + vsv = 0.0d0 + vph = vpv + vsh = vsv + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! !--- D" at the base of the mantle ! else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vpv=15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vsv=6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x - vph=vpv - vsh=vsv - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vpv = 15.3891d0-5.3181d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vsv = 6.9254d0+1.4672d0*x-2.0834d0*x*x+0.9783d0*x*x*x + vph = vpv + vsh = vsv + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: from top of D" to d670 ! else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vpv=24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x - vsv=11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x - vph=vpv - vsh=vsv - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vpv = 24.9520d0-40.4673d0*x+51.4832d0*x*x-26.6419d0*x*x*x + vsv = 11.1671d0-13.7818d0*x+17.4575d0*x*x-9.2777d0*x*x*x + vph = vpv + vsh = vsv + Qmu = 312.0d0 + Qkappa = 57827.0d0 else if (r > R771 .and. r <= R670) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x - vpv=29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x - vsv=22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x - vph=vpv - vsh=vsv - Qmu=312.0d0 - Qkappa=57827.0d0 + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + vpv = 29.2766d0-23.6027d0*x+5.5242d0*x*x-2.5514d0*x*x*x + vsv = 22.3459d0-17.2473d0*x-2.0834d0*x*x+0.9783d0*x*x*x + vph = vpv + vsh = vsv + Qmu = 312.0d0 + Qkappa = 57827.0d0 ! !--- mantle: above d670 ! else if (r > R670 .and. r <= R600) then - rho=5.3197d0-1.4836d0*x - vpv=19.0957d0-9.8672d0*x - vsv=9.9839d0-4.9324d0*x - vph=vpv - vsh=vsv - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 5.3197d0-1.4836d0*x + vpv = 19.0957d0-9.8672d0*x + vsv = 9.9839d0-4.9324d0*x + vph = vpv + vsh = vsv + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R600 .and. r <= R400) then - rho=11.2494d0-8.0298d0*x - vpv=39.7027d0-32.6166d0*x - vsv=22.3512d0-18.5856d0*x - vph=vpv - vsh=vsv - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 11.2494d0-8.0298d0*x + vpv = 39.7027d0-32.6166d0*x + vsv = 22.3512d0-18.5856d0*x + vph = vpv + vsh = vsv + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R400 .and. r <= R220) then - rho=7.1089d0-3.8045d0*x - vpv=20.3926d0-12.2569d0*x - vsv=8.9496d0-4.4597d0*x - vph=vpv - vsh=vsv - Qmu=143.0d0 - Qkappa=57827.0d0 + rho = 7.1089d0-3.8045d0*x + vpv = 20.3926d0-12.2569d0*x + vsv = 8.9496d0-4.4597d0*x + vph = vpv + vsh = vsv + Qmu = 143.0d0 + Qkappa = 57827.0d0 else if (r > R220 .and. r <= R80) then ! anisotropy in PREM only above 220 km - rho=2.6910d0+0.6924d0*x - vpv=0.8317d0+7.2180d0*x - vph=3.5908d0+4.6172d0*x - vsv=5.8582d0-1.4678d0*x + rho = 2.6910d0+0.6924d0*x + vpv = 0.8317d0+7.2180d0*x + vph = 3.5908d0+4.6172d0*x + vsv = 5.8582d0-1.4678d0*x vsh=-1.0839d0+5.7176d0*x - eta_aniso=3.3687d0-2.4778d0*x - Qmu=80.0d0 - Qkappa=57827.0d0 + eta_aniso = 3.3687d0-2.4778d0*x + Qmu = 80.0d0 + Qkappa = 57827.0d0 else if (CRUSTAL) then ! fill with PREM mantle and later add CRUST2.0 if (r > R80) then - rho=2.6910d0+0.6924d0*x - vpv=0.8317d0+7.2180d0*x - vph=3.5908d0+4.6172d0*x - vsv=5.8582d0-1.4678d0*x + rho = 2.6910d0+0.6924d0*x + vpv = 0.8317d0+7.2180d0*x + vph = 3.5908d0+4.6172d0*x + vsv = 5.8582d0-1.4678d0*x vsh=-1.0839d0+5.7176d0*x - eta_aniso=3.3687d0-2.4778d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + eta_aniso = 3.3687d0-2.4778d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else ! use PREM crust @@ -445,53 +445,53 @@ subroutine prem_aniso(myrank,x,rho,vpv,vph,vsv,vsh,eta_aniso,Qkappa,Qmu, & ! anisotropy in PREM only above 220 km - rho=2.6910d0+0.6924d0*x - vpv=0.8317d0+7.2180d0*x - vph=3.5908d0+4.6172d0*x - vsv=5.8582d0-1.4678d0*x + rho = 2.6910d0+0.6924d0*x + vpv = 0.8317d0+7.2180d0*x + vph = 3.5908d0+4.6172d0*x + vsv = 5.8582d0-1.4678d0*x vsh=-1.0839d0+5.7176d0*x - eta_aniso=3.3687d0-2.4778d0*x - Qmu=600.0d0 - Qkappa=57827.0d0 + eta_aniso = 3.3687d0-2.4778d0*x + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! no anisotropy in the crust in PREM else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then - rho=2.9d0 - vpv=6.8d0 - vsv=3.9d0 - vph=vpv - vsh=vsv - Qmu=600.0d0 - Qkappa=57827.0d0 + rho = 2.9d0 + vpv = 6.8d0 + vsv = 3.9d0 + vph = vpv + vsh = vsv + Qmu = 600.0d0 + Qkappa = 57827.0d0 ! same properties everywhere in PREM crust (only one layer in the crust) if (ONE_CRUST) then - rho=2.6d0 - vpv=5.8d0 - vsv=3.2d0 - vph=vpv - vsh=vsv - Qmu=600.0d0 - Qkappa=57827.0d0 + rho = 2.6d0 + vpv = 5.8d0 + vsv = 3.2d0 + vph = vpv + vsh = vsv + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - rho=2.6d0 - vpv=5.8d0 - vsv=3.2d0 - vph=vpv - vsh=vsv - Qmu=600.0d0 - Qkappa=57827.0d0 + rho = 2.6d0 + vpv = 5.8d0 + vsv = 3.2d0 + vph = vpv + vsh = vsv + Qmu = 600.0d0 + Qkappa = 57827.0d0 else if (r > ROCEAN) then - rho=2.6d0 - vpv=5.8d0 - vsv=3.2d0 - vph=vpv - vsh=vsv - Qmu=600.0d0 - Qkappa=57827.0d0 + rho = 2.6d0 + vpv = 5.8d0 + vsv = 3.2d0 + vph = vpv + vsh = vsv + Qmu = 600.0d0 + Qkappa = 57827.0d0 endif endif endif @@ -500,7 +500,7 @@ subroutine prem_aniso(myrank,x,rho,vpv,vph,vsv,vsh,eta_aniso,Qkappa,Qmu, & ! time scaling (s^{-1}) is done with scaleval ! do not scale anisotropy parameter eta_aniso, which is dimensionless scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vpv=vpv*1000.0d0/(R_EARTH*scaleval) vsv=vsv*1000.0d0/(R_EARTH*scaleval) vph=vph*1000.0d0/(R_EARTH*scaleval) @@ -534,11 +534,11 @@ subroutine prem_display_outer_core(myrank,x,rho,vp,vs,Qkappa,Qmu,idoubling) ! !--- outer core ! - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x - vp=11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x - vs=0.0d0 - Qmu=0.0d0 - Qkappa=57827.0d0 + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + vp = 11.0487d0-4.0362d0*x+4.8023d0*x*x-13.5732d0*x*x*x + vs = 0.0d0 + Qmu = 0.0d0 + Qkappa = 57827.0d0 ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval @@ -570,40 +570,40 @@ subroutine prem_density(x,rho,ONE_CRUST,RICB,RCMB,RTOPDDOUBLEPRIME, & r = x * R_EARTH if (r <= RICB) then - rho=13.0885d0-8.8381d0*x*x + rho = 13.0885d0-8.8381d0*x*x else if (r > RICB .and. r <= RCMB) then - rho=12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x + rho = 12.5815d0-1.2638d0*x-3.6426d0*x*x-5.5281d0*x*x*x else if (r > RCMB .and. r <= RTOPDDOUBLEPRIME) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > RTOPDDOUBLEPRIME .and. r <= R771) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > R771 .and. r <= R670) then - rho=7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x + rho = 7.9565d0-6.4761d0*x+5.5283d0*x*x-3.0807d0*x*x*x else if (r > R670 .and. r <= R600) then - rho=5.3197d0-1.4836d0*x + rho = 5.3197d0-1.4836d0*x else if (r > R600 .and. r <= R400) then - rho=11.2494d0-8.0298d0*x + rho = 11.2494d0-8.0298d0*x else if (r > R400 .and. r <= R220) then - rho=7.1089d0-3.8045d0*x + rho = 7.1089d0-3.8045d0*x else if (r > R220 .and. r <= R80) then - rho=2.6910d0+0.6924d0*x + rho = 2.6910d0+0.6924d0*x else if (r > R80 .and. r <= RMOHO) then - rho=2.6910d0+0.6924d0*x + rho = 2.6910d0+0.6924d0*x else if (r > RMOHO .and. r <= RMIDDLE_CRUST) then if (ONE_CRUST) then - rho=2.6d0 + rho = 2.6d0 else - rho=2.9d0 + rho = 2.9d0 endif else if (r > RMIDDLE_CRUST .and. r <= ROCEAN) then - rho=2.6d0 + rho = 2.6d0 else if (r > ROCEAN) then - rho=2.6d0 + rho = 2.6d0 endif endif - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV end subroutine prem_density diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ref.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ref.f90 index ba47bd3e7..44d4f389d 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ref.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_ref.f90 @@ -126,7 +126,7 @@ subroutine model_ref(x,rho,vpv,vph,vsv,vsh,eta,Qkappa,Qmu,iregion_code,CRUSTAL,M ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho/RHOAV + rho = rho/RHOAV vpv=vpv/(R_EARTH*scaleval) vph=vph/(R_EARTH*scaleval) vsv=vsv/(R_EARTH*scaleval) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_sea1d.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_sea1d.f90 index 1d05a07c7..b5aded913 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_sea1d.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/model_sea1d.f90 @@ -111,7 +111,7 @@ subroutine model_sea1d(x,rho,vp,vs,Qkappa,Qmu,iregion_code,SEA1DM_V) ! non-dimensionalize ! time scaling (s^{-1}) is done with scaleval scaleval=dsqrt(PI*GRAV*RHOAV) - rho=rho*1000.0d0/RHOAV + rho = rho*1000.0d0/RHOAV vp=vp*1000.0d0/(R_EARTH*scaleval) vs=vs*1000.0d0/(R_EARTH*scaleval) @@ -1131,7 +1131,7 @@ subroutine define_model_sea1d(USE_EXTERNAL_CRUSTAL_MODEL,SEA1DM_V) ! strip the crust and replace it by mantle if (USE_EXTERNAL_CRUSTAL_MODEL) then - do i=NR_SEA1D-12,NR_SEA1D + do i = NR_SEA1D-12,NR_SEA1D SEA1DM_V%density_sea1d(i) = SEA1DM_V%density_sea1d(NR_SEA1D-13) SEA1DM_V%vp_sea1d(i) = SEA1DM_V%vp_sea1d(NR_SEA1D-13) SEA1DM_V%vs_sea1d(i) = SEA1DM_V%vs_sea1d(NR_SEA1D-13) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/read_compute_parameters.F90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/read_compute_parameters.F90 index 22e50a87c..5c71871b7 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/read_compute_parameters.F90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/read_compute_parameters.F90 @@ -488,9 +488,9 @@ subroutine read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD !---- case prem_onecrust by default !---- if (SUPPRESS_CRUSTAL_MESH) then - multiplication_factor=2 + multiplication_factor = 2 else - multiplication_factor=1 + multiplication_factor = 1 endif ! element width = 0.5625000 degrees = 62.54715 km @@ -752,34 +752,34 @@ subroutine read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD call auto_time_stepping(ANGULAR_WIDTH_XI_IN_DEGREES, NEX_MAX, DT) !! DK DK suppressed because this routine should not write anything to the screen -! write(*,*)'##############################################################' +! write(*,*) '##############################################################' ! write(*,*) -! write(*,*)' Auto Radial Meshing Code ' -! write(*,*)' Consult read_compute_parameters.f90 and auto_ner.f90 ' -! write(*,*)' This should only be invoked for chunks less than 90 degrees' -! write(*,*)' and for chunks greater than 1248 elements wide' +! write(*,*) ' Auto Radial Meshing Code ' +! write(*,*) ' Consult read_compute_parameters.f90 and auto_ner.f90 ' +! write(*,*) ' This should only be invoked for chunks less than 90 degrees' +! write(*,*) ' and for chunks greater than 1248 elements wide' ! write(*,*) -! write(*,*)'CHUNK WIDTH: ', ANGULAR_WIDTH_XI_IN_DEGREES -! write(*,*)'NEX: ', NEX_MAX -! write(*,*)'NER_CRUST: ', NER_CRUST -! write(*,*)'NER_80_MOHO: ', NER_80_MOHO -! write(*,*)'NER_220_80: ', NER_220_80 -! write(*,*)'NER_400_220: ', NER_400_220 -! write(*,*)'NER_600_400: ', NER_600_400 -! write(*,*)'NER_670_600: ', NER_670_600 -! write(*,*)'NER_771_670: ', NER_771_670 -! write(*,*)'NER_TOPDDOUBLEPRIME_771: ', NER_TOPDDOUBLEPRIME_771 -! write(*,*)'NER_CMB_TOPDDOUBLEPRIME: ', NER_CMB_TOPDDOUBLEPRIME -! write(*,*)'NER_OUTER_CORE: ', NER_OUTER_CORE -! write(*,*)'NER_TOP_CENTRAL_CUBE_ICB: ', NER_TOP_CENTRAL_CUBE_ICB -! write(*,*)'R_CENTRAL_CUBE: ', R_CENTRAL_CUBE -! write(*,*)'multiplication factor: ', multiplication_factor +! write(*,*) 'CHUNK WIDTH: ', ANGULAR_WIDTH_XI_IN_DEGREES +! write(*,*) 'NEX: ', NEX_MAX +! write(*,*) 'NER_CRUST: ', NER_CRUST +! write(*,*) 'NER_80_MOHO: ', NER_80_MOHO +! write(*,*) 'NER_220_80: ', NER_220_80 +! write(*,*) 'NER_400_220: ', NER_400_220 +! write(*,*) 'NER_600_400: ', NER_600_400 +! write(*,*) 'NER_670_600: ', NER_670_600 +! write(*,*) 'NER_771_670: ', NER_771_670 +! write(*,*) 'NER_TOPDDOUBLEPRIME_771: ', NER_TOPDDOUBLEPRIME_771 +! write(*,*) 'NER_CMB_TOPDDOUBLEPRIME: ', NER_CMB_TOPDDOUBLEPRIME +! write(*,*) 'NER_OUTER_CORE: ', NER_OUTER_CORE +! write(*,*) 'NER_TOP_CENTRAL_CUBE_ICB: ', NER_TOP_CENTRAL_CUBE_ICB +! write(*,*) 'R_CENTRAL_CUBE: ', R_CENTRAL_CUBE +! write(*,*) 'multiplication factor: ', multiplication_factor ! write(*,*) -! write(*,*)'DT: ',DT -! write(*,*)'MIN_ATTENUATION_PERIOD ',MIN_ATTENUATION_PERIOD -! write(*,*)'MAX_ATTENUATION_PERIOD ',MAX_ATTENUATION_PERIOD +! write(*,*) 'DT: ',DT +! write(*,*) 'MIN_ATTENUATION_PERIOD ',MIN_ATTENUATION_PERIOD +! write(*,*) 'MAX_ATTENUATION_PERIOD ',MAX_ATTENUATION_PERIOD ! write(*,*) -! write(*,*)'##############################################################' +! write(*,*) '##############################################################' if (HONOR_1D_SPHERICAL_MOHO) then if (.not. ONE_CRUST) then @@ -1133,8 +1133,8 @@ subroutine read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD if (NEX_ETA < 48) stop 'NEX_ETA must be greater than 48 to cut the sphere into slices with positive Jacobian' ! check that mesh can be coarsened in depth three or four times - CUT_SUPERBRICK_XI=.false. - CUT_SUPERBRICK_ETA=.false. + CUT_SUPERBRICK_XI = .false. + CUT_SUPERBRICK_ETA = .false. if (SUPPRESS_CRUSTAL_MESH .and. .not. ADD_4TH_DOUBLING) then if (mod(NEX_XI,8) /= 0) stop 'NEX_XI must be a multiple of 8' @@ -2392,8 +2392,8 @@ subroutine read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD endif tmp_sum = 0; do iter_layer = ifirst_region, ilast_region - nglob_int_surf_eta=0 - nglob_int_surf_xi=0 + nglob_int_surf_eta = 0 + nglob_int_surf_xi = 0 nglob_ext_surf = 0 nglob_center_edge = 0 nglob_corner_edge = 0 diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/recompute_jacobian.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/recompute_jacobian.f90 index 521ec43e2..8dbae89dc 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/recompute_jacobian.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/recompute_jacobian.f90 @@ -64,28 +64,28 @@ subroutine recompute_jacobian(xelm,yelm,zelm,xi,eta,gamma,x,y,z, & if (NGNOD /= 27) stop 'elements should have 27 control nodes' l1xi=HALF*xi*(xi-ONE) - l2xi=ONE-xi**2 + l2xi = ONE-xi**2 l3xi=HALF*xi*(xi+ONE) - l1pxi=xi-HALF + l1pxi = xi-HALF l2pxi=-TWO*xi - l3pxi=xi+HALF + l3pxi = xi+HALF l1eta=HALF*eta*(eta-ONE) - l2eta=ONE-eta**2 + l2eta = ONE-eta**2 l3eta=HALF*eta*(eta+ONE) - l1peta=eta-HALF + l1peta = eta-HALF l2peta=-TWO*eta - l3peta=eta+HALF + l3peta = eta+HALF l1gamma=HALF*gamma*(gamma-ONE) - l2gamma=ONE-gamma**2 + l2gamma = ONE-gamma**2 l3gamma=HALF*gamma*(gamma+ONE) - l1pgamma=gamma-HALF + l1pgamma = gamma-HALF l2pgamma=-TWO*gamma - l3pgamma=gamma+HALF + l3pgamma = gamma+HALF ! corner nodes @@ -218,33 +218,33 @@ subroutine recompute_jacobian(xelm,yelm,zelm,xi,eta,gamma,x,y,z, & dershape3D(3,27)=l2xi*l2eta*l2pgamma ! compute coordinates and jacobian matrix - x=ZERO - y=ZERO - z=ZERO - xxi=ZERO - xeta=ZERO - xgamma=ZERO - yxi=ZERO - yeta=ZERO - ygamma=ZERO - zxi=ZERO - zeta=ZERO - zgamma=ZERO - - do ia=1,NGNOD - x=x+shape3D(ia)*xelm(ia) - y=y+shape3D(ia)*yelm(ia) - z=z+shape3D(ia)*zelm(ia) - - xxi=xxi+dershape3D(1,ia)*xelm(ia) - xeta=xeta+dershape3D(2,ia)*xelm(ia) - xgamma=xgamma+dershape3D(3,ia)*xelm(ia) - yxi=yxi+dershape3D(1,ia)*yelm(ia) - yeta=yeta+dershape3D(2,ia)*yelm(ia) - ygamma=ygamma+dershape3D(3,ia)*yelm(ia) - zxi=zxi+dershape3D(1,ia)*zelm(ia) - zeta=zeta+dershape3D(2,ia)*zelm(ia) - zgamma=zgamma+dershape3D(3,ia)*zelm(ia) + x = ZERO + y = ZERO + z = ZERO + xxi = ZERO + xeta = ZERO + xgamma = ZERO + yxi = ZERO + yeta = ZERO + ygamma = ZERO + zxi = ZERO + zeta = ZERO + zgamma = ZERO + + do ia = 1,NGNOD + x = x+shape3D(ia)*xelm(ia) + y = y+shape3D(ia)*yelm(ia) + z = z+shape3D(ia)*zelm(ia) + + xxi = xxi+dershape3D(1,ia)*xelm(ia) + xeta = xeta+dershape3D(2,ia)*xelm(ia) + xgamma = xgamma+dershape3D(3,ia)*xelm(ia) + yxi = yxi+dershape3D(1,ia)*yelm(ia) + yeta = yeta+dershape3D(2,ia)*yelm(ia) + ygamma = ygamma+dershape3D(3,ia)*yelm(ia) + zxi = zxi+dershape3D(1,ia)*zelm(ia) + zeta = zeta+dershape3D(2,ia)*zelm(ia) + zgamma = zgamma+dershape3D(3,ia)*zelm(ia) enddo jacobian = xxi*(yeta*zgamma-ygamma*zeta) - xeta*(yxi*zgamma-ygamma*zxi) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/reduce.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/reduce.f90 index ccc862ede..3160cf2a9 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/reduce.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/reduce.f90 @@ -38,42 +38,42 @@ subroutine reduce(theta,phi) integer i double precision th,ph - th=theta - ph=phi - i=abs(int(ph/TWO_PI)) + th = theta + ph = phi + i = abs(int(ph/TWO_PI)) if (ph < ZERO) then ph=ph+(i+1)*TWO_PI else if (ph > TWO_PI) ph=ph-i*TWO_PI endif - phi=ph + phi = ph if (th < ZERO .or. th > PI) then i=int(th/PI) if (th > ZERO) then if (mod(i,2) /= 0) then th=(i+1)*PI-th if (ph < PI) then - ph=ph+PI + ph = ph+PI else - ph=ph-PI + ph = ph-PI endif else - th=th-i*PI + th = th-i*PI endif else if (mod(i,2) == 0) then th=-th+i*PI if (ph < PI) then - ph=ph+PI + ph = ph+PI else - ph=ph-PI + ph = ph-PI endif else - th=th-i*PI + th = th-i*PI endif endif - theta=th - phi=ph + theta = th + phi = ph endif if (theta < ZERO .or. theta > PI) stop 'theta out of range in reduce' diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/s362ani.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/s362ani.f90 index 56c3a4b6a..307da1636 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/s362ani.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/s362ani.f90 @@ -26,45 +26,45 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) real(kind=4) :: u,u2,ddep,radius2,radius,depth - ierror=0 + ierror = 0 lstr=len_trim(string) - radius=r0-depth - ddep=0.1 - radius2=r0-depth+ddep - upper=.false. - lower=.false. + radius = r0-depth + ddep = 0.1 + radius2 = r0-depth+ddep + upper = .false. + lower = .false. if (radius > rcmb .and. radius < r670) then - lower=.true. + lower = .true. else if (radius >= r670 .and. radius < rmoho) then - upper=.true. + upper = .true. endif - upper_650=.false. - lower_650=.false. + upper_650 = .false. + lower_650 = .false. if (radius > rcmb .and. radius < r650) then - lower_650=.true. + lower_650 = .true. else if (radius >= r650 .and. radius < rmoho) then - upper_650=.true. + upper_650 = .true. endif - do iker=1,nker + do iker = 1,nker vercof(iker)=0. dvercof(iker)=0. enddo if (string(1:16) == 'WDC+SPC_U4L8CHEB') then - nupper=5 - nlower=9 - nskip=2 + nupper = 5 + nlower = 9 + nskip = 2 if (upper) then u=(radius+radius-rmoho-r670)/(rmoho-r670) u2=(radius2+radius2-rmoho-r670)/(rmoho-r670) ! write(*,"('upper mantle:',2f10.3)") u,u2 call chebyfun(u,13,chebyshev) - do i=1+nskip,nskip+nupper + do i = 1+nskip,nskip+nupper vercof(i)=chebyshev(i-nskip) enddo call chebyfun(u2,13,chebyshev2) - do i=1+nskip,nskip+nupper + do i = 1+nskip,nskip+nupper dvercof(i)=(chebyshev2(i-nskip)-chebyshev(i-nskip))/ddep enddo else if (lower) then @@ -72,17 +72,17 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) u2=(radius2+radius2-r670-rcmb)/(r670-rcmb) ! write(*,"('lower mantle:',2f10.3)") u,u2 call chebyfun(u,13,chebyshev) - do i=1+nskip+nupper,nskip+nupper+nlower + do i = 1+nskip+nupper,nskip+nupper+nlower vercof(i)=chebyshev(i-nskip-nupper) enddo call chebyfun(u2,13,chebyshev2) - do i=1+nskip+nupper,nskip+nupper+nlower + do i = 1+nskip+nupper,nskip+nupper+nlower dvercof(i)=(chebyshev2(i-nskip-nupper)- & chebyshev(i-nskip-nupper))/ddep enddo endif else if (string(1:13) == 'WDC+SHSVWM20A') then - nspl=20 + nspl = 20 splpts(1)=0. splpts(2)=50. splpts(3)=100. @@ -104,14 +104,14 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(19)=2700. splpts(20)=2891. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=22,27 + do i = 22,27 vercof(i)=vercof(i-20) dvercof(i)=dvercof(i-20) enddo vercof(1)=1. else if (string(1:16) == 'WDC+XBS_362_U6L8') then if (upper) then - nspl=6 + nspl = 6 splpts(1)=24.4 splpts(2)=100. splpts(3)=225. @@ -120,7 +120,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(6)=670. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) else if (lower) then - nspl=8 + nspl = 8 splpts(1)=670. splpts(2)=820. splpts(3)=1320. @@ -171,7 +171,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) (string(1:lstr) == 'WDC+ANI_362_U6L8_TOPO' .and. lstr == 21) & ) then if (upper) then - nspl=6 + nspl = 6 splpts(1)=24.4 splpts(2)=100. splpts(3)=225. @@ -179,12 +179,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(5)=500. splpts(6)=670. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=16,21 + do i = 16,21 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo else if (lower) then - nspl=8 + nspl = 8 splpts(1)=670. splpts(2)=820. splpts(3)=1320. @@ -200,7 +200,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) vercof(23)=1. else if (string(1:lstr) == 'WDC+WM_362_U6L8' .and. lstr == 15) then if (upper) then - nspl=6 + nspl = 6 splpts(1)=24.4 splpts(2)=100. splpts(3)=225. @@ -208,12 +208,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(5)=500. splpts(6)=670. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=16,21 + do i = 16,21 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo else if (lower) then - nspl=8 + nspl = 8 splpts(1)=670. splpts(2)=820. splpts(3)=1320. @@ -223,7 +223,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(8),dvercof(8)) - do i=22,29 + do i = 22,29 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo @@ -238,7 +238,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) (string(1:lstr) == 'WDC+ANI_362_U6L8_TOPO_650' .and. lstr == 25) & ) then if (upper_650) then - nspl=6 + nspl = 6 splpts(1)=24.4 splpts(2)=100. splpts(3)=225. @@ -246,12 +246,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(5)=500. splpts(6)=650. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=16,21 + do i = 16,21 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -268,7 +268,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) else if (string(1:lstr) == 'WDC+WM_362_U6L8_650' & .and.lstr == 19) then if (upper_650) then - nspl=6 + nspl = 6 splpts(1)=24.4 splpts(2)=100. splpts(3)=225. @@ -276,12 +276,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(5)=500. splpts(6)=650. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=16,21 + do i = 16,21 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -291,7 +291,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(8),dvercof(8)) - do i=22,29 + do i = 22,29 vercof(i)=vercof(i-14) dvercof(i)=dvercof(i-14) enddo @@ -302,7 +302,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) vercof(32)=1. else if (string(1:lstr) == 'WDC+U8L8_650' .and. lstr == 12) then if (upper_650) then - nspl=8 + nspl = 8 splpts(1)=24.4 splpts(2)=75. splpts(3)=150. @@ -312,12 +312,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=530. splpts(8)=650. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=18,25 + do i = 18,25 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -327,7 +327,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(10),dvercof(10)) - do i=26,33 + do i = 26,33 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo @@ -338,7 +338,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) vercof(36)=1. else if (string(1:lstr) == 'WDC+U8L8_670' .and. lstr == 12) then if (upper) then - nspl=8 + nspl = 8 splpts(1)=24.4 splpts(2)=75. splpts(3)=150. @@ -348,12 +348,12 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=530. splpts(8)=670. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=18,25 + do i = 18,25 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo else if (lower) then - nspl=8 + nspl = 8 splpts(1)=670. splpts(2)=820. splpts(3)=1320. @@ -363,7 +363,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(10),dvercof(10)) - do i=26,33 + do i = 26,33 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo @@ -378,7 +378,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) (string(1:lstr) == 'WDC+U8L8_I3D_650' .and. lstr == 16) & ) then if (upper_650) then - nspl=8 + nspl = 8 splpts(1)=24.4 splpts(2)=75. splpts(3)=150. @@ -388,28 +388,28 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=530. splpts(8)=650. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=18,25 + do i = 18,25 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo - do i=37,40 + do i = 37,40 vercof(i)=vercof(i-35) dvercof(i)=dvercof(i-35) enddo - do i=41,44 + do i = 41,44 vercof(i)=vercof(i-39) dvercof(i)=dvercof(i-39) enddo - do i=45,48 + do i = 45,48 vercof(i)=vercof(i-43) dvercof(i)=dvercof(i-43) enddo - do i=49,52 + do i = 49,52 vercof(i)=vercof(i-47) dvercof(i)=dvercof(i-47) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -419,7 +419,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(10),dvercof(10)) - do i=26,33 + do i = 26,33 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo @@ -431,7 +431,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) else if ((string(1:lstr) == 'WDC+I1D_650' .and. lstr == 11) .or. & (string(1:lstr) == 'WDC+I3D_650' .and. lstr == 11)) then if (upper_650) then - nspl=8 + nspl = 8 splpts(1)=24.4 splpts(2)=75. splpts(3)=150. @@ -441,28 +441,28 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=530. splpts(8)=650. call vbspl(depth,nspl,splpts,vercof(2),dvercof(2)) - do i=18,25 + do i = 18,25 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo - do i=37,44 + do i = 37,44 vercof(i)=vercof(i-35) dvercof(i)=dvercof(i-35) enddo - do i=53,60 + do i = 53,60 vercof(i)=vercof(i-51) dvercof(i)=dvercof(i-51) enddo - do i=69,76 + do i = 69,76 vercof(i)=vercof(i-67) dvercof(i)=dvercof(i-67) enddo - do i=85,92 + do i = 85,92 vercof(i)=vercof(i-83) dvercof(i)=dvercof(i-83) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -472,23 +472,23 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=2791. splpts(8)=2891. call vbspl(depth,nspl,splpts,vercof(10),dvercof(10)) - do i=26,33 + do i = 26,33 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo - do i=45,52 + do i = 45,52 vercof(i)=vercof(i-35) dvercof(i)=dvercof(i-35) enddo - do i=61,68 + do i = 61,68 vercof(i)=vercof(i-51) dvercof(i)=dvercof(i-51) enddo - do i=77,84 + do i = 77,84 vercof(i)=vercof(i-67) dvercof(i)=dvercof(i-67) enddo - do i=93,100 + do i = 93,100 vercof(i)=vercof(i-83) dvercof(i)=dvercof(i-83) enddo @@ -499,7 +499,7 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) vercof(36)=1. else if (string(1:lstr) == 'V16A4_V7A4' .and. lstr == 10) then if (upper_650) then - nspl=8 + nspl = 8 splpts(1)=24.4 splpts(2)=75. splpts(3)=150. @@ -509,20 +509,20 @@ subroutine evradker(depth,string,nker,vercof,dvercof,ierror) splpts(7)=530. splpts(8)=650. call vbspl(depth,nspl,splpts,vercof(1),dvercof(1)) - do i=17,20 + do i = 17,20 vercof(i)=vercof(i-16) dvercof(i)=dvercof(i-16) enddo - do i=23,29 + do i = 23,29 vercof(i)=vercof(i-22) dvercof(i)=dvercof(i-22) enddo - do i=30,33 + do i = 30,33 vercof(i)=vercof(i-29) dvercof(i)=dvercof(i-29) enddo else if (lower_650) then - nspl=8 + nspl = 8 splpts(1)=650. splpts(2)=820. splpts(3)=1320. @@ -570,13 +570,13 @@ subroutine chebyfun(u,kmax,f) f(0)=1.0 f(1)=u - twou=2.0*u + twou = 2.0*u - do k=2,kmax + do k = 2,kmax f(k) = twou*f(k-1)-f(k-2) enddo - do k=0,kmax + do k = 0,kmax f(k)=f(k)*chebycoeff(k) enddo @@ -593,9 +593,9 @@ subroutine gt3dmodl(lu,targetfile, & implicit none - integer, parameter :: mxhpar=2 - integer, parameter :: mxkern=200 - integer, parameter :: mxcoef=2000 + integer, parameter :: mxhpar = 2 + integer, parameter :: mxkern = 200 + integer, parameter :: mxcoef = 2000 character(len=80) refmodel character(len=80) kernstri @@ -638,7 +638,7 @@ subroutine gt3dmodl(lu,targetfile, & integer numvar,ierror,lu,nhorpar,nmodkern,i,j,lstr,k - ierror=0 + ierror = 0 call rd3dmodl(lu,targetfile,ierror, & nmodkern,nhorpar,ityphpar, & ihorpar,lmaxhor,ncoefhor, & @@ -646,21 +646,21 @@ subroutine gt3dmodl(lu,targetfile, & hsplfile,refmodel,kernstri,desckern) if (nhorpar <= maxhpa) then - numhpa=nhorpar + numhpa = nhorpar else - ierror=ierror+1 + ierror = ierror+1 endif if (nmodkern <= maxker) then - numker=nmodkern + numker = nmodkern else - ierror=ierror+1 + ierror = ierror+1 endif - do i=1,nmodkern + do i = 1,nmodkern ihpakern(i)=ihorpar(i) dskker(i)=desckern(i) - do j=1,ncoefhor(ihpakern(i)) + do j = 1,ncoefhor(ihpakern(i)) coe(j,i)=coef(j,i) ! if (j == 1) then ! write(*,"(e12.4)") coe(j,i) @@ -668,12 +668,12 @@ subroutine gt3dmodl(lu,targetfile, & enddo enddo - do i=1,nhorpar + do i = 1,nhorpar numcoe(i)=ncoefhor(i) lmxhpa(i)=lmaxhor(i) itypehpa(i)=ityphpar(i) if (itypehpa(i) == 2) then - do j=1,ncoefhor(i) + do j = 1,ncoefhor(i) itpspl(j,i)=ixlspl(j,i) xlatspl(j,i)=xlaspl(j,i) xlonspl(j,i)=xlospl(j,i) @@ -683,29 +683,29 @@ subroutine gt3dmodl(lu,targetfile, & hsplfl(i)=hsplfile(i) enddo - numvar=0 - do i=1,nmodkern + numvar = 0 + do i = 1,nmodkern string=dskker(i) lstr=len_trim(string) - j=1 + j = 1 do while(string(j:j) /= ',' .and. j < lstr) - j=j+1 + j = j+1 enddo ivarkern(i)=0 - do k=1,numvar + do k = 1,numvar if (string(1:j) == varstr(k)(1:j)) then ivarkern(i)=k endif enddo if (ivarkern(i) == 0) then - numvar=numvar+1 + numvar = numvar+1 varstr(numvar)=string(1:j) ivarkern(i)=numvar endif enddo - refmdl=refmodel - kerstr=kernstri + refmdl = refmodel + kerstr = kernstri end subroutine gt3dmodl @@ -718,9 +718,9 @@ subroutine rd3dmodl(lu,filename,ierror, & implicit none - integer, parameter :: mxhpar=2 - integer, parameter :: mxkern=200 - integer, parameter :: mxcoef=2000 + integer, parameter :: mxhpar = 2 + integer, parameter :: mxkern = 200 + integer, parameter :: mxcoef = 2000 character(len=80) refmodel character(len=80) kernstri @@ -757,10 +757,10 @@ subroutine rd3dmodl(lu,filename,ierror, & if (ios == 0) then if (string(1:16) == 'REFERENCE MODEL:') then substr=string(17:lstr) - ifst=1 + ifst = 1 ilst=len_trim(substr) do while (substr(ifst:ifst) == ' ' .and. ifst < ilst) - ifst=ifst+1 + ifst = ifst+1 enddo if (ilst-ifst <= 0) then stop 'error reading model 1' @@ -768,11 +768,11 @@ subroutine rd3dmodl(lu,filename,ierror, & refmodel=substr(ifst:ilst) endif else if (string(1:11) == 'KERNEL SET:') then - substr=string(12:len_trim(string)) - ifst=1 + substr = string(12:len_trim(string)) + ifst = 1 ilst=len_trim(substr) do while (substr(ifst:ifst) == ' ' .and. ifst < ilst) - ifst=ifst+1 + ifst = ifst+1 enddo if (ilst-ifst <= 0) then stop 'error reading model 2' @@ -780,18 +780,18 @@ subroutine rd3dmodl(lu,filename,ierror, & kernstri=substr(ifst:ilst) endif else if (string(1:25) == 'RADIAL STRUCTURE KERNELS:') then - substr=string(26:len_trim(string)) + substr = string(26:len_trim(string)) read(substr,*,iostat=ierror) nmodkern if (ierror /= 0) then stop 'error reading model 3' endif else if (string(1:4) == 'DESC' .and. string(9:9) == ':') then read(string(5:8),"(i4)") idummy - substr=string(10:len_trim(string)) - ifst=1 + substr = string(10:len_trim(string)) + ifst = 1 ilst=len_trim(substr) do while (substr(ifst:ifst) == ' ' .and. ifst < ilst) - ifst=ifst+1 + ifst = ifst+1 enddo if (ilst-ifst <= 0) then stop 'error reading model 4' @@ -799,50 +799,50 @@ subroutine rd3dmodl(lu,filename,ierror, & desckern(idummy)=substr(ifst:ilst) endif else if (string(1:29) == 'HORIZONTAL PARAMETERIZATIONS:') then - substr=string(30:len_trim(string)) + substr = string(30:len_trim(string)) read(substr,*,iostat=ierror) nhorpar if (ierror /= 0) then stop 'error reading model 5' endif else if (string(1:4) == 'HPAR' .and. string(9:9) == ':') then read(string(5:8),"(i4)") idummy - ifst=10 + ifst = 10 ilst=len_trim(string) do while (string(ifst:ifst) == ' ' .and. ifst < ilst) - ifst=ifst+1 + ifst = ifst+1 enddo if (ilst-ifst <= 0) then stop 'error reading model 6' else if (string(ifst:ifst+19) == 'SPHERICAL HARMONICS,') then - substr=string(20+ifst:len_trim(string)) + substr = string(20+ifst:len_trim(string)) read(substr,*) lmax ityphpar(idummy)=1 lmaxhor(idummy)=lmax ncoefhor(idummy)=(lmax+1)**2 else if (string(ifst:ifst+17) == 'SPHERICAL SPLINES,') then - ifst1=ifst+18 + ifst1 = ifst+18 ifst=len_trim(string) ilst=len_trim(string) do while(string(ifst:ifst) /= ',') - ifst=ifst-1 + ifst = ifst-1 enddo read(string(ifst+1:ilst),*) ncoef substr=string(ifst1:ifst-1) do while (string(ifst1:ifst1) == ' ' .and. ifst1 < ifst) - ifst1=ifst1+1 + ifst1 = ifst1+1 enddo hsplfile(idummy)=string(ifst1:ifst-1) ityphpar(idummy)=2 lmaxhor(idummy)=0 ncoefhor(idummy)=ncoef - do i=1,ncoef + do i = 1,ncoef read(lu,*) ixlspl(i,idummy),xlaspl(i,idummy), & xlospl(i,idummy),xraspl(i,idummy) enddo endif else if (string(1:4) == 'STRU' .and. string(9:9) == ':') then read(string(5:8),"(i4)") idummy - substr=string(10:len_trim(string)) + substr = string(10:len_trim(string)) read(substr,*) ihor ihorpar(idummy)=ihor ncoef=ncoefhor(ihor) @@ -873,11 +873,11 @@ subroutine read_model_s362ani(THREE_D_MODEL, & integer numvar integer ierror - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa @@ -902,7 +902,7 @@ subroutine read_model_s362ani(THREE_D_MODEL, & ! ------------------------------------- - lu=1 ! --- log unit: input 3-D model + lu = 1 ! --- log unit: input 3-D model if (THREE_D_MODEL == THREE_D_MODEL_S362ANI) then modeldef='DATA/s362ani/S362ANI' else if (THREE_D_MODEL == THREE_D_MODEL_S362WMANI) then @@ -930,7 +930,7 @@ subroutine read_model_s362ani(THREE_D_MODEL, & ! --- check arrays if (numker > maxker) stop 'numker > maxker' - do ihpa=1,numhpa + do ihpa = 1,numhpa if (itypehpa(ihpa) == 1) then if (lmxhpa(ihpa) > maxl) stop 'lmxhpa(ihpa) > maxl' else if (itypehpa(ihpa) == 2) then @@ -965,24 +965,24 @@ subroutine splcon(xlat,xlon,nver,verlat,verlon,verrad,ncon,icon,con) real(kind=4) :: xlat,xlon - xrad=3.14159265358979/180.d0 + xrad = 3.14159265358979/180.d0 - ncon=0 + ncon = 0 - do iver=1,nver + do iver = 1,nver if (xlat > verlat(iver)-2.*verrad(iver)) then if (xlat < verlat(iver)+2.*verrad(iver)) then - ver8=xrad*(verlat(iver)) + ver8 = xrad*(verlat(iver)) xla8=xrad*(xlat) - dd=sin(ver8)*sin(xla8) - dd=dd+cos(ver8)*cos(xla8)* cos(xrad*(xlon-verlon(iver))) + dd = sin(ver8)*sin(xla8) + dd = dd+cos(ver8)*cos(xla8)* cos(xrad*(xlon-verlon(iver))) dd=acos(dd)/xrad if (dd > (verrad(iver))*2.d0) then else - ncon=ncon+1 + ncon = ncon+1 icon(ncon)=iver - rn=dd/(verrad(iver)) - dr=rn-1.d0 + rn = dd/(verrad(iver)) + dr = rn-1.d0 if (rn <= 1.d0) then con(ncon)=(0.75d0*rn-1.5d0)*(rn**2)+1.d0 else if (rn > 1.d0) then @@ -1008,11 +1008,11 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & implicit none - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof @@ -1066,19 +1066,19 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & ! ------------------------------------- - depth=6371.0-xrad + depth = 6371.0-xrad call evradker (depth,kerstr,numker,vercof,vercofd,ierror) if (ierror /= 0) stop 'ierror evradker' ! --- loop over sv and sh (sv=0,sh=1) - do ish=0,1 + do ish = 0,1 ! --- contributing horizontal basis functions at xlat,xlon - y=90.0-xcolat - x=xlon - do ihpa=1,numhpa + y = 90.0-xcolat + x = xlon + do ihpa = 1,numhpa if (itypehpa(ihpa) == 1) then lmax=lmxhpa(ihpa) call ylm(y,x,lmax,ylmcof(1,ihpa),wk1,wk2,wk3) @@ -1097,23 +1097,23 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & valu(1)=0. ! --- velocity valu(2)=0. ! --- anisotropy - do ieval=1,2 - value=0. - do iker=1,numker - isel=0 - lstr=len_trim(varstr(ivarkern(iker))) + do ieval = 1,2 + value = 0. + do iker = 1,numker + isel = 0 + lstr = len_trim(varstr(ivarkern(iker))) vstr=(varstr(ivarkern(iker))) if (ieval == 1) then if (vstr(1:lstr) == 'UM (SH+SV)*0.5,' .or. & vstr(1:lstr) == 'LM (SH+SV)*0.5,' .or. & vstr(1:lstr) == 'EA (SH+SV)*0.5,') then - isel=1 + isel = 1 endif else if (ieval == 2) then if (vstr(1:lstr) == 'UM SH-SV,' .or. & vstr(1:lstr) == 'LM SH-SV,' .or. & vstr(1:lstr) == 'EA SH-SV,') then - isel=1 + isel = 1 endif endif @@ -1122,15 +1122,15 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & if (itypehpa(ihpakern(iker)) == 1) then ihpa=ihpakern(iker) nylm=(lmxhpa(ihpakern(iker))+1)**2 - do i=1,nylm - value=value+vercof(iker)*ylmcof(i,ihpa) & + do i = 1,nylm + value = value+vercof(iker)*ylmcof(i,ihpa) & *coe(i,iker) enddo else if (itypehpa(ihpakern(iker)) == 2) then ihpa=ihpakern(iker) - do i=1,nconpt(ihpa) + do i = 1,nconpt(ihpa) iver=iconpt(i,ihpa) - value=value+vercof(iker)*conpt(i,ihpa) & + value = value+vercof(iker)*conpt(i,ihpa) & *coe(iver,iker) enddo else @@ -1139,7 +1139,7 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & endif ! --- itypehpa endif ! --- vercof(iker) /= 0. endif ! --- isel == 1 - enddo ! --- end of do iker=1,numker + enddo ! --- end of do iker = 1,numker valu(ieval)=value enddo ! --- ieval @@ -1147,9 +1147,9 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & ! --- evaluate perturbations in vsh and vsv if (ish == 1) then - vsh3drel=valu(1)+0.5*valu(2) + vsh3drel = valu(1)+0.5*valu(2) else if (ish == 0) then - vsv3drel=valu(1)-0.5*valu(2) + vsv3drel = valu(1)-0.5*valu(2) else stop 'something wrong' endif @@ -1158,10 +1158,10 @@ subroutine subshsv(xcolat,xlon,xrad,dvsh,dvsv,dvph,dvpv, & ! --- evaluate perturbations in per cent - dvsh=vsh3drel - dvsv=vsv3drel - dvph=0.55*dvsh ! --- scaling used in the inversion - dvpv=0.55*dvsv ! --- scaling used in the inversion + dvsh = vsh3drel + dvsv = vsv3drel + dvph = 0.55*dvsh ! --- scaling used in the inversion + dvpv = 0.55*dvsv ! --- scaling used in the inversion end subroutine subshsv @@ -1176,11 +1176,11 @@ subroutine subtopo(xcolat,xlon,topo410,topo650, & implicit none - integer, parameter :: maxker=200 - integer, parameter :: maxl=72 - integer, parameter :: maxcoe=2000 - integer, parameter :: maxver=1000 - integer, parameter :: maxhpa=2 + integer, parameter :: maxker = 200 + integer, parameter :: maxl = 72 + integer, parameter :: maxcoe = 2000 + integer, parameter :: maxver = 1000 + integer, parameter :: maxhpa = 2 integer numker integer numhpa,numcof @@ -1227,9 +1227,9 @@ subroutine subtopo(xcolat,xlon,topo410,topo650, & ! --- contributing horizontal basis functions at xlat,xlon - y=90.0-xcolat - x=xlon - do ihpa=1,numhpa + y = 90.0-xcolat + x = xlon + do ihpa = 1,numhpa if (itypehpa(ihpa) == 1) then lmax=lmxhpa(ihpa) call ylm(y,x,lmax,ylmcof(1,ihpa),wk1,wk2,wk3) @@ -1248,19 +1248,19 @@ subroutine subtopo(xcolat,xlon,topo410,topo650, & valu(1)=0. ! --- 410 valu(2)=0. ! --- 650 - do ieval=1,2 - value=0. - do iker=1,numker - isel=0 - lstr=len_trim(varstr(ivarkern(iker))) + do ieval = 1,2 + value = 0. + do iker = 1,numker + isel = 0 + lstr = len_trim(varstr(ivarkern(iker))) vstr=(varstr(ivarkern(iker))) if (ieval == 1) then if (vstr(1:lstr) == 'Topo 400,') then - isel=1 + isel = 1 endif else if (ieval == 2) then if (vstr(1:lstr) == 'Topo 670,') then - isel=1 + isel = 1 endif endif @@ -1268,21 +1268,21 @@ subroutine subtopo(xcolat,xlon,topo410,topo650, & if (itypehpa(ihpakern(iker)) == 1) then ihpa=ihpakern(iker) nylm=(lmxhpa(ihpakern(iker))+1)**2 - do i=1,nylm - value=value+ylmcof(i,ihpa)*coe(i,iker) + do i = 1,nylm + value = value+ylmcof(i,ihpa)*coe(i,iker) enddo else if (itypehpa(ihpakern(iker)) == 2) then ihpa=ihpakern(iker) - do i=1,nconpt(ihpa) + do i = 1,nconpt(ihpa) iver=iconpt(i,ihpa) - value=value+conpt(i,ihpa)*coe(iver,iker) + value = value+conpt(i,ihpa)*coe(iver,iker) enddo else write(*,"('problem 2')") stop endif ! --- itypehpa endif ! --- isel == 1 - enddo ! --- end of do iker=1,numker + enddo ! --- end of do iker = 1,numker valu(ieval)=value enddo ! --- ieval @@ -1316,18 +1316,18 @@ subroutine vbspl(x,np,xarr,splcon,splcond) !---- iflag=1 = => > second derivative is 0 at end points !---- iflag=0 = => > first derivative is 0 at end points ! - iflag=1 + iflag = 1 ! !---- first, find out within which interval x falls ! - interval=0 - ik=1 + interval = 0 + ik = 1 do while(interval == 0 .and. ik < np) - ik=ik+1 + ik = ik+1 if (x >= xarr(ik-1) .and. x <= xarr(ik)) interval=ik-1 enddo if (x > xarr(np)) then - interval=np + interval = np endif if (interval == 0) then @@ -1338,9 +1338,9 @@ subroutine vbspl(x,np,xarr,splcon,splcond) ! write(*,"('high value:',2f10.3)") xarr(np),x endif - do ib=1,np - val=0. - vald=0. + do ib = 1,np + val = 0. + vald = 0. if (ib == 1) then r1=(x-xarr(1))/(xarr(2)-xarr(1)) @@ -1353,42 +1353,42 @@ subroutine vbspl(x,np,xarr,splcon,splcond) r12=(xarr(3)-x)/(xarr(3)-xarr(2)) r13=(xarr(2)-x)/(xarr(2)-xarr(1)) - r1d=1./(xarr(2)-xarr(1)) + r1d = 1./(xarr(2)-xarr(1)) r2d=-1./(xarr(3)-xarr(1)) r4d=-1./(xarr(2)-xarr(1)) - r5d=1./(xarr(2)-xarr(1)) + r5d = 1./(xarr(2)-xarr(1)) r6d=-1./(xarr(3)-xarr(1)) r10d=-1./(xarr(2)-xarr(1)) - r11d=1./(xarr(2)-xarr(1)) + r11d = 1./(xarr(2)-xarr(1)) r12d=-1./(xarr(3)-xarr(2)) r13d=-1./(xarr(2)-xarr(1)) if (interval == ib .or. interval == 0) then if (iflag == 0) then - val=r1*r4*r10 + r2*r5*r10 + r2*r6*r11 +r13**3 - vald=r1d*r4*r10+r1*r4d*r10+r1*r4*r10d - vald=vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d - vald=vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d - vald=vald+3.*r13d*r13**2 + val = r1*r4*r10 + r2*r5*r10 + r2*r6*r11 +r13**3 + vald = r1d*r4*r10+r1*r4d*r10+r1*r4*r10d + vald = vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d + vald = vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d + vald = vald+3.*r13d*r13**2 else if (iflag == 1) then - val=0.6667*(r1*r4*r10 + r2*r5*r10 + r2*r6*r11 & + val = 0.6667*(r1*r4*r10 + r2*r5*r10 + r2*r6*r11 & + 1.5*r13**3) - vald=r1d*r4*r10+r1*r4d*r10+r1*r4*r10d - vald=vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d - vald=vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d - vald=vald+4.5*r13d*r13**2 - vald=0.6667*vald + vald = r1d*r4*r10+r1*r4d*r10+r1*r4*r10d + vald = vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d + vald = vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d + vald = vald+4.5*r13d*r13**2 + vald = 0.6667*vald endif else if (interval == ib+1) then if (iflag == 0) then - val=r2*r6*r12 - vald=r2d*r6*r12+r2*r6d*r12+r2*r6*r12d + val = r2*r6*r12 + vald = r2d*r6*r12+r2*r6d*r12+r2*r6*r12d else if (iflag == 1) then - val=0.6667*r2*r6*r12 + val = 0.6667*r2*r6*r12 vald=0.6667*(r2d*r6*r12+r2*r6d*r12+r2*r6*r12d) endif else - val=0. + val = 0. endif else if (ib == 2) then @@ -1402,13 +1402,13 @@ subroutine vbspl(x,np,xarr,splcon,splcond) rr11=(x-xarr(1)) /(xarr(2)-xarr(1)) rr12=(xarr(3)-x)/(xarr(3)-xarr(2)) - rr1d=1./(xarr(2)-xarr(1)) + rr1d = 1./(xarr(2)-xarr(1)) rr2d=-1./(xarr(3)-xarr(1)) rr4d=-1./(xarr(2)-xarr(1)) - rr5d=1./(xarr(2)-xarr(1)) + rr5d = 1./(xarr(2)-xarr(1)) rr6d=-1./(xarr(3)-xarr(1)) rr10d=-1./(xarr(2)-xarr(1)) - rr11d=1./(xarr(2)-xarr(1)) + rr11d = 1./(xarr(2)-xarr(1)) rr12d=-1./(xarr(3)-xarr(2)) r1=(x-xarr(ib-1))/(xarr(ib+1)-xarr(ib-1)) @@ -1423,48 +1423,48 @@ subroutine vbspl(x,np,xarr,splcon,splcond) r11=(x-xarr(ib)) /(xarr(ib+1)-xarr(ib)) r12=(xarr(ib+2)-x)/(xarr(ib+2)-xarr(ib+1)) - r1d=1./(xarr(ib+1)-xarr(ib-1)) + r1d = 1./(xarr(ib+1)-xarr(ib-1)) r2d=-1./(xarr(ib+2)-xarr(ib-1)) - r3d=1./(xarr(ib)-xarr(ib-1)) + r3d = 1./(xarr(ib)-xarr(ib-1)) r4d=-1./(xarr(ib+1)-xarr(ib-1)) - r5d=1./(xarr(ib+1)-xarr(ib-1)) + r5d = 1./(xarr(ib+1)-xarr(ib-1)) r6d=-1./(xarr(ib+2)-xarr(ib)) r8d=-1./ (xarr(ib)-xarr(ib-1)) - r9d=1./(xarr(ib)-xarr(ib-1)) + r9d = 1./(xarr(ib)-xarr(ib-1)) r10d=-1./(xarr(ib+1)-xarr(ib)) - r11d=1./(xarr(ib+1)-xarr(ib)) + r11d = 1./(xarr(ib+1)-xarr(ib)) r12d=-1./(xarr(ib+2)-xarr(ib+1)) if (interval == ib-1 .or. interval == 0) then - val=r1*r3*r8 + r1*r4*r9 + r2*r5*r9 - vald=r1d*r3*r8+r1*r3d*r8+r1*r3*r8d - vald=vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d - vald=vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d + val = r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + vald = r1d*r3*r8+r1*r3d*r8+r1*r3*r8d + vald = vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d + vald = vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d if (iflag == 1) then - val=val+0.3333*(rr1*rr4*rr10 + rr2*rr5*rr10 + & + val = val+0.3333*(rr1*rr4*rr10 + rr2*rr5*rr10 + & rr2*rr6*rr11) - vald=vald+0.3333*(rr1d*rr4*rr10+rr1*rr4d*rr10+ & + vald = vald+0.3333*(rr1d*rr4*rr10+rr1*rr4d*rr10+ & rr1*rr4*rr10d) - vald=vald+0.3333*(rr2d*rr5*rr10+rr2*rr5d*rr10+ & + vald = vald+0.3333*(rr2d*rr5*rr10+rr2*rr5d*rr10+ & rr2*rr5*rr10d) - vald=vald+0.3333*(rr2d*rr6*rr11+rr2*rr6d*rr11+ & + vald = vald+0.3333*(rr2d*rr6*rr11+rr2*rr6d*rr11+ & rr2*rr6*rr11d) endif else if (interval == ib) then - val=r1*r4*r10 + r2*r5*r10 + r2*r6*r11 - vald=r1d*r4*r10+r1*r4d*r10+r1*r4*r10d - vald=vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d - vald=vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d + val = r1*r4*r10 + r2*r5*r10 + r2*r6*r11 + vald = r1d*r4*r10+r1*r4d*r10+r1*r4*r10d + vald = vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d + vald = vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d if (iflag == 1) then - val=val+0.3333*rr2*rr6*rr12 - vald=vald+0.3333*(rr2d*rr6*rr12+rr2*rr6d*rr12+ & + val = val+0.3333*rr2*rr6*rr12 + vald = vald+0.3333*(rr2d*rr6*rr12+rr2*rr6d*rr12+ & rr2*rr6*rr12d) endif else if (interval == ib+1) then - val=r2*r6*r12 - vald=r2d*r6*r12+r2*r6d*r12+r2*r6*r12d + val = r2*r6*r12 + vald = r2d*r6*r12+r2*r6d*r12+r2*r6*r12d else - val=0. + val = 0. endif else if (ib == np-1) then @@ -1477,14 +1477,14 @@ subroutine vbspl(x,np,xarr,splcon,splcond) rr8=(xarr(np)-x)/ (xarr(np)-xarr(np-1)) rr9=(x-xarr(np-1))/(xarr(np)-xarr(np-1)) - rr1d=1./(xarr(np)-xarr(np-2)) + rr1d = 1./(xarr(np)-xarr(np-2)) rr2d=-1./(xarr(np)-xarr(np-1)) - rr3d=1./(xarr(np)-xarr(np-2)) + rr3d = 1./(xarr(np)-xarr(np-2)) rr4d=-1./(xarr(np)-xarr(np-1)) - rr5d=1./(xarr(np)-xarr(np-1)) - rr7d=1./(xarr(np-1)-xarr(np-2)) + rr5d = 1./(xarr(np)-xarr(np-1)) + rr7d = 1./(xarr(np-1)-xarr(np-2)) rr8d=-1./ (xarr(np)-xarr(np-1)) - rr9d=1./(xarr(np)-xarr(np-1)) + rr9d = 1./(xarr(np)-xarr(np-1)) r1=(x-xarr(ib-2))/(xarr(ib+1)-xarr(ib-2)) r2=(xarr(ib+1)-x)/(xarr(ib+1)-xarr(ib-1)) @@ -1498,48 +1498,48 @@ subroutine vbspl(x,np,xarr,splcon,splcond) r10=(xarr(ib+1)-x)/(xarr(ib+1)-xarr(ib)) r11=(x-xarr(ib)) /(xarr(ib+1)-xarr(ib)) - r1d=1./(xarr(ib+1)-xarr(ib-2)) + r1d = 1./(xarr(ib+1)-xarr(ib-2)) r2d=-1./(xarr(ib+1)-xarr(ib-1)) - r3d=1./(xarr(ib)-xarr(ib-2)) + r3d = 1./(xarr(ib)-xarr(ib-2)) r4d=-1./(xarr(ib+1)-xarr(ib-1)) - r5d=1./(xarr(ib+1)-xarr(ib-1)) + r5d = 1./(xarr(ib+1)-xarr(ib-1)) r6d=-1./(xarr(ib+1)-xarr(ib)) - r7d=1./(xarr(ib-1)-xarr(ib-2)) + r7d = 1./(xarr(ib-1)-xarr(ib-2)) r8d=-1./(xarr(ib)-xarr(ib-1)) - r9d=1./(xarr(ib)-xarr(ib-1)) + r9d = 1./(xarr(ib)-xarr(ib-1)) r10d=-1./(xarr(ib+1)-xarr(ib)) - r11d=1./(xarr(ib+1)-xarr(ib)) + r11d = 1./(xarr(ib+1)-xarr(ib)) if (interval == ib-2) then - val=r1*r3*r7 - vald=r1d*r3*r7+r1*r3d*r7+r1*r3*r7d + val = r1*r3*r7 + vald = r1d*r3*r7+r1*r3d*r7+r1*r3*r7d else if (interval == ib-1) then - val=r1*r3*r8 + r1*r4*r9 + r2*r5*r9 - vald=r1d*r3*r8+r1*r3d*r8+r1*r3*r8d - vald=vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d - vald=vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d + val = r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + vald = r1d*r3*r8+r1*r3d*r8+r1*r3*r8d + vald = vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d + vald = vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d if (iflag == 1) then - val=val+0.3333*rr1*rr3*rr7 - vald=vald+0.3333*(rr1d*rr3*rr7+rr1*rr3d*rr7+ & + val = val+0.3333*rr1*rr3*rr7 + vald = vald+0.3333*(rr1d*rr3*rr7+rr1*rr3d*rr7+ & rr1*rr3*rr7d) endif else if (interval == ib .or. interval == np) then - val=r1*r4*r10 + r2*r5*r10 + r2*r6*r11 - vald=r1d*r4*r10+r1*r4d*r10+r1*r4*r10d - vald=vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d - vald=vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d + val = r1*r4*r10 + r2*r5*r10 + r2*r6*r11 + vald = r1d*r4*r10+r1*r4d*r10+r1*r4*r10d + vald = vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d + vald = vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d if (iflag == 1) then - val=val+0.3333*(rr1*rr3*rr8 + rr1*rr4*rr9 + & + val = val+0.3333*(rr1*rr3*rr8 + rr1*rr4*rr9 + & rr2*rr5*rr9) - vald=vald+0.3333*(rr1d*rr3*rr8+rr1*rr3d*rr8+ & + vald = vald+0.3333*(rr1d*rr3*rr8+rr1*rr3d*rr8+ & rr1*rr3*rr8d) - vald=vald+0.3333*(rr1d*rr4*rr9+rr1*rr4d*rr9+ & + vald = vald+0.3333*(rr1d*rr4*rr9+rr1*rr4d*rr9+ & rr1*rr4*rr9d) - vald=vald+0.3333*(rr2d*rr5*rr9+rr2*rr5d*rr9+ & + vald = vald+0.3333*(rr2d*rr5*rr9+rr2*rr5d*rr9+ & rr2*rr5*rr9d) endif else - val=0. + val = 0. endif else if (ib == np) then @@ -1553,42 +1553,42 @@ subroutine vbspl(x,np,xarr,splcon,splcond) r9=(x-xarr(np-1))/(xarr(np)-xarr(np-1)) r13=(x-xarr(np-1))/(xarr(np)-xarr(np-1)) - r1d=1./(xarr(np)-xarr(np-2)) + r1d = 1./(xarr(np)-xarr(np-2)) r2d=-1./(xarr(np)-xarr(np-1)) - r3d=1./(xarr(np)-xarr(np-2)) + r3d = 1./(xarr(np)-xarr(np-2)) r4d=-1./(xarr(np)-xarr(np-1)) - r5d=1./(xarr(np)-xarr(np-1)) - r7d=1./(xarr(np-1)-xarr(np-2)) + r5d = 1./(xarr(np)-xarr(np-1)) + r7d = 1./(xarr(np-1)-xarr(np-2)) r8d=-1./ (xarr(np)-xarr(np-1)) - r9d=1./(xarr(np)-xarr(np-1)) - r13d=1./(xarr(np)-xarr(np-1)) + r9d = 1./(xarr(np)-xarr(np-1)) + r13d = 1./(xarr(np)-xarr(np-1)) if (interval == np-2) then if (iflag == 0) then - val=r1*r3*r7 - vald=r1d*r3*r7+r1*r3d*r7+r1*r3*r7d + val = r1*r3*r7 + vald = r1d*r3*r7+r1*r3d*r7+r1*r3*r7d else if (iflag == 1) then - val=0.6667*r1*r3*r7 + val = 0.6667*r1*r3*r7 vald=0.6667*(r1d*r3*r7+r1*r3d*r7+r1*r3*r7d) endif else if (interval == np-1 .or. interval == np) then if (iflag == 0) then - val=r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + r13**3 - vald=r1d*r3*r8+r1*r3d*r8+r1*r3*r8d - vald=vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d - vald=vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d - vald=vald+3.*r13d*r13**2 + val = r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + r13**3 + vald = r1d*r3*r8+r1*r3d*r8+r1*r3*r8d + vald = vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d + vald = vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d + vald = vald+3.*r13d*r13**2 else if (iflag == 1) then - val=0.6667*(r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + & + val = 0.6667*(r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + & 1.5*r13**3) - vald=r1d*r3*r8+r1*r3d*r8+r1*r3*r8d - vald=vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d - vald=vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d - vald=vald+4.5*r13d*r13**2 - vald=0.6667*vald + vald = r1d*r3*r8+r1*r3d*r8+r1*r3*r8d + vald = vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d + vald = vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d + vald = vald+4.5*r13d*r13**2 + vald = 0.6667*vald endif else - val=0. + val = 0. endif else @@ -1605,37 +1605,37 @@ subroutine vbspl(x,np,xarr,splcon,splcond) r11=(x-xarr(ib)) /(xarr(ib+1)-xarr(ib)) r12=(xarr(ib+2)-x)/(xarr(ib+2)-xarr(ib+1)) - r1d=1./(xarr(ib+1)-xarr(ib-2)) + r1d = 1./(xarr(ib+1)-xarr(ib-2)) r2d=-1./(xarr(ib+2)-xarr(ib-1)) - r3d=1./(xarr(ib)-xarr(ib-2)) + r3d = 1./(xarr(ib)-xarr(ib-2)) r4d=-1./(xarr(ib+1)-xarr(ib-1)) - r5d=1./(xarr(ib+1)-xarr(ib-1)) + r5d = 1./(xarr(ib+1)-xarr(ib-1)) r6d=-1./(xarr(ib+2)-xarr(ib)) - r7d=1./(xarr(ib-1)-xarr(ib-2)) + r7d = 1./(xarr(ib-1)-xarr(ib-2)) r8d=-1./ (xarr(ib)-xarr(ib-1)) - r9d=1./(xarr(ib)-xarr(ib-1)) + r9d = 1./(xarr(ib)-xarr(ib-1)) r10d=-1./(xarr(ib+1)-xarr(ib)) - r11d=1./(xarr(ib+1)-xarr(ib)) + r11d = 1./(xarr(ib+1)-xarr(ib)) r12d=-1./(xarr(ib+2)-xarr(ib+1)) if (interval == ib-2) then - val=r1*r3*r7 - vald=r1d*r3*r7+r1*r3d*r7+r1*r3*r7d + val = r1*r3*r7 + vald = r1d*r3*r7+r1*r3d*r7+r1*r3*r7d else if (interval == ib-1) then - val=r1*r3*r8 + r1*r4*r9 + r2*r5*r9 - vald=r1d*r3*r8+r1*r3d*r8+r1*r3*r8d - vald=vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d - vald=vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d + val = r1*r3*r8 + r1*r4*r9 + r2*r5*r9 + vald = r1d*r3*r8+r1*r3d*r8+r1*r3*r8d + vald = vald+r1d*r4*r9+r1*r4d*r9+r1*r4*r9d + vald = vald+r2d*r5*r9+r2*r5d*r9+r2*r5*r9d else if (interval == ib) then - val=r1*r4*r10 + r2*r5*r10 + r2*r6*r11 - vald=r1d*r4*r10+r1*r4d*r10+r1*r4*r10d - vald=vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d - vald=vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d + val = r1*r4*r10 + r2*r5*r10 + r2*r6*r11 + vald = r1d*r4*r10+r1*r4d*r10+r1*r4*r10d + vald = vald+r2d*r5*r10+r2*r5d*r10+r2*r5*r10d + vald = vald+r2d*r6*r11+r2*r6d*r11+r2*r6*r11d else if (interval == ib+1) then - val=r2*r6*r12 - vald=r2d*r6*r12+r2*r6d*r12+r2*r6*r12d + val = r2*r6*r12 + vald = r2d*r6*r12+r2*r6d*r12+r2*r6*r12d else - val=0. + val = 0. endif endif splcon(ib)=val @@ -1666,27 +1666,27 @@ subroutine ylm(XLAT,XLON,LMAX,Y,WK1,WK2,WK3) real(kind=4) :: THETA,PHI THETA=(90.-XLAT)/RADIAN - PHI=XLON/RADIAN + PHI = XLON/RADIAN - IND=0 - LM1=LMAX+1 + IND = 0 + LM1 = LMAX+1 - DO IL1=1,LM1 + DO IL1 = 1,LM1 - L=IL1-1 + L = IL1-1 CALL legndr(THETA,L,L,WK1,WK2,WK3) FAC=(1.,0.) - DFAC=CEXP(CMPLX(0.,PHI)) + DFAC = CEXP(CMPLX(0.,PHI)) - do IM=1,IL1 - TEMP=FAC*CMPLX(WK1(IM),0.) - IND=IND+1 + do IM = 1,IL1 + TEMP = FAC*CMPLX(WK1(IM),0.) + IND = IND+1 Y(IND)=REAL(TEMP) if (IM == 1) goto 20 - IND=IND+1 + IND = IND+1 Y(IND)=AIMAG(TEMP) - 20 FAC=FAC*DFAC + 20 FAC = FAC*DFAC enddo enddo @@ -1711,19 +1711,19 @@ subroutine legndr(THETA,L,M,X,XP,XCOSEC) !!!!!! illegal statement, removed by Dimitri Komatitsch DFLOAT(I)=FLOAT(I) - SUM=0.D0 - LP1=L+1 - TH=THETA + SUM = 0.D0 + LP1 = L+1 + TH = THETA CT=DCOS(TH) ST=DSIN(TH) - MP1=M+1 - FCT=DSQRT(dble(2*L+1)/FPI) - SFL3=SQRT(FLOAT(L*(L+1))) + MP1 = M+1 + FCT = DSQRT(dble(2*L+1)/FPI) + SFL3 = SQRT(FLOAT(L*(L+1))) COMPAR=dble(2*L+1)/FPI - DSFL3=SFL3 - SMALL=1.D-16*COMPAR + DSFL3 = SFL3 + SMALL = 1.D-16*COMPAR - do I=1,MP1 + do I = 1,MP1 X(I)=0. XCOSEC(I)=0. XP(I)=0. @@ -1740,45 +1740,45 @@ subroutine legndr(THETA,L,M,X,XP,XCOSEC) if (ABS(THETA) >= 1.E-5) XCOSEC(2)=X(2)/ST return - 3 X1=1.D0 - X2=CT + 3 X1 = 1.D0 + X2 = CT - do I=2,L + do I = 2,L X3=(dble(2*I-1)*CT*X2-dble(I-1)*X1)/dble(I) - X1=X2 - X2=X3 + X1 = X2 + X2 = X3 enddo - COT=CT/ST - COSEC=1./ST - X3=X2*FCT - X2=dble(L)*(X1-CT*X2)*FCT/ST + COT = CT/ST + COSEC = 1./ST + X3 = X2*FCT + X2 = dble(L)*(X1-CT*X2)*FCT/ST X(1)=X3 X(2)=X2 - SUM=X3*X3 + SUM = X3*X3 XP(1)=-X2 XP(2)=dble(L*(L+1))*X3-COT*X2 X(2)=-X(2)/SFL3 XCOSEC(2)=X(2)*COSEC XP(2)=-XP(2)/SFL3 - SUM=SUM+2.D0*X(2)*X(2) + SUM = SUM+2.D0*X(2)*X(2) if (SUM-COMPAR > SMALL) return - X1=X3 + X1 = X3 X2=-X2/DSQRT(dble(L*(L+1))) - do I=3,MP1 - K=I-1 - F1=DSQRT(dble((L+I-1)*(L-I+2))) - F2=DSQRT(dble((L+I-2)*(L-I+3))) - XM=K + do I = 3,MP1 + K = I-1 + F1 = DSQRT(dble((L+I-1)*(L-I+2))) + F2 = DSQRT(dble((L+I-2)*(L-I+3))) + XM = K X3=-(2.D0*COT*(XM-1.D0)*X2+F2*X1)/F1 - SUM=SUM+2.D0*X3*X3 + SUM = SUM+2.D0*X3*X3 if (SUM-COMPAR > SMALL .and. I /= LP1) return X(I)=X3 XCOSEC(I)=X(I)*COSEC - X1=X2 + X1 = X2 XP(I)=-(F1*X2+XM*COT*X3) - X2=X3 + X2 = X3 enddo end subroutine legndr diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/save_header_file.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/save_header_file.f90 index cd62158cb..f4f2cd7e0 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/save_header_file.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/save_header_file.f90 @@ -182,20 +182,20 @@ subroutine save_header_file(NSPEC,nglob,NEX_XI,NEX_ETA,NPROC,NPROCTOT, & y=dtan(eta) gamma=ONE/dsqrt(ONE+x*x+y*y) - rgt=R_UNIT_SPHERE*gamma + rgt = R_UNIT_SPHERE*gamma ! define the mesh points at the top surface x_top=-y*rgt - y_top=x*rgt - z_top=rgt + y_top = x*rgt + z_top = rgt ! rotate top vector_ori(1) = x_top vector_ori(2) = y_top vector_ori(3) = z_top - do i=1,3 + do i = 1,3 vector_rotated(i)=0.0d0 - do j=1,3 + do j = 1,3 vector_rotated(i)=vector_rotated(i)+rotation_matrix(i,j)*vector_ori(j) enddo enddo @@ -208,7 +208,7 @@ subroutine save_header_file(NSPEC,nglob,NEX_XI,NEX_ETA,NPROC,NPROCTOT, & call reduce(theta_corner,phi_corner) ! convert geocentric to geographic colatitude - colat_corner=PI/2.0d0-datan(1.006760466d0*dcos(theta_corner)/dmax1(TINYVAL,dsin(theta_corner))) + colat_corner = PI/2.0d0-datan(1.006760466d0*dcos(theta_corner)/dmax1(TINYVAL,dsin(theta_corner))) if (phi_corner > PI) phi_corner=phi_corner-TWO_PI ! compute real position of the source diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sea99_s_model.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sea99_s_model.f90 index 4c97d1b61..8f4224929 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sea99_s_model.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sea99_s_model.f90 @@ -112,8 +112,8 @@ subroutine sea99_s_model(radius,theta,phi,dvs,SEA99M_V) double precision :: xxx,yyy,dep,pla,plo,xd1,dd1,dd2,ddd(2) !----------------------- depth in the model ------------------ dep=R_EARTH_KM*(R_UNIT_SPHERE - radius) - pla=90.0d0 - theta/DEGREES_TO_RADIANS - plo=phi/DEGREES_TO_RADIANS + pla = 90.0d0 - theta/DEGREES_TO_RADIANS + plo = phi/DEGREES_TO_RADIANS if (dep <= SEA99M_V%sea99_depth(1)) then id1 = 1 xd1 = 0 diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sort_array_coordinates.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sort_array_coordinates.f90 index 17897ae5f..40b3b45c2 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sort_array_coordinates.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/sort_array_coordinates.f90 @@ -50,7 +50,7 @@ subroutine sort_array_coordinates(npointot,x,y,z,ibool,iglob,locval,ifseg, & integer :: nseg, ioff, iseg, ig ! establish initial pointers - do i=1,npointot + do i = 1,npointot locval(i) = i enddo @@ -63,10 +63,10 @@ subroutine sort_array_coordinates(npointot,x,y,z,ibool,iglob,locval,ifseg, & ifseg(1) = .true. ninseg(1) = npointot - do j=1,NDIM + do j = 1,NDIM ! sort within each segment ioff = 1 - do iseg=1,nseg + do iseg = 1,nseg if (j == 1) then call heap_sort_multi(ninseg(iseg), x(ioff), y(ioff), z(ioff), ibool(ioff), locval(ioff)) @@ -86,22 +86,22 @@ subroutine sort_array_coordinates(npointot,x,y,z,ibool,iglob,locval,ifseg, & ! check for jumps in current coordinate if (j == 1) then - do i=2,npointot + do i = 2,npointot if (dabs(x(i) - x(i-1)) > xtol) ifseg(i) = .true. enddo else if (j == 2) then - do i=2,npointot + do i = 2,npointot if (dabs(y(i) - y(i-1)) > xtol) ifseg(i) = .true. enddo else - do i=2,npointot + do i = 2,npointot if (dabs(z(i) - z(i-1)) > xtol) ifseg(i) = .true. enddo endif ! count up number of different segments nseg = 0 - do i=1,npointot + do i = 1,npointot if (ifseg(i)) then nseg = nseg + 1 ninseg(nseg) = 1 @@ -113,7 +113,7 @@ subroutine sort_array_coordinates(npointot,x,y,z,ibool,iglob,locval,ifseg, & ! assign global node numbers (now sorted lexicographically) ig = 0 - do i=1,npointot + do i = 1,npointot if (ifseg(i)) ig = ig + 1 iglob(locval(i)) = ig enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/stretching_function.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/stretching_function.f90 index 445a2ad48..bfe74a20c 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/stretching_function.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/stretching_function.f90 @@ -41,7 +41,7 @@ subroutine stretching_function(r_top,r_bottom,ner,stretch_tab) double precision, parameter :: step = 0.001 ! initialize array - do i=1,ner + do i = 1,ner stretch_tab(2,i)=(1.d0/ner) enddo @@ -52,7 +52,7 @@ subroutine stretching_function(r_top,r_bottom,ner,stretch_tab) else value = (0.5d0-floor(ner/2.d0))*step endif - do i=1,ner + do i = 1,ner stretch_tab(2,i) = stretch_tab(2,i) + value value = value + step enddo @@ -61,13 +61,13 @@ subroutine stretching_function(r_top,r_bottom,ner,stretch_tab) ! deduce r_top and r_bottom ! r_top stretch_tab(1,1) = r_top - do i=2,ner + do i = 2,ner stretch_tab(1,i) = sum(stretch_tab(2,i:ner))*(r_top-r_bottom) + r_bottom enddo ! r_bottom stretch_tab(2,ner) = r_bottom - do i=1,ner-1 + do i = 1,ner-1 stretch_tab(2,i) = stretch_tab(1,i+1) enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/topo_bathy.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/topo_bathy.f90 index 5ac8120b9..5477a191d 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/topo_bathy.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/topo_bathy.f90 @@ -84,8 +84,8 @@ subroutine read_topo_bathy_file(ibathy_topo) open(unit=13,file=topo_bathy_file,status='old',action='read') - do itopo_y=1,NY_BATHY - do itopo_x=1,NX_BATHY + do itopo_y = 1,NY_BATHY + do itopo_x = 1,NX_BATHY read(13,*) ibathy_topo(itopo_x,itopo_y) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_chunks_data.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_chunks_data.f90 index f0489410b..db40084fe 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_chunks_data.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_chunks_data.f90 @@ -150,7 +150,7 @@ subroutine write_AVS_DX_global_chunks_data(myrank,prname,nspec,iboun, & nspecface = 0 ! mark global AVS or DX points - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iboun(1,ispec) .or. iboun(2,ispec) .or. & iboun(3,ispec) .or. iboun(4,ispec)) then @@ -213,7 +213,7 @@ subroutine write_AVS_DX_global_chunks_data(myrank,prname,nspec,iboun, & ! output global AVS or DX points numpoin = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iboun(1,ispec) .or. iboun(2,ispec) .or. & iboun(3,ispec) .or. iboun(4,ispec)) then @@ -571,7 +571,7 @@ subroutine write_AVS_DX_global_chunks_data(myrank,prname,nspec,iboun, & write(10,*) nspecface ispecface = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iboun(1,ispec) .or. iboun(2,ispec) .or. & iboun(3,ispec) .or. iboun(4,ispec)) then @@ -588,17 +588,17 @@ subroutine write_AVS_DX_global_chunks_data(myrank,prname,nspec,iboun, & if (ISOTROPIC_3D_MANTLE) then ! pick a point within the element and get its radius - r=dsqrt(xstore(2,2,2,ispec)**2+ystore(2,2,2,ispec)**2+zstore(2,2,2,ispec)**2) + r = dsqrt(xstore(2,2,2,ispec)**2+ystore(2,2,2,ispec)**2+zstore(2,2,2,ispec)**2) if (r > RCMB/R_EARTH .and. r < R_UNIT_SPHERE) then ! average over the element dvp = 0.0 dvs = 0.0 np =0 - do k=2,NGLLZ-1 - do j=2,NGLLY-1 - do i=2,NGLLX-1 - np=np+1 + do k = 2,NGLLZ-1 + do j = 2,NGLLY-1 + do i = 2,NGLLX-1 + np = np+1 x=xstore(i,j,k,ispec) y=ystore(i,j,k,ispec) z=zstore(i,j,k,ispec) @@ -610,7 +610,7 @@ subroutine write_AVS_DX_global_chunks_data(myrank,prname,nspec,iboun, & p20=0.5d0*(3.0d0*cost*cost-1.0d0) call spline_evaluation(rspl,espl,espl2,nspl,r,ell) factor=ONE-(TWO/3.0d0)*ell*p20 - r=r/factor + r = r/factor endif if (REFERENCE_1D_MODEL == REFERENCE_MODEL_IASP91) then diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_data.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_data.f90 index b52838291..591c1ded7 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_data.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_data.f90 @@ -63,7 +63,7 @@ subroutine write_AVS_DX_global_data(myrank,prname,nspec,ibool,idoubling, & mask_ibool(:) = .false. ! mark global AVS or DX points - do ispec=1,nspec + do ispec = 1,nspec iglob1=ibool(1,1,1,ispec) iglob2=ibool(NGLLX,1,1,ispec) iglob3=ibool(NGLLX,NGLLY,1,ispec) @@ -93,7 +93,7 @@ subroutine write_AVS_DX_global_data(myrank,prname,nspec,ibool,idoubling, & ! output global AVS or DX points numpoin = 0 - do ispec=1,nspec + do ispec = 1,nspec iglob1=ibool(1,1,1,ispec) iglob2=ibool(NGLLX,1,1,ispec) iglob3=ibool(NGLLX,NGLLY,1,ispec) @@ -173,7 +173,7 @@ subroutine write_AVS_DX_global_data(myrank,prname,nspec,ibool,idoubling, & write(10,*) nspec ! output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec iglob1=ibool(1,1,1,ispec) iglob2=ibool(NGLLX,1,1,ispec) iglob3=ibool(NGLLX,NGLLY,1,ispec) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_faces_data.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_faces_data.f90 index 6edda4d9c..49b10f48c 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_faces_data.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_global_faces_data.f90 @@ -71,7 +71,7 @@ subroutine write_AVS_DX_global_faces_data(myrank,prname,nspec,iMPIcut_xi,iMPIcut nspecface = 0 ! mark global AVS or DX points - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iMPIcut_xi(1,ispec) .or. iMPIcut_xi(2,ispec) .or. & iMPIcut_eta(1,ispec) .or. iMPIcut_eta(2,ispec)) then @@ -134,7 +134,7 @@ subroutine write_AVS_DX_global_faces_data(myrank,prname,nspec,iMPIcut_xi,iMPIcut ! output global AVS or DX points numpoin = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iMPIcut_xi(1,ispec) .or. iMPIcut_xi(2,ispec) .or. & iMPIcut_eta(1,ispec) .or. iMPIcut_eta(2,ispec)) then @@ -293,7 +293,7 @@ subroutine write_AVS_DX_global_faces_data(myrank,prname,nspec,iMPIcut_xi,iMPIcut write(10,*) nspecface ispecface = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if on face if (iMPIcut_xi(1,ispec) .or. iMPIcut_xi(2,ispec) .or. & iMPIcut_eta(1,ispec) .or. iMPIcut_eta(2,ispec)) then diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_surface_data.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_surface_data.f90 index 3eb7e099a..105f64384 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_surface_data.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/mesher_for_serial/write_AVS_DX_surface_data.f90 @@ -68,7 +68,7 @@ subroutine write_AVS_DX_surface_data(myrank,prname,nspec,iboun, & nspecface = 0 ! mark global AVS or DX points - do ispec=1,nspec + do ispec = 1,nspec ! only if at the surface (top plane) if (iboun(6,ispec)) then @@ -98,7 +98,7 @@ subroutine write_AVS_DX_surface_data(myrank,prname,nspec,iboun, & ! output global AVS or DX points numpoin = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if at the surface if (iboun(6,ispec)) then @@ -163,7 +163,7 @@ subroutine write_AVS_DX_surface_data(myrank,prname,nspec,iboun, & write(10,*) nspecface ispecface = 0 - do ispec=1,nspec + do ispec = 1,nspec ! only if at the surface if (iboun(6,ispec)) then diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/older_serial_specfem3D_inlined_v03_is_the_fastest_with_function_calls.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/older_serial_specfem3D_inlined_v03_is_the_fastest_with_function_calls.f90 index ccde6c0ad..5d8c4d06a 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/older_serial_specfem3D_inlined_v03_is_the_fastest_with_function_calls.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/older_serial_specfem3D_inlined_v03_is_the_fastest_with_function_calls.f90 @@ -152,9 +152,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='DATABASES_FOR_SOLVER/proc000000_reg1_database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -196,8 +196,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='DATABASES_FOR_SOLVER/matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -289,9 +289,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -312,9 +312,9 @@ program serial_specfem3D call mxm_m2_m1_5points(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -469,9 +469,9 @@ program serial_specfem3D ! enddo ! enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX fac1 = wgllwgll_yz(j,k) fac2 = wgllwgll_xz(i,k) @@ -539,8 +539,8 @@ subroutine mxm_m1_m2_5points(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -579,8 +579,8 @@ subroutine mxm_m1_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -619,8 +619,8 @@ subroutine mxm_m2_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NGLOB.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NGLOB.f90 index 10e38e87f..6fd3a07c6 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NGLOB.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NGLOB.f90 @@ -150,9 +150,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -178,8 +178,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -262,9 +262,9 @@ program serial_specfem3D ! and then to compute the elemental contribution ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_glob(i,j,k,ispec) = displ(1,iglob) dummyy_glob(i,j,k,ispec) = displ(2,iglob) @@ -275,9 +275,9 @@ program serial_specfem3D enddo do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempx2l = 0. @@ -291,7 +291,7 @@ program serial_specfem3D tempz2l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + dummyx_glob(l,j,k,ispec)*hp1 tempy1l = tempy1l + dummyy_glob(l,j,k,ispec)*hp1 @@ -374,9 +374,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempy1l = 0. @@ -390,7 +390,7 @@ program serial_specfem3D tempy3l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k)*fac1 tempy1l = tempy1l + tempy1(l,j,k)*fac1 @@ -433,9 +433,9 @@ program serial_specfem3D !! DK DK (i.e., not on faces, edges or corners) for which there are no dependencies !! DK DK because they only represent 3^3 = 27 points out of 5^3 = 125 do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) accel(1,iglob) = accel(1,iglob) + dummyx_glob(i,j,k,ispec) accel(2,iglob) = accel(2,iglob) + dummyy_glob(i,j,k,ispec) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NSPEC.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NSPEC.f90 index 581a67e03..2fcd550e0 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NSPEC.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_22dec2008_NSPEC.f90 @@ -151,9 +151,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -179,8 +179,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -198,9 +198,9 @@ program serial_specfem3D !! DK DK now create inverse mass matrix stored in element format do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) rmass_inverse_nspec(i,j,k,ispec) = rmass_inverse(iglob) enddo @@ -228,9 +228,9 @@ program serial_specfem3D !!!!!!!!! if (it == 2100 .or. it == 5) then Usolidnorm = -1. do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX current_value = sqrt(displ(1,i,j,k,ispec)**2 + displ(2,i,j,k,ispec)**2 + displ(3,i,j,k,ispec)**2) if (current_value > Usolidnorm) Usolidnorm = current_value enddo @@ -294,9 +294,9 @@ program serial_specfem3D ! enddo do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempx2l = 0. @@ -310,7 +310,7 @@ program serial_specfem3D tempz2l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + displ(1,l,j,k,ispec)*hp1 tempy1l = tempy1l + displ(2,l,j,k,ispec)*hp1 @@ -393,9 +393,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempy1l = 0. @@ -409,7 +409,7 @@ program serial_specfem3D tempy3l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k)*fac1 tempy1l = tempy1l + tempy1(l,j,k)*fac1 @@ -454,9 +454,9 @@ program serial_specfem3D goto 777 !! new gather not implemented for now; partial test only do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) ! accel(1,iglob) = accel(1,iglob) + dummyx_glob(i,j,k,ispec) ! accel(2,iglob) = accel(2,iglob) + dummyy_glob(i,j,k,ispec) diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v01.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v01.f90 index 2dc4a293e..299f590e6 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v01.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v01.f90 @@ -155,9 +155,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -183,8 +183,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -275,9 +275,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -300,9 +300,9 @@ program serial_specfem3D call mxm_m2_m1_v10(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -399,9 +399,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempy1l = 0. @@ -415,7 +415,7 @@ program serial_specfem3D tempy3l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k)*fac1 tempy1l = tempy1l + tempy1(l,j,k)*fac1 @@ -498,8 +498,8 @@ subroutine mxm_m1_m2_v10(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -538,8 +538,8 @@ subroutine mxm_m1_m1_v10(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -578,8 +578,8 @@ subroutine mxm_m2_m1_v10(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v02.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v02.f90 index f5eb5c41c..ad18323f0 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v02.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v02.f90 @@ -155,9 +155,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -183,8 +183,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -275,9 +275,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -311,9 +311,9 @@ program serial_specfem3D call mxm_m2_m1_v10(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -410,9 +410,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempy1l = 0. @@ -426,7 +426,7 @@ program serial_specfem3D tempy3l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k)*fac1 tempy1l = tempy1l + tempy1(l,j,k)*fac1 @@ -461,9 +461,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! sum contributions from each element to the global mesh using indirect addressing iglob = ibool(i,j,k,ispec) @@ -527,8 +527,8 @@ subroutine mxm_m1_m2_v10(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -567,8 +567,8 @@ subroutine mxm_m1_m1_v10(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -607,8 +607,8 @@ subroutine mxm_m2_m1_v10(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v04_is_slower.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v04_is_slower.f90 index 99435950b..731f60861 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v04_is_slower.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v04_is_slower.f90 @@ -156,9 +156,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -197,8 +197,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) hprimewgll_xx(i,j) = - hprimewgll_xx(i,j) !!!!!!!!!! DK DK @@ -210,9 +210,9 @@ program serial_specfem3D close(IIN) !! DK DK define matrix with three indices - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX wgllwgll_yz_3indices(i,j,k) = wgllwgll_yz(j,k) wgllwgll_xz_3indices(i,j,k) = wgllwgll_xz(i,k) wgllwgll_xy_3indices(i,j,k) = wgllwgll_xy(i,j) @@ -302,9 +302,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -324,9 +324,9 @@ program serial_specfem3D call mxm_m2_m1(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -471,9 +471,9 @@ program serial_specfem3D ! enddo ! enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX fac1 = wgllwgll_yz_3indices(i,j,k) fac2 = wgllwgll_xz_3indices(i,j,k) @@ -541,8 +541,8 @@ subroutine mxm_m1_m2(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -581,8 +581,8 @@ subroutine mxm_m1_m1(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -621,8 +621,8 @@ subroutine mxm_m2_m1(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v05_displx_y_z_3arrays.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v05_displx_y_z_3arrays.f90 index 3049705cf..8516a7642 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v05_displx_y_z_3arrays.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v05_displx_y_z_3arrays.f90 @@ -154,9 +154,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -195,8 +195,8 @@ program serial_specfem3D close(IIN) open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -303,9 +303,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displx(iglob) dummyy_loc(i,j,k) = disply(iglob) @@ -326,9 +326,9 @@ program serial_specfem3D call mxm_m2_m1_5points(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -474,9 +474,9 @@ program serial_specfem3D ! enddo ! enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX fac1 = wgllwgll_yz(j,k) fac2 = wgllwgll_xz(i,k) @@ -548,8 +548,8 @@ subroutine mxm_m1_m2_5points(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -588,8 +588,8 @@ subroutine mxm_m1_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -628,8 +628,8 @@ subroutine mxm_m2_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v06_fac1_merged_not_faster.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v06_fac1_merged_not_faster.f90 index c15d71c83..dcba86115 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v06_fac1_merged_not_faster.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/older_slower_versions_not_so_good_do_not_use/serial_specfem3D_26dec2008_inlined_v06_fac1_merged_not_faster.f90 @@ -152,8 +152,8 @@ program serial_specfem3D if (mod(NSPEC,2) /= 0) stop 'source element number is not an integer, exiting...' open(unit=IIN,file='matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -166,9 +166,9 @@ program serial_specfem3D ! read the mesh from external file open(unit=IIN,file='database.dat',status='old') do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! read real numbers here read(IIN,*) xix(i,j,k,ispec) read(IIN,*) xiy(i,j,k,ispec) @@ -293,9 +293,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -316,9 +316,9 @@ program serial_specfem3D call mxm_m2_m1_5points(dummyx_loc,dummyy_loc,dummyz_loc,hprime_xxT,tempx3,tempy3,tempz3) - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -469,9 +469,9 @@ program serial_specfem3D ! enddo ! enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! sum contributions from each element to the global mesh using indirect addressing iglob = ibool(i,j,k,ispec) @@ -537,8 +537,8 @@ subroutine mxm_m1_m2_5points(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -577,8 +577,8 @@ subroutine mxm_m1_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -617,8 +617,8 @@ subroutine mxm_m2_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/read_arrays_solver.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/read_arrays_solver.f90 index fa36bca26..b3b231e22 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/read_arrays_solver.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/read_arrays_solver.f90 @@ -89,9 +89,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & ! read real numbers here read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! indices start at 1 in Fortran and 0 in C therefore we subtract 1 to all ! the indices in this formula to convert to a linear offset xix((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) @@ -102,9 +102,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX xiy((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -113,9 +113,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX xiz((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -124,9 +124,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX etax((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -135,9 +135,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX etay((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -146,9 +146,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX etaz((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -157,9 +157,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX gammax((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -168,9 +168,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX gammay((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -179,9 +179,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX gammaz((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -190,9 +190,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX kappav((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -201,9 +201,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & read(IOUT) dummy_float_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX muv((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_float_read(i,j,k,ispec) enddo enddo @@ -213,9 +213,9 @@ subroutine read_arrays_solver(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, & ! read an integer here read(IOUT) dummy_int_read do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ibool((ispec-1)*NGLL3+(k-1)*NGLL2+(j-1)*NGLLX+i-1+1) = dummy_int_read(i,j,k,ispec) enddo enddo diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_fastest_version_with_Deville_and_inlining.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_fastest_version_with_Deville_and_inlining.f90 index fe2f2d7cd..e5b6f32f3 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_fastest_version_with_Deville_and_inlining.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_fastest_version_with_Deville_and_inlining.f90 @@ -205,8 +205,8 @@ program serial_specfem3D enddo open(unit=IIN,file='DATABASES_FOR_SOLVER/matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -381,9 +381,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -396,8 +396,8 @@ program serial_specfem3D ! for incompressible fluid flow, Cambridge University Press (2002), ! pages 386 and 389 and Figure 8.3.1 ! call mxm_m1_m2_5points(hprime_xx,dummyx_loc,dummyy_loc,dummyz_loc,tempx1,tempy1,tempz1) - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1_m1_m2_5points(i,j) = hprime_xx(i,1)*B1_m1_m2_5points(1,j) + & hprime_xx(i,2)*B1_m1_m2_5points(2,j) + & hprime_xx(i,3)*B1_m1_m2_5points(3,j) + & @@ -420,8 +420,8 @@ program serial_specfem3D ! call mxm_m1_m1_5points(dummyx_loc(1,1,k),dummyy_loc(1,1,k),dummyz_loc(1,1,k), & ! hprime_xxT,tempx2(1,1,k),tempy2(1,1,k),tempz2(1,1,k)) - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 ! for efficiency it is better to leave this loop on k inside, it leads to slightly faster code do k = 1,NGLLX tempx2(i,j,k) = dummyx_loc(i,1,k)*hprime_xxT(1,j) + & @@ -446,8 +446,8 @@ program serial_specfem3D enddo ! call mxm_m2_m1_5points(dummyx_loc,dummyy_loc,dummyz_loc,tempx3,tempy3,tempz3) - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1_mxm_m2_m1_5points(i,j) = A1_mxm_m2_m1_5points(i,1)*hprime_xxT(1,j) + & A1_mxm_m2_m1_5points(i,2)*hprime_xxT(2,j) + & A1_mxm_m2_m1_5points(i,3)*hprime_xxT(3,j) + & @@ -468,9 +468,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX ! tempx1l = 0. ! tempx2l = 0. @@ -578,8 +578,8 @@ program serial_specfem3D ! for incompressible fluid flow, Cambridge University Press (2002), ! pages 386 and 389 and Figure 8.3.1 ! call mxm_m1_m2_5points(hprimewgll_xxT,tempx1,tempy1,tempz1,newtempx1,newtempy1,newtempz1) - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 E1_m1_m2_5points(i,j) = hprimewgll_xxT(i,1)*C1_m1_m2_5points(1,j) + & hprimewgll_xxT(i,2)*C1_m1_m2_5points(2,j) + & hprimewgll_xxT(i,3)*C1_m1_m2_5points(3,j) + & @@ -602,8 +602,8 @@ program serial_specfem3D ! call mxm_m1_m1_5points(tempx2(1,1,k),tempy2(1,1,k),tempz2(1,1,k), & ! hprimewgll_xx,newtempx2(1,1,k),newtempy2(1,1,k),newtempz2(1,1,k)) - do i=1,m1 - do j=1,m1 + do i = 1,m1 + do j = 1,m1 ! for efficiency it is better to leave this loop on k inside, it leads to slightly faster code do k = 1,NGLLX newtempx2(i,j,k) = tempx2(i,1,k)*hprimewgll_xx(1,j) + & @@ -628,8 +628,8 @@ program serial_specfem3D enddo ! call mxm_m2_m1_5points(tempx3,tempy3,tempz3,hprimewgll_xx,newtempx3,newtempy3,newtempz3) - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 E1_mxm_m2_m1_5points(i,j) = C1_mxm_m2_m1_5points(i,1)*hprimewgll_xx(1,j) + & C1_mxm_m2_m1_5points(i,2)*hprimewgll_xx(2,j) + & C1_mxm_m2_m1_5points(i,3)*hprimewgll_xx(3,j) + & @@ -687,9 +687,9 @@ program serial_specfem3D ! enddo ! enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX fac1 = wgllwgll_yz(j,k) fac2 = wgllwgll_xz(i,k) @@ -759,8 +759,8 @@ subroutine old_mxm_m1_m2_5points(A,B1,B2,B3,C1,C2,C3) integer :: i,j - do j=1,m2 - do i=1,m1 + do j = 1,m2 + do i = 1,m1 C1(i,j) = A(i,1)*B1(1,j) + & A(i,2)*B1(2,j) + & @@ -799,8 +799,8 @@ subroutine old_mxm_m1_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m1 + do j = 1,m1 + do i = 1,m1 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & @@ -839,8 +839,8 @@ subroutine old_mxm_m2_m1_5points(A1,A2,A3,B,C1,C2,C3) integer :: i,j - do j=1,m1 - do i=1,m2 + do j = 1,m1 + do i = 1,m2 C1(i,j) = A1(i,1)*B(1,j) + & A1(i,2)*B(2,j) + & diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_how_to_consistently_average_a_gradient.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_how_to_consistently_average_a_gradient.f90 index 22dd3aba7..03b8d5595 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_how_to_consistently_average_a_gradient.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_how_to_consistently_average_a_gradient.f90 @@ -96,8 +96,8 @@ program serial_specfem3D kappav,muv,ibool,rmass_fictitious_inverse,myrank,xstore,ystore,zstore) open(unit=IIN,file='DATABASES_FOR_SOLVER/matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -114,9 +114,9 @@ program serial_specfem3D ! this is computed automatically by adding 1 from each point, and thus at the end the sum of all the 1s is equal to the ! number of elements that have this point in common do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) rmass_fictitious_inverse(iglob) = rmass_fictitious_inverse(iglob) + 1._CUSTOM_REAL enddo @@ -138,9 +138,9 @@ program serial_specfem3D ! assign a fictitious value to the array for the test do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) displ(1,iglob) = cos(2.d0*PI*xstore(i,j,k,ispec)) displ(2,iglob) = cos(PI*ystore(i,j,k,ispec)) @@ -160,9 +160,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -171,9 +171,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0._CUSTOM_REAL tempx2l = 0._CUSTOM_REAL @@ -187,7 +187,7 @@ program serial_specfem3D tempz2l = 0._CUSTOM_REAL tempz3l = 0._CUSTOM_REAL - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + dummyx_loc(l,j,k)*hp1 tempy1l = tempy1l + dummyy_loc(l,j,k)*hp1 diff --git a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_normal_no_Deville.f90 b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_normal_no_Deville.f90 index 8a9692176..0bfb7cfee 100644 --- a/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_normal_no_Deville.f90 +++ b/utils/small_SEM_solvers_in_Fortran_and_C_without_MPI_to_learn/specfem3D_normal_no_Deville.f90 @@ -164,8 +164,8 @@ program serial_specfem3D enddo open(unit=IIN,file='DATABASES_FOR_SOLVER/matrices.dat',status='old') - do j=1,NGLLY - do i=1,NGLLX + do j = 1,NGLLY + do i = 1,NGLLX read(IIN,*) hprime_xx(i,j) read(IIN,*) hprimewgll_xx(i,j) read(IIN,*) wgllwgll_yz(i,j) @@ -247,9 +247,9 @@ program serial_specfem3D ! to the acceleration vector of each element of the finite-element mesh do ispec = 1,NSPEC - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dummyx_loc(i,j,k) = displ(1,iglob) dummyy_loc(i,j,k) = displ(2,iglob) @@ -258,9 +258,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempx2l = 0. @@ -274,7 +274,7 @@ program serial_specfem3D tempz2l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX hp1 = hprime_xx(i,l) tempx1l = tempx1l + dummyx_loc(l,j,k)*hp1 tempy1l = tempy1l + dummyy_loc(l,j,k)*hp1 @@ -362,9 +362,9 @@ program serial_specfem3D enddo enddo - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX tempx1l = 0. tempy1l = 0. @@ -378,7 +378,7 @@ program serial_specfem3D tempy3l = 0. tempz3l = 0. - do l=1,NGLLX + do l = 1,NGLLX fac1 = hprimewgll_xx(l,i) tempx1l = tempx1l + tempx1(l,j,k)*fac1 tempy1l = tempy1l + tempy1(l,j,k)*fac1 diff --git a/utils/small_utilities/combine_result_signals_to_one_hdf5/README.md b/utils/small_utilities/combine_result_signals_to_one_hdf5/README.md index 1e17250aa..562ddbf54 100644 --- a/utils/small_utilities/combine_result_signals_to_one_hdf5/README.md +++ b/utils/small_utilities/combine_result_signals_to_one_hdf5/README.md @@ -1,21 +1,21 @@ # combine result singals -A set of scripts and samples to combine seismo files into single binary file in HDF5 format. +A set of scripts and samples to combine seismo files into single binary file in HDF5 format. -## Description of included files: -* combine_signal_files_into_a_single_one.f90: fortran code which do the combine process. +## Description of included files: +* combine_signal_files_into_a_single_one.f90: fortran code which do the combine process. * test_signal_files.txt: a list of signal pathes that will be combined. -* test_script_convert_signals_to_one_single_binalize.py: sample script for the process. -* test_script_open_binarized_file.py: sample script for opening the combined binary file. -* compile_on_occigen.sh: useful script when one comile the fortran code on OCCIGEN/CINES. -* test_signals: folder where the sample signals are put. - +* test_script_convert_signals_to_one_single_binalize.py: sample script for the process. +* test_script_open_binarized_file.py: sample script for opening the combined binary file. +* compile_on_occigen.sh: useful script when one comile the fortran code on OCCIGEN/CINES. +* test_signals: folder where the sample signals are put. + ## To use in your environment -1. compile combine_signal_files_into_a_single_one.f90 with compile flags for HDF5 -`h5pfc (or h5fc) combine_signal_files_into_a_single_one.f90 -o combine` -(just do `./compile_on_occigen.sh` if you use it on OCCIGEN) -2. prepare list_signal_files.txt which is a list of pathes for seismo signal files. -3. adjust the values `total_timesteps` and `total_num_sigs` in `test_script_convert_signals_to_single_binary.py` to your simulation. -4. `python test_script_convert_signals_to_single_binary.py` then the result will be saved as test_out.h5 - +1. compile combine_signal_files_into_a_single_one.f90 with compile flags for HDF5 +`h5pfc (or h5fc) combine_signal_files_into_a_single_one.f90 -o combine` +(just do `./compile_on_occigen.sh` if you use it on OCCIGEN) +2. prepare list_signal_files.txt which is a list of pathes for seismo signal files. +3. adjust the values `total_timesteps` and `total_num_sigs` in `test_script_convert_signals_to_single_binary.py` to your simulation. +4. `python test_script_convert_signals_to_single_binary.py` then the result will be saved as test_out.h5 + diff --git a/utils/small_utilities/combine_result_signals_to_one_hdf5/combine_signal_files_into_a_single_one.f90 b/utils/small_utilities/combine_result_signals_to_one_hdf5/combine_signal_files_into_a_single_one.f90 index 8dc97fefe..c264d2a98 100644 --- a/utils/small_utilities/combine_result_signals_to_one_hdf5/combine_signal_files_into_a_single_one.f90 +++ b/utils/small_utilities/combine_result_signals_to_one_hdf5/combine_signal_files_into_a_single_one.f90 @@ -16,7 +16,7 @@ program combine_signal_files_into_a_single_one real, allocatable, dimension(:) :: xx, yy, zz integer :: pos - integer, parameter :: strlen=200 + integer, parameter :: strlen = 200 character(len=strlen) :: filename_to_open, strdump character(len=strlen) :: out_h5_name diff --git a/utils/small_utilities/locate_partition.f90 b/utils/small_utilities/locate_partition.f90 index 100c11ef1..98412fa02 100644 --- a/utils/small_utilities/locate_partition.f90 +++ b/utils/small_utilities/locate_partition.f90 @@ -207,10 +207,10 @@ subroutine get_closest_point(target_x,target_y,target_z, & y_found = 0.0 z_found = 0.0 - do ispec=1,NSPEC_AB - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do ispec = 1,NSPEC_AB + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dist = (target_x - xstore(iglob))*(target_x - xstore(iglob)) & + (target_y - ystore(iglob))*(target_y - ystore(iglob)) & diff --git a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/create_OpenDX_files_to_view_the_3D_mesh.f90 b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/create_OpenDX_files_to_view_the_3D_mesh.f90 index 267f75285..414409e18 100644 --- a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/create_OpenDX_files_to_view_the_3D_mesh.f90 +++ b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/create_OpenDX_files_to_view_the_3D_mesh.f90 @@ -138,7 +138,7 @@ program create_OpenDX_file_to_view_the_mesh write(11,*) 'object 2 class array type int rank 1 shape 8 items ',nspec,' data follows' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec ! point order in OpenDX in 2D is 1,4,2,3 *not* 1,2,3,4 as in AVS ! point order in OpenDX in 3D is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS ! in the case of OpenDX, node numbers start at zero @@ -155,7 +155,7 @@ program create_OpenDX_file_to_view_the_mesh write(11,*) 'object 3 class array type float rank 0 items ',nspec,' data follows' ! read local elements in this slice and output global AVS or DX elements - do ispec=1,nspec + do ispec = 1,nspec write(11,*) imaterial(ispec) enddo diff --git a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_downwards.f90 b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_downwards.f90 index 72c9533b3..6d78ce092 100644 --- a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_downwards.f90 +++ b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_downwards.f90 @@ -444,8 +444,8 @@ subroutine save_gnuplot_file(nx,nz,x,z) integer :: ier,ili,icol ! draw horizontal lines of the grid - do ili=0,nz - do icol=0,nx-1 + do ili = 0,nz + do icol = 0,nx-1 write(20,*) sngl(x(icol,ili)),sngl(z(icol,ili)) write(20,*) sngl(x(icol+1,ili)),sngl(z(icol+1,ili)) write(20,10) @@ -453,8 +453,8 @@ subroutine save_gnuplot_file(nx,nz,x,z) enddo ! draw vertical lines of the grid - do icol=0,nx - do ili=0,nz-1 + do icol = 0,nx + do ili = 0,nz-1 write(20,*) sngl(x(icol,ili)),sngl(z(icol,ili)) write(20,*) sngl(x(icol,ili+1)),sngl(z(icol,ili+1)) write(20,10) diff --git a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_upwards.f90 b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_upwards.f90 index 7b4bcf6a1..7e80e75de 100644 --- a/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_upwards.f90 +++ b/utils/small_utilities/mesher_analytical_Dimitri_for_2D_and_3D_cracks/mesh_a_Y_shaped_crack_oriented_upwards.f90 @@ -1037,36 +1037,36 @@ subroutine rank(A,IND,N) enddo if (n == 1) return - L=n/2+1 - ir=n + L = n/2+1 + ir = n 100 continue if (l > 1) then - l=l-1 + l = l-1 indx=ind(l) q=a(indx) ELSE indx=ind(ir) q=a(indx) ind(ir)=ind(1) - ir=ir-1 + ir = ir-1 if (ir == 1) then ind(1)=indx return endif endif - i=l - j=l+l + i = l + j = l+l 200 continue if (J <= IR) then if (J < IR) then - if (A(IND(j)) < A(IND(j+1))) j=j+1 + if (A(IND(j)) < A(IND(j+1))) j = j+1 endif if (q < A(IND(j))) then IND(I)=IND(J) - I=J - J=J+J + I = J + J = J+J ELSE - J=IR+1 + J = IR+1 endif goto 200 endif From 350876cb5fc7bff970bdce3e15742f882cd8b798 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 21 Mar 2024 17:37:54 +0100 Subject: [PATCH 05/56] adds cleaning script --- utils/scripts/clean_listings_specfem.py | 486 ++++++++++++++++++++++++ 1 file changed, 486 insertions(+) create mode 100755 utils/scripts/clean_listings_specfem.py diff --git a/utils/scripts/clean_listings_specfem.py b/utils/scripts/clean_listings_specfem.py new file mode 100755 index 000000000..8f2680b76 --- /dev/null +++ b/utils/scripts/clean_listings_specfem.py @@ -0,0 +1,486 @@ +#!/usr/bin/env python +# +# fortran source code cleaning script +# +from __future__ import print_function + +import sys +import os +import filecmp +import shutil +import re +import subprocess +import glob +import fnmatch + +############################################################################################ + +# shows a diff between original and new content (if any) +show_diff = True + +# replaces original with new content (if anything changed) +replace_file_content = False + +############################################################################################ + +# Define the list of file extensions to be processed for Fortran formatting +fortran_file_extensions = ['.fh', '.f90', '.F90', '.fh.in'] + +# Define the list of file extensions to be processed as general formatting +general_file_extensions = ['.bash', '.c', '.cpp','.csh','.cu','.h','.h.in','.pl','.tex','.txt','.sh','.rb', '.md'] + +# Define the list of directories to be excluded (these are mostly submodules included in the source repositories) +exclude_dirs = ['.git', 'm4', './utils/ADJOINT_TOMOGRAPHY_TOOLS/flexwin', './src/inverse_problem_for_source/pyCMT3D'] + +# Define the list of files to be excluded +exclude_files = ['*Par_file*'] + +# list of regex patterns to be replaced +patterns = [ + # suppress trailing white spaces and carriage return + (r'\s*$', ''), + # use new syntax of comparison operators, ignoring case in starting pattern (useful in case of mixed case) + (r'\.le\.', '<='), + (r'\.ge\.', '>='), + (r'\.lt\.', '<'), + (r'\.gt\.', '>'), + (r'\.ne\.', '/='), + (r'\.eq\.', '=='), + # switch to lowercase for comparison operators + (r'\.and\.', '.and.'), + (r'\.or\.', '.or.'), + (r'\.not\.', '.not.'), + (r'\.eqv\.', '.eqv.'), + (r'\.neqv\.', '.neqv.'), + (r'\.true\.', '.true.'), + (r'\.false\.', '.false.'), + # switch to Fortran2008 standard + (r'call\s*getarg\(', 'call get_command_argument('), + # constant strings + (r'endsubroutine', 'end subroutine'), + (r'if\s*\(', 'if ('), + (r'\)\s*then', ') then'), + (r'end\s*if', 'endif'), + (r'end\s*do', 'enddo'), + (r'else\s*if', 'else if'), + # force lowercase keywords + (r'subroutine', 'subroutine'), + (r'end\s*subroutine', 'end subroutine'), + (r'function', 'function'), + (r'end\s*function', 'end function'), + (r'continue', 'continue'), + (r'implicit none', 'implicit none'), + (r'implicit', 'implicit'), + (r'return', 'return'), + (r' go\s*to ', ' goto '), + (r'use\s*::\s*mpi', 'use mpi'), + (r',\s*only\s*:\s*', ', only: '), + (r'NOISE_SOURCE_TIME_FUNCTION_TYPE', 'noise_source_time_function_type'), + # do not move this before the above line in which we change the keyword "function" + (r'use_ricker_time_function', 'USE_RICKER_TIME_FUNCTION'), + (r'print_source_time_function', 'PRINT_SOURCE_TIME_FUNCTION'), + (r'external_source_time_function', 'EXTERNAL_SOURCE_TIME_FUNCTION'), + (r'sourceTimeFunction', 'sourceTimeFunction'), + (r'external_stf', 'EXTERNAL_SOURCE_TIME_FUNCTION'), + (r'EXTERNAL_SOURCE_TIME_FUNCTION_filename', 'external_source_time_function_filename'), + (r'read_EXTERNAL_SOURCE_TIME_FUNCTION', 'read_external_source_time_function'), + (r'USE_MAP_function', 'USE_MAP_FUNCTION'), + (r'enddo_LOOP_IJK', 'ENDDO_LOOP_IJK'), + (r'enddo_LOOP_IJ', 'ENDDO_LOOP_IJ'), + (r'OMP do', 'OMP DO'), + (r'OMP enddo', 'OMP ENDDO'), + (r'print\*', 'print *'), + (r'print\s*\*', 'print *'), + (r'spectral-elements', 'spectral elements'), + (r'gaussian', 'Gaussian'), + (r'hessian', 'Hessian'), + (r'cartesian', 'Cartesian'), + # suppress space between parenthesis and .not. (this can happen when testing logical operators) + (r'\( \.not\. ', '(.not. '), + (r'\)call', ') call'), + # enforce upper case + (r'CUSTOM_REAL', 'CUSTOM_REAL'), + # do not use null strings, which are not part of the Fortran standard (and the IBM xlf compiler rejects them for instance) + (r'print\s*\*\s*,\s*\'\'', 'print *'), + (r'write\s*\(\s*\*\s*,\s*\*\s*\)\s*\'\'', 'print *'), + (r'write\s*\(\s*IMAIN\s*,\s*\*\s*\)\s*\'\'', 'write(IMAIN,*)'), + (r'write\s*\(\s*IOUT\s*,\s*\*\s*\)\s*\'\'', 'write(IOUT,*)'), + (r'print\s*\*\s*,\s*""', 'print *'), + (r'write\s*\(\s*\*\s*,\s*\*\s*\)\s*""', 'print *'), + (r'write\s*\(\s*IMAIN\s*,\s*\*\s*\)\s*""', 'write(IMAIN,*)'), + (r'write\s*\(\s*IOUT\s*,\s*\*\s*\)\s*""', 'write(IOUT,*)'), + # unit 6 means standard output, replace it with standard output symbol + (r'write\s*\(\s*6\s*,\s*\*\s*\)', 'write(*,*)'), + (r'write\s*\(\s*6\s*,', 'write(*,'), + # force space in , & at end of line + (r'\s*\,\s*&\s*$', ', &'), + # always use upper case for GLL when used as a word + (r' gll ', ' GLL '), + (r' mpi ', ' MPI '), + (r' pml ', ' PML '), + # fix some typos I have found in the different codes, or non-US spelling. + # also switch to US spelling in order to have the same standard in all files. + (r'regularisation', 'regularization'), + (r'optimisation', 'optimization'), + (r'analitical', 'analytical'), + # (r'communIcation', 'communication'), + (r' in orfer ', ' in order '), + (r' stepest ', ' steepest '), + (r' stepest$', ' steepest'), + (r'aloow', 'allow'), + (r'neighbour', 'neighbor'), + (r'vecotr', 'vector'), + (r'computse', 'compute'), + (r'indicies', 'indices'), + (r'accordig', 'according'), + (r'paralell', 'parallel'), + (r'debbug', 'debug'), + # do not suppress the white space here because it would then change "debugging" for instance + (r'debugg ', 'debug '), + (r'debugg$', 'debug'), + (r'familly', 'family'), + (r'warnning', 'warning'), + (r'elemement', 'element'), + (r'cartesion', 'Cartesian'), + (r'partiton', 'partition'), + (r'drection', 'direction'), + (r'seperation', 'separation'), + (r'inverision', 'inversion'), + (r'restauration', 'restoration'), + (r'restaure', 'restore'), + (r'memmory', 'memory'), + (r'convolution formation', 'convolution formulation'), + (r'fortran', 'Fortran'), + (r'adress', 'address'), + (r'gFortran', 'gfortran'), + (r' usefull ', ' useful '), + (r' usefull$', ' useful'), + # enforce upper case + (r'MAX_neighborS', 'MAX_NEIGHBORS'), +] + +# list of regex patterns to be replaced only for selected files w/out excluded files +special_patterns = [ + # operators + (r'\s*<\s*=\s*', ' <= '), + (r'\s*>\s*=\s*', ' >= '), + (r'\s*<\s*', ' < '), + (r'\s*/=\s*', ' /= '), + # restore operators that may have been split by the above introduction of white spaces + (r'<\s*=', '<='), + (r'>\s*=', '>='), + (r'=\s*=', '=='), + (r'/\s*=', '/='), + # also restore bash file pipes that may appear in some print statements that save bash scripts to disk for future processing + (r'>\s*&', '>&'), + (r'<\s*&', '<&'), + # also restore xml-formatting strings '< and >' + (r'\'\s*<\s*', '\'<'), + (r'\s*>\s*\'', '>\''), + # for pointers + (r'\s*=\s*>\s*(?!$)', ' => '), +] + +# patterns for comment/non-comment lines +comment = [ '!' ] +comment_patterns = [ + (r'-\s*>', '->'), + (r'<\s*-', '<-'), +] +non_comment_patterns = [ + (r'(?(?!=)(?!\')(?!&)\s*', ' > '), + (r'\s*==(?!=)\s*', ' == '), + (r'(? 0: + first_letter = line_nospace[0] + else: + first_letter = '' + #print(f"line {i}: first_letter={first_letter} line: {line}") + + ## general patterns + for pattern, replacement in patterns: + #print(f"pattern: {pattern}") + line = re.sub(pattern, replacement, line, flags=re.IGNORECASE) + + ## special patterns formatting (operators,..) + # check if line has xml format (contains ' patterns) + xml_patterns = [ r'\'' ] + has_xml_pattern = False + for pattern in xml_patterns: + if re.search(pattern, line): + has_xml_pattern = True + break + if not has_xml_pattern: + ## Replace special patterns + for pattern, replacement in special_patterns: + line = re.sub(pattern, replacement, line, flags=re.IGNORECASE) + + ## Replace patterns on non-comment lines + if first_letter in comment: + # comment line + for pattern, replacement in comment_patterns: + #print(f"comment pattern: {pattern}") + line = re.sub(pattern, replacement, line, flags=re.IGNORECASE) + else: + # non-comment line + for pattern, replacement in non_comment_patterns: + #print(f"non-comment pattern: {pattern}") + line = re.sub(pattern, replacement, line, flags=re.IGNORECASE) + + ## special formatting + # "write(IMAIN,*)'my-comment'" -> "write(IMAIN,*) 'my-comment'" + if re.search(r'\bwrite\s*\(IMAIN,\*\)\'[^\']*\'', line): + line = re.sub(r'\)(?=\'[^\']*\')', ') ', line, flags=re.IGNORECASE) + + # "write(IMAIN,*)my-parameter" -> "write(*,*) my-parameter" + if re.search(r'\bwrite\s*\(IMAIN,\*\)\w+', line): + line = re.sub(r'\)(?=\w)', ') ', line, flags=re.IGNORECASE) + + # "write(*,*)'my-comment'" -> "write(*,*)'my-comment'" + if re.search(r'\bwrite\s*\(\*,\*\)\'[^\']*\'', line): + line = re.sub(r'\)(?=\'[^\']*\')', ') ', line, flags=re.IGNORECASE) + + # "write(*,*)my-parameter" -> "write(*,*) my-parameter" + if re.search(r'\bwrite\s*\(\*,\*\)\w+', line): + line = re.sub(r'\)(?=\w)', ') ', line, flags=re.IGNORECASE) + + # "if (a==b)something" -> "if (a==b) something" + if re.search(r'\bif\s*\(\s*(\w+)\s*==\s*(\w+)\s*\)\w+', line): + line = re.sub(r'\)(?=\w)', ') ', line, flags=re.IGNORECASE) + + # on non-comment lines + if not first_letter in comment: + # do i=1,.. -> do i = 1,.. + if re.search(r'\bdo\s+(\w+)\s*=(\d+)\s*\,', line): + line = re.sub(r'\bdo\s+(\w+)\s*=(\d+)\s*\,', r'do \1 = \2,', line, flags=re.IGNORECASE) + + # do i=ilat,.. -> do i = ilat,.. + if re.search(r'\bdo\s+(\w+)\s*=(\w+)\s*\,', line): + line = re.sub(r'\bdo\s+(\w+)\s*=(\w+)\s*\,', r'do \1 = \2,', line, flags=re.IGNORECASE) + + # "myvar==0" -> "myvar == 0" + if re.search(r'(\w+)==(\d+)', line): + newline = re.sub(r'(\w+)==(\d+)', r'\1 == \2', line, flags=re.IGNORECASE) + print(" A newline: ",newline) + + # "myvar==something" -> "myvar == something" + if re.search(r'\b(\w+)==(\w+)', line): + newline = re.sub(r'\b(\w+)==(\w+)', r'\1 == \2', line, flags=re.IGNORECASE) + print(" B newline: ",newline) + + # "a=b" -> "a = b" + exclude_equal_patterns = [ + r'==', + r'>=', + r'<=', + r'\bopen\s*\(', + r'\bclose\s*\(', + r'\binquire\s*\(', + r'\bread\s*\(', + r'\bwrite\s*\(', + r'\brandom_seed\s*\(', + r'\bminloc\s*\(', + r'\bminval\s*\(', + r'\bmaxval\s*\(', + r'\bcheck_status\s*\(', + r'\bget_command_argument\s*\(', + r'\bdate_and_time\s*\(', + r'\bexit_mpi\s*\(', + r'\bexit_MPI\s*\(', + r'\blibxsmm', + r'\bprint\s*\*', + r'\brecl=', + r'\bstat=', + r'\bexitstat=', + r'\biostat=', + r'\blen=', + r'\bkind=', + r'\bh5', + r'^[^)]*\)[^)]*$', + r'^\s*&', + ] + has_equal_pattern = False + for pattern in exclude_equal_patterns: + if re.search(pattern, line): + has_equal_pattern = True + break + if not has_equal_pattern: + # "myvar=something" -> "myvar = something" but not "a==b" or lines with "open(unit=.." etc. + if re.search(r'(\w+)=(\w+)', line): + line = re.sub(r'(\w+)=(\w+)', r'\1 = \2', line, flags=re.IGNORECASE) + + # Replace the original line with the modified line + lines[i] = line + + # Join the modified lines back together + content_new = '\n'.join(lines) + return content_new + + +def format_content_general(content): + """ + applies cleaning to general (text) files, for example output_solver.txt files in REF_SEIS/ folders + """ + # line-by-line + lines = content.split('\n') # Split the content into lines + + for i, line in enumerate(lines): + ## general formatting + # suppress trailing white spaces and carriage return + line = re.sub(r'\s*$', '', line) + # Replace the original line with the modified line + lines[i] = line + + # Join the modified lines back together + content_new = '\n'.join(lines) + return content_new + + +def clean_code_format(file): + """ + cleans code format + """ + # Exclude specified files + if any(fnmatch.fnmatch(file, filename) for filename in exclude_files): + return + + # Process files only with specified extensions + # Fortran files + is_Fortran_file = False + is_general_file = False + if any(file.endswith(ext) for ext in fortran_file_extensions): + is_Fortran_file = True + elif any(file.endswith(ext) for ext in general_file_extensions): + is_general_file = True + + # checks if anything to do + if not is_Fortran_file and not is_general_file: + return + + print(f'Processing {file}...') + + # Read the file + with open(file, 'r') as f: + content = f.read() + + # content + if is_Fortran_file: + # fortran code formatting + content_new = format_content_fortran(content) + else: + # general file cleaning + content_new = format_content_general(content) + + # output + if show_diff: + # show all content + #print("content:") + #print(content_new) + + # show differences only line-by-line + # line-by-line + lines_org = content.split('\n') # Split the content into lines + lines_new = content_new.split('\n') # Split the content into lines + + len_org = len(lines_org) + len_new = len(lines_new) + if len(lines_org) != len(lines_new): + print("Warning: content number of lines differ: original = {} new = {}".format(len_org,len_new)) + + length = min(len_org,len_new) + for i in range(length): + line_org = lines_org[i] + line_new = lines_new[i] + # show if lines are different + if line_new != line_org: + print(f" line {i}: - {line_org}") + print(f" line {i}: + {line_new}") + + if replace_file_content: + # Write the modified content back to the file if anything changed + if content_new != content: + # new content is different + with open(file, 'w') as f: + f.write(content_new) + +def clean_listings(folder_filename): + """ + loops over (Fortran) code files and updates code formatting + """ + # determines whether a folder or a specific file was provided as input + if os.path.isdir(folder_filename): + # folder + # Define the path to the source code + src_path = folder_filename + + # Iterate over all files in the source directory and its subdirectories + for root, dirs, files in os.walk(src_path): + # Exclude specified directories + dirs[:] = [d for d in dirs if d not in exclude_dirs and os.path.join(root,d) not in exclude_dirs] + + for file in files: + file_path = os.path.join(root, file) + # clean code formatting + clean_code_format(file_path) + + elif os.path.isfile(folder_filename): + # file + file_path = folder_filename + # clean code formatting + clean_code_format(file_path) + + print("") + print("all done") + print("") + +# reads in arguments +def usage(): + print("Usage: ./clean_listings_specfem.py filename/folder [--diff/--no-diff] [--replace]") + print("") + print(" filename/folder - required input file or folder containing Fortran source code files, e.g., src/") + print(" --diff/--no-diff - show or don't show formatting differences (default is to show differences)") + print(" --replace - replace file content with new formatting (default off)") + sys.exit(1) + + +if __name__ == '__main__': + + # gets arguments + if len(sys.argv) < 2: + usage() + + folder_filename = sys.argv[1] # file or folder with source code files + + # reads arguments + i = 0 + for arg in sys.argv: + i += 1 + #print("arg: ",arg) + # get arguments + if "--diff" in arg: + show_diff = True + elif "--no-diff" in arg: + show_diff = False + elif "--replace" in arg: + replace_file_content = True + elif i > 2: + print("argument not recognized: ",arg) + print("") + usage() + + # main routine + clean_listings(folder_filename) From 800a522935b530a4adb36e20bb1ec94903d6c09e Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 4 Apr 2024 11:16:52 +0200 Subject: [PATCH 06/56] updates vis scripts --- ...convert_openstreetmap_buildings_to_mesh.py | 92 +++++++++---------- .../python_blender/plot_with_blender.py | 43 +++++---- 2 files changed, 72 insertions(+), 63 deletions(-) diff --git a/utils/Visualization/Blender/python_blender/convert_openstreetmap_buildings_to_mesh.py b/utils/Visualization/Blender/python_blender/convert_openstreetmap_buildings_to_mesh.py index 04cde4c5a..16d987e90 100755 --- a/utils/Visualization/Blender/python_blender/convert_openstreetmap_buildings_to_mesh.py +++ b/utils/Visualization/Blender/python_blender/convert_openstreetmap_buildings_to_mesh.py @@ -3,14 +3,14 @@ # downloads openstreetmap buildings and creates 3d mesh objects saved in .ply format # # required python modules: -# - numpy (numpy==1.26.3) -# - scipy (scipy-1.11.4) -# - pygmt (pygmt==0.10.0) +# - numpy (numpy==1.26.4) +# - scipy (scipy==1.13.0) +# - pygmt (pygmt==0.11.0) # - pyproj (pyproj==3.6.1) -# - xarray (xarray==2023.10.1) -# - osmnx (osmnx==1.8.1) -# - geopandas (geopandas==0.14.2) -# - trimesh (trimesh==4.0.10) +# - xarray (xarray==2024.3.0) +# - osmnx (osmnx==1.9.2) +# - geopandas (geopandas==0.14.3) +# - trimesh (trimesh==4.2.4) # - rtree (Rtree==1.2.0) # - mapbox_earcut (mapbox-earcut==1.0.1) # @@ -66,6 +66,20 @@ print("install by: > pip install -U trimesh") sys.exit(1) +try: + import rtree +except: + print("Error importing module `rtree`") + print("install by: > pip install -U rtree") + sys.exit(1) + +try: + import mapbox_earcut +except: + print("Error importing module `mapbox_earcut`") + print("install by: > pip install -U mapbox_earcut") + sys.exit(1) + # for mesh triangulation from scipy.spatial import Delaunay @@ -88,7 +102,7 @@ -def download_buildings(mesh_area): +def download_buildings(mesh_area: np.array): """ downloads OpenStreetMap (OSM) building footprints and infos """ @@ -114,6 +128,7 @@ def download_buildings(mesh_area): # define a bounding box north, south, east, west = lat_max, lat_min, lon_max, lon_min + target_area = (north, south, east, west) # configuration ox.settings.use_cache = True @@ -121,7 +136,7 @@ def download_buildings(mesh_area): if 1 == 0: # get graph - G = ox.graph_from_bbox(north, south, east, west, network_type="drive") + G = ox.graph_from_bbox(bbox=target_area, network_type="drive") #print("debug: G ",G) fig, ax = ox.plot_graph(G, node_size=0) @@ -141,7 +156,7 @@ def download_buildings(mesh_area): tags = {"building": True, "building:part": True} # download buildings as a GeoDataFrame - gdf = ox.features_from_bbox(north, south, east, west, tags) + gdf = ox.features_from_bbox(bbox=target_area, tags=tags) print("") print(" number of all buildings: ",gdf.shape[0]) @@ -374,7 +389,7 @@ def prepare_osm_building_data(gdf): #---------------------------------------------------------------------------------------- # -def get_topo_DEM(mesh_area): +def get_topo_DEM(mesh_area: np.array): """ downloads elevation data using GMT """ @@ -473,7 +488,7 @@ def get_topo_elevation(lat,lon,topo_grid): #---------------------------------------------------------------------------------------- # -def convert_coordinates_to_UTM(gdf,mesh_area,lons,lats): +def convert_coordinates_to_UTM(gdf, mesh_area: np.array, lons, lats): global transformer_to_utm # user output @@ -553,7 +568,7 @@ def convert_coordinates_to_UTM(gdf,mesh_area,lons,lats): #---------------------------------------------------------------------------------------- # -def create_building_mesh(gdf,mesh_area,elevation,obj,meshes,icount_added): +def create_building_mesh(gdf, mesh_area: np.array, elevation, obj, meshes, icount_added: int): """ creates a 3d mesh for building specified by obj """ @@ -802,7 +817,7 @@ def get_building_roof_type(obj): #---------------------------------------------------------------------------------------- # -def create_extruded_building(gdf,mesh_area,height,roof_type,roof_height,roof_direction,roof_orientation,elevation,poly): +def create_extruded_building(gdf, mesh_area: np.array, height, roof_type, roof_height, roof_direction, roof_orientation, elevation, poly): """ create building mesh by extrusion """ @@ -978,7 +993,7 @@ def filter_triangles(tris, polygon, hole): #---------------------------------------------------------------------------------------- # -def add_roof_mesh(b_mesh,height,roof_type,roof_height,roof_direction,roof_orientation): +def add_roof_mesh(b_mesh, height, roof_type, roof_height, roof_direction, roof_orientation): """ adds a roof mesh to the building """ @@ -1217,7 +1232,7 @@ def angular_difference(angle1, angle2): #---------------------------------------------------------------------------------------- # -def get_roof_primitive(roof_type,roof_height,base_points,height): +def get_roof_primitive(roof_type, roof_height, base_points, height): """ creates a geometric primitive of different roof types which will need to be scaled and positioned """ @@ -1457,7 +1472,7 @@ def get_roof_primitive(roof_type,roof_height,base_points,height): #---------------------------------------------------------------------------------------- # -def determine_building_elevations(gdf,topo_grid,mesh_area): +def determine_building_elevations(gdf, topo_grid, mesh_area: np.array): """ determines for each building its topographic elevation based on the building's centroid position """ @@ -1576,7 +1591,7 @@ def determine_building_elevations(gdf,topo_grid,mesh_area): #---------------------------------------------------------------------------------------- # -def create_3d_buildings(gdf,topo_grid,mesh_area): +def create_3d_buildings(gdf, topo_grid, mesh_area: np.array) -> None: """ creates for each building a 3d mesh and stores all as .ply output file """ @@ -1710,7 +1725,7 @@ def create_3d_buildings(gdf,topo_grid,mesh_area): #---------------------------------------------------------------------------------------- # -def convert_openstreetmap_buildings(input_file=None,mesh_origin=None,mesh_scale=None,mesh_area=None): +def convert_openstreetmap_buildings(input_file: str="", mesh_area: np.array=None) -> None: # user output print("") @@ -1718,10 +1733,6 @@ def convert_openstreetmap_buildings(input_file=None,mesh_origin=None,mesh_scale= if len(input_file) > 0: print(" input file : ",input_file) - if not mesh_origin is None: - print(" mesh_origin : ",mesh_origin) - if not mesh_scale is None: - print(" mesh_scale : ",mesh_scale) if not mesh_area is None: print(" mesh_area : ",mesh_area) @@ -1733,12 +1744,12 @@ def convert_openstreetmap_buildings(input_file=None,mesh_origin=None,mesh_scale= print("") # input data - if len(input_file) == 0: - # download buildings - gdf = download_buildings(mesh_area) - else: + if len(input_file) > 0: # reads in buildings and loads GeoJSON format file into a GeoDataFrame object gdf = gpd.read_file(input_file) + else: + # download buildings + gdf = download_buildings(mesh_area) # prepare gdf data array and validate entries gdf = prepare_osm_building_data(gdf) @@ -1754,22 +1765,18 @@ def convert_openstreetmap_buildings(input_file=None,mesh_origin=None,mesh_scale= #---------------------------------------------------------------------------------------- # -def usage(): - print("usage: ./convert_openstreetmap_buildings_to_dxf.py [--mesh_area=(lon_min,lat_min,lon_max,lat_max)] [--mesh_origin=(x0,y0,z0)] [--mesh_scale=factor] [--GeoJSON_file=file]") +def usage() -> None: + print("usage: ./convert_openstreetmap_buildings_to_dxf.py [--mesh_area=(lon_min,lat_min,lon_max,lat_max)] [--GeoJSON_file=file]") print(" with") print(" --mesh_area - downloads/limits buildings for area specified by (lon_min,lat_min,lon_max,lat_max)") - print(" --mesh_origin - translate mesh by origin position") - print(" --mesh_scale - scale mesh by a factor") print(" --GeoJSON_file - use input mesh file (.gjson) instead of download") sys.exit(1) if __name__ == '__main__': # init - input_file = "" - mesh_origin = None - mesh_scale = None - mesh_area = None + input_file: str = "" + mesh_area: np.array = None # reads arguments #print("\nnumber of arguments: " + str(len(sys.argv))) @@ -1782,19 +1789,12 @@ def usage(): # get arguments if "--help" in arg: usage() - elif "--dxf_file=" in arg: - input_file = arg.split('=')[1] - elif "--dwg_file=" in arg: - input_file = arg.split('=')[1] - elif "--mesh_origin=" in arg: - str_array = arg.split('=')[1] - mesh_origin = np.array([float(val) for val in str_array.strip('()[]').split(',')]) - elif "--mesh_scale=" in arg: - mesh_scale = float(arg.split('=')[1]) elif "--mesh_area=" in arg: str_array = arg.split('=')[1] mesh_area = np.array([float(val) for val in str_array.strip('()[]').split(',')]) - elif i >= 6: + elif "--GeoJSON_file=" in arg: + input_file = arg.split('=')[1] + elif i >= 2: print("argument not recognized: ",arg) # logging @@ -1806,4 +1806,4 @@ def usage(): print("command logged to file: " + filename) # main routine - convert_openstreetmap_buildings(input_file,mesh_origin,mesh_scale,mesh_area) + convert_openstreetmap_buildings(input_file,mesh_area) diff --git a/utils/Visualization/Blender/python_blender/plot_with_blender.py b/utils/Visualization/Blender/python_blender/plot_with_blender.py index bd845513d..705949656 100755 --- a/utils/Visualization/Blender/python_blender/plot_with_blender.py +++ b/utils/Visualization/Blender/python_blender/plot_with_blender.py @@ -98,6 +98,8 @@ # elevation at center point z_elevation = 0.0 +# background color +world_background_color = (1,1,1,1) # white # class to avoid long stdout output by renderer # see: https://stackoverflow.com/questions/24277488/in-python-how-to-capture-the-stdout-from-a-c-shared-library-to-a-variable/29834357 @@ -123,7 +125,7 @@ def __exit__(self, type, value, traceback): self.devnull.close() -def convert_vtk_to_obj(vtk_file,colormap=0,color_max=None): +def convert_vtk_to_obj(vtk_file: str="", colormap: int=0, color_max=None) -> str: global mesh_scale_factor,mesh_origin # Path to your .vtu file @@ -767,7 +769,7 @@ def convert_vtk_to_obj(vtk_file,colormap=0,color_max=None): return obj_file -def create_blender_setup(obj_file=""): +def create_blender_setup(obj_file: str="") -> None: ## Blender setup print("blender setup:") print("") @@ -994,7 +996,7 @@ def create_blender_setup(obj_file=""): print("") -def add_blender_buildings(buildings_file=""): +def add_blender_buildings(buildings_file: str="") -> None: """ adds buildings given by input .ply file """ @@ -1153,7 +1155,7 @@ def add_blender_buildings(buildings_file=""): print("") -def get_mesh_elevation(point_of_interest): +def get_mesh_elevation(point_of_interest: Vector) -> float: """ determines elevation of object (obj) at a given point by ray intersection """ @@ -1185,7 +1187,7 @@ def get_mesh_elevation(point_of_interest): return None -def get_mesh_elevation_at_origin(): +def get_mesh_elevation_at_origin() -> float: """ determines elevation of mesh at origin/center point """ @@ -1211,7 +1213,7 @@ def get_mesh_elevation_at_origin(): return elevation -def add_camera(title="",close_up_view=False): +def add_camera(title: str="", close_up_view: bool=False) -> None: """ adds camera object """ @@ -1344,7 +1346,7 @@ def add_camera(title="",close_up_view=False): scene.camera.data.angle = float(30.0 * DEGREE_TO_RAD) -def add_light(): +def add_light() -> None: """ adds a light to the scene """ @@ -1370,7 +1372,7 @@ def add_light(): light.data.use_contact_shadow = True # Enable contact shadows -def add_plane(close_up_view=False): +def add_plane(close_up_view: bool=False) -> None: """ adds a plane at sea-level """ @@ -1411,7 +1413,7 @@ def add_plane(close_up_view=False): plane_object.data.materials.append(mat) -def add_title(title=""): +def add_title(title: str="") -> None: """ adds a title text """ @@ -1446,7 +1448,7 @@ def add_title(title=""): text_object.data.materials.append(text_material) -def set_scene(): +def set_scene() -> None: """ sets scene options """ @@ -1512,14 +1514,14 @@ def set_scene(): # Set the render percentage (optional, for scaling down the final output) #scene.render.resolution_percentage = 50 # Adjust as needed - # sets white background color - bpy.data.worlds["World"].node_tree.nodes["Background"].inputs[0].default_value = (1, 1, 1, 1) + # sets background color + bpy.data.worlds["World"].node_tree.nodes["Background"].inputs[0].default_value = world_background_color print(" renderer: ",scene.render.engine) print("") -def render_animation(): +def render_animation() -> None: """ renders a movie animation """ @@ -1773,7 +1775,7 @@ def render_animation(): print("elapsed time for animation render is {} min {:0.4f} sec\n".format(min,sec)) -def render_image(): +def render_image() -> None: """ renders a single image """ @@ -1817,7 +1819,7 @@ def render_image(): print("elapsed time for image render is {} min {:0.4f} sec\n".format(min,sec)) -def render_blender_scene(title="",animation=False,close_up_view=False): +def render_blender_scene(title: str="", animation: bool=False, close_up_view: bool=False) -> None: ## blender scene setup print("Setting up blender scene...") @@ -1859,7 +1861,8 @@ def render_blender_scene(title="",animation=False,close_up_view=False): # main routine -def plot_with_blender(vtk_file="",image_title="",colormap=0,color_max=None,buildings_file="",animation=False,close_up_view=False): +def plot_with_blender(vtk_file: str="", image_title: str="", colormap: int=0, color_max: float=None, + buildings_file: str="", animation: bool=False, close_up_view: bool=False) -> None: """ renders image for (earth) sphere with textures """ @@ -1881,7 +1884,7 @@ def plot_with_blender(vtk_file="",image_title="",colormap=0,color_max=None,build render_blender_scene(image_title,animation,close_up_view) -def usage(): +def usage() -> None: print("usage: ./plot_with_blender.py [--vtk_file=file] [--title=my_mesh_name] [--colormap=val] [--color-max=val] [--buildings=file]") print(" [--with-cycles/--no-cycles] [--closeup] [--small] [--anim] [--suppress] [--help]") print(" with") @@ -1954,6 +1957,12 @@ def usage(): use_transparent_sea_level_plane = True elif "--vtk_file=" in arg: vtk_file = arg.split('=')[1] + elif "--background-dark" in arg: + world_background_color = (0.05,0.05,0.05,1) # dark world background + elif "--background-blue" in arg: + world_background_color = (0.05,0.05,0.1,1) # dark-blue world background + elif "--background-black" in arg: + world_background_color = (0,0,0,1) # black world background elif i >= 8: print("argument not recognized: ",arg) From f8fdf49439ea1f47ae8dde3c839a4f2c7fed0fc3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 4 Apr 2024 22:20:06 +0200 Subject: [PATCH 07/56] updates surface detection threshold (based on mesh dimensions) --- .../geocubitlib/boundary_definition.py | 199 ++++++++++++------ 1 file changed, 133 insertions(+), 66 deletions(-) diff --git a/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py b/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py index 0d15a773f..9ec8443bf 100755 --- a/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py +++ b/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py @@ -71,7 +71,7 @@ def map_boundary(cpuxmin=0, cpuxmax=1, cpuymin=0, cpuymax=1, cpux=1, cpuy=1): return xmin, xmax, ymin, ymax, listfull -def define_4side_lateral_surfaces(tres = 0.0003, tol = 0.000001): +def define_4side_lateral_surfaces(): list_vol = cubit.parse_cubit_list("volume", "all") surf_xmin = [] surf_ymin = [] @@ -85,9 +85,36 @@ def define_4side_lateral_surfaces(tres = 0.0003, tol = 0.000001): ymax_box = cubit.get_total_bounding_box("volume", list_vol)[4] zmin_box = cubit.get_total_bounding_box("volume", list_vol)[6] zmax_box = cubit.get_total_bounding_box("volume", list_vol)[7] - #print('absorbing boundary xmin:' + str(xmin_box) + ' xmax: ' + str(xmax_box)) - #print('absorbing boundary ymin:' + str(ymin_box) + ' ymax: ' + str(ymax_box)) - #print('absorbing boundary zmin:' + str(zmin_box) + ' zmax: ' + str(zmax_box)) + + #print('# absorbing boundary:') + #print('# xmin:' + str(xmin_box) + ' xmax: ' + str(xmax_box)) + #print('# ymin:' + str(ymin_box) + ' ymax: ' + str(ymax_box)) + #print('# zmin:' + str(zmin_box) + ' zmax: ' + str(zmax_box)) + + # mesh dimensions + dim_x = abs(xmax_box - xmin_box) + dim_y = abs(ymax_box - ymin_box) + dim_z = abs(zmax_box - zmin_box) + + # maximum of lateral dimensions + dim_max = max( dim_x, dim_y ) + #print('# define_4side_lateral_surfaces: mesh dimensions: ',dim_x,dim_y,dim_z,' - maximum: ',dim_max) + #print('#') + + # we want to distinguish between NDT cases and others more seismic-like ones, + # assuming NDT uses much smaller mesh dimensions + if dim_max > 10000.0: + # seismic cases (like Mount St.Helens example, with UTM coordinates, and maximum extents around 22 km) + tres = 0.3 + tol = 0.1 + elif dim_max > 1000.0: + # seismic cases + tres = 0.3 + tol = 0.001 + else: + # NDT (non-destructive testing) cases + tres = 0.0003 + tol = 0.000001 for id_vol in list_vol: surf_vertical = [] @@ -96,6 +123,9 @@ def define_4side_lateral_surfaces(tres = 0.0003, tol = 0.000001): lsurf = cubit.get_relatives("volume", id_vol, "surface") for k in lsurf: normal = cubit.get_surface_normal(k) + #debug + #print("#debug: lateral surface: vol {} surf {} normal {} - tres {}".format(id_vol,k,normal,tres)) + # checks if normal is horizontal (almost 0, i.e., +/- tres) if normal[2] >= -1 * tres and normal[2] <= tres: # checks if surface is on minimum/maximum side of the whole model @@ -103,11 +133,17 @@ def define_4side_lateral_surfaces(tres = 0.0003, tol = 0.000001): # note: for models with smaller volumes inscribed, we want only the outermost surfaces # as absorbing ones #sbox = cubit.get_bounding_box('surface', k) + # relative distances to outer surfaces + dist_xmin = abs(center_point[0] - xmin_box) / dim_x + dist_xmax = abs(center_point[0] - xmax_box) / dim_x + dist_ymin = abs(center_point[1] - ymin_box) / dim_y + dist_ymax = abs(center_point[1] - ymax_box) / dim_y + #debug + #print("#debug: lateral surface: center {} dist {}/{}/{}/{} - tol {}".format(center_point,dist_xmin,dist_xmax,dist_ymin,dist_ymax,tol)) + # xmin of surface box relative to total box xmin - if (abs(center_point[0] - xmin_box) / abs(xmax_box - xmin_box) <= tol) or \ - (abs(center_point[0] - xmax_box) / abs(xmax_box - xmin_box) <= tol) or \ - (abs(center_point[1] - ymin_box) / abs(ymax_box - ymin_box) <= tol) or \ - (abs(center_point[1] - ymax_box) / abs(ymax_box - ymin_box) <= tol): + if (dist_xmin <= tol) or (dist_xmax <= tol) or \ + (dist_ymin <= tol) or (dist_ymax <= tol): # adds as vertical surface surf_vertical.append(k) xsurf.append(center_point[0]) @@ -119,10 +155,11 @@ def define_4side_lateral_surfaces(tres = 0.0003, tol = 0.000001): surf_xmax.append(surf_vertical[xsurf.index(max(xsurf))]) surf_ymax.append(surf_vertical[ysurf.index(max(ysurf))]) #debug - #print('define_4side_lateral_surfaces: xmin ',surf_xmin) - #print('define_4side_lateral_surfaces: xmax ',surf_xmax) - #print('define_4side_lateral_surfaces: ymin ',surf_ymin) - #print('define_4side_lateral_surfaces: ymax ',surf_ymax) + #print('# define_4side_lateral_surfaces: xmin ',surf_xmin) + #print('# define_4side_lateral_surfaces: xmax ',surf_xmax) + #print('# define_4side_lateral_surfaces: ymin ',surf_ymin) + #print('# define_4side_lateral_surfaces: ymax ',surf_ymax) + return surf_xmin, surf_ymin, surf_xmax, surf_ymax @@ -147,15 +184,15 @@ def lateral_boundary_are_absorbing(iproc=0, cpuxmin=0, cpuxmax=1, # if iproc in iproc_xmin: abs_xmin = xmin - print('proc ', iproc, ' has absorbing boundary xmin') + print('# proc ', iproc, ' has absorbing boundary xmin') if iproc in iproc_ymin: - print('proc ', iproc, ' has absorbing boundary ymin') + print('# proc ', iproc, ' has absorbing boundary ymin') abs_ymin = ymin if iproc in iproc_xmax: - print('proc ', iproc, ' has absorbing boundary xmax') + print('# proc ', iproc, ' has absorbing boundary xmax') abs_xmax = xmax if iproc in iproc_ymax: - print('proc ', iproc, ' has absorbing boundary ymax') + print('# proc ', iproc, ' has absorbing boundary ymax') abs_ymax = ymax return abs_xmin, abs_xmax, abs_ymin, abs_ymax @@ -203,7 +240,9 @@ def product(*args, **kwds): # top_surf = [] bottom_surf = [] + list_vol = cubit.parse_cubit_list("volume", "all") + zmax_box = cubit.get_total_bounding_box("volume", list_vol)[7] # it is the z_min of the box ... box= xmin,xmax,d,ymin,ymax,d,zmin... zmin_box = cubit.get_total_bounding_box("volume", list_vol)[6] @@ -212,17 +251,40 @@ def product(*args, **kwds): ymin_box = cubit.get_total_bounding_box("volume", list_vol)[3] ymax_box = cubit.get_total_bounding_box("volume", list_vol)[4] - print('total bounding box:') - print(' xmin: ',xmin_box,' xmax: ',xmax_box) - print(' ymin: ',ymin_box,' ymax: ',ymax_box) - print(' zmin: ',zmin_box,' zmax: ',zmax_box) - print('') + print('# total bounding box:') + print('# xmin: ',xmin_box,' xmax: ',xmax_box) + print('# ymin: ',ymin_box,' ymax: ',ymax_box) + print('# zmin: ',zmin_box,' zmax: ',zmax_box) + print('#') + + # mesh dimensions + dim_x = abs(xmax_box - xmin_box) + dim_y = abs(ymax_box - ymin_box) + dim_z = abs(zmax_box - zmin_box) + dim_max = max( dim_x, dim_y, dim_z ) + print('# mesh dimensions:') + print('# dim x: ',dim_x) + print('# dim y: ',dim_y) + print('# dim z: ',dim_z) + print('# maximum extent = ',dim_max) + print('#') list_surf = cubit.parse_cubit_list("surface", "all") - absorbing_surface_distance_tolerance = 0.000001 - topographic_surface_distance_tolerance = 0.0001 - topographic_surface_normal_tolerance = 0.0004 + # we want to distinguish between NDT cases and others more seismic-like ones, + # assuming NDT uses much smaller mesh dimensions + if dim_max > 1000.0: + # seismic cases + absorbing_surface_distance_tolerance = 0.001 + topographic_surface_distance_tolerance = 0.1 + topographic_surface_normal_tolerance = 0.4 + dzmin_tolerance = 0.001 + else: + # NDT (non-destructive testing) cases + absorbing_surface_distance_tolerance = 0.000001 + topographic_surface_distance_tolerance = 0.0001 + topographic_surface_normal_tolerance = 0.0004 + dzmin_tolerance = 0.00001 lv = [] for k in list_surf: @@ -252,7 +314,7 @@ def product(*args, **kwds): # valence 3 is a corner, 4 is a vertex between 2 volumes, # > 4 is a vertex not in the boundaries lv.append(v) - elif dzmin <= 0.00001 and zn < -1 + topographic_surface_normal_tolerance: + elif dzmin <= dzmin_tolerance and zn < -1 + topographic_surface_normal_tolerance: bottom_surf.append(k) if len(top_surf) == 0: # assuming that one topo surface need to be selected @@ -303,9 +365,11 @@ def product(*args, **kwds): abs_ymin = list(set(abs_ymintmp) - set(abs_ymaxtmp)) abs_ymax = list(set(abs_ymaxtmp) - set(abs_ymintmp)) - print('lateral absorbing boundary:') - print(' abs_xmin: ',abs_xmin,' abs_xmax: ',abs_xmax) - print(' abs_ymin: ',abs_xmin,' abs_ymax: ',abs_xmax) + print('#') + print('# lateral absorbing boundary:') + print('# abs_xmin: ',abs_xmin,' abs_xmax: ',abs_xmax) + print('# abs_ymin: ',abs_ymin,' abs_ymax: ',abs_ymax) + print('#') return absorbing_surf, abs_xmin, abs_xmax, abs_ymin, abs_ymax, top_surf, \ bottom_surf, xmin, ymin, xmax, ymax @@ -331,9 +395,9 @@ def build_block(vol_list, name, id_0=1, top_surf=None, optionsea=False): seathres = False # - print('build blocks') + print('# build blocks') block_list = cubit.get_block_id_list() - print(block_list, vol_list) + #print('#debug:',block_list, vol_list) if len(block_list) > 0: id_block = max(max(block_list), 2) + id_0 else: @@ -370,15 +434,15 @@ def build_block(vol_list, name, id_0=1, top_surf=None, optionsea=False): if version_cubit >= 15: command = 'block ' + str(id_block) + ' hex in vol ' + \ str(v) - print(command) else: command = 'block ' + str(id_block) + ' hex in vol ' + \ str(v) + ' except hex in vol ' + str(list(v_other)) - print(command) + print("# ",command) command = command.replace("[", " ").replace("]", " ") cubit.cmd(command) command = "block " + str(id_block) + " name '" + n + "'" cubit.cmd(command) + print('#') def build_block_side(surf_list, name, obj='surface', id_0=1): @@ -446,64 +510,67 @@ def define_bc(*args, **keys): cpux=cpux, cpuy=cpuy) id_0 = cubit.get_next_block_id() v_list, name_list = define_block() - print('define block', v_list, name_list) + print('# define block: ', v_list, name_list) + print('#') + build_block(v_list, name_list, id_0, top_surf, optionsea=optionsea) + # entities entities = ['face'] if type(args) == list: if len(args) > 0: entities = args[0] - print(entities) + + #print('#debug: ',entities) for entity in entities: - print("##entity: " + str(entity)) + print("## entity: " + str(entity)) # block for free surface (w/ topography) # print('## topo surface block: ' + str(topo)) if len(top_surf) == 0: - print("") - print("no topo surface found,\ - please create block face_topo manually...") - print("") + print("#") + print("# no topo surface found, please create block face_topo manually...") + print("#") else: build_block_side(top_surf, entity + '_topo', obj=entity, id_0=1001) # model has parallel sides (e.g. a block model ) # xmin - blocks if len(xmin) == 0: - print("") - print("0 abs_xmin surface found, please create block manually") - print("") + print("#") + print("# zero abs_xmin surface found, please create block manually") + print("#") else: build_block_side(xmin, entity + '_abs_xmin', obj=entity, id_0=1003) # xmax - blocks if len(xmax) == 0: - print("") - print("0 abs_xmax surface found, please create block manually") - print("") + print("#") + print("# zero abs_xmax surface found, please create block manually") + print("#") else: build_block_side(xmax, entity + '_abs_xmax', obj=entity, id_0=1005) # ymin - blocks if len(ymin) == 0: - print("") - print("0 abs_xmin surface found, please create block manually") - print("") + print("#") + print("# zero abs_xmin surface found, please create block manually") + print("#") else: build_block_side(ymin, entity + '_abs_ymin', obj=entity, id_0=1004) # ymax - blocks if len(ymax) == 0: - print("") - print("0 abs_ymax surface found, please create block manually") - print("") + print("#") + print("# zero abs_ymax surface found, please create block manually") + print("#") else: build_block_side(ymax, entity + '_abs_ymax', obj=entity, id_0=1006) # bottom - blocks if len(bottom_surf) == 0: - print("") - print("0 abs_bottom surf found, please create block manually") - print("") + print("#") + print("# zero abs_bottom surf found, please create block manually") + print("#") else: build_block_side(bottom_surf, entity + '_abs_bottom', obj=entity, id_0=1002) @@ -517,7 +584,7 @@ def define_bc(*args, **keys): # # entities # entities = args[0] # id_side = 1001 - # print(entities) + # print('# ',entities) # for entity in entities: # build_block_side(surf, entity + '_closedvol', # obj=entity, id_0=id_side) @@ -592,7 +659,7 @@ def get_ordered_node_surf(lsurface, icurve): if k != 0: cubit.cmd('del group sl') else: - print('initializing group sl') + print('# initializing group sl') cubit.cmd("group 'sl' add node in surf " + lsurf) group1 = cubit.get_id_from_name("sl") nodes_ls = list(cubit.get_group_nodes(group1)) @@ -604,7 +671,7 @@ def get_ordered_node_surf(lsurface, icurve): if k != 0: cubit.cmd('del group n1') else: - print('initializing group n1') + print('# initializing group n1') cubit.cmd("group 'n1' add node in curve " + icurvestr) x = cubit.get_bounding_box('curve', icurve) if x[2] > x[5]: @@ -664,7 +731,7 @@ def get_ordered_node_surf(lsurface, icurve): if k != 0: cubit.cmd('del group curve_vertical') else: - print('initializing group curve_vertical') + print('# initializing group curve_vertical') cubit.cmd("group 'curve_vertical' add node in curve " + kcurve) group1 = cubit.get_id_from_name('curve_vertical') nodes_curve = list(cubit.get_group_nodes(group1)) @@ -696,14 +763,14 @@ def check_bc(iproc, xmin, xmax, ymin, ymax, curve_bottom_xmin, curve_bottom_ymin, curve_bottom_xmax, \ curve_bottom_ymax = \ extract_bottom_curves(surf_xmin, surf_ymin, surf_xmax, surf_ymax) - # print('absorbing surfaces: ', absorbing_surf) - print('absorbing surfaces xmin : ', abs_xmin) - print('absorbing surfaces xmax : ', abs_xmax) - print('absorbing surfaces ymin : ', abs_ymin) - print('absorbing surfaces ymax : ', abs_ymax) - print('absorbing surfaces top : ', top_surf) - print('absorbing surfaces bottom : ', bottom_surf) - # print('bottom curves: ', surf_xmin, surf_ymin, surf_xmax, surf_ymax) + # print('# absorbing surfaces: ', absorbing_surf) + print('# absorbing surfaces xmin : ', abs_xmin) + print('# absorbing surfaces xmax : ', abs_xmax) + print('# absorbing surfaces ymin : ', abs_ymin) + print('# absorbing surfaces ymax : ', abs_ymax) + print('# absorbing surfaces top : ', top_surf) + print('# absorbing surfaces bottom : ', bottom_surf) + # print('# bottom curves: ', surf_xmin, surf_ymin, surf_xmax, surf_ymax) # # # From a095385497469315fb008d49dec322a0f30c44ba Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 4 Apr 2024 22:21:06 +0200 Subject: [PATCH 08/56] updates cubit meshing scripts (adding path to GEOCUBIT, just in case) --- .../block_mesh-anisotropic.py | 19 +- .../block_mesh-anisotropic.py | 19 +- .../block_mesh-anisotropic.py | 19 +- .../block_mesh-anisotropic.py | 19 +- .../block_mesh-anisotropic.py | 19 +- .../block_mesh-anisotropic.py | 19 +- .../mesh_example_with_cubit.py | 1 + .../block_mesh.py | 14 +- .../applications/Mount_StHelens/mesh_mount.py | 341 +++++++++++------- .../Mount_StHelens/mesh_mount_stl.py | 115 ++++-- .../applications/Mount_StHelens/read_topo.py | 7 +- .../run_boundary_definition.py | 4 +- .../run_cubit2specfem3d.py | 4 +- .../splay_faults/splay_faults.py | 21 +- .../block_mesh-anisotropic.py | 24 +- .../create_mesh.py | 14 +- .../block_mesh-anisotropic.py | 19 +- .../homogeneous_poroelastic/create_mesh.py | 19 +- .../2lay_mesh_boundary_fig8-nodoubling.py | 13 + .../tomographic_model/tomoblock_mesh.py | 20 +- .../make_mesh_waterlayer-default.py | 13 + .../make_mesh_waterlayer_verticalboundary.py | 16 + .../waterlayer_mesh_boundary_fig8.py | 13 + .../waterlayer_mesh_boundary_vertical.py | 19 +- .../waterlayer_only-nodoubling.py | 19 +- 25 files changed, 593 insertions(+), 217 deletions(-) diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4da6f936f..4b4ec657b 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py b/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py index c4a65d15d..1eef6b2c5 100755 --- a/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py +++ b/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py @@ -83,6 +83,7 @@ try: import geocubitlib except: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') sys.path.append('../../../CUBIT_GEOCUBIT/') print("path: ") print(sys.path) diff --git a/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py b/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py index 73b7e9074..51f7d1b99 100755 --- a/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py +++ b/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py @@ -52,8 +52,18 @@ #### End of meshing -# adds path to scripts (if not setup yet) -sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") ## obsolete: #import boundary_definition diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py index 505a3f52c..122a5b876 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py @@ -1,6 +1,3 @@ -#!python -#!python -#!/usr/bin/python #!/usr/bin/env python ############################################################# # @@ -18,15 +15,45 @@ import os.path import time -import cubit -cubit.init([""]) +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") +# +# CUBIT +# try: - from geocubitlib import boundary_definition, exportlib - from geocubitlib import cubit2specfem3d + import cubit +except ImportError: + print("Error: Importing cubit as python module failed") + print(" Please check your PYTHONPATH settings...") + print("") + print("current path: ") + print(sys.path) + print("") + sys.exit("Import cubit failed") + +#cubit.init([""]) +cubit.init(["-noecho","-nojournal"]) + +# +# GEOCUBIT +# +try: + from geocubitlib import boundary_definition + from geocubitlib import cubit2specfem3d except: - import boundary_definition - import cubit2specfem3d + import boundary_definition + import cubit2specfem3d # time stamp print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) @@ -34,20 +61,26 @@ # working directory cwd = os.getcwd() -print("#current working directory: " + str(cwd)) +print("# current working directory: " + str(cwd)) if cwd[len(cwd)-14:len(cwd)] != "Mount_StHelens": print("") - print("#please run this script from example directory: SPECFEM3D/example/Mount_StHelens/") + print("# Please run this script from example directory: SPECFEM3D/EXAMPLES/applications/Mount_StHelens/") print("") +print("#") +print("## cubit version:") +print("#") cubit.cmd('version') -cubit.cmd('reset') -print("running meshing script...") -print("") -print("note: this script uses topography surface in ACIS format") -print(" meshing will take around 15 min") -print("") +print("#") +print("# running meshing script...") +print("#") +print("# note: this script uses topography surface in ACIS format") +print("# meshing will take around 15 min") +print("#") + +# clean workspace +cubit.cmd('reset') # uses developer commands cubit.cmd('set developer commands on') @@ -59,23 +92,23 @@ # ############################################################# print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#loading topo surface...") +print("# loading topo surface...") # topography surface if os.path.exists("topo.cub"): - print("opening existing topography surface") - # topography surface - # previously run, just reopen the cubit file - cubit.cmd('open "topo.cub"') + print("# opening existing topography surface") + # topography surface + # previously run, just reopen the cubit file + cubit.cmd('open "topo.cub"') else: - # topo surface doesn't exist yet, this creates it: - print("reading in topography surface") - # reads in topography points and creates sheet surface - execfile("./read_topo.py") - # clear - cubit.cmd('reset') - # now reopen the cubit file - cubit.cmd('open "topo.cub"') + # topo surface doesn't exist yet, this creates it: + print("# reading in topography surface") + # reads in topography points and creates sheet surface + execfile("./read_topo.py") + # clear + cubit.cmd('reset') + # now reopen the cubit file + cubit.cmd('open "topo.cub"') # healing the surface... cubit.cmd('Auto_clean volume 1 small_surfaces small_curve_size 10') @@ -87,17 +120,24 @@ # ############################################################# print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#creating brick...") +print("# creating brick...") # creates temporary brick volume -# new brick volume (depth will become 1/2 * 20,000 = 10,000 m) -cubit.cmd('brick x 15000 y 22000 z 20000') +if os.path.exists("topo_1.cub"): + print("# opening existing volume 1") + # clears workspace + cubit.cmd('reset') + # previously run, just reopen the cubit file + cubit.cmd('open "topo_1.cub"') +else: + # new brick volume (depth will become 1/2 * 20,000 = 10,000 m) + cubit.cmd('brick x 15000 y 22000 z 20000') -# moves volume to UTM coordinates of topography surface -cubit.cmd('volume 2 move x 561738. y 5116370. z 0 ') + # moves volume to UTM coordinates of topography surface + cubit.cmd('volume 2 move x 561738. y 5116370. z 0 ') -# temporary backup -cubit.cmd('save as "topo_1.cub" overwrite') + # temporary backup + cubit.cmd('save as "topo_1.cub" overwrite') ############################################################# # @@ -105,18 +145,26 @@ # ############################################################# print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#creating volume with topography...") +print("# creating volume with topography...") -print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#imprinting volume, this will take around 1 min, please be patience...") -cubit.cmd('merge all') -cubit.cmd('imprint all') +# topography surface +if os.path.exists("topo_2.cub"): + print("# opening existing volume 2") + # clears workspace + cubit.cmd('reset') + # previously run, just reopen the cubit file + cubit.cmd('open "topo_2.cub"') +else: + print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) + print("# imprinting volume, this will take around 1 min, please be patience...") + cubit.cmd('merge all') + cubit.cmd('imprint all') -# exports only surfaces which will create single volume -cubit.cmd('export acis "topo_2.acis" surface 3 10 12 14 15 9 ascii overwrite') + # exports only surfaces which will create single volume + cubit.cmd('export acis "topo_2.acis" surface 3 10 12 14 15 9 ascii overwrite') -# backup -cubit.cmd('save as "topo_2.cub" overwrite') + # backup + cubit.cmd('save as "topo_2.cub" overwrite') ############################################################# # @@ -126,21 +174,29 @@ # checks if new file available if not os.path.exists("topo_2.acis"): print("") - print("error creating new volume, please check manually...") + print("# error creating new volume, please check manually...") print("") cubit.cmd('pause') # clears workspace cubit.cmd('reset') -# imports surfaces and merges to single volume -cubit.cmd('import acis "topo_2.acis" ascii merge_globally') +# single volume +if os.path.exists("topo_3.cub"): + print("# opening existing volume 3") + # clears workspace + cubit.cmd('reset') + # previously run, just reopen the cubit file + cubit.cmd('open "topo_3.cub"') +else: + # imports surfaces and merges to single volume + cubit.cmd('import acis "topo_2.acis" ascii merge_globally') -print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#creating new volume, this will take another 2 min...") -cubit.cmd('create volume surface all heal') + print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) + print("# creating new volume, this will take another 2 min...") + cubit.cmd('create volume surface all heal') -# backup -cubit.cmd('save as "topo_3.cub" overwrite') + # backup + cubit.cmd('save as "topo_3.cub" overwrite') ############################################################# # @@ -148,89 +204,129 @@ # ############################################################# print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#initial meshing...") -print("#(will take around 7 min)") - -# optional: refining mesh at surface -# -# note: refining using ACIS surface format takes a long time ... (up to 3 hours) -DO_TOPO_REFINEMENT = False - -# Meshing the volumes -if DO_TOPO_REFINEMENT == False: - elementsize = 500.0 - cubit.cmd('volume all size '+str(elementsize)) - # note: we will mesh first the topography surface, then sweep down the mesh - # topography surface - #cubit.cmd('control skew surface 12') - cubit.cmd('surface 12 submap smooth off') - cubit.cmd('surface 12 scheme submap') - cubit.cmd('mesh surface 12') - # propagates mesh down for whole volume - cubit.cmd('volume 1 redistribute nodes off') - cubit.cmd('volume 1 scheme sweep source surface 12 target surface 7') - cubit.cmd('mesh volume all') - # draw/update mesh lines for visualization - # this will draw also the tripling layer mesh lines in case - cubit.cmd('draw volume all') + +# topography surface +if os.path.exists("topo_4.cub"): + print("# opening existing volume 4") + # clears workspace + cubit.cmd('reset') + # previously run, just reopen the cubit file + cubit.cmd('open "topo_4.cub"') else: - # optional surface refinement - # time stamp - print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) - print("#refining surface mesh...") - print("#(will take around 3 hours)") - # starts with a crude mesh - elementsize = 2000.0 - cubit.cmd('volume all size '+str(elementsize)) - # sets meshing type - # explicitly sets scheme for topography surface - cubit.cmd('surface 12 submap smooth off') - cubit.cmd('surface 12 scheme submap') - # uses a sweep algorithm in vertical (Z) direction - cubit.cmd('volume all scheme sweep Vector 0 0 1') - # initial coarse mesh - cubit.cmd('mesh volume all') - # optional smoothing to improve mesh quality (takes up to 5 min) - cubit.cmd('volume all smooth scheme condition number beta 1.0 cpu 5') - cubit.cmd('smooth volume all') - # refines global mesh - cubit.cmd('refine volume 1 numsplit 1') - cubit.cmd('draw volume all') - # optional smoothing - cubit.cmd('smooth volume all') - # refines elements at topography surface - cubit.cmd('refine surface 12 numsplit 1 bias 1.0 depth 1') - cubit.cmd('draw volume all') - # optional smoothing to improve mesh quality (takes up to 10 min) - cubit.cmd('volume all smooth scheme condition number beta 2.3 cpu 10') - cubit.cmd('smooth volume all') - # displays final mesh - cubit.cmd('draw volume all') + print("# initial meshing...") + print("# (will take around 7 min)") + + # optional: refining mesh at surface + # + # note: refining using ACIS surface format takes a long time ... (up to 3 hours) + DO_TOPO_REFINEMENT = False + + # Meshing the volumes + if DO_TOPO_REFINEMENT == False: + elementsize = 500.0 + cubit.cmd('volume all size '+str(elementsize)) + # note: we will mesh first the topography surface, then sweep down the mesh + # topography surface + #cubit.cmd('control skew surface 12') + cubit.cmd('surface 12 submap smooth off') + cubit.cmd('surface 12 scheme submap') + cubit.cmd('mesh surface 12') + # propagates mesh down for whole volume + cubit.cmd('volume 1 redistribute nodes off') + cubit.cmd('volume 1 scheme sweep source surface 12 target surface 7') + cubit.cmd('mesh volume all') + # draw/update mesh lines for visualization + # this will draw also the tripling layer mesh lines in case + cubit.cmd('draw volume all') + else: + # optional surface refinement + # time stamp + print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) + print("# refining surface mesh...") + print("# (will take around 3 hours)") + # starts with a crude mesh + elementsize = 2000.0 + cubit.cmd('volume all size '+str(elementsize)) + # sets meshing type + # explicitly sets scheme for topography surface + cubit.cmd('surface 12 submap smooth off') + cubit.cmd('surface 12 scheme submap') + # uses a sweep algorithm in vertical (Z) direction + cubit.cmd('volume all scheme sweep Vector 0 0 1') + # initial coarse mesh + cubit.cmd('mesh volume all') + # optional smoothing to improve mesh quality (takes up to 5 min) + cubit.cmd('volume all smooth scheme condition number beta 1.0 cpu 5') + cubit.cmd('smooth volume all') + # refines global mesh + cubit.cmd('refine volume 1 numsplit 1') + cubit.cmd('draw volume all') + # optional smoothing + cubit.cmd('smooth volume all') + # refines elements at topography surface + cubit.cmd('refine surface 12 numsplit 1 bias 1.0 depth 1') + cubit.cmd('draw volume all') + # optional smoothing to improve mesh quality (takes up to 10 min) + cubit.cmd('volume all smooth scheme condition number beta 2.3 cpu 10') + cubit.cmd('smooth volume all') + # displays final mesh + cubit.cmd('draw volume all') + + + # time stamp + print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) + print("# done meshing...") + + # backup + cubit.cmd('save as "topo_4.cub" overwrite') +#### End of meshing -# time stamp -print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) -print("#done meshing...") +# re-indexes +cubit.cmd('compress all') -# backup -cubit.cmd('save as "topo_4.cub" overwrite') +# avoids assigning empty blocks +cubit.cmd('set duplicate block elements on') -#### End of meshing ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print("#### DEFINE BC #######################") boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) +# given the tolerance on the bounding box surfaces is too narrow, the xmin/xmax/ymin/ymax boundaries might not be found. +# we can create the missing absorbing blocks manually here: +if 1 == 0: + print("## surfaces") + cubit.cmd('list surface') + print("#") + #box = cubit.get_bounding_box('surface', 5) + #print("# surface 5: bounding box = ",box) + + cubit.cmd('block 1003 face in surface 5') + cubit.cmd('block 1003 name "face_abs_xmin"') + + cubit.cmd('block 1004 face in surface 4') + cubit.cmd('block 1004 name "face_abs_ymin"') + + cubit.cmd('block 1005 face in surface 3') + cubit.cmd('block 1005 name "face_abs_xmax"') + + cubit.cmd('block 1006 face in surface 2') + cubit.cmd('block 1006 name "face_abs_ymax"') + + #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') -cubit.cmd('block 1 name "elastic 1" ') # elastic material region -cubit.cmd('block 1 attribute count 6') +print("#### DEFINE MATERIAL PROPERTIES #######################") +cubit.cmd('block 1 name "elastic 1"') # elastic material region +cubit.cmd('block 1 attribute count 7') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material cubit.cmd('block 1 attribute index 2 2800') # vp cubit.cmd('block 1 attribute index 3 1500') # vs cubit.cmd('block 1 attribute index 4 2300') # rho -cubit.cmd('block 1 attribute index 5 150.0') # Qmu -cubit.cmd('block 1 attribute index 6 0 ') # anisotropy_flag +cubit.cmd('block 1 attribute index 5 9999.0') # Qkappa +cubit.cmd('block 1 attribute index 6 150.0') # Qmu +cubit.cmd('block 1 attribute index 7 0') # anisotropy_flag # optional saves backups cubit.cmd('export mesh "top.e" dimension 3 overwrite') @@ -244,6 +340,7 @@ # all files needed by SCOTCH are now in directory MESH # time stamp +print("# all done") print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py index 16c289155..75b0d2b28 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py @@ -14,36 +14,65 @@ import sys import os.path -import cubit +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + +# +# CUBIT +# +try: + import cubit +except ImportError: + print("Error: Importing cubit as python module failed") + print(" Please check your PYTHONPATH settings...") + print("") + print("current path: ") + print(sys.path) + print("") + sys.exit("Import cubit failed") + cubit.init([""]) +# +# GEOCUBIT +# try: - from geocubitlib import boundary_definition - from geocubitlib import cubit2specfem3d + from geocubitlib import boundary_definition + from geocubitlib import cubit2specfem3d except: import boundary_definition - import cubit2specfem3d + import cubit2specfem3d # time stamp print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) # working directory cwd = os.getcwd() -print("#current working directory: " + str(cwd)) +print("# current working directory: " + str(cwd)) if cwd[len(cwd)-14:len(cwd)] != "Mount_StHelens": - print("") - print("#please run this script from example directory: SPECFEM3D/example/Mount_StHelens/") - print("") + print("") + print("# Please run this script from example directory: SPECFEM3D/EXAMPLES/applications/Mount_StHelens/") + print("") cubit.cmd('version') cubit.cmd('reset') os.system('rm -f topo_brick.stl topo_vol.stl topo_vol2.stl') -print("running meshing script...") +print("# running meshing script...") print("") -print("note: this script uses topography surface in STL format") -print(" meshing will take around 2 min") +print("# note: this script uses topography surface in STL format") +print("# meshing will take around 2 min") print("") # note: this is a workaround to use STL file formats rather than ACIS formats. @@ -71,10 +100,10 @@ cubit.cmd('reset') #checks if new file available if not os.path.exists("topo_brick.stl"): - print("") - print("error creating new STL file topo_brick.stl, please check manually...") - print("") - cubit.cmd('pause') + print("") + print("# error creating new STL file topo_brick.stl, please check manually...") + print("") + cubit.cmd('pause') ############################################################# # @@ -84,18 +113,18 @@ # topography surface if os.path.exists("topo.stl"): - print("opening existing topography surface") - # previously run, just reopen the cubit file - cubit.cmd('import stl "topo.stl" merge stitch') + print("# opening existing topography surface") + # previously run, just reopen the cubit file + cubit.cmd('import stl "topo.stl" merge stitch') else: - # topo surface doesn't exist yet, this creates it: - print("reading in topography surface") - # reads in topography points and creates sheet surface - execfile("./read_topo.py") - # clear - cubit.cmd('reset') - # now reopen the cubit file - cubit.cmd('import stl "topo.stl" merge stitch') + # topo surface doesn't exist yet, this creates it: + print("# reading in topography surface") + # reads in topography points and creates sheet surface + execfile("./read_topo.py") + # clear + cubit.cmd('reset') + # now reopen the cubit file + cubit.cmd('import stl "topo.stl" merge stitch') # re-opens brick in STL format cubit.cmd('import stl "topo_brick.stl" merge stitch') @@ -114,10 +143,10 @@ cubit.cmd('reset') #checks if new file available if not os.path.exists("topo_vol.stl"): - print("") - print("error creating new STL file topo_vol.stl, please check manually...") - print("") - cubit.cmd('pause') + print("") + print("# error creating new STL file topo_vol.stl, please check manually...") + print("") + cubit.cmd('pause') ############################################################# # @@ -128,10 +157,10 @@ os.system('awk \'BEGIN{print \"solid Body_1\";}{if($0 !~ /solid/) print $0;}END{print \"endsolid Body_1\";}\' topo_vol.stl > topo_vol2.stl') #checks if new file available if not os.path.exists("topo_vol2.stl"): - print("") - print("error creating new STL file topo_vol2.stl, please check manually...") - print("") - cubit.cmd('pause') + print("") + print("# error creating new STL file topo_vol2.stl, please check manually...") + print("") + cubit.cmd('pause') ############################################################# # @@ -171,23 +200,30 @@ #### End of meshing +# re-indexes +cubit.cmd('compress all') + +# avoids assigning empty blocks +cubit.cmd('set duplicate block elements on') + ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') - +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic 1" ') # elastic material region -cubit.cmd('block 1 attribute count 6') +cubit.cmd('block 1 attribute count 7') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material cubit.cmd('block 1 attribute index 2 2800') # vp cubit.cmd('block 1 attribute index 3 1500') # vs cubit.cmd('block 1 attribute index 4 2300') # rho -cubit.cmd('block 1 attribute index 5 150.0') # Qmu -cubit.cmd('block 1 attribute index 6 0 ') # anisotropy_flag +cubit.cmd('block 1 attribute index 5 9999.0') # Qkappa +cubit.cmd('block 1 attribute index 6 150.0') # Qmu +cubit.cmd('block 1 attribute index 7 0 ') # anisotropy_flag # optional saves backups cubit.cmd('export mesh "top.e" dimension 3 overwrite') @@ -203,4 +239,5 @@ # all files needed by SCOTCH are now in directory MESH # time stamp +print("# all done") print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) diff --git a/EXAMPLES/applications/Mount_StHelens/read_topo.py b/EXAMPLES/applications/Mount_StHelens/read_topo.py index 1709d5fa0..c34684353 100755 --- a/EXAMPLES/applications/Mount_StHelens/read_topo.py +++ b/EXAMPLES/applications/Mount_StHelens/read_topo.py @@ -64,7 +64,8 @@ print('') cubit.cmd('Display') -cubit.cmd('pause') +#cubit.cmd('pause') +#cubit.cmd('resume') # creates surface print('#creating skin surface...') @@ -72,7 +73,8 @@ cubit.cmd('Display') -cubit.cmd('pause') +#cubit.cmd('pause') +#cubit.cmd('resume') # cleans up cubit.cmd('merge all ') @@ -80,6 +82,7 @@ cubit.cmd('delete curve all') print('#done cleaning up') + cubit.cmd('Display') cubit.cmd('echo on') diff --git a/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_boundary_definition.py b/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_boundary_definition.py index d5c33af56..4db8dc4a2 100755 --- a/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_boundary_definition.py +++ b/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_boundary_definition.py @@ -10,7 +10,9 @@ if "geocubitlib" in path: found_lib = True break -if not found_lib: sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') print("path:") for path in sys.path: print(" ",path) print("") diff --git a/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_cubit2specfem3d.py b/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_cubit2specfem3d.py index 32f6b3c95..d6429545c 100755 --- a/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_cubit2specfem3d.py +++ b/EXAMPLES/applications/coffee_mug_with_fluid_inside/run_cubit2specfem3d.py @@ -10,7 +10,9 @@ if "geocubitlib" in path: found_lib = True break -if not found_lib: sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') print("path:") for path in sys.path: print(" ",path) print("") diff --git a/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py b/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py index e76c63803..dabfdd93a 100644 --- a/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py +++ b/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py @@ -1,12 +1,27 @@ #!/usr/bin/env python from __future__ import print_function -import cubit -import boundary_definition -import cubit2specfem3d import math import os import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + +import cubit +import boundary_definition +import cubit2specfem3d + import numarray from save_fault_nodes_elements import * diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py b/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py index 1f2ca3968..20bd4c884 100644 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py @@ -1,17 +1,31 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit cubit.init([""]) try: - from geocubitlib import boundary_definition - from geocubitlib import cubit2specfem3d + from geocubitlib import boundary_definition + from geocubitlib import cubit2specfem3d except: import boundary_definition - import cubit2specfem3d + import cubit2specfem3d -import os -import sys # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py index f030109c3..85a9a63cf 100755 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py @@ -68,8 +68,18 @@ # # GEOCUBIT # -# adds path to geocubit (if not setup yet) -sys.path.append('../../../CUBIT_GEOCUBIT/') +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") print("path: ") print(sys.path) diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py index bfcf8d42d..3d61f5471 100755 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py @@ -4,15 +4,28 @@ import os import sys +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit cubit.init([""]) try: - from geocubitlib import boundary_definition - from geocubitlib import cubit2specfem3d + from geocubitlib import boundary_definition + from geocubitlib import cubit2specfem3d except: import boundary_definition - import cubit2specfem3d + import cubit2specfem3d # two volumes separating 134000x134000x60000 block horizontally cubit.cmd('reset') diff --git a/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py b/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py index 89dd78990..76a77f97d 100755 --- a/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py +++ b/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py @@ -14,6 +14,19 @@ # you can also explicitly set it here e.g. like: #sys.path.append('/opt/Trelis-15.0/bin/') +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + try: import cubit except ImportError: @@ -68,12 +81,6 @@ # # GEOCUBIT # -# adds path to geocubit (if not setup yet) -sys.path.append('../../../CUBIT_GEOCUBIT/') - -print("path: ") -print(sys.path) -print("") # avoids assigning empty blocks cubit.cmd('set duplicate block elements on') diff --git a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py index 401777176..95690c5e9 100755 --- a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py +++ b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py @@ -11,6 +11,19 @@ import os import sys +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + ## choose your size # hi-resolution #elementsize = 1196.4 diff --git a/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py b/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py index ec37a7ff0..63b95fa24 100755 --- a/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py +++ b/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py @@ -4,6 +4,19 @@ import os import sys +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit cubit.init([""]) @@ -23,13 +36,6 @@ # # GEOCUBIT # -# adds path to geocubit (if not setup yet) -sys.path.append('../../../CUBIT_GEOCUBIT/') - -print("path: ") -print(sys.path) -print("") - try: from geocubitlib import boundary_definition from geocubitlib import cubit2specfem3d diff --git a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py index ef5fdc5b8..ef3f4bf40 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py +++ b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py @@ -13,6 +13,19 @@ import os import sys +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + ## choose your size # hi-resolution #elementsize = 1196.4 diff --git a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer_verticalboundary.py b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer_verticalboundary.py index b8762711c..36510f361 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer_verticalboundary.py +++ b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer_verticalboundary.py @@ -1,9 +1,25 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + SEMoutput='MESH' CUBIToutput='MESH_GEOCUBIT' +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit try: cubit.init([""]) diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py index af8e88bf0..8393cf7e2 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py @@ -4,6 +4,19 @@ import os import sys +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + ########################################################################### #### TNM: This is the mesh generation, adapted from a journal file #### specific to the settings of Komatitsch and Tromp 1999, Fig.8 diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py index 0f98a86b3..e43214ec5 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py @@ -1,13 +1,26 @@ #!/usr/bin/env python from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - # two volumes separating whole 134000x134000x60000 block in middle vertically cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py index a282c3610..99e70668c 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py @@ -11,13 +11,26 @@ ########################################################################### from __future__ import print_function +import os +import sys + +# checks for path for modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + import cubit import boundary_definition import cubit2specfem3d -import os -import sys - cubit.cmd('reset') cubit.cmd('brick x 134000 y 134000 z 60000') From add15ad48f602c74201c5c1947aa526213f369b9 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 8 Apr 2024 16:43:00 +0200 Subject: [PATCH 09/56] fixes list iterator for newer python versions --- .../geocubitlib/absorbing_boundary.py | 122 ++++++++++-------- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/CUBIT_GEOCUBIT/geocubitlib/absorbing_boundary.py b/CUBIT_GEOCUBIT/geocubitlib/absorbing_boundary.py index d8b913110..875624e4d 100644 --- a/CUBIT_GEOCUBIT/geocubitlib/absorbing_boundary.py +++ b/CUBIT_GEOCUBIT/geocubitlib/absorbing_boundary.py @@ -62,33 +62,34 @@ def define_parallel_absorbing_surf(): absorbing_surf_bottom = [] top_surf = [] - list_vol = cubit.parse_cubit_list("volume","all") init_n_vol = len(list_vol) + zmax_box = cubit.get_total_bounding_box("volume",list_vol)[7] zmin_box = cubit.get_total_bounding_box("volume",list_vol)[6] #it is the z_min of the box ... box= xmin,xmax,d,ymin,ymax,d,zmin... xmin_box = cubit.get_total_bounding_box("volume",list_vol)[0] xmax_box = cubit.get_total_bounding_box("volume",list_vol)[1] ymin_box = cubit.get_total_bounding_box("volume",list_vol)[3] ymax_box = cubit.get_total_bounding_box("volume",list_vol)[4] + list_surf = cubit.parse_cubit_list("surface","all") - print('##boundary box: ') - print('## x min: ' + str(xmin_box)) - print('## y min: ' + str(ymin_box)) - print('## z min: ' + str(zmin_box)) - print('## x max: ' + str(xmax_box)) - print('## y max: ' + str(ymax_box)) - print('## z max: ' + str(zmax_box)) + print('## boundary box: ') + print('## x min: ' + str(xmin_box)) + print('## y min: ' + str(ymin_box)) + print('## z min: ' + str(zmin_box)) + print('## x max: ' + str(xmax_box)) + print('## y max: ' + str(ymax_box)) + print('## z max: ' + str(zmax_box)) #box lengths - x_len = abs( xmax_box - xmin_box) - y_len = abs( ymax_box - ymin_box) - z_len = abs( zmax_box - zmin_box) + dim_x = abs(xmax_box - xmin_box) + dim_y = abs(ymax_box - ymin_box) + dim_z = abs(zmax_box - zmin_box) - print('##boundary box: ') - print('## x length: ' + str(x_len)) - print('## y length: ' + str(y_len)) - print('## z length: ' + str(z_len)) + print('## boundary box: ') + print('## x length: ' + str(dim_x)) + print('## y length: ' + str(dim_y)) + print('## z length: ' + str(dim_z)) # tolerance parameters absorbing_surface_distance_tolerance = 0.005 @@ -97,22 +98,34 @@ def define_parallel_absorbing_surf(): for k in list_surf: center_point = cubit.get_center_point("surface", k) - if abs((center_point[0] - xmin_box)/x_len) <= absorbing_surface_distance_tolerance: + + # relative distances to outer surfaces + dist_xmin = abs(center_point[0] - xmin_box) / dim_x + dist_xmax = abs(center_point[0] - xmax_box) / dim_x + dist_ymin = abs(center_point[1] - ymin_box) / dim_y + dist_ymax = abs(center_point[1] - ymax_box) / dim_y + dist_zmin = abs(center_point[2] - zmin_box) / dim_z + + #debug + #print("#debug: define_parallel_absorbing_surf: center {} dist {}/{}/{}/{}/{} - tol {}".format(center_point, \ + # dist_xmin,dist_xmax,dist_ymin,dist_ymax,dist_zmin,absorbing_surface_distance_tolerance)) + + # checks surface distances + if dist_xmin <= absorbing_surface_distance_tolerance: absorbing_surf_xmin.append(k) - elif abs((center_point[0] - xmax_box)/x_len) <= absorbing_surface_distance_tolerance: + elif dist_xmax <= absorbing_surface_distance_tolerance: absorbing_surf_xmax.append(k) - elif abs((center_point[1] - ymin_box)/y_len) <= absorbing_surface_distance_tolerance: + elif dist_ymin <= absorbing_surface_distance_tolerance: absorbing_surf_ymin.append(k) - elif abs((center_point[1] - ymax_box)/y_len) <= absorbing_surface_distance_tolerance: + elif dist_ymax <= absorbing_surface_distance_tolerance: absorbing_surf_ymax.append(k) - elif abs((center_point[2] - zmin_box)/z_len) <= absorbing_surface_distance_tolerance: - print('center_point[2] ' + str(center_point[2])) - print('kz: ' + str(k)) + elif dist_zmin <= absorbing_surface_distance_tolerance: + #print('#debug: center_point[2] ' + str(center_point[2])) + #print('#debug: kz: ' + str(k)) absorbing_surf_bottom.append(k) - else: sbox = cubit.get_bounding_box('surface',k) - dz = abs((sbox[7] - zmax_box)/z_len) + dz = abs(sbox[7] - zmax_box) / dim_z normal = cubit.get_surface_normal(k) zn = normal[2] dn = abs(zn-1) @@ -120,14 +133,14 @@ def define_parallel_absorbing_surf(): top_surf.append(k) # checking list sizes before return - len_return_items = [len(liste) for liste in \ - absorbing_surf_xmin,absorbing_surf_xmax,absorbing_surf_ymin,absorbing_surf_ymax,\ - absorbing_surf_bottom,top_surf] - if (0 in len_return_items ): - print ('WARNING::define_parallel_absorbing_surf:: empty return list(s). try increasing tolerance!') + len_return_items = [len(liste) for liste in (absorbing_surf_xmin,absorbing_surf_xmax,absorbing_surf_ymin,absorbing_surf_ymax,absorbing_surf_bottom,top_surf)] + + # check surface list lengths + if 0 in len_return_items: + print('ERROR: define_parallel_absorbing_surf: empty return list(s). try increasing tolerance!') + print(' surface list lengths: ',len_return_items) import sys sys.exit() - ## return absorbing_surf_xmin,absorbing_surf_xmax,absorbing_surf_ymin,absorbing_surf_ymax,absorbing_surf_bottom,top_surf @@ -159,23 +172,23 @@ def define_top_bottom_absorbing_surf(zmin_box,zmax_box): ymax_box = cubit.get_total_bounding_box("volume",list_vol)[4] list_surf = cubit.parse_cubit_list("surface","all") - print('##boundary box: ') - print('## x min: ' + str(xmin_box)) - print('## y min: ' + str(ymin_box)) - print('## z min: ' + str(zmin_box)) - print('## x max: ' + str(xmax_box)) - print('## y max: ' + str(ymax_box)) - print('## z max: ' + str(zmax_box)) + print('## boundary box: ') + print('## x min: ' + str(xmin_box)) + print('## y min: ' + str(ymin_box)) + print('## z min: ' + str(zmin_box)) + print('## x max: ' + str(xmax_box)) + print('## y max: ' + str(ymax_box)) + print('## z max: ' + str(zmax_box)) #box lengths x_len = abs( xmax_box - xmin_box) y_len = abs( ymax_box - ymin_box) z_len = abs( zmax_box - zmin_box) - print('##boundary box: ') - print('## x length: ' + str(x_len)) - print('## y length: ' + str(y_len)) - print('## z length: ' + str(z_len)) + print('## boundary box: ') + print('## x length: ' + str(x_len)) + print('## y length: ' + str(y_len)) + print('## z length: ' + str(z_len)) # tolerance parameters absorbing_surface_distance_tolerance = 0.005 @@ -185,8 +198,8 @@ def define_top_bottom_absorbing_surf(zmin_box,zmax_box): for k in list_surf: center_point = cubit.get_center_point("surface", k) if abs((center_point[2] - zmin_box)/z_len) <= absorbing_surface_distance_tolerance: - print('center_point[2] ' + str(center_point[2])) - print('kz: ' + str(k)) + #print('#debug: center_point[2] ' + str(center_point[2])) + #print('#debug: kz: ' + str(k)) absorbing_surf_bottom.append(k) else: @@ -265,6 +278,13 @@ def build_block_side(surf_list,name,obj='surface'): id_nodeset = cubit.get_next_nodeset_id() id_block = cubit.get_next_block_id() + # check if surface list is empty + if len(surf_list) == 0: + print("#") + print("# zero {} surface found, please create block manually...".format(name)) + print("#") + return + if obj == 'hex': txt='hex in node in surface' txt1='block '+str(id_block)+ ' '+ txt +' '+str(list(surf_list)) @@ -299,9 +319,9 @@ def define_bc(entities,zmin,zmax,self): bottom,topo = define_top_bottom_absorbing_surf(zmin,zmax) v_list,name_list = define_block() build_block(v_list,name_list) - print(entities) + #print("#debug: entities: ",entities) for entity in entities: - print("##entity: "+str(entity)) + print("## entity: "+str(entity)) build_block_side(xmin,entity+'_abs_xmin',obj=entity) build_block_side(xmax,entity+'_abs_xmax',obj=entity) build_block_side(ymin,entity+'_abs_ymin',obj=entity) @@ -320,9 +340,9 @@ def define_parallel_bc(entities): xmin,xmax,ymin,ymax,bottom,topo = define_parallel_absorbing_surf() v_list,name_list = define_block() build_block(v_list,name_list) - print(entities) + #print("#debug: entities: ",entities) for entity in entities: - print("##entity: "+str(entity)) + print("## entity: "+str(entity)) build_block_side(xmin,entity+'_abs_xmin',obj=entity) build_block_side(xmax,entity+'_abs_xmax',obj=entity) build_block_side(ymin,entity+'_abs_ymin',obj=entity) @@ -337,9 +357,9 @@ def define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax): topo = zmax v_list,name_list = define_block() build_block(v_list,name_list) - print(entities) + #print("#debug: entities: ",entities) for entity in entities: - print("##entity: "+str(entity)) + print("## entity: "+str(entity)) build_block_side(xmin,entity+'_abs_xmin',obj=entity) build_block_side(xmax,entity+'_abs_xmax',obj=entity) build_block_side(ymin,entity+'_abs_ymin',obj=entity) @@ -357,9 +377,9 @@ def define_bc_topo(entities,self): topo = self.topo v_list,name_list = define_block() build_block(v_list,name_list) - print(entities) + #print("#debug: entities: ",entities) for entity in entities: - print("##entity: "+str(entity)) + print("## entity: "+str(entity)) build_block_side(xmin,entity+'_abs_xmin',obj=entity) build_block_side(xmax,entity+'_abs_xmax',obj=entity) build_block_side(ymin,entity+'_abs_ymin',obj=entity) From 5f86fba51a1d4e51a8f73c3c196683e2557ec846 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 8 Apr 2024 16:44:11 +0200 Subject: [PATCH 10/56] adds center point check for top surfaces detection --- .../geocubitlib/boundary_definition.py | 135 +++++++++++------- 1 file changed, 80 insertions(+), 55 deletions(-) diff --git a/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py b/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py index 9ec8443bf..4dac26283 100755 --- a/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py +++ b/CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py @@ -286,26 +286,68 @@ def product(*args, **kwds): topographic_surface_normal_tolerance = 0.0004 dzmin_tolerance = 0.00001 + # tolerance factor for center point checks + # adding factor 0.1 for a relative tolerance to vertical mesh dimension + # + # note: using the splay_faults/ example, some of the internal fault surfaces would be assigned to the top free surface, since their bounding box top + # is at the height of the free surface, and their normals almost vertical and within the normal tolerance. + # to avoid taking these fault surfaces, we add here a check with the surface center point. the central points for those internal fault surfaces + # are distant enough to the free surface top and thus we can distinguish them from the actual mesh surfaces at the top. + # + # another example to check is the Mount_StHelens/ example where the top free surface has topography. + # due to the mesh dimensions (rather shallow mesh for the given topography) and the top surface center point being too far below the top of the bounding box, + # the center point check will fail with the current tolerance. + # however, the top surface will be recognized in a subsequent step by the additional get_v_h_list() routine call below. + # + # when changing these tolerance values, please check using splay_faults/ and Mount_StHelens/ examples. + topographic_surface_center_distance_tolerance = 0.1 * topographic_surface_distance_tolerance + dzmin_center_tolerance = 0.1 * dzmin_tolerance + lv = [] for k in list_surf: sbox = cubit.get_bounding_box('surface', k) + #debug + #print("#debug: define_surf: surface {} sbox[6]/sbox[7] = {}/{}".format(k,sbox[6],sbox[7])) + + # checks distance to top surface using bounding box if zmax_box == 0 and sbox[7] == 0: - dzmax = 0 + dzmax = 0.0 elif zmax_box == 0 or sbox[7] == 0: dzmax = abs(sbox[7] - zmax_box) else: dzmax = abs(sbox[7] - zmax_box) / max(abs(sbox[7]), abs(zmax_box)) + + # checks distance to bottom surface using bounding box if zmin_box == 0 and sbox[6] == 0: - dzmin = 0 + dzmin = 0.0 elif zmin_box == 0 or sbox[6] == 0: dzmin = abs(sbox[6] - zmin_box) else: dzmin = abs(sbox[6] - zmin_box) / max(abs(sbox[6]), abs(zmin_box)) + + #debug + #print("#debug: define_surf: dzmin/dzmax = {}/{} - tol {}/{}".format(dzmin,dzmax,dzmin_tolerance,topographic_surface_distance_tolerance)) + + # surface center point + center_point = cubit.get_center_point('surface', k) + + # relative vertical distances to top/bottom mesh surfaces + dist_zmin = abs(center_point[2] - zmin_box) / dim_z + dist_zmax = abs(center_point[2] - zmax_box) / dim_z + + #debug + #print("#debug: define_surf: center {} dist {}/{} - tol {}/{}".format(center_point,dist_zmin,dist_zmax, \ + # dzmin_center_tolerance,topographic_surface_center_distance_tolerance)) + + # surface normal in vertical Z-direction normal = cubit.get_surface_normal(k) zn = normal[2] + + # top surface if dzmax <= topographic_surface_distance_tolerance and \ + dist_zmax <= topographic_surface_center_distance_tolerance and \ zn > topographic_surface_normal_tolerance: - + # adds surface id to top surfaces top_surf.append(k) list_vertex = cubit.get_relatives('surface', k, 'vertex') for v in list_vertex: @@ -314,11 +356,24 @@ def product(*args, **kwds): # valence 3 is a corner, 4 is a vertex between 2 volumes, # > 4 is a vertex not in the boundaries lv.append(v) - elif dzmin <= dzmin_tolerance and zn < -1 + topographic_surface_normal_tolerance: + # bottom surface + elif dzmin <= dzmin_tolerance and \ + dist_zmin <= dzmin_center_tolerance and \ + zn < (-1 + topographic_surface_normal_tolerance): + # adds surface id to bottom surfaces bottom_surf.append(k) + + #debug + #print("#debug: define_surf: total bottom_surf: ",bottom_surf) + #print("#debug: define_surf: total top_surf : ",top_surf) + if len(top_surf) == 0: # assuming that one topo surface need to be selected _, _, _, _, _, top_surf = get_v_h_list(list_vol, chktop=False) + #debug + #print("#debug: define_surf: total top_surf (w/ v_h): ",top_surf) + + # overall absorbing surface lp = [] labelp = [] combs = product(lv, lv) @@ -349,7 +404,8 @@ def product(*args, **kwds): if -1 <= center_point[0] <= 1 and -1 <= center_point[1] <= 1: absorbing_surf.append(k) break - # + + # lateral sides four_side = True if four_side: xmintmp, ymintmp, xmaxtmp, ymaxtmp = define_4side_lateral_surfaces() @@ -448,34 +504,38 @@ def build_block(vol_list, name, id_0=1, top_surf=None, optionsea=False): def build_block_side(surf_list, name, obj='surface', id_0=1): id_nodeset = cubit.get_next_nodeset_id() id_block = id_0 + + # check if surface list is empty + if len(surf_list) == 0: + print("#") + print("# zero {} surface found, please create block manually...".format(name)) + print("#") + return + if obj == 'hex': txt = 'hex in node in surface' - txt1 = 'block ' + str(id_block) + ' ' + txt + \ - ' ' + str(list(surf_list)) + txt1 = 'block ' + str(id_block) + ' ' + txt + ' ' + str(list(surf_list)) txt2 = "block " + str(id_block) + " name '" + name + "'" txt1 = txt1.replace("[", " ").replace("]", " ") cubit.cmd(txt1) cubit.cmd(txt2) elif obj == 'node': txt = obj + ' in surface' - txt1 = 'nodeset ' + str(id_nodeset) + ' ' + \ - txt + ' ' + str(list(surf_list)) + txt1 = 'nodeset ' + str(id_nodeset) + ' ' + txt + ' ' + str(list(surf_list)) txt1 = txt1.replace("[", " ").replace("]", " ") txt2 = "nodeset " + str(id_nodeset) + " name '" + name + "'" cubit.cmd(txt1) cubit.cmd(txt2) elif obj == 'face' or obj == 'edge': txt = obj + ' in surface' - txt1 = 'block ' + str(id_block) + ' ' + txt + \ - ' ' + str(list(surf_list)) + txt1 = 'block ' + str(id_block) + ' ' + txt + ' ' + str(list(surf_list)) txt1 = txt1.replace("[", " ").replace("]", " ") txt2 = "block " + str(id_block) + " name '" + name + "'" cubit.cmd(txt1) cubit.cmd(txt2) else: txt1 = '' - txt2 = "block " + str(id_block) + " name " + \ - name + "_notsupported (only hex,face,edge,node)" + txt2 = "block " + str(id_block) + " name " + name + "_notsupported (only hex,face,edge,node)" try: cubit.cmd('comment "' + txt1 + '"') cubit.cmd('comment "' + txt2 + '"') @@ -526,54 +586,19 @@ def define_bc(*args, **keys): print("## entity: " + str(entity)) # block for free surface (w/ topography) # print('## topo surface block: ' + str(topo)) - if len(top_surf) == 0: - print("#") - print("# no topo surface found, please create block face_topo manually...") - print("#") - else: - build_block_side(top_surf, entity + '_topo', - obj=entity, id_0=1001) + build_block_side(top_surf, entity + '_topo', obj=entity, id_0=1001) # model has parallel sides (e.g. a block model ) # xmin - blocks - if len(xmin) == 0: - print("#") - print("# zero abs_xmin surface found, please create block manually") - print("#") - else: - build_block_side(xmin, entity + '_abs_xmin', - obj=entity, id_0=1003) + build_block_side(xmin, entity + '_abs_xmin', obj=entity, id_0=1003) # xmax - blocks - if len(xmax) == 0: - print("#") - print("# zero abs_xmax surface found, please create block manually") - print("#") - else: - build_block_side(xmax, entity + '_abs_xmax', - obj=entity, id_0=1005) + build_block_side(xmax, entity + '_abs_xmax', obj=entity, id_0=1005) # ymin - blocks - if len(ymin) == 0: - print("#") - print("# zero abs_xmin surface found, please create block manually") - print("#") - else: - build_block_side(ymin, entity + '_abs_ymin', - obj=entity, id_0=1004) + build_block_side(ymin, entity + '_abs_ymin', obj=entity, id_0=1004) # ymax - blocks - if len(ymax) == 0: - print("#") - print("# zero abs_ymax surface found, please create block manually") - print("#") - else: - build_block_side(ymax, entity + '_abs_ymax', - obj=entity, id_0=1006) + build_block_side(ymax, entity + '_abs_ymax', obj=entity, id_0=1006) # bottom - blocks - if len(bottom_surf) == 0: - print("#") - print("# zero abs_bottom surf found, please create block manually") - print("#") - else: - build_block_side(bottom_surf, entity + - '_abs_bottom', obj=entity, id_0=1002) + build_block_side(bottom_surf, entity + '_abs_bottom', obj=entity, id_0=1002) + elif closed: # closed boundary surfaces # (for example sphere or cylinder-like models) From b81ef1220248476e2e0ef8aee59ef6c239e45cfc Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 24 Apr 2024 12:41:39 +0200 Subject: [PATCH 11/56] updates cubit scripts --- .../block_mesh-anisotropic.py | 3 +- .../block_mesh-anisotropic.py | 3 +- .../block_mesh-anisotropic.py | 3 +- .../block_mesh-anisotropic.py | 3 +- .../block_mesh-anisotropic.py | 3 +- .../block_mesh-anisotropic.py | 3 +- .../mesh_example_with_cubit.py | 2 + .../block_mesh.py | 29 +++---- .../applications/Mount_StHelens/mesh_mount.py | 5 +- .../Mount_StHelens/mesh_mount_stl.py | 5 +- .../create_mesh.py | 18 +++- .../3D_CUBIT_mesh/create_box_mesh.py | 14 +++- .../3D_CUBIT_mesh/create_semisphere_mesh.py | 14 +++- .../splay_faults/splay_faults.py | 51 ++++++++++-- .../fault_examples/tpv102/TPV102.py | 25 +++++- .../fault_examples/tpv103/TPV103.py | 45 +++++++++- .../fault_examples/tpv15/TPV15.py | 83 +++++++++++++++++-- .../fault_examples/tpv16/TPV16.py | 48 ++++++++++- .../applications/fault_examples/tpv5/TPV5.py | 70 ++++++++++++---- .../block_mesh-anisotropic.py | 6 +- .../create_mesh.py | 40 ++++----- .../block_mesh-anisotropic.py | 3 +- .../homogeneous_poroelastic/create_mesh.py | 6 +- .../2lay_mesh_boundary_fig8-nodoubling.py | 3 +- .../2lay_mesh_boundary_fig8.py | 25 +++--- .../tomographic_model/tomoblock_mesh.py | 1 + .../make_mesh_waterlayer-default.py | 3 +- .../waterlayer_mesh_boundary_fig8.py | 3 +- .../waterlayer_mesh_boundary_vertical.py | 3 +- .../waterlayer_only-nodoubling.py | 3 +- .../waterlayered_poroelastic/create_mesh.py | 3 +- .../curved_fault_mesh/create_box_mesh.py | 2 +- .../create_semisphere_mesh.py | 2 +- .../dipping_fault_planar_dip10_kink.py | 6 +- .../subductionzone_mesh/exportmesh.py | 4 +- 35 files changed, 422 insertions(+), 118 deletions(-) diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py index 4b4ec657b..ae24cef3c 100755 --- a/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/CPML_examples/homogeneous_halfspace_HEX8_elastic_absorbing_CPML_6sides/block_mesh-anisotropic.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py b/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py index 1eef6b2c5..f60acb74c 100755 --- a/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py +++ b/EXAMPLES/applications/Gmsh_simple_box_hex27/mesh_example_with_cubit.py @@ -119,6 +119,7 @@ cubit.cmd('block '+str(id_block)+' element type hex27') cubit.cmd('reset block '+str(id_block)) # bounding faces + print("#### DEFINE BC #######################") boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) from geocubitlib import cubit2specfem3d @@ -173,6 +174,7 @@ # Export to SPECFEM3D format # note: exportlib-commands will overwrite material properties # for hex27 elements + print("#### DEFINE BLOCKS #######################") if 1 == 1: exportlib.define_blocks(outdir='MESH/',save_cubfile=True,outfilename='top',hex27=True) exportlib.e2SEM(outdir='MESH/',hex27=True) diff --git a/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py b/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py index 51f7d1b99..fff43ca89 100755 --- a/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py +++ b/EXAMPLES/applications/LTS_homogeneous_halfspace_HEX8/block_mesh.py @@ -4,6 +4,19 @@ import os import sys +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') +#print("path:") +#for path in sys.path: print(" ",path) +#print("") + # default directories SEMoutput='MESH' os.system('mkdir -p '+ SEMoutput) @@ -52,19 +65,6 @@ #### End of meshing -# checks for path for modules -found_lib = False -for path in sys.path: - if "geocubitlib" in path: - found_lib = True - break -if not found_lib: - sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') - sys.path.append('../../../CUBIT_GEOCUBIT/') -#print("path:") -#for path in sys.path: print(" ",path) -#print("") - ## obsolete: #import boundary_definition #import cubit2specfem3d @@ -75,12 +75,13 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic 1" ') # elastic material region cubit.cmd('block 1 attribute count 7') diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py index 122a5b876..593ed25a7 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py @@ -15,7 +15,7 @@ import os.path import time -# checks for path for modules +# checks path for GEOCUBIT modules found_lib = False for path in sys.path: if "geocubitlib" in path: @@ -104,7 +104,8 @@ # topo surface doesn't exist yet, this creates it: print("# reading in topography surface") # reads in topography points and creates sheet surface - execfile("./read_topo.py") + # old: execfile("./read_topo.py") + exec(open("./read_topo.py").read()) # clear cubit.cmd('reset') # now reopen the cubit file diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py index 75b0d2b28..12713490b 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py @@ -41,7 +41,7 @@ print("") sys.exit("Import cubit failed") -cubit.init([""]) +cubit.init(["-noecho","-nojournal"]) # # GEOCUBIT @@ -120,7 +120,8 @@ # topo surface doesn't exist yet, this creates it: print("# reading in topography surface") # reads in topography points and creates sheet surface - execfile("./read_topo.py") + # old: execfile("./read_topo.py") + exec(open("./read_topo.py").read()) # clear cubit.cmd('reset') # now reopen the cubit file diff --git a/EXAMPLES/applications/coffee_mug_with_fluid_inside/create_mesh.py b/EXAMPLES/applications/coffee_mug_with_fluid_inside/create_mesh.py index 9da91a7a1..d43f5c3ff 100755 --- a/EXAMPLES/applications/coffee_mug_with_fluid_inside/create_mesh.py +++ b/EXAMPLES/applications/coffee_mug_with_fluid_inside/create_mesh.py @@ -5,6 +5,16 @@ import os import sys +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') + import cubit try: #cubit.init([""]) @@ -21,7 +31,7 @@ cubit.cmd('set duplicate block elements on') # mesh -#cubit.cmd('open "coffee_cup_with_handle_CUBIT_mesh.cub"') +cubit.cmd('open "coffee_cup_with_handle_CUBIT_mesh.cub"') ## block definitions # @@ -72,7 +82,13 @@ cubit.cmd('export mesh "cubit_mesh.e" dimension 3 overwrite') cubit.cmd('save as "cubit_mesh.cub" overwrite') +# +# GEOCUBIT +# +from geocubitlib import cubit2specfem3d +#### Export to SPECFEM3D format using cubit2specfem3d.py of GEOCUBIT +cubit2specfem3d.export2SPECFEM3D('MESH') diff --git a/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_box_mesh.py b/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_box_mesh.py index b995353b6..86327ed20 100755 --- a/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_box_mesh.py +++ b/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_box_mesh.py @@ -357,7 +357,7 @@ #absorbing_boundary.define_boundaries(entities, xmin,xmax,ymin,ymax,bottom,topo) #### Define material properties for the 4 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') for i in range(Vol_num): cubit.cmd('block {0} name "elastic {0}" '.format(i+1)) # material region cubit.cmd('block {0} attribute count {1}'.format(i+1,6)) @@ -374,6 +374,18 @@ else: cubit2specfem3d.export2SPECFEM3D('MESH') +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + # You need to create fault mesh file in the last, if using hex27. faultA = save_fault_nodes_elements.fault_input(1,Au,Ad) diff --git a/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_semisphere_mesh.py b/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_semisphere_mesh.py index d9ab9130d..42d880f9d 100755 --- a/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_semisphere_mesh.py +++ b/EXAMPLES/applications/fault_examples/hete_fault_properties/3D_CUBIT_mesh/create_semisphere_mesh.py @@ -297,7 +297,7 @@ #### Define material properties for the 4 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') for i in range(Vol_num): cubit.cmd('block {0} name "elastic {0}" '.format(i+1)) # material region cubit.cmd('block {0} attribute count {1}'.format(i+1,6)) @@ -314,6 +314,18 @@ else: cubit2specfem3d.export2SPECFEM3D('MESH') +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + # You need to create fault mesh file in the last, if using hex27. faultA = save_fault_nodes_elements.fault_input(1,Au,Ad) diff --git a/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py b/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py index dabfdd93a..ce9e59c1a 100644 --- a/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py +++ b/EXAMPLES/applications/fault_examples/splay_faults/splay_faults.py @@ -5,26 +5,31 @@ import os import sys -# checks for path for modules +# checks path for GEOCUBIT modules found_lib = False for path in sys.path: if "geocubitlib" in path: found_lib = True break if not found_lib: - sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') - sys.path.append('../../../CUBIT_GEOCUBIT/') -#print("path:") -#for path in sys.path: print(" ",path) -#print("") + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') import cubit import boundary_definition import cubit2specfem3d -import numarray from save_fault_nodes_elements import * +# CUBIT +cubit.init(["-noecho","-nojournal"]) + +print("#") +print("## cubit version:") +print("#") +cubit.cmd('version') + +# clean workspace cubit.cmd('reset') km = 1000 @@ -169,7 +174,7 @@ cubit.cmd('curve 8 10 7 9 scheme equal') cubit.cmd('mesh curve 8 10 7 9') cubit.cmd("surface 13 18 size "+str(elementsize)) -cubit.cmd("volume 1 2 3 size "+str(elementsize)) +cubit.cmd("volume 1 2 size "+str(elementsize)) cubit.cmd("surface 13 18 scheme pave") cubit.cmd("mesh surface 13 18 ") cubit.cmd("mesh volume 1 2 ") @@ -178,22 +183,50 @@ ########## loading cracks ####### #SAVING FAULT NODES AND ELEMENTS. os.system('mkdir -p MESH') + ########## FAULT A ############################################################## Au = [8,15] #face_up Ad = [6,7] #face_down + +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault A up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault A down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultA = fault_input(1,Au,Ad) ########## FAULT BC ############################################################## BCu = [9,10] #face_up BCd = [14,17] #face_down + +# fault surface info +print("#") +# fault up +for k in BCu: + center_point = cubit.get_center_point("surface", k) + print("# fault BC up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in BCd: + center_point = cubit.get_center_point("surface", k) + print("# fault BC down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultBC = fault_input(2,BCu,BCd) ### Exporting the mesh to cubit. +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 2 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') # Material properties in concordance with tpv5 benchmark. diff --git a/EXAMPLES/applications/fault_examples/tpv102/TPV102.py b/EXAMPLES/applications/fault_examples/tpv102/TPV102.py index d463287df..6c6d433e9 100755 --- a/EXAMPLES/applications/fault_examples/tpv102/TPV102.py +++ b/EXAMPLES/applications/fault_examples/tpv102/TPV102.py @@ -5,6 +5,16 @@ import os import sys +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') + import cubit try: #cubit.init([""]) @@ -58,9 +68,10 @@ ymax = [5] zmax = [8,15] zmin = [10,14] -entities=['face'] # bounding faces +print("#### DEFINE BC #######################") +entities=['face'] absorbing_boundary.define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax) # Define material properties @@ -97,6 +108,18 @@ Au = [8] # A_up Ad = [3] # A_down +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + # create fault mesh files faultA = save_fault_nodes_elements.fault_input(1,Au,Ad) diff --git a/EXAMPLES/applications/fault_examples/tpv103/TPV103.py b/EXAMPLES/applications/fault_examples/tpv103/TPV103.py index d17d65f79..d3cc1a0de 100644 --- a/EXAMPLES/applications/fault_examples/tpv103/TPV103.py +++ b/EXAMPLES/applications/fault_examples/tpv103/TPV103.py @@ -3,15 +3,37 @@ # Surendra Nadh Somala, Caltech 2012 from __future__ import print_function +import os +import sys + +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') + import cubit import cubit2specfem3d -import os -import sys from save_fault_nodes_elements import * from absorbing_boundary import * from boundary_definition import * +# CUBIT +cubit.init(["-noecho","-nojournal"]) + +print("#") +print("## cubit version:") +print("#") +cubit.cmd('version') + +# clean workspace +cubit.cmd('reset') + cubit.cmd('playback "TPV103.jou" ') os.system('mkdir -p MESH') @@ -22,9 +44,15 @@ ymax = [5] zmax = [8,15] zmin = [10,14] + +# bounding faces +print("#### DEFINE BC #######################") entities=['face'] define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax) +# Define material properties +print("#### DEFINE MATERIAL PROPERTIES #######################") + cubit.cmd('block 1 name "elastic 1" ') # elastic material cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material @@ -49,4 +77,17 @@ Au = [8] # A_up Ad = [3] # A_down + +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultA = fault_input(1,Au,Ad) diff --git a/EXAMPLES/applications/fault_examples/tpv15/TPV15.py b/EXAMPLES/applications/fault_examples/tpv15/TPV15.py index 3bda58d8b..7bf338f51 100644 --- a/EXAMPLES/applications/fault_examples/tpv15/TPV15.py +++ b/EXAMPLES/applications/fault_examples/tpv15/TPV15.py @@ -2,15 +2,55 @@ # Percy. Script for TPV14-TPV15 SCEC benchmarks. from __future__ import print_function -import cubit -import cubit2specfem3d import math import os import sys + +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') + +import cubit +import cubit2specfem3d + from save_fault_nodes_elements import * from absorbing_boundary import * from boundary_definition import * +# CUBIT +cubit.init(["-noecho","-nojournal"]) + +print("#") +print("## cubit version:") +print("#") +cubit.cmd('version') +print("#") +# gets version string +cubit_version = cubit.get_version() +print("version: ",cubit_version) + +# extracts major number +v = cubit_version.split('.') +cubit_version_major = int(v[0]) +print("major version number: ",cubit_version_major) + +# version check: script only works for older cubit versions +if cubit_version_major >= 2020: + print("#") + print("# WARNING: Sorry, this script only works for older Cubit versions.") + print("# newer versions like this one will fail meshing the first surface 1 using the pave scheme.") + print("# Please try with an older version - exiting...") + print("#") + sys.exit(1) + # newer versions would also need the legacy sweeper to avoid sweep warnings + #cubit.cmd('set legacy sweeper on') + cubit.cmd('reset') km = 1000 @@ -192,18 +232,26 @@ cubit.cmd("surface 1 2 size "+str(h_size)) cubit.cmd("volume 1 2 size "+str(h_size)) + +# note: meshing surface 1 with the pave scheme will only work on older cubit versions... cubit.cmd("surface 1 2 scheme pave") cubit.cmd("mesh surface 1 2") + +#debug for checking meshed surfaces +cubit.cmd('pause') +#cubit.cmd('resume') + cubit.cmd("mesh volume 1 2") -bia=1.03 -inter= 40 +bia = 1.03 +inter = 40 ## Meshing Aristas ##### cubit.cmd('curve 95 97 99 101 103 105 107 109 interval '+str(inter)) cubit.cmd('curve 95 97 99 101 103 105 107 109 scheme bias factor '+str(bia)) cubit.cmd('mesh curve 95 97 99 101 103 105 107 109') + ### meshing chuncks ####### ### CHUNCK 1 cubit.cmd('volume 12 scheme Sweep source surface 8 13 3 target surface 71 rotate off') @@ -230,23 +278,48 @@ Au = [6,7] # A_up Ad = [5,14] # A_down +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# main fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# main fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultA = fault_input(1,Au,Ad) ####### Branch Fault############################################################################## Bu = [4] # B_up Bd = [15] # B_down +# fault surface info +print("#") +# fault up +for k in Bu: + center_point = cubit.get_center_point("surface", k) + print("# branch fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Bd: + center_point = cubit.get_center_point("surface", k) + print("# branch fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultB = fault_input(2,Bu,Bd) ## FOR THE BULK (Seismic wave propagation part for SPECFEM3D) ####### This is boundary_definition.py of GEOCUBIT ##..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') entities=['face'] define_parallel_bc(entities) #### Define material properties for the 2 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') # Material properties in concordance with tpv14-15 benchmark. diff --git a/EXAMPLES/applications/fault_examples/tpv16/TPV16.py b/EXAMPLES/applications/fault_examples/tpv16/TPV16.py index 67ceabe79..8340d2323 100644 --- a/EXAMPLES/applications/fault_examples/tpv16/TPV16.py +++ b/EXAMPLES/applications/fault_examples/tpv16/TPV16.py @@ -1,17 +1,39 @@ -#!python #!/usr/bin/env python # Surendra Nadh Somala, Caltech 2012 from __future__ import print_function +import os +import sys + +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') + import cubit import cubit2specfem3d -import os -import sys from save_fault_nodes_elements import * from absorbing_boundary import * from boundary_definition import * +# CUBIT +cubit.init(["-noecho","-nojournal"]) + +print("#") +print("## cubit version:") +print("#") +cubit.cmd('version') + +# clean workspace +cubit.cmd('reset') + +# use journal file cubit.cmd('playback "TPV16.jou" ') os.system('mkdir -p MESH') @@ -21,9 +43,14 @@ ymax = [12,15] zmax = [9,14] zmin = [11,16] + +print('#### DEFINE BC #######################') + entities=['face'] define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax) +print('#### DEFINE MATERIAL PROPERTIES #######################') + cubit.cmd('block 1 name "elastic 1" ') cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') @@ -48,9 +75,22 @@ cubit2specfem3d.export2SPECFEM3D('MESH') - +# fault surfaces Au = [8] # A_up Ad = [3] # A_down + +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") + faultA = fault_input(1,Au,Ad) diff --git a/EXAMPLES/applications/fault_examples/tpv5/TPV5.py b/EXAMPLES/applications/fault_examples/tpv5/TPV5.py index 8b5b0602e..ffceab079 100755 --- a/EXAMPLES/applications/fault_examples/tpv5/TPV5.py +++ b/EXAMPLES/applications/fault_examples/tpv5/TPV5.py @@ -5,6 +5,16 @@ import os import sys +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../../CUBIT_GEOCUBIT/') + import cubit try: #cubit.init([""]) @@ -25,23 +35,22 @@ # GEOCUBIT # # adds path to geocubit (if not setup yet) -sys.path.append('../../../../CUBIT_GEOCUBIT/') - +#sys.path.append('../../../../CUBIT_GEOCUBIT/') # in case importing menu fails due to import utilities errors to find, # this will add the geocubitlib/ folder to the sys.path: import geocubitlib -sys.path.append(geocubitlib.__path__[0]) -print("path: ") -print(sys.path) -print("") +#sys.path.append(geocubitlib.__path__[0]) +#print("path: ") +#print(sys.path) +#print("") from geocubitlib import absorbing_boundary from geocubitlib import save_fault_nodes_elements from geocubitlib import cubit2specfem3d -km = 1000 -z_surf = 0*km +km = 1000.0 +z_surf = 0.0 #### initializing coordinates x,y,z x = [] # fault @@ -127,18 +136,43 @@ cubit.cmd("surface 1 scheme pave") cubit.cmd("mesh surface 1") cubit.cmd("mesh volume 1") -cubit.cmd("unmerge surface 2 3") -# clean up sheet bodies -cubit.cmd("delete volume 2 3") +cubit.cmd("compress all") + +# sets fault surfaces IDs +if cubit_version_major < 2020: + # w/ older cubit versions + cubit.cmd("unmerge surface 2 3") + # clean up sheet bodies + cubit.cmd("delete volume 2 3") + + ########### Fault elements and nodes ############### + # fault surfaces (up/down) + Au = [2] + Ad = [3] +else: + # w/ newer cubit versions (latest 2024.3) + # clean up sheet bodies + cubit.cmd("delete volume 2 3") + ########### Fault elements and nodes ############### + # fault surfaces (up/down) + Au = [6] + Ad = [7] + +# fault surface info +print("#") +# fault up +for k in Au: + center_point = cubit.get_center_point("surface", k) + print("# fault up : surface {} has center point: {}".format(k,center_point)) +# fault down +for k in Ad: + center_point = cubit.get_center_point("surface", k) + print("# fault down: surface {} has center point: {}".format(k,center_point)) +print("#") os.system('mkdir -p MESH') -########### Fault elements and nodes ############### -# fault surfaces (up/down) -Au = [2] -Ad = [3] - faultA = save_fault_nodes_elements.fault_input(1,Au,Ad) # FOR THE BULK (Seismic wave propagation part for SPECFEM3D) @@ -147,12 +181,12 @@ #..... which extracts the bounding faces and defines them into blocks #entities=['face'] # this is a deprecated boundary definition function #boundary_definition.define_bc(entities,parallel=True) - +print('#### DEFINE BC #######################') entities=['face'] absorbing_boundary.define_parallel_bc(entities) # in absorbing_boundary.py #### Define material properties for the 2 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') # Material properties in concordance with tpv5 benchmark. diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py b/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py index 20bd4c884..c5b698c15 100644 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX27_elastic_no_absorbing/block_mesh-anisotropic.py @@ -18,7 +18,8 @@ #print("") import cubit -cubit.init([""]) +cubit.init(["-noecho","-nojournal"]) + try: from geocubitlib import boundary_definition from geocubitlib import cubit2specfem3d @@ -47,11 +48,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py index 85a9a63cf..b5096ee90 100755 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py @@ -14,22 +14,32 @@ # you can also explicitly set it here e.g. like: #sys.path.append('/opt/Trelis-15.0/bin/') +# checks path for GEOCUBIT modules +found_lib = False +for path in sys.path: + if "geocubitlib" in path: + found_lib = True + break +if not found_lib: + sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') + sys.path.append('../../../CUBIT_GEOCUBIT/') + +print("path: ") +print(sys.path) +print("") + try: import cubit except ImportError: print("Error: Importing cubit as python module failed") print("could not import cubit, please check your PYTHONPATH settings...") print("") - print("current path: ") - print(sys.path) - print("") print("try to include path to directory which includes file cubit.py, e.g. /opt/Trelis-15.0/bin/") print("") sys.exit("Import cubit failed") -print(sys.path) - -cubit.init([""]) +# CUBIT +cubit.init(["-noecho","-nojournal"]) # gets version string cubit_version = cubit.get_version() @@ -68,22 +78,6 @@ # # GEOCUBIT # -# checks for path for modules -found_lib = False -for path in sys.path: - if "geocubitlib" in path: - found_lib = True - break -if not found_lib: - sys.path.append('../../../CUBIT_GEOCUBIT/geocubitlib') - sys.path.append('../../../CUBIT_GEOCUBIT/') -#print("path:") -#for path in sys.path: print(" ",path) -#print("") - -print("path: ") -print(sys.path) -print("") # avoids assigning empty blocks cubit.cmd('set duplicate block elements on') @@ -98,6 +92,7 @@ if use_explicit == 1: from geocubitlib import boundary_definition # bounding faces + print("#### DEFINE BC #######################") boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) from geocubitlib import cubit2specfem3d @@ -144,6 +139,7 @@ print("") # Export to SPECFEM3D format # note: exportlib-commands will overwrite material properties + print("#### DEFINE BLOCKS #######################") exportlib.define_blocks(outdir='MESH/',save_cubfile=True,outfilename='top') exportlib.e2SEM(outdir='MESH/') # Define material properties diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py index 3d61f5471..d37283eb5 100755 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_no_absorbing/block_mesh-anisotropic.py @@ -47,11 +47,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py b/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py index 76a77f97d..6ec58295b 100755 --- a/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py +++ b/EXAMPLES/applications/homogeneous_poroelastic/create_mesh.py @@ -40,9 +40,7 @@ print("") sys.exit("Import cubit failed") -print(sys.path) - -cubit.init([""]) +cubit.init(["-noecho","-nojournal"]) # gets version string cubit_version = cubit.get_version() @@ -95,6 +93,7 @@ if use_explicit == 1: from geocubitlib import boundary_definition # bounding faces + print("#### DEFINE BC #######################") boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) from geocubitlib import cubit2specfem3d @@ -133,6 +132,7 @@ print("exporting to SPECFEM3D-format:") print("") # Export to SPECFEM3D format + print("#### DEFINE BLOCKS #######################") # note: exportlib-commands will overwrite material properties exportlib.define_blocks(outdir='MESH/',save_cubfile=True,outfilename='top') exportlib.e2SEM(outdir='MESH/') diff --git a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py index 95690c5e9..ff549e299 100755 --- a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py +++ b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py @@ -111,11 +111,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic 1" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1 ') # volume 1 diff --git a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py index 13c53266d..044d7fdb6 100755 --- a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py +++ b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py @@ -11,17 +11,7 @@ import os import sys -# current working directory -print("current dir: ",os.getcwd()) - -# default directories -SEMoutput='MESH' -CUBIToutput='MESH_GEOCUBIT' - -os.system('mkdir -p '+ SEMoutput) -os.system('mkdir -p '+ CUBIToutput) - -# checks path for modules +# checks path for GEOCUBIT modules found_lib = False for path in sys.path: if "geocubitlib" in path: @@ -34,6 +24,16 @@ for path in sys.path: print(" ",path) print("") +# current working directory +print("current dir: ",os.getcwd()) + +# default directories +SEMoutput='MESH' +CUBIToutput='MESH_GEOCUBIT' + +os.system('mkdir -p '+ SEMoutput) +os.system('mkdir -p '+ CUBIToutput) + ## obsolete: #import boundary_definition #import cubit2specfem3d @@ -129,11 +129,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "elastic 1" ') # elastic material region cubit.cmd('block 1 attribute count 6') cubit.cmd('block 1 attribute index 1 1 ') # volume 1 diff --git a/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py b/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py index 63b95fa24..b52ec3461 100755 --- a/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py +++ b/EXAMPLES/applications/tomographic_model/tomoblock_mesh.py @@ -44,6 +44,7 @@ import cubit2specfem3d # bounding faces +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) diff --git a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py index ef3f4bf40..84095d03d 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py +++ b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py @@ -113,11 +113,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "acoustic 1" ') # acoustic material region cubit.cmd('block 1 attribute count 4') cubit.cmd('block 1 attribute index 1 1 ') # material 1 diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py index 8393cf7e2..fe312b2e1 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py @@ -101,6 +101,7 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) @@ -108,7 +109,7 @@ #boundary_definition.define_bc(parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "acoustic 1" ') # material region cubit.cmd('block 1 attribute count 4') cubit.cmd('block 1 attribute index 1 1 ') # volume 1 diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py index e43214ec5..45f528435 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_vertical.py @@ -41,11 +41,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "acoustic 1" ') # material region cubit.cmd('block 1 attribute count 4') cubit.cmd('block 1 attribute index 1 1') # flag for material: 1 for 1. material diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py index 99e70668c..c5ed17ce9 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py @@ -86,11 +86,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "acoustic 1" ') # acoustic material region cubit.cmd('block 1 attribute count 4') cubit.cmd('block 1 attribute index 1 1 ') # material 1 diff --git a/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py b/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py index 0bda2cf6c..767420f07 100755 --- a/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py +++ b/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py @@ -116,11 +116,12 @@ ###### This is boundary_definition.py of GEOCUBIT #..... which extracts the bounding faces and defines them into blocks +print('#### DEFINE BC #######################') boundary_definition.entities=['face'] boundary_definition.define_bc(boundary_definition.entities,parallel=True) #### Define material properties for the 3 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') cubit.cmd('block 1 name "acoustic 1" ') # acoustic material region cubit.cmd('block 1 attribute count 4') cubit.cmd('block 1 attribute index 1 1 ') # material 1 diff --git a/utils/dynamic_rupture/curved_fault_mesh/create_box_mesh.py b/utils/dynamic_rupture/curved_fault_mesh/create_box_mesh.py index 83e3403c9..9ee94a5e3 100755 --- a/utils/dynamic_rupture/curved_fault_mesh/create_box_mesh.py +++ b/utils/dynamic_rupture/curved_fault_mesh/create_box_mesh.py @@ -357,7 +357,7 @@ #absorbing_boundary.define_boundaries(entities, xmin,xmax,ymin,ymax,bottom,topo) #### Define material properties for the 4 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') for i in range(Vol_num): cubit.cmd('block {0} name "elastic {0}" '.format(i+1)) # material region cubit.cmd('block {0} attribute count {1}'.format(i+1,6)) diff --git a/utils/dynamic_rupture/curved_fault_mesh/create_semisphere_mesh.py b/utils/dynamic_rupture/curved_fault_mesh/create_semisphere_mesh.py index 6b2939f3f..4b92c5f61 100755 --- a/utils/dynamic_rupture/curved_fault_mesh/create_semisphere_mesh.py +++ b/utils/dynamic_rupture/curved_fault_mesh/create_semisphere_mesh.py @@ -296,7 +296,7 @@ #### Define material properties for the 4 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') for i in range(Vol_num): cubit.cmd('block {0} name "elastic {0}" '.format(i+1)) # material region cubit.cmd('block {0} attribute count {1}'.format(i+1,6)) diff --git a/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py b/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py index e3c5a4d83..c977bb21d 100644 --- a/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py +++ b/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py @@ -173,14 +173,14 @@ def main(parameter): ymax = [10,13] zmin = [4,9] zmax = [6,7] # Free surface. - entities=['face'] + print('#### DEFINE BOUNDARIES #######################') + entities=['face'] define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax) - ##### USER: define material properties ################ - cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') + print('#### DEFINE MATERIAL PROPERTIES #######################') print('we are here') #for iblock in range(1,11,1): diff --git a/utils/dynamic_rupture/subductionzone_mesh/exportmesh.py b/utils/dynamic_rupture/subductionzone_mesh/exportmesh.py index 7adf2c6fd..8a1c10bce 100644 --- a/utils/dynamic_rupture/subductionzone_mesh/exportmesh.py +++ b/utils/dynamic_rupture/subductionzone_mesh/exportmesh.py @@ -72,12 +72,14 @@ def define_block_hex27(i): ymax = [27,36] zmax = [35,26,10,6,33,37,28,17] zmin = [16] + +print('#### DEFINE BOUNDARIES #######################') entities=['face'] define_boundaries(entities,xmin,xmax,ymin,ymax,zmin,zmax) #### Define material properties for the 2 volumes ################ -cubit.cmd('#### DEFINE MATERIAL PROPERTIES #######################') +print('#### DEFINE MATERIAL PROPERTIES #######################') for iblock in range(1,11,1): export_block(nb = iblock,vp=6000,vs=3464,rho=2670) From 6b0081e4bfa61de217d1527cf8b45a8763812c21 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 13 May 2024 17:51:10 +0200 Subject: [PATCH 12/56] updates gitignore (to avoid adding compiled my_mpi.mod to repo) --- .gitignore | 1 + my_mpi.mod | Bin 11109 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100644 my_mpi.mod diff --git a/.gitignore b/.gitignore index 3e8ce2f1e..c3130ac01 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ src/generate_databases/*.mod src/meshfem3D/*.mod src/specfem3D/*.mod *__genmod.f90 +./*.mod # documentation manual_SPECFEM3D_Cartesian.aux diff --git a/my_mpi.mod b/my_mpi.mod deleted file mode 100644 index 1c9828043e89a97b04a22c4106ce9db2f84d8fa7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11109 zcmcJVOKenC9LCRBpn&CBc@#ye15`xX(kc&MbZDm!nOA3~G>E3DSk%~{0TbQ1CN6ZP z!MHFXtPEkHaphyl!i}z6Dv3K26Jv}qZ2Z1+@9CX6kDhxj<0S1p)Beu)|L%A1J#+54 z(<5@?>Rut{gb;6@7#SWNJ}K@;yLT;q#jla!k)wmh28a3f`qy`txFy3^F53KWzc=* z7G10D+|p_xRdmM0Tl zMKTkfNTJrFOVDvF$E)SC=*gfOozgzl&@?u~i4dMNwg8c7Y(pb74R&@O$oZLyyyQYf zX~ZiUn#Fc0>dB%Pkj!ES8lkq?*=c)nrc@LUWKg9OziMb2JEf{8ja`6b8hvPlroqlm z-{oSXQJ5-<-5G>wCY5k#CVQl?CzA&O$xN6>XeR9Jv|g;&rwf&dQn4-`%Ag&2af~3E zc4#sWOW&Sk_5qT~Jd(jZJ3Et^s#oV~q8~tL;IxuLHZ+e%rK~59JRq3|)kBT5v(xxQ zp;>62s};rm49d~II?j_e<d2)bu2A z7?4cj2{b~_4|aCC&OA@06TfO`8b_q6CyhZsGL0cLLepSpr|)~2r_xL+;m}OvU7c@c zb`-T`CL?HsX2Q-+>zU`NbmCVHO=DE5dd`q10m(F;LL)Q{c6R#CI!~n$uV`o%$E2ty zi{pS~7AMdM&4QhswlmLD>BO%Zn#M_~>Ph2iKr)SI&IVH6{$&3M#$rR8Cb_9# z)|1CLAeqMm8licxv(tFnY%)}tZqg}-rc#v3o>V3Q$yBD$2=&g+PVX7#sr2E~Y+D#j zvD!H;HFLe)aw|k=|CxL2|AN*(T3d_FaFY|cv6i=blk;ojaGi3`u3@X&*e)K_azsVA?P?PM_36uSij^AV%V5mv< z>4Zrxi=;}j0xZ-d`*gx2m$XuutO5%)$v&Mh$%V*NCTqY#O|nlXOv2N;?p`*gx2AJL>b+znu%CfTPGCZoYS#W>l_V3K`oCb5QB zFXb;@lI!%h@oo%1{EXtWPR=sA@fq+6wtR7sr8s+-&jrV;l}58rX*L8GlimPy7Td)Y z=l~u|TEOp35RWZ2kRNe7;7pZ`S2K*tT)KG|+_|{&3TG)!_D3sg*5_^?>PqT!<-jP; z-TnZO+U*FkR3>=G1kJMi&^(SaLhUwg(T%E%<{FqeY#Fv>EJexvVQ^+m?&|p3q$Y2L zjiTIx8-UcVMv$c{!Mi4CmZiN}Jj+$P8sBpom3h>@1gDPh3TG)!wg;0HlQruf2D=1S z)lcs43=3QiyAAXuY?*i~YH>k4zutkHMh*ghAGk6iZ>J0oTwA>ZY93p9h$%~Xk|#Ep zq*O+vKvbu3GiXQ>^C%_l6W$^^G)F*sqqZKwSzG-PY2N~-3UWL%uQ6u0ttUC%W6DyNLzP*a0q)zBoW%)f zsZaPlJ8W9u&i@2hS>S+W*5@vbZccVSrYyxtUbT>BWezgGfK-(+XqknXP+?2k$Ogz# zm*B@HXqM#;{|-=<<*;Se8+_XKhkPKU>FO>K-Hq773<%Riby)+?ss(i94H(9MOoE|UWi%-=2 zc~y3%(!|qzUh=yzt9}_CjV%ZF2s*$G7BDoJhx{8&Q5{PS9R=El zd(u{2g*w!^UyJC{>Q|nonlw-S?=)%2Idr*;>-yStlS@$(=d+ayfLnbhu%iOc?=Q3p z@i3yvkAPgir(HfK9ooEbYv|FM3P({*m~)<+nlLekD#zu&HC22hXrjEn>iF_VYZ#y$ znsoXp=vJpZ#Whhn{YMie=1^s}r?3Lksv3VFYr@R-Gmx!rW745b$G>UXoM~vnbX?fm JE=)ikV From 0f185fc67255293a18189a66514f0470b84de40d Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 13 May 2024 18:31:18 +0200 Subject: [PATCH 13/56] updates gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c3130ac01..a4621c17e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ src/generate_databases/*.mod src/meshfem3D/*.mod src/specfem3D/*.mod *__genmod.f90 -./*.mod +my_mpi.mod # documentation manual_SPECFEM3D_Cartesian.aux From 9930e0528946d8560b1b49a4a3a61983003df24f Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 13 May 2024 18:49:41 +0200 Subject: [PATCH 14/56] updates actions workflow (for macOS) --- .github/workflows/CI.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2f60ee686..c8b89032a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -107,6 +107,10 @@ jobs: echo "PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV ## OpenMP echo "OMP_NUM_THREADS=2" >> $GITHUB_ENV + ## MPI + echo "MPI environment:" + echo "mpif90 on path: $(which mpif90)" + echo ## avoids MPI issue with number of slots echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV echo "OMPI_MCA_rmaps_base_inherit=1" >> $GITHUB_ENV @@ -122,6 +126,8 @@ jobs: - name: configure run: | ./configure + # checks exit code + if [[ $? -ne 0 ]]; then cat config.log; exit 1; fi echo "modifying external_libs/scotch/src/Makefile.inc" cp -v external_libs/scotch/src/Make.inc/Makefile.inc.i686_mac_darwin8 external_libs/scotch/src/Makefile.inc From 885c3f9fc0bfa67ebe0dbf6d71021ecfc6d578ff Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 13 May 2024 19:10:13 +0200 Subject: [PATCH 15/56] updates workflow --- .github/workflows/CI.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8b89032a..a879acdbf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -111,6 +111,8 @@ jobs: echo "MPI environment:" echo "mpif90 on path: $(which mpif90)" echo + # add OpenMPI path to have ./configure detect mpi.h + echo "MPI_INC=/opt/homebrew/include" >> $GITHUB_ENV ## avoids MPI issue with number of slots echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV echo "OMPI_MCA_rmaps_base_inherit=1" >> $GITHUB_ENV From a3267f25301c85cb9623e4984f534f4275603213 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 13 May 2024 19:21:42 +0200 Subject: [PATCH 16/56] updates workflow for macOS --- .github/workflows/CI.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a879acdbf..5220a9797 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -127,9 +127,8 @@ jobs: - name: configure run: | - ./configure - # checks exit code - if [[ $? -ne 0 ]]; then cat config.log; exit 1; fi + ./configure ; if [[ $? -ne 0 ]]; then cat config.log; exit 1; fi + # changes SCOTCH Makefile for macOS echo "modifying external_libs/scotch/src/Makefile.inc" cp -v external_libs/scotch/src/Make.inc/Makefile.inc.i686_mac_darwin8 external_libs/scotch/src/Makefile.inc From 203a09c466aaaa3b4d0956bd33a8ed2a1c674746 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 14 May 2024 15:20:18 +0200 Subject: [PATCH 17/56] updates workflow (sed path for macOS) --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5220a9797..08f1e4ecf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -104,10 +104,11 @@ jobs: echo "" ## avoids sed -i '' issue on MacOS, using gnu sed to have the same sed command lines as in linux brew install gnu-sed - echo "PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV + echo "PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV ## OpenMP echo "OMP_NUM_THREADS=2" >> $GITHUB_ENV ## MPI + echo echo "MPI environment:" echo "mpif90 on path: $(which mpif90)" echo From b9c7f6ddd2da8c8ea436c23f796314e27a81397e Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 5 Jun 2024 10:41:04 +0200 Subject: [PATCH 18/56] updates github action checkout version --- .github/workflows/CI.yml | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 08f1e4ecf..cad72697b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for changes id: diff @@ -86,7 +86,7 @@ jobs: needs: changesCheck steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: | @@ -150,7 +150,7 @@ jobs: os: [ubuntu-latest,ubuntu-20.04] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -169,7 +169,7 @@ jobs: needs: changesCheck steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache Intel oneapi packages id: cache-intel-oneapi @@ -304,7 +304,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -323,7 +323,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -347,7 +347,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -371,7 +371,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -396,7 +396,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -420,7 +420,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -445,7 +445,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -470,7 +470,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -496,7 +496,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -521,7 +521,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -545,7 +545,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -569,7 +569,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -593,7 +593,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -617,7 +617,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -641,7 +641,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -665,7 +665,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -689,7 +689,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -713,7 +713,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages run: ./.github/scripts/run_install.sh @@ -737,7 +737,7 @@ jobs: needs: [linuxCheck] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages env: From e9d5096dbf32e48313d0c1bbb92d904aa3591813 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 5 Jun 2024 10:41:48 +0200 Subject: [PATCH 19/56] updates mpi allreduce calls --- .../save_arrays_solver_adios.F90 | 2 +- src/generate_databases/save_moho_adios.F90 | 4 +- src/meshfem3D/save_databases_adios.F90 | 2 +- src/shared/parallel.f90 | 212 ++++++------------ src/shared/serial.f90 | 26 +-- src/specfem3D/save_forward_arrays_adios.F90 | 8 +- src/specfem3D/save_kernels_adios.F90 | 14 +- 7 files changed, 98 insertions(+), 170 deletions(-) diff --git a/src/generate_databases/save_arrays_solver_adios.F90 b/src/generate_databases/save_arrays_solver_adios.F90 index a42732919..fad0d3c95 100644 --- a/src/generate_databases/save_arrays_solver_adios.F90 +++ b/src/generate_databases/save_arrays_solver_adios.F90 @@ -208,7 +208,7 @@ subroutine save_arrays_solver_mesh_adios() ! calling wrapper instead to compile without mpi - call max_allreduce_i(max_global_values,num_vars) + call max_all_all_veci(max_global_values,num_vars) nglob_wmax = max_global_values(1) nspec_wmax = max_global_values(2) diff --git a/src/generate_databases/save_moho_adios.F90 b/src/generate_databases/save_moho_adios.F90 index 1c4a6dd97..e8ad2f4bd 100644 --- a/src/generate_databases/save_moho_adios.F90 +++ b/src/generate_databases/save_moho_adios.F90 @@ -61,8 +61,8 @@ subroutine crm_save_moho_adios() ! ADIOS write equally sized chunks for each processor. | !-----------------------------------------------------------------' ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,NSPEC_wmax) - call max_allreduce_singlei(nspec2d_moho,nspec2d_moho_wmax) + call max_all_all_i(NSPEC_AB,NSPEC_wmax) + call max_all_all_i(nspec2d_moho,nspec2d_moho_wmax) !-----------------------------------. ! Setup ADIOS for the current group | diff --git a/src/meshfem3D/save_databases_adios.F90 b/src/meshfem3D/save_databases_adios.F90 index 33631c722..1097fad33 100644 --- a/src/meshfem3D/save_databases_adios.F90 +++ b/src/meshfem3D/save_databases_adios.F90 @@ -674,7 +674,7 @@ subroutine save_databases_adios(LOCAL_PATH,sizeprocs, & max_global_values(11) = nspec_interfaces_max max_global_values(12) = nspec_CPML - call max_allreduce_i(max_global_values,num_vars) + call max_all_all_veci(max_global_values,num_vars) nglob_wmax = max_global_values(1) nspec_wmax = max_global_values(2) diff --git a/src/shared/parallel.f90 b/src/shared/parallel.f90 index e8515251d..ae994ca80 100644 --- a/src/shared/parallel.f90 +++ b/src/shared/parallel.f90 @@ -25,26 +25,31 @@ ! !===================================================================== -! Dimitri Komatitsch, July 2014, CNRS Marseille, France: -! added the ability to run several calculations (several earthquakes) -! in an embarrassingly-parallel fashion from within the same run; -! this can be useful when using a very large supercomputer to compute -! many earthquakes in a catalog, in which case it can be better from -! a batch job submission point of view to start fewer and much larger jobs, -! each of them computing several earthquakes in parallel. -! To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS to a value greater than 1 in the Par_file. -! To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators, -! each of them being labeled "my_local_mpi_comm_world", and we use them -! in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case -! we need to kill the entire run. -! When that option is on, of course the number of processor cores used to start -! the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS, -! all the individual runs must use the same number of processor cores, -! which as usual is NPROC in the input file DATA/Par_file, -! and thus the total number of processor cores to request from the batch system -! should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC. -! All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on -! (with exactly four digits). +! note by Dimitri Komatitsch, July 2014, CNRS Marseille, France: +! +! added the ability to run several calculations (several earthquakes) +! in an embarrassingly-parallel fashion from within the same run; +! this can be useful when using a very large supercomputer to compute +! many earthquakes in a catalog, in which case it can be better from +! a batch job submission point of view to start fewer and much larger jobs, +! each of them computing several earthquakes in parallel. +! +! To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS to a value greater than 1 in the Par_file. +! +! To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators, +! each of them being labeled "my_local_mpi_comm_world", and we use them +! in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case +! we need to kill the entire run. +! +! When that option is on, of course the number of processor cores used to start +! the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS, +! all the individual runs must use the same number of processor cores, +! which as usual is NPROC in the input file DATA/Par_file, +! and thus the total number of processor cores to request from the batch system +! should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC. +! +! All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on +! (with exactly four digits). !------------------------------------------------------------------------------------------------- ! @@ -60,6 +65,9 @@ module my_mpi implicit none + ! defines CUSTOM_MPI_TYPE for CUSTOM_REAL + include "precision.h" + ! my MPI groups integer :: my_local_mpi_comm_world integer :: my_local_mpi_comm_for_bcast @@ -376,8 +384,6 @@ subroutine bcast_all_cr(buffer, countval) implicit none - include "precision.h" - integer :: countval real(kind=CUSTOM_REAL), dimension(countval) :: buffer @@ -401,8 +407,6 @@ subroutine bcast_all_singlecr(buffer) implicit none - include "precision.h" - real(kind=CUSTOM_REAL) :: buffer integer :: ier @@ -626,8 +630,6 @@ subroutine bcast_all_cr_for_database(buffer, countval) implicit none - include "precision.h" - integer :: countval ! by not specifying any dimensions for the buffer here we can use this routine for arrays of any number ! of indices, provided we call the routine using the first memory cell of that multidimensional array, @@ -739,146 +741,138 @@ end subroutine min_all_all_i !------------------------------------------------------------------------------------------------- ! - subroutine max_all_i(sendbuf, recvbuf) + subroutine min_all_cr(sendbuf, recvbuf) use my_mpi + use constants, only: CUSTOM_REAL implicit none - integer :: sendbuf, recvbuf + real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier - call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,0,my_local_mpi_comm_world,ier) + call MPI_REDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MIN,0,my_local_mpi_comm_world,ier) - end subroutine max_all_i + end subroutine min_all_cr ! !------------------------------------------------------------------------------------------------- ! - subroutine max_all_all_i(sendbuf, recvbuf) + subroutine min_all_all_cr(sendbuf, recvbuf) use my_mpi + use constants, only: CUSTOM_REAL implicit none - integer :: sendbuf, recvbuf + real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier - call MPI_ALLREDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,my_local_mpi_comm_world,ier) + call MPI_ALLREDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MIN,my_local_mpi_comm_world,ier) - end subroutine max_all_all_i + end subroutine min_all_all_cr ! !------------------------------------------------------------------------------------------------- ! - subroutine max_allreduce_i(buffer,countval) + subroutine min_all_dp(sendbuf, recvbuf) use my_mpi implicit none - integer :: countval - integer,dimension(countval),intent(inout) :: buffer - - ! local parameters + double precision :: sendbuf, recvbuf integer :: ier - integer,dimension(countval) :: send - ! checks if anything to do - if (countval == 0) return - - ! seems not to be supported on all kind of MPI implementations... - !! DK DK: yes, I confirm, using MPI_IN_PLACE is tricky - !! DK DK (see the answer at http://stackoverflow.com/questions/17741574/in-place-mpi-reduce-crashes-with-openmpi - !! DK DK for how to use it right) - !call MPI_ALLREDUCE(MPI_IN_PLACE, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) - - send(:) = buffer(:) - - call MPI_ALLREDUCE(send, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) - if (ier /= 0) stop 'Allreduce to get max values failed.' + call MPI_REDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION,MPI_MIN,0,my_local_mpi_comm_world,ier) - end subroutine max_allreduce_i + end subroutine min_all_dp ! !------------------------------------------------------------------------------------------------- ! - subroutine max_allreduce_singlei(val,recvval) + subroutine min_all_all_dp(sendbuf, recvbuf) use my_mpi implicit none - integer,intent(in) :: val - integer,intent(out) :: recvval - - ! local parameters + double precision :: sendbuf, recvbuf integer :: ier - call MPI_ALLREDUCE(val, recvval, 1, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) - if (ier /= 0) stop 'Allreduce to get single max value failed.' + call MPI_ALLREDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION,MPI_MIN,my_local_mpi_comm_world,ier) - end subroutine max_allreduce_singlei + end subroutine min_all_all_dp ! !------------------------------------------------------------------------------------------------- ! - subroutine min_all_cr(sendbuf, recvbuf) + subroutine max_all_i(sendbuf, recvbuf) use my_mpi - use constants, only: CUSTOM_REAL implicit none - include "precision.h" - - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf + integer :: sendbuf, recvbuf integer :: ier - call MPI_REDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MIN,0,my_local_mpi_comm_world,ier) + call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,0,my_local_mpi_comm_world,ier) - end subroutine min_all_cr + end subroutine max_all_i ! !------------------------------------------------------------------------------------------------- ! - subroutine min_all_all_cr(sendbuf, recvbuf) + subroutine max_all_all_i(sendbuf, recvbuf) use my_mpi - use constants, only: CUSTOM_REAL implicit none - include "precision.h" - - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf + integer :: sendbuf, recvbuf integer :: ier - call MPI_ALLREDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MIN,my_local_mpi_comm_world,ier) + call MPI_ALLREDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,my_local_mpi_comm_world,ier) - end subroutine min_all_all_cr + end subroutine max_all_all_i ! !------------------------------------------------------------------------------------------------- ! - subroutine min_all_all_dp(sendbuf, recvbuf) + subroutine max_all_all_veci(buffer,countval) use my_mpi implicit none - double precision :: sendbuf, recvbuf + integer :: countval + integer,dimension(countval),intent(inout) :: buffer + + ! local parameters integer :: ier + integer,dimension(countval) :: send - call MPI_ALLREDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION,MPI_MIN,my_local_mpi_comm_world,ier) + ! checks if anything to do + if (countval == 0) return - end subroutine min_all_all_dp + ! seems not to be supported on all kind of MPI implementations... + !! DK DK: yes, I confirm, using MPI_IN_PLACE is tricky + !! DK DK (see the answer at http://stackoverflow.com/questions/17741574/in-place-mpi-reduce-crashes-with-openmpi + !! DK DK for how to use it right) + !call MPI_ALLREDUCE(MPI_IN_PLACE, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) + + send(:) = buffer(:) + + call MPI_ALLREDUCE(send, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) + if (ier /= 0) stop 'Allreduce to get max values failed.' + + end subroutine max_all_all_veci ! !------------------------------------------------------------------------------------------------- @@ -891,8 +885,6 @@ subroutine max_all_cr(sendbuf, recvbuf) implicit none - include "precision.h" - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier @@ -900,13 +892,6 @@ subroutine max_all_cr(sendbuf, recvbuf) end subroutine max_all_cr -! -!------------------------------------------------------------------------------------------------- -! - -! subroutine max_allreduce_cr(sendbuf, recvbuf) -! end subroutine max_allreduce_cr - ! !------------------------------------------------------------------------------------------------- ! @@ -918,8 +903,6 @@ subroutine max_all_all_cr(sendbuf, recvbuf) implicit none - include "precision.h" - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier @@ -927,23 +910,6 @@ subroutine max_all_all_cr(sendbuf, recvbuf) end subroutine max_all_all_cr -! -!------------------------------------------------------------------------------------------------- -! - - subroutine min_all_dp(sendbuf, recvbuf) - - use my_mpi - - implicit none - - double precision :: sendbuf, recvbuf - integer :: ier - - call MPI_REDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION,MPI_MIN,0,my_local_mpi_comm_world,ier) - - end subroutine min_all_dp - ! !------------------------------------------------------------------------------------------------- ! @@ -1059,8 +1025,6 @@ subroutine sum_all_cr(sendbuf, recvbuf) implicit none - include "precision.h" - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier @@ -1079,8 +1043,6 @@ subroutine sum_all_all_cr(sendbuf, recvbuf) implicit none - include "precision.h" - real(kind=CUSTOM_REAL) :: sendbuf, recvbuf integer :: ier @@ -1189,8 +1151,6 @@ subroutine isend_cr(sendbuf, sendcount, dest, sendtag, req) implicit none - include "precision.h" - integer :: sendcount, dest, sendtag, req real(kind=CUSTOM_REAL), dimension(sendcount) :: sendbuf @@ -1237,8 +1197,6 @@ subroutine irecv_cr(recvbuf, recvcount, dest, recvtag, req) implicit none - include "precision.h" - integer :: recvcount, dest, recvtag, req real(kind=CUSTOM_REAL), dimension(recvcount) :: recvbuf @@ -1366,8 +1324,6 @@ subroutine recvv_cr(recvbuf, recvcount, dest, recvtag ) implicit none - include "precision.h" - integer :: recvcount,dest,recvtag real(kind=CUSTOM_REAL),dimension(recvcount) :: recvbuf @@ -1527,8 +1483,6 @@ subroutine sendv_cr(sendbuf, sendcount, dest, sendtag) implicit none - include "precision.h" - integer :: sendcount,dest,sendtag real(kind=CUSTOM_REAL),dimension(sendcount) :: sendbuf integer :: ier @@ -1678,8 +1632,6 @@ subroutine gather_all_cr(sendbuf, sendcnt, recvbuf, recvcount, NPROC) implicit none - include "precision.h" - integer :: sendcnt, recvcount, NPROC real(kind=CUSTOM_REAL), dimension(sendcnt) :: sendbuf real(kind=CUSTOM_REAL), dimension(recvcount,0:NPROC-1) :: recvbuf @@ -1751,8 +1703,6 @@ subroutine gather_all_all_cr(sendbuf, recvbuf, counts, NPROC) implicit none - include "precision.h" - integer :: NPROC,counts real(kind=CUSTOM_REAL), dimension(counts) :: sendbuf real(kind=CUSTOM_REAL), dimension(counts,0:NPROC-1) :: recvbuf @@ -1797,8 +1747,6 @@ subroutine gatherv_all_cr(sendbuf, sendcnt, recvbuf, recvcount, recvoffset,recvc implicit none - include "precision.h" - integer :: sendcnt,recvcounttot,NPROC integer, dimension(NPROC) :: recvcount,recvoffset real(kind=CUSTOM_REAL), dimension(sendcnt) :: sendbuf @@ -1898,8 +1846,6 @@ end subroutine all_gather_all_ch ! ! implicit none ! -! include "precision.h" -! ! integer :: sendcnt,recvcounttot,NPROC ! integer, dimension(NPROC) :: recvcount,recvoffset ! double precision, dimension(sendcnt) :: sendbuf @@ -2487,8 +2433,6 @@ subroutine recvv_cr_inter(recvbuf, recvcount, dest, recvtag) implicit none - include "precision.h" - integer :: recvcount,dest,recvtag real(kind=CUSTOM_REAL),dimension(recvcount) :: recvbuf @@ -2510,8 +2454,6 @@ subroutine irecvv_cr_inter(recvbuf, recvcount, dest, recvtag, req) implicit none - include "precision.h" - integer :: recvcount,dest,recvtag,req real(kind=CUSTOM_REAL),dimension(recvcount) :: recvbuf @@ -2533,8 +2475,6 @@ subroutine isend_cr_inter(sendbuf, sendcount, dest, sendtag, req) implicit none - include "precision.h" - integer :: sendcount, dest, sendtag, req real(kind=CUSTOM_REAL), dimension(sendcount) :: sendbuf @@ -2595,8 +2535,6 @@ subroutine sendv_cr_inter(sendbuf, sendcount, dest, sendtag) implicit none - include "precision.h" - integer :: sendcount,dest,sendtag real(kind=CUSTOM_REAL),dimension(sendcount) :: sendbuf @@ -2642,8 +2580,6 @@ end subroutine gather_all_all_single_ch ! ! implicit none ! -! include "precision.h" -! ! integer :: sendcnt,recvcounttot,NPROC ! integer, dimension(NPROC) :: recvcount,recvoffset ! real(kind=CUSTOM_REAL), dimension(sendcnt) :: sendbuf diff --git a/src/shared/serial.f90 b/src/shared/serial.f90 index e7197bb90..b13675d92 100644 --- a/src/shared/serial.f90 +++ b/src/shared/serial.f90 @@ -30,7 +30,11 @@ !---- subroutine abort_mpi() + + implicit none + stop 'error, program ended by abort' + end subroutine abort_mpi ! @@ -55,6 +59,9 @@ end function wtime ! subroutine synchronize_all() + + implicit none + end subroutine synchronize_all ! @@ -826,7 +833,7 @@ end subroutine max_all_all_i !------------------------------------------------------------------------------------------------- ! - subroutine max_allreduce_i(buffer,countval) + subroutine max_all_all_veci(buffer,countval) implicit none @@ -837,22 +844,7 @@ subroutine max_allreduce_i(buffer,countval) unused_i4 = buffer(1) - end subroutine max_allreduce_i - -! -!------------------------------------------------------------------------------------------------- -! - - subroutine max_allreduce_singlei(val,recvval) - - implicit none - - integer,intent(in) :: val - integer,intent(out) :: recvval - - recvval = val - - end subroutine max_allreduce_singlei + end subroutine max_all_all_veci ! !------------------------------------------------------------------------------------------------- diff --git a/src/specfem3D/save_forward_arrays_adios.F90 b/src/specfem3D/save_forward_arrays_adios.F90 index 4f4c059e2..72f461613 100644 --- a/src/specfem3D/save_forward_arrays_adios.F90 +++ b/src/specfem3D/save_forward_arrays_adios.F90 @@ -68,7 +68,7 @@ subroutine save_forward_arrays_adios() max_global_values(3) = NSPEC_STRAIN_ONLY max_global_values(4) = N_SLS - call max_allreduce_i(max_global_values,num_vars) + call max_all_all_veci(max_global_values,num_vars) NGLOB_wmax = max_global_values(1) NSPEC_ATTENUATION_wmax = max_global_values(2) @@ -303,9 +303,9 @@ subroutine save_forward_arrays_undoatt_adios() ! only need to do this once for the first iteration and save the max values if (iteration_on_subset_tmp == 1) then ! Filling a temporary array to avoid doing allreduces for each var. - call max_allreduce_singlei(NGLOB_AB,NGLOB_wmax) - call max_allreduce_singlei(NSPEC_ATTENUATION_AB,NSPEC_ATTENUATION_wmax) - call max_allreduce_singlei(N_SLS,N_SLS_wmax) ! probably not needed, N_SLS will be the same for all partitions + call max_all_all_i(NGLOB_AB,NGLOB_wmax) + call max_all_all_i(NSPEC_ATTENUATION_AB,NSPEC_ATTENUATION_wmax) + call max_all_all_i(N_SLS,N_SLS_wmax) ! probably not needed, N_SLS will be the same for all partitions endif ! file handling diff --git a/src/specfem3D/save_kernels_adios.F90 b/src/specfem3D/save_kernels_adios.F90 index e9b35e9c1..30b36c8cc 100644 --- a/src/specfem3D/save_kernels_adios.F90 +++ b/src/specfem3D/save_kernels_adios.F90 @@ -71,7 +71,7 @@ subroutine define_kernel_adios_variables() call init_adios_group(myadios_group,group_name) ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) ! defines variable entries call define_adios_scalar(myadios_group, group_size_inc, '', "nspec", NSPEC_AB) @@ -240,7 +240,7 @@ subroutine save_kernels_acoustic_adios() integer :: nspec_wmax ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax @@ -273,7 +273,7 @@ subroutine save_kernels_elastic_iso_adios(rhop_kl, alpha_kl, beta_kl) integer :: nspec_wmax ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax @@ -325,7 +325,7 @@ subroutine save_kernels_elastic_aniso_adios(alphav_kl, alphah_kl, betav_kl, beta integer :: nspec_wmax ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax @@ -384,7 +384,7 @@ subroutine save_kernels_poroelastic_adios() integer :: nspec_wmax ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax @@ -440,7 +440,7 @@ subroutine save_kernels_moho_adios() if (.not. SAVE_MOHO_MESH) return ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) ! save moho kernels to binary files local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax @@ -468,7 +468,7 @@ subroutine save_kernels_Hessian_adios() integer :: nspec_wmax ! determines maximum values for nspec over all partition slices - call max_allreduce_singlei(NSPEC_AB,nspec_wmax) + call max_all_all_i(NSPEC_AB,nspec_wmax) local_dim = NGLLX * NGLLY * NGLLZ * nspec_wmax From 560c1f902d9519457e673cb320790b5fc94058c0 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 5 Jun 2024 17:40:39 +0200 Subject: [PATCH 20/56] code cleaning --- .../input_output/Teleseismic_IO.f90 | 6 ++-- .../input_output/input_output_mod.f90 | 30 +++++++++++++------ .../parallel_for_inverse_problem.f90 | 8 ----- src/specfem3D/fault_solver_dynamic.f90 | 12 ++++---- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 b/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 index 378933126..75b1db59c 100644 --- a/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 +++ b/src/inverse_problem_for_model/input_output/Teleseismic_IO.f90 @@ -39,6 +39,8 @@ module Teleseismic_IO_mod calc_delta_dist_baz, calc_dist_baz_cart, lowcase, & write_binary_data use signal_processing, only: taper_window_W + + implicit none integer, private :: NEVENT contains @@ -50,8 +52,8 @@ module Teleseismic_IO_mod subroutine read_acqui_teleseismic_file(acqui_file, acqui_simu, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none character(len=MAX_LEN_STRING), intent(in) :: acqui_file integer, intent(in) :: myrank type(acqui), dimension(:), allocatable, intent(inout) :: acqui_simu @@ -437,7 +439,7 @@ subroutine setup_teleseismic_stations(acqui_simu, myrank) !! hgamma, hpgamma !! !! ------------------------------------------------------------------------------ - + implicit none type(acqui), dimension(:), intent(inout) :: acqui_simu integer, intent(in) :: myrank ! local diff --git a/src/inverse_problem_for_model/input_output/input_output_mod.f90 b/src/inverse_problem_for_model/input_output/input_output_mod.f90 index a78528f13..18b0a9342 100644 --- a/src/inverse_problem_for_model/input_output/input_output_mod.f90 +++ b/src/inverse_problem_for_model/input_output/input_output_mod.f90 @@ -105,6 +105,7 @@ module input_output !------------------------------------------------------------------------------------------------------------------- subroutine init_input_output_mod(inversion_param, acqui_simu, myrank) + implicit none integer, intent(in) :: myrank type(acqui), dimension(:), allocatable, intent(inout) :: acqui_simu type(inver), intent(inout) :: inversion_param @@ -284,6 +285,8 @@ end subroutine init_input_output_mod !> read input inversion parameter file !-------------------------------------------------------------------------------------------------------------------- subroutine SetUpInversion(inversion_param, myrank) + + implicit none type(inver), intent(inout) :: inversion_param integer, intent(in) :: myrank @@ -366,6 +369,7 @@ end subroutine SetUpInversion !-------------------------------------------------------------------------------------------------------------------- subroutine read_and_distribute_events_for_simultaneous_runs(NUMBER_OF_SIMULTANEOUS_RUNS, acqui_file_ref) + implicit none character(len=MAX_LEN_STRING), intent(in) :: acqui_file_ref integer, intent(in) :: NUMBER_OF_SIMULTANEOUS_RUNS ! local @@ -450,7 +454,6 @@ end subroutine read_and_distribute_events_for_simultaneous_runs subroutine create_name_database_inversion(prname,iproc,ievent,LOCAL_PATH) implicit none - integer, intent(in) :: iproc, ievent ! name of the database file character(len=MAX_LEN_STRING), intent(inout) :: prname @@ -471,6 +474,7 @@ end subroutine create_name_database_inversion !-------------------------------------------------------------------------------------------------------------------- subroutine WriteOutputs(inversion_param) + implicit none type(inver), intent(in) :: inversion_param !! FOR NOT ONLY ONE OUPTPUT BUT FOR FURTHER DEV WE WILL ADD OTHER @@ -488,6 +492,7 @@ subroutine get_mode_running(mode_running, inversion_param) use my_mpi use specfem_par, only: myrank + implicit none type(inver), intent(inout) :: inversion_param character(len=MAX_LEN_STRING), intent(inout) :: mode_running integer :: ier @@ -564,6 +569,7 @@ end subroutine get_mode_running subroutine dump_adjoint_sources(ievent, acqui_simu, myrank) + implicit none integer, intent(in) :: ievent, myrank type(acqui), dimension(:), intent(inout) :: acqui_simu ! local @@ -589,6 +595,7 @@ end subroutine dump_adjoint_sources !---------------------------------------------------------------- subroutine dump_seismograms(ievent, array_to_write, acqui_simu, myrank) + implicit none integer, intent(in) :: ievent, myrank real(kind=CUSTOM_REAL), dimension(:,:,:), intent(in) :: array_to_write type(acqui), dimension(:), intent(inout) :: acqui_simu @@ -624,6 +631,7 @@ end subroutine dump_seismograms !---------------------------------------------------------------- subroutine dump_filtered_data(ievent, array_to_write, acqui_simu, myrank) + implicit none integer, intent(in) :: ievent,myrank real(kind=CUSTOM_REAL), dimension(:,:,:), intent(in) :: array_to_write type(acqui), dimension(:), intent(inout) :: acqui_simu @@ -651,8 +659,8 @@ end subroutine dump_filtered_data subroutine write_bin_sismo_on_disk(ievent, acqui_simu, array_to_write, name_file_to_write, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none integer, intent(in) :: myrank, ievent character(len=MAX_LEN_STRING), intent(in) :: name_file_to_write real(kind=CUSTOM_REAL), dimension(:,:,:), intent(in) :: array_to_write @@ -787,8 +795,8 @@ end subroutine write_bin_sismo_on_disk subroutine read_data_gather(acqui_simu, inversion_param, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none integer, intent(in) :: myrank type(acqui), dimension(:), intent(inout) :: acqui_simu type(inver), intent(inout) :: inversion_param @@ -999,8 +1007,8 @@ end subroutine read_data_gather subroutine read_pif_data_gather(acqui_simu, inversion_param, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none integer, intent(in) :: myrank type(acqui), dimension(:), intent(inout) :: acqui_simu type(inver), intent(inout) :: inversion_param @@ -1308,8 +1316,8 @@ end subroutine read_pif_data_gather subroutine write_pif_data_gather(ievent, acqui_simu, inversion_param, array_to_write, name_file_to_write, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none integer, intent(in) :: myrank, ievent real(kind=CUSTOM_REAL), dimension(:,:,:), intent(in) :: array_to_write type(acqui), dimension(:), intent(inout) :: acqui_simu @@ -1513,8 +1521,8 @@ end subroutine write_pif_data_gather subroutine read_acqui_file(acqui_file, acqui_simu, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none character(len=MAX_LEN_STRING), intent(in) :: acqui_file integer, intent(in) :: myrank type(acqui), dimension(:), allocatable, intent(inout) :: acqui_simu @@ -1719,8 +1727,8 @@ end subroutine read_acqui_file subroutine read_inver_file(inver_file, inversion_param, myrank) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none character(len=MAX_LEN_STRING), intent(in) :: inver_file integer, intent(in) :: myrank type(inver), intent(inout) :: inversion_param @@ -2051,6 +2059,7 @@ end subroutine read_inver_file !---------------------------------------------------------------- subroutine store_default_acqui_values(acqui_simu, ievent) + implicit none type(acqui), dimension(:), intent(inout) :: acqui_simu integer, intent(in) :: ievent @@ -2069,6 +2078,7 @@ end subroutine store_default_acqui_values !---------------------------------------------------------------- logical function is_blank_line(line) + implicit none character(len=MAX_LEN_STRING), intent(in) :: line is_blank_line = .false. if (len(trim(adjustl(line))) == 0) is_blank_line = .true. @@ -2081,6 +2091,7 @@ end function is_blank_line !---------------------------------------------------------------- subroutine remove_blank_in_line(line, line_without_blank) + implicit none character(len=MAX_LEN_STRING), intent(in) :: line character(len=MAX_LEN_STRING), intent(inout) :: line_without_blank integer :: n, i, k @@ -2103,6 +2114,7 @@ end subroutine remove_blank_in_line !------------------------------------------------------------ subroutine get_stations(acqui_simu) + implicit none type(acqui), dimension(:), intent(inout) :: acqui_simu integer :: ievent, irec, nsta, nrec_loc, ier @@ -2288,8 +2300,8 @@ end subroutine get_stations subroutine get_point_source(acqui_simu) use my_mpi !! module from specfem - include "precision.h" !! from specfem + implicit none type(acqui), dimension(:), intent(inout) :: acqui_simu ! locals character(len=MAX_STRING_LEN) :: filename @@ -2650,7 +2662,7 @@ end subroutine get_point_source ! subroutine bcast_all_acqui(acqui_simu, inversion_param, myrank) ! use my_mpi !! module from specfem -! include "precision.h" !! from specfem +! implicit none ! type(acqui), dimension(:), intent(inout) :: acqui_simu ! type(inver), intent(inout) :: inversion_param ! integer, intent(in) :: myrank diff --git a/src/inverse_problem_for_model/parallel_for_inverse_problem.f90 b/src/inverse_problem_for_model/parallel_for_inverse_problem.f90 index a136b0fa9..dd9e51a3e 100644 --- a/src/inverse_problem_for_model/parallel_for_inverse_problem.f90 +++ b/src/inverse_problem_for_model/parallel_for_inverse_problem.f90 @@ -34,8 +34,6 @@ subroutine sum_all_all_cr_for_simulatenous_runs(sendbuf, recvbuf, countval) implicit none - include "precision.h" - integer, intent(in) :: countval real(kind=CUSTOM_REAL), intent(in) :: sendbuf real(kind=CUSTOM_REAL), intent(inout) :: recvbuf @@ -62,8 +60,6 @@ subroutine max_all_all_cr_for_simulatenous_runs(sendbuf, recvbuf, countval) implicit none - include "precision.h" - integer, intent(in) :: countval real(kind=CUSTOM_REAL), intent(in) :: sendbuf real(kind=CUSTOM_REAL), intent(inout) :: recvbuf @@ -90,8 +86,6 @@ subroutine min_all_all_cr_for_simulatenous_runs(sendbuf, recvbuf, countval) implicit none - include "precision.h" - integer, intent(in) :: countval real(kind=CUSTOM_REAL), intent(in) :: sendbuf real(kind=CUSTOM_REAL), intent(inout) :: recvbuf @@ -168,8 +162,6 @@ subroutine sum_all_all_cr_array(sendbuf, recvbuf, countval) implicit none - include "precision.h" - integer, intent(in) :: countval real(kind=CUSTOM_REAL), intent(in) :: sendbuf real(kind=CUSTOM_REAL), intent(inout) :: recvbuf diff --git a/src/specfem3D/fault_solver_dynamic.f90 b/src/specfem3D/fault_solver_dynamic.f90 index 5c12e85dd..054dcb4b3 100644 --- a/src/specfem3D/fault_solver_dynamic.f90 +++ b/src/specfem3D/fault_solver_dynamic.f90 @@ -1109,7 +1109,7 @@ subroutine BC_DYNFLT_set3d(bc,MxA,V,D,iflt) nuc_r = bc%twf%nuc_r nuc_t0 = bc%twf%nuc_t0 nuc_v = bc%twf%nuc_v - if(bc%twf%kind==1) then + if (bc%twf%kind == 1) then do i = 1,bc%nglob dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 if (dist < nuc_r) then @@ -1122,14 +1122,14 @@ subroutine BC_DYNFLT_set3d(bc,MxA,V,D,iflt) endif endif enddo - elseif(bc%twf%kind==2) then + else if (bc%twf%kind == 2) then do i = 1,bc%nglob dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 if (dist < nuc_r) then temp_T = dist/0.7/3464 + 0.081*nuc_r/0.7/3464*(1/(1-(dist/nuc_r)**2)-1) if (timeval >= temp_T+nuc_t0) then bc%mu(i) = min(bc%mu(i), bc%twf%mud) - else if (timeval>=temp_T .and. timeval= temp_T .and. timeval < temp_T+nuc_t0) then bc%mu(i) = min(bc%mu(i), bc%twf%mud + (temp_T+nuc_t0-timeval)/nuc_t0*(bc%twf%mus-bc%twf%mud)) endif endif @@ -1526,7 +1526,7 @@ subroutine BC_DYNFLT_set3d_lts(bc,MxA,V,D,iflt,p_value,ilevel) nuc_r = bc%twf%nuc_r nuc_t0 = bc%twf%nuc_t0 nuc_v = bc%twf%nuc_v - if(bc%twf%kind==1) then + if (bc%twf%kind == 1) then do i = 1,bc%nglob dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 if (dist < nuc_r) then @@ -1539,14 +1539,14 @@ subroutine BC_DYNFLT_set3d_lts(bc,MxA,V,D,iflt,p_value,ilevel) endif endif enddo - elseif(bc%twf%kind==2) then + else if (bc%twf%kind == 2) then do i = 1,bc%nglob dist = ((bc%coord(1,i)-nuc_x)**2 + (bc%coord(2,i)-nuc_y)**2 + (bc%coord(3,i)-nuc_z)**2)**0.5 if (dist < nuc_r) then temp_T = dist/0.7/3464 + 0.081*nuc_r/0.7/3464*(1/(1-(dist/nuc_r)**2)-1) if (timeval >= temp_T+nuc_t0) then bc%mu(i) = min(bc%mu(i), bc%twf%mud) - else if (timeval>=temp_T .and. timeval= temp_T .and. timeval < temp_T+nuc_t0) then bc%mu(i) = min(bc%mu(i), bc%twf%mud + (temp_T+nuc_t0-timeval)/nuc_t0*(bc%twf%mus-bc%twf%mud)) endif endif From 4d38bffef528e5730ec0602fd00432e08406d57e Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 5 Jun 2024 19:43:28 +0200 Subject: [PATCH 21/56] adds github action test case w/ ADIOS2 --- .github/scripts/run_build.sh | 16 ++++++++++++-- .github/scripts/run_install.sh | 39 ++++++++++++++++++++++++++++++++++ .github/scripts/run_tests.sh | 6 ++++++ .github/workflows/CI.yml | 28 ++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) diff --git a/.github/scripts/run_build.sh b/.github/scripts/run_build.sh index a8732621a..74b6ac863 100755 --- a/.github/scripts/run_build.sh +++ b/.github/scripts/run_build.sh @@ -29,13 +29,25 @@ echo "mpif90 --version" mpif90 --version echo +## ADIOS2 +if [ "${ADIOS2}" == "true" ]; then + echo + echo "enabling ADIOS2" + echo + ADIOS2_CONFIG="${ADIOS2_DIR}/bin/adios2-config" + adios=(--with-adios2 ADIOS2_CONFIG="$ADIOS2_CONFIG" ) +else + adios=() +fi # configuration echo -echo "configuration: default" +echo "configuration:" echo -./configure FC=gfortran MPIFC=mpif90 CC=gcc ${TESTFLAGS} +./configure \ +${adios[@]} \ +FC=gfortran MPIFC=mpif90 CC=gcc ${TESTFLAGS} # checks if [[ $? -ne 0 ]]; then echo "configuration failed:"; cat config.log; echo ""; echo "exiting..."; exit 1; fi diff --git a/.github/scripts/run_install.sh b/.github/scripts/run_install.sh index c495ebb64..4cdbf5a49 100755 --- a/.github/scripts/run_install.sh +++ b/.github/scripts/run_install.sh @@ -38,6 +38,12 @@ fi if [[ $? -ne 0 ]]; then exit 1; fi echo +# python3 pip upgrade might complain: "ERROR: launchpadlib 1.10.13 requires testresources" +sudo apt-get install -yq --no-install-recommends python3-testresources +# checks exit code +if [[ $? -ne 0 ]]; then exit 1; fi +echo + # python script needs numpy #sudo apt-get install -qq python-numpy # not working, likely installed on older python version pip install --user --upgrade pip setuptools wheel @@ -68,6 +74,39 @@ echo "mpif90 --version" mpif90 --version echo +## ADIOS2 +if [ "${ADIOS2}" == "true" ]; then + echo + echo "ADIOS2 installation:" + echo + # installs cmake wget + sudo apt-get install -yq --no-install-recommends cmake wget + # checks exit code + if [[ $? -ne 0 ]]; then exit 1; fi + # uses /opt as installation directory + mkdir -p /opt; cd /opt + # download source + wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.10.1.tar.gz + tar zxvf v2.10.1.tar.gz + cd ADIOS2-2.10.1/ + # build source + mkdir -p build; cd build/ + CC=gcc CXX=g++ FC=gfortran cmake -DADIOS2_USE_Fortran=ON \ + -DADIOS2_USE_HDF5=OFF -DADIOS2_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF \ + -DCMAKE_INSTALL_PREFIX=/opt/ADIOS2 ../ + # checks exit code + if [[ $? -ne 0 ]]; then exit 1; fi + make -j4 + # checks exit code + if [[ $? -ne 0 ]]; then exit 1; fi + make install + # checks exit code + if [[ $? -ne 0 ]]; then exit 1; fi + # environment for directory + echo "ADIOS2_DIR=/opt/ADIOS2" >> $GITHUB_ENV + echo; echo "done ADIOS2"; echo +fi + # MPI # github actions uses for Linux virtual machines a 2-core CPU environment # see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources diff --git a/.github/scripts/run_tests.sh b/.github/scripts/run_tests.sh index 9e070c777..b8595d93d 100755 --- a/.github/scripts/run_tests.sh +++ b/.github/scripts/run_tests.sh @@ -117,6 +117,12 @@ if [[ "${TEST}" == *"with-hdf5"* ]]; then cp -v run_this_example_HDF5_IO_server.sh run_this_example.sh fi +# adios +if [ "${ADIOS2}" == "true" ]; then + # turns on ADIOS + sed -i "s:^ADIOS_ENABLED .*:ADIOS_ENABLED = .true.:" DATA/Par_file +fi + # default script ./run_this_example.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cad72697b..c36258642 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -759,3 +759,31 @@ jobs: run: ./.github/scripts/run_tests.sh shell: bash + linuxTest_19: + name: Test run example 19 - meshfem3D simple model w/ ADIOS2 + runs-on: ubuntu-latest + needs: [linuxCheck] + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + env: + ADIOS2: true + run: ./.github/scripts/run_install.sh + shell: bash + + - name: Run build + env: + TESTFLAGS: --with-mpi --enable-vectorization + ADIOS2: true + run: ./.github/scripts/run_build.sh + shell: bash + + - name: Run test + env: + TESTDIR: EXAMPLES/applications/meshfem3D_examples/simple_model/ + ADIOS2: true + run: ./.github/scripts/run_tests.sh + shell: bash + From 2652225597c28d0d9d6ccc1b53e8bc0fc58152b3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Wed, 5 Jun 2024 20:14:39 +0200 Subject: [PATCH 22/56] updates github action file --- .github/scripts/run_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/run_install.sh b/.github/scripts/run_install.sh index 4cdbf5a49..db44a347b 100755 --- a/.github/scripts/run_install.sh +++ b/.github/scripts/run_install.sh @@ -87,7 +87,7 @@ if [ "${ADIOS2}" == "true" ]; then mkdir -p /opt; cd /opt # download source wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.10.1.tar.gz - tar zxvf v2.10.1.tar.gz + tar zxf v2.10.1.tar.gz cd ADIOS2-2.10.1/ # build source mkdir -p build; cd build/ From 4751779fd5cb82975f1f243167e2daf344308018 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 20 Jun 2024 13:29:30 -0400 Subject: [PATCH 23/56] wavefield discontinuity mesher --- DATA/CMTSOLUTION | 14 +- DATA/Par_file | 406 +++++++++++++++++- DATA/STATIONS | 5 +- .../DATA/Par_file | 7 + setup/constants.h.in | 16 + src/meshfem3D/create_meshfem_mesh.f90 | 8 + src/meshfem3D/meshfem3D_par.f90 | 17 + src/meshfem3D/rules.mk | 1 + src/meshfem3D/save_databases.F90 | 14 + src/shared/count_number_of_sources.f90 | 10 +- src/shared/read_parameter_file.F90 | 18 + src/shared/shared_par.F90 | 3 + 12 files changed, 514 insertions(+), 5 deletions(-) mode change 120000 => 100644 DATA/CMTSOLUTION mode change 120000 => 100644 DATA/Par_file mode change 120000 => 100644 DATA/STATIONS diff --git a/DATA/CMTSOLUTION b/DATA/CMTSOLUTION deleted file mode 120000 index 6bbf21120..000000000 --- a/DATA/CMTSOLUTION +++ /dev/null @@ -1 +0,0 @@ -../EXAMPLES/applications/homogeneous_halfspace/DATA/CMTSOLUTION \ No newline at end of file diff --git a/DATA/CMTSOLUTION b/DATA/CMTSOLUTION new file mode 100644 index 000000000..3d78a2e2f --- /dev/null +++ b/DATA/CMTSOLUTION @@ -0,0 +1,13 @@ +PDE 1999 01 01 00 00 00.00 67000 67000 -25000 4.2 4.2 homog_test +event name: homog_test +time shift: 0.0000 +half duration: 5.0 +latorUTM: 67000.0 +longorUTM: 67000.0 +depth: 30.0 +Mrr: -7.600000e+27 +Mtt: 7.700000e+27 +Mpp: -2.000000e+26 +Mrt: -2.500000e+28 +Mrp: 4.000000e+26 +Mtp: -2.500000e+27 diff --git a/DATA/Par_file b/DATA/Par_file deleted file mode 120000 index 9b1a3472b..000000000 --- a/DATA/Par_file +++ /dev/null @@ -1 +0,0 @@ -../EXAMPLES/applications/homogeneous_halfspace/DATA/Par_file \ No newline at end of file diff --git a/DATA/Par_file b/DATA/Par_file new file mode 100644 index 000000000..17a57c82c --- /dev/null +++ b/DATA/Par_file @@ -0,0 +1,405 @@ +#----------------------------------------------------------- +# +# Simulation input parameters +# +#----------------------------------------------------------- + +# forward or adjoint simulation +# 1 = forward, 2 = adjoint, 3 = both simultaneously +SIMULATION_TYPE = 1 +# 0 = earthquake simulation, 1/2/3 = three steps in noise simulation +NOISE_TOMOGRAPHY = 0 +SAVE_FORWARD = .false. + +# solve a full FWI inverse problem from a single calling program with no I/Os, storing everything in memory, +# or run a classical forward or adjoint problem only and save the seismograms and/or sensitivity kernels to disk (with costlier I/Os) +INVERSE_FWI_FULL_PROBLEM = .false. + +# UTM projection parameters +# Use a negative zone number for the Southern hemisphere: +# The Northern hemisphere corresponds to zones +1 to +60, +# The Southern hemisphere corresponds to zones -1 to -60. +UTM_PROJECTION_ZONE = 11 +SUPPRESS_UTM_PROJECTION = .true. + +# number of MPI processors +NPROC = 4 + +# time step parameters +NSTEP = 5000 +DT = 0.05 + +# set to true to use local-time stepping (LTS) +LTS_MODE = .false. + +# Partitioning algorithm for decompose_mesh +# choose partitioner: 1==SCOTCH (default), 2==METIS, 3==PATOH, 4==ROWS_PART +PARTITIONING_TYPE = 1 + +#----------------------------------------------------------- +# +# LDDRK time scheme +# +#----------------------------------------------------------- +USE_LDDRK = .false. +INCREASE_CFL_FOR_LDDRK = .false. +RATIO_BY_WHICH_TO_INCREASE_IT = 1.4 + +#----------------------------------------------------------- +# +# Mesh +# +#----------------------------------------------------------- + +# Number of nodes for 2D and 3D shape functions for hexahedra. +# We use either 8-node mesh elements (bricks) or 27-node elements. +# If you use our internal mesher, the only option is 8-node bricks (27-node elements are not supported). +NGNOD = 8 + +# models: +# available options are: +# default (model parameters described by mesh properties) +# 1D models available are: +# 1d_prem,1d_socal,1d_cascadia +# 3D models available are: +# aniso,external,gll,salton_trough,tomo,SEP,coupled,... +MODEL = default + +# path for external tomographic models files +TOMOGRAPHY_PATH = DATA/tomo_files/ +# if you are using a SEP model (oil-industry format) +SEP_MODEL_DIRECTORY = DATA/my_SEP_model/ + +#----------------------------------------------------------- + +# parameters describing the model +APPROXIMATE_OCEAN_LOAD = .false. +TOPOGRAPHY = .false. +ATTENUATION = .false. +ANISOTROPY = .false. +GRAVITY = .false. + +# in case of attenuation, reference frequency in Hz at which the velocity values in the velocity model are given (unused otherwise) +ATTENUATION_f0_REFERENCE = 18.d0 + +# attenuation period range over which we try to mimic a constant Q factor +MIN_ATTENUATION_PERIOD = 999999998.d0 +MAX_ATTENUATION_PERIOD = 999999999.d0 +# ignore this range and ask the code to compute it automatically instead based on the estimated resolution of the mesh (use this unless you know what you are doing) +COMPUTE_FREQ_BAND_AUTOMATIC = .true. + +# Olsen's constant for Q_mu = constant * V_s attenuation rule +USE_OLSEN_ATTENUATION = .false. +OLSEN_ATTENUATION_RATIO = 0.05 + +#----------------------------------------------------------- +# +# Absorbing boundary conditions +# +#----------------------------------------------------------- + +# C-PML boundary conditions for a regional simulation +# (if set to .false., and STACEY_ABSORBING_CONDITIONS is also set to .false., you get a free surface instead +# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements +PML_CONDITIONS = .false. + +# C-PML top surface +PML_INSTEAD_OF_FREE_SURFACE = .false. + +# C-PML dominant frequency +f0_FOR_PML = 0.05555 + +# parameters used to rotate C-PML boundary conditions by a given angle (not completed yet) +# ROTATE_PML_ACTIVATE = .false. +# ROTATE_PML_ANGLE = 0. + +# absorbing boundary conditions for a regional simulation +# (if set to .false., and PML_CONDITIONS is also set to .false., you get a free surface instead +# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements +STACEY_ABSORBING_CONDITIONS = .true. + +# absorbing top surface (defined in mesh as 'free_surface_file') +STACEY_INSTEAD_OF_FREE_SURFACE = .false. + +# When STACEY_ABSORBING_CONDITIONS is set to .true. : +# absorbing conditions are defined in xmin, xmax, ymin, ymax and zmin +# this option BOTTOM_FREE_SURFACE can be set to .true. to +# make zmin free surface instead of absorbing condition +BOTTOM_FREE_SURFACE = .false. + +#----------------------------------------------------------- +# +# undoing attenuation and/or PMLs for sensitivity kernel calculations +# +#----------------------------------------------------------- + +# to undo attenuation and/or PMLs for sensitivity kernel calculations or forward runs with SAVE_FORWARD +# use the flag below. It performs undoing of attenuation and/or of PMLs in an exact way for sensitivity kernel calculations +# but requires disk space for temporary storage, and uses a significant amount of memory used as buffers for temporary storage. +# When that option is on the second parameter indicates how often the code dumps restart files to disk (if in doubt, use something between 100 and 1000). +UNDO_ATTENUATION_AND_OR_PML = .false. +NT_DUMP_ATTENUATION = 500 + +#----------------------------------------------------------- +# +# Visualization +# +#----------------------------------------------------------- + +# save AVS or OpenDX movies +# MOVIE_TYPE = 1 to show the top surface +# MOVIE_TYPE = 2 to show all the external faces of the mesh +CREATE_SHAKEMAP = .false. +MOVIE_SURFACE = .false. +MOVIE_TYPE = 1 +MOVIE_VOLUME = .false. +SAVE_DISPLACEMENT = .false. +MOVIE_VOLUME_STRESS = .false. +USE_HIGHRES_FOR_MOVIES = .false. +NTSTEP_BETWEEN_FRAMES = 200 +HDUR_MOVIE = 0.0 + +# save AVS or OpenDX mesh files to check the mesh +SAVE_MESH_FILES = .true. + +# path to store the local database file on each node +LOCAL_PATH = OUTPUT_FILES/DATABASES_MPI + +# interval at which we output time step info and max of norm of displacement +NTSTEP_BETWEEN_OUTPUT_INFO = 500 + +#----------------------------------------------------------- +# +# Sources +# +#----------------------------------------------------------- + +# sources and receivers Z coordinates given directly (i.e. as their true position) instead of as their depth +USE_SOURCES_RECEIVERS_Z = .false. + +# use a (tilted) FORCESOLUTION force point source (or several) instead of a CMTSOLUTION moment-tensor source. +# This can be useful e.g. for oil industry foothills simulations or asteroid simulations +# in which the source is a vertical force, normal force, tilted force, impact etc. +# If this flag is turned on, the FORCESOLUTION file must be edited by giving: +# - the corresponding time-shift parameter, +# - the half duration (hdur, in s) for Gaussian/Step function, dominant frequency (f0, in Hz) for Ricker, +# - the coordinates of the source, +# - the source time function type (0=Gaussian function, 1=Ricker wavelet, 2=Step function), +# - the magnitude of the force source, +# - the components of a (non necessarily unitary) direction vector for the force source in the E/N/Z_UP basis. +# The direction vector is made unitary internally in the code and thus only its direction matters here; +# its norm is ignored and the norm of the force used is the factor force source times the source time function. +USE_FORCE_POINT_SOURCE = .false. + +# set to true to use a Ricker source time function instead of the source time functions set by default +# to represent a (tilted) FORCESOLUTION force point source or a CMTSOLUTION moment-tensor source. +USE_RICKER_TIME_FUNCTION = .false. + +# use an external source time function +# you must add a file with your source time function and the file name path +# relative to working directory at the end of CMTSOLUTION or FORCESOLUTION file +# (with multiple sources, one file per source is required). +# This file must have a single column containing the amplitudes of the source at all time steps; +# time step size used must be equal to DT as defined at the beginning of this Par_file. +# Be sure when this option is .false. to remove the name of stf file in CMTSOLUTION or FORCESOLUTION +USE_EXTERNAL_SOURCE_FILE = .false. + +# print source time function +PRINT_SOURCE_TIME_FUNCTION = .false. + +# source encoding +# (for acoustic simulations only for now) determines source encoding factor +/-1 depending on sign of moment tensor +# (see e.g. Krebs et al., 2009. Fast full-wavefield seismic inversion using encoded sources, Geophysics, 74 (6), WCC177-WCC188.) +USE_SOURCE_ENCODING = .false. + +#----------------------------------------------------------- +# +# Seismograms +# +#----------------------------------------------------------- + +# interval in time steps for writing of seismograms +NTSTEP_BETWEEN_OUTPUT_SEISMOS = 10000 + +# set to n to reduce the sampling rate of output seismograms by a factor of n +# defaults to 1, which means no down-sampling +NTSTEP_BETWEEN_OUTPUT_SAMPLE = 1 + +# decide if we save displacement, velocity, acceleration and/or pressure in forward runs (they can be set to true simultaneously) +# currently pressure seismograms are implemented in acoustic (i.e. fluid) elements only +SAVE_SEISMOGRAMS_DISPLACEMENT = .true. +SAVE_SEISMOGRAMS_VELOCITY = .false. +SAVE_SEISMOGRAMS_ACCELERATION = .false. +SAVE_SEISMOGRAMS_PRESSURE = .false. # currently implemented in acoustic (i.e. fluid) elements only + +# option to save strain seismograms +# this option is useful for strain Green's tensor +SAVE_SEISMOGRAMS_STRAIN = .false. + +# save seismograms also when running the adjoint runs for an inverse problem +# (usually they are unused and not very meaningful, leave this off in almost all cases) +SAVE_SEISMOGRAMS_IN_ADJOINT_RUN = .true. + +# save seismograms in binary or ASCII format (binary is smaller but may not be portable between machines) +USE_BINARY_FOR_SEISMOGRAMS = .false. + +# output seismograms in Seismic Unix format (binary with 240-byte-headers) +SU_FORMAT = .false. + +# output seismograms in ASDF (requires asdf-library) +ASDF_FORMAT = .false. + +# output seismograms in HDF5 (requires hdf5-library and WRITE_SEISMOGRAMS_BY_MAIN) +HDF5_FORMAT = .false. + +# decide if main process writes all the seismograms or if all processes do it in parallel +WRITE_SEISMOGRAMS_BY_MAIN = .false. + +# save all seismograms in one large combined file instead of one file per seismogram +# to avoid overloading shared non-local file systems such as LUSTRE or GPFS for instance +SAVE_ALL_SEISMOS_IN_ONE_FILE = .false. + +# use a trick to increase accuracy of pressure seismograms in fluid (acoustic) elements: +# use the second derivative of the source for the source time function instead of the source itself, +# and then record -potential_acoustic() as pressure seismograms instead of -potential_dot_dot_acoustic(); +# this is mathematically equivalent, but numerically significantly more accurate because in the explicit +# Newmark time scheme acceleration is accurate at zeroth order while displacement is accurate at second order, +# thus in fluid elements potential_dot_dot_acoustic() is accurate at zeroth order while potential_acoustic() +# is accurate at second order and thus contains significantly less numerical noise. +USE_TRICK_FOR_BETTER_PRESSURE = .false. + +#----------------------------------------------------------- +# +# Energy calculation +# +#----------------------------------------------------------- + +# to plot energy curves, for instance to monitor how CPML absorbing layers behave; +# should be turned OFF in most cases because a bit expensive +OUTPUT_ENERGY = .false. +# every how many time steps we compute energy (which is a bit expensive to compute) +NTSTEP_BETWEEN_OUTPUT_ENERGY = 10 + +#----------------------------------------------------------- +# +# Adjoint kernel outputs +# +#----------------------------------------------------------- + +# interval in time steps for reading adjoint traces +# 0 = read the whole adjoint sources at start time +NTSTEP_BETWEEN_READ_ADJSRC = 0 + +# read adjoint sources using ASDF (requires asdf-library) +READ_ADJSRC_ASDF = .false. + +# this parameter must be set to .true. to compute anisotropic kernels +# in crust and mantle (related to the 21 Cij in geographical coordinates) +# default is .false. to compute isotropic kernels (related to alpha and beta) +ANISOTROPIC_KL = .false. + +# compute transverse isotropic kernels (alpha_v,alpha_h,beta_v,beta_h,eta,rho) +# rather than fully anisotropic kernels in case ANISOTROPIC_KL is set to .true. +SAVE_TRANSVERSE_KL = .false. + +# this parameter must be set to .true. to compute anisotropic kernels for +# cost function using velocity observable rather than displacement +ANISOTROPIC_VELOCITY_KL = .false. + +# outputs approximate Hessian for preconditioning +APPROXIMATE_HESS_KL = .false. + +# save Moho mesh and compute Moho boundary kernels +SAVE_MOHO_MESH = .false. + +#----------------------------------------------------------- +# +# Coupling with an injection technique (DSM, AxiSEM, or FK) +# +#----------------------------------------------------------- +COUPLE_WITH_INJECTION_TECHNIQUE = .false. +INJECTION_TECHNIQUE_TYPE = 3 # 1 = DSM, 2 = AxiSEM, 3 = FK +MESH_A_CHUNK_OF_THE_EARTH = .false. +TRACTION_PATH = DATA/AxiSEM_tractions/3/ +FKMODEL_FILE = FKmodel +RECIPROCITY_AND_KH_INTEGRAL = .false. # does not work yet + +#----------------------------------------------------------- +## +## Prescribed wavefield discontinuity on an interface +## +##----------------------------------------------------------- +IS_WAVEFIELD_DISCONTINUITY = .false. + +#----------------------------------------------------------- +# +# Run modes +# +#----------------------------------------------------------- + +# Simultaneous runs +# added the ability to run several calculations (several earthquakes) +# in an embarrassingly-parallel fashion from within the same run; +# this can be useful when using a very large supercomputer to compute +# many earthquakes in a catalog, in which case it can be better from +# a batch job submission point of view to start fewer and much larger jobs, +# each of them computing several earthquakes in parallel. +# To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS to a value greater than 1. +# To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators, +# each of them being labeled "my_local_mpi_comm_world", and we use them +# in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case +# we need to kill the entire run. +# When that option is on, of course the number of processor cores used to start +# the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS, +# all the individual runs must use the same number of processor cores, +# which as usual is NPROC in the Par_file, +# and thus the total number of processor cores to request from the batch system +# should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC. +# All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on +# (with exactly four digits). +# +# Imagine you have 10 independent calculations to do, each of them on 100 cores; you have three options: +# +# 1/ submit 10 jobs to the batch system +# +# 2/ submit a single job on 1000 cores to the batch, and in that script create a sub-array of jobs to start 10 jobs, +# each running on 100 cores (see e.g. http://www.schedmd.com/slurmdocs/job_array.html ) +# +# 3/ submit a single job on 1000 cores to the batch, start SPECFEM3D on 1000 cores, create 10 sub-communicators, +# cd into one of 10 subdirectories (called e.g. run0001, run0002,... run0010) depending on the sub-communicator +# your MPI rank belongs to, and run normally on 100 cores using that sub-communicator. +# +# The option below implements 3/. +# +NUMBER_OF_SIMULTANEOUS_RUNS = 1 + +# if we perform simultaneous runs in parallel, if only the source and receivers vary between these runs +# but not the mesh nor the model (velocity and density) then we can also read the mesh and model files +# from a single run in the beginning and broadcast them to all the others; for a large number of simultaneous +# runs for instance when solving inverse problems iteratively this can DRASTICALLY reduce I/Os to disk in the solver +# (by a factor equal to NUMBER_OF_SIMULTANEOUS_RUNS), and reducing I/Os is crucial in the case of huge runs. +# Thus, always set this option to .true. if the mesh and the model are the same for all simultaneous runs. +# In that case there is no need to duplicate the mesh and model file database (the content of the DATABASES_MPI +# directories) in each of the run0001, run0002,... directories, it is sufficient to have one in run0001 +# and the code will broadcast it to the others) +BROADCAST_SAME_MESH_AND_MODEL = .true. + +#----------------------------------------------------------- + +# set to true to use GPUs +GPU_MODE = .false. + +# ADIOS Options for I/Os +ADIOS_ENABLED = .false. +ADIOS_FOR_DATABASES = .false. +ADIOS_FOR_MESH = .false. +ADIOS_FOR_FORWARD_ARRAYS = .false. +ADIOS_FOR_KERNELS = .false. +ADIOS_FOR_UNDO_ATTENUATION = .false. + +# HDF5 Database I/O +# (note the flags for HDF5 and ADIOS are mutually exclusive, only one can be used) +HDF5_ENABLED = .false. +HDF5_FOR_MOVIES = .false. +HDF5_IO_NODES = 0 # HDF5 IO server with number of IO dedicated procs + diff --git a/DATA/STATIONS b/DATA/STATIONS deleted file mode 120000 index 7c5e8b5d6..000000000 --- a/DATA/STATIONS +++ /dev/null @@ -1 +0,0 @@ -../EXAMPLES/applications/homogeneous_halfspace/DATA/STATIONS \ No newline at end of file diff --git a/DATA/STATIONS b/DATA/STATIONS new file mode 100644 index 000000000..1ee47ff70 --- /dev/null +++ b/DATA/STATIONS @@ -0,0 +1,4 @@ +X20 DB 67000.00 22732.14 0.0 0.0 +X30 DB 67000.00 34696.43 0.0 0.0 +X40 DB 67000.00 46660.71 0.0 0.0 +X50 DB 67000.00 58625.00 0.0 0.0 diff --git a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/DATA/Par_file b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/DATA/Par_file index 01a5e8972..17a57c82c 100644 --- a/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/DATA/Par_file +++ b/EXAMPLES/applications/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/DATA/Par_file @@ -324,6 +324,13 @@ TRACTION_PATH = DATA/AxiSEM_tractions/3/ FKMODEL_FILE = FKmodel RECIPROCITY_AND_KH_INTEGRAL = .false. # does not work yet +#----------------------------------------------------------- +## +## Prescribed wavefield discontinuity on an interface +## +##----------------------------------------------------------- +IS_WAVEFIELD_DISCONTINUITY = .false. + #----------------------------------------------------------- # # Run modes diff --git a/setup/constants.h.in b/setup/constants.h.in index 09b34e89a..1f0260307 100644 --- a/setup/constants.h.in +++ b/setup/constants.h.in @@ -287,6 +287,22 @@ integer, parameter :: IIN_veloc_dsm = 51, IIN_tract_dsm = 52 integer, parameter :: IIN_displ_axisem = 54 +!!----------------------------------------------------------- +!! +!! Prescribed wavefield discontinuity on an interface +!! +!!----------------------------------------------------------- + + +! I/O for wavefield discontinuity + integer, parameter :: IFILE_WAVEFIELD_DISCONTINUITY = 527 + +! file name for ASCII wavefield discontinuity interface file + character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE = 'wavefield_discontinuity_interface' + +! file name for ASCII wavefield discontinuity box file + character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_BOX = 'wavefield_discontinuity_box' + !!----------------------------------------------------------- !! !! mesh optimization diff --git a/src/meshfem3D/create_meshfem_mesh.f90 b/src/meshfem3D/create_meshfem_mesh.f90 index 5162c8127..5fe925c07 100644 --- a/src/meshfem3D/create_meshfem_mesh.f90 +++ b/src/meshfem3D/create_meshfem_mesh.f90 @@ -82,6 +82,9 @@ subroutine create_meshfem_mesh() ! HDF5 file i/o use shared_parameters, only: HDF5_ENABLED + + !! setting up wavefield discontinuity interface + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY implicit none @@ -143,6 +146,11 @@ subroutine create_meshfem_mesh() nspec,nglob, & prname,nodes_coords,ibool,ispec_material_id) + !! setting up wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) then + call find_wavefield_discontinuity_elements() + endif + ! stores boundary informations call store_boundaries(iboun,nspec, & ibelm_xmin,ibelm_xmax,ibelm_ymin,ibelm_ymax,ibelm_bottom,ibelm_top, & diff --git a/src/meshfem3D/meshfem3D_par.f90 b/src/meshfem3D/meshfem3D_par.f90 index 7c9049136..8faad973d 100644 --- a/src/meshfem3D/meshfem3D_par.f90 +++ b/src/meshfem3D/meshfem3D_par.f90 @@ -141,5 +141,22 @@ module meshfem_par ! name of the database file character(len=MAX_STRING_LEN) :: prname + !! boundary of wavefield discontinuity, read from database file + integer :: nb_wd + + !! boundary_to_ispec_wd(nb_wd) + !! the element the boundary belongs to, read from database file + !! each point on the boundary belongs to two sides of the boundary + !! here the element must be on the inner side of the boundary + integer, dimension(:), allocatable :: boundary_to_ispec_wd + + !! side_wd(nb_wd) + !! integers specifying which side the boundary is in the element + !! read from database file + !! side_wd = 1--8: only one vertex is on the boundary + !! side_wd = 9--20: only one edge is on the boundary + !! side_wd = 21--26: one face is on the boundary + integer, dimension(:), allocatable :: side_wd + end module meshfem_par diff --git a/src/meshfem3D/rules.mk b/src/meshfem3D/rules.mk index d7e27148b..24cfdaa80 100644 --- a/src/meshfem3D/rules.mk +++ b/src/meshfem3D/rules.mk @@ -59,6 +59,7 @@ meshfem3D_OBJECTS = \ $O/get_MPI_cutplanes_xi.mesh.o \ $O/meshfem3D.mesh.o \ $O/meshfem3D_par.mesh_module.o \ + $O/get_wavefield_discontinuity.mesh.o \ $O/read_mesh_parameter_file.mesh.o \ $O/read_value_mesh_parameters.mesh.o \ $O/save_databases.mesh.o \ diff --git a/src/meshfem3D/save_databases.F90 b/src/meshfem3D/save_databases.F90 index de31b2f64..caf3087ba 100644 --- a/src/meshfem3D/save_databases.F90 +++ b/src/meshfem3D/save_databases.F90 @@ -46,6 +46,9 @@ subroutine save_databases(nspec,nglob, & nspec_CPML,is_CPML,CPML_to_spec,CPML_regions, & SAVE_MESH_AS_CUBIT + !! setting up wavefield discontinuity interface + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + implicit none ! number of spectral elements in each block @@ -257,6 +260,10 @@ subroutine save_databases(nspec,nglob, & write(IIN_database) ispec,material_index(1,ispec),material_index(2,ispec),(loc_node(ia),ia = 1,NGNOD) enddo + !! setting up wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) & + call write_wavefield_discontinuity_database(IIN_database) + ! Boundaries ! ! note: check with routine write_boundaries_database() to produce identical output @@ -623,6 +630,9 @@ subroutine save_output_mesh_files_as_cubit(nspec,nglob, & NMATERIALS,material_properties, & nspec_CPML,CPML_to_spec,CPML_regions + !! setting up wavefield discontinuity interface + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + implicit none integer, parameter :: IIN_database = IIN_DB @@ -778,6 +788,10 @@ subroutine save_output_mesh_files_as_cubit(nspec,nglob, & enddo close(IIN_database) + !! setting up wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) & + call write_wavefield_discontinuity_file() + open(IIN_database,file='MESH/absorbing_surface_file_xmin') write(IIN_database,*) nspec2D_xmin do i = 1,nspec2D_xmin diff --git a/src/shared/count_number_of_sources.f90 b/src/shared/count_number_of_sources.f90 index aba14d4ba..cfde30284 100644 --- a/src/shared/count_number_of_sources.f90 +++ b/src/shared/count_number_of_sources.f90 @@ -37,6 +37,8 @@ subroutine count_number_of_sources(NSOURCES,sources_filename) use shared_parameters, only: USE_FORCE_POINT_SOURCE,USE_EXTERNAL_SOURCE_FILE, & HAS_FINITE_FAULT_SOURCE,NUMBER_OF_SIMULTANEOUS_RUNS + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + implicit none integer,intent(out) :: NSOURCES @@ -125,9 +127,13 @@ subroutine count_number_of_sources(NSOURCES,sources_filename) ! checks if any if (NSOURCES < 1) then - print *,'Error: ',trim(sources_filename),' has ',icounter,'lines, but need ',nlines_per_source, & + ! if there is prescribed wavefield discontinuity, then + ! it is OK to have an empty source file + if (.not. IS_WAVEFIELD_DISCONTINUITY) then + print *,'Error: ',trim(sources_filename),' has ',icounter,'lines, but need ',nlines_per_source, & 'per source... ',NSOURCES - stop 'Error need at least one source in CMTSOLUTION or FORCESOLUTION file' + stop 'Error need at least one source in CMTSOLUTION or FORCESOLUTION file' + endif endif end subroutine count_number_of_sources diff --git a/src/shared/read_parameter_file.F90 b/src/shared/read_parameter_file.F90 index fd56fb6b2..18aa68bfa 100644 --- a/src/shared/read_parameter_file.F90 +++ b/src/shared/read_parameter_file.F90 @@ -711,6 +711,14 @@ subroutine read_parameter_file(BROADCAST_AFTER_READ) !------------------------------------------------------- + ! prescribed wavefield discontinuity on an interface + ! if these parameters do not exist in Par_file, then wavefield + ! is not switched on by default + call read_value_logical(IS_WAVEFIELD_DISCONTINUITY, 'IS_WAVEFIELD_DISCONTINUITY', ier); ier = 0 + if (IS_WAVEFIELD_DISCONTINUITY) write(*,'(a)') 'wavefield discontinuity enabled' + + !------------------------------------------------------- + ! for simultaneous runs from the same batch job call read_value_integer(NUMBER_OF_SIMULTANEOUS_RUNS, 'NUMBER_OF_SIMULTANEOUS_RUNS', ier) if (ier /= 0) then @@ -1057,6 +1065,13 @@ subroutine check_simulation_parameters() MOVIE_VOLUME_STRESS = .false. endif + if (IS_WAVEFIELD_DISCONTINUITY) then + if (GPU_MODE) & + stop 'wavefield discontinuity problem cannot be solved on GPU yet' + if (ATTENUATION) & + stop 'wavefield discontinuity problem cannot be solved with attenuation' + endif + end subroutine check_simulation_parameters ! @@ -1419,6 +1434,9 @@ subroutine broadcast_computed_parameters() call bcast_all_string(FKMODEL_FILE) call bcast_all_singlel(RECIPROCITY_AND_KH_INTEGRAL) + ! wavefield discontinuity + call bcast_all_singlel(IS_WAVEFIELD_DISCONTINUITY) + ! simultaneous runs call bcast_all_singlei(NUMBER_OF_SIMULTANEOUS_RUNS) call bcast_all_singlel(BROADCAST_SAME_MESH_AND_MODEL) diff --git a/src/shared/shared_par.F90 b/src/shared/shared_par.F90 index 36ab72cde..92f50d866 100644 --- a/src/shared/shared_par.F90 +++ b/src/shared/shared_par.F90 @@ -204,6 +204,9 @@ module shared_input_parameters logical :: MESH_A_CHUNK_OF_THE_EARTH logical :: RECIPROCITY_AND_KH_INTEGRAL + ! prescribed wavefield discontinuity on an interface + logical :: IS_WAVEFIELD_DISCONTINUITY = .false. ! if .true. then wavefield discontinuity is turned on (default is false) + end module shared_input_parameters ! From 7295acd822d7ce2984333ef2790c239ab7e9fb97 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 20 Jun 2024 13:31:24 -0400 Subject: [PATCH 24/56] add to track meshfem3D/get_wavefield_discontinuity.f90 --- src/meshfem3D/get_wavefield_discontinuity.f90 | 507 ++++++++++++++++++ 1 file changed, 507 insertions(+) create mode 100644 src/meshfem3D/get_wavefield_discontinuity.f90 diff --git a/src/meshfem3D/get_wavefield_discontinuity.f90 b/src/meshfem3D/get_wavefield_discontinuity.f90 new file mode 100644 index 000000000..08eb95a60 --- /dev/null +++ b/src/meshfem3D/get_wavefield_discontinuity.f90 @@ -0,0 +1,507 @@ +!===================================================================== +! +! S p e c f e m 3 D +! ----------------- +! +! Main historical authors: Dimitri Komatitsch and Jeroen Tromp +! CNRS, France +! and Princeton University, USA +! (there are currently many more authors!) +! (c) October 2017 +! +! 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 write_wavefield_discontinuity_database(ifile) +! write data related to wavefield discontinuity to proc*_Database + use meshfem_par, only: nb_wd, boundary_to_ispec_wd, side_wd + implicit none + ! local variables + integer, intent(in) :: ifile + write(ifile) nb_wd + write(ifile) boundary_to_ispec_wd + write(ifile) side_wd + !deallocate(boundary_to_ispec_wd, side_wd) + end subroutine write_wavefield_discontinuity_database + +! +!----------------------------------------------------------- +! + + subroutine write_wavefield_discontinuity_file() +! write wavefield discontinuity interfaces to an ascii file +! works only when NPROC = 1 + use meshfem_par, only: nb_wd, boundary_to_ispec_wd, side_wd + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & + FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE + implicit none + ! local variables + integer :: i + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file='MESH/'//trim(FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE), & + form='formatted', action='write') + do i = 1, nb_wd + write(IFILE_WAVEFIELD_DISCONTINUITY, *) boundary_to_ispec_wd(i), side_wd(i) + enddo + close(IFILE_WAVEFIELD_DISCONTINUITY) + end subroutine write_wavefield_discontinuity_file + +! +!----------------------------------------------------------- +! + + subroutine find_wavefield_discontinuity_elements() +! read the wavefield_discontinuity_box file +! find the wavefield discontinuity interface + use constants, only: CUSTOM_REAL + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & + FNAME_WAVEFIELD_DISCONTINUITY_BOX + use meshfem_par, only: xstore,ystore,zstore,nspec + use meshfem_par, only: nb_wd, boundary_to_ispec_wd, side_wd + implicit none + ! local variables + integer :: boundary_to_ispec_wd_temp(6*nspec), side_wd_temp(6*nspec) + integer :: ispec, iside, i, j, k + logical :: is_boundary_wd, IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE + logical :: covered(26) + double precision :: x_min, x_max, y_min, y_max, z_min, z_max + double precision :: dx, dy, dz, x_mid, y_mid, z_mid, ratio_small=1.0e-6 + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(FNAME_WAVEFIELD_DISCONTINUITY_BOX), & + form='formatted', action='read') + read(IFILE_WAVEFIELD_DISCONTINUITY, *) IS_TOP_WAVEFIELD_DISCONTINUITY + read(IFILE_WAVEFIELD_DISCONTINUITY, *) IS_EXTRAPOLATION_MODE + read(IFILE_WAVEFIELD_DISCONTINUITY, *) x_min + read(IFILE_WAVEFIELD_DISCONTINUITY, *) x_max + read(IFILE_WAVEFIELD_DISCONTINUITY, *) y_min + read(IFILE_WAVEFIELD_DISCONTINUITY, *) y_max + read(IFILE_WAVEFIELD_DISCONTINUITY, *) z_min + read(IFILE_WAVEFIELD_DISCONTINUITY, *) z_max + close(IFILE_WAVEFIELD_DISCONTINUITY) + nb_wd = 0 + do ispec = 1, nspec + covered(:) = .false. + x_mid = xstore(2,2,2,ispec) + y_mid = ystore(2,2,2,ispec) + z_mid = zstore(2,2,2,ispec) + dx = ratio_small * abs(xstore(3,1,1,ispec) - xstore(1,1,1,ispec)) + dy = ratio_small * abs(ystore(1,3,1,ispec) - ystore(1,1,1,ispec)) + dz = ratio_small * abs(zstore(1,1,3,ispec) - zstore(1,1,1,ispec)) + !! bottom + iside = 21; i = 2; j = 2; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/9,10,11,12,1,2,3,4,21/)) = .true. + endif + endif + !! front + iside = 22; i = 2; j = 1; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/9,13,14,17,1,2,5,6,22/)) = .true. + endif + endif + !! right + iside = 23; i = 3; j = 2; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/10,14,15,18,2,3,6,7,23/)) = .true. + endif + endif + !! back + iside = 24; i = 2; j = 3; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/11,15,16,19,3,4,7,8,24/)) = .true. + endif + endif + !! left + iside = 25; i = 1; j = 2; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/12,13,16,20,1,4,5,8,25/)) = .true. + endif + endif + !! top + iside = 26; i = 2; j = 2; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/17,18,19,20,5,6,7,8,26/)) = .true. + endif + endif + !! front - bottom + iside = 9; i = 2; j = 1; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/1,2,9/)) = .true. + endif + endif + !! right - bottom + iside = 10; i = 3; j = 2; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/2,3,10/)) = .true. + endif + endif + !! back - bottom + iside = 11; i = 2; j = 3; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/3,4,11/)) = .true. + endif + endif + !! left - bottom + iside = 12; i = 1; j = 2; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/1,4,12/)) = .true. + endif + endif + !! left - front + iside = 13; i = 1; j = 1; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/1,5,13/)) = .true. + endif + endif + !! right - front + iside = 14; i = 3; j = 1; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/2,6,14/)) = .true. + endif + endif + !! right - back + iside = 15; i = 3; j = 3; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/3,7,15/)) = .true. + endif + endif + !! left - front + iside = 16; i = 1; j = 3; k = 2 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/4,8,16/)) = .true. + endif + endif + !! front - top + iside = 17; i = 2; j = 1; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/5,6,17/)) = .true. + endif + endif + !! right - top + iside = 18; i = 3; j = 2; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/6,7,18/)) = .true. + endif + endif + !! back - top + iside = 19; i = 2; j = 3; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/7,8,19/)) = .true. + endif + endif + !! left - bottom + iside = 20; i = 1; j = 2; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered((/5,8,20/)) = .true. + endif + endif + !! left - front - bottom + iside = 1; i = 1; j = 1; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(1) = .true. + endif + endif + !! right - front - bottom + iside = 2; i = 3; j = 1; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(2) = .true. + endif + endif + !! right - back - bottom + iside = 3; i = 3; j = 3; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(3) = .true. + endif + endif + !! left - front - bottom + iside = 4; i = 1; j = 3; k = 1 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(4) = .true. + endif + endif + !! left - front - top + iside = 5; i = 1; j = 1; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(5) = .true. + endif + endif + !! right - front - top + iside = 6; i = 3; j = 1; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(6) = .true. + endif + endif + !! right - back - top + iside = 7; i = 3; j = 3; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(7) = .true. + endif + endif + !! left - front - top + iside = 8; i = 1; j = 3; k = 3 + if (.not. covered(iside)) then + if (is_boundary_wd(xstore(i,j,k,ispec), ystore(i,j,k,ispec), & + zstore(i,j,k,ispec), x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE)) then + nb_wd = nb_wd + 1 + boundary_to_ispec_wd_temp(nb_wd) = ispec + side_wd_temp(nb_wd) = iside + covered(8) = .true. + endif + endif + enddo + allocate(boundary_to_ispec_wd(nb_wd), side_wd(nb_wd)) + boundary_to_ispec_wd(1:nb_wd) = boundary_to_ispec_wd_temp(1:nb_wd) + side_wd(1:nb_wd) = side_wd_temp(1:nb_wd) + end subroutine find_wavefield_discontinuity_elements + +! +!----------------------------------------------------------- +! + + logical function is_boundary_wd(x, y, z, x_min, x_max, y_min, y_max, & + z_min, z_max, x_mid, y_mid, z_mid, dx, dy, dz, & + IS_TOP_WAVEFIELD_DISCONTINUITY, & + IS_EXTRAPOLATION_MODE) + implicit none + double precision :: x_min, x_max, y_min, y_max, z_min, z_max + double precision :: x, y, z, x_mid, y_mid, z_mid, dx, dy, dz + logical :: IS_TOP_WAVEFIELD_DISCONTINUITY, IS_EXTRAPOLATION_MODE + is_boundary_wd = .false. + if (IS_EXTRAPOLATION_MODE) then + if (((x > x_min - dx) .and. (x < x_max + dx) .and. & + (y > y_min - dy) .and. (y < y_max + dy) .and. & + (z > z_min - dz) .and. (z < z_max + dz)) .and. & + ((x_mid < x_min) .or. (x_mid > x_max) .or. & + (y_mid < y_min) .or. (y_mid > y_max) .or. & + (z_mid < z_min) .or. (z_mid > z_max))) & + is_boundary_wd = .true. + else + if (((x < x_min + dx) .or. (x > x_max - dx) .or. & + (y < y_min + dy) .or. (y > y_max - dy) .or. & + (z < z_min + dz) .or. ((z > z_max - dz) .and. & + IS_TOP_WAVEFIELD_DISCONTINUITY)) .and. & + (x_mid > x_min) .and. (x_mid < x_max) .and. & + (y_mid > y_min) .and. (y_mid < y_max) .and. & + (z_mid > z_min) .and. ((.not. IS_TOP_WAVEFIELD_DISCONTINUITY) .or. & + (z_mid < z_max))) & + is_boundary_wd = .true. + endif + end function is_boundary_wd From 1441e4c5c6940ea48a1febe2f264d2f613d7dded Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 20 Jun 2024 18:39:47 -0400 Subject: [PATCH 25/56] wavefield discontinuity for decompose_mesh --- src/decompose_mesh/decompose_mesh_par.F90 | 20 +++++++++ src/decompose_mesh/part_decompose_mesh.F90 | 47 +++++++++++++++++++++ src/decompose_mesh/read_mesh_files.F90 | 30 ++++++++++++- src/decompose_mesh/write_mesh_databases.F90 | 6 +++ 4 files changed, 102 insertions(+), 1 deletion(-) diff --git a/src/decompose_mesh/decompose_mesh_par.F90 b/src/decompose_mesh/decompose_mesh_par.F90 index df5853233..9735094de 100644 --- a/src/decompose_mesh/decompose_mesh_par.F90 +++ b/src/decompose_mesh/decompose_mesh_par.F90 @@ -39,6 +39,8 @@ module decompose_mesh_par acoustic_elastic_poro_load,mesh2dual_ncommonnodes, & build_glob2loc_elmnts,build_glob2loc_nodes,build_interfaces,poro_elastic_repartitioning,moho_surface_repartitioning + !! setting up wavefield discontinuity interface + use part_decompose_mesh, only: write_wavefield_discontinuity_database implicit none ! note: the poroelastic repartitioning routine to parallelize the poroelastic-elastic interface @@ -120,5 +122,23 @@ module decompose_mesh_par integer,dimension(:),allocatable :: num_ispec_level integer :: num_p_level + ! wavefield discontinuity + !! boundary of wavefield discontinuity, read from database file + integer :: nb_wd + + !! boundary_to_ispec_wd(nb_wd) + !! the element the boundary belongs to, read from database file + !! each point on the boundary belongs to two sides of the boundary + !! here the element must be on the inner side of the boundary + integer, dimension(:), allocatable :: boundary_to_ispec_wd + + !! side_wd(nb_wd) + !! integers specifying which side the boundary is in the element + !! read from database file + !! side_wd = 1--8: only one vertex is on the boundary + !! side_wd = 9--20: only one edge is on the boundary + !! side_wd = 21--26: one face is on the boundary + integer, dimension(:), allocatable :: side_wd + end module decompose_mesh_par diff --git a/src/decompose_mesh/part_decompose_mesh.F90 b/src/decompose_mesh/part_decompose_mesh.F90 index e0c8a095b..e8f52c935 100644 --- a/src/decompose_mesh/part_decompose_mesh.F90 +++ b/src/decompose_mesh/part_decompose_mesh.F90 @@ -608,6 +608,53 @@ subroutine write_material_props_database(IIN_database,count_def_mat, & end subroutine write_material_props_database + !------------------------------------------------- + ! Write elements on the inner side of the wavefield + ! discontinuity interface + !------------------------------------------------- + subroutine write_wavefield_discontinuity_database(IIN_database, iproc, & + nb_wd, boundary_to_ispec_wd, side_wd, & + nspec, glob2loc_elmnts, part) + implicit none + integer, intent(in) :: IIN_database + integer, intent(in) :: iproc + integer, intent(in) :: nspec + integer, intent(in) :: nb_wd + integer, dimension(:), pointer :: glob2loc_elmnts + integer, dimension(1:nspec) :: part + integer, dimension(1:nb_wd), intent(in) :: boundary_to_ispec_wd, side_wd + integer :: ispec, iside, ib + integer :: local_nb_wd + integer, dimension(:), allocatable :: local_boundary_to_ispec_wd, & + local_side_wd + + local_nb_wd = 0 + do ib = 1, nb_wd + ispec = boundary_to_ispec_wd(ib) + iside = side_wd(ib) + if (part(ispec) == iproc) then + local_nb_wd = local_nb_wd + 1 + endif + enddo + allocate(local_boundary_to_ispec_wd(local_nb_wd)) + allocate(local_side_wd(local_nb_wd)) + local_nb_wd = 0 + do ib = 1, nb_wd + ispec = boundary_to_ispec_wd(ib) + iside = side_wd(ib) + if (part(ispec) == iproc) then + local_nb_wd = local_nb_wd + 1 + local_boundary_to_ispec_wd(local_nb_wd) = glob2loc_elmnts(ispec-1)+1 + local_side_wd(local_nb_wd) = iside + endif + enddo + write(IIN_database) local_nb_wd + write(IIN_database) local_boundary_to_ispec_wd + write(IIN_database) local_side_wd + deallocate(local_boundary_to_ispec_wd, local_side_wd) + end subroutine write_wavefield_discontinuity_database + + !-------------------------------------------------- ! Write elements on boundaries (and their four nodes on boundaries) ! pertaining to iproc partition in the corresponding Database diff --git a/src/decompose_mesh/read_mesh_files.F90 b/src/decompose_mesh/read_mesh_files.F90 index 0b7c3ab43..389be55e2 100644 --- a/src/decompose_mesh/read_mesh_files.F90 +++ b/src/decompose_mesh/read_mesh_files.F90 @@ -38,6 +38,8 @@ subroutine read_mesh_files() use fault_scotch, only: ANY_FAULT,read_fault_files,save_nodes_coords,close_faults + use constants, only: FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE + implicit none ! local parameters @@ -46,7 +48,7 @@ subroutine read_mesh_files() ! poroelastic parameters read in a new file double precision :: rhos,rhof,phi,tort,kxx,kxy,kxz,kyy,kyz,kzz,kappas,kappaf,kappafr,eta,mufr integer(kind=8) :: nspec_long - integer :: inode,idummy + integer :: inode,idummy,ib integer :: ispec,ispec2D,ispec_CPML,ier character(len=MAX_STRING_LEN) :: line @@ -566,6 +568,32 @@ subroutine read_mesh_files() endif enddo + ! reads in wavefield discontinuity elements + if (IS_WAVEFIELD_DISCONTINUITY) then + open(unit=IIN_DB, file=localpath_name(1:len_trim(localpath_name))//& + '/'//trim(FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE), & + status='old', form='formatted',iostat=ier) + if (ier /= 0) then + stop 'no wavefield discontinuity interface file' + endif + ier = 0 + nb_wd = 0 + do while (ier == 0) + read(IIN_DB, '(a)', iostat=ier) line + if (ier /= 0) exit + nb_wd = nb_wd + 1 + enddo + close(IIN_DB) + allocate(boundary_to_ispec_wd(nb_wd), side_wd(nb_wd)) + open(unit=IIN_DB, file=localpath_name(1:len_trim(localpath_name))//& + '/'//trim(FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE), & + status='old', form='formatted',iostat=ier) + do ib = 1, nb_wd + read(IIN_DB, *, iostat=ier) boundary_to_ispec_wd(ib), side_wd(ib) + enddo + close(IIN_DB) + endif + ! reads in absorbing boundary files open(unit=IIN_DB, file=localpath_name(1:len_trim(localpath_name))//'/absorbing_surface_file_xmin', & status='old', form='formatted',iostat=ier) diff --git a/src/decompose_mesh/write_mesh_databases.F90 b/src/decompose_mesh/write_mesh_databases.F90 index f4745c690..6fafd734b 100644 --- a/src/decompose_mesh/write_mesh_databases.F90 +++ b/src/decompose_mesh/write_mesh_databases.F90 @@ -108,10 +108,16 @@ subroutine write_mesh_databases() ! writes out spectral element indices write(IIN_database) nspec_local + call write_partition_database(IIN_database, ipart, nspec_local, nspec, elmnts, & glob2loc_elmnts, glob2loc_nodes_nparts, & glob2loc_nodes_parts, glob2loc_nodes, part, mat, NGNOD, 2) + !! setting up wavefield discontinuity boundary + call write_wavefield_discontinuity_database(IIN_database, ipart, & + nb_wd, boundary_to_ispec_wd, side_wd, & + nspec, glob2loc_elmnts, part) + ! writes out absorbing/free-surface boundaries call write_boundaries_database(IIN_database, ipart, nspec, nspec2D_xmin, nspec2D_xmax, nspec2D_ymin, & nspec2D_ymax, nspec2D_bottom, nspec2D_top, & From 55de7b9e441ba56ae32a38e092d80980b7dc0b16 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Fri, 21 Jun 2024 15:53:28 -0400 Subject: [PATCH 26/56] write a separate database for wavefield discontinuity in mesher and partitioner --- src/decompose_mesh/part_decompose_mesh.F90 | 21 +++++++++++++------ src/decompose_mesh/write_mesh_databases.F90 | 14 +++++++++---- src/meshfem3D/get_wavefield_discontinuity.f90 | 19 ++++++++++------- src/meshfem3D/save_databases.F90 | 7 ++++--- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/decompose_mesh/part_decompose_mesh.F90 b/src/decompose_mesh/part_decompose_mesh.F90 index e8f52c935..034ed2ecf 100644 --- a/src/decompose_mesh/part_decompose_mesh.F90 +++ b/src/decompose_mesh/part_decompose_mesh.F90 @@ -612,11 +612,12 @@ end subroutine write_material_props_database ! Write elements on the inner side of the wavefield ! discontinuity interface !------------------------------------------------- - subroutine write_wavefield_discontinuity_database(IIN_database, iproc, & + subroutine write_wavefield_discontinuity_database(iproc, outputpath_name, & nb_wd, boundary_to_ispec_wd, side_wd, & nspec, glob2loc_elmnts, part) + use constants, only: FNAME_WAVEFIELD_DISCONTINUITY_MESH, & + IFILE_WAVEFIELD_DISCONTINUITY, MAX_STRING_LEN implicit none - integer, intent(in) :: IIN_database integer, intent(in) :: iproc integer, intent(in) :: nspec integer, intent(in) :: nb_wd @@ -627,7 +628,13 @@ subroutine write_wavefield_discontinuity_database(IIN_database, iproc, & integer :: local_nb_wd integer, dimension(:), allocatable :: local_boundary_to_ispec_wd, & local_side_wd - + character(len=MAX_STRING_LEN), intent(in) :: outputpath_name + character(len=MAX_STRING_LEN) :: prname + write(prname, "(i6.6,'_')") iproc + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(outputpath_name)//'/'//trim(prname)//& + trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & + form='unformatted', action='write') local_nb_wd = 0 do ib = 1, nb_wd ispec = boundary_to_ispec_wd(ib) @@ -636,6 +643,7 @@ subroutine write_wavefield_discontinuity_database(IIN_database, iproc, & local_nb_wd = local_nb_wd + 1 endif enddo + print *, 'partition', iproc, ' has ', local_nb_wd, ' elements on wavefield discontinuity interface' allocate(local_boundary_to_ispec_wd(local_nb_wd)) allocate(local_side_wd(local_nb_wd)) local_nb_wd = 0 @@ -648,9 +656,10 @@ subroutine write_wavefield_discontinuity_database(IIN_database, iproc, & local_side_wd(local_nb_wd) = iside endif enddo - write(IIN_database) local_nb_wd - write(IIN_database) local_boundary_to_ispec_wd - write(IIN_database) local_side_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) local_nb_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) local_boundary_to_ispec_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) local_side_wd + close(IFILE_WAVEFIELD_DISCONTINUITY) deallocate(local_boundary_to_ispec_wd, local_side_wd) end subroutine write_wavefield_discontinuity_database diff --git a/src/decompose_mesh/write_mesh_databases.F90 b/src/decompose_mesh/write_mesh_databases.F90 index 6fafd734b..7c42244a2 100644 --- a/src/decompose_mesh/write_mesh_databases.F90 +++ b/src/decompose_mesh/write_mesh_databases.F90 @@ -113,10 +113,6 @@ subroutine write_mesh_databases() glob2loc_elmnts, glob2loc_nodes_nparts, & glob2loc_nodes_parts, glob2loc_nodes, part, mat, NGNOD, 2) - !! setting up wavefield discontinuity boundary - call write_wavefield_discontinuity_database(IIN_database, ipart, & - nb_wd, boundary_to_ispec_wd, side_wd, & - nspec, glob2loc_elmnts, part) ! writes out absorbing/free-surface boundaries call write_boundaries_database(IIN_database, ipart, nspec, nspec2D_xmin, nspec2D_xmax, nspec2D_ymin, & @@ -205,6 +201,16 @@ subroutine write_mesh_databases() enddo endif + + !! setting up wavefield discontinuity boundary + if (IS_WAVEFIELD_DISCONTINUITY) then + do ipart = 0, nparts-1 + call write_wavefield_discontinuity_database(ipart, outputpath_name, & + nb_wd, boundary_to_ispec_wd, side_wd, & + nspec, glob2loc_elmnts, part) + enddo + endif + ! cleanup deallocate(CPML_to_spec,stat=ier); if (ier /= 0) stop 'Error deallocating array CPML_to_spec' deallocate(CPML_regions,stat=ier); if (ier /= 0) stop 'Error deallocating array CPML_regions' diff --git a/src/meshfem3D/get_wavefield_discontinuity.f90 b/src/meshfem3D/get_wavefield_discontinuity.f90 index 08eb95a60..7f3f26090 100644 --- a/src/meshfem3D/get_wavefield_discontinuity.f90 +++ b/src/meshfem3D/get_wavefield_discontinuity.f90 @@ -26,16 +26,21 @@ !===================================================================== - subroutine write_wavefield_discontinuity_database(ifile) + subroutine write_wavefield_discontinuity_database() ! write data related to wavefield discontinuity to proc*_Database - use meshfem_par, only: nb_wd, boundary_to_ispec_wd, side_wd + use meshfem_par, only: nb_wd, boundary_to_ispec_wd, side_wd, prname + use constants, only: FNAME_WAVEFIELD_DISCONTINUITY_MESH, & + IFILE_WAVEFIELD_DISCONTINUITY implicit none ! local variables - integer, intent(in) :: ifile - write(ifile) nb_wd - write(ifile) boundary_to_ispec_wd - write(ifile) side_wd - !deallocate(boundary_to_ispec_wd, side_wd) + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=prname(1:len_trim(prname))//& + trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & + form='unformatted', action='write') + write(IFILE_WAVEFIELD_DISCONTINUITY) nb_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) boundary_to_ispec_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) side_wd + close(IFILE_WAVEFIELD_DISCONTINUITY) end subroutine write_wavefield_discontinuity_database ! diff --git a/src/meshfem3D/save_databases.F90 b/src/meshfem3D/save_databases.F90 index caf3087ba..7562e8986 100644 --- a/src/meshfem3D/save_databases.F90 +++ b/src/meshfem3D/save_databases.F90 @@ -260,9 +260,6 @@ subroutine save_databases(nspec,nglob, & write(IIN_database) ispec,material_index(1,ispec),material_index(2,ispec),(loc_node(ia),ia = 1,NGNOD) enddo - !! setting up wavefield discontinuity interface - if (IS_WAVEFIELD_DISCONTINUITY) & - call write_wavefield_discontinuity_database(IIN_database) ! Boundaries ! @@ -603,6 +600,10 @@ subroutine save_databases(nspec,nglob, & deallocate(material_index) + ! setting up wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) & + call write_wavefield_discontinuity_database() + ! user output if (myrank == 0) then write(IMAIN,*) ' done mesh files' From f93a8a47b653cfb8999d10754a6086166d3da8ff Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Fri, 21 Jun 2024 17:13:53 -0400 Subject: [PATCH 27/56] generate databases for wavefield discontinuity --- src/decompose_mesh/part_decompose_mesh.F90 | 2 +- .../create_regions_mesh.f90 | 18 + src/generate_databases/rules.mk | 6 + src/generate_databases/save_arrays_solver.F90 | 10 + ...field_discontinuity_generate_databases.f90 | 693 ++++++++++++++++++ 5 files changed, 728 insertions(+), 1 deletion(-) create mode 100644 src/generate_databases/wavefield_discontinuity_generate_databases.f90 diff --git a/src/decompose_mesh/part_decompose_mesh.F90 b/src/decompose_mesh/part_decompose_mesh.F90 index 034ed2ecf..e1468dffe 100644 --- a/src/decompose_mesh/part_decompose_mesh.F90 +++ b/src/decompose_mesh/part_decompose_mesh.F90 @@ -630,7 +630,7 @@ subroutine write_wavefield_discontinuity_database(iproc, outputpath_name, & local_side_wd character(len=MAX_STRING_LEN), intent(in) :: outputpath_name character(len=MAX_STRING_LEN) :: prname - write(prname, "(i6.6,'_')") iproc + write(prname, "('proc',i6.6,'_')") iproc open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & file=trim(outputpath_name)//'/'//trim(prname)//& trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & diff --git a/src/generate_databases/create_regions_mesh.f90 b/src/generate_databases/create_regions_mesh.f90 index e09ee313c..8286ea7c6 100644 --- a/src/generate_databases/create_regions_mesh.f90 +++ b/src/generate_databases/create_regions_mesh.f90 @@ -62,6 +62,12 @@ subroutine create_regions_mesh() nnodes_coords_open,nodes_coords_open,ANY_FAULT_IN_THIS_PROC, & ANY_FAULT + !! setup wavefield discontinuity interface + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + use wavefield_discontinuity_generate_databases, only: & + setup_boundary_wavefield_discontinuity, & + read_partition_files_wavefield_discontinuity + implicit none ! local parameters @@ -329,6 +335,18 @@ subroutine create_regions_mesh() ! user output call print_timing() + ! setup wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) then + call synchronize_all() + if (myrank == 0) then + write(IMAIN,*) + write(IMAIN,*) ' ...setting up wavefield discontinuity boundary ' + call flush_IMAIN() + endif + call read_partition_files_wavefield_discontinuity() + call setup_boundary_wavefield_discontinuity() + endif + ! saves the binary mesh files call synchronize_all() if (myrank == 0) then diff --git a/src/generate_databases/rules.mk b/src/generate_databases/rules.mk index b413ddf91..1f4600aa6 100644 --- a/src/generate_databases/rules.mk +++ b/src/generate_databases/rules.mk @@ -45,6 +45,7 @@ generate_databases_OBJECTS = \ $O/generate_databases_par.gen_mod.o \ $O/calc_jacobian.gen.o \ $O/fault_generate_databases.gen.o \ + $O/wavefield_discontinuity_generate_databases.gen.o \ $O/create_mass_matrices.gen.o \ $O/create_regions_mesh.gen.o \ $O/finalize_databases.gen.o \ @@ -91,6 +92,7 @@ generate_databases_MODULES = \ $(FC_MODDIR)/model_sep_mod.$(FC_MODEXT) \ $(FC_MODDIR)/model_tomography_par.$(FC_MODEXT) \ $(FC_MODDIR)/salton_trough_par.$(FC_MODEXT) \ + $(FC_MODDIR)/wavefield_discontinuity_generate_databases.$(FC_MODEXT) \ $(EMPTY_MACRO) @@ -229,6 +231,10 @@ $O/lts_generate_databases.gen.o: $O/fault_generate_databases.gen.o ## kdtree & faults dependency $O/setup_mesh_adjacency.gen.o: $O/search_kdtree.shared.o $O/fault_generate_databases.gen.o +## wavefield discontinuity +$O/create_regions_mesh.gen.o: $O/wavefield_discontinuity_generate_databases.gen.o +$O/save_arrays_solver.gen.o: $O/wavefield_discontinuity_generate_databases.gen.o + ####################################### diff --git a/src/generate_databases/save_arrays_solver.F90 b/src/generate_databases/save_arrays_solver.F90 index 01b8cb10a..59cde021b 100644 --- a/src/generate_databases/save_arrays_solver.F90 +++ b/src/generate_databases/save_arrays_solver.F90 @@ -69,6 +69,11 @@ subroutine save_arrays_solver_mesh() use shared_parameters, only: ADIOS_FOR_MESH,HDF5_ENABLED + !! setup wavefield discontinuity interface + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + use wavefield_discontinuity_generate_databases, only: & + save_arrays_solver_mesh_wavefield_discontinuity + implicit none ! local parameters @@ -408,6 +413,11 @@ subroutine save_arrays_solver_mesh() call save_arrays_solver_injection_boundary() endif + !! setup wavefield discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) then + call save_arrays_solver_mesh_wavefield_discontinuity() + endif + ! synchronizes processes call synchronize_all() diff --git a/src/generate_databases/wavefield_discontinuity_generate_databases.f90 b/src/generate_databases/wavefield_discontinuity_generate_databases.f90 new file mode 100644 index 000000000..12c3292d2 --- /dev/null +++ b/src/generate_databases/wavefield_discontinuity_generate_databases.f90 @@ -0,0 +1,693 @@ +module wavefield_discontinuity_generate_databases + use constants, only: CUSTOM_REAL + + !! boundary of wavefield discontinuity, read from database file + integer :: nb_wd + + !! boundary_to_ispec_wd(nb_wd) + !! the element the boundary belongs to, read from database file + !! each point on the boundary belongs to two sides of the boundary + !! here the element must be on the inner side of the boundary + integer, dimension(:), allocatable :: boundary_to_ispec_wd + + !! side_wd(nb_wd) + !! integers specifying which side the boundary is in the element + !! read from database file + !! side_wd = 1--8: only one vertex is on the boundary + !! side_wd = 9--20: only one edge is on the boundary + !! side_wd = 21--26: one face is on the boundary + integer, dimension(:), allocatable :: side_wd + + !! ispec_to_elem_wd(NSPEC_AB) + !! ispec_to_elem_wd(ispec) = ispec_wd (0 if element not belong to boundary) + !! written in solver database and used in solver + integer, dimension(:), allocatable :: ispec_to_elem_wd + + !! number of distinct gll points on the boundary + !! written in solver database and used in solver + integer :: nglob_wd + + !! number of elements on the inner side of the boundary + !! written in solver database and used in solver + integer :: nspec_wd + + !! ibool_wd(NGLLX, NGLLY, NGLLZ, nspec_wd) + !! ibool_wd(i,j,k,ispec_wd) = iglob_wd (0 if point not on boundary) + !! written in solver database and used in solver + integer, dimension(:,:,:,:), allocatable :: ibool_wd + + !! boundary_to_iglob_wd(nglob_wd) + !! boundary_to_iglob_wd(iglob_wd) = iglob + !! written in solver database and used in solver + integer, dimension(:), allocatable :: boundary_to_iglob_wd + + !! mass_in_wd(nglob_wd) + !! mass matrix on the inner side of the boundary + !! note that it is not assembled over processors + !! written in solver database and used in solver + real(kind=CUSTOM_REAL), dimension(:), allocatable :: mass_in_wd + + !! number of faces on the boundary + !! written in solver database and used in solver + integer :: nfaces_wd + + !! face_ijk_wd(NDIM, NGLLSQUARE, nfaces_wd) + !! written in solver database and used in solver + integer, dimension(:,:,:), allocatable :: face_ijk_wd + + !! face_ispec_wd(nfaces_wd) + !! written in solver database and used in solver + integer, dimension(:), allocatable :: face_ispec_wd + + !! face_normal_wd(NDIM, NGLLSQUARE, nfaces_wd) + !! written in solver database and used in solver + real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: face_normal_wd + + !! face_jacobian2Dw_wd(NGLLSQUARE, nfaces_wd) + !! written in solver database and used in solver + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: face_jacobian2dw_wd + +contains + subroutine read_partition_files_wavefield_discontinuity() + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & + FNAME_WAVEFIELD_DISCONTINUITY_MESH + use generate_databases_par, only: prname + implicit none + !integer :: ier + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & + action='read', form='unformatted') + read(IFILE_WAVEFIELD_DISCONTINUITY) nb_wd + allocate(boundary_to_ispec_wd(nb_wd), side_wd(nb_wd)) + read(IFILE_WAVEFIELD_DISCONTINUITY) boundary_to_ispec_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) side_wd + close(IFILE_WAVEFIELD_DISCONTINUITY) + end subroutine read_partition_files_wavefield_discontinuity + + subroutine save_arrays_solver_mesh_wavefield_discontinuity() + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & + FNAME_WAVEFIELD_DISCONTINUITY_DATABASE + use generate_databases_par, only: prname + implicit none + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & + action='write', form='unformatted') + write(IFILE_WAVEFIELD_DISCONTINUITY) ispec_to_elem_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) nglob_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) nspec_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) ibool_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) boundary_to_iglob_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) mass_in_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) nfaces_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) face_ijk_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) face_ispec_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) face_normal_wd + write(IFILE_WAVEFIELD_DISCONTINUITY) face_jacobian2dw_wd + close(IFILE_WAVEFIELD_DISCONTINUITY) + deallocate(boundary_to_ispec_wd, side_wd) + deallocate(ispec_to_elem_wd, ibool_wd, boundary_to_iglob_wd, mass_in_wd, & + face_ijk_wd, face_ispec_wd, face_normal_wd, face_jacobian2dw_wd) + end subroutine save_arrays_solver_mesh_wavefield_discontinuity + + subroutine setup_boundary_wavefield_discontinuity() + use generate_databases_par, only: NDIM, NGLLX, NGLLY, NGLLZ, CUSTOM_REAL, & + NGLLSQUARE, ibool, NSPEC_AB + + implicit none + integer :: i1, i2, j1, j2, k1, k2, i, j, k + integer :: ib, iside, ispec, iglob, ispec_wd, iglob_wd + logical :: is_face + integer, dimension(:), allocatable :: elem_list_temp, gllp_list_temp + real(kind=CUSTOM_REAL) :: val_mass + allocate(ispec_to_elem_wd(NSPEC_AB)) + allocate(elem_list_temp(nb_wd), gllp_list_temp(nb_wd*NGLLSQUARE)) + nspec_wd = 0 + nglob_wd = 0 + nfaces_wd = 0 + ispec_to_elem_wd(:) = 0 + elem_list_temp(:) = 0 + gllp_list_temp(:) = 0 + do ib = 1, nb_wd + ispec = boundary_to_ispec_wd(ib) + iside = side_wd(ib) + call get_points_boundary_wd(iside, i1, i2, j1, j2, k1, k2, is_face) + call find_point_wd(ispec, elem_list_temp, nspec_wd, ispec_wd) + if (ispec_wd == 0) then + ispec_to_elem_wd(ispec) = nspec_wd + 1 + elem_list_temp(nspec_wd+1) = ispec + nspec_wd = nspec_wd + 1 + endif + do i=i1,i2; do j=j1,j2; do k=k1,k2 + iglob = ibool(i,j,k,ispec) + call find_point_wd(iglob, gllp_list_temp, nglob_wd, iglob_wd) + if (iglob_wd == 0) then + gllp_list_temp(nglob_wd+1) = iglob + nglob_wd = nglob_wd + 1 + endif + enddo; enddo; enddo + if (is_face) nfaces_wd = nfaces_wd + 1 + enddo + allocate(ibool_wd(NGLLX, NGLLY, NGLLZ, nspec_wd), & + boundary_to_iglob_wd(nglob_wd), & + mass_in_wd(nglob_wd), & + face_ijk_wd(NDIM, NGLLSQUARE, nfaces_wd), & + face_ispec_wd(nfaces_wd), & + face_normal_wd(NDIM, NGLLSQUARE, nfaces_wd), & + face_jacobian2Dw_wd(NGLLSQUARE, nfaces_wd)) + ibool_wd(:,:,:,:) = 0 + mass_in_wd(:) = 0.0 + nfaces_wd = 0 + do ib = 1, nb_wd + ispec = boundary_to_ispec_wd(ib) + iside = side_wd(ib) + call get_points_boundary_wd(iside, i1, i2, j1, j2, k1, k2, is_face) + call find_point_wd(ispec, elem_list_temp, nspec_wd, ispec_wd) + do i=i1,i2; do j=j1,j2; do k=k1,k2 + iglob = ibool(i,j,k,ispec) + call find_point_wd(iglob, gllp_list_temp, nglob_wd, iglob_wd) + ibool_wd(i,j,k,ispec_wd) = iglob_wd + boundary_to_iglob_wd(iglob_wd) = iglob + !call get_mass_wd(i, j, k, ispec, val_mass) + !mass_in_wd(iglob_wd) = mass_in_wd(iglob_wd) + val_mass + enddo; enddo; enddo + if (is_face) then + nfaces_wd = nfaces_wd + 1 + face_ispec_wd(nfaces_wd) = ispec + call get_face_wd(ispec, iside, face_ijk_wd(:,:,nfaces_wd), & + face_normal_wd(:,:,nfaces_wd), & + face_jacobian2Dw_wd(:,nfaces_wd)) + endif + enddo + do ispec = 1, NSPEC_AB + ispec_wd = ispec_to_elem_wd(ispec) + if (ispec_wd > 0) then + do k=1,NGLLZ; do j=1,NGLLY; do i=1, NGLLX + iglob_wd= ibool_wd(i,j,k,ispec_wd) + if (iglob_wd > 0) then + call get_mass_wd(i, j, k, ispec, val_mass) + mass_in_wd(iglob_wd) = mass_in_wd(iglob_wd) + val_mass + endif + enddo; enddo; enddo + endif + enddo + call write_discontinuity_surface_file() + end subroutine setup_boundary_wavefield_discontinuity + + subroutine write_discontinuity_surface_file() + use constants, only: NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE,CUSTOM_REAL,& + IFILE_WAVEFIELD_DISCONTINUITY + use generate_databases_par, only: prname, myrank, LOCAL_PATH, & + nodes_coords_ext_mesh, elmnts_ext_mesh, NGNOD + use create_regions_mesh_ext_par, only: xstore_unique, ystore_unique, & + zstore_unique, & + xigll,yigll,zigll + implicit none + double precision, parameter :: ONE_SHRINK = 0.999 + integer :: i,j,k,ispec,iglob,igll,iglob_wd,iface_wd, ia + real(CUSTOM_REAL) :: tx, ty, tz + double precision :: shape3D_shrink(NGNOD,NGLLX,NGLLY,NGLLZ) + double precision :: dershape3D_shrink(NDIM,NGNOD,NGLLX,NGLLY,NGLLZ) + double precision :: xigll_shrink(NGLLX), yigll_shrink(NGLLY), & + zigll_shrink(NGLLZ) + double precision :: xstore_shrink(NGLLX,NGLLY,NGLLZ), & + ystore_shrink(NGLLX,NGLLY,NGLLZ), & + zstore_shrink(NGLLX,NGLLY,NGLLZ) + double precision, dimension(NGNOD) :: xelm,yelm,zelm + call create_name_database(prname,myrank,LOCAL_PATH) + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=prname(1:len_trim(prname))//'wavefield_discontinuity_points',& + action='write', form='formatted') + do iglob_wd = 1, nglob_wd + iglob = boundary_to_iglob_wd(iglob_wd) + write(IFILE_WAVEFIELD_DISCONTINUITY, '(4e20.5)') xstore_unique(iglob), & + ystore_unique(iglob), zstore_unique(iglob), mass_in_wd(iglob_wd) + enddo + close(IFILE_WAVEFIELD_DISCONTINUITY) + xigll_shrink(:) = xigll(:) + xigll_shrink(1) = xigll_shrink(1) * ONE_SHRINK + xigll_shrink(NGLLX) = xigll_shrink(NGLLX) * ONE_SHRINK + yigll_shrink(:) = yigll(:) + yigll_shrink(1) = yigll_shrink(1) * ONE_SHRINK + yigll_shrink(NGLLX) = yigll_shrink(NGLLX) * ONE_SHRINK + zigll_shrink(:) = zigll(:) + zigll_shrink(1) = zigll_shrink(1) * ONE_SHRINK + zigll_shrink(NGLLX) = zigll_shrink(NGLLX) * ONE_SHRINK + call get_shape3D(shape3D_shrink, dershape3D_shrink, & + xigll_shrink, yigll_shrink, zigll_shrink, NGNOD, NGLLX, NGLLY, NGLLZ) + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=prname(1:len_trim(prname))//'wavefield_discontinuity_faces',& + action='write', form='formatted') + do iface_wd = 1, nfaces_wd + ispec = face_ispec_wd(iface_wd) + do ia = 1,NGNOD + iglob = elmnts_ext_mesh(ia,ispec) + xelm(ia) = nodes_coords_ext_mesh(1,iglob) + yelm(ia) = nodes_coords_ext_mesh(2,iglob) + zelm(ia) = nodes_coords_ext_mesh(3,iglob) + enddo + call calc_coords(xstore_shrink(1,1,1), ystore_shrink(1,1,1),& + zstore_shrink(1,1,1), xelm,yelm,zelm,shape3D_shrink) + do igll = 1, NGLLSQUARE + i = face_ijk_wd(1,igll,iface_wd) + j = face_ijk_wd(2,igll,iface_wd) + k = face_ijk_wd(3,igll,iface_wd) + !iglob = ibool(i,j,k,ispec) + tx = face_normal_wd(1,igll,iface_wd) + ty = face_normal_wd(2,igll,iface_wd) + tz = face_normal_wd(3,igll,iface_wd) + !write(IFILE_WAVEFIELD_DISCONTINUITY, '(7e20.5)') xstore_unique(iglob), & + ! ystore_unique(iglob), zstore_unique(iglob), tx, ty, tz, & + ! face_jacobian2Dw_wd(igll, iface_wd) + write(IFILE_WAVEFIELD_DISCONTINUITY, '(7e20.5)') xstore_shrink(i,j,k), & + ystore_shrink(i,j,k), zstore_shrink(i,j,k), tx, ty, tz, & + face_jacobian2Dw_wd(igll, iface_wd) + enddo + enddo + end subroutine write_discontinuity_surface_file + + subroutine get_face_wd(ispec, iside, face_ijk_b, face_normal_b, & + face_jacobian2Dw_b) + use constants, only: NGLLX,NGLLY,NGLLZ,NDIM,NGNOD2D_FOUR_CORNERS, & + CUSTOM_REAL, NGLLSQUARE + use generate_databases_par, only: NGNOD2D, ibool, NSPEC_AB, NGLOB_AB, & + xstore, ystore, zstore + use create_regions_mesh_ext_par, only: xstore_unique, ystore_unique, & + zstore_unique, nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz + implicit none + integer, intent(in) :: ispec, iside + integer :: iface, igll, i, j + integer :: ijk_face(NDIM, NGLLX, NGLLY) + real(kind=CUSTOM_REAL) :: normal_face(NDIM, NGLLX, NGLLY), & + jacobian2Dw_face(NGLLX, NGLLY) + real(kind=CUSTOM_REAL), dimension(NDIM) :: lnormal + integer, intent(out) :: face_ijk_b(NDIM, NGLLSQUARE) + real(kind=CUSTOM_REAL), intent(out) :: face_normal_b(NDIM, NGLLSQUARE), & + face_jacobian2Dw_b(NGLLSQUARE) + real(kind=CUSTOM_REAL), dimension(NGNOD2D_FOUR_CORNERS) :: & + xcoord,ycoord,zcoord + if (nglob_unique /= NGLOB_AB) & + call exit_MPI_without_rank('nglob_unique not equal to NGLOB_AB') + select case (iside) + case (21) + ! bottom + xcoord(1) = xstore(1,1,1,ispec) + xcoord(2) = xstore(1,NGLLY,1,ispec) + xcoord(3) = xstore(NGLLX,NGLLY,1,ispec) + xcoord(4) = xstore(NGLLX,1,1,ispec) + ycoord(1) = ystore(1,1,1,ispec) + ycoord(2) = ystore(1,NGLLY,1,ispec) + ycoord(3) = ystore(NGLLX,NGLLY,1,ispec) + ycoord(4) = ystore(NGLLX,1,1,ispec) + zcoord(1) = zstore(1,1,1,ispec) + zcoord(2) = zstore(1,NGLLY,1,ispec) + zcoord(3) = zstore(NGLLX,NGLLY,1,ispec) + zcoord(4) = zstore(NGLLX,1,1,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 5) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLX,NGLLY) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLX,NGLLY,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLY + do i = 1,NGLLX + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLY + do i = 1,NGLLX + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + case (25) + ! left, xmin + xcoord(1) = xstore(1,1,1,ispec) + xcoord(2) = xstore(1,1,NGLLZ,ispec) + xcoord(3) = xstore(1,NGLLY,NGLLZ,ispec) + xcoord(4) = xstore(1,NGLLY,1,ispec) + ycoord(1) = ystore(1,1,1,ispec) + ycoord(2) = ystore(1,1,NGLLZ,ispec) + ycoord(3) = ystore(1,NGLLY,NGLLZ,ispec) + ycoord(4) = ystore(1,NGLLY,1,ispec) + zcoord(1) = zstore(1,1,1,ispec) + zcoord(2) = zstore(1,1,NGLLZ,ispec) + zcoord(3) = zstore(1,NGLLY,NGLLZ,ispec) + zcoord(4) = zstore(1,NGLLY,1,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 1) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLX,NGLLZ) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLX,NGLLZ,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLZ + do i = 1,NGLLX + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLZ + do i = 1,NGLLX + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + case (22) + ! front, ymin + xcoord(1) = xstore(1,1,1,ispec) + xcoord(2) = xstore(NGLLX,1,1,ispec) + xcoord(3) = xstore(NGLLX,1,NGLLZ,ispec) + xcoord(4) = xstore(1,1,NGLLZ,ispec) + ycoord(1) = ystore(1,1,1,ispec) + ycoord(2) = ystore(NGLLX,1,1,ispec) + ycoord(3) = ystore(NGLLX,1,NGLLZ,ispec) + ycoord(4) = ystore(1,1,NGLLZ,ispec) + zcoord(1) = zstore(1,1,1,ispec) + zcoord(2) = zstore(NGLLX,1,1,ispec) + zcoord(3) = zstore(NGLLX,1,NGLLZ,ispec) + zcoord(4) = zstore(1,1,NGLLZ,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 3) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLY,NGLLZ) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLY,NGLLZ,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLZ + do i = 1,NGLLY + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLZ + do i = 1,NGLLY + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + case (23) + ! right, xmax + xcoord(1) = xstore(NGLLX,1,1,ispec) + xcoord(2) = xstore(NGLLX,NGLLY,1,ispec) + xcoord(3) = xstore(NGLLX,NGLLY,NGLLZ,ispec) + xcoord(4) = xstore(NGLLX,1,NGLLZ,ispec) + ycoord(1) = ystore(NGLLX,1,1,ispec) + ycoord(2) = ystore(NGLLX,NGLLY,1,ispec) + ycoord(3) = ystore(NGLLX,NGLLY,NGLLZ,ispec) + ycoord(4) = ystore(NGLLX,1,NGLLZ,ispec) + zcoord(1) = zstore(NGLLX,1,1,ispec) + zcoord(2) = zstore(NGLLX,NGLLY,1,ispec) + zcoord(3) = zstore(NGLLX,NGLLY,NGLLZ,ispec) + zcoord(4) = zstore(NGLLX,1,NGLLZ,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 2) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLX,NGLLZ) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLX,NGLLZ,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLZ + do i = 1,NGLLX + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLZ + do i = 1,NGLLX + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + case (24) + ! back, ymax + xcoord(1) = xstore(1,NGLLY,1,ispec) + xcoord(2) = xstore(1,NGLLY,NGLLZ,ispec) + xcoord(3) = xstore(NGLLX,NGLLY,NGLLZ,ispec) + xcoord(4) = xstore(NGLLX,NGLLY,1,ispec) + ycoord(1) = ystore(1,NGLLY,1,ispec) + ycoord(2) = ystore(1,NGLLY,NGLLZ,ispec) + ycoord(3) = ystore(NGLLX,NGLLY,NGLLZ,ispec) + ycoord(4) = ystore(NGLLX,NGLLY,1,ispec) + zcoord(1) = zstore(1,NGLLY,1,ispec) + zcoord(2) = zstore(1,NGLLY,NGLLZ,ispec) + zcoord(3) = zstore(NGLLX,NGLLY,NGLLZ,ispec) + zcoord(4) = zstore(NGLLX,NGLLY,1,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 4) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLY,NGLLZ) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLY,NGLLZ,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLZ + do i = 1,NGLLY + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLZ + do i = 1,NGLLY + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + case (26) + ! top, zmax + xcoord(1) = xstore(1,1,NGLLZ,ispec) + xcoord(2) = xstore(NGLLX,1,NGLLZ,ispec) + xcoord(3) = xstore(NGLLX,NGLLY,NGLLZ,ispec) + xcoord(4) = xstore(1,NGLLY,NGLLZ,ispec) + ycoord(1) = ystore(1,1,NGLLZ,ispec) + ycoord(2) = ystore(NGLLX,1,NGLLZ,ispec) + ycoord(3) = ystore(NGLLX,NGLLY,NGLLZ,ispec) + ycoord(4) = ystore(1,NGLLY,NGLLZ,ispec) + zcoord(1) = zstore(1,1,NGLLZ,ispec) + zcoord(2) = zstore(NGLLX,1,NGLLZ,ispec) + zcoord(3) = zstore(NGLLX,NGLLY,NGLLZ,ispec) + zcoord(4) = zstore(1,NGLLY,NGLLZ,ispec) + ! sets face id of reference element associated with this face + call get_element_face_id(ispec,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,NGLOB_AB, & + xstore_unique,ystore_unique,zstore_unique,iface) + if (iface /= 6) & + call exit_MPI_without_rank('incorrect iface') + ! ijk indices of GLL points on face + call get_element_face_gll_indices(iface,ijk_face,NGLLX,NGLLY) + ! weighted jacobian and normal + call get_jacobian_boundary_face(NSPEC_AB, & + xstore_unique,ystore_unique,zstore_unique,ibool,nglob_unique, & + dershape2D_x,dershape2D_y,dershape2D_bottom,dershape2D_top, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz, & + ispec,iface,jacobian2Dw_face,normal_face,NGLLX,NGLLY,NGNOD2D) + ! normal convention: points away from element + ! switch normal direction if necessary + do j = 1,NGLLY + do i = 1,NGLLX + lnormal(:) = normal_face(:,i,j) + call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, & + ibool,NSPEC_AB,nglob_unique, & + xstore_unique,ystore_unique,zstore_unique, & + lnormal) + normal_face(:,i,j) = lnormal(:) + enddo + enddo + ! GLL points -- assuming NGLLX = NGLLY = NGLLZ + igll = 0 + do j = 1,NGLLY + do i = 1,NGLLX + igll = igll+1 + face_ijk_b(:,igll) = ijk_face(:,i,j) + face_jacobian2Dw_b(igll) = jacobian2Dw_face(i,j) + face_normal_b(:,igll) = normal_face(:,i,j) + enddo + enddo + end select + end subroutine get_face_wd + + subroutine get_mass_wd(i, j, k, ispec, val_mass) + use generate_databases_par, only: CUSTOM_REAL + use create_regions_mesh_ext_par, only: irregular_element_number, & + wxgll, wygll, wzgll, jacobianstore, & + rhostore, jacobian_regular + implicit none + integer :: i, j, k, ispec, ispec_irreg + real(kind=CUSTOM_REAL) :: val_mass, jacobianl + double precision :: weight + ispec_irreg = irregular_element_number(ispec) + if (ispec_irreg == 0) then + jacobianl = jacobian_regular + else + jacobianl = jacobianstore(i,j,k,ispec_irreg) + endif + weight = wxgll(i)*wygll(j)*wzgll(k) + val_mass = real(dble(jacobianl) * weight * dble(rhostore(i,j,k,ispec)), & + kind=CUSTOM_REAL) + end subroutine get_mass_wd + + subroutine find_point_wd(p, plist, len, ip) + implicit none + integer, intent(in) :: p, len + integer, dimension(len), intent(in) :: plist + integer, intent(out) :: ip + integer :: i + ip = 0 + do i = 1, len + if (plist(i) == p) then + ip = i + exit + endif + enddo + end subroutine find_point_wd + + subroutine get_points_boundary_wd(iside, i1, i2, j1, j2, k1, k2, is_face) + use generate_databases_par, only: NGLLX, NGLLY, NGLLZ + implicit none + integer, intent(in) :: iside + integer, intent(out) :: i1, i2, j1, j2, k1, k2 + logical, intent(out) :: is_face + integer, parameter :: NGNOD = 27, THREE = 3 + integer, dimension(NGNOD) :: iaddx, iaddy, iaddz + integer :: i, j, k + call usual_hex_nodes(NGNOD, iaddx, iaddy, iaddz) + iaddx = iaddx * 2 + 1 + iaddy = iaddy * 2 + 1 + iaddz = iaddz * 2 + 1 + i = iaddx(iside) + j = iaddy(iside) + k = iaddz(iside) + is_face = .false. + if ((iside >= 1) .and. (iside <= 8)) then + ! a vertex is on the boundary + i1 = i; i2 = i + j1 = j; j2 = j + k1 = k; k2 = k + else if ((iside >= 9) .and. (iside <= 20)) then + ! an edge is on the boundary + if (i == THREE) then + i1 = 1; i2 = NGLLX + j1 = j; j2 = j + k1 = k; k2 = k + else if (j == THREE) then + i1 = i; i2 = i + j1 = 1; j2 = NGLLY + k1 = k; k2 = k + else if (k == THREE) then + i1 = i; i2 = i + j1 = j; j2 = j + k1 = 1; k2 = NGLLZ + else + call exit_MPI_without_rank('incorrect wavefield discontinuity point') + endif + else if ((iside >= 21) .and. (iside <= 26)) then + ! a face is on the boundary + is_face = .true. + if (i /= THREE) then + i1 = i; i2 = i + j1 = 1; j2 = NGLLY + k1 = 1; k2 = NGLLZ + else if (j /= THREE) then + i1 = 1; i2 = NGLLX + j1 = j; j2 = j + k1 = 1; k2 = NGLLZ + else if (k /= THREE) then + i1 = 1; i2 = NGLLX + j1 = 1; j2 = NGLLY + k1 = k; k2 = k + else + call exit_MPI_without_rank('incorrect wavefield discontinuity point') + endif + else + call exit_MPI_without_rank('incorrect wavefield discontinuity point') + endif + end subroutine get_points_boundary_wd + +end module wavefield_discontinuity_generate_databases From e333501973376bcd17f9bc9a5def479f52d1df56 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Sat, 22 Jun 2024 19:07:42 -0400 Subject: [PATCH 28/56] solver for wavefield discontinuity --- src/inverse_problem_for_model/rules.mk | 1 + src/specfem3D/compute_forces_viscoelastic.F90 | 12 ++ ...te_forces_viscoelastic_calling_routine.F90 | 18 ++ src/specfem3D/initialize_simulation.F90 | 8 +- src/specfem3D/iterate_time.F90 | 19 ++ src/specfem3D/rules.mk | 7 + .../wavefield_discontinuity_solver.f90 | 179 ++++++++++++++++++ 7 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 src/specfem3D/wavefield_discontinuity_solver.f90 diff --git a/src/inverse_problem_for_model/rules.mk b/src/inverse_problem_for_model/rules.mk index c6de580b1..55e2322aa 100644 --- a/src/inverse_problem_for_model/rules.mk +++ b/src/inverse_problem_for_model/rules.mk @@ -111,6 +111,7 @@ inverse_problem_for_model_OBJECTS = \ inverse_problem_for_model_OBJECTS += \ $O/specfem3D_par.spec_module.o \ $O/asdf_data.spec_module.o \ + $O/wavefield_discontinuity_solver.spec.o \ $O/assemble_MPI_vector.spec.o \ $O/calendar.spec.o \ $O/check_stability.spec.o \ diff --git a/src/specfem3D/compute_forces_viscoelastic.F90 b/src/specfem3D/compute_forces_viscoelastic.F90 index 3a5fb47e9..a283e2693 100644 --- a/src/specfem3D/compute_forces_viscoelastic.F90 +++ b/src/specfem3D/compute_forces_viscoelastic.F90 @@ -82,6 +82,11 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & ! PML use pml_par, only: is_CPML,NSPEC_CPML + !! solving wavefield problem with non-split-node scheme + use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY + use wavefield_discontinuity_solver, only: & + add_displacement_discontinuity_element + ! LTS use specfem_par_lts, only: lts_type_compute_pelem,current_lts_elem,current_lts_boundary_elem @@ -312,6 +317,13 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & enddo enddo enddo + !! solving wavefield discontinuity problem with non-split-node scheme + !! add back displacement discontinuity for inner elements of + !! the discontinuity interface + if (IS_WAVEFIELD_DISCONTINUITY) then + call add_displacement_discontinuity_element(ispec, dummyx_loc, & + dummyy_loc, dummyz_loc) + endif endif !------------------------------------------------------------------------------ diff --git a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 index 6e770206e..53b810a33 100644 --- a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 +++ b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 @@ -40,6 +40,10 @@ subroutine compute_forces_viscoelastic_calling() use constants, only: FAULT_SYNCHRONIZE_DISPL_VELOC,FAULT_SYNCHRONIZE_ACCEL use fault_solver_dynamic, only: bc_dynflt_set3d_all,SIMULATION_TYPE_DYN,fault_output_synchronize_GPU,NT_RECORD_LENGTH use fault_solver_kinematic, only: bc_kinflt_set_all,SIMULATION_TYPE_KIN + + !! solving wavefield discontinuity problem with non-split-node scheme + use wavefield_discontinuity_solver, only: & + add_traction_discontinuity, read_wavefield_discontinuity_file implicit none @@ -103,6 +107,12 @@ subroutine compute_forces_viscoelastic_calling() endif endif + !! solving wavefield discontinuity problem with + !! non-split-node scheme + if (IS_WAVEFIELD_DISCONTINUITY) then + call read_wavefield_discontinuity_file() + endif + ! distinguishes two runs: for elements in contact with MPI interfaces, and elements within the partitions do iphase = 1,2 @@ -266,6 +276,14 @@ subroutine compute_forces_viscoelastic_calling() ! on GPU call compute_add_sources_viscoelastic_GPU() endif + + !! solving wavefield discontinuity problem with + !! non-split-node scheme + !! traction discontinuity term must be added in iphase = 1 + !! because these terms need to be used in MPI calls + if (IS_WAVEFIELD_DISCONTINUITY) then + call add_traction_discontinuity() + endif endif ! iphase ! assemble all the contributions between slices using MPI diff --git a/src/specfem3D/initialize_simulation.F90 b/src/specfem3D/initialize_simulation.F90 index c3baa8bc2..c9617b9d2 100644 --- a/src/specfem3D/initialize_simulation.F90 +++ b/src/specfem3D/initialize_simulation.F90 @@ -345,8 +345,12 @@ subroutine initialize_simulation_check() endif ! check that we have at least one source - if (NSOURCES < 1 .and. (.not. HAS_FINITE_FAULT_SOURCE .and. .not. INVERSE_FWI_FULL_PROBLEM)) & - call exit_MPI(myrank,'need at least one source') + if (NSOURCES < 1 .and. (.not. HAS_FINITE_FAULT_SOURCE .and. .not. INVERSE_FWI_FULL_PROBLEM)) then + ! skip source check in case of wavefield discontinuity problem + if (.not. IS_WAVEFIELD_DISCONTINUITY) then + call exit_MPI(myrank,'need at least one source') + endif + endif ! check simulation type if (SIMULATION_TYPE /= 1 .and. SIMULATION_TYPE /= 2 .and. SIMULATION_TYPE /= 3) & diff --git a/src/specfem3D/iterate_time.F90 b/src/specfem3D/iterate_time.F90 index 5f16e06c0..5c413af04 100644 --- a/src/specfem3D/iterate_time.F90 +++ b/src/specfem3D/iterate_time.F90 @@ -39,6 +39,12 @@ subroutine iterate_time() ! hdf5 i/o server use io_server_hdf5, only: do_io_start_idle,pass_info_to_io + !! solving wavefield discontinuity problem with non-split-node scheme + use wavefield_discontinuity_solver, only: & + read_mesh_databases_wavefield_discontinuity, & + open_wavefield_discontinuity_file, & + finalize_wavefield_discontinuity + implicit none ! for EXACT_UNDOING_TO_DISK @@ -207,6 +213,13 @@ subroutine iterate_time() ! get MPI starting time_start = wtime() + !! solving wavefield discontinuity problem with + !! non-split-node scheme + if (IS_WAVEFIELD_DISCONTINUITY) then + call read_mesh_databases_wavefield_discontinuity() + call open_wavefield_discontinuity_file() + endif + ! LTS if (LTS_MODE) then ! LTS steps through its own time iterations - for now @@ -329,6 +342,12 @@ subroutine iterate_time() ! enddo ! end of main time loop + !! solving wavefield discontinuity problem with + !! non-split-node scheme + if (IS_WAVEFIELD_DISCONTINUITY) then + call finalize_wavefield_discontinuity() + endif + ! goto point for LTS to finish time loop 777 continue diff --git a/src/specfem3D/rules.mk b/src/specfem3D/rules.mk index 76595154a..d1d81a9df 100644 --- a/src/specfem3D/rules.mk +++ b/src/specfem3D/rules.mk @@ -45,6 +45,7 @@ specfem3D_TARGETS = \ specfem3D_OBJECTS = \ $O/specfem3D_par.spec_module.o \ $O/asdf_data.spec_module.o \ + $O/wavefield_discontinuity_solver.spec.o \ $O/assemble_MPI_vector.spec.o \ $O/check_stability.spec.o \ $O/comp_source_time_function.spec.o \ @@ -199,6 +200,7 @@ specfem3D_MODULES = \ $(FC_MODDIR)/specfem_par_noise.$(FC_MODEXT) \ $(FC_MODDIR)/specfem_par_lts.$(FC_MODEXT) \ $(FC_MODDIR)/user_noise_distribution.$(FC_MODEXT) \ + $(FC_MODDIR)/wavefield_discontinuity_solver.$(FC_MODEXT) \ $(EMPTY_MACRO) @@ -358,6 +360,11 @@ $O/initialize_simulation.spec.o: $O/adios_manager.shared_adios_module.o ## ASDF compilation $O/write_output_ASDF.spec.o: $O/asdf_data.spec_module.o +## wavefield discontinuity +$O/compute_forces_viscoelastic_calling_routine.spec.o: $O/wavefield_discontinuity_solver.spec.o +$O/compute_forces_viscoelastic.spec.o: $O/wavefield_discontinuity_solver.spec.o +$O/iterate_time.spec.o: $O/wavefield_discontinuity_solver.spec.o + ## kdtree $O/locate_point.spec.o: $O/search_kdtree.shared.o $O/setup_sources_receivers.spec.o: $O/search_kdtree.shared.o diff --git a/src/specfem3D/wavefield_discontinuity_solver.f90 b/src/specfem3D/wavefield_discontinuity_solver.f90 new file mode 100644 index 000000000..72b62684a --- /dev/null +++ b/src/specfem3D/wavefield_discontinuity_solver.f90 @@ -0,0 +1,179 @@ +!! Solving the wavefield discontinuity problem with a non-split-node +!! scheme +!! Tianshi Liu, 2023.5 +module wavefield_discontinuity_solver + use constants, only: CUSTOM_REAL + + !! ispec_to_elem_wd(NSPEC_AB) + !! ispec_to_elem_wd(ispec) = ispec_wd (0 if element not belong to boundary) + !! read from solver database + integer, dimension(:), allocatable :: ispec_to_elem_wd + + !! number of distinct gll points on the boundary + !! read from solver database + integer :: nglob_wd + + !! number of elements on the inner side of the boundary + !! read from solver database + integer :: nspec_wd + + !! ibool_wd(NGLLX, NGLLY, NGLLZ, nspec_wd) + !! ibool_wd(i,j,k,ispec_wd) = iglob_wd (0 if point not on boundary) + !! read from solver database + integer, dimension(:,:,:,:), allocatable :: ibool_wd + + !! boundary_to_iglob_wd(nglob_wd) + !! boundary_to_iglob_wd(iglob_wd) = iglob + !! read from solver database + integer, dimension(:), allocatable :: boundary_to_iglob_wd + + !! mass_in_wd(nglob_wd) + !! mass matrix on the inner side of the boundary + !! note that it is not assembled over processors + !! read from solver database + real(kind=CUSTOM_REAL), dimension(:), allocatable :: mass_in_wd + + !! number of faces on the boundary + !! read from solver database + integer :: nfaces_wd + + !! face_ijk_wd(NDIM, NGLLSQUARE, nfaces_wd) + !! read from solver database + integer, dimension(:,:,:), allocatable :: face_ijk_wd + + !! face_ispec_wd(nfaces_wd) + !! read from solver database + integer, dimension(:), allocatable :: face_ispec_wd + + !! face_normal_wd(NDIM, NGLLSQUARE, nfaces_wd) + !! read from solver database + real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: face_normal_wd + + !! face_jacobian2Dw_wd(NGLLSQUARE, nfaces_wd) + !! read from solver database + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: face_jacobian2dw_wd + + !! displ_wd(NDIM, nglob_wd) + !! displacement discontinuity condition at current time step + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: displ_wd + + !! accel_wd(NDIM, nglob_wd) + !! acceleration discontinuity condition at current time step + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: accel_wd + + !! traction_wd(NDIM, NGLLSQUARE, nfaces_wd) + !! traction discontinuity condition at current time step + real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: traction_wd + +contains + + subroutine read_mesh_databases_wavefield_discontinuity() + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & + FNAME_WAVEFIELD_DISCONTINUITY_DATABASE + use specfem_par, only: CUSTOM_REAL, prname, & + NSPEC_AB, NGLLX, NGLLY, NGLLZ, NDIM, NGLLSQUARE + implicit none + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & + action='read', form='unformatted') + + allocate(ispec_to_elem_wd(NSPEC_AB)) + read(IFILE_WAVEFIELD_DISCONTINUITY) ispec_to_elem_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) nglob_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) nspec_wd + allocate(ibool_wd(NGLLX, NGLLY, NGLLZ, nspec_wd), & + boundary_to_iglob_wd(nglob_wd), & + mass_in_wd(nglob_wd)) + read(IFILE_WAVEFIELD_DISCONTINUITY) ibool_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) boundary_to_iglob_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) mass_in_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) nfaces_wd + allocate(face_ijk_wd(NDIM, NGLLSQUARE, nfaces_wd), & + face_ispec_wd(nfaces_wd), & + face_normal_wd(NDIM, NGLLSQUARE, nfaces_wd), & + face_jacobian2Dw_wd(NGLLSQUARE, nfaces_wd)) + read(IFILE_WAVEFIELD_DISCONTINUITY) face_ijk_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) face_ispec_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) face_normal_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) face_jacobian2Dw_wd + allocate(displ_wd(NDIM, nglob_wd), & + accel_wd(NDIM, nglob_wd), & + traction_wd(NDIM, NGLLSQUARE, nfaces_wd)) + end subroutine read_mesh_databases_wavefield_discontinuity + + subroutine open_wavefield_discontinuity_file() + use specfem_par, only: prname + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY + implicit none + open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & + file=trim(prname)//'wavefield_discontinuity.bin', & + status='old',action='read',form='unformatted') + end subroutine open_wavefield_discontinuity_file + + subroutine read_wavefield_discontinuity_file() + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY + implicit none + read(IFILE_WAVEFIELD_DISCONTINUITY) displ_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) accel_wd + read(IFILE_WAVEFIELD_DISCONTINUITY) traction_wd + end subroutine read_wavefield_discontinuity_file + + subroutine finalize_wavefield_discontinuity() + use constants, only: IFILE_WAVEFIELD_DISCONTINUITY + implicit none + close(IFILE_WAVEFIELD_DISCONTINUITY) + deallocate(ispec_to_elem_wd, ibool_wd, boundary_to_iglob_wd, mass_in_wd, & + face_ijk_wd, face_ispec_wd, face_normal_wd, face_jacobian2Dw_wd, & + displ_wd, accel_wd, traction_wd) + end subroutine finalize_wavefield_discontinuity + + subroutine add_displacement_discontinuity_element(ispec, dummyx_loc, & + dummyy_loc, dummyz_loc) + use specfem_par, only: CUSTOM_REAL,NGLLX, NGLLY, NGLLZ + implicit none + integer, intent(in) :: ispec + real(kind=CUSTOM_REAL), dimension(NGLLX, NGLLY, NGLLZ) :: dummyx_loc, & + dummyy_loc, dummyz_loc + integer :: ispec_wd, i, j, k, iglob_wd + ispec_wd = ispec_to_elem_wd(ispec) + if (ispec_wd /= 0) then + do k=1,NGLLZ + do j=1,NGLLY + do i=1,NGLLX + iglob_wd = ibool_wd(i,j,k,ispec_wd) + if (iglob_wd /= 0) then + dummyx_loc(i,j,k) = dummyx_loc(i,j,k) + displ_wd(1, iglob_wd) + dummyy_loc(i,j,k) = dummyy_loc(i,j,k) + displ_wd(2, iglob_wd) + dummyz_loc(i,j,k) = dummyz_loc(i,j,k) + displ_wd(3, iglob_wd) + endif + enddo + enddo + enddo + endif + end subroutine add_displacement_discontinuity_element + + subroutine add_traction_discontinuity() + use specfem_par, only: CUSTOM_REAL, NGLLX, NGLLY, NGLLZ, NGLLSQUARE, ibool + use specfem_par_elastic, only: accel + implicit none + integer :: iglob_wd, iglob, ispec, i, j, k, iface_wd, igll + real(kind=CUSTOM_REAL) :: jacobianw + do iglob_wd = 1, nglob_wd + iglob = boundary_to_iglob_wd(iglob_wd) + accel(:,iglob) = accel(:,iglob) - & + accel_wd(:,iglob_wd) * mass_in_wd(iglob_wd) + enddo + do iface_wd = 1, nfaces_wd + do igll = 1, NGLLSQUARE + i = face_ijk_wd(1, igll, iface_wd) + j = face_ijk_wd(2, igll, iface_wd) + k = face_ijk_wd(3, igll, iface_wd) + ispec = face_ispec_wd(iface_wd) + iglob = ibool(i,j,k,ispec) + jacobianw = face_jacobian2Dw_wd(igll, iface_wd) + accel(:,iglob) = accel(:,iglob) + & + traction_wd(:,igll,iface_wd) * jacobianw + enddo + enddo + end subroutine add_traction_discontinuity +end module wavefield_discontinuity_solver From 0af8f60cd9f8f1264b83d8b8349025cc51c31d7f Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Sun, 23 Jun 2024 17:42:26 -0400 Subject: [PATCH 29/56] exclude wavefield injection in case of adjoint simulation (SIMULATION_TYPE==1 .and. .not. backward_simulation) --- src/specfem3D/compute_forces_viscoelastic.F90 | 4 +++- .../compute_forces_viscoelastic_calling_routine.F90 | 8 +++++--- src/specfem3D/wavefield_discontinuity_solver.f90 | 10 ++++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/specfem3D/compute_forces_viscoelastic.F90 b/src/specfem3D/compute_forces_viscoelastic.F90 index a283e2693..2817d6c28 100644 --- a/src/specfem3D/compute_forces_viscoelastic.F90 +++ b/src/specfem3D/compute_forces_viscoelastic.F90 @@ -320,7 +320,9 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & !! solving wavefield discontinuity problem with non-split-node scheme !! add back displacement discontinuity for inner elements of !! the discontinuity interface - if (IS_WAVEFIELD_DISCONTINUITY) then + !! note that this is called in adjoint simulation + if (IS_WAVEFIELD_DISCONTINUITY .and. & + ((SIMULATION_TYPE == 1) .or. backward_simulation)) then call add_displacement_discontinuity_element(ispec, dummyx_loc, & dummyy_loc, dummyz_loc) endif diff --git a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 index 53b810a33..8d3627c0e 100644 --- a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 +++ b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 @@ -109,7 +109,8 @@ subroutine compute_forces_viscoelastic_calling() !! solving wavefield discontinuity problem with !! non-split-node scheme - if (IS_WAVEFIELD_DISCONTINUITY) then + !! note that this is not called in case of adjoint simulation + if (IS_WAVEFIELD_DISCONTINUITY .and. (SIMULATION_TYPE == 1)) then call read_wavefield_discontinuity_file() endif @@ -281,8 +282,9 @@ subroutine compute_forces_viscoelastic_calling() !! non-split-node scheme !! traction discontinuity term must be added in iphase = 1 !! because these terms need to be used in MPI calls - if (IS_WAVEFIELD_DISCONTINUITY) then - call add_traction_discontinuity() + !! note that this is not called in case of adjoint simulation + if (IS_WAVEFIELD_DISCONTINUITY .and. (SIMULATION_TYPE == 1)) then + call add_traction_discontinuity(accel, NGLOB_AB) endif endif ! iphase diff --git a/src/specfem3D/wavefield_discontinuity_solver.f90 b/src/specfem3D/wavefield_discontinuity_solver.f90 index 72b62684a..e13886ffa 100644 --- a/src/specfem3D/wavefield_discontinuity_solver.f90 +++ b/src/specfem3D/wavefield_discontinuity_solver.f90 @@ -152,12 +152,14 @@ subroutine add_displacement_discontinuity_element(ispec, dummyx_loc, & endif end subroutine add_displacement_discontinuity_element - subroutine add_traction_discontinuity() - use specfem_par, only: CUSTOM_REAL, NGLLX, NGLLY, NGLLZ, NGLLSQUARE, ibool - use specfem_par_elastic, only: accel + subroutine add_traction_discontinuity(accel, nglob) + use specfem_par, only: CUSTOM_REAL, NGLLX, NGLLY, NGLLZ, NGLLSQUARE, & + ibool, NDIM + !use specfem_par_elastic, only: accel implicit none - integer :: iglob_wd, iglob, ispec, i, j, k, iface_wd, igll + integer :: iglob_wd, iglob, ispec, i, j, k, iface_wd, igll, nglob real(kind=CUSTOM_REAL) :: jacobianw + real(kind=CUSTOM_REAL) :: accel(NDIM, nglob) do iglob_wd = 1, nglob_wd iglob = boundary_to_iglob_wd(iglob_wd) accel(:,iglob) = accel(:,iglob) - & From 59ae952d7cf617cbbf23005c0930365702d7654e Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Sun, 23 Jun 2024 18:27:49 -0400 Subject: [PATCH 30/56] include changes for wavefield discontinuity to constants.h.in --- setup/constants.h.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup/constants.h.in b/setup/constants.h.in index 1f0260307..3bfed6bfe 100644 --- a/setup/constants.h.in +++ b/setup/constants.h.in @@ -303,6 +303,12 @@ ! file name for ASCII wavefield discontinuity box file character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_BOX = 'wavefield_discontinuity_box' +! file name for binary wavefield discontinuity mesh file + character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_MESH = 'wavefield_discontinuity_mesh.bin' + +! file name for binary wavefield discontinuity solver database file + character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_DATABASE = 'wavefield_discontinuity_database.bin' + !!----------------------------------------------------------- !! !! mesh optimization From 3cf37c41fe3df6aca0a075e6f41dd01f43757bb2 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Mon, 24 Jun 2024 15:46:49 -0400 Subject: [PATCH 31/56] add a small example for wavefield discontinuity problem --- .../compute_fk_injection_field.f90 | 254 +++ .../fk_coupling/compute_fk_receiver.f90 | 174 ++ .../fk_coupling/coupling_fk.f90 | 1529 +++++++++++++++++ .../fk_coupling/make_fk_injection.sh | 6 + .../fk_coupling/utils.f90 | 72 + .../plot/plot_utils_injection.py | 255 +++ .../test_small_injection/DATA/CMTSOLUTION | 13 + .../test_small_injection/DATA/FORCESOLUTION | 0 .../test_small_injection/DATA/Par_file | 405 +++++ .../test_small_injection/DATA/STATIONS | 4 + .../DATA/STATIONS_FILTERED | 4 + .../DATA/meshfem3D_files/Mesh_Par_file | 103 ++ .../DATA/meshfem3D_files/interfaces.dat | 18 + .../DATA/meshfem3D_files/moho.dat | 4 + .../DATA/meshfem3D_files/top.dat | 4 + .../test_small_injection/fk_model | 14 + .../test_small_injection/plot_seismograms.py | 53 + .../test_small_injection/run_this_example.sh | 79 + .../wavefield_discontinuity_box | 8 + 19 files changed, 2999 insertions(+) create mode 100644 EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_injection_field.f90 create mode 100644 EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_receiver.f90 create mode 100644 EXAMPLES/applications/wavefield_discontinuity/fk_coupling/coupling_fk.f90 create mode 100644 EXAMPLES/applications/wavefield_discontinuity/fk_coupling/make_fk_injection.sh create mode 100644 EXAMPLES/applications/wavefield_discontinuity/fk_coupling/utils.f90 create mode 100644 EXAMPLES/applications/wavefield_discontinuity/plot/plot_utils_injection.py create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/CMTSOLUTION create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/FORCESOLUTION create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/Par_file create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS_FILTERED create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/interfaces.dat create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/moho.dat create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/top.dat create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/fk_model create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py create mode 100755 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh create mode 100644 EXAMPLES/applications/wavefield_discontinuity/test_small_injection/wavefield_discontinuity_box diff --git a/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_injection_field.f90 b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_injection_field.f90 new file mode 100644 index 000000000..1ea41584a --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_injection_field.f90 @@ -0,0 +1,254 @@ +program write_injection_field + use mpi + use fk_injection + implicit none + integer, parameter :: THREE = 3 + integer, parameter :: NGLLMID = (NGLLSQUARE + 1) / 2 + integer :: ier, ip, ib, igll, ilayer,nlines, nb, np + character(len=256) :: fn, line + real(kind=CUSTOM_REAL), dimension(:), allocatable :: xp, yp, zp + real(kind=CUSTOM_REAL), dimension(:), allocatable :: xb, yb, zb, nxb, nyb, nzb + !real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: displ, accel + !real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: traction + real(kind=CUSTOM_REAL) :: ray_p,Tg,DF_FK + + real(kind=CUSTOM_REAL) :: rho_tmp,kappa_tmp,mu_tmp,alpha_tmp,beta_tmp,xi + integer :: ii, kk, iim1, iip1, iip2, it_tmp + real(kind=CUSTOM_REAL) :: cs1,cs2,cs3,cs4,w + + real(kind=CUSTOM_REAL), parameter :: TOL_ZERO_TAKEOFF = 1.e-14 + + real(kind=CUSTOM_REAL) :: zmid, ztop + real(kind=CUSTOM_REAL) :: time_t + + call MPI_Init(ier) + if (ier /= 0 ) stop 'Error initializing MPI' + call MPI_Comm_rank(MPI_COMM_WORLD, myrank, ier) + + write(fn, "('DATABASES_MPI/proc',i6.6,'_wavefield_discontinuity_points')")& + myrank + open(77, file=trim(fn), action="read") + ier = 0 + nlines = 0 + do while (ier == 0) + read(77, '(a)', iostat=ier) line + if (ier == 0) nlines = nlines + 1 + enddo + close(77) + np = nlines + allocate(xp(np), yp(np), zp(np)) + !allocate(displ(THREE, np), accel(THREE, np)) + !displ(:,:) = 0.0 + !accel(:,:) = 0.0 + open(77, file=trim(fn), action="read") + do ip = 1, np + read(77, *) xp(ip), yp(ip), zp(ip) + enddo + close(77) + write(fn, "('DATABASES_MPI/proc',i6.6,'_wavefield_discontinuity_faces')")& + myrank + open(77, file=trim(fn), action="read") + ier = 0 + nlines = 0 + do while (ier == 0) + read(77, '(a)', iostat=ier) line + if (ier == 0) nlines = nlines + 1 + enddo + close(77) + nb = nlines / NGLLSQUARE + allocate(xb(nb*NGLLSQUARE), yb(nb*NGLLSQUARE), & + zb(nb*NGLLSQUARE), nxb(nb*NGLLSQUARE), nyb(nb*NGLLSQUARE), & + nzb(nb*NGLLSQUARE), xi1(nb*NGLLSQUARE), xim(nb*NGLLSQUARE), & + bdlambdamu(nb*NGLLSQUARE)) + !allocate(traction(THREE, NGLLSQUARE, nb)) + !traction(:,:,:) = 0.0 + open(77, file=trim(fn), action="read") + do ip = 1, nb*NGLLSQUARE + ! do igll = 1, NGLLSQUARE + read(77, *) xb(ip), yb(ip), zb(ip), & + nxb(ip), nyb(ip), nzb(ip) + ! enddo + enddo + close(77) + + + call ReadFKModelInput() + + ! converts origin point Z to reference framework depth for FK, + ! where top of lower half-space has to be at z==0 + zz0 = zz0 - Z_REF_for_FK + + ! converts to rad + phi_FK = phi_FK * PI/180.d0 ! azimuth + theta_FK = theta_FK * PI/180.d0 ! take-off + + ! ray parameter p (according to Snell's law: sin(theta1)/v1 == + ! sin(theta2)/v2) + if (type_kpsv_fk == 1) then + ! P-wave + ray_p = sin(theta_FK)/alpha_FK(nlayer) ! for vp (i.e., alpha) + else if (type_kpsv_fk == 2) then + ! SV-wave + ray_p = sin(theta_FK)/beta_FK(nlayer) ! for vs (i.e., beta) + endif + + ! note: vertical incident (theta==0 -> p==0) is not handled. + ! here, it limits ray parameter p to a very small value to handle + ! the calculations + if (abs(ray_p) < TOL_ZERO_TAKEOFF) ray_p = sign(TOL_ZERO_TAKEOFF,ray_p) + + ! maximum period + Tg = 1.d0 / ff0 + + call find_size_of_working_arrays(deltat, freq_sampling_fk, tmax_fk, & + NF_FOR_STORING, & + NF_FOR_FFT, NPOW_FOR_INTERP, NP_RESAMP, & + DF_FK) + + ! user output + if (myrank == 0) then + write(IMAIN,*) ' computed FK parameters:' + write(IMAIN,*) ' frequency sampling rate = ', freq_sampling_fk,"(Hz)" + write(IMAIN,*) ' number of frequencies to store = ', NF_FOR_STORING + write(IMAIN,*) ' number of frequencies for FFT = ', NF_FOR_FFT + write(IMAIN,*) ' power of 2 for FFT = ', NPOW_FOR_INTERP + write(IMAIN,*) + write(IMAIN,*) ' simulation time step = ', deltat,"(s)" + write(IMAIN,*) ' total simulation length = ', NSTEP*deltat,"(s)" + write(IMAIN,*) + write(IMAIN,*) ' FK time resampling rate = ', NP_RESAMP + write(IMAIN,*) ' new time step for F-K = ', NP_RESAMP * deltat,"(s)" + write(IMAIN,*) ' new time window length = ', tmax_fk,"(s)" + write(IMAIN,*) + write(IMAIN,*) ' frequency step for F-K = ', DF_FK,"(Hz)" + call flush_IMAIN() + endif + + ! safety check with number of simulation time steps + if (NSTEP/NP_RESAMP > NF_FOR_STORING + NP_RESAMP) then + if (myrank == 0) then + print *,'Error: FK time window length ',tmax_fk,' and NF_for_storing ',NF_FOR_STORING + print *,' are too small for chosen simulation length with NSTEP = ',NSTEP + print * + print *,' you could use a smaller NSTEP <= ',NF_FOR_STORING*NP_RESAMP + print *,' or' + print *,' increase FK window length larger than ',(NSTEP/NP_RESAMP - NP_RESAMP) * NP_RESAMP * deltat + print *,' to have a NF for storing larger than ',(NSTEP/NP_RESAMP - NP_RESAMP) + endif + stop 'Invalid FK setting' + endif + + ! safety check + if (NP_RESAMP == 0) then + if (myrank == 0) then + print *,'Error: FK resampling rate ',NP_RESAMP,' is invalid for frequency sampling rate ',freq_sampling_fk + print *,' and the chosen simulation DT = ',deltat + print * + print *,' you could use a higher frequency sampling rate>',1./(deltat) + print *,' (or increase the time stepping size DT if possible)' + endif + stop 'Invalid FK setting' + endif + + ! limits resampling sizes + if (NP_RESAMP > 10000) then + if (myrank == 0) then + print *,'Error: FK resampling rate ',NP_RESAMP,' is too high for frequency sampling rate ',freq_sampling_fk + print *,' and the chosen simulation DT = ',deltat + print * + print *,' you could use a higher frequency sampling rate>',1./(10000*deltat) + print *,' (or increase the time stepping size DT if possible)' + endif + stop 'Invalid FK setting' + endif + + allocate(displ(THREE, np, -NP_RESAMP:NF_FOR_STORING+NP_RESAMP), & + accel(THREE, np, -NP_RESAMP:NF_FOR_STORING+NP_RESAMP), & + traction(THREE, NGLLSQUARE*nb, -NP_RESAMP:NF_FOR_STORING+NP_RESAMP)) + + do ib = 1, nb + zmid = zb((ib-1)*NGLLSQUARE+NGLLMID) + ztop = 0.0 + do ilayer = 1, nlayer-1 + ztop = ztop - h_FK(ilayer) + if (ztop < zmid) exit + enddo + if (ztop > zmid) ilayer = nlayer + rho_tmp = rho_FK(ilayer) + alpha_tmp = alpha_FK(ilayer) + beta_tmp = beta_FK(ilayer) + kappa_tmp = rho_tmp*(alpha_tmp*alpha_tmp-4.0/3.0*beta_tmp*beta_tmp) + mu_tmp = rho_tmp*beta_tmp*beta_tmp + xi = mu_tmp/(kappa_tmp + 4.0/3.0 * mu_tmp) + xi1((ib-1)*NGLLSQUARE+1:ib*NGLLSQUARE) = 1.0 - 2.0 * xi + xim((ib-1)*NGLLSQUARE+1:ib*NGLLSQUARE) = (1.0 - xi) * mu_tmp + bdlambdamu((ib-1)*NGLLSQUARE+1:ib*NGLLSQUARE) = & + (3.0 * kappa_tmp - 2.0 * mu_tmp) / (6.0 * kappa_tmp + 2.0 * mu_tmp) ! Poisson's ratio 3K-2G/[2(3K+G)] + enddo + + allocate(xx(np), yy(np), zz(np)) + xx(:) = xp(:); yy(:) = yp(:); zz(:) = zp(:) - Z_REF_for_FK + call FK(alpha_FK, beta_FK, mu_FK, h_FK, nlayer, & + Tg, ray_p, phi_FK, xx0, yy0, zz0, & + tt0, deltat, nstep, np, & + type_kpsv_fk, NF_FOR_STORING, NPOW_FOR_FFT, NP_RESAMP, DF_FK, & + .false.) + deallocate(xx, yy, zz) + allocate(xx(nb*NGLLSQUARE), yy(nb*NGLLSQUARE), zz(nb*NGLLSQUARE), & + nmx(nb*NGLLSQUARE), nmy(nb*NGLLSQUARE), nmz(nb*NGLLSQUARE)) + xx(:) = xb(:); yy(:) = yb(:); zz(:) = zb(:) - Z_REF_for_FK + nmx(:) = nxb(:); nmy(:) = nyb(:); nmz(:) = nzb(:) + call FK(alpha_FK, beta_FK, mu_FK, h_FK, nlayer, & + Tg, ray_p, phi_FK, xx0, yy0, zz0, & + tt0, deltat, nstep, nb*NGLLSQUARE, & + type_kpsv_fk, NF_FOR_STORING, NPOW_FOR_FFT, NP_RESAMP, DF_FK, & + .true.) + deallocate(xx, yy, zz) + write(fn, "('DATABASES_MPI/proc',i6.6,'_wavefield_discontinuity.bin')")& + myrank + open(88, file=trim(fn), form="unformatted", action="write") + if (myrank == 0) open(99, file='injection_displ', form='formatted', action='write') + ! data + do it_tmp = 1,NSTEP + ! FK coupling + !! find indices + ! example: + ! np_resamp = 1 and it = 1,2,3,4,5,6, .. + ! --> ii = 1,2,3,4,5,6,.. + ! np_resamp = 2 and it = 1,2,3,4,5,6, .. + ! --> ii = 1,1,2,2,3,3,.. + ii = floor( real(it_tmp + NP_RESAMP - 1) / real( NP_RESAMP)) + ! example: + ! kk = 1,2,1,2,1,2,,.. + kk = it_tmp - (ii-1) * NP_RESAMP + ! example: + ! w = 0,1/2,0,1/2,.. + w = dble(kk-1) / dble(NP_RESAMP) + + ! Cubic spline values + cs4 = w*w*w/6.d0 + cs1 = 1.d0/6.d0 + w*(w-1.d0)/2.d0 - cs4 + cs3 = w + cs1 - 2.d0*cs4 + cs2 = 1.d0 - cs1 - cs3 - cs4 + + ! interpolation indices + iim1 = ii-1 ! 0,.. + iip1 = ii+1 ! 2,.. + iip2 = ii+2 ! 3,.. + + write(88) cs1*displ(:,:,iim1)+cs2*displ(:,:,ii)+cs3*displ(:,:,iip1)& + +cs4*displ(:,:,iip2) + write(88) cs1*accel(:,:,iim1)+cs2*accel(:,:,ii)+cs3*accel(:,:,iip1)& + +cs4*accel(:,:,iip2) + write(88) cs1*traction(:,:,iim1)+cs2*traction(:,:,ii)& + +cs3*traction(:,:,iip1)+cs4*traction(:,:,iip2) + ! time + time_t = (it_tmp-1) * deltat - tt0 + if (myrank == 0) write(99, *) time_t, & + cs1*displ(3,1,iim1)+cs2*displ(3,1,ii)+cs3*displ(3,1,iip1)& + +cs4*displ(3,1,iip2) + enddo + close(88) + close(99) + call MPI_Finalize(ier) +end program write_injection_field diff --git a/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_receiver.f90 b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_receiver.f90 new file mode 100644 index 000000000..8ee15f5e6 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/compute_fk_receiver.f90 @@ -0,0 +1,174 @@ +program compute_fk_receiver + use fk_injection + implicit none + integer, parameter :: THREE = 3 + character(len=256) :: fn, line + character(len=3) :: char_comp = 'XYZ' + integer :: ier, ip, np, nlines, ic + real(kind=CUSTOM_REAL), dimension(:), allocatable :: xp, yp, zp + real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: seismogram + character(len=256), dimension(:), allocatable :: nt_name, sta_name + real(kind=CUSTOM_REAL) :: ray_p,Tg,DF_FK + + real(kind=CUSTOM_REAL) :: rho_tmp,kappa_tmp,mu_tmp,alpha_tmp,beta_tmp,xi + integer :: ii, kk, iim1, iip1, iip2, it_tmp + real(kind=CUSTOM_REAL) :: cs1,cs2,cs3,cs4,w + + real(kind=CUSTOM_REAL), parameter :: TOL_ZERO_TAKEOFF = 1.e-14 + + real(kind=CUSTOM_REAL) :: zmid, ztop + real(kind=CUSTOM_REAL) :: time_t + + fn = "DATA/STATIONS" + open(77, file=trim(fn), action="read") + ier = 0 + nlines = 0 + do while (ier == 0) + read(77, '(a)', iostat=ier) line + if (ier == 0) nlines = nlines + 1 + enddo + close(77) + np = nlines + allocate(xp(np), yp(np), zp(np), nt_name(np), sta_name(np)) + open(77, file=trim(fn), action="read") + do ip = 1, np + read(77, *) sta_name(ip), nt_name(ip), yp(ip), xp(ip), zp(ip) + enddo + close(77) + + call ReadFKModelInput() + + ! converts origin point Z to reference framework depth for FK, + ! where top of lower half-space has to be at z==0 + zz0 = zz0 - Z_REF_for_FK + + ! converts to rad + phi_FK = phi_FK * PI/180.d0 ! azimuth + theta_FK = theta_FK * PI/180.d0 ! take-off + + ! ray parameter p (according to Snell's law: sin(theta1)/v1 == + ! sin(theta2)/v2) + if (type_kpsv_fk == 1) then + ! P-wave + ray_p = sin(theta_FK)/alpha_FK(nlayer) ! for vp (i.e., alpha) + else if (type_kpsv_fk == 2) then + ! SV-wave + ray_p = sin(theta_FK)/beta_FK(nlayer) ! for vs (i.e., beta) + endif + + ! note: vertical incident (theta==0 -> p==0) is not handled. + ! here, it limits ray parameter p to a very small value to handle + ! the calculations + if (abs(ray_p) < TOL_ZERO_TAKEOFF) ray_p = sign(TOL_ZERO_TAKEOFF,ray_p) + + ! maximum period + Tg = 1.d0 / ff0 + + call find_size_of_working_arrays(deltat, freq_sampling_fk, tmax_fk, & + NF_FOR_STORING, & + NF_FOR_FFT, NPOW_FOR_INTERP, NP_RESAMP, & + DF_FK) + + ! user output + if (myrank == 0) then + write(IMAIN,*) ' computed FK parameters:' + write(IMAIN,*) ' frequency sampling rate = ', freq_sampling_fk,"(Hz)" + write(IMAIN,*) ' number of frequencies to store = ', NF_FOR_STORING + write(IMAIN,*) ' number of frequencies for FFT = ', NF_FOR_FFT + write(IMAIN,*) ' power of 2 for FFT = ', NPOW_FOR_INTERP + write(IMAIN,*) + write(IMAIN,*) ' simulation time step = ', deltat,"(s)" + write(IMAIN,*) ' total simulation length = ', NSTEP*deltat,"(s)" + write(IMAIN,*) + write(IMAIN,*) ' FK time resampling rate = ', NP_RESAMP + write(IMAIN,*) ' new time step for F-K = ', NP_RESAMP * deltat,"(s)" + write(IMAIN,*) ' new time window length = ', tmax_fk,"(s)" + write(IMAIN,*) + write(IMAIN,*) ' frequency step for F-K = ', DF_FK,"(Hz)" + call flush_IMAIN() + endif + + ! safety check with number of simulation time steps + if (NSTEP/NP_RESAMP > NF_FOR_STORING + NP_RESAMP) then + if (myrank == 0) then + print *,'Error: FK time window length ',tmax_fk,' and NF_for_storing ',NF_FOR_STORING + print *,' are too small for chosen simulation length with NSTEP = ',NSTEP + print * + print *,' you could use a smaller NSTEP <= ',NF_FOR_STORING*NP_RESAMP + print *,' or' + print *,' increase FK window length larger than ',(NSTEP/NP_RESAMP -NP_RESAMP) * NP_RESAMP * deltat + print *,' to have a NF for storing larger than ',(NSTEP/NP_RESAMP -NP_RESAMP) + endif + stop 'Invalid FK setting' + endif + + ! limits resampling sizes + if (NP_RESAMP > 10000) then + if (myrank == 0) then + print *,'Error: FK resampling rate ',NP_RESAMP,' is too high for frequencysampling rate ',freq_sampling_fk + print *,' and the chosen simulation DT = ',deltat + print * + print *,' you could use a higher frequency sampling rate>',1./(10000*deltat) + print *,' (or increase the time stepping size DT if possible)' + endif + stop 'Invalid FK setting' + endif + + allocate(displ(THREE, np, -NP_RESAMP:NF_FOR_STORING+NP_RESAMP), & + accel(THREE, np, -NP_RESAMP:NF_FOR_STORING+NP_RESAMP)) + + allocate(xx(np), yy(np), zz(np)) + xx(:) = xp(:); yy(:) = yp(:); zz(:) = zp(:) - Z_REF_for_FK + call FK(alpha_FK, beta_FK, mu_FK, h_FK, nlayer, & + Tg, ray_p, phi_FK, xx0, yy0, zz0, & + tt0, deltat, nstep, np, & + type_kpsv_fk, NF_FOR_STORING, NPOW_FOR_FFT, NP_RESAMP, DF_FK, & + .false.) + deallocate(xx, yy, zz) + + allocate(seismogram(THREE, np, NSTEP)) + do it_tmp = 1,NSTEP + ! FK coupling + !! find indices + ! example: + ! np_resamp = 1 and it = 1,2,3,4,5,6, .. + ! --> ii = 1,2,3,4,5,6,.. + ! np_resamp = 2 and it = 1,2,3,4,5,6, .. + ! --> ii = 1,1,2,2,3,3,.. + ii = floor( real(it_tmp + NP_RESAMP - 1) / real( NP_RESAMP)) + ! example: + ! kk = 1,2,1,2,1,2,,.. + kk = it_tmp - (ii-1) * NP_RESAMP + ! example: + ! w = 0,1/2,0,1/2,.. + w = dble(kk-1) / dble(NP_RESAMP) + + ! Cubic spline values + cs4 = w*w*w/6.d0 + cs1 = 1.d0/6.d0 + w*(w-1.d0)/2.d0 - cs4 + cs3 = w + cs1 - 2.d0*cs4 + cs2 = 1.d0 - cs1 - cs3 - cs4 + + ! interpolation indices + iim1 = ii-1 ! 0,.. + iip1 = ii+1 ! 2,.. + iip2 = ii+2 ! 3,.. + + seismogram(:,:,it_tmp) = cs1*displ(:,:,iim1)+cs2*displ(:,:,ii)+& + cs3*displ(:,:,iip1)+cs4*displ(:,:,iip2) + enddo + + do ip = 1, np + do ic = 1, THREE + fn = "OUTPUT_FILES/"//trim(nt_name(ip))//'.'//trim(sta_name(ip)) & + //'.'//char_comp(ic:ic)//".fkd" + open(77, file=trim(fn), action='write') + do it_tmp = 1, NSTEP + time_t = (it_tmp-1) * deltat - tt0 + write(77, *) time_t, seismogram(ic, ip, it_tmp) + enddo + close(77) + enddo + enddo + deallocate(xp, yp, zp, nt_name, sta_name, displ, accel, seismogram) +end program compute_fk_receiver diff --git a/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/coupling_fk.f90 b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/coupling_fk.f90 new file mode 100644 index 000000000..9720150d7 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/coupling_fk.f90 @@ -0,0 +1,1529 @@ + + +module fk_injection + integer, parameter :: CUSTOM_REAL = 4, IMAIN = 6, NGLLSQUARE = 25 + double precision, parameter :: PI = 3.141592653589793d0, & + TINYVAL = 1.d-9 + integer :: myrank + integer :: NSTEP + real(kind=CUSTOM_REAL) :: deltat + character(len=100) :: FKMODEL_FILE = 'fk_model' + ! FK elastic + integer :: nlayer + integer :: NF_FOR_STORING, NF_FOR_FFT, NPOW_FOR_FFT, NP_RESAMP, NPOW_FOR_INTERP + integer :: NPTS_STORED, NPTS_INTERP + + !real(kind=CUSTOM_REAL),dimension(:,:),allocatable :: & + ! vxbd,vybd,vzbd,txxbd,txybd,txzbd,tyybd,tyzbd,tzzbd + real(kind=CUSTOM_REAL) :: Z_REF_for_FK + + ! source + integer :: type_kpsv_fk = 0 ! incident wave type: 1 == P-wave, 2 == SV-wave + real(kind=CUSTOM_REAL) :: xx0,yy0,zz0,ff0,tt0,tmax_fk,freq_sampling_fk,amplitude_fk + real(kind=CUSTOM_REAL) :: phi_FK,theta_FK + + ! model + real(kind=CUSTOM_REAL),dimension(:),allocatable :: alpha_FK,beta_FK,rho_FK,mu_FK,h_FK + !complex(kind=8), dimension(:,:), allocatable :: VX_f, VY_f, VZ_f, TX_f, TY_f, TZ_f + real(kind=CUSTOM_REAL),dimension(:,:,:),allocatable :: displ, accel, traction + + !complex(kind=8), dimension(:), allocatable :: WKS_CMPLX_FOR_FFT + !real(kind=CUSTOM_REAL), dimension(:), allocatable :: WKS_REAL_FOR_FFT + + real(kind=CUSTOM_REAL),dimension(:),allocatable :: xx,yy,zz,xi1,xim,bdlambdamu + + ! normal + real(kind=CUSTOM_REAL),dimension(:),allocatable :: nmx,nmy,nmz +end module fk_injection + + subroutine FK(al, be, mu, H, nlayer, & + Tg, ray_p, phi, x0, y0, z0, & + t0, dt, npts, npt, & + kpsv, NF_FOR_STORING, NPOW_FOR_FFT, NP_RESAMP, DF_FK, & + compute_traction) + + use fk_injection, only: myrank,CUSTOM_REAL,IMAIN,PI,TINYVAL,& + NGLLSQUARE, & + displ, accel, traction, & + xx, yy, zz, xi1, xim, bdlambdamu, & + nmx, nmy, nmz, NPTS_STORED, NPTS_INTERP, & + amplitude_fk + + implicit none + + integer, parameter :: CUSTOM_CMPLX = 8 + real(kind=CUSTOM_REAL), parameter :: zign_neg = -1.0 + + ! input and output + integer, intent(in) :: nlayer, npt, npts, kpsv + integer :: NF_FOR_STORING, NPOW_FOR_FFT, NP_RESAMP + + ! model + real(kind=CUSTOM_REAL), dimension(nlayer), intent(in) :: al(nlayer),be(nlayer),mu(nlayer),H(nlayer) + + ! source + real(kind=CUSTOM_REAL), intent(in) :: dt, ray_p, phi, x0, y0, z0, Tg, t0, DF_FK + + ! local parameters + real(kind=CUSTOM_REAL), dimension(:), allocatable :: fvec, dtmp + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: field + real(kind=CUSTOM_REAL), dimension(:), allocatable :: tmp_t1, tmp_t2, tmp_t3, tmp_it1 + + complex(kind=CUSTOM_CMPLX), dimension(:,:), allocatable :: coeff, field_f + complex(kind=CUSTOM_CMPLX), dimension(:), allocatable :: tmp_f1, tmp_f2, tmp_f3 + complex(kind=CUSTOM_CMPLX) :: C_3,stf_coeff,a,b,c,d,delta_mat + complex(kind=CUSTOM_CMPLX) :: dx_f,dz_f,txz_f,tzz_f + complex(kind=CUSTOM_CMPLX) :: N_mat(4,4) + + real(kind=CUSTOM_REAL) :: sigma_rr,sigma_rt,sigma_rz,sigma_tt,sigma_tz,sigma_zz + real(kind=CUSTOM_REAL) :: Txx_tmp, Txy_tmp, Txz_tmp, Tyy_tmp, Tyz_tmp, Tzz_tmp + real(kind=CUSTOM_REAL) :: dt_fk,df,om,Tdelay,eta_p,eta_s,f_Nyquist,C_1 + + integer :: npow,npts2,nf,nf2,nn,ii,ipt,i,j,lpts + integer :: npoints2 + integer :: ier,iface,igll,ispec + + ! spline work array + double precision, dimension(:), allocatable :: tmp_c + +!! DK DK here is the hardwired maximum size of the array +!! DK DK Aug 2016: if this routine is called many times (for different mesh points at which the SEM is coupled with FK) +!! DK DK Aug 2016: this should be moved to the calling program and precomputed once and for all + real(kind=CUSTOM_REAL) :: mpow(30) + + ! taper + ! idea: tapers the onset of the injection traces to diminish numerical noise. + ! the inverse FFT can lead to non-zero onsets for coarse frequency sampling. + logical, parameter :: USE_TAPERED_BEGINNING = .false. + integer, parameter :: taper_nlength = 20 ! tapers first 20 steps + real(kind=CUSTOM_REAL) :: taper + + ! fixed parameters + !integer, parameter :: nvar = 5 + logical :: compute_traction + integer :: nvar + + if (compute_traction) then + nvar = 3 + else + nvar = 4 + endif + + ! initializations + !! new way to do time domain resampling + df = DF_FK + nf2 = NF_FOR_STORING+1 ! number of positive frequency sample points + nf = 2*NF_FOR_STORING ! number of total frequencies after symmetrisation + npts2 = nf ! number of samples in time serie + + !! VM VM recompute new values for new way to do + npow = ceiling(log(npts2*1.0)/log(2.0)) + npts2 = 2**npow + NPOW_FOR_FFT = npow + + !! number of points for resampled vector + npoints2 = NP_RESAMP*(npts2-1)+1 + + dt_fk = 1.0_CUSTOM_REAL/(df*(npts2-1)) + f_Nyquist = 1.0_CUSTOM_REAL/(2.0_CUSTOM_REAL * dt) ! Nyquist frequency of specfem time serie + + ! user output + if (myrank == 0) then + write(IMAIN,*) + write(IMAIN,*) ' Entering the FK synthetics program:' + write(IMAIN,*) ' Number of samples stored for FK solution = ', NF_FOR_STORING + write(IMAIN,*) ' Number of points used for FFT = ', npts2 + write(IMAIN,*) ' Total time length used for FK = ', t0+(npts2-1)*dt_fk,'(s)' + write(IMAIN,*) + write(IMAIN,*) ' simulation Nyquist frequency = ', f_Nyquist,'(Hz)' + write(IMAIN,*) ' FK time step = ', dt_fk + write(IMAIN,*) ' FK frequency step = ', df + write(IMAIN,*) ' power of 2 for FFT = ', npow + write(IMAIN,*) + call flush_IMAIN() + endif + + !! check if dt_fk is compatible with dt_specfem + !! + !! + !! + + allocate(fvec(nf2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2218') + if (ier /= 0) stop 'error while allocating' + fvec(:) = 0.0_CUSTOM_REAL + do ii = 1, nf2 + fvec(ii) = (ii-1)*df + enddo + + allocate(coeff(2,nf2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2219') + if (ier /= 0) stop 'error while allocating' + coeff(:,:) = (0.d0,0.d0) + + allocate(field_f(nf,nvar),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2220') + if (ier /= 0) stop 'error while allocating' + field_f(:,:) = (0.d0,0.d0) + + allocate(field(npts2,nvar),dtmp(npts),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2221') + if (ier /= 0) stop 'error while allocating' + field(:,:) = 0._CUSTOM_REAL; dtmp(:) = 0._CUSTOM_REAL + + !! allocate debug vectors + allocate(tmp_f1(npts2), tmp_f2(npts2), tmp_f3(npts2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2222') + if (ier /= 0) stop 'error while allocating' + tmp_f1(:) = (0.d0,0.d0) + tmp_f2(:) = (0.d0,0.d0) + tmp_f3(:) = (0.d0,0.d0) + + if (ier /= 0) stop 'error while allocating' + allocate(tmp_t1(npts2), tmp_t2(npts2), tmp_t3(npts2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2223') + if (ier /= 0) stop 'error while allocating' + tmp_t1(:) = 0.0_CUSTOM_REAL + tmp_t2(:) = 0.0_CUSTOM_REAL + tmp_t3(:) = 0.0_CUSTOM_REAL + + allocate(tmp_it1(npoints2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2224') + if (ier /= 0) stop 'error while allocating' + tmp_it1(:) = 0.0_CUSTOM_REAL + + ! temporary work array for splines + allocate(tmp_c(npts2),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating array 2225') + tmp_c(:) = 0.d0 + + NPTS_STORED = npts2 + NPTS_INTERP = npoints2 + + nn = int(-t0/dt) ! what if this is not an integer number? + +!! DK DK Aug 2016: if this routine is called many times (for different mesh points at which the SEM is coupled with FK) +!! DK DK Aug 2016: this should be moved to the calling program and precomputed once and for all + do i = 1,npow + mpow(i) = 2**(npow-i) + enddo + + if (myrank == 0) then + write(IMAIN,*) ' starting from ',nn,' points before time 0' + write(IMAIN,*) + call flush_IMAIN() + endif + + if (kpsv == 1) then + ! P-wave + ! for C_3 = i sin(inc) (u=[sin(inc), cos(inc)]) + C_3 = amplitude_fk * cmplx(0,1.) * ray_p * al(nlayer) ! amp. of incoming P in the bot. layer + eta_p = sqrt(1.0/al(nlayer)**2 - ray_p**2) ! vertical slowness for lower layer + + if (myrank == 0) write(IMAIN,*) ' Incoming P : C_3, ray_p, eta = ', C_3, ray_p, eta_p + + N_mat(:,:) = (0.d0,0.d0) + + ! find out the wave coefficients in the bottom layer for all freqs ------------------------------- + do ii = 1, nf2 + om = 2.0 * PI * fvec(ii) + ! propagation matrix + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness=sum(H) + + a = N_mat(3,2); b = N_mat(3,4); c = N_mat(4,2); d = N_mat(4,4) + delta_mat = a*d - b*c + if (abs(delta_mat) > TINYVAL) then + coeff(1,ii) = -(d*N_mat(3,3) - b*N_mat(4,3)) / delta_mat * C_3 + coeff(2,ii) = -(-c*N_mat(3,3) + a*N_mat(4,3)) / delta_mat * C_3 + else + coeff(1,ii) = (0.d0,0.d0) + coeff(2,ii) = (0.d0,0.d0) + endif + + !debug + !if (ii == 1 .and. myrank == 0) then + ! print *,'debug: Rayleigh coeff ',coeff(1,ii),coeff(2,ii),delta_mat + ! print *,'N_mat' + ! print *,N_mat + !endif + enddo + + ! loop over all data points ------------------------------------------------- + ! instead of looping over points like: + do ipt = 1, npt ! maybe this can be run faster by shifting t for diff. x of fixed z + ! we loop over the boundary arrays to get ispec & acoustic/elastic domain flag: + !do iface = 1,num_abs_boundary_faces + ! ispec = abs_boundary_ispec(iface) + + ! ! GLL points on boundary face + ! do igll = 1,NGLLSQUARE + ! ! point index using table lookup + ! ipt = ipt_table(igll,iface) + + ! initializes + field_f(:,:) = (0.d0,0.d0) + + ! time delay with respect to top of lower half-space (set to be at z==0) + Tdelay = ray_p * (xx(ipt)-x0) * cos(phi) + ray_p * (yy(ipt)-y0) * sin(phi) + eta_p * (0.0-z0) + + do ii = 1, nf2 + om = 2.0 * PI * fvec(ii) !! pulsation + + stf_coeff = exp(-(om * Tg/2)**2) !! apodization window + stf_coeff = stf_coeff * exp(cmplx(0,-1)*om*Tdelay) + + !! zz(ipt) is the height of point with respect to the lower layer + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,zz(ipt),N_mat) + + + dx_f = N_mat(1,2)*coeff(1,ii) + N_mat(1,4)*coeff(2,ii) + N_mat(1,3)*C_3 ! y_1 + dz_f = N_mat(2,2)*coeff(1,ii) + N_mat(2,4)*coeff(2,ii) + N_mat(2,3)*C_3 ! y_3 + if (.not. compute_traction) then + ! for the Stacey boundary contribution, we need velocity = (i om) displacement (in frequency domain) + field_f(ii,1) = stf_coeff * dx_f * cmplx(0,-1) ! u_x + field_f(ii,2) = stf_coeff * dz_f ! u_z + + field_f(ii,3) = stf_coeff * dx_f * cmplx(0,-1) * cmplx(-om*om,0) ! (-om^2)u_x + field_f(ii,4) = stf_coeff * dz_f * cmplx(-om*om,0) ! (-om^2)u_z + ! acoustic boundary point + ! note: instead of velocity as in the elastic case, in acoustic domains we would need potentials. + ! the velocity potential would be defined as: v = 1/rho grad(potential_dot) + ! thus, we would require to either change the FK formulations or to integrate velocity. + ! this will be left as a todo for future... + ! + ! as a reminder, displacement in frequency domains could be obtained by: + !if (ispec_is_acoustic(ispec)) then + ! ! displacement: u_x = -i y_1 + ! ! u_z = y_3 from Tong. (A13) + ! field_f(ii,1) = stf_coeff * dx_f * cmplx(0,-1) ! u_x = - i y_1 + ! field_f(ii,2) = stf_coeff * dz_f ! u_z = y_3 + !endif + + ! stress + else + txz_f = N_mat(3,2)*coeff(1,ii) + N_mat(3,4)*coeff(2,ii) + N_mat(3,3)*C_3 ! tilde{y}_4 + tzz_f = N_mat(4,2)*coeff(1,ii) + N_mat(4,4)*coeff(2,ii) + N_mat(4,3)*C_3 ! tilde{y}_6 + + field_f(ii,1) = stf_coeff * om * ray_p * (xi1(ipt)*tzz_f - 4.0*xim(ipt)*dx_f) ! T_xx + field_f(ii,2) = stf_coeff * om * ray_p * txz_f * cmplx(0,-1) ! T_xz + field_f(ii,3) = stf_coeff * om * ray_p * tzz_f ! T_zz + endif + + !debug + !if (ipt==1000 .and. ii == 10 .and. myrank == 0) print *,'debug: coeff',coeff(1,ii),coeff(2,ii), & + ! 'dx_f',dx_f,tzz_f,'xi',xi1(ipt),xim(ipt),'field',field_f(ii,3:5) + enddo + + ! pad negative f, and convert to time series + do ii = 2, nf2-1 + field_f(nf+2-ii,:) = conjg(field_f(ii,:)) + enddo + + !! inverse fast fourier transform + field(:,:) = 0.0 + do j = 1, nvar + ! inverse FFT + call FFTinv(npow,field_f(:,j),zign_neg,dt,field(:,j),mpow) + + ! wrap around to start from t0: here one has to be careful if t0/dt is not + ! exactly an integer, assume nn > 0 + if (nn > 0) then + dtmp(1:nn) = field(npts2-nn+1:npts2,j) + field(nn+1:npts2,j) = field(1:npts2-nn,j) + field(1:nn,j) = dtmp(1:nn) + else if (nn < 0) then + dtmp(1:nn) = field(1:nn,j) + field(1:npts-nn,j) = field(nn+1:npts,j) + field(npts-nn+1:npts,j) = dtmp(1:nn) + endif + enddo + + if (.not. compute_traction) then + !! store undersampled version of velocity FK solution + tmp_t1(:) = field(:,1) * cos(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,1) * sin(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,2) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,3) * cos(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,3) * sin(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,4) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + else + !! compute traction + do lpts = 1, NF_FOR_STORING + sigma_rr = field(lpts,1) + sigma_rt = 0.0 + sigma_rz = field(lpts,2) + sigma_zz = field(lpts,3) + sigma_tt = bdlambdamu(ipt)*(sigma_rr+sigma_zz) + sigma_tz = 0.0 + + Txx_tmp = sigma_rr * cos(phi) * cos(phi) + sigma_tt * sin(phi) * sin(phi) + Txy_tmp = cos(phi) * sin(phi) * (sigma_rr - sigma_tt) + Txz_tmp = sigma_rz * cos(phi) + Tyy_tmp = sigma_rr * sin(phi) * sin(phi) + sigma_tt * cos(phi) * cos(phi) + Tyz_tmp = sigma_rz * sin(phi) + Tzz_tmp = sigma_zz + + !! store directly the traction + traction(1,ipt,lpts) = Txx_tmp*nmx(ipt) + Txy_tmp*nmy(ipt) + Txz_tmp*nmz(ipt) + traction(2,ipt,lpts) = Txy_tmp*nmx(ipt) + Tyy_tmp*nmy(ipt) + Tyz_tmp*nmz(ipt) + traction(3,ipt,lpts) = Txz_tmp*nmx(ipt) + Tyz_tmp*nmy(ipt) + Tzz_tmp*nmz(ipt) + enddo + + !! store undersamped version of tractions FK solution + tmp_t1(1:NF_FOR_STORING) = traction(1,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(1:NF_FOR_STORING) = traction(2,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(1:NF_FOR_STORING) = traction(3,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + endif + + ! user output + if (myrank == 0 .and. npt > 1000) then + if (mod(ipt,(npt/10)) == 0) then + write(IMAIN,*) ' done ',ipt/(npt/10)*10,'% points out of ',npt + call flush_IMAIN() + endif + endif + !enddo + enddo + + else if (kpsv == 2) then + ! SV-wave + ! for C_2 = sin(inc) (u=[cos(inc), sin(inc)]) + C_1 = amplitude_fk * ray_p * be(nlayer) ! amp. of incoming S in the bot. layer + eta_s = sqrt(1.0/be(nlayer)**2 - ray_p**2) ! vertical slowness for lower layer + + if (myrank == 0) write(IMAIN,*) ' Incoming S : C_1, ray_p, eta = ', C_1, ray_p, eta_s + + N_mat(:,:) = (0.d0,0.d0) + + ! find out the wave coefficients in the bottom layer for all freqs + do ii = 1, nf2 + om = 2.0 * PI * fvec(ii) + ! propagation matrix + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,sum(H(1:nlayer-1)),N_mat) !total-thickness=sum(h) + + a = N_mat(3,2); b = N_mat(3,4); c = N_mat(4,2); d = N_mat(4,4) + delta_mat = a*d - b*c + if (abs(delta_mat) > TINYVAL) then + coeff(1,ii) = -(d*N_mat(3,1) - b*N_mat(4,1)) / delta_mat * C_1 + coeff(2,ii) = -(-c*N_mat(3,1) + a*N_mat(4,1)) / delta_mat * C_1 + else + coeff(1,ii) = (0.d0,0.d0) + coeff(2,ii) = (0.d0,0.d0) + endif + enddo + + ! loop over all data points + ! instead of looping over points like: + do ipt = 1, npt ! maybe this can be run faster by shifting t for diff. x of fixed z + ! we loop over the boundary arrays to get ispec & acoustic/elastic domain flag: + !do iface = 1,num_abs_boundary_faces + ! ispec = abs_boundary_ispec(iface) + + ! ! GLL points on boundary face + ! do igll = 1,NGLLSQUARE + ! point index using table lookup + !ipt = ipt_table(igll,iface) + + ! initializes + field_f(:,:) = (0.d0,0.d0) + + ! time delay with respect to top of lower half-space (set to be at z==0) + Tdelay = ray_p * (xx(ipt)-x0) * cos(phi) + ray_p * (yy(ipt)-y0) * sin(phi) + eta_s * (0.0-z0) + + do ii = 1, nf2 + om = 2.0 * PI * fvec(ii) + stf_coeff = exp(-(om * Tg/2)**2) * exp(cmplx(0,-1)*om*Tdelay) + + ! z is the height of position with respect to the lowest layer interface. + call compute_N_Rayleigh(al,be,mu,H,nlayer,om,ray_p,zz(ipt),N_mat) + + + dx_f = N_mat(1,2)*coeff(1,ii) + N_mat(1,4)*coeff(2,ii) + N_mat(1,1)*C_1 ! y_1 + dz_f = N_mat(2,2)*coeff(1,ii) + N_mat(2,4)*coeff(2,ii) + N_mat(2,1)*C_1 ! y_3 + if (compute_traction) then + ! for the Stacey boundary contribution, we need velocity = (i om) displacement (in frequency domain) + field_f(ii,1) = stf_coeff * dx_f * cmplx(0,-1) ! u_x(1.20) + field_f(ii,2) = stf_coeff * dz_f ! u_z + field_f(ii,3) = stf_coeff * dx_f * cmplx(0,-1) * cmplx(-om*om,0) ! (-om^2)u_x(1.20) + field_f(ii,4) = stf_coeff * dz_f * cmplx(-om*om,0) ! (-om^2)u_z + + ! acoustic boundary point + ! note: instead of velocity as in the elastic case, in acoustic domains we would need potentials. + ! the velocity potential would be defined as: v = 1/rho grad(potential_dot) + ! thus, we would require to either change the FK formulations or to integrate velocity. + ! this will be left as a todo for future... + ! + ! as a reminder, displacement in frequency domains could be obtained by: + !if (ispec_is_acoustic(ispec)) then + ! ! displacement: u_x = -i y_1 + ! ! u_z = y_3 from Tong. (A13) + ! field_f(ii,1) = stf_coeff * dx_f * cmplx(0,-1) ! u_x = - i y_1 + ! field_f(ii,2) = stf_coeff * dz_f ! u_z = y_3 + !endif + + else + txz_f = N_mat(3,2)*coeff(1,ii) + N_mat(3,4)*coeff(2,ii) + N_mat(3,1)*C_1 ! tilde{y}_4 + tzz_f = N_mat(4,2)*coeff(1,ii) + N_mat(4,4)*coeff(2,ii) + N_mat(4,1)*C_1 ! tilde{y}_6 + + field_f(ii,1) = stf_coeff * om * ray_p * (xi1(ipt)*tzz_f - 4.0*xim(ipt)*dx_f) ! T_xx + field_f(ii,2) = stf_coeff * om * ray_p * txz_f * cmplx(0,-1) ! T_xz + field_f(ii,3) = stf_coeff * om * ray_p * tzz_f ! T_zz + endif + enddo + + ! pad negative f, and convert to time series + do ii = 2, nf2-1 + field_f(nf+2-ii,:) = conjg(field_f(ii,:)) + enddo + + field(:,:) = 0.0 + do j = 1, nvar + ! inverse FFT + call FFTinv(npow,field_f(:,j),zign_neg,dt,field(:,j),mpow) + + ! wrap around to start from t0: here one has to be careful if t0/dt is not + ! exactly an integer, assume nn > 0 + ! note: for nn == 0, nothing to wrap as field(1:npts2,j) = field(1:npts2,j) + if (nn > 0) then + dtmp(1:nn) = field(npts2-nn+1:npts2,j) + field(nn+1:npts2,j) = field(1:npts2-nn,j) + field(1:nn,j) = dtmp(1:nn) + else if (nn < 0) then + dtmp(1:nn) = field(1:nn,j) + field(1:npts-nn,j) = field(nn+1:npts,j) + field(npts-nn+1:npts,j) = dtmp(1:nn) + endif + enddo + + if (.not. compute_traction) then + !! store undersampled version of velocity FK solution + tmp_t1(:) = field(:,1)*cos(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,1)*sin(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,2) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + displ(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,3)*cos(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,3)*sin(phi) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(:) = field(:,4) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + accel(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + else + !! compute traction + do lpts = 1, NF_FOR_STORING + sigma_rr = field(lpts,1) + sigma_rt = 0.0 + sigma_rz = field(lpts,2) + sigma_zz = field(lpts,3) + sigma_tt = bdlambdamu(ipt)*(sigma_rr+sigma_zz) + sigma_tz = 0.0 + + Txx_tmp = sigma_rr * cos(phi) * cos(phi) + sigma_tt * sin(phi) * sin(phi) + Txy_tmp = cos(phi) * sin(phi) * (sigma_rr - sigma_tt) + Txz_tmp = sigma_rz * cos(phi) + Tyy_tmp = sigma_rr * sin(phi) * sin(phi) + sigma_tt * cos(phi) * cos(phi) + Tyz_tmp = sigma_rz * sin(phi) + Tzz_tmp = sigma_zz + + !! store directly the traction + traction(1,ipt,lpts) = Txx_tmp*nmx(ipt) + Txy_tmp*nmy(ipt) + Txz_tmp*nmz(ipt) + traction(2,ipt,lpts) = Txy_tmp*nmx(ipt) + Tyy_tmp*nmy(ipt) + Tyz_tmp*nmz(ipt) + traction(3,ipt,lpts) = Txz_tmp*nmx(ipt) + Tyz_tmp*nmy(ipt) + Tzz_tmp*nmz(ipt) + enddo + + !! store undersamped version of tractions FK solution + tmp_t1(1:NF_FOR_STORING) = traction(1,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(1,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(1:NF_FOR_STORING) = traction(2,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(2,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + + tmp_t1(1:NF_FOR_STORING) = traction(3,ipt,1:NF_FOR_STORING) + call compute_spline_coef_to_store(tmp_t1, npts2, tmp_t2, tmp_c) + traction(3,ipt,1:NF_FOR_STORING) = tmp_t2(1:NF_FOR_STORING) + endif + + ! user output + if (myrank == 0 .and. npt > 1000) then + if (mod(ipt,(npt/10)) == 0) then + write(IMAIN,*) ' done ',ipt/(npt/10)*10,'% points out of ',npt + call flush_IMAIN() + endif + endif + !enddo + enddo + endif + + ! taper + if (USE_TAPERED_BEGINNING) then + ! check if taper length is reasonable compared to wavefield storage traces + if (NF_FOR_STORING > 2 * taper_nlength) then + do i = 1,taper_nlength + ! cosine taper, otherwise using a constant (1.0) instead + taper = (1.0 - cos(PI*(i-1)/taper_nlength)) * 0.5 ! between [0,1[ + if (.not. compute_traction) then + ! tapers traces + displ(:,:,i) = taper * displ(:,:,i) + accel(:,:,i) = taper * accel(:,:,i) + else + traction(:,:,i) = taper * traction(:,:,i) + endif + enddo + endif + endif + + ! free temporary arrays + deallocate(fvec,coeff, field_f, field, dtmp) + deallocate(tmp_f1, tmp_f2, tmp_f3, tmp_t1, tmp_t2, tmp_t3) + deallocate(tmp_c) + + ! user output + if (myrank == 0) then + write(IMAIN,*) + write(IMAIN,*) " FK computing passed " + write(IMAIN,*) + call flush_IMAIN() + endif + + end subroutine FK + +! +!------------------------------------------------------------------------------------------------- +! + + subroutine compute_N_Rayleigh(alpha, beta, mu, H, nlayer, om, ray_p, height, N_mat) + + ! assumes that height = 0 is the bottom interface + + use fk_injection, only: CUSTOM_REAL,myrank + + implicit none + + ! precision for complex + integer, parameter :: CUSTOM_CMPLX = 8 + + ! input + integer, intent(in) :: nlayer + real(kind=CUSTOM_REAL), dimension(nlayer), intent(in) :: alpha, beta, mu, H + real(kind=CUSTOM_REAL), intent(in) :: om,ray_p,height + + ! output + complex(kind=CUSTOM_CMPLX), dimension(4,4), intent(inout) :: N_mat(4,4) + + ! local vars + integer :: i, j, ilayer + complex(kind=CUSTOM_CMPLX), dimension(nlayer) :: eta_alpha, eta_beta, nu_al, nu_be + complex(kind=CUSTOM_CMPLX), dimension(4,4) :: E_mat, G_mat, P_layer + complex(kind=CUSTOM_CMPLX) :: xa, ya, xb, yb + complex(kind=CUSTOM_CMPLX) :: ca, sa, cb, sb, c1, c2 + real(kind=CUSTOM_CMPLX), dimension(nlayer) :: gamma0, gamma1 + real(kind=CUSTOM_CMPLX), dimension(nlayer) :: hh + real(kind=CUSTOM_CMPLX) :: g1, mul, two_mul, g1_sq + real(kind=CUSTOM_CMPLX) :: alphal, betal + + if (nlayer < 1) stop 'nlayer has to be larger than or equal to 1' + +! see: Tong et al. (2014), +! High-resolution seismic array imaging based on an SEM-FK hybrid method, +! GJI, 197, 369-395. +! details in the appendix + + ! note: vertical incident (p=0) is not handled in Tong et al. explanations. + ! here, it limits p to a very small value to handle the calculations + if (abs(ray_p) < 1.e-15) stop 'Invalid ray parameter p (cannot be zero) in compute_N_Rayleigh() routine' + + ! vertical wavenumbers + ! pre-computes factors + do i = 1,nlayer + ! vp and vs + alphal = alpha(i) ! vp + betal = beta(i) ! vs + + ! safety check: zero shear velocity case not handled yet + if (abs(betal) < 1.e-15) stop 'Invalid shear velocity in compute_N_Rayleigh() routine' + + ! P + ! see (A5): E_23 = -i nu_p / k = -i omega sqrt(1/alpha^2 - p^2) / k + ! factor eta_alpha = -i sqrt(1/alpha^2 - p^2) + ! = -i sqrt( (1/alpha + p) * (1/alpha - p) ) + ! = -i sqrt(1/alpha + p) * sqrt(1/alpha - p) + !org: eta_alpha(i) = -cmplx(0,1) * sqrt(1.0/alpha(i) + ray_p) * sqrt(1.0/alpha(i) - ray_p) + eta_alpha(i) = -cmplx(0,1) * sqrt( 1.0 / alphal**2 - ray_p**2 ) ! i*vertical slowness, purely imaginary + ! note: here factor nu_al = -i nu_p = -i omega sqrt(1/alpha^2 - p^2) + ! = omega (-i sqrt(1/alpha^2 - p^2) + ! = omega (eta_alpha) + nu_al(i) = om * eta_alpha(i) ! i * vertical wavenumber + + ! SV + ! see (A5): E_11 = -i nu_s / k = -i omega sqrt(1/beta^2 - p^2) / k + ! factor eta_beta = -i sqrt(1/beta^2 - p^2) + ! = -i sqrt( (1/beta + p) * (1/beta - p) ) + ! = -i sqrt(1/beta + p) * sqrt(1/beta - p) + !org: eta_beta(i) = -cmplx(0,1) * sqrt(1.0/beta(i) + ray_p) * sqrt(1.0/beta(i) - ray_p) + eta_beta(i) = -cmplx(0,1) * sqrt( 1.0 / betal**2 - ray_p**2 ) + + ! note: here factor nu_be = -i nu_s = -i omega sqrt(1/beta^2 - p^2) + ! = omega (-i sqrt(1/beta^2 - p^2) + ! = omega (eta_beta) + nu_be(i) = om * eta_beta(i) ! i * vertical wavenumber + + ! auxiliary variables + gamma0(i) = 2.0 * betal**2 * ray_p**2 + gamma1(i) = 1.0 - 1.0/gamma0(i) + enddo + + ! initializes matrix + E_mat(:,:) = (0.0,0.0) + + ! Tong et al. (2014), appendix (A10) E_0: + ! note: E_mat is not omega dependent + ! + ! (A5): E_11 = -i nu_s / k + ! = -i omega * sqrt(1/beta^2 - p^2) / ( p * omega) ,with p = k/omega -> k = p * omega + ! = -i sqrt(1/beta^2 - p^2) / p + ! = eta_beta / p + E_mat(1,1) = eta_beta(nlayer) / ray_p + E_mat(1,2) = -E_mat(1,1) + E_mat(1,3) = (1.0,0.0) + E_mat(1,4) = (1.0,0.0) + + ! (A5): E_23 = -i nu_p / k + ! = -i omega * sqrt(1/alpha^2 - p^2) / (p * omega) ,with p = k/omega -> k = p * omega + ! = -i sqrt(1/alpha^2 - p^2) / p + ! = eta_alpha / p + E_mat(2,1) = (1.0,0.0) + E_mat(2,2) = (1.0,0.0) + E_mat(2,3) = eta_alpha(nlayer) / ray_p + E_mat(2,4) = -E_mat(2,3) + + ! pre-computed factor for half-space (layer with index nlayer) + mul = mu(nlayer) + ! 2 mu + two_mul = 2.0 * mul + + ! note: wavenumber k is defined as p = k / omega -> k = p * omega + ! for frequency omega==0, wavenumber k becomes zero and thus a factor 1/k becomes undefined. + ! to avoid such behavior, the factor k in the expressions for E below will be cancelled out. + ! together with the multiplication by propagation matrix P, where elements can have a factor k, this should be ok. + ! unfortunately, the original paper by Tong et al. doesn't mention such a case and assumes k is non-zero. + + ! (A5): E_31 = 2 k mu gamma_1 + ! = 2 p omega mu gamma_1 ,with wavenumber k: from ray p = k / omega -> k = p * omega + !org: E_mat(3,1) = 2.0 * mu(nlayer) * gamma1(nlayer) ! takes out factor k + E_mat(3,1) = two_mul * gamma1(nlayer) + E_mat(3,2) = E_mat(3,1) + + ! (A5): E_33 = - 2 i mu nu_p + ! = 2 mu (-i) omega sqrt(1/alpha^2 - p^2) + ! = 2 mu omega (-i sqrt(1/alpha^2 - p^2)) + ! = 2 mu omega (eta_alpha) + ! or + ! = 2 mu (eta_alpha) k / p ,with p = k/omega -> omega = k / p + !org: E_mat(3,3) = 2.0 * mu(nlayer) * eta_alpha(nlayer) / ray_p ! takes out factor k + E_mat(3,3) = two_mul * eta_alpha(nlayer) / ray_p + E_mat(3,4) = -E_mat(3,3) + + ! (A5): E_41 = - 2 i mu nu_s + ! = 2 mu (-i) omega sqrt(1/beta^2 - p^2) + ! = 2 mu omega (-i sqrt(1/beta^2 - p^2)) + ! = 2 mu omega (eta_beta) + ! or + ! = 2 mu (eta_beta) k / p ,with p = k/omega -> omega = k / p + !org: E_mat(4,1) = 2.0 * mu(nlayer) * eta_beta(nlayer) / ray_p ! takes out factor k + E_mat(4,1) = two_mul * eta_beta(nlayer) / ray_p + E_mat(4,2) = -E_mat(4,1) + + ! (A5): E_43 = 2 k mu gamma_1 + ! = E_31 = E_32 + E_mat(4,3) = E_mat(3,1) + E_mat(4,4) = E_mat(3,1) + + if (height > sum(H(1:nlayer-1))) then + print *,'FK error: rank ',myrank + print *,' Z point is located in the air above the surface rather than in the solid!' + print *,' current z :', height, ' max z allowed : ', sum(H(1:nlayer-1)) + stop 'FK invalid height' + endif + + ! figure out the location z with respect to layer stack + if (height <= 0.0) then + ! in lower half space + G_mat(:,:) = (0.0,0.0) + ! incident, up-going S-wave + ! (A5): Gamma_11 = e^(-i nu_s z) = e^( (-i nu_s) * z ) = e^(nu_be * z) + G_mat(1,1) = exp(nu_be(nlayer) * height) + ! reflected, down-going S-wave + ! (A5): Gamma_22 = e^(i nu_s z) = e^( -(-i nu_s) * z ) = e^(-nu_be * z) + G_mat(2,2) = exp(-nu_be(nlayer) * height) + ! incident, up-going P-wave + ! (A5): Gamma_33 = e^(-i nu_p z) = e^( (-i nu_p) * z ) = e^(nu_al * z) + G_mat(3,3) = exp(nu_al(nlayer) * height) + ! reflected, down-going P-wave + ! (A5): Gamma_44 = e^(i nu_p z) = e^( -(-i nu_p) * z ) = e^(-nu_al * z) + G_mat(4,4) = exp(-nu_al(nlayer) * height) + + ! resulting matrix + N_mat = matmul(E_mat,G_mat) + + else + ! in layers + ! determines layer in which the point (given by height) lies + ! note: indexing assumes that last layer (nlayer) being the bottom, lower halfspace, + ! and the first layer (1) being at the top surface + hh(:) = H(:) + ilayer = nlayer + do j = nlayer-1 , 1 , -1 + if (height <= sum(H(j:nlayer-1))) then + ilayer = j; exit + endif + enddo + + ! updates point's layer thicknesses + hh(ilayer+1:nlayer-1) = H(ilayer+1:nlayer-1) + hh(ilayer) = height - sum(H(ilayer+1:nlayer-1)) + + if (hh(ilayer) < 0.0) then + print *,'Error: rank ',myrank,' has invalid point height ',hh(ilayer),' at layer ',ilayer + stop 'Error setting layer thickness' + endif + + !debug + !print *,'debug: height ',height,'layer ',ilayer,nlayer,'H',H(:),'sum',sum(H(ilayer:nlayer-1)),'h',hh(:) + + ! compute propagation matrices + N_mat(:,:) = E_mat(:,:) + + do j = nlayer-1, ilayer, -1 + ! matrix variables + ! C_alpha = cos(nu_p h) = cos( omega sqrt(1/alpha^2 - p^2) h ) + ! S_alpha = -sin(nu_p h) = -sin( omega sqrt(1/alpha^2 - p^2) h ) + ! with nu_p h = omega sqrt(1/alpha^2 - p^2) h + ! + ! note: there might be some sign conflict and confusion between sin and sinh in the definition after (A9) of Tong et al. + ! instead of S_alpha = -sin(nu_p h) as stated in the paper, here sa becomes [i sin(nu_p h)] as imaginary number. + ! + c1 = nu_al(j) * hh(j) + ! cos(nu_p h) = [ e^(i nu_p h) + e^(-i nu_p h) ] / 2 + ! = [ e^(-nu_al * h) + e^(nu_al * h) ] / 2 + ca = (exp(c1) + exp(-c1))/2.0 + ! sin(nu_p h) = [ e^(i nu_p h) - e^(-i nu_p h) ] / 2i + ! = [ e^(-nu_al * h) - e^(nu_al * h) ] / 2i + ! = i [ e^(nu_al * h) - e^(-nu_al * h) ] / 2 + sa = (exp(c1) - exp(-c1))/2.0 ! imaginary part + + ! X_alpha = - i nu_p S_alpha / ( omega p) + ! = -i omega sqrt(1/alpha^2 - p^2) S_alpha / (omega p ) + ! = [ -i sqrt(1/alpha^2 - p^2) ] S_alpha / p + ! = eta_alpha S_alpha / p + xa = eta_alpha(j) * sa / ray_p + + ! Y_alpha = i omega p S_alpha / nu_p + ! = p S_alpha i omega / ( omega sqrt(1/alpha^2 - p^2) ) + ! = p S_alpha i / ( sqrt(1/alpha^2 - p^2) ) + ! = p S_alpha 1 / (-i sqrt(1/alpha^2 - p^2) ) + ! = p S_alpha / eta_alpha + ya = ray_p * sa / eta_alpha(j) + + ! C_beta = cos(nu_s h) = cos( omega sqrt(1/beta^2 - p^2) h ) + ! S_beta = -sin(nu_s h) = -sin( omega sqrt(1/beta^2 - p^2) h ) + ! with nu_s h = omega sqrt(1/beta^2 - p^2) h + ! + ! note: for sb, see same remark as above for sa + c2 = nu_be(j) * hh(j) + cb = (exp(c2) + exp(-c2))/2.0 ! cos(nu_s h) + sb = (exp(c2) - exp(-c2))/2.0 ! sin(nu_s h) imaginary part + + ! X_beta = - i nu_s S_beta / ( omega p) + ! Y_beta = i omega p S_beta / nu_s + xb = eta_beta(j) * sb / ray_p + yb = ray_p * sb / eta_beta(j) + + ! layer factors + g1 = gamma1(j) + mul = mu(j) + ! pre-computed factors + ! gamma1^2 + g1_sq = g1 * g1 + ! 2 mu + two_mul = 2.0 * mul ! note: leaving out factor k, only 2 mu + + ! Tong et al. (2014), appendix (A8) + ! propagation matrix P_n + P_layer(1,1) = ca - g1*cb + P_layer(1,2) = xb - g1*ya + !org: P_layer(1,3) = (ya - xb)/(2*mul) ! misses factor 1/k + ! P_layer(1,4) = (cb - ca)/(2*mul) ! misses factor 1/k + P_layer(1,3) = (ya - xb) / two_mul + P_layer(1,4) = (cb - ca) / two_mul + + P_layer(2,1) = xa - g1*yb + P_layer(2,2) = cb - g1*ca + !org: P_layer(2,3) = (ca - cb)/(2*mul) ! misses factor 1/k + ! P_layer(2,4) = (yb - xa)/(2*mul) ! misses factor 1/k + P_layer(2,3) = (ca - cb) / two_mul + P_layer(2,4) = (yb - xa) / two_mul + + !org: P_layer(3,1) = 2*mul * (xa - g1**2 * yb) ! misses factor k + ! P_layer(3,2) = 2*mul * g1 * (cb - ca) ! misses factor k + P_layer(3,1) = two_mul * (xa - g1_sq * yb) + P_layer(3,2) = two_mul * g1 * (cb - ca) + + P_layer(3,3) = ca - g1*cb + P_layer(3,4) = g1*yb - xa + + !org: P_layer(4,1) = 2*mul * g1 * (ca - cb) ! misses factor k + ! P_layer(4,2) = 2*mul * (xb - g1**2 * ya) ! misses factor k + P_layer(4,1) = two_mul * g1 * (ca - cb) + P_layer(4,2) = two_mul * (xb - g1_sq * ya) + P_layer(4,3) = g1*ya - xb + P_layer(4,4) = cb - g1*ca + + !debug + !if (myrank == 0) print *,'debug: j,g1,g1_sq,mul,two_mul,xa,xb,ya,yb,ca,cb,ray_p,om', & + ! j,g1,g1_sq,mul,two_mul,xa,xb,ya,yb,ca,cb,ray_p,om + !if (myrank == 0) print *,'debug: j,P_layer',j,P_layer(:,:) + + ! resulting matrix + N_mat = gamma0(j) * matmul(P_layer,N_mat) + enddo + endif + + ! debug + !if (myrank == 0) then + ! print *,'debug: N_mat ' + ! do j = 1,4 + ! print *,N_mat(:,j) + ! enddo + !endif + !stop + + end subroutine compute_N_Rayleigh + +! +!------------------------------------------------------------------------------------------------- +! + + subroutine FFT(npow,xi,zign,dtt,mpow) + +! Fourier transform +! This inputs AND outputs a complex function. +! The convention is FFT --> e^(-iwt) +! numerical factor for Plancherel theorem: planch_fac = dble(NPT * dt * dt) + + use fk_injection, only: CUSTOM_REAL + + implicit none + + integer, parameter :: CUSTOM_CMPLX = 8 + + integer,intent(in) :: npow + + real(kind=CUSTOM_REAL),intent(in) :: zign,dtt + + complex(kind=CUSTOM_CMPLX),dimension(*),intent(inout) :: xi + +!! DK DK here is the hardwired maximum size of the array +!! DK DK Aug 2016: if this routine is called many times (for different mesh points at which the SEM is coupled with FK) +!! DK DK Aug 2016: this should be moved to the calling program and precomputed once and for all + real(kind=CUSTOM_REAL),intent(in) :: mpow(30) + + ! local parameters + integer :: lblock,k,FK,jh,ii,istart + integer :: l,iblock,nblock,i,lbhalf,j,lx + complex(kind=CUSTOM_CMPLX) :: wk, hold, q + real(kind=CUSTOM_REAL) :: flx,inv_of_flx,v + ! PI = acos(-1.d0) + real(kind=CUSTOM_REAL), parameter :: TWO_PI = 2.0_CUSTOM_REAL * acos(-1.d0) + +!! DK DK added this sanity check + if (npow > 30) stop 'error: the FK FTT routine has an hardwired maximum of 30 levels' +!! DK DK in any case the line below imposes a maximum of 31, otherwise the integer 2**n will overflow + + lx = 2**npow + + do l = 1,npow + + nblock = 2**(l-1) + lblock = lx/nblock + lbhalf = lblock/2 + + k = 0 + + do iblock = 1,nblock + + FK = k + flx = lx + + v = zign * TWO_PI * FK / flx ! Fourier convention + + ! - sign: MATLAB convention: forward e^{-i om t} + ! + sign: engineering convention: forward e^{i om t} + wk = cmplx(cos(v),-sin(v)) ! sign change to -sin(v) or sin(v) + istart = lblock*(iblock-1) + + do i = 1,lbhalf + j = istart+i + jh = j+lbhalf + q = xi(jh)*wk + xi(jh) = xi(j)-q + xi(j) = xi(j)+q + enddo + + do i = 2,npow + ii = i + if (k < mpow(i)) goto 4 + k = k-mpow(i) + enddo + + 4 k = k+mpow(ii) + + enddo + enddo + + k = 0 + + do j = 1,lx + if (k < j) goto 5 + + hold = xi(j) + xi(j) = xi(k+1) + xi(k+1) = hold + +5 do i = 1,npow + ii = i + if (k < mpow(i)) goto 7 + k = k-mpow(i) + enddo + +7 k = k+mpow(ii) + enddo + + ! final steps deal with dt factors + if (zign > 0.) then + ! FORWARD FFT + xi(1:lx) = xi(1:lx) * dtt ! multiplication by dt + + else + ! REVERSE FFT + flx = flx*dtt + inv_of_flx = 1._CUSTOM_REAL / flx + +!! DK DK Aug 2016: changed to multiplication by the precomputed inverse to make the routine faster +! xi(1:lx) = xi(1:lx) / flx ! division by dt + xi(1:lx) = xi(1:lx) * inv_of_flx ! division by dt + + endif + + end subroutine FFT + +! +!------------------------------------------------------------------------------------------------- +! + + subroutine FFTinv(npow,s,zign,dtt,r,mpow) + +! inverse Fourier transform -- calls FFT + + use fk_injection, only: CUSTOM_REAL + + implicit none + + integer, parameter :: CUSTOM_CMPLX = 8 + + integer,intent(in) :: npow + real(kind=CUSTOM_REAL),intent(in) :: dtt,zign + + complex(kind=CUSTOM_CMPLX), intent(inout) :: s(*) + real(kind=CUSTOM_REAL), intent(out) :: r(*) ! note that this is real, not double precision + +!! DK DK here is the hardwired maximum size of the array +!! DK DK Aug 2016: if this routine is called many times (for different mesh points at which the SEM is coupled with FK) +!! DK DK Aug 2016: this should be moved to the calling program and precomputed once and for all + real(kind=CUSTOM_REAL),intent(in) :: mpow(30) + + ! local parameters + integer :: nsmp, nhalf + + nsmp = 2**npow + nhalf = nsmp/2 + + call rspec(s,nhalf) ! restructuring + call FFT(npow,s,zign,dtt,mpow) ! Fourier transform + + r(1:nsmp) = real(s(1:nsmp)) ! take the real part + + end subroutine FFTinv + +! +!------------------------------------------------------------------------------------------------- +! + + subroutine rspec(s,np2) + + implicit none + + integer, parameter :: CUSTOM_CMPLX = 8 + + complex(kind=CUSTOM_CMPLX),intent(inout) :: s(*) + integer, intent(in) :: np2 + + ! local parameters + integer :: n,n1,i + + n = 2*np2 + n1 = np2+1 + + s(n1) = 0.0 + s(1) = cmplx(real(s(1)),0.0) + + do i = 1,np2 + s(np2+i) = conjg(s(np2+2-i)) + enddo + + end subroutine rspec + +! +!------------------------------------------------------------------------------------------------- +! + + subroutine find_size_of_working_arrays(deltat, freq_sampling_fk, tmax_fk, NF_FOR_STORING, & + NF_FOR_FFT, NPOW_FOR_INTERP, NP_RESAMP, DF_FK) + + use fk_injection, only: CUSTOM_REAL, NSTEP + + implicit none + real(kind=CUSTOM_REAL),intent(in) :: deltat,freq_sampling_fk + real(kind=CUSTOM_REAL),intent(inout) :: tmax_fk + real(kind=CUSTOM_REAL),intent(inout) :: DF_FK + integer, intent(inout) :: NF_FOR_STORING, NF_FOR_FFT, NPOW_FOR_INTERP, NP_RESAMP + ! local parameter + real(kind=CUSTOM_REAL) :: df, dt_min_fk, Frq_ech_Fk + real(kind=CUSTOM_REAL) :: tmax_samp, tmax_use + + ! sampling frequency to store fk solution + Frq_ech_Fk = freq_sampling_fk + + ! sampling time step to store fk solution + dt_min_fk = 1.0 / Frq_ech_Fk + + ! compute resampling rate + NP_RESAMP = floor(dt_min_fk / deltat) + + ! checks sampling rate + if (NP_RESAMP == 0) NP_RESAMP = 1 + + ! update dt for fk with respect to integer np_resampling + dt_min_fk = NP_RESAMP * deltat !! this is the time step sampling for FK storage + + !! time window lengths + ! maximum simulation time length would be: + ! tmax_simulation = NSTEP * deltat + ! FK signal trace is symmetric after inverse FFT, thus NF_FOR_STORING must match at least match NSTEP * 2 with resampling rate. + ! maximum time length with respect to simulation NSTEP and resampling rate: + tmax_samp = (2*NSTEP/NP_RESAMP + 1) * dt_min_fk + + ! take user defined window length as initial default + tmax_use = tmax_fk + + ! limits window length to actual simulation length + if (tmax_use > tmax_samp) tmax_use = tmax_samp + + ! compute number of time steps to store + NF_FOR_STORING = ceiling( tmax_use / dt_min_fk) + + ! in power of two + NF_FOR_STORING = ceiling(log(real(NF_FOR_STORING))/log(2.)) + + ! multiply by 2 in order to do an inverse FFT + NF_FOR_FFT = 2**(NF_FOR_STORING+1) + + NPOW_FOR_INTERP = NF_FOR_STORING+1 + NF_FOR_STORING = 2**NF_FOR_STORING + + ! now we have this new time window + tmax_fk = dt_min_fk * (NF_FOR_FFT - 1) + + ! step in frequency for fk + df = 1.0 / tmax_fk + DF_FK = df + + !debug + !print *,'debug: tmax ',tmax_fk,tmax_samp,tmax_use,'np_resamp',NP_RESAMP,'NSTEP',NSTEP,2*NSTEP/NP_RESAMP, & + ! 'NF',NF_FOR_STORING,ceiling( tmax_use / dt_min_fk) + + end subroutine find_size_of_working_arrays + + +! +!------------------------------------------------------------------------------------------------- +! + +!! ################# INTERPOLATION ROUTINES IN TIME DOMAIN ###################################### + +!! compute and store spline coefficients + + subroutine compute_spline_coef_to_store(Sig, npts, spline_coeff, tmp_c) + + use fk_injection, only: CUSTOM_REAL + + implicit none + + integer, intent(in) :: npts + real(kind=CUSTOM_REAL), dimension(npts), intent(in) :: Sig + real(kind=CUSTOM_REAL), dimension(npts), intent(inout) :: spline_coeff + double precision, dimension(npts),intent(out) :: tmp_c ! temporary work array + + !! computation in double precision + double precision,parameter :: error = 1.d-24 + double precision,parameter :: z1 = dsqrt(3.d0) - 2.d0 + double precision :: zn, sumc + integer :: i, n_init + + ! Compute pole value + tmp_c(:) = dble(Sig(:)) * (1.d0 - z1) * ( 1.d0 - 1.d0/z1) + + ! Initialisation causal filter + n_init = ceiling(log(error)/log(abs(z1))) + + ! check limits: by default is n_init==42, for very short test simulations this might be larger than npts + if (n_init > npts) n_init = npts + + sumc = tmp_c(1) + zn = z1 + do i = 1,n_init + sumc = sumc + zn * tmp_c(i) + zn = zn * z1 + enddo + tmp_c(1) = sumc + + ! Causal filter + do i = 2,npts + tmp_c(i) = tmp_c(i) + z1 * tmp_c(i-1) + enddo + + ! Initialisation anti-causal filter + tmp_c(npts) = ( z1 / (z1 - 1.d0) ) * tmp_c(npts) + do i = npts-1,1,-1 + tmp_c(i) = z1 * (tmp_c(i+1) - tmp_c(i)) + enddo + + !! store spline coeff in CUSTOM_REAL precision + spline_coeff(:) = tmp_c(:) + + end subroutine compute_spline_coef_to_store + + +! +!------------------------------------------------------------------------------------------------- +! + +!! VM VM READING INPUT FILE FOR FK MODEL + + subroutine ReadFKModelInput() + + !use specfem_par + !use specfem_par_coupling + use fk_injection, only: CUSTOM_REAL, TINYVAL, alpha_FK, beta_FK, & + rho_FK, mu_FK, h_FK, phi_FK, theta_FK, & + nlayer, IMAIN, myrank, & + xx0, yy0, zz0, tt0, ff0, freq_sampling_fk, & + tmax_fk, amplitude_fk, Z_REF_for_FK, NSTEP, deltat, & + type_kpsv_fk, FKMODEL_FILE + + implicit none + + !real(kind=CUSTOM_REAL), intent(in) :: Xmin_box, Xmax_box, Ymin_box, Ymax_box, Zmin_box, Zmax_box + integer :: ioerr + character(len=100) :: keyword, keyvalue, line + character(len=100) :: keyword_tmp, incident_wave + + real(kind=CUSTOM_REAL) :: rho_layer, vp_layer, vs_layer, ztop_layer + real(kind=CUSTOM_REAL) :: Radius_box, wave_length_at_bottom + real(kind=CUSTOM_REAL), dimension(:), allocatable :: rho_fk_input, vp_fk_input, vs_fk_input, ztop_fk_input + integer, dimension(:), allocatable :: ilayer_fk_input + integer :: ilayer,ier + !logical :: position_of_wavefront_not_read + + !!-------------------------------------------------------------- + ! # model description : + ! NLAYER n # number of layers + ! LAYER 1 rho, vp ,vs, ztop + ! LAYER 2 rho, vp, vs, ztop + ! ... + ! LAYER n rho, vp, vs, ztop # homogenoeus half-space + ! # + ! # incident wave description: + ! INCIDENT_WAVE "p" or "sv" + ! BACK_AZITUTH bazi + ! INCIDENCE inc + ! ORIGIN_WAVEFRONT xx0, yy0, zz0 + ! ORIGIN_TIME tt0 + ! FREQUENCY_MAX ff0 + ! FREQUENCY_SAMPLING freq_sampling_fk + ! TIME_WINDOW tmax_fk + ! AMPLITUDE amplitude_fk + !!---------------------------------------------------------------- + + !! set default values + tt0 = 0.0 ! origin time + tmax_fk = 128.0 ! time window length + + ff0 = 0.1 ! frequency maximum in Hz + freq_sampling_fk = 10.0 ! frequency sampling rate in Hz + amplitude_fk = 1.0 ! amplitude factor + + type_kpsv_fk = 1 ! 1 == P-wave / 2 == SV-wave + + !position_of_wavefront_not_read = .true. + + !! READING input file + open(85,file=trim(FKMODEL_FILE)) + do + read(85, fmt='(a100)',iostat=ioerr) line + !call remove_begin_blanks(line) + if (ioerr < 0) exit + if (len(trim(line)) < 1 .or. line(1:1) == '#') cycle + read(line,*) keyword, keyvalue + + select case(trim(keyword)) + case('NLAYER') + read(line, *) keyword_tmp, nlayer + + allocate(alpha_FK(nlayer), beta_FK(nlayer), rho_FK(nlayer), mu_FK(nlayer), h_FK(nlayer),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating arrays 2226') + alpha_FK(:) = 0._CUSTOM_REAL; beta_FK(:) = 0._CUSTOM_REAL; rho_FK(:) = 0._CUSTOM_REAL + mu_FK(:) = 0._CUSTOM_REAL; h_FK(:) = 0._CUSTOM_REAL + + allocate(rho_fk_input(nlayer), & + vp_fk_input(nlayer), & + vs_fk_input(nlayer), & + ztop_fk_input(nlayer+1), & + ilayer_fk_input(nlayer+1),stat=ier) + if (ier /= 0) call exit_MPI_without_rank('error allocating arrays 2227') + rho_fk_input(:) = 0._CUSTOM_REAL + vp_fk_input(:) = 0._CUSTOM_REAL + vs_fk_input(:) = 0._CUSTOM_REAL + ztop_fk_input(:) = 0._CUSTOM_REAL + ilayer_fk_input(:) = -1 + + case('LAYER') + read(line, *) keyword_tmp, ilayer, rho_layer, vp_layer, vs_layer, ztop_layer + + ilayer_fk_input(ilayer) = ilayer + rho_fk_input(ilayer) = rho_layer + vp_fk_input(ilayer) = vp_layer + vs_fk_input(ilayer) = vs_layer + ztop_fk_input(ilayer) = ztop_layer + + ! acoustic case: FK for zero-shear velocity not handled, here we set it to a (very) small value + if (abs(vs_fk_input(ilayer)) < TINYVAL) vs_fk_input(ilayer) = 1.e-5 + + case('INCIDENT_WAVE') + read(line,*) keyword_tmp, incident_wave + + select case(trim(incident_wave)) + case ('p', 'P') + type_kpsv_fk = 1 + case('sv','SV') + type_kpsv_fk = 2 + case default + type_kpsv_fk = 1 + end select + + case('BACK_AZIMUTH') + read(line,*) keyword_tmp, phi_FK + phi_FK = - phi_FK - 90.0 + + case('AZIMUTH') + read(line,*) keyword_tmp, phi_FK + phi_FK = 90.0 - phi_FK + + case('TAKE_OFF') + read(line,*) keyword_tmp, theta_FK + + case('ORIGIN_WAVEFRONT') + read(line,*) keyword_tmp, xx0, yy0, zz0 + !position_of_wavefront_not_read = .false. + + case('ORIGIN_TIME') + read(line,*) keyword_tmp, tt0 + + case('NSTEP') + read(line,*) keyword_tmp, NSTEP + + case('deltat') + read(line,*) keyword_tmp, deltat + + case('FREQUENCY_MAX') + read(line,*) keyword_tmp, ff0 + + case('FREQUENCY_SAMPLING') + read(line,*) keyword_tmp, freq_sampling_fk + + case('TIME_WINDOW') + read(line,*) keyword_tmp, tmax_fk + + case('AMPLITUDE') + read(line,*) keyword_tmp, amplitude_fk + + end select + !!------------------------------------------------------------------------------------------------------ + enddo + + if (allocated(ilayer_fk_input)) then + + ilayer_fk_input(nlayer+1) = ilayer_fk_input(nlayer) + ztop_fk_input(nlayer+1) = ztop_fk_input(nlayer) + + ! Z coordinate reference for top of lower-halfspace (last layer input) + Z_REF_for_FK = ztop_fk_input(nlayer) + + do ilayer = 1, nlayer + alpha_FK(ilayer) = vp_fk_input(ilayer) + beta_FK(ilayer) = vs_fk_input(ilayer) + rho_FK(ilayer) = rho_fk_input(ilayer) + + mu_FK(ilayer) = rho_fk_input(ilayer) * vs_fk_input(ilayer)**2 + h_FK(ilayer) = ztop_fk_input(ilayer) - ztop_fk_input(ilayer+1) + + ! checks if layer has values + if (ilayer_fk_input(ilayer) == -1) then + write(*,*) " ERROR READING FK INPUT FILE " + write(*,*) " MISSING LAYER ", ilayer + stop 'Missing layer in FK model' + endif + + ! checks vp,rho are strictly positive + if (alpha_FK(ilayer) <= 0.0_CUSTOM_REAL .or. rho_FK(ilayer) <= 0.0_CUSTOM_REAL) then + print *,'Error: invalid elastic material for FK coupling in layer ',ilayer + print *,' vp = ',alpha_FK(ilayer),' vs = ',beta_FK(ilayer),' rho = ',rho_FK(ilayer) + print *,'vp & rho must be strictly positive' + stop 'Invalid material for FK coupling found in ReadFKModelInput() routine' + endif + + ! checks if vs is strictly positive for SV coupling + if (type_kpsv_fk == 2) then + if (beta_FK(ilayer) <= 0.0_CUSTOM_REAL) then + print *,'Error: invalid elastic material for FK coupling in layer ',ilayer + print *,' vp = ',alpha_FK(ilayer),' vs = ',beta_FK(ilayer),' rho = ',rho_FK(ilayer) + print *,'vp, vs & rho must be strictly positive (in particular vs must be > 0) for SV incident wave' + stop 'Invalid elastic material for FK coupling found in ReadFKModelInput() routine' + endif + endif + + enddo + + deallocate(ilayer_fk_input, rho_fk_input, vp_fk_input, vs_fk_input, ztop_fk_input) + + else + + write(*,*) " ERROR READING FK INPUT FILE " + write(*,*) " NOT BE ABLE TO READ MODEL PROPERTIES " + stop 'Error reading FK input file' + + endif + + !! compute position of wave front + !if (position_of_wavefront_not_read) then + ! ! sets center point of box + ! xx0 = 0.5*(Xmin_box + Xmax_box) + ! yy0 = 0.5*(Ymin_box + Ymax_box) + + ! Radius_box = sqrt( (Xmin_box - xx0)**2 + (Ymin_box - yy0)**2) + + ! if (type_kpsv_fk == 1) then + ! ! P-wave + ! wave_length_at_bottom = alpha_FK(nlayer) / ff0 ! vp + ! else if (type_kpsv_fk == 2) then + ! ! SV-wave + ! wave_length_at_bottom = beta_FK(nlayer) / ff0 ! vs + ! endif + + ! ! depth position below bottom + ! zz0 = Zmin_box - Radius_box * sin ( abs(theta_FK) * (PI / 180.d0) ) & + ! - 3.0 * wave_length_at_bottom * cos ( abs(theta_FK) * (PI / 180.d0) ) + !endif + + ! user output + if (myrank == 0) then + write(IMAIN,*) + write(IMAIN,*) "**********************************************" + write(IMAIN,*) " USING FK INJECTION TECHNIQUE " + write(IMAIN,*) "**********************************************" + write(IMAIN,*) + write(IMAIN,*) " Model : " , nlayer , " layers " + write(IMAIN,*) + do ilayer = 1, nlayer + write(IMAIN,'(a9, i3, 3(a6,2x,f8.3), 3x, a9, f18.5 )') & + " layer ", ilayer, & + " rho =", rho_FK(ilayer), & + " vp =", alpha_FK(ilayer), & + " vs =", beta_FK(ilayer), & + " Height =", h_FK(ilayer) + enddo + write(IMAIN,*) + write(IMAIN,*) " FK (azimuth) angle phi = ", phi_FK,'(deg)' + write(IMAIN,*) " FK take-off angle theta = ", theta_FK,'(deg)' + write(IMAIN,*) + write(IMAIN,*) " Origin wavefront point FK : ", xx0, yy0, zz0 + write(IMAIN,*) " Time shift FK : ", tt0 + write(IMAIN,*) " Time discretization in SEM : ", deltat + write(IMAIN,*) " Number of steps in SEM : ", NSTEP + write(IMAIN,*) " Z reference for FK routine : ", Z_REF_for_FK + write(IMAIN,*) + write(IMAIN,*) " Time window for FK computing : ", tmax_fk + write(IMAIN,*) " Frequency max : ", ff0 + write(IMAIN,*) " Frequency sampling rate : ", freq_sampling_fk + write(IMAIN,*) " Amplitude factor : ", amplitude_fk + write(IMAIN,*) + !write(IMAIN,*) " Model boundary box : Xmin/Xmax = ",Xmin_box,Xmax_box + !write(IMAIN,*) " : Ymin/Ymax = ",Ymin_box,Ymax_box + !write(IMAIN,*) " : Zmin/Zmax = ",Zmin_box,Zmax_box + write(IMAIN,*) + write(IMAIN,*) " Type of incoming wave (1=P), (2=SV) : ",type_kpsv_fk + write(IMAIN,*) + call flush_IMAIN() + endif + + end subroutine ReadFKModelInput diff --git a/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/make_fk_injection.sh b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/make_fk_injection.sh new file mode 100644 index 000000000..e9dd1b09d --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/make_fk_injection.sh @@ -0,0 +1,6 @@ +MPIFC=mpif90 +FLAGS='-g -xHost -O3' + +${MPIFC} ${FLAGS} -o compute_fk_injection_field coupling_fk.f90 utils.f90 compute_fk_injection_field.f90 + +${MPIFC} ${FLAGS} -o compute_fk_receiver coupling_fk.f90 utils.f90 compute_fk_receiver.f90 diff --git a/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/utils.f90 b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/utils.f90 new file mode 100644 index 000000000..e15e56c29 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/fk_coupling/utils.f90 @@ -0,0 +1,72 @@ + subroutine flush_IMAIN() + + use fk_injection, only: IMAIN + + implicit none + + ! only main process writes out to main output file + ! file I/O in Fortran is buffered by default + ! + ! note: Fortran2003 includes a FLUSH statement + ! which is implemented by most compilers by now + ! + ! otherwise: + ! a) comment out the line below + ! b) try to use instead: call flush(IMAIN) + + flush(IMAIN) + + end subroutine flush_IMAIN + +! version without rank number printed in the error message + + subroutine exit_MPI_without_rank(error_msg) + + use mpi + !use fk_injection + + implicit none + + character(len=*) :: error_msg + integer :: ier + + ! write error message to screen + write(*,*) error_msg(1:len(error_msg)) + write(*,*) 'Error detected, aborting MPI...' + + ! flushes possible left-overs from print-statements + call flush_stdout() + + ! abort execution + call MPI_ABORT(MPI_COMM_WORLD,30,ier) + stop 'error, program ended in abort_mpi' + + end subroutine exit_MPI_without_rank + + subroutine flush_stdout() + +! flushes possible left-overs from print-statements + + implicit none + + logical :: is_connected + + ! note: Cray systems don't flush print statements before ending with an MPI + ! abort, + ! which often omits debugging statements with print before it. + ! + ! to check which unit is used for standard output, one might also use a + ! Fortran2003 module iso_Fortran_env: + ! use, intrinsic :: iso_Fortran_env, only: output_unit + + ! checks default stdout unit 6 + inquire(unit=6,opened=is_connected) + if (is_connected) & + flush(6) + + ! checks Cray stdout unit 101 + inquire(unit=101,opened=is_connected) + if (is_connected) & + flush(101) + + end subroutine flush_stdout diff --git a/EXAMPLES/applications/wavefield_discontinuity/plot/plot_utils_injection.py b/EXAMPLES/applications/wavefield_discontinuity/plot/plot_utils_injection.py new file mode 100644 index 000000000..3a0fe0dc1 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/plot/plot_utils_injection.py @@ -0,0 +1,255 @@ +import numpy as np +import sys, os +import matplotlib.pyplot as plt +from scipy import signal +from scipy.interpolate import interp1d + +def split_line(line): + # split line with continuous multiple spaces + # return a list of strings + return [_ for _ in line.strip().split(' ') if _ != ''] + +class WaveformSection: + def __init__(self): + self.waveforms = None + self.t = None + self.coord_list = None + + def __sub__(self, other): + sub = other.interpolate(self.t) + for i_wave in range(len(sub.waveforms)): + sub.waveforms[i_wave] = self.waveforms[i_wave] - sub.waveforms[i_wave] + return sub + + def shift(self, dt): + self.t += dt + + def scale(self, fac): + for i_wave in range(len(self.waveforms)): + self.waveforms[i_wave] = self.waveforms[i_wave] * fac + + def difference_ratio(self, other, time_range=None, offset=None): + if offset is None: offset = [0.0] * len(self.waveforms) + if time_range is None: time_range = (self.t[0], self.t[-1]) + ratio_list = [] + sub = other.interpolate(self.t) + for i_wave in range(len(sub.waveforms)): + ind = np.logical_and((self.t-offset[i_wave] >= time_range[0]), (self.t-offset[i_wave] <= time_range[1])) + diff = self.waveforms[i_wave][ind] - sub.waveforms[i_wave][ind] + ratio = np.sum(diff * diff) / ( + np.sqrt(np.sum(self.waveforms[i_wave][ind] * self.waveforms[i_wave][ind]))* + np.sqrt(np.sum(sub.waveforms[i_wave][ind] * sub.waveforms[i_wave][ind]))) + ratio_list.append(ratio) + return ratio_list + + def time_shift(self, other, time_range=None, offset=None): + if offset is None: offset = [0.0] * len(self.waveforms) + if time_range is None: time_range = (self.t[0], self.t[-1]) + shift_list = [] + sub = other.interpolate(self.t) + for i_wave in range(len(sub.waveforms)): + ind = np.logical_and((self.t-offset[i_wave] >= time_range[0]), (self.t-offset[i_wave] <= time_range[1])) + cc = signal.correlate(self.waveforms[i_wave][ind], sub.waveforms[i_wave][ind]) + dt = (np.argmax(cc) - (len(self.waveforms[i_wave][ind]) - 1)) * (self.t[1] - self.t[0]) + shift_list.append(dt) + return shift_list + + def interpolate(self, t_new): + """ + not in-place + """ + sec_new = WaveformSection() + sec_new.coord_list = self.coord_list + sec_new.t = np.copy(t_new) + sec_new.waveforms = [] + for wave in self.waveforms: + f = interp1d(self.t, wave, fill_value="extrapolate") + sec_new.waveforms.append(f(t_new)) + return sec_new + + def filter(self, freq_range, verbose=1): + if (not isinstance(freq_range, tuple)): + sys.exit(f"{freq_range} is not a tuple\n") + if (len(freq_range)!=2): + sys.exit(f"incorrect frequency range {freq_range}\n") + if (verbose==1): print(f'apply filter {freq_range}\n') + s = self.t[1] - self.t[0] + if (not (freq_range[0] >= 0.0)): + sos = signal.butter(4, freq_range[1] * s * 2, 'lowpass', output='sos') + else: + sos = signal.butter(4, [freq_range[0] * s * 2, freq_range[1] * s * 2], 'bandpass', output='sos') + for i_wave in range(len(self.waveforms)): + wave = self.waveforms[i_wave] + self.waveforms[i_wave] = signal.sosfiltfilt(sos, wave, padtype=None) + + def get_max_time(self, time_range=None): + if time_range is None: time_range = (self.t[0], self.t[-1]) + max_time_list = [] + max_amp_list = [] + for i_wave in range(len(self.waveforms)): + wave = self.waveforms[i_wave] + ind = np.logical_and((self.t >= time_range[0]), (self.t <= time_range[1])) + wave_abs = np.absolute(wave) + ind_max = np.argmax(wave_abs[ind]) + max_amp_list.append(np.amax(wave_abs[ind])) + max_time_list.append(time_range[0] + ind_max * (self.t[1] - self.t[0])) + return max_time_list, max_amp_list + + def get_first_arrival_time(self, threshold=0.1, time_range=None): + if time_range is None: time_range = (self.t[0], self.t[-1]) + max_time_list, max_amp_list = self.get_max_time() + first_arrival_time_list = [] + for i_wave in range(len(self.waveforms)): + wave = self.waveforms[i_wave] + ind = np.logical_and((self.t >= time_range[0]), (self.t <= time_range[1])) + wave = wave[ind] + wave_abs = np.absolute(wave) + for it in range(1, len(wave)-1): + if ((wave_abs[it] >= wave_abs[it-1]) and (wave_abs[it] >= wave_abs[it+1]) and (wave_abs[it]>=threshold*max_amp_list[i_wave])): + arrival = time_range[0] + it * (self.t[1] - self.t[0]) + break + first_arrival_time_list.append(arrival) + return first_arrival_time_list + + + def plot_waveforms_fill(self, *args, fig_num=0, time_range=None, offset=None, + x_axis_trans=(1.0, 0.0, 0.0, 0.0), + fill=True, fill_color=('blue', 'red'), + norm_with=None, normalize=1.0, label=None, **kwargs): + fig = plt.figure(num=fig_num) # pull out the existed figure + if offset is None: offset = [0.0] * len(self.waveforms) + if time_range is None: time_range = (self.t[0], self.t[-1]) + if norm_with is None: norm_with = self + max_val = 0.0 + for i_wave in range(len(self.waveforms)): + wave = norm_with.waveforms[i_wave] + ind = np.logical_and((norm_with.t-offset[i_wave] >= time_range[0]), (norm_with.t-offset[i_wave] <= time_range[1])) + if (np.amax(np.absolute(wave)) > max_val): + max_val = np.amax(np.absolute(wave[ind])) + for i_wave in range(len(self.waveforms)): + x_axis_val = x_axis_trans[0] * self.coord_list[i_wave][0] + \ + x_axis_trans[1] * self.coord_list[i_wave][1] + \ + x_axis_trans[2] * self.coord_list[i_wave][2] + \ + x_axis_trans[3] + ind = np.logical_and((self.t-offset[i_wave] >= time_range[0]), (self.t-offset[i_wave] <= time_range[1])) + wave_norm = self.waveforms[i_wave][ind] / max_val * normalize + x_axis_val + t_ind = self.t[ind] - offset[i_wave] + if ((i_wave == 0) and (label is not None)): + plt.plot(wave_norm, t_ind, *args, label=label, **kwargs) + else: + plt.plot(wave_norm, t_ind, *args, **kwargs) + if fill: + ax = plt.gca() + zero = np.zeros_like(wave_norm) + x_axis_val + ax.fill_betweenx(t_ind, wave_norm, zero, where=wave_norm >= zero , facecolor=fill_color[0]) + ax.fill_betweenx(t_ind, wave_norm, zero, where=wave_norm <= zero , facecolor=fill_color[1]) + + def plot_waveforms_ax_fill(self, *args, ax=None, time_range=None, offset=None, + x_axis_trans=(1.0, 0.0, 0.0, 0.0), + is_time_axis_x = False, + fill=True, fill_color=('blue', 'red'), + norm_with=None, normalize=1.0, label=None, **kwargs): + #fig = plt.figure(num=fig_num) # pull out the existed figure + if ax is None: ax = plt.gca() + if offset is None: offset = [0.0] * len(self.waveforms) + if time_range is None: time_range = (self.t[0], self.t[-1]) + if norm_with is None: norm_with = self + max_val = 0.0 + for i_wave in range(len(self.waveforms)): + wave = norm_with.waveforms[i_wave] + ind = np.logical_and((norm_with.t-offset[i_wave] >= time_range[0]), (norm_with.t-offset[i_wave] <= time_range[1])) + if (np.amax(np.absolute(wave)) > max_val): + max_val = np.amax(np.absolute(wave[ind])) + for i_wave in range(len(self.waveforms)): + x_axis_val = x_axis_trans[0] * self.coord_list[i_wave][0] + \ + x_axis_trans[1] * self.coord_list[i_wave][1] + \ + x_axis_trans[2] * self.coord_list[i_wave][2] + \ + x_axis_trans[3] + ind = np.logical_and((self.t-offset[i_wave] >= time_range[0]), (self.t-offset[i_wave] <= time_range[1])) + wave_norm = self.waveforms[i_wave][ind] / max_val * normalize + x_axis_val + t_ind = self.t[ind] - offset[i_wave] + if ((i_wave == 0) and (label is not None)): + if is_time_axis_x: + ax.plot(t_ind, wave_norm, *args, label=label, **kwargs) + else: + ax.plot(wave_norm, t_ind, *args, label=label, **kwargs) + else: + if is_time_axis_x: + ax.plot(t_ind, wave_norm, *args, **kwargs) + else: + ax.plot(wave_norm, t_ind, *args, **kwargs) + if fill: + #ax = plt.gca() + zero = np.zeros_like(wave_norm) + x_axis_val + if is_time_axis_x: + ax.fill_between(t_ind, wave_norm, zero, where=wave_norm >= zero , facecolor=fill_color[0]) + ax.fill_between(t_ind, wave_norm, zero, where=wave_norm <= zero , facecolor=fill_color[1]) + else: + ax.fill_betweenx(t_ind, wave_norm, zero, where=wave_norm >= zero , facecolor=fill_color[0]) + ax.fill_betweenx(t_ind, wave_norm, zero, where=wave_norm <= zero , facecolor=fill_color[1]) + + def get_waveforms_from_specfem(self, fn_list, fn_stations, + t=None, tstart=None, dt=None, nt=None, + verbose=1): + if (verbose==1): print('plotting waveforms from SPECFEM results\n') + n_stations = len(fn_list) + if (verbose==1): print(f'there are {n_stations} waveforms\n') + if (verbose==1): print(f'reading station information from {fn_stations}\n') + try: + coord_list = [None] * n_stations + with open(fn_stations, 'r') as f_stations: + lines = f_stations.readlines() + for line in lines: + line_segs = split_line(line) + nt_name = line_segs[0] + sta_name = line_segs[1] + sta_lat = float(line_segs[2]) + sta_lon = float(line_segs[3]) + sta_depth = float(line_segs[5]) + for i_fn in range(len(fn_list)): + fn = os.path.split(fn_list[i_fn])[-1] + if (fn.startswith(f'{nt_name}.{sta_name}') or fn.startswith(f'{sta_name}.{nt_name}')): + if coord_list[i_fn] is not None: + raise(ValueError('file list conflict')) + coord_list[i_fn] = (sta_lon / 1000.0, sta_lat / 1000.0, sta_depth / 1000.0) + break + for i_fn in range(len(fn_list)): + if coord_list[i_fn] is None: + raise(ValueError(f'station does not exist for {fn_list[i_fn]}')) + except Exception as e: + sys.exit(f"{e}\n") + self.coord_list = coord_list + + waveforms = [] + if t is not None: + if (verbose==1): print(f'use time t0={t[0]}, dt={t[1]-t[0]}, nt={nt}\n') + elif (tstart is not None) and (dt is not None) and (nt is not None): + try: + t = np.arange(0, nt, dtype=float) *dt + tstart + except Exception as e: + sys.exit(f"{e}\n") + if (verbose==1): print(f'use time t0={t[0]}, dt={t[1]-t[0]}, nt={nt}\n') + else: + if (verbose==1): print('find time in waveform files\n') + for i_fn in range(len(fn_list)): + try: + if (verbose==1): print(f'reading waveform file {fn_list[i_fn]}\n') + wave = np.loadtxt(fn_list[i_fn]) + if t is None: + if (tstart is None): tstart = wave[0,0] + if (dt is None): dt = wave[1,0] - wave[0,0] + if (nt is None): nt = len(wave) + try: + t = np.arange(0, nt, dtype=float) *dt + tstart + except Exception as e: + sys.exit(f"{e}\n") + if (verbose==1): print(f'use time t0={t[0]}, dt={t[1]-t[0]}, nt={nt}\n') + if (wave.shape[0] != len(t)): + raise (ValueError(f'file length inconsistant: {fn_list[i_fn]}')) + waveforms.append(wave[:,1]) + except Exception as e: + sys.exit(f"{e}\n") + self.waveforms = waveforms + self.t = t + + diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/CMTSOLUTION b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/CMTSOLUTION new file mode 100644 index 000000000..07356239f --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/CMTSOLUTION @@ -0,0 +1,13 @@ +PDE 1999 01 01 00 00 00.00 67000 67000 -25000 4.2 4.2 hom_explosion +event name: hom_explosion +time shift: 0.0000 +half duration: 5.0 +latorUTM: 33.6 +longorUTM: -118.4 +depth: 10.0 +Mrr: 1.000000e+23 +Mtt: 1.000000e+23 +Mpp: 1.000000e+23 +Mrt: 0.000000 +Mrp: 0.000000 +Mtp: 0.000000 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/FORCESOLUTION b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/FORCESOLUTION new file mode 100644 index 000000000..e69de29bb diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/Par_file b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/Par_file new file mode 100644 index 000000000..c8d6b9b01 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/Par_file @@ -0,0 +1,405 @@ +#----------------------------------------------------------- +# +# Simulation input parameters +# +#----------------------------------------------------------- + +# forward or adjoint simulation +# 1 = forward, 2 = adjoint, 3 = both simultaneously +SIMULATION_TYPE = 1 +# 0 = earthquake simulation, 1/2/3 = three steps in noise simulation +NOISE_TOMOGRAPHY = 0 +SAVE_FORWARD = .false. + +# solve a full FWI inverse problem from a single calling program with no I/Os, storing everything in memory, +# or run a classical forward or adjoint problem only and save the seismograms and/or sensitivity kernels to disk (with costlier I/Os) +INVERSE_FWI_FULL_PROBLEM = .false. + +# UTM projection parameters +# Use a negative zone number for the Southern hemisphere: +# The Northern hemisphere corresponds to zones +1 to +60, +# The Southern hemisphere corresponds to zones -1 to -60. +UTM_PROJECTION_ZONE = 11 +SUPPRESS_UTM_PROJECTION = .true. + +# number of MPI processors +NPROC = 4 + +# time step parameters +NSTEP = 3000 +DT = 0.02 + +# set to true to use local-time stepping (LTS) +LTS_MODE = .false. + +# Partitioning algorithm for decompose_mesh +# choose partitioner: 1==SCOTCH (default), 2==METIS, 3==PATOH, 4==ROWS_PART +PARTITIONING_TYPE = 1 + +#----------------------------------------------------------- +# +# LDDRK time scheme +# +#----------------------------------------------------------- +USE_LDDRK = .false. +INCREASE_CFL_FOR_LDDRK = .false. +RATIO_BY_WHICH_TO_INCREASE_IT = 1.4 + +#----------------------------------------------------------- +# +# Mesh +# +#----------------------------------------------------------- + +# Number of nodes for 2D and 3D shape functions for hexahedra. +# We use either 8-node mesh elements (bricks) or 27-node elements. +# If you use our internal mesher, the only option is 8-node bricks (27-node elements are not supported). +NGNOD = 8 + +# models: +# available options are: +# default (model parameters described by mesh properties) +# 1D models available are: +# 1d_prem,1d_socal,1d_cascadia +# 3D models available are: +# aniso,external,gll,salton_trough,tomo,SEP,coupled,... +MODEL = default + +# path for external tomographic models files +TOMOGRAPHY_PATH = DATA/tomo_files/ +# if you are using a SEP model (oil-industry format) +SEP_MODEL_DIRECTORY = DATA/my_SEP_model/ + +#----------------------------------------------------------- + +# parameters describing the model +APPROXIMATE_OCEAN_LOAD = .false. +TOPOGRAPHY = .false. +ATTENUATION = .false. +ANISOTROPY = .false. +GRAVITY = .false. + +# in case of attenuation, reference frequency in Hz at which the velocity values in the velocity model are given (unused otherwise) +ATTENUATION_f0_REFERENCE = 18.d0 + +# attenuation period range over which we try to mimic a constant Q factor +MIN_ATTENUATION_PERIOD = 999999998.d0 +MAX_ATTENUATION_PERIOD = 999999999.d0 +# ignore this range and ask the code to compute it automatically instead based on the estimated resolution of the mesh (use this unless you know what you are doing) +COMPUTE_FREQ_BAND_AUTOMATIC = .true. + +# Olsen's constant for Q_mu = constant * V_s attenuation rule +USE_OLSEN_ATTENUATION = .false. +OLSEN_ATTENUATION_RATIO = 0.05 + +#----------------------------------------------------------- +# +# Absorbing boundary conditions +# +#----------------------------------------------------------- + +# C-PML boundary conditions for a regional simulation +# (if set to .false., and STACEY_ABSORBING_CONDITIONS is also set to .false., you get a free surface instead +# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements +PML_CONDITIONS = .true. + +# C-PML top surface +PML_INSTEAD_OF_FREE_SURFACE = .false. + +# C-PML dominant frequency +f0_FOR_PML = 1.0 + +# parameters used to rotate C-PML boundary conditions by a given angle (not completed yet) +# ROTATE_PML_ACTIVATE = .false. +# ROTATE_PML_ANGLE = 0. + +# absorbing boundary conditions for a regional simulation +# (if set to .false., and PML_CONDITIONS is also set to .false., you get a free surface instead +# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements +STACEY_ABSORBING_CONDITIONS = .false. + +# absorbing top surface (defined in mesh as 'free_surface_file') +STACEY_INSTEAD_OF_FREE_SURFACE = .false. + +# When STACEY_ABSORBING_CONDITIONS is set to .true. : +# absorbing conditions are defined in xmin, xmax, ymin, ymax and zmin +# this option BOTTOM_FREE_SURFACE can be set to .true. to +# make zmin free surface instead of absorbing condition +BOTTOM_FREE_SURFACE = .false. + +#----------------------------------------------------------- +# +# undoing attenuation and/or PMLs for sensitivity kernel calculations +# +#----------------------------------------------------------- + +# to undo attenuation and/or PMLs for sensitivity kernel calculations or forward runs with SAVE_FORWARD +# use the flag below. It performs undoing of attenuation and/or of PMLs in an exact way for sensitivity kernel calculations +# but requires disk space for temporary storage, and uses a significant amount of memory used as buffers for temporary storage. +# When that option is on the second parameter indicates how often the code dumps restart files to disk (if in doubt, use something between 100 and 1000). +UNDO_ATTENUATION_AND_OR_PML = .false. +NT_DUMP_ATTENUATION = 500 + +#----------------------------------------------------------- +# +# Visualization +# +#----------------------------------------------------------- + +# save AVS or OpenDX movies +# MOVIE_TYPE = 1 to show the top surface +# MOVIE_TYPE = 2 to show all the external faces of the mesh +CREATE_SHAKEMAP = .false. +MOVIE_SURFACE = .false. +MOVIE_TYPE = 1 +MOVIE_VOLUME = .false. +SAVE_DISPLACEMENT = .false. +MOVIE_VOLUME_STRESS = .false. +USE_HIGHRES_FOR_MOVIES = .false. +NTSTEP_BETWEEN_FRAMES = 200 +HDUR_MOVIE = 0.0 + +# save AVS or OpenDX mesh files to check the mesh +SAVE_MESH_FILES = .true. + +# path to store the local database file on each node +LOCAL_PATH = ./DATABASES_MPI + +# interval at which we output time step info and max of norm of displacement +NTSTEP_BETWEEN_OUTPUT_INFO = 500 + +#----------------------------------------------------------- +# +# Sources +# +#----------------------------------------------------------- + +# sources and receivers Z coordinates given directly (i.e. as their true position) instead of as their depth +USE_SOURCES_RECEIVERS_Z = .true. + +# use a (tilted) FORCESOLUTION force point source (or several) instead of a CMTSOLUTION moment-tensor source. +# This can be useful e.g. for oil industry foothills simulations or asteroid simulations +# in which the source is a vertical force, normal force, tilted force, impact etc. +# If this flag is turned on, the FORCESOLUTION file must be edited by giving: +# - the corresponding time-shift parameter, +# - the half duration (hdur, in s) for Gaussian/Step function, dominant frequency (f0, in Hz) for Ricker, +# - the coordinates of the source, +# - the source time function type (0=Gaussian function, 1=Ricker wavelet, 2=Step function), +# - the magnitude of the force source, +# - the components of a (non necessarily unitary) direction vector for the force source in the E/N/Z_UP basis. +# The direction vector is made unitary internally in the code and thus only its direction matters here; +# its norm is ignored and the norm of the force used is the factor force source times the source time function. +USE_FORCE_POINT_SOURCE = .true. + +# set to true to use a Ricker source time function instead of the source time functions set by default +# to represent a (tilted) FORCESOLUTION force point source or a CMTSOLUTION moment-tensor source. +USE_RICKER_TIME_FUNCTION = .true. + +# use an external source time function +# you must add a file with your source time function and the file name path +# relative to working directory at the end of CMTSOLUTION or FORCESOLUTION file +# (with multiple sources, one file per source is required). +# This file must have a single column containing the amplitudes of the source at all time steps; +# time step size used must be equal to DT as defined at the beginning of this Par_file. +# Be sure when this option is .false. to remove the name of stf file in CMTSOLUTION or FORCESOLUTION +USE_EXTERNAL_SOURCE_FILE = .false. + +# print source time function +PRINT_SOURCE_TIME_FUNCTION = .true. + +# source encoding +# (for acoustic simulations only for now) determines source encoding factor +/-1 depending on sign of moment tensor +# (see e.g. Krebs et al., 2009. Fast full-wavefield seismic inversion using encoded sources, Geophysics, 74 (6), WCC177-WCC188.) +USE_SOURCE_ENCODING = .false. + +#----------------------------------------------------------- +# +# Seismograms +# +#----------------------------------------------------------- + +# interval in time steps for writing of seismograms +NTSTEP_BETWEEN_OUTPUT_SEISMOS = 10000 + +# set to n to reduce the sampling rate of output seismograms by a factor of n +# defaults to 1, which means no down-sampling +NTSTEP_BETWEEN_OUTPUT_SAMPLE = 1 + +# decide if we save displacement, velocity, acceleration and/or pressure in forward runs (they can be set to true simultaneously) +# currently pressure seismograms are implemented in acoustic (i.e. fluid) elements only +SAVE_SEISMOGRAMS_DISPLACEMENT = .true. +SAVE_SEISMOGRAMS_VELOCITY = .false. +SAVE_SEISMOGRAMS_ACCELERATION = .false. +SAVE_SEISMOGRAMS_PRESSURE = .false. # currently implemented in acoustic (i.e. fluid) elements only + +# option to save strain seismograms +# this option is useful for strain Green's tensor +SAVE_SEISMOGRAMS_STRAIN = .false. + +# save seismograms also when running the adjoint runs for an inverse problem +# (usually they are unused and not very meaningful, leave this off in almost all cases) +SAVE_SEISMOGRAMS_IN_ADJOINT_RUN = .false. + +# save seismograms in binary or ASCII format (binary is smaller but may not be portable between machines) +USE_BINARY_FOR_SEISMOGRAMS = .false. + +# output seismograms in Seismic Unix format (binary with 240-byte-headers) +SU_FORMAT = .false. + +# output seismograms in ASDF (requires asdf-library) +ASDF_FORMAT = .false. + +# output seismograms in HDF5 (requires hdf5-library and WRITE_SEISMOGRAMS_BY_MAIN) +HDF5_FORMAT = .false. + +# decide if main process writes all the seismograms or if all processes do it in parallel +WRITE_SEISMOGRAMS_BY_MAIN = .false. + +# save all seismograms in one large combined file instead of one file per seismogram +# to avoid overloading shared non-local file systems such as LUSTRE or GPFS for instance +SAVE_ALL_SEISMOS_IN_ONE_FILE = .false. + +# use a trick to increase accuracy of pressure seismograms in fluid (acoustic) elements: +# use the second derivative of the source for the source time function instead of the source itself, +# and then record -potential_acoustic() as pressure seismograms instead of -potential_dot_dot_acoustic(); +# this is mathematically equivalent, but numerically significantly more accurate because in the explicit +# Newmark time scheme acceleration is accurate at zeroth order while displacement is accurate at second order, +# thus in fluid elements potential_dot_dot_acoustic() is accurate at zeroth order while potential_acoustic() +# is accurate at second order and thus contains significantly less numerical noise. +USE_TRICK_FOR_BETTER_PRESSURE = .false. + +#----------------------------------------------------------- +# +# Energy calculation +# +#----------------------------------------------------------- + +# to plot energy curves, for instance to monitor how CPML absorbing layers behave; +# should be turned OFF in most cases because a bit expensive +OUTPUT_ENERGY = .false. +# every how many time steps we compute energy (which is a bit expensive to compute) +NTSTEP_BETWEEN_OUTPUT_ENERGY = 10 + +#----------------------------------------------------------- +# +# Adjoint kernel outputs +# +#----------------------------------------------------------- + +# interval in time steps for reading adjoint traces +# 0 = read the whole adjoint sources at start time +NTSTEP_BETWEEN_READ_ADJSRC = 0 + +# read adjoint sources using ASDF (requires asdf-library) +READ_ADJSRC_ASDF = .false. + +# this parameter must be set to .true. to compute anisotropic kernels +# in crust and mantle (related to the 21 Cij in geographical coordinates) +# default is .false. to compute isotropic kernels (related to alpha and beta) +ANISOTROPIC_KL = .false. + +# compute transverse isotropic kernels (alpha_v,alpha_h,beta_v,beta_h,eta,rho) +# rather than fully anisotropic kernels in case ANISOTROPIC_KL is set to .true. +SAVE_TRANSVERSE_KL = .false. + +# this parameter must be set to .true. to compute anisotropic kernels for +# cost function using velocity observable rather than displacement +ANISOTROPIC_VELOCITY_KL = .false. + +# outputs approximate Hessian for preconditioning +APPROXIMATE_HESS_KL = .false. + +# save Moho mesh and compute Moho boundary kernels +SAVE_MOHO_MESH = .false. + +#----------------------------------------------------------- +# +# Coupling with an injection technique (DSM, AxiSEM, or FK) +# +#----------------------------------------------------------- +COUPLE_WITH_INJECTION_TECHNIQUE = .false. +INJECTION_TECHNIQUE_TYPE = 3 # 1 = DSM, 2 = AxiSEM, 3 = FK +MESH_A_CHUNK_OF_THE_EARTH = .false. +TRACTION_PATH = DATA/AxiSEM_tractions/3/ +FKMODEL_FILE = FKmodel +RECIPROCITY_AND_KH_INTEGRAL = .false. # does not work yet + +#----------------------------------------------------------- +## +## Prescribed wavefield discontinuity on an interface +## +##----------------------------------------------------------- +IS_WAVEFIELD_DISCONTINUITY = .true. + +#----------------------------------------------------------- +# +# Run modes +# +#----------------------------------------------------------- + +# Simultaneous runs +# added the ability to run several calculations (several earthquakes) +# in an embarrassingly-parallel fashion from within the same run; +# this can be useful when using a very large supercomputer to compute +# many earthquakes in a catalog, in which case it can be better from +# a batch job submission point of view to start fewer and much larger jobs, +# each of them computing several earthquakes in parallel. +# To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS to a value greater than 1. +# To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators, +# each of them being labeled "my_local_mpi_comm_world", and we use them +# in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case +# we need to kill the entire run. +# When that option is on, of course the number of processor cores used to start +# the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS, +# all the individual runs must use the same number of processor cores, +# which as usual is NPROC in the Par_file, +# and thus the total number of processor cores to request from the batch system +# should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC. +# All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on +# (with exactly four digits). +# +# Imagine you have 10 independent calculations to do, each of them on 100 cores; you have three options: +# +# 1/ submit 10 jobs to the batch system +# +# 2/ submit a single job on 1000 cores to the batch, and in that script create a sub-array of jobs to start 10 jobs, +# each running on 100 cores (see e.g. http://www.schedmd.com/slurmdocs/job_array.html ) +# +# 3/ submit a single job on 1000 cores to the batch, start SPECFEM3D on 1000 cores, create 10 sub-communicators, +# cd into one of 10 subdirectories (called e.g. run0001, run0002,... run0010) depending on the sub-communicator +# your MPI rank belongs to, and run normally on 100 cores using that sub-communicator. +# +# The option below implements 3/. +# +NUMBER_OF_SIMULTANEOUS_RUNS = 1 + +# if we perform simultaneous runs in parallel, if only the source and receivers vary between these runs +# but not the mesh nor the model (velocity and density) then we can also read the mesh and model files +# from a single run in the beginning and broadcast them to all the others; for a large number of simultaneous +# runs for instance when solving inverse problems iteratively this can DRASTICALLY reduce I/Os to disk in the solver +# (by a factor equal to NUMBER_OF_SIMULTANEOUS_RUNS), and reducing I/Os is crucial in the case of huge runs. +# Thus, always set this option to .true. if the mesh and the model are the same for all simultaneous runs. +# In that case there is no need to duplicate the mesh and model file database (the content of the DATABASES_MPI +# directories) in each of the run0001, run0002,... directories, it is sufficient to have one in run0001 +# and the code will broadcast it to the others) +BROADCAST_SAME_MESH_AND_MODEL = .true. + +#----------------------------------------------------------- + +# set to true to use GPUs +GPU_MODE = .false. + +# ADIOS Options for I/Os +ADIOS_ENABLED = .false. +ADIOS_FOR_DATABASES = .false. +ADIOS_FOR_MESH = .false. +ADIOS_FOR_FORWARD_ARRAYS = .false. +ADIOS_FOR_KERNELS = .false. +ADIOS_FOR_UNDO_ATTENUATION = .false. + +# HDF5 Database I/O +# (note the flags for HDF5 and ADIOS are mutually exclusive, only one can be used) +HDF5_ENABLED = .false. +HDF5_FOR_MOVIES = .false. +HDF5_IO_NODES = 0 # HDF5 IO server with number of IO dedicated procs + diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS new file mode 100644 index 000000000..f9175a451 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS @@ -0,0 +1,4 @@ +TS01 TS 25000.0 10000.0 0.0 0.0 +TS02 TS 25000.0 20000.0 0.0 0.0 +TS03 TS 25000.0 30000.0 0.0 0.0 +TS04 TS 25000.0 40000.0 0.0 0.0 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS_FILTERED b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS_FILTERED new file mode 100644 index 000000000..6b1e6c492 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/STATIONS_FILTERED @@ -0,0 +1,4 @@ + TS01 TS 25000.000000000000 10000.000000000000 0.000000000000 0.000000000000 + TS02 TS 25000.000000000000 20000.000000000000 0.000000000000 0.000000000000 + TS03 TS 25000.000000000000 30000.000000000000 0.000000000000 0.000000000000 + TS04 TS 25000.000000000000 40000.000000000000 0.000000000000 0.000000000000 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file new file mode 100644 index 000000000..f08c911b0 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file @@ -0,0 +1,103 @@ +#----------------------------------------------------------- +# +# Meshing input parameters +# +#----------------------------------------------------------- + +# coordinates of mesh block in latitude/longitude and depth in km +LATITUDE_MIN = -10000.0 +LATITUDE_MAX = 60000.0 +LONGITUDE_MIN = -10000.0 +LONGITUDE_MAX = 60000.0 +DEPTH_BLOCK_KM = 60.0 +UTM_PROJECTION_ZONE = 11 +SUPPRESS_UTM_PROJECTION = .true. + +# file that contains the interfaces of the model / mesh +INTERFACES_FILE = interfaces.dat + +# file that contains the cavity +CAVITY_FILE = no_cavity.dat + +# number of elements at the surface along edges of the mesh at the surface +# (must be 8 * multiple of NPROC below if mesh is not regular and contains mesh doublings) +# (must be multiple of NPROC below if mesh is regular) +NEX_XI = 28 +NEX_ETA = 28 + +# number of MPI processors along xi and eta (can be different) +NPROC_XI = 1 +NPROC_ETA = 1 + +#----------------------------------------------------------- +# +# Doubling layers +# +#----------------------------------------------------------- + +# Regular/irregular mesh +USE_REGULAR_MESH = .true. +# Only for irregular meshes, number of doubling layers and their position +NDOUBLINGS = 0 +# NZ_DOUBLING_1 is the parameter to set up if there is only one doubling layer +# (more doubling entries can be added if needed to match NDOUBLINGS value) +NZ_DOUBLING_1 = 11 +NZ_DOUBLING_2 = 0 + +#----------------------------------------------------------- +# +# Visualization +# +#----------------------------------------------------------- + +# create mesh files for visualisation or further checking +CREATE_ABAQUS_FILES = .false. +CREATE_DX_FILES = .false. +CREATE_VTK_FILES = .false. + +# stores mesh files as cubit-exported files into directory MESH/ (for single process run) +SAVE_MESH_AS_CUBIT = .true. + +# path to store the databases files +LOCAL_PATH = ./DATABASES_MPI + +#----------------------------------------------------------- +# +# CPML +# +#----------------------------------------------------------- + +# CPML perfectly matched absorbing layers +THICKNESS_OF_X_PML = 10000.0 +THICKNESS_OF_Y_PML = 10000.0 +THICKNESS_OF_Z_PML = 10000.0 + +#----------------------------------------------------------- +# +# Domain materials +# +#----------------------------------------------------------- + +# number of materials +NMATERIALS = 2 +# define the different materials in the model as: +# #material_id #rho #vp #vs #Q_Kappa #Q_mu #anisotropy_flag #domain_id +# Q_Kappa : Q_Kappa attenuation quality factor +# Q_mu : Q_mu attenuation quality factor +# anisotropy_flag : 0 = no anisotropy / 1,2,... check the implementation in file aniso_model.f90 +# domain_id : 1 = acoustic / 2 = elastic / 3 = poroelastic +1 3380.0 8080.0 4485.0 9999. 40.0 0 2 +2 2600.0 5800.0 3198.0 9999. 40.0 0 2 + +#----------------------------------------------------------- +# +# Domain regions +# +#----------------------------------------------------------- + +# number of regions +NREGIONS = 2 +# define the different regions of the model as : +#NEX_XI_BEGIN #NEX_XI_END #NEX_ETA_BEGIN #NEX_ETA_END #NZ_BEGIN #NZ_END #material_id +1 28 1 28 1 14 1 +1 28 1 28 15 24 2 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/interfaces.dat b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/interfaces.dat new file mode 100644 index 000000000..2d1101962 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/interfaces.dat @@ -0,0 +1,18 @@ +# number of interfaces + 2 +# +# We describe each interface below, structured as a 2D-grid, with several parameters : +# number of points along XI and ETA, minimal XI ETA coordinates +# and spacing between points which must be constant. +# Then the records contain the Z coordinates of the NXI x NETA points. +# +# interface number 1 +# SUPPRESS_UTM_PROJECTION NXI NETA LONG_MIN LAT_MIN SPACING_XI SPACING_ETA + .true. 2 2 -10000.0 -10000.0 70000.0 70000.0 + moho.dat + .true. 2 2 -10000.0 -10000.0 70000.0 70000.0 + top.dat +# for each layer, we give the number of spectral elements in the vertical direction +# layer number 1 (bottom layer) + 10 + 14 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/moho.dat b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/moho.dat new file mode 100644 index 000000000..01cb63a8c --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/moho.dat @@ -0,0 +1,4 @@ +-35000.0 +-35000.0 +-35000.0 +-35000.0 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/top.dat b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/top.dat new file mode 100644 index 000000000..68ea011c5 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/top.dat @@ -0,0 +1,4 @@ +0.0 +0.0 +0.0 +0.0 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/fk_model b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/fk_model new file mode 100644 index 000000000..7520f3074 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/fk_model @@ -0,0 +1,14 @@ +NLAYER 2 +LAYER 1 2600.0 5800.0 3198.0 0.0 +LAYER 2 3380.0 8080.0 4485.0 -35000.0 +INCIDENT_WAVE P +BACK_AZIMUTH 270.0 +TAKE_OFF 15.0 +ORIGIN_WAVEFRONT 0.0 25000.0 -75000.0 +ORIGIN_TIME 0.0 +NSTEP 3000 +deltat 0.02 +FREQUENCY_MAX 1.0 +FREQUENCY_SAMPLING 32.0 +TIME_WINDOW 400.0 +AMPLITUDE 1.0 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py new file mode 100644 index 000000000..0f7955efc --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py @@ -0,0 +1,53 @@ +import sys +sys.path.insert(1, '../plot') +from plot_utils_injection import WaveformSection +import matplotlib.pyplot as plt +import os + +Tmin = 1.5 +Tmax = 50.0 + +fig = plt.figure(figsize=(12, 9)) + +wave_dir = '../injection_test_crust/OUTPUT_FILES' + +sta_list = [f'TS{i:02d}' for i in range(1,5)] + +fn_list = [os.path.join(wave_dir, 'TS.'+sta+'.Z.fkd') for sta in sta_list] + +sec_fk = WaveformSection() + +sec_fk.get_waveforms_from_specfem(fn_list=fn_list, fn_stations=os.path.join(wave_dir, 'STATIONS')) + + +wave_dir = '../injection_test_crust/OUTPUT_FILES' + +sta_list = [f'TS{i:02d}' for i in range(1,5)] + +fn_list = [os.path.join(wave_dir, 'TS.'+sta+'.BXZ.semd') for sta in sta_list] + +sec = WaveformSection() + +sec.get_waveforms_from_specfem(fn_list=fn_list, fn_stations=os.path.join(wave_dir, 'STATIONS')) + +sec_fk.filter((-1.0, 1.0/Tmin)) +sec.filter((-1.0, 1.0/Tmin)) + +sec_diff = sec - sec_fk + +offset = sec_fk.get_first_arrival_time() +print(offset) + +print(sec_fk.difference_ratio(sec, offset=offset, time_range=(-10.0, 40.0))) +sec.plot_waveforms_fill('k', fig_num=fig.number, normalize=10.0, offset=offset, time_range=(-10.0, 40.0), fill=False, label="injection", linewidth=2) +sec_diff.plot_waveforms_fill('r--', fig_num=fig.number, normalize=100.0, offset=offset, norm_with=sec_fk, time_range=(-10.0, 40.0), fill=False, label="(injection-FK)X10", linewidth=2) +plt.ylim([-10.0, 40.0]) +plt.xlim([0.0, 50.0]) +plt.legend(prop={'size':20}, loc=4) +plt.xlabel('x (km)', fontsize=20) +plt.ylabel('t (s)', fontsize=20) +plt.gca().invert_yaxis() +plt.gca().tick_params(labelsize=20) +#plt.text(-30.0, -10.0, '(a)', fontsize=20) +plt.show() +#plt.savefig("crust_Z.pdf") diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh new file mode 100755 index 000000000..a9df98db9 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh @@ -0,0 +1,79 @@ +#!/bin/bash +module load intel/2020u4 intelmpi/2020u4 +NPROC=4 +echo "running example: `date`" +currentdir=`pwd` +specfem_dir=~/specfem3d +# sets up directory structure in current example directory +echo +echo " setting up example..." +echo + +BASEMPIDIR=`grep ^LOCAL_PATH DATA/Par_file | cut -d = -f 2 ` +mkdir -p $BASEMPIDIR + +# cleans output files +mkdir -p OUTPUT_FILES +mkdir -p DATABASES_MPI +mkdir -p MESH/ +rm -rf OUTPUT_FILES/* +rm -rf DATABASES_MPI/* + +# links executables +mkdir -p bin +cd bin/ +rm -f * +ln -s ${specfem_dir}/bin/xmeshfem3D +ln -s ${specfem_dir}/bin/xdecompose_mesh +ln -s ${specfem_dir}/bin/xgenerate_databases +#ln -s ${specfem_dir}/bin/xcombine_vol_data_vtk +ln -s ${specfem_dir}/bin/xspecfem3D +cd ../ + +# stores setup +cp DATA/meshfem3D_files/Mesh_Par_file OUTPUT_FILES/ +cp DATA/Par_file OUTPUT_FILES/ +cp DATA/CMTSOLUTION OUTPUT_FILES/ +cp DATA/STATIONS OUTPUT_FILES/ + +sed -i "/^NPROC/c\NPROC = 1" DATA/Par_file +# This is a serial simulation +echo +echo " running mesher..." +echo +./bin/xmeshfem3D + +mkdir -p MESH-default +cp -f MESH/* MESH-default +#cp -f MESH-default/wavefield_discontinuity_boundary . +#cp -f nummaterial_velocity_file MESH-default + +sed -i "/^NPROC/c\NPROC = ${NPROC}" DATA/Par_file + +# decomposes mesh using the pre-saved mesh files in MESH-default +echo +echo " decomposing mesh..." +echo +./bin/xdecompose_mesh $NPROC ./MESH-default $BASEMPIDIR + +# generate solver database +echo +echo " generate databases..." +echo +mpirun -np $NPROC ./bin/xgenerate_databases + +# generate injection wavefield +mpirun -np $NPROC ../fk_coupling/compute_fk_injection_field + +# launch solver +echo +echo " launch solver..." +echo +mpirun -np $NPROC ./bin/xspecfem3D + +# compute reference seismograms using FK +../fk_coupling/compute_fk_receiver + +# checks exit code +if [[ $? -ne 0 ]]; then exit 1; fi + diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/wavefield_discontinuity_box b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/wavefield_discontinuity_box new file mode 100644 index 000000000..bae672e44 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/wavefield_discontinuity_box @@ -0,0 +1,8 @@ +.false. # IS_TOP_WAVEFIELD_DISCONTINUITY +.false. # IS_EXTRAPOLATION_MODE +0.0 # x_min +50000.0 # x_max +0.0 # y_min +50000.0 # y_max +-50000.0 # z_min +0.0 # z_max From 876d4f3864bcd78f991f76e72183db0b56cfadbb Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Mon, 24 Jun 2024 17:23:40 -0400 Subject: [PATCH 32/56] setup a small wavefield injection example using wavefield discontinuity --- .../wavefield_discontinuity/README.md | 10 +++ .../DATA/meshfem3D_files/Mesh_Par_file | 4 +- .../test_small_injection/plot_seismograms.py | 4 +- .../test_small_injection/run_this_example.sh | 67 +++++++++++++------ 4 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 EXAMPLES/applications/wavefield_discontinuity/README.md diff --git a/EXAMPLES/applications/wavefield_discontinuity/README.md b/EXAMPLES/applications/wavefield_discontinuity/README.md new file mode 100644 index 000000000..0e4a38196 --- /dev/null +++ b/EXAMPLES/applications/wavefield_discontinuity/README.md @@ -0,0 +1,10 @@ +## Examples for wavefield injection + +**Step 1:** configure and compile SPECFEM + +**Step 2:** compile FK simulator +`cd fk_coupling; bash make_fk_injection.sh` + +**Step 3:** go inside an example directory, see a self-explanatory script `run_this_example.sh` + +**Step 4:** after running the program, plot the waveforms using `python plot_seismograms.py` diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file index f08c911b0..2610f25ff 100644 --- a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/DATA/meshfem3D_files/Mesh_Par_file @@ -99,5 +99,5 @@ NMATERIALS = 2 NREGIONS = 2 # define the different regions of the model as : #NEX_XI_BEGIN #NEX_XI_END #NEX_ETA_BEGIN #NEX_ETA_END #NZ_BEGIN #NZ_END #material_id -1 28 1 28 1 14 1 -1 28 1 28 15 24 2 +1 28 1 28 1 10 1 +1 28 1 28 11 24 2 diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py index 0f7955efc..cd565d847 100644 --- a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/plot_seismograms.py @@ -9,7 +9,7 @@ fig = plt.figure(figsize=(12, 9)) -wave_dir = '../injection_test_crust/OUTPUT_FILES' +wave_dir = 'OUTPUT_FILES' sta_list = [f'TS{i:02d}' for i in range(1,5)] @@ -20,7 +20,7 @@ sec_fk.get_waveforms_from_specfem(fn_list=fn_list, fn_stations=os.path.join(wave_dir, 'STATIONS')) -wave_dir = '../injection_test_crust/OUTPUT_FILES' +wave_dir = 'OUTPUT_FILES' sta_list = [f'TS{i:02d}' for i in range(1,5)] diff --git a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh index a9df98db9..9415f7134 100755 --- a/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh +++ b/EXAMPLES/applications/wavefield_discontinuity/test_small_injection/run_this_example.sh @@ -1,23 +1,27 @@ #!/bin/bash + +## load all necessary modules here module load intel/2020u4 intelmpi/2020u4 + +## set number of processors NPROC=4 -echo "running example: `date`" + currentdir=`pwd` + +## set the path to SPECFEM here specfem_dir=~/specfem3d -# sets up directory structure in current example directory + + echo -echo " setting up example..." +echo " running a small example for wavefield injection" echo -BASEMPIDIR=`grep ^LOCAL_PATH DATA/Par_file | cut -d = -f 2 ` -mkdir -p $BASEMPIDIR -# cleans output files -mkdir -p OUTPUT_FILES -mkdir -p DATABASES_MPI -mkdir -p MESH/ +BASEMPIDIR=`grep ^LOCAL_PATH DATA/Par_file | cut -d = -f 2 ` +mkdir -p OUTPUT_FILES/ rm -rf OUTPUT_FILES/* -rm -rf DATABASES_MPI/* +mkdir -p $BASEMPIDIR +rm -rf $BASEMPIDIR/* # links executables mkdir -p bin @@ -33,39 +37,64 @@ cd ../ # stores setup cp DATA/meshfem3D_files/Mesh_Par_file OUTPUT_FILES/ cp DATA/Par_file OUTPUT_FILES/ -cp DATA/CMTSOLUTION OUTPUT_FILES/ +cp DATA/FORCESOLUTION OUTPUT_FILES/ cp DATA/STATIONS OUTPUT_FILES/ +# prepare to run the mesher +# at this point the meshfem3D files must be well-prepared, +# the Par_file should be set properly to turn on IS_WAVEFIELD_DISCONTINUITY, +# an empty FORCESOLUTION file should be present to indicate +# there is no external source, +# and a wavefield_discontinuity_box file to designate the interface +mkdir -p MESH/ + +###################################################################### +## running meshfem3D, here I adopt a strategy that first run meshfem3D +## in seriel, output the mesh in CUBIT format, and then decompose +## the mesh with decompose_mesh sed -i "/^NPROC/c\NPROC = 1" DATA/Par_file -# This is a serial simulation +sed -i "/^NPROC_XI/c\NPROC_XI = 1" DATA/meshfem3D_files/Mesh_Par_file +sed -i "/^NPROC_ETA/c\NPROC_ETA = 1" DATA/meshfem3D_files/Mesh_Par_file +sed -i "/^SAVE_MESH_AS_CUBIT/c\SAVE_MESH_AS_CUBIT = .true." DATA/meshfem3D_files/Mesh_Par_file + echo -echo " running mesher..." +echo " running mesher in seriel..." echo ./bin/xmeshfem3D mkdir -p MESH-default cp -f MESH/* MESH-default -#cp -f MESH-default/wavefield_discontinuity_boundary . -#cp -f nummaterial_velocity_file MESH-default sed -i "/^NPROC/c\NPROC = ${NPROC}" DATA/Par_file -# decomposes mesh using the pre-saved mesh files in MESH-default echo echo " decomposing mesh..." echo ./bin/xdecompose_mesh $NPROC ./MESH-default $BASEMPIDIR -# generate solver database +###################################################################### +## note that this can be replaced by directly running meshfem3D +## in parallel +#sed -i "/^NPROC/c\NPROC = ${NPROC}" DATA/Par_file +#sed -i "/^NPROC_XI/c\NPROC_XI = 2" DATA/meshfem3D_files/Mesh_Par_file +#sed -i "/^NPROC_ETA/c\NPROC_ETA = 2" DATA/meshfem3D_files/Mesh_Par_file +#sed -i "/^SAVE_MESH_AS_CUBIT/c\SAVE_MESH_AS_CUBIT = .false." DATA/meshfem3D_files/Mesh_Par_file +# +#echo +#echo " running mesher in parallel..." +#echo +#mpirun -np ${NPROC} ./bin/xmeshfem3D +######################################################################## + echo echo " generate databases..." echo mpirun -np $NPROC ./bin/xgenerate_databases -# generate injection wavefield +# generate injection wavefield by producing +# DATABASES_MPI/proc*_wavefield_discontinuity.bin files mpirun -np $NPROC ../fk_coupling/compute_fk_injection_field -# launch solver echo echo " launch solver..." echo From 621a4e89e045278a0a3507ab15cd1b1069563d31 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 27 Jun 2024 09:11:11 -0400 Subject: [PATCH 33/56] fix the symbolic links in DATA/ --- DATA/CMTSOLUTION | 14 +- DATA/Par_file | 406 +---------------------------------------------- DATA/STATIONS | 5 +- 3 files changed, 3 insertions(+), 422 deletions(-) mode change 100644 => 120000 DATA/CMTSOLUTION mode change 100644 => 120000 DATA/Par_file mode change 100644 => 120000 DATA/STATIONS diff --git a/DATA/CMTSOLUTION b/DATA/CMTSOLUTION deleted file mode 100644 index 3d78a2e2f..000000000 --- a/DATA/CMTSOLUTION +++ /dev/null @@ -1,13 +0,0 @@ -PDE 1999 01 01 00 00 00.00 67000 67000 -25000 4.2 4.2 homog_test -event name: homog_test -time shift: 0.0000 -half duration: 5.0 -latorUTM: 67000.0 -longorUTM: 67000.0 -depth: 30.0 -Mrr: -7.600000e+27 -Mtt: 7.700000e+27 -Mpp: -2.000000e+26 -Mrt: -2.500000e+28 -Mrp: 4.000000e+26 -Mtp: -2.500000e+27 diff --git a/DATA/CMTSOLUTION b/DATA/CMTSOLUTION new file mode 120000 index 000000000..6bbf21120 --- /dev/null +++ b/DATA/CMTSOLUTION @@ -0,0 +1 @@ +../EXAMPLES/applications/homogeneous_halfspace/DATA/CMTSOLUTION \ No newline at end of file diff --git a/DATA/Par_file b/DATA/Par_file deleted file mode 100644 index 17a57c82c..000000000 --- a/DATA/Par_file +++ /dev/null @@ -1,405 +0,0 @@ -#----------------------------------------------------------- -# -# Simulation input parameters -# -#----------------------------------------------------------- - -# forward or adjoint simulation -# 1 = forward, 2 = adjoint, 3 = both simultaneously -SIMULATION_TYPE = 1 -# 0 = earthquake simulation, 1/2/3 = three steps in noise simulation -NOISE_TOMOGRAPHY = 0 -SAVE_FORWARD = .false. - -# solve a full FWI inverse problem from a single calling program with no I/Os, storing everything in memory, -# or run a classical forward or adjoint problem only and save the seismograms and/or sensitivity kernels to disk (with costlier I/Os) -INVERSE_FWI_FULL_PROBLEM = .false. - -# UTM projection parameters -# Use a negative zone number for the Southern hemisphere: -# The Northern hemisphere corresponds to zones +1 to +60, -# The Southern hemisphere corresponds to zones -1 to -60. -UTM_PROJECTION_ZONE = 11 -SUPPRESS_UTM_PROJECTION = .true. - -# number of MPI processors -NPROC = 4 - -# time step parameters -NSTEP = 5000 -DT = 0.05 - -# set to true to use local-time stepping (LTS) -LTS_MODE = .false. - -# Partitioning algorithm for decompose_mesh -# choose partitioner: 1==SCOTCH (default), 2==METIS, 3==PATOH, 4==ROWS_PART -PARTITIONING_TYPE = 1 - -#----------------------------------------------------------- -# -# LDDRK time scheme -# -#----------------------------------------------------------- -USE_LDDRK = .false. -INCREASE_CFL_FOR_LDDRK = .false. -RATIO_BY_WHICH_TO_INCREASE_IT = 1.4 - -#----------------------------------------------------------- -# -# Mesh -# -#----------------------------------------------------------- - -# Number of nodes for 2D and 3D shape functions for hexahedra. -# We use either 8-node mesh elements (bricks) or 27-node elements. -# If you use our internal mesher, the only option is 8-node bricks (27-node elements are not supported). -NGNOD = 8 - -# models: -# available options are: -# default (model parameters described by mesh properties) -# 1D models available are: -# 1d_prem,1d_socal,1d_cascadia -# 3D models available are: -# aniso,external,gll,salton_trough,tomo,SEP,coupled,... -MODEL = default - -# path for external tomographic models files -TOMOGRAPHY_PATH = DATA/tomo_files/ -# if you are using a SEP model (oil-industry format) -SEP_MODEL_DIRECTORY = DATA/my_SEP_model/ - -#----------------------------------------------------------- - -# parameters describing the model -APPROXIMATE_OCEAN_LOAD = .false. -TOPOGRAPHY = .false. -ATTENUATION = .false. -ANISOTROPY = .false. -GRAVITY = .false. - -# in case of attenuation, reference frequency in Hz at which the velocity values in the velocity model are given (unused otherwise) -ATTENUATION_f0_REFERENCE = 18.d0 - -# attenuation period range over which we try to mimic a constant Q factor -MIN_ATTENUATION_PERIOD = 999999998.d0 -MAX_ATTENUATION_PERIOD = 999999999.d0 -# ignore this range and ask the code to compute it automatically instead based on the estimated resolution of the mesh (use this unless you know what you are doing) -COMPUTE_FREQ_BAND_AUTOMATIC = .true. - -# Olsen's constant for Q_mu = constant * V_s attenuation rule -USE_OLSEN_ATTENUATION = .false. -OLSEN_ATTENUATION_RATIO = 0.05 - -#----------------------------------------------------------- -# -# Absorbing boundary conditions -# -#----------------------------------------------------------- - -# C-PML boundary conditions for a regional simulation -# (if set to .false., and STACEY_ABSORBING_CONDITIONS is also set to .false., you get a free surface instead -# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements -PML_CONDITIONS = .false. - -# C-PML top surface -PML_INSTEAD_OF_FREE_SURFACE = .false. - -# C-PML dominant frequency -f0_FOR_PML = 0.05555 - -# parameters used to rotate C-PML boundary conditions by a given angle (not completed yet) -# ROTATE_PML_ACTIVATE = .false. -# ROTATE_PML_ANGLE = 0. - -# absorbing boundary conditions for a regional simulation -# (if set to .false., and PML_CONDITIONS is also set to .false., you get a free surface instead -# in the case of elastic or viscoelastic mesh elements, and a rigid surface in the case of acoustic (fluid) elements -STACEY_ABSORBING_CONDITIONS = .true. - -# absorbing top surface (defined in mesh as 'free_surface_file') -STACEY_INSTEAD_OF_FREE_SURFACE = .false. - -# When STACEY_ABSORBING_CONDITIONS is set to .true. : -# absorbing conditions are defined in xmin, xmax, ymin, ymax and zmin -# this option BOTTOM_FREE_SURFACE can be set to .true. to -# make zmin free surface instead of absorbing condition -BOTTOM_FREE_SURFACE = .false. - -#----------------------------------------------------------- -# -# undoing attenuation and/or PMLs for sensitivity kernel calculations -# -#----------------------------------------------------------- - -# to undo attenuation and/or PMLs for sensitivity kernel calculations or forward runs with SAVE_FORWARD -# use the flag below. It performs undoing of attenuation and/or of PMLs in an exact way for sensitivity kernel calculations -# but requires disk space for temporary storage, and uses a significant amount of memory used as buffers for temporary storage. -# When that option is on the second parameter indicates how often the code dumps restart files to disk (if in doubt, use something between 100 and 1000). -UNDO_ATTENUATION_AND_OR_PML = .false. -NT_DUMP_ATTENUATION = 500 - -#----------------------------------------------------------- -# -# Visualization -# -#----------------------------------------------------------- - -# save AVS or OpenDX movies -# MOVIE_TYPE = 1 to show the top surface -# MOVIE_TYPE = 2 to show all the external faces of the mesh -CREATE_SHAKEMAP = .false. -MOVIE_SURFACE = .false. -MOVIE_TYPE = 1 -MOVIE_VOLUME = .false. -SAVE_DISPLACEMENT = .false. -MOVIE_VOLUME_STRESS = .false. -USE_HIGHRES_FOR_MOVIES = .false. -NTSTEP_BETWEEN_FRAMES = 200 -HDUR_MOVIE = 0.0 - -# save AVS or OpenDX mesh files to check the mesh -SAVE_MESH_FILES = .true. - -# path to store the local database file on each node -LOCAL_PATH = OUTPUT_FILES/DATABASES_MPI - -# interval at which we output time step info and max of norm of displacement -NTSTEP_BETWEEN_OUTPUT_INFO = 500 - -#----------------------------------------------------------- -# -# Sources -# -#----------------------------------------------------------- - -# sources and receivers Z coordinates given directly (i.e. as their true position) instead of as their depth -USE_SOURCES_RECEIVERS_Z = .false. - -# use a (tilted) FORCESOLUTION force point source (or several) instead of a CMTSOLUTION moment-tensor source. -# This can be useful e.g. for oil industry foothills simulations or asteroid simulations -# in which the source is a vertical force, normal force, tilted force, impact etc. -# If this flag is turned on, the FORCESOLUTION file must be edited by giving: -# - the corresponding time-shift parameter, -# - the half duration (hdur, in s) for Gaussian/Step function, dominant frequency (f0, in Hz) for Ricker, -# - the coordinates of the source, -# - the source time function type (0=Gaussian function, 1=Ricker wavelet, 2=Step function), -# - the magnitude of the force source, -# - the components of a (non necessarily unitary) direction vector for the force source in the E/N/Z_UP basis. -# The direction vector is made unitary internally in the code and thus only its direction matters here; -# its norm is ignored and the norm of the force used is the factor force source times the source time function. -USE_FORCE_POINT_SOURCE = .false. - -# set to true to use a Ricker source time function instead of the source time functions set by default -# to represent a (tilted) FORCESOLUTION force point source or a CMTSOLUTION moment-tensor source. -USE_RICKER_TIME_FUNCTION = .false. - -# use an external source time function -# you must add a file with your source time function and the file name path -# relative to working directory at the end of CMTSOLUTION or FORCESOLUTION file -# (with multiple sources, one file per source is required). -# This file must have a single column containing the amplitudes of the source at all time steps; -# time step size used must be equal to DT as defined at the beginning of this Par_file. -# Be sure when this option is .false. to remove the name of stf file in CMTSOLUTION or FORCESOLUTION -USE_EXTERNAL_SOURCE_FILE = .false. - -# print source time function -PRINT_SOURCE_TIME_FUNCTION = .false. - -# source encoding -# (for acoustic simulations only for now) determines source encoding factor +/-1 depending on sign of moment tensor -# (see e.g. Krebs et al., 2009. Fast full-wavefield seismic inversion using encoded sources, Geophysics, 74 (6), WCC177-WCC188.) -USE_SOURCE_ENCODING = .false. - -#----------------------------------------------------------- -# -# Seismograms -# -#----------------------------------------------------------- - -# interval in time steps for writing of seismograms -NTSTEP_BETWEEN_OUTPUT_SEISMOS = 10000 - -# set to n to reduce the sampling rate of output seismograms by a factor of n -# defaults to 1, which means no down-sampling -NTSTEP_BETWEEN_OUTPUT_SAMPLE = 1 - -# decide if we save displacement, velocity, acceleration and/or pressure in forward runs (they can be set to true simultaneously) -# currently pressure seismograms are implemented in acoustic (i.e. fluid) elements only -SAVE_SEISMOGRAMS_DISPLACEMENT = .true. -SAVE_SEISMOGRAMS_VELOCITY = .false. -SAVE_SEISMOGRAMS_ACCELERATION = .false. -SAVE_SEISMOGRAMS_PRESSURE = .false. # currently implemented in acoustic (i.e. fluid) elements only - -# option to save strain seismograms -# this option is useful for strain Green's tensor -SAVE_SEISMOGRAMS_STRAIN = .false. - -# save seismograms also when running the adjoint runs for an inverse problem -# (usually they are unused and not very meaningful, leave this off in almost all cases) -SAVE_SEISMOGRAMS_IN_ADJOINT_RUN = .true. - -# save seismograms in binary or ASCII format (binary is smaller but may not be portable between machines) -USE_BINARY_FOR_SEISMOGRAMS = .false. - -# output seismograms in Seismic Unix format (binary with 240-byte-headers) -SU_FORMAT = .false. - -# output seismograms in ASDF (requires asdf-library) -ASDF_FORMAT = .false. - -# output seismograms in HDF5 (requires hdf5-library and WRITE_SEISMOGRAMS_BY_MAIN) -HDF5_FORMAT = .false. - -# decide if main process writes all the seismograms or if all processes do it in parallel -WRITE_SEISMOGRAMS_BY_MAIN = .false. - -# save all seismograms in one large combined file instead of one file per seismogram -# to avoid overloading shared non-local file systems such as LUSTRE or GPFS for instance -SAVE_ALL_SEISMOS_IN_ONE_FILE = .false. - -# use a trick to increase accuracy of pressure seismograms in fluid (acoustic) elements: -# use the second derivative of the source for the source time function instead of the source itself, -# and then record -potential_acoustic() as pressure seismograms instead of -potential_dot_dot_acoustic(); -# this is mathematically equivalent, but numerically significantly more accurate because in the explicit -# Newmark time scheme acceleration is accurate at zeroth order while displacement is accurate at second order, -# thus in fluid elements potential_dot_dot_acoustic() is accurate at zeroth order while potential_acoustic() -# is accurate at second order and thus contains significantly less numerical noise. -USE_TRICK_FOR_BETTER_PRESSURE = .false. - -#----------------------------------------------------------- -# -# Energy calculation -# -#----------------------------------------------------------- - -# to plot energy curves, for instance to monitor how CPML absorbing layers behave; -# should be turned OFF in most cases because a bit expensive -OUTPUT_ENERGY = .false. -# every how many time steps we compute energy (which is a bit expensive to compute) -NTSTEP_BETWEEN_OUTPUT_ENERGY = 10 - -#----------------------------------------------------------- -# -# Adjoint kernel outputs -# -#----------------------------------------------------------- - -# interval in time steps for reading adjoint traces -# 0 = read the whole adjoint sources at start time -NTSTEP_BETWEEN_READ_ADJSRC = 0 - -# read adjoint sources using ASDF (requires asdf-library) -READ_ADJSRC_ASDF = .false. - -# this parameter must be set to .true. to compute anisotropic kernels -# in crust and mantle (related to the 21 Cij in geographical coordinates) -# default is .false. to compute isotropic kernels (related to alpha and beta) -ANISOTROPIC_KL = .false. - -# compute transverse isotropic kernels (alpha_v,alpha_h,beta_v,beta_h,eta,rho) -# rather than fully anisotropic kernels in case ANISOTROPIC_KL is set to .true. -SAVE_TRANSVERSE_KL = .false. - -# this parameter must be set to .true. to compute anisotropic kernels for -# cost function using velocity observable rather than displacement -ANISOTROPIC_VELOCITY_KL = .false. - -# outputs approximate Hessian for preconditioning -APPROXIMATE_HESS_KL = .false. - -# save Moho mesh and compute Moho boundary kernels -SAVE_MOHO_MESH = .false. - -#----------------------------------------------------------- -# -# Coupling with an injection technique (DSM, AxiSEM, or FK) -# -#----------------------------------------------------------- -COUPLE_WITH_INJECTION_TECHNIQUE = .false. -INJECTION_TECHNIQUE_TYPE = 3 # 1 = DSM, 2 = AxiSEM, 3 = FK -MESH_A_CHUNK_OF_THE_EARTH = .false. -TRACTION_PATH = DATA/AxiSEM_tractions/3/ -FKMODEL_FILE = FKmodel -RECIPROCITY_AND_KH_INTEGRAL = .false. # does not work yet - -#----------------------------------------------------------- -## -## Prescribed wavefield discontinuity on an interface -## -##----------------------------------------------------------- -IS_WAVEFIELD_DISCONTINUITY = .false. - -#----------------------------------------------------------- -# -# Run modes -# -#----------------------------------------------------------- - -# Simultaneous runs -# added the ability to run several calculations (several earthquakes) -# in an embarrassingly-parallel fashion from within the same run; -# this can be useful when using a very large supercomputer to compute -# many earthquakes in a catalog, in which case it can be better from -# a batch job submission point of view to start fewer and much larger jobs, -# each of them computing several earthquakes in parallel. -# To turn that option on, set parameter NUMBER_OF_SIMULTANEOUS_RUNS to a value greater than 1. -# To implement that, we create NUMBER_OF_SIMULTANEOUS_RUNS MPI sub-communicators, -# each of them being labeled "my_local_mpi_comm_world", and we use them -# in all the routines in "src/shared/parallel.f90", except in MPI_ABORT() because in that case -# we need to kill the entire run. -# When that option is on, of course the number of processor cores used to start -# the code in the batch system must be a multiple of NUMBER_OF_SIMULTANEOUS_RUNS, -# all the individual runs must use the same number of processor cores, -# which as usual is NPROC in the Par_file, -# and thus the total number of processor cores to request from the batch system -# should be NUMBER_OF_SIMULTANEOUS_RUNS * NPROC. -# All the runs to perform must be placed in directories called run0001, run0002, run0003 and so on -# (with exactly four digits). -# -# Imagine you have 10 independent calculations to do, each of them on 100 cores; you have three options: -# -# 1/ submit 10 jobs to the batch system -# -# 2/ submit a single job on 1000 cores to the batch, and in that script create a sub-array of jobs to start 10 jobs, -# each running on 100 cores (see e.g. http://www.schedmd.com/slurmdocs/job_array.html ) -# -# 3/ submit a single job on 1000 cores to the batch, start SPECFEM3D on 1000 cores, create 10 sub-communicators, -# cd into one of 10 subdirectories (called e.g. run0001, run0002,... run0010) depending on the sub-communicator -# your MPI rank belongs to, and run normally on 100 cores using that sub-communicator. -# -# The option below implements 3/. -# -NUMBER_OF_SIMULTANEOUS_RUNS = 1 - -# if we perform simultaneous runs in parallel, if only the source and receivers vary between these runs -# but not the mesh nor the model (velocity and density) then we can also read the mesh and model files -# from a single run in the beginning and broadcast them to all the others; for a large number of simultaneous -# runs for instance when solving inverse problems iteratively this can DRASTICALLY reduce I/Os to disk in the solver -# (by a factor equal to NUMBER_OF_SIMULTANEOUS_RUNS), and reducing I/Os is crucial in the case of huge runs. -# Thus, always set this option to .true. if the mesh and the model are the same for all simultaneous runs. -# In that case there is no need to duplicate the mesh and model file database (the content of the DATABASES_MPI -# directories) in each of the run0001, run0002,... directories, it is sufficient to have one in run0001 -# and the code will broadcast it to the others) -BROADCAST_SAME_MESH_AND_MODEL = .true. - -#----------------------------------------------------------- - -# set to true to use GPUs -GPU_MODE = .false. - -# ADIOS Options for I/Os -ADIOS_ENABLED = .false. -ADIOS_FOR_DATABASES = .false. -ADIOS_FOR_MESH = .false. -ADIOS_FOR_FORWARD_ARRAYS = .false. -ADIOS_FOR_KERNELS = .false. -ADIOS_FOR_UNDO_ATTENUATION = .false. - -# HDF5 Database I/O -# (note the flags for HDF5 and ADIOS are mutually exclusive, only one can be used) -HDF5_ENABLED = .false. -HDF5_FOR_MOVIES = .false. -HDF5_IO_NODES = 0 # HDF5 IO server with number of IO dedicated procs - diff --git a/DATA/Par_file b/DATA/Par_file new file mode 120000 index 000000000..9b1a3472b --- /dev/null +++ b/DATA/Par_file @@ -0,0 +1 @@ +../EXAMPLES/applications/homogeneous_halfspace/DATA/Par_file \ No newline at end of file diff --git a/DATA/STATIONS b/DATA/STATIONS deleted file mode 100644 index 1ee47ff70..000000000 --- a/DATA/STATIONS +++ /dev/null @@ -1,4 +0,0 @@ -X20 DB 67000.00 22732.14 0.0 0.0 -X30 DB 67000.00 34696.43 0.0 0.0 -X40 DB 67000.00 46660.71 0.0 0.0 -X50 DB 67000.00 58625.00 0.0 0.0 diff --git a/DATA/STATIONS b/DATA/STATIONS new file mode 120000 index 000000000..7c5e8b5d6 --- /dev/null +++ b/DATA/STATIONS @@ -0,0 +1 @@ +../EXAMPLES/applications/homogeneous_halfspace/DATA/STATIONS \ No newline at end of file From cada5cdc1eb2cadc4b4fd5bed19653eaaa2143ee Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 27 Jun 2024 09:37:28 -0400 Subject: [PATCH 34/56] add IS_WAVEFIELD_DISCONTINUITY to OMP SHARED section --- src/specfem3D/compute_forces_viscoelastic.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/specfem3D/compute_forces_viscoelastic.F90 b/src/specfem3D/compute_forces_viscoelastic.F90 index 2817d6c28..64bec1141 100644 --- a/src/specfem3D/compute_forces_viscoelastic.F90 +++ b/src/specfem3D/compute_forces_viscoelastic.F90 @@ -200,6 +200,7 @@ subroutine compute_forces_viscoelastic(iphase,deltat, & !$OMP irregular_element_number,jacobian_regular,xix_regular, & !$OMP displ,veloc,accel, & !$OMP is_CPML,backward_simulation, & +!$OMP IS_WAVEFIELD_DISCONTINUITY, & !$OMP xixstore,xiystore,xizstore,etaxstore,etaystore,etazstore,gammaxstore,gammaystore,gammazstore,jacobianstore, & !$OMP kappastore,mustore, & !$OMP Kelvin_Voigt_eta,USE_KELVIN_VOIGT_DAMPING, & From b3611fcfd1d3e0e617532ab3f162b85192678a52 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Fri, 5 Jul 2024 15:17:37 +0200 Subject: [PATCH 35/56] fixes output comment --- src/generate_databases/save_arrays_solver.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generate_databases/save_arrays_solver.F90 b/src/generate_databases/save_arrays_solver.F90 index 59cde021b..5fee37dc5 100644 --- a/src/generate_databases/save_arrays_solver.F90 +++ b/src/generate_databases/save_arrays_solver.F90 @@ -110,6 +110,7 @@ subroutine save_arrays_solver_mesh() if (myrank == 0) then write(IMAIN,*) ' using binary file format' write(IMAIN,*) ' database file (for rank 0): ',trim(filename) + write(IMAIN,*) call flush_IMAIN() endif @@ -585,7 +586,7 @@ subroutine save_arrays_solver_files() ! user output call synchronize_all() if (myrank == 0) then - write(IMAIN,*) ' saving additonal mesh files with surface/coupling points' + write(IMAIN,*) ' saving additional mesh files with surface/coupling points' call flush_IMAIN() endif From 6fd1993f9f4b52f17615bb69cf088a4833cdcf1a Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 8 Jul 2024 16:39:44 +0200 Subject: [PATCH 36/56] updates script cubit2specfem3d.py (fixes issue w/ optional surfaces and output of free/topo surface file) --- CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py | 96 +++++++++---------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py b/CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py index 263617f76..5ea4b34cf 100755 --- a/CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py +++ b/CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py @@ -652,14 +652,16 @@ def block_definition(self): self.bc = bc print('HEX Blocks:') for m, f in zip(self.block_mat, self.block_flag): - print('block ', m, 'material flag ', f) + print(' block ', m, 'material flag ', f) print('Absorbing Boundary Conditions:') for m, f in zip(self.block_bc, self.block_bc_flag): - print('bc ', m, 'bc flag ', f) - print('Topography (free surface)') - print(self.topography) - print('Free surface') - print(self.free) + print(' bc ', m, 'bc flag ', f) + if self.topography: + print('Topography (free surface):') + print(' ',self.topography) + if self.free: + print('Free surface:') + print(' ',self.free) except: print('****************************************') print('sorry, no blocks or blocks not properly defined') @@ -765,7 +767,7 @@ def mat_parameter(self, properties): else: raise RuntimeError('Error: material id must be strictly positive or negative, but not equal to 0') # info output - print("material: ",txt) + print(" material: ",txt) return txt def nummaterial_write(self, nummaterial_name, placeholder=True): @@ -853,8 +855,7 @@ def create_hexnode_string(self, hexa, hexnode_string=True): else: map(int, txt.split()) - def create_facenode_string(self, hexa, face, normal=None, cknormal=True, - facenode_string=True): + def create_facenode_string(self, hexa, face, normal=None, cknormal=True, facenode_string=True): nodes = self.get_face_connectivity(face) if cknormal: nodes_ok = self.normal_check(nodes[0:4], normal) @@ -886,7 +887,7 @@ def mesh_write(self, mesh_name): meshfile.write(str(num_elems) + '\n') for block, flag in zip(self.block_mat, self.block_flag): hexes = cubit.get_block_hexes(block) - print('block ', block, ' hexes ', len(hexes)) + print(' block ', block, ' hexes ', len(hexes)) for hexa in hexes: txt = self.create_hexnode_string(hexa) meshfile.write(txt) @@ -897,7 +898,7 @@ def material_write(self, mat_name): mat = open(mat_name, 'w') print('Writing ' + mat_name + '.....') for block, flag in zip(self.block_mat, self.block_flag): - print('block ', block, 'flag ', flag) + print(' block ', block, 'flag ', flag) hexes = cubit.get_block_hexes(block) for hexa in hexes: mat.write(('%10i %10i\n') % (hexa, flag)) @@ -949,8 +950,7 @@ def free_write(self, freename=None): for block, flag in zip(self.block_bc, self.block_bc_flag): if block == self.topography: name = cubit.get_exodus_entity_name('block', block) - print('free surface (topography) block name:', \ - name, 'id:', block) + print(' free surface (topography): block name:', name, 'id:', block) quads_all = cubit.get_block_faces(block) print(' number of faces = ', len(quads_all)) dic_quads_all = dict(zip(quads_all, quads_all)) @@ -968,13 +968,13 @@ def free_write(self, freename=None): faces = cubit.get_sub_elements('hex', h, 2) for f in faces: if f in s: - txt = self.create_facenode_string( - h, f, normal, cknormal=True) + # topography surface: checks face orientation against vertical normal (0,0,1) + txt = self.create_facenode_string(h, f, normal, cknormal=True) freehex.write(txt) print(' 100 %') elif block == self.free: name = cubit.get_exodus_entity_name('block', block) - print('free surface block name:', name, 'id:', block) + print(' free surface: block name:', name, 'id:', block) quads_all = cubit.get_block_faces(block) print(' number of faces = ', len(quads_all)) dic_quads_all = dict(zip(quads_all, quads_all)) @@ -992,8 +992,8 @@ def free_write(self, freename=None): faces = cubit.get_sub_elements('hex', h, 2) for f in faces: if f in s: - txt = self.create_facenode_string( - h, f, normal, cknormal=False) + # free surface: no face orientation check against vertical normal + txt = self.create_facenode_string(h, f, normal, cknormal=False) freehex.write(txt) print(' 100 %') freehex.close() @@ -1122,60 +1122,60 @@ def abs_write(self, absname=None): # loops through all block definitions list_hex = cubit.parse_cubit_list('hex', 'all') for block, flag in zip(self.block_bc, self.block_bc_flag): - if block != self.topography: + if block != self.topography and block != self.free: name = cubit.get_exodus_entity_name('block', block) print(' block name:', name, 'id:', block) cknormal = True abshex_local = False # opens file if re.search('xmin', name): - print("xmin") + print(" xmin") abshex_local = open(absname + '_xmin', 'w') normal = (-1, 0, 0) elif re.search('xmax', name): - print("xmax") + print(" xmax") abshex_local = open(absname + '_xmax', 'w') normal = (1, 0, 0) elif re.search('ymin', name): - print("ymin") + print(" ymin") abshex_local = open(absname + '_ymin', 'w') normal = (0, -1, 0) elif re.search('ymax', name): - print("ymax") + print(" ymax") abshex_local = open(absname + '_ymax', 'w') normal = (0, 1, 0) elif re.search('bottom', name): - print("bottom") + print(" bottom") abshex_local = open(absname + '_bottom', 'w') normal = (0, 0, -1) elif re.search('abs', name): - print("abs all - experimental, check the output") + print(" abs all - experimental, check the output") cknormal = False abshex_local = open(absname, 'w') normal = None else: if block == 1003: - print("xmin") + print(" xmin") abshex_local = open(absname + '_xmin', 'w') normal = (-1, 0, 0) elif block == 1004: - print("ymin") + print(" ymin") abshex_local = open(absname + '_ymin', 'w') normal = (0, -1, 0) elif block == 1005: - print("xmax") + print(" xmax") abshex_local = open(absname + '_xmax', 'w') normal = (1, 0, 0) elif block == 1006: - print("ymax") + print(" ymax") abshex_local = open(absname + '_ymax', 'w') normal = (0, 1, 0) elif block == 1002: - print("bottom") + print(" bottom") abshex_local = open(absname + '_bottom', 'w') normal = (0, 0, -1) elif block == 1000: - print("custom") + print(" custom") abshex_local = open(absname, 'w') cknormal = False normal = None @@ -1199,8 +1199,7 @@ def abs_write(self, absname=None): faces = cubit.get_sub_elements('hex', h, 2) for f in faces: if f in s: - txt = self.create_facenode_string( - h, f, normal=normal, cknormal=cknormal) + txt = self.create_facenode_string(h, f, normal=normal, cknormal=cknormal) abshex_local.write(txt) abshex_local.close() print(' 100 %') @@ -1215,19 +1214,23 @@ def surface_write(self, pathdir=None): # > block 10 name 'moho_surface' import re for block in self.block_bc: - if block != self.topography: + if block != self.topography and block != self.free: name = cubit.get_exodus_entity_name('block', block) - # skips block names like face_abs**, face_topo** + # skips block names like face_abs**, face_topo**, face_free** if re.search('abs', name): continue elif re.search('topo', name): continue + elif re.search('free', name): + continue elif re.search('surface', name): + # e.g. moho_surface filename = pathdir + name + '_file' else: continue # gets face elements - print(' surface block name: ', name, 'id: ', block) + print('Optional surface:') + print(' surface: block name: ', name, 'id: ', block) quads_all = cubit.get_block_faces(block) print(' face = ', len(quads_all)) if len(quads_all) == 0: @@ -1243,8 +1246,8 @@ def surface_write(self, pathdir=None): Nhex = len(list_hex) # Create a set to speed up "if f in dic_quads_all.keys()" big time s = set(dic_quads_all.keys()) - percentageDone = -1 - for h in list_hex: + lastDisplayed = -1 + for ih, h in enumerate(list_hex): percentageDone = float(ih)/Nhex*100.0 if int(percentageDone)%10 == 0 and lastDisplayed != int(percentageDone): print(' ', int(percentageDone), '%') @@ -1252,8 +1255,7 @@ def surface_write(self, pathdir=None): faces = cubit.get_sub_elements('hex', h, 2) for f in faces: if f in s: - txt = self.create_facenode_string( - h, f, cknormal=False) + txt = self.create_facenode_string(h, f, cknormal=False) surfhex_local.write(txt) # closes file surfhex_local.close() @@ -1388,7 +1390,7 @@ def _get_bc_flag(self, block): normal = (0, 0, -1) elif re.search('abs', name): label = "all" - print("abs all - experimental, check the output") + print(" abs all - experimental, check the output") cknormal = False else: if block == 1003: @@ -1424,9 +1426,7 @@ def _get_bc_flag(self, block): # faces = cubit.get_sub_elements('hex', h, 2) # for f in faces: # if dic_quads_all.has_key(f): -# abs_array.append(self.create_facenode_string( -# h, f, normal=normal, cknormal=cknormal, -# facenode_string=False)) +# abs_array.append(self.create_facenode_string(h, f, normal=normal, cknormal=cknormal, facenode_string=False)) # print('Ok') # cubit.cd('set info on') # cubit.cmd('set echo on') @@ -1474,9 +1474,7 @@ def _get_bc_flag(self, block): # for f in faces: # if dic_quads_all.has_key(f): # # print(f) -# free_array.append(self.create_facenode_string( -# h, f, normal, cknormal=True, -# facenode_string=False)) +# free_array.append(self.create_facenode_string(h, f, normal, cknormal=True, facenode_string=False)) # elif block == self.free: # name = cubit.get_exodus_entity_name('block', block) # print('free surface block name:', name, 'id:', block) @@ -1488,9 +1486,7 @@ def _get_bc_flag(self, block): # faces = cubit.get_sub_elements('hex', h, 2) # for f in faces: # if dic_quads_all.has_key(f): -# free_array.append(self.create_facenode_string( -# h, f, normal, cknormal=False, -# facenode_string=False)) +# free_array.append(self.create_facenode_string(h, f, normal, cknormal=False, facenode_string=False)) # print('Ok') # cubit.cmd('set info on') # cubit.cmd('set echo on') From 8ddfdda6265bcf7f5430f9c8362fef9f21370f1c Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 8 Jul 2024 16:40:59 +0200 Subject: [PATCH 37/56] updates ordering of imprint & merge commands in cubit scripts (first imprint, then merge) --- EXAMPLES/applications/Mount_StHelens/mesh_mount.py | 2 +- EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py | 2 +- EXAMPLES/applications/fault_examples/tpv5/TPV5.py | 1 + .../layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py | 2 +- .../applications/layered_halfspace/2lay_mesh_boundary_fig8.py | 2 +- .../waterlayered_halfspace/make_mesh_waterlayer-default.py | 2 +- .../waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py | 2 +- .../waterlayered_halfspace/waterlayer_only-nodoubling.py | 2 +- EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py | 2 +- utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py | 1 + 10 files changed, 10 insertions(+), 8 deletions(-) diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py index 593ed25a7..26291371d 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount.py @@ -158,8 +158,8 @@ else: print("#" + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())) print("# imprinting volume, this will take around 1 min, please be patience...") - cubit.cmd('merge all') cubit.cmd('imprint all') + cubit.cmd('merge all') # exports only surfaces which will create single volume cubit.cmd('export acis "topo_2.acis" surface 3 10 12 14 15 9 ascii overwrite') diff --git a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py index 12713490b..825a020f4 100755 --- a/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py +++ b/EXAMPLES/applications/Mount_StHelens/mesh_mount_stl.py @@ -132,7 +132,7 @@ # imprints topography surfaces into brick volume, creates connected surfaces # note: this is a develop feature cubit.cmd('imprint all') - +cubit.cmd('merge all') cubit.cmd('version') diff --git a/EXAMPLES/applications/fault_examples/tpv5/TPV5.py b/EXAMPLES/applications/fault_examples/tpv5/TPV5.py index ffceab079..7747d3472 100755 --- a/EXAMPLES/applications/fault_examples/tpv5/TPV5.py +++ b/EXAMPLES/applications/fault_examples/tpv5/TPV5.py @@ -131,6 +131,7 @@ cubit.cmd("imprint all") cubit.cmd("merge all") + cubit.cmd("surface 1 size "+str(elementsize)) cubit.cmd("volume 1 size "+str(elementsize)) cubit.cmd("surface 1 scheme pave") diff --git a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py index ff549e299..9bb5c0d7f 100755 --- a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py +++ b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8-nodoubling.py @@ -94,8 +94,8 @@ cubit.cmd('delete volume 2 4') -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') cubit.cmd('volume 3 size '+str(elementsize)) cubit.cmd('mesh volume 3') diff --git a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py index 044d7fdb6..5cbc766b2 100755 --- a/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py +++ b/EXAMPLES/applications/layered_halfspace/2lay_mesh_boundary_fig8.py @@ -94,8 +94,8 @@ cubit.cmd('delete volume 2 4') -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') # Meshing the volumes ## middle volume diff --git a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py index 84095d03d..8571d2322 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py +++ b/EXAMPLES/applications/waterlayered_halfspace/make_mesh_waterlayer-default.py @@ -88,8 +88,8 @@ cubit.cmd('delete volume 2 4') -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') # Meshing the volumes cubit.cmd('volume 3 size '+str(elementsize)) diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py index fe312b2e1..c9b52e079 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_mesh_boundary_fig8.py @@ -68,8 +68,8 @@ cubit.cmd('delete volume 2 4') -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') # Meshing the volumes cubit.cmd('volume 3 size 3589.2') diff --git a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py index c5ed17ce9..950c1bcbd 100755 --- a/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py +++ b/EXAMPLES/applications/waterlayered_halfspace/waterlayer_only-nodoubling.py @@ -64,8 +64,8 @@ cubit.cmd('delete volume 2 4') -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') # Meshing the volumes #elementsize = 1196.4 #hi-resolution diff --git a/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py b/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py index 767420f07..dea735f17 100755 --- a/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py +++ b/EXAMPLES/applications/waterlayered_poroelastic/create_mesh.py @@ -95,8 +95,8 @@ cubit.cmd('delete volume 4') # merges surfaces -cubit.cmd('merge all') cubit.cmd('imprint all') +cubit.cmd('merge all') # resets numbering cubit.cmd('compress all') diff --git a/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py b/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py index c977bb21d..b5a12b242 100644 --- a/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py +++ b/utils/dynamic_rupture/dipping_fault_planar_dip10_kink.py @@ -140,6 +140,7 @@ def main(parameter): ##### MESHING fault #### cubit.cmd("imprint all") cubit.cmd("merge all") + cubit.cmd("vol all size "+str(h_size*sf)) cubit.cmd("mesh volume all") From b17f71630f989ae0aec9088e5f959f76e86e24c2 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 8 Jul 2024 19:50:26 +0200 Subject: [PATCH 38/56] code cleaning --- src/decompose_mesh/part_decompose_mesh.F90 | 4 +- src/decompose_mesh/read_mesh_files.F90 | 4 +- src/decompose_mesh/write_mesh_databases.F90 | 2 +- ...field_discontinuity_generate_databases.f90 | 52 ++++++++++++++----- src/meshfem3D/create_meshfem_mesh.f90 | 2 +- src/meshfem3D/get_wavefield_discontinuity.f90 | 5 +- ...te_forces_viscoelastic_calling_routine.F90 | 2 +- .../wavefield_discontinuity_solver.f90 | 43 ++++++++++++--- 8 files changed, 84 insertions(+), 30 deletions(-) diff --git a/src/decompose_mesh/part_decompose_mesh.F90 b/src/decompose_mesh/part_decompose_mesh.F90 index e1468dffe..f85afb035 100644 --- a/src/decompose_mesh/part_decompose_mesh.F90 +++ b/src/decompose_mesh/part_decompose_mesh.F90 @@ -620,7 +620,7 @@ subroutine write_wavefield_discontinuity_database(iproc, outputpath_name, & implicit none integer, intent(in) :: iproc integer, intent(in) :: nspec - integer, intent(in) :: nb_wd + integer, intent(in) :: nb_wd integer, dimension(:), pointer :: glob2loc_elmnts integer, dimension(1:nspec) :: part integer, dimension(1:nb_wd), intent(in) :: boundary_to_ispec_wd, side_wd @@ -632,7 +632,7 @@ subroutine write_wavefield_discontinuity_database(iproc, outputpath_name, & character(len=MAX_STRING_LEN) :: prname write(prname, "('proc',i6.6,'_')") iproc open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=trim(outputpath_name)//'/'//trim(prname)//& + file = trim(outputpath_name)//'/'//trim(prname)//& trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & form='unformatted', action='write') local_nb_wd = 0 diff --git a/src/decompose_mesh/read_mesh_files.F90 b/src/decompose_mesh/read_mesh_files.F90 index 389be55e2..706ecf290 100644 --- a/src/decompose_mesh/read_mesh_files.F90 +++ b/src/decompose_mesh/read_mesh_files.F90 @@ -39,7 +39,7 @@ subroutine read_mesh_files() use fault_scotch, only: ANY_FAULT,read_fault_files,save_nodes_coords,close_faults use constants, only: FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE - + implicit none ! local parameters @@ -592,7 +592,7 @@ subroutine read_mesh_files() read(IIN_DB, *, iostat=ier) boundary_to_ispec_wd(ib), side_wd(ib) enddo close(IIN_DB) - endif + endif ! reads in absorbing boundary files open(unit=IIN_DB, file=localpath_name(1:len_trim(localpath_name))//'/absorbing_surface_file_xmin', & diff --git a/src/decompose_mesh/write_mesh_databases.F90 b/src/decompose_mesh/write_mesh_databases.F90 index 7c42244a2..3b3259bee 100644 --- a/src/decompose_mesh/write_mesh_databases.F90 +++ b/src/decompose_mesh/write_mesh_databases.F90 @@ -201,7 +201,7 @@ subroutine write_mesh_databases() enddo endif - + !! setting up wavefield discontinuity boundary if (IS_WAVEFIELD_DISCONTINUITY) then do ipart = 0, nparts-1 diff --git a/src/generate_databases/wavefield_discontinuity_generate_databases.f90 b/src/generate_databases/wavefield_discontinuity_generate_databases.f90 index 12c3292d2..e531bbd32 100644 --- a/src/generate_databases/wavefield_discontinuity_generate_databases.f90 +++ b/src/generate_databases/wavefield_discontinuity_generate_databases.f90 @@ -1,3 +1,31 @@ +!===================================================================== +! +! S p e c f e m 3 D +! ----------------- +! +! Main historical authors: Dimitri Komatitsch and Jeroen Tromp +! CNRS, France +! and Princeton University, USA +! (there are currently many more authors!) +! (c) October 2017 +! +! 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. +! +!===================================================================== + + module wavefield_discontinuity_generate_databases use constants, only: CUSTOM_REAL @@ -23,7 +51,7 @@ module wavefield_discontinuity_generate_databases !! written in solver database and used in solver integer, dimension(:), allocatable :: ispec_to_elem_wd - !! number of distinct gll points on the boundary + !! number of distinct GLL points on the boundary !! written in solver database and used in solver integer :: nglob_wd @@ -75,7 +103,7 @@ subroutine read_partition_files_wavefield_discontinuity() implicit none !integer :: ier open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & + file = trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & action='read', form='unformatted') read(IFILE_WAVEFIELD_DISCONTINUITY) nb_wd allocate(boundary_to_ispec_wd(nb_wd), side_wd(nb_wd)) @@ -90,7 +118,7 @@ subroutine save_arrays_solver_mesh_wavefield_discontinuity() use generate_databases_par, only: prname implicit none open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & + file = trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & action='write', form='unformatted') write(IFILE_WAVEFIELD_DISCONTINUITY) ispec_to_elem_wd write(IFILE_WAVEFIELD_DISCONTINUITY) nglob_wd @@ -112,7 +140,7 @@ end subroutine save_arrays_solver_mesh_wavefield_discontinuity subroutine setup_boundary_wavefield_discontinuity() use generate_databases_par, only: NDIM, NGLLX, NGLLY, NGLLZ, CUSTOM_REAL, & NGLLSQUARE, ibool, NSPEC_AB - + implicit none integer :: i1, i2, j1, j2, k1, k2, i, j, k integer :: ib, iside, ispec, iglob, ispec_wd, iglob_wd @@ -126,7 +154,7 @@ subroutine setup_boundary_wavefield_discontinuity() nfaces_wd = 0 ispec_to_elem_wd(:) = 0 elem_list_temp(:) = 0 - gllp_list_temp(:) = 0 + gllp_list_temp(:) = 0 do ib = 1, nb_wd ispec = boundary_to_ispec_wd(ib) iside = side_wd(ib) @@ -137,7 +165,7 @@ subroutine setup_boundary_wavefield_discontinuity() elem_list_temp(nspec_wd+1) = ispec nspec_wd = nspec_wd + 1 endif - do i=i1,i2; do j=j1,j2; do k=k1,k2 + do i = i1,i2; do j = j1,j2; do k = k1,k2 iglob = ibool(i,j,k,ispec) call find_point_wd(iglob, gllp_list_temp, nglob_wd, iglob_wd) if (iglob_wd == 0) then @@ -162,7 +190,7 @@ subroutine setup_boundary_wavefield_discontinuity() iside = side_wd(ib) call get_points_boundary_wd(iside, i1, i2, j1, j2, k1, k2, is_face) call find_point_wd(ispec, elem_list_temp, nspec_wd, ispec_wd) - do i=i1,i2; do j=j1,j2; do k=k1,k2 + do i = i1,i2; do j = j1,j2; do k = k1,k2 iglob = ibool(i,j,k,ispec) call find_point_wd(iglob, gllp_list_temp, nglob_wd, iglob_wd) ibool_wd(i,j,k,ispec_wd) = iglob_wd @@ -181,7 +209,7 @@ subroutine setup_boundary_wavefield_discontinuity() do ispec = 1, NSPEC_AB ispec_wd = ispec_to_elem_wd(ispec) if (ispec_wd > 0) then - do k=1,NGLLZ; do j=1,NGLLY; do i=1, NGLLX + do k = 1,NGLLZ; do j = 1,NGLLY; do i = 1, NGLLX iglob_wd= ibool_wd(i,j,k,ispec_wd) if (iglob_wd > 0) then call get_mass_wd(i, j, k, ispec, val_mass) @@ -194,7 +222,7 @@ subroutine setup_boundary_wavefield_discontinuity() end subroutine setup_boundary_wavefield_discontinuity subroutine write_discontinuity_surface_file() - use constants, only: NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE,CUSTOM_REAL,& + use constants, only: NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE,CUSTOM_REAL, & IFILE_WAVEFIELD_DISCONTINUITY use generate_databases_par, only: prname, myrank, LOCAL_PATH, & nodes_coords_ext_mesh, elmnts_ext_mesh, NGNOD @@ -215,7 +243,7 @@ subroutine write_discontinuity_surface_file() double precision, dimension(NGNOD) :: xelm,yelm,zelm call create_name_database(prname,myrank,LOCAL_PATH) open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=prname(1:len_trim(prname))//'wavefield_discontinuity_points',& + file = prname(1:len_trim(prname))//'wavefield_discontinuity_points', & action='write', form='formatted') do iglob_wd = 1, nglob_wd iglob = boundary_to_iglob_wd(iglob_wd) @@ -235,7 +263,7 @@ subroutine write_discontinuity_surface_file() call get_shape3D(shape3D_shrink, dershape3D_shrink, & xigll_shrink, yigll_shrink, zigll_shrink, NGNOD, NGLLX, NGLLY, NGLLZ) open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=prname(1:len_trim(prname))//'wavefield_discontinuity_faces',& + file = prname(1:len_trim(prname))//'wavefield_discontinuity_faces', & action='write', form='formatted') do iface_wd = 1, nfaces_wd ispec = face_ispec_wd(iface_wd) @@ -245,7 +273,7 @@ subroutine write_discontinuity_surface_file() yelm(ia) = nodes_coords_ext_mesh(2,iglob) zelm(ia) = nodes_coords_ext_mesh(3,iglob) enddo - call calc_coords(xstore_shrink(1,1,1), ystore_shrink(1,1,1),& + call calc_coords(xstore_shrink(1,1,1), ystore_shrink(1,1,1), & zstore_shrink(1,1,1), xelm,yelm,zelm,shape3D_shrink) do igll = 1, NGLLSQUARE i = face_ijk_wd(1,igll,iface_wd) diff --git a/src/meshfem3D/create_meshfem_mesh.f90 b/src/meshfem3D/create_meshfem_mesh.f90 index 5fe925c07..3b3c46e35 100644 --- a/src/meshfem3D/create_meshfem_mesh.f90 +++ b/src/meshfem3D/create_meshfem_mesh.f90 @@ -82,7 +82,7 @@ subroutine create_meshfem_mesh() ! HDF5 file i/o use shared_parameters, only: HDF5_ENABLED - + !! setting up wavefield discontinuity interface use shared_parameters, only: IS_WAVEFIELD_DISCONTINUITY diff --git a/src/meshfem3D/get_wavefield_discontinuity.f90 b/src/meshfem3D/get_wavefield_discontinuity.f90 index 7f3f26090..2c9e5c143 100644 --- a/src/meshfem3D/get_wavefield_discontinuity.f90 +++ b/src/meshfem3D/get_wavefield_discontinuity.f90 @@ -34,7 +34,7 @@ subroutine write_wavefield_discontinuity_database() implicit none ! local variables open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=prname(1:len_trim(prname))//& + file = prname(1:len_trim(prname))//& trim(FNAME_WAVEFIELD_DISCONTINUITY_MESH), & form='unformatted', action='write') write(IFILE_WAVEFIELD_DISCONTINUITY) nb_wd @@ -72,7 +72,6 @@ end subroutine write_wavefield_discontinuity_file subroutine find_wavefield_discontinuity_elements() ! read the wavefield_discontinuity_box file ! find the wavefield discontinuity interface - use constants, only: CUSTOM_REAL use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & FNAME_WAVEFIELD_DISCONTINUITY_BOX use meshfem_par, only: xstore,ystore,zstore,nspec @@ -85,7 +84,7 @@ subroutine find_wavefield_discontinuity_elements() IS_EXTRAPOLATION_MODE logical :: covered(26) double precision :: x_min, x_max, y_min, y_max, z_min, z_max - double precision :: dx, dy, dz, x_mid, y_mid, z_mid, ratio_small=1.0e-6 + double precision :: dx, dy, dz, x_mid, y_mid, z_mid, ratio_small = 1.0e-6 open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & file=trim(FNAME_WAVEFIELD_DISCONTINUITY_BOX), & form='formatted', action='read') diff --git a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 index 8d3627c0e..873cb01fb 100644 --- a/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 +++ b/src/specfem3D/compute_forces_viscoelastic_calling_routine.F90 @@ -40,7 +40,7 @@ subroutine compute_forces_viscoelastic_calling() use constants, only: FAULT_SYNCHRONIZE_DISPL_VELOC,FAULT_SYNCHRONIZE_ACCEL use fault_solver_dynamic, only: bc_dynflt_set3d_all,SIMULATION_TYPE_DYN,fault_output_synchronize_GPU,NT_RECORD_LENGTH use fault_solver_kinematic, only: bc_kinflt_set_all,SIMULATION_TYPE_KIN - + !! solving wavefield discontinuity problem with non-split-node scheme use wavefield_discontinuity_solver, only: & add_traction_discontinuity, read_wavefield_discontinuity_file diff --git a/src/specfem3D/wavefield_discontinuity_solver.f90 b/src/specfem3D/wavefield_discontinuity_solver.f90 index e13886ffa..2c4c94841 100644 --- a/src/specfem3D/wavefield_discontinuity_solver.f90 +++ b/src/specfem3D/wavefield_discontinuity_solver.f90 @@ -1,3 +1,30 @@ +!===================================================================== +! +! S p e c f e m 3 D +! ----------------- +! +! Main historical authors: Dimitri Komatitsch and Jeroen Tromp +! CNRS, France +! and Princeton University, USA +! (there are currently many more authors!) +! (c) October 2017 +! +! 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. +! +!===================================================================== + !! Solving the wavefield discontinuity problem with a non-split-node !! scheme !! Tianshi Liu, 2023.5 @@ -9,7 +36,7 @@ module wavefield_discontinuity_solver !! read from solver database integer, dimension(:), allocatable :: ispec_to_elem_wd - !! number of distinct gll points on the boundary + !! number of distinct GLL points on the boundary !! read from solver database integer :: nglob_wd @@ -66,15 +93,15 @@ module wavefield_discontinuity_solver real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: traction_wd contains - + subroutine read_mesh_databases_wavefield_discontinuity() use constants, only: IFILE_WAVEFIELD_DISCONTINUITY, & FNAME_WAVEFIELD_DISCONTINUITY_DATABASE - use specfem_par, only: CUSTOM_REAL, prname, & + use specfem_par, only: prname, & NSPEC_AB, NGLLX, NGLLY, NGLLZ, NDIM, NGLLSQUARE implicit none open(unit=IFILE_WAVEFIELD_DISCONTINUITY, & - file=trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & + file = trim(prname)//trim(FNAME_WAVEFIELD_DISCONTINUITY_DATABASE), & action='read', form='unformatted') allocate(ispec_to_elem_wd(NSPEC_AB)) @@ -137,9 +164,9 @@ subroutine add_displacement_discontinuity_element(ispec, dummyx_loc, & integer :: ispec_wd, i, j, k, iglob_wd ispec_wd = ispec_to_elem_wd(ispec) if (ispec_wd /= 0) then - do k=1,NGLLZ - do j=1,NGLLY - do i=1,NGLLX + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX iglob_wd = ibool_wd(i,j,k,ispec_wd) if (iglob_wd /= 0) then dummyx_loc(i,j,k) = dummyx_loc(i,j,k) + displ_wd(1, iglob_wd) @@ -153,7 +180,7 @@ subroutine add_displacement_discontinuity_element(ispec, dummyx_loc, & end subroutine add_displacement_discontinuity_element subroutine add_traction_discontinuity(accel, nglob) - use specfem_par, only: CUSTOM_REAL, NGLLX, NGLLY, NGLLZ, NGLLSQUARE, & + use specfem_par, only: CUSTOM_REAL, NGLLSQUARE, & ibool, NDIM !use specfem_par_elastic, only: accel implicit none From 52e6717685590289034e3b6de0012a665b213ac2 Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Thu, 27 Jun 2024 17:43:46 -0400 Subject: [PATCH 39/56] implement diffusion-PDE-based smoothing --- .../postprocess_sensitivity_kernels/rules.mk | 66 +- .../smooth_sem_pde.F90 | 805 ++++++++++++++++++ 2 files changed, 870 insertions(+), 1 deletion(-) create mode 100644 src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 diff --git a/src/tomography/postprocess_sensitivity_kernels/rules.mk b/src/tomography/postprocess_sensitivity_kernels/rules.mk index 9f402917f..d31ef1755 100644 --- a/src/tomography/postprocess_sensitivity_kernels/rules.mk +++ b/src/tomography/postprocess_sensitivity_kernels/rules.mk @@ -35,6 +35,7 @@ tomography/postprocess_sensitivity_kernels_TARGETS = \ $E/xclip_sem \ $E/xcombine_sem \ $E/xsmooth_sem \ + $E/xsmooth_sem_pde \ $(EMPTY_MACRO) tomography/postprocess_sensitivity_kernels_OBJECTS = \ @@ -77,7 +78,8 @@ xcombine_sem: $E/xcombine_sem smooth_sem: xsmooth_sem xsmooth_sem: $E/xsmooth_sem - +smooth_sem_pde: xsmooth_sem_pde +xsmooth_sem_pde: $E/xsmooth_sem_pde ####################################### @@ -170,6 +172,41 @@ xsmooth_sem_SHARED_OBJECTS = \ $O/write_VTK_data.shared.o \ $(EMPTY_MACRO) + +xsmooth_sem_pde_OBJECTS = \ + $O/postprocess_par.postprocess_module.o \ + $O/parse_kernel_names.postprocess.o \ + $O/smooth_sem_pde.postprocess.o \ + $(EMPTY_MACRO) + + +xsmooth_sem_pde_SHARED_OBJECTS = \ + $O/specfem3D_par.spec_module.o \ + $O/pml_par.spec_module.o \ + $O/read_mesh_databases.spec.o \ + $O/hdf5_io_server.spec_hdf5.o \ + $O/initialize_simulation.spec.o \ + $O/read_mesh_databases_hdf5.spec_hdf5.o \ + $O/shared_par.shared_module.o \ + $O/adios_manager.shared_adios_module.o \ + $O/init_openmp.shared.o \ + $O/lagrange_poly.shared.o \ + $O/check_mesh_resolution.shared.o \ + $O/count_number_of_sources.shared.o \ + $O/create_name_database.shared.o \ + $O/exit_mpi.shared.o \ + $O/gll_library.shared.o \ + $O/hdf5_manager.shared_hdf5_module.o \ + $O/heap_sort.shared.o \ + $O/param_reader.cc.o \ + $O/read_parameter_file.shared.o \ + $O/read_value_parameters.shared.o \ + $O/search_kdtree.shared.o \ + $O/write_VTK_data.shared.o \ + $O/define_derivation_matrices.shared.o \ + $O/assemble_MPI_scalar.shared.o \ + $(EMPTY_MACRO) + ### ### ADIOS ### @@ -178,11 +215,26 @@ xsmooth_sem_SHARED_OBJECTS = \ ifeq ($(ADIOS),yes) xsmooth_sem_OBJECTS += $(adios_specfem3D_OBJECTS) xsmooth_sem_SHARED_OBJECTS += $(adios_specfem3D_PREOBJECTS) +xsmooth_sem_pde_OBJECTS += $(adios_specfem3D_OBJECTS) +xsmooth_sem_pde_SHARED_OBJECTS += $(adios_specfem3D_PREOBJECTS) else ifeq ($(ADIOS2),yes) xsmooth_sem_OBJECTS += $(adios_specfem3D_OBJECTS) xsmooth_sem_SHARED_OBJECTS += $(adios_specfem3D_PREOBJECTS) +xsmooth_sem_pde_OBJECTS += $(adios_specfem3D_OBJECTS) +xsmooth_sem_pde_SHARED_OBJECTS += $(adios_specfem3D_PREOBJECTS) else xsmooth_sem_OBJECTS += $(adios_specfem3D_STUBS) +xsmooth_sem_pde_OBJECTS += $(adios_specfem3D_STUBS) +endif + +### +### ASDF +### + +ifeq ($(ASDF),yes) +xsmooth_sem_pde_OBJECTS += $(asdf_shared_OBJECTS) +else +xsmooth_sem_pde_OBJECTS += $(asdf_shared_STUBS) endif ### @@ -191,17 +243,22 @@ endif xsmooth_sem_LIBS = $(MPILIBS) xsmooth_sem_OBJECTS += $(gpu_OBJECTS) +xsmooth_sem_pde_LIBS = $(MPILIBS) +xsmooth_sem_pde_OBJECTS += $(gpu_OBJECTS) ## cuda ifeq ($(HAS_GPU),yes) xsmooth_sem_LIBS += $(GPU_LINK) +xsmooth_sem_pde_LIBS += $(GPU_LINK) endif INFO_SMOOTH="building xsmooth_sem $(BUILD_VERSION_TXT)" +INFO_SMOOTH_PDE="building xsmooth_sem_pde $(BUILD_VERSION_TXT)" # extra dependencies $O/smooth_sem.postprocess.o: $O/specfem3D_par.spec_module.o $O/postprocess_par.postprocess_module.o $O/smooth_sem.postprocess.o: $O/search_kdtree.shared.o +$O/smooth_sem_pde.postprocess.o: $O/specfem3D_par.spec_module.o $O/postprocess_par.postprocess_module.o ${E}/xsmooth_sem: $(xsmooth_sem_OBJECTS) $(xsmooth_sem_SHARED_OBJECTS) $(COND_MPI_OBJECTS) @echo "" @@ -210,6 +267,13 @@ ${E}/xsmooth_sem: $(xsmooth_sem_OBJECTS) $(xsmooth_sem_SHARED_OBJECTS) $(COND_MP ${FCLINK} -o $@ $+ $(xsmooth_sem_LIBS) @echo "" +${E}/xsmooth_sem_pde: $(xsmooth_sem_pde_OBJECTS) $(xsmooth_sem_pde_SHARED_OBJECTS) $(COND_MPI_OBJECTS) + @echo "" + @echo $(INFO_SMOOTH_PDE) + @echo "" + ${FCLINK} -o $@ $+ $(xsmooth_sem_pde_LIBS) + @echo + ####################################### ### diff --git a/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 new file mode 100644 index 000000000..adc02f8b4 --- /dev/null +++ b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 @@ -0,0 +1,805 @@ +!! Usage: +!! mpirun -np NPROC bin/xsmooth_sem SIGMA_H SIGMA_V KERNEL_NAME INPUT_DIR OUPUT_DIR GPU_MODE [SET_ZERO_IN_PML] +!! The last argument (optional, FALSE by default) only functions in case of PML. +!! If set to be TRUE, then the PML domain will be set to zero. +!! If the last argument is omitted, then the command-line arguments +!! are identical to smooth_sem. +!! Ideally, the result of this program should be identical to +!! smooth_sem, but will be tens of times faster + +!! GPU is not supported yet, but should be straightforward to +!! implement. +!! Currently, only NGLL=5 is optimized with force inline + +!! This implementation solves a diffusion PDE with explicit +!! time stepping. The parameter CFL_CONST is set to guarantee +!! stability. It can be increased in case of instability. + +#include "config.fh" + +program smooth_sem_pde + use constants, only: HUGEVAL, m1, m2 + use postprocess_par, only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE, & + MAX_STRING_LEN,IIN,IOUT,GAUSSALPHA,GAUSSBETA,PI,TWO_PI + use specfem_par + use specfem_par_elastic, only: & + !ispec_is_elastic, & + nspec_inner_elastic,nspec_outer_elastic,phase_ispec_inner_elastic + !use specfem_par_acoustic, only: ispec_is_acoustic + !use specfem_par_poroelastic, only: ispec_is_poroelastic + use pml_par, only: is_CPML + + implicit none + integer, parameter :: NARGS = 7 + integer, parameter :: PRINT_INFO_PER_STEP = 1000000 + real(kind=CUSTOM_REAL), parameter :: CFL_CONST = 9.0 + real(kind=CUSTOM_REAL), dimension(:,:,:,:),allocatable :: dat + !! spherical coordinate !! + !real(kind=CUSTOM_REAL), dimension(:,:,:,:,:),allocatable :: rotate_r + !!!!!!!!!!!!!!!!!!!!!!!!!! + real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: & + stemp1,stemp2,stemp3, & + snewtemp1,snewtemp2,snewtemp3, & + dat_elem + real(kind=CUSTOM_REAL), dimension(:), allocatable :: dat_glob, ddat_glob + real(kind=CUSTOM_REAL), dimension(:), allocatable :: rvol + real(kind=CUSTOM_REAL), dimension(:,:,:,:),allocatable :: rvol_local + integer :: i,j,k,l,iglob,ier,ispec,ispec_p,iphase,ispec_irreg + + character(len=MAX_STRING_LEN) :: arg(NARGS) + character(len=MAX_STRING_LEN) :: input_dir, output_dir + !character(len=MAX_STRING_LEN) :: prname_lp + character(len=MAX_STRING_LEN*2) :: ks_file + character(len=MAX_STRING_LEN*2) :: local_data_file + + + !character(len=MAX_STRING_LEN) :: kernel_names(MAX_KERNEL_NAMES) + !character(len=MAX_STRING_LEN) :: kernel_names_comma_delimited + character(len=MAX_STRING_LEN) :: kernel_name + integer :: num_elements + real t1,t2,tnow,tlast + + real(kind=CUSTOM_REAL) :: sigma_h, sigma_v, ch, cv, cmax + real(kind=CUSTOM_REAL) :: min_val, max_val, min_val_glob, max_val_glob + + real(kind=CUSTOM_REAL) :: distance_min_glob,distance_max_glob + real(kind=CUSTOM_REAL) :: elemsize_min_glob,elemsize_max_glob + real(kind=CUSTOM_REAL) :: x_min_glob,x_max_glob + real(kind=CUSTOM_REAL) :: y_min_glob,y_max_glob + real(kind=CUSTOM_REAL) :: z_min_glob,z_max_glob + + real(kind=CUSTOM_REAL) :: & + xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl, & + stemp1l, stemp2l, stemp3l, ddxl, ddyl, ddzl + integer :: ntstep, istep + double precision :: weight + !real(kind=CUSTOM_REAL), dimension(MAX_KERNEL_NAMES) :: max_old,max_new,max_old_all,max_new_all + !real(kind=CUSTOM_REAL), dimension(MAX_KERNEL_NAMES) :: min_old,min_new,min_old_all,min_new_all + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_send_vector_ext_mesh_smooth + real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_recv_vector_ext_mesh_smooth + logical :: USE_GPU, SET_ZERO_IN_PML + + call init_mpi() + call world_size(sizeprocs) + call world_rank(myrank) + + if (myrank == 0) print *,"Running XSMOOTH_SEM" + call synchronize_all() + call cpu_time(t1) + + ! parse command line arguments + if ((command_argument_count() /= NARGS) .and. & + (command_argument_count() /= (NARGS - 1)) .and. & + (command_argument_count() /= (NARGS - 2))) then + if (myrank == 0) then + print *,'USAGE: mpirun -np NPROC bin/xsmooth_sem SIGMA_H SIGMA_V ' + print *,'KERNEL_NAME INPUT_DIR OUPUT_DIR GPU_MODE [SET_ZERO_IN_PML]' + stop 'Please check command line arguments' + endif + endif + call synchronize_all() + + if (command_argument_count() == NARGS) then + do i = 1, NARGS + call get_command_argument(i,arg(i), status=ier) + enddo + else if (command_argument_count() == (NARGS - 1)) then + do i = 1, NARGS-1 + call get_command_argument(i,arg(i), status=ier) + enddo + arg(NARGS) = 'TRUE' ! SET_ZERO_IN_PML = .true. by default + else if (command_argument_count() == (NARGS - 2)) then + do i = 1, NARGS-2 + call get_command_argument(i,arg(i), status=ier) + enddo + arg(NARGS-1) = 'FALSE' ! USE_GPU = .false. by default + arg(NARGS) = 'TRUE' ! SET_ZERO_IN_PML = .true. by default + else + if (myrank == 0) then + stop 'Please check command line arguments' + endif + endif + + read(arg(1),*) sigma_h + read(arg(2),*) sigma_v + kernel_name = arg(3) + input_dir= arg(4) + output_dir = arg(5) + read(arg(6),*) USE_GPU + read(arg(7),*) SET_ZERO_IN_PML + + !call parse_kernel_names(kernel_names_comma_delimited,kernel_names,nker) + call synchronize_all() + ! user output + if (myrank == 0) then + print *,'command line arguments:' + print *,' smoothing sigma_h , sigma_v : ',sigma_h,sigma_v + print *,' input dir : ',trim(input_dir) + print *,' output dir: ',trim(output_dir) + print *," GPU_MODE: ", USE_GPU + print *," SET_ZERO_IN_PML: ", SET_ZERO_IN_PML + print * + endif + + if (USE_GPU) then + if (myrank == 0) stop 'GPU mode not available yet' + endif + + call initialize_simulation() + + ! reads in external mesh + call read_mesh_databases() + + ! gets mesh dimensions + call check_mesh_distances(myrank,NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, & + x_min_glob,x_max_glob,y_min_glob,y_max_glob,z_min_glob,z_max_glob, & + elemsize_min_glob,elemsize_max_glob, & + distance_min_glob,distance_max_glob) + + ! outputs infos + if (myrank == 0) then + print *,'mesh dimensions:' + print *,' Xmin and Xmax of the model = ',x_min_glob,x_max_glob + print *,' Ymin and Ymax of the model = ',y_min_glob,y_max_glob + print *,' Zmin and Zmax of the model = ',z_min_glob,z_max_glob + print * + print *,' Max GLL point distance = ',distance_max_glob + print *,' Min GLL point distance = ',distance_min_glob + print *,' Max/min ratio = ',distance_max_glob/distance_min_glob + print * + print *,' Max element size = ',elemsize_max_glob + print *,' Min element size = ',elemsize_min_glob + print *,' Max/min ratio = ',elemsize_max_glob/elemsize_min_glob + print * + endif + + !! broadcast distance_min_glob to other processors + ! check before broadcast + !if (myrank == 1) print *, 'distance_min_glob = ', distance_min_glob, 'myrank=', myrank + call bcast_all_singlecr(distance_min_glob) + ! check after broadcast + !if (myrank == 1) print *, 'distance_min_glob = ', distance_min_glob, 'myrank=', myrank + !! spherical coordinate !! + !allocate(rotate_r(NDIM,NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier) + !if (ier /= 0) call exit_MPI_without_rank('error allocating array 1013') + ! + !do ispec = 1, NSPEC_AB + ! do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + ! iglob = ibool(i,j,k,ispec) + ! xl = xstore(iglob) + ! yl = ystore(iglob) + ! zl = zstore(iglob) + ! rl = sqrt(xl*xl+yl*yl+zl*zl) + ! rotate_r(1,i,j,k,ispec) = xl / rl + ! rotate_r(2,i,j,k,ispec) = yl / rl + ! rotate_r(3,i,j,k,ispec) = zl / rl + ! enddo;enddo;enddo + !enddo + !!!!!!!!!!!!!!!!!!!!!!!!! + + deallocate(xstore,ystore,zstore,kappastore,mustore) + !deallocate(ispec_is_acoustic, ispec_is_elastic, ispec_is_poroelastic) + + !! determine ch, cv, ntstep + cmax = distance_min_glob ** 2 / CFL_CONST + if (sigma_v >= sigma_h) then + cv = cmax + ch = cv * (sigma_h ** 2) / (sigma_v ** 2) + else + ch = cmax + cv = ch * (sigma_v ** 2) / (sigma_h ** 2) + endif + ntstep = int(ceiling((max(sigma_h,sigma_v)**2)/(2.0*cmax))) + + if (myrank == 0) print *, 'cv=', cv, 'ch=', ch, 'ntstep=', ntstep + print *, jacobian_regular, xix_regular + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + !! initialize time iteration + ! set up GLL points, weights and derivation matrices for reference element + ! (between -1,1) + call define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, & + hprime_xx,hprime_yy,hprime_zz, & + hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, & + wgllwgll_xy,wgllwgll_xz,wgllwgll_yz) + ! define transpose of derivation matrix + do j = 1,NGLLY + do i = 1,NGLLX + hprime_xxT(j,i) = hprime_xx(i,j) + hprime_yyT(j,i) = hprime_yy(i,j) + hprime_zzT(j,i) = hprime_zz(i,j) + + hprimewgll_xxT(j,i) = hprimewgll_xx(i,j) + enddo + enddo + + ! define a 3D extension in order to be able to force vectorization in the compute_forces routines + do k = 1,NGLLZ + do j = 1,NGLLY + do i = 1,NGLLX + wgllwgll_yz_3D(i,j,k) = wgllwgll_yz(j,k) + wgllwgll_xz_3D(i,j,k) = wgllwgll_xz(i,k) + wgllwgll_xy_3D(i,j,k) = wgllwgll_xy(i,j) + enddo + enddo + enddo + + allocate(dat(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) + allocate(dat_glob(NGLOB_AB)) + allocate(ddat_glob(NGLOB_AB)) + allocate(buffer_send_vector_ext_mesh_smooth( & + max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh),stat=ier) + allocate(buffer_recv_vector_ext_mesh_smooth( & + max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh),stat=ier) + ! prepare assemble array + allocate(rvol(NGLOB_AB)) + rvol(:) = 0.0 + allocate(rvol_local(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) + do ispec = 1, NSPEC_AB + ispec_irreg = irregular_element_number(ispec) + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + weight = wxgll(i)*wygll(j)*wzgll(k) + if (ispec_irreg /= 0) then + jacobianl = jacobianstore(i,j,k,ispec_irreg) + else + jacobianl = jacobian_regular + endif + rvol_local(i,j,k,ispec) = real(dble(jacobianl)*weight,kind=CUSTOM_REAL) + iglob = ibool(i,j,k,ispec) + rvol(iglob) = rvol(iglob) + rvol_local(i,j,k,ispec) + enddo;enddo;enddo + enddo + call assemble_MPI_scalar_blocking(NPROC,NGLOB_AB,rvol, & + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh,& + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh) + rvol(:) = 1.0 / rvol(:) + !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! read in data to be smoothed + ! data file + write(prname,'(a,i6.6,a)') trim(input_dir)//'/proc',myrank,'_' + local_data_file = trim(prname) // trim(kernel_name) // '.bin' + + open(unit = IIN,file = trim(local_data_file),status='old',action='read',& + form ='unformatted',iostat=ier) + if (ier /= 0) then + print *,'Error opening data file: ',trim(local_data_file) + stop 'Error opening data file' + endif + + read(IIN) dat + close(IIN) + !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! project + dat_glob(:) = 0.0 + do ispec = 1, NSPEC_AB + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + iglob = ibool(i,j,k,ispec) + dat_glob(iglob) = dat_glob(iglob) + dat(i,j,k,ispec) & + * rvol_local(i,j,k,ispec) + enddo;enddo;enddo + enddo + call assemble_MPI_send_smooth(NPROC,NGLOB_AB,& + dat_glob,buffer_send_vector_ext_mesh_smooth,& + buffer_recv_vector_ext_mesh_smooth,& + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh) + call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB,& + dat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& + max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & + my_neighbors_ext_mesh,myrank) + if (myrank == 0) print *, 'Before smoothing: ' + + dat_glob(:) = dat_glob(:) * rvol(:) + min_val = minval(dat_glob) + max_val = maxval(dat_glob) + call min_all_cr(min_val, min_val_glob) + call max_all_cr(max_val, max_val_glob) + if (myrank == 0) then + print *, ' '//trim(kernel_name) + print *, ' minval:', min_val_glob + print *, ' maxval:', max_val_glob + if (myrank == 0) call cpu_time(tlast) + endif + !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! broadcast glob array back to local array + do ispec = 1, NSPEC_AB + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + iglob = ibool(i,j,k,ispec) + dat(i,j,k,ispec) = dat_glob(iglob) + enddo;enddo;enddo + enddo + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + do istep = 1, ntstep + !if (myrank == 0) print *, istep + ddat_glob(:) = 0.0 + do iphase = 1,2 + if (iphase == 1) then + num_elements = nspec_outer_elastic + else + num_elements = nspec_inner_elastic + endif + do ispec_p = 1,num_elements + ispec = phase_ispec_inner_elastic(ispec_p,iphase) + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + dat_elem(i,j,k) = dat(i,j,k,ispec) + enddo; enddo; enddo + select case (NGLLX) + case (5) + call mxm5_single(hprime_xx,m1,dat_elem,stemp1,m2) + call mxm5_3dmat_single(dat_elem,m1,hprime_xxT,m1,& + stemp2,NGLLX) + call mxm5_single(dat_elem,m2,hprime_xxT,stemp3,m1) + case default + !! derivative along xi, eta, zeta + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + stemp1l = 0._CUSTOM_REAL + stemp2l = 0._CUSTOM_REAL + stemp3l = 0._CUSTOM_REAL + ! we can merge the loops because NGLLX == NGLLY == NGLLZ + do l = 1,NGLLX + stemp1l = stemp1l + dat_elem(l,j,k)*hprime_xx(i,l) + stemp2l = stemp2l + dat_elem(i,l,k)*hprime_yy(j,l) + stemp3l = stemp3l + dat_elem(i,j,l)*hprime_zz(k,l) + enddo + stemp1(i,j,k) = stemp1l + stemp2(i,j,k) = stemp2l + stemp3(i,j,k) = stemp3l + enddo;enddo;enddo + end select + + ispec_irreg = irregular_element_number(ispec) + if (ispec_irreg /= 0) then + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + xixl = xixstore(i,j,k,ispec_irreg) + xiyl = xiystore(i,j,k,ispec_irreg) + xizl = xizstore(i,j,k,ispec_irreg) + etaxl = etaxstore(i,j,k,ispec_irreg) + etayl = etaystore(i,j,k,ispec_irreg) + etazl = etazstore(i,j,k,ispec_irreg) + gammaxl = gammaxstore(i,j,k,ispec_irreg) + gammayl = gammaystore(i,j,k,ispec_irreg) + gammazl = gammazstore(i,j,k,ispec_irreg) + jacobianl = jacobianstore(i,j,k,ispec_irreg) + + ! derivatives along x, y, z + ddxl = xixl*stemp1(i,j,k) + etaxl*stemp2(i,j,k) + & + gammaxl*stemp3(i,j,k) + ddyl = xiyl*stemp1(i,j,k) + etayl*stemp2(i,j,k) + & + gammayl*stemp3(i,j,k) + ddzl = xizl*stemp1(i,j,k) + etazl*stemp2(i,j,k) + & + gammazl*stemp3(i,j,k) + !! spherical coordinate + !rxl = rotate_r(1,i,j,k,ispec) + !ryl = rotate_r(2,i,j,k,ispec) + !rzl = rotate_r(3,i,j,k,ispec) + !stemp1(i,j,k) = ((cv-ch) * (rxl*xixl+ryl*xiyl+rzl*xizl) * & + ! (rxl*ddxl+ryl*ddyl+rzl*ddzl) +& + ! ch * (xixl*ddxl+xiyl*ddyl+xizl*ddzl)) * jacobianl + !stemp2(i,j,k) = ((cv-ch) * (rxl*etaxl+ryl*etayl+rzl*etazl) * & + ! (rxl*ddxl+ryl*ddyl+rzl*ddzl) +& + ! ch * (etaxl*ddxl+etayl*ddyl+etazl*dzl)) * jacobianl + !stemp3(i,j,k) = ((cv-ch) * (rxl*gammaxl+ryl*gammayl+rzl*gammazl)* & + ! (rxl*ddxl+ryl*ddyl+rzl*ddzl) +& + ! ch * (gammaxl*ddxl+gammayl*ddyl+gammazl*ddzl)) * jacobianl + !! Cartesian coordinate + stemp1(i,j,k) = ((cv-ch) * xizl * ddzl +& + ch * (xixl*ddxl+xiyl*ddyl+xizl*ddzl)) * jacobianl + stemp2(i,j,k) = ((cv-ch) * etazl * ddzl +& + ch * (etaxl*ddxl+etayl*ddyl+etazl*ddzl)) * jacobianl + stemp3(i,j,k) = ((cv-ch) * gammazl * ddzl +& + ch * (gammaxl*ddxl+gammayl*ddyl+gammazl*ddzl)) * jacobianl + enddo;enddo;enddo + else + xixl = xix_regular + jacobianl = jacobian_regular + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + stemp1(i,j,k) = (& + ch * xixl*xixl*stemp1(i,j,k)) * jacobianl + stemp2(i,j,k) = (& + ch * xixl*xixl*stemp2(i,j,k)) * jacobianl + stemp3(i,j,k) = (& + cv * xixl*xixl*stemp3(i,j,k)) * jacobianl + enddo;enddo;enddo + endif + + select case (NGLLX) + case (5) + call mxm5_single(hprimewgll_xxT,m1,stemp1,snewtemp1,m2) + call mxm5_3dmat_single(stemp2,m1,hprimewgll_xx,m1,& + snewtemp2,NGLLX) + call mxm5_single(stemp3,m2,hprimewgll_xx,snewtemp3,m1) + case default + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + stemp1l = 0._CUSTOM_REAL + stemp2l = 0._CUSTOM_REAL + stemp3l = 0._CUSTOM_REAL + ! we can merge these loops because NGLLX = NGLLY = NGLLZ + do l = 1,NGLLX + stemp1l = stemp1l + stemp1(l,j,k) * hprimewgll_xx(l,i) + stemp2l = stemp2l + stemp2(i,l,k) * hprimewgll_yy(l,j) + stemp3l = stemp3l + stemp3(i,j,l) * hprimewgll_zz(l,k) + enddo + ! to be compatible with matrix versions from above + snewtemp1(i,j,k) = stemp1l + snewtemp2(i,j,k) = stemp2l + snewtemp3(i,j,k) = stemp3l + enddo;enddo;enddo + end select + + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + iglob = ibool(i,j,k,ispec) + ddat_glob(iglob) = ddat_glob(iglob) - (& + wgllwgll_yz_3D(i,j,k) * snewtemp1(i,j,k)+& + wgllwgll_xz_3D(i,j,k) * snewtemp2(i,j,k)+& + wgllwgll_xy_3D(i,j,k) * snewtemp3(i,j,k)) + enddo;enddo;enddo + enddo ! ispec_p = 1, num_elements + !! assemble MPI + if (iphase == 1) then + call assemble_MPI_send_smooth(NPROC,NGLOB_AB,& + ddat_glob,buffer_send_vector_ext_mesh_smooth,& + buffer_recv_vector_ext_mesh_smooth,& + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh) + else + call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB,& + ddat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& + max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & + my_neighbors_ext_mesh,myrank) + endif + !!!!!!!!!!!!!!!!! + enddo !iphase = 1,2 + + ddat_glob(:) = ddat_glob(:) * rvol(:) + !! update + dat_glob(:) = dat_glob(:) + ddat_glob(:) + !! info + if (mod(istep, PRINT_INFO_PER_STEP) == 0) then + if (myrank == 0) print *, 'Step:', istep + min_val = minval(dat_glob) + max_val = maxval(dat_glob) + call min_all_cr(min_val, min_val_glob) + call max_all_cr(max_val, max_val_glob) + if (myrank == 0) then + print *, ' '//trim(kernel_name) + print *, ' minval:', min_val_glob + print *, ' maxval:', max_val_glob + call cpu_time(tnow) + print *, 'time since last message:', tnow-tlast + call cpu_time(tlast) + endif + endif + !!!!!!!!!!!!! + !! broadcast glob array back to local array + do ispec = 1, NSPEC_AB + do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + iglob = ibool(i,j,k,ispec) + !! mute everything in the PML domain + if (SET_ZERO_IN_PML .and. is_CPML(ispec)) then + dat_glob(iglob) = 0.0 + endif + dat(i,j,k,ispec) = dat_glob(iglob) + enddo;enddo;enddo + enddo + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + call synchronize_all() + enddo + call synchronize_all() + call cpu_time(t2) + if (myrank == 0) & + print *, 'Computation time with PDE-based smoothing on CPU:', t2-t1 + !! output + ! file output + ! smoothed kernel file name + ! statistics + min_val = minval(dat_glob) + max_val = maxval(dat_glob) + call min_all_cr(min_val, min_val_glob) + call max_all_cr(max_val, max_val_glob) + if (myrank == 0) then + print *, 'After smoothing:' + print *, ' '//trim(kernel_name) + print *, ' minval:', min_val_glob + print *, ' maxval:', max_val_glob + endif + write(ks_file,'(a,i6.6,a)') trim(output_dir)//'/proc',myrank,'_'//trim(kernel_name)//'_smooth.bin' + open(IOUT,file=trim(ks_file),status='unknown',form='unformatted',iostat=ier) + if (ier /= 0) stop 'Error opening smoothed kernel file' + write(IOUT) dat + close(IOUT) + if (myrank == 0) print *,'written: ',trim(ks_file) + + deallocate(ibool,irregular_element_number) + deallocate(xixstore,xiystore,xizstore,etaxstore,etaystore,etazstore,& + gammaxstore,gammaystore,gammazstore,jacobianstore) + !! spherical coordinate !! + !deallocate(rotate_r) + !!!!!!!!!!!!!!!!!!!!!!!!!! + deallocate(dat, dat_glob, ddat_glob) + deallocate(buffer_send_vector_ext_mesh_smooth, & + buffer_recv_vector_ext_mesh_smooth) + deallocate(rvol, rvol_local) + + + call finalize_mpi() + + + contains + + subroutine mxm5_single(A,n1,B,C,n3) + +! we can force inlining (Intel compiler) +#if defined __INTEL_COMPILER +!DIR$ ATTRIBUTES FORCEINLINE :: mxm5_single +#else +! cray +!DIR$ INLINEALWAYS mxm5_single +#endif + +! two-dimensional arrays (25,5)/(5,25) + + use constants, only: CUSTOM_REAL + + implicit none + + integer,intent(in) :: n1,n3 + real(kind=CUSTOM_REAL),dimension(n1,5),intent(in) :: A + real(kind=CUSTOM_REAL),dimension(5,n3),intent(in) :: B + real(kind=CUSTOM_REAL),dimension(n1,n3),intent(out) :: C + + ! local parameters + integer :: i,j + + ! matrix-matrix multiplication + do j = 1,n3 +!DIR$ IVDEP +!DIR$ SIMD + do i = 1,n1 + C(i,j) = A(i,1) * B(1,j) & + + A(i,2) * B(2,j) & + + A(i,3) * B(3,j) & + + A(i,4) * B(4,j) & + + A(i,5) * B(5,j) + enddo + enddo + + end subroutine mxm5_single + + subroutine mxm5_3dmat_single(A,n1,B,n2,C,n3) + +! we can force inlining (Intel compiler) +#if defined __INTEL_COMPILER +!DIR$ ATTRIBUTES FORCEINLINE :: mxm5_3dmat_single +#else +! cray +!DIR$ INLINEALWAYS mxm5_3dmat_single +#endif + +! three-dimensional arrays (5,5,5) for A and C + + use constants, only: CUSTOM_REAL + + implicit none + + integer,intent(in) :: n1,n2,n3 + real(kind=CUSTOM_REAL),dimension(n1,5,n3),intent(in) :: A + real(kind=CUSTOM_REAL),dimension(5,n2),intent(in) :: B + real(kind=CUSTOM_REAL),dimension(n1,n2,n3),intent(out) :: C + + ! local parameters + integer :: i,j,k + + ! matrix-matrix multiplication + do k = 1,n3 + do j = 1,n2 +!DIR$ IVDEP +!DIR$ SIMD + do i = 1,n1 + C(i,j,k) = A(i,1,k) * B(1,j) & + + A(i,2,k) * B(2,j) & + + A(i,3,k) * B(3,j) & + + A(i,4,k) * B(4,j) & + + A(i,5,k) * B(5,j) + enddo + enddo + enddo + + end subroutine mxm5_3dmat_single + +end program smooth_sem_pde + + subroutine assemble_MPI_send_smooth(NPROC,NGLOB_AB,& + array_val,buffer_send_vector_ext_mesh_smooth,& + buffer_recv_vector_ext_mesh_smooth,& + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh) + + ! sends data + + use constants, only: CUSTOM_REAL, itag + + implicit none + + integer :: NPROC + integer :: NGLOB_AB + + ! array to assemble + real(kind=CUSTOM_REAL), dimension(NGLOB_AB) :: array_val + + integer :: num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh + + real(kind=CUSTOM_REAL), & + dimension(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh) :: & + buffer_send_vector_ext_mesh_smooth,buffer_recv_vector_ext_mesh_smooth + + integer, dimension(num_interfaces_ext_mesh) :: & + nibool_interfaces_ext_mesh,my_neighbors_ext_mesh + integer, dimension(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh):: & + ibool_interfaces_ext_mesh + integer, dimension(num_interfaces_ext_mesh) :: & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh + + integer ipoin,iinterface + + ! here we have to assemble all the contributions between partitions using MPI + + ! assemble only if more than one partition + if (NPROC > 1) then + + ! partition border copy into the buffer + do iinterface = 1, num_interfaces_ext_mesh + do ipoin = 1, nibool_interfaces_ext_mesh(iinterface) + buffer_send_vector_ext_mesh_smooth(ipoin,iinterface) = & + array_val(ibool_interfaces_ext_mesh(ipoin,iinterface)) + enddo + enddo + + ! send messages + do iinterface = 1, num_interfaces_ext_mesh + call isend_cr(buffer_send_vector_ext_mesh_smooth(1,iinterface), & + nibool_interfaces_ext_mesh(iinterface), & + my_neighbors_ext_mesh(iinterface), & + itag, & + request_send_vector_ext_mesh(iinterface)) + call irecv_cr(buffer_recv_vector_ext_mesh_smooth(1,iinterface), & + nibool_interfaces_ext_mesh(iinterface), & + my_neighbors_ext_mesh(iinterface), & + itag, & + request_recv_vector_ext_mesh(iinterface)) + enddo + + endif + + end subroutine assemble_MPI_send_smooth + + + subroutine assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB, & + array_val,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& + max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & + my_neighbors_ext_mesh,myrank) + +! waits for data to receive and assembles + + use constants, only: CUSTOM_REAL, itag + + implicit none + + integer :: NPROC + integer :: NGLOB_AB +! array to assemble + real(kind=CUSTOM_REAL), dimension(NGLOB_AB) :: array_val + + integer :: num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh,myrank + + real(kind=CUSTOM_REAL), & + dimension(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh) :: & + buffer_recv_vector_ext_mesh_smooth + + integer, dimension(num_interfaces_ext_mesh) :: nibool_interfaces_ext_mesh + integer, dimension(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh)::& + ibool_interfaces_ext_mesh + integer, dimension(num_interfaces_ext_mesh) :: & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh + integer, dimension(num_interfaces_ext_mesh) :: my_neighbors_ext_mesh + + real(kind=CUSTOM_REAL), & + dimension(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh) :: & + mybuffer + integer :: ipoin,iinterface,iglob + logical :: need_add_my_contrib + +! here we have to assemble all the contributions between partitions using MPI + +! assemble only if more than one partition + if (NPROC == 1) return + +! move interface values of array_val to local buffers + do iinterface = 1, num_interfaces_ext_mesh + do ipoin = 1, nibool_interfaces_ext_mesh(iinterface) + iglob = ibool_interfaces_ext_mesh(ipoin,iinterface) + mybuffer(ipoin,iinterface) = array_val(iglob) + ! set them to zero right away to avoid counting it more than once during + ! assembly: + ! buffers of higher rank get zeros on nodes shared with current buffer + array_val(iglob) = 0._CUSTOM_REAL + enddo + enddo + +! wait for communications completion (recv) + do iinterface = 1, num_interfaces_ext_mesh + call wait_req(request_recv_vector_ext_mesh(iinterface)) + enddo + +! adding all contributions in order of processor rank + need_add_my_contrib = .true. + do iinterface = 1, num_interfaces_ext_mesh + if (need_add_my_contrib .and. myrank < my_neighbors_ext_mesh(iinterface)) & + call add_my_contrib() + do ipoin = 1, nibool_interfaces_ext_mesh(iinterface) + iglob = ibool_interfaces_ext_mesh(ipoin,iinterface) + array_val(iglob) = array_val(iglob) + & + buffer_recv_vector_ext_mesh_smooth(ipoin,iinterface) + enddo + enddo + if (need_add_my_contrib) call add_my_contrib() + +! wait for communications completion (send) + do iinterface = 1, num_interfaces_ext_mesh + call wait_req(request_send_vector_ext_mesh(iinterface)) + enddo + + contains + + subroutine add_my_contrib() + + integer :: my_iinterface,my_ipoin + + do my_iinterface = 1, num_interfaces_ext_mesh + do my_ipoin = 1, nibool_interfaces_ext_mesh(my_iinterface) + iglob = ibool_interfaces_ext_mesh(my_ipoin,my_iinterface) + array_val(iglob) = array_val(iglob) + & + mybuffer(my_ipoin,my_iinterface) + enddo + enddo + need_add_my_contrib = .false. + + end subroutine add_my_contrib + + end subroutine assemble_MPI_w_ord_smooth + From 8870f16acad683b07dbca5dd1bb49b5f35ad5bfc Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Fri, 9 Aug 2024 22:35:26 -0400 Subject: [PATCH 40/56] include the dependency to module specfem_par_movie_hdf5 in case of HDF5 --- .../postprocess_sensitivity_kernels/rules.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tomography/postprocess_sensitivity_kernels/rules.mk b/src/tomography/postprocess_sensitivity_kernels/rules.mk index d31ef1755..c53a6045a 100644 --- a/src/tomography/postprocess_sensitivity_kernels/rules.mk +++ b/src/tomography/postprocess_sensitivity_kernels/rules.mk @@ -227,6 +227,16 @@ xsmooth_sem_OBJECTS += $(adios_specfem3D_STUBS) xsmooth_sem_pde_OBJECTS += $(adios_specfem3D_STUBS) endif +### +### HDF 5 +### + +ifeq ($(HDF5),yes) +tomography/postprocess_sensitivity_kernels_MODULES += \ + $(FC_MODDIR)/specfem_par_movie_hdf5.$(FC_MODEXT) \ + $(EMPTY_MACRO) +endif + ### ### ASDF ### From b286c277e4f307809c0418f489ac0f18d640a21b Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Fri, 9 Aug 2024 23:35:36 -0400 Subject: [PATCH 41/56] fix dependencies in case of HDF5 for PDE-based smoothing --- .../postprocess_sensitivity_kernels/rules.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tomography/postprocess_sensitivity_kernels/rules.mk b/src/tomography/postprocess_sensitivity_kernels/rules.mk index c53a6045a..49d42ec84 100644 --- a/src/tomography/postprocess_sensitivity_kernels/rules.mk +++ b/src/tomography/postprocess_sensitivity_kernels/rules.mk @@ -205,6 +205,22 @@ xsmooth_sem_pde_SHARED_OBJECTS = \ $O/write_VTK_data.shared.o \ $O/define_derivation_matrices.shared.o \ $O/assemble_MPI_scalar.shared.o \ + $O/write_movie_output_HDF5.spec_hdf5.o \ + $O/write_output_HDF5.spec_hdf5.o \ + $O/write_seismograms.spec.o \ + $O/write_output_ASCII_or_binary.spec.o \ + $O/write_output_SU.spec.o \ + $O/compute_seismograms.spec.o \ + $O/compute_adj_source_frechet.spec.o \ + $O/compute_gradient_in_acoustic.spec.o \ + $O/compute_interpolated_dva.spec.o \ + $O/compute_element_strain.spec.o \ + $O/compute_add_sources_viscoelastic.spec.o \ + $O/comp_source_time_function.spec.o \ + $O/noise_tomography.spec.o \ + $O/compute_arrays_source.spec.o \ + $O/netlib_specfun_erf.shared.o \ + $O/write_c_binary.cc.o \ $(EMPTY_MACRO) ### From 56554706f3fdde4700b98351c35192c85a8ee501 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 12 Aug 2024 10:20:06 +0200 Subject: [PATCH 42/56] code cleaning --- .../smooth_sem_pde.F90 | 186 +++++++++++------- 1 file changed, 115 insertions(+), 71 deletions(-) diff --git a/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 index adc02f8b4..d59fab115 100644 --- a/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 +++ b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 @@ -1,4 +1,31 @@ -!! Usage: +!===================================================================== +! +! S p e c f e m 3 D +! ----------------- +! +! Main historical authors: Dimitri Komatitsch and Jeroen Tromp +! CNRS, France +! and Princeton University, USA +! (there are currently many more authors!) +! (c) October 2017 +! +! 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. +! +!===================================================================== + +!! Usage: !! mpirun -np NPROC bin/xsmooth_sem SIGMA_H SIGMA_V KERNEL_NAME INPUT_DIR OUPUT_DIR GPU_MODE [SET_ZERO_IN_PML] !! The last argument (optional, FALSE by default) only functions in case of PML. !! If set to be TRUE, then the PML domain will be set to zero. @@ -8,7 +35,7 @@ !! smooth_sem, but will be tens of times faster !! GPU is not supported yet, but should be straightforward to -!! implement. +!! implement. !! Currently, only NGLL=5 is optimized with force inline !! This implementation solves a diffusion PDE with explicit @@ -18,6 +45,7 @@ #include "config.fh" program smooth_sem_pde + use constants, only: HUGEVAL, m1, m2 use postprocess_par, only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE, & MAX_STRING_LEN,IIN,IOUT,GAUSSALPHA,GAUSSBETA,PI,TWO_PI @@ -27,12 +55,14 @@ program smooth_sem_pde nspec_inner_elastic,nspec_outer_elastic,phase_ispec_inner_elastic !use specfem_par_acoustic, only: ispec_is_acoustic !use specfem_par_poroelastic, only: ispec_is_poroelastic - use pml_par, only: is_CPML + use pml_par, only: is_CPML + + implicit none - implicit none integer, parameter :: NARGS = 7 integer, parameter :: PRINT_INFO_PER_STEP = 1000000 real(kind=CUSTOM_REAL), parameter :: CFL_CONST = 9.0 + real(kind=CUSTOM_REAL), dimension(:,:,:,:),allocatable :: dat !! spherical coordinate !! !real(kind=CUSTOM_REAL), dimension(:,:,:,:,:),allocatable :: rotate_r @@ -52,7 +82,6 @@ program smooth_sem_pde character(len=MAX_STRING_LEN*2) :: ks_file character(len=MAX_STRING_LEN*2) :: local_data_file - !character(len=MAX_STRING_LEN) :: kernel_names(MAX_KERNEL_NAMES) !character(len=MAX_STRING_LEN) :: kernel_names_comma_delimited character(len=MAX_STRING_LEN) :: kernel_name @@ -61,7 +90,7 @@ program smooth_sem_pde real(kind=CUSTOM_REAL) :: sigma_h, sigma_v, ch, cv, cmax real(kind=CUSTOM_REAL) :: min_val, max_val, min_val_glob, max_val_glob - + real(kind=CUSTOM_REAL) :: distance_min_glob,distance_max_glob real(kind=CUSTOM_REAL) :: elemsize_min_glob,elemsize_max_glob real(kind=CUSTOM_REAL) :: x_min_glob,x_max_glob @@ -78,7 +107,8 @@ program smooth_sem_pde real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_send_vector_ext_mesh_smooth real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_recv_vector_ext_mesh_smooth logical :: USE_GPU, SET_ZERO_IN_PML - + + ! initializes MPI call init_mpi() call world_size(sizeprocs) call world_rank(myrank) @@ -118,8 +148,8 @@ program smooth_sem_pde if (myrank == 0) then stop 'Please check command line arguments' endif - endif - + endif + read(arg(1),*) sigma_h read(arg(2),*) sigma_v kernel_name = arg(3) @@ -128,7 +158,7 @@ program smooth_sem_pde read(arg(6),*) USE_GPU read(arg(7),*) SET_ZERO_IN_PML - !call parse_kernel_names(kernel_names_comma_delimited,kernel_names,nker) + !call parse_kernel_names(kernel_names_comma_delimited,kernel_names,nker) call synchronize_all() ! user output if (myrank == 0) then @@ -210,7 +240,7 @@ program smooth_sem_pde cv = ch * (sigma_v ** 2) / (sigma_h ** 2) endif ntstep = int(ceiling((max(sigma_h,sigma_v)**2)/(2.0*cmax))) - + if (myrank == 0) print *, 'cv=', cv, 'ch=', ch, 'ntstep=', ntstep print *, jacobian_regular, xix_regular @@ -253,12 +283,12 @@ program smooth_sem_pde allocate(buffer_recv_vector_ext_mesh_smooth( & max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh),stat=ier) ! prepare assemble array - allocate(rvol(NGLOB_AB)) + allocate(rvol(NGLOB_AB)) rvol(:) = 0.0 allocate(rvol_local(NGLLX,NGLLY,NGLLZ,NSPEC_AB)) do ispec = 1, NSPEC_AB ispec_irreg = irregular_element_number(ispec) - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX weight = wxgll(i)*wygll(j)*wzgll(k) if (ispec_irreg /= 0) then jacobianl = jacobianstore(i,j,k,ispec_irreg) @@ -271,7 +301,7 @@ program smooth_sem_pde enddo;enddo;enddo enddo call assemble_MPI_scalar_blocking(NPROC,NGLOB_AB,rvol, & - num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh,& + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & my_neighbors_ext_mesh) rvol(:) = 1.0 / rvol(:) @@ -281,7 +311,7 @@ program smooth_sem_pde write(prname,'(a,i6.6,a)') trim(input_dir)//'/proc',myrank,'_' local_data_file = trim(prname) // trim(kernel_name) // '.bin' - open(unit = IIN,file = trim(local_data_file),status='old',action='read',& + open(unit = IIN,file = trim(local_data_file),status='old',action='read', & form ='unformatted',iostat=ier) if (ier /= 0) then print *,'Error opening data file: ',trim(local_data_file) @@ -290,32 +320,35 @@ program smooth_sem_pde read(IIN) dat close(IIN) - !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! project + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! project dat_glob(:) = 0.0 do ispec = 1, NSPEC_AB - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX iglob = ibool(i,j,k,ispec) - dat_glob(iglob) = dat_glob(iglob) + dat(i,j,k,ispec) & - * rvol_local(i,j,k,ispec) + dat_glob(iglob) = dat_glob(iglob) + dat(i,j,k,ispec) * rvol_local(i,j,k,ispec) enddo;enddo;enddo enddo - call assemble_MPI_send_smooth(NPROC,NGLOB_AB,& - dat_glob,buffer_send_vector_ext_mesh_smooth,& - buffer_recv_vector_ext_mesh_smooth,& - num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & - nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & - my_neighbors_ext_mesh, & - request_send_vector_ext_mesh,request_recv_vector_ext_mesh) - call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB,& - dat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& - max_nibool_interfaces_ext_mesh, & - nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & - request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & - my_neighbors_ext_mesh,myrank) + + call assemble_MPI_send_smooth(NPROC,NGLOB_AB, & + dat_glob,buffer_send_vector_ext_mesh_smooth, & + buffer_recv_vector_ext_mesh_smooth, & + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh) + call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB, & + dat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh, & + max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & + my_neighbors_ext_mesh,myrank) + if (myrank == 0) print *, 'Before smoothing: ' dat_glob(:) = dat_glob(:) * rvol(:) + min_val = minval(dat_glob) max_val = maxval(dat_glob) call min_all_cr(min_val, min_val_glob) @@ -326,16 +359,16 @@ program smooth_sem_pde print *, ' maxval:', max_val_glob if (myrank == 0) call cpu_time(tlast) endif - !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! broadcast glob array back to local array + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! broadcast glob array back to local array do ispec = 1, NSPEC_AB - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX iglob = ibool(i,j,k,ispec) dat(i,j,k,ispec) = dat_glob(iglob) enddo;enddo;enddo enddo - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do istep = 1, ntstep !if (myrank == 0) print *, istep @@ -348,18 +381,18 @@ program smooth_sem_pde endif do ispec_p = 1,num_elements ispec = phase_ispec_inner_elastic(ispec_p,iphase) - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX dat_elem(i,j,k) = dat(i,j,k,ispec) enddo; enddo; enddo select case (NGLLX) case (5) call mxm5_single(hprime_xx,m1,dat_elem,stemp1,m2) - call mxm5_3dmat_single(dat_elem,m1,hprime_xxT,m1,& + call mxm5_3dmat_single(dat_elem,m1,hprime_xxT,m1, & stemp2,NGLLX) call mxm5_single(dat_elem,m2,hprime_xxT,stemp3,m1) case default !! derivative along xi, eta, zeta - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX stemp1l = 0._CUSTOM_REAL stemp2l = 0._CUSTOM_REAL stemp3l = 0._CUSTOM_REAL @@ -377,7 +410,7 @@ program smooth_sem_pde ispec_irreg = irregular_element_number(ispec) if (ispec_irreg /= 0) then - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX xixl = xixstore(i,j,k,ispec_irreg) xiyl = xiystore(i,j,k,ispec_irreg) xizl = xizstore(i,j,k,ispec_irreg) @@ -388,7 +421,7 @@ program smooth_sem_pde gammayl = gammaystore(i,j,k,ispec_irreg) gammazl = gammazstore(i,j,k,ispec_irreg) jacobianl = jacobianstore(i,j,k,ispec_irreg) - + ! derivatives along x, y, z ddxl = xixl*stemp1(i,j,k) + etaxl*stemp2(i,j,k) + & gammaxl*stemp3(i,j,k) @@ -420,7 +453,7 @@ program smooth_sem_pde else xixl = xix_regular jacobianl = jacobian_regular - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX stemp1(i,j,k) = (& ch * xixl*xixl*stemp1(i,j,k)) * jacobianl stemp2(i,j,k) = (& @@ -433,11 +466,11 @@ program smooth_sem_pde select case (NGLLX) case (5) call mxm5_single(hprimewgll_xxT,m1,stemp1,snewtemp1,m2) - call mxm5_3dmat_single(stemp2,m1,hprimewgll_xx,m1,& + call mxm5_3dmat_single(stemp2,m1,hprimewgll_xx,m1, & snewtemp2,NGLLX) call mxm5_single(stemp3,m2,hprimewgll_xx,snewtemp3,m1) case default - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX stemp1l = 0._CUSTOM_REAL stemp2l = 0._CUSTOM_REAL stemp3l = 0._CUSTOM_REAL @@ -454,30 +487,31 @@ program smooth_sem_pde enddo;enddo;enddo end select - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX iglob = ibool(i,j,k,ispec) ddat_glob(iglob) = ddat_glob(iglob) - (& wgllwgll_yz_3D(i,j,k) * snewtemp1(i,j,k)+& wgllwgll_xz_3D(i,j,k) * snewtemp2(i,j,k)+& wgllwgll_xy_3D(i,j,k) * snewtemp3(i,j,k)) - enddo;enddo;enddo + enddo;enddo;enddo enddo ! ispec_p = 1, num_elements + !! assemble MPI if (iphase == 1) then - call assemble_MPI_send_smooth(NPROC,NGLOB_AB,& - ddat_glob,buffer_send_vector_ext_mesh_smooth,& - buffer_recv_vector_ext_mesh_smooth,& - num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & - nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & - my_neighbors_ext_mesh, & - request_send_vector_ext_mesh,request_recv_vector_ext_mesh) + call assemble_MPI_send_smooth(NPROC,NGLOB_AB, & + ddat_glob,buffer_send_vector_ext_mesh_smooth, & + buffer_recv_vector_ext_mesh_smooth, & + num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + my_neighbors_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh) else - call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB,& - ddat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& - max_nibool_interfaces_ext_mesh, & - nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & - request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & - my_neighbors_ext_mesh,myrank) + call assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB, & + ddat_glob,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh, & + max_nibool_interfaces_ext_mesh, & + nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & + request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & + my_neighbors_ext_mesh,myrank) endif !!!!!!!!!!!!!!!!! enddo !iphase = 1,2 @@ -485,6 +519,7 @@ program smooth_sem_pde ddat_glob(:) = ddat_glob(:) * rvol(:) !! update dat_glob(:) = dat_glob(:) + ddat_glob(:) + !! info if (mod(istep, PRINT_INFO_PER_STEP) == 0) then if (myrank == 0) print *, 'Step:', istep @@ -501,10 +536,11 @@ program smooth_sem_pde call cpu_time(tlast) endif endif + !!!!!!!!!!!!! !! broadcast glob array back to local array do ispec = 1, NSPEC_AB - do k=1,NGLLZ;do j=1,NGLLY;do i=1,NGLLX + do k = 1,NGLLZ;do j = 1,NGLLY;do i = 1,NGLLX iglob = ibool(i,j,k,ispec) !! mute everything in the PML domain if (SET_ZERO_IN_PML .and. is_CPML(ispec)) then @@ -516,10 +552,12 @@ program smooth_sem_pde !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! call synchronize_all() enddo + call synchronize_all() call cpu_time(t2) - if (myrank == 0) & + if (myrank == 0) & print *, 'Computation time with PDE-based smoothing on CPU:', t2-t1 + !! output ! file output ! smoothed kernel file name @@ -534,6 +572,7 @@ program smooth_sem_pde print *, ' minval:', min_val_glob print *, ' maxval:', max_val_glob endif + write(ks_file,'(a,i6.6,a)') trim(output_dir)//'/proc',myrank,'_'//trim(kernel_name)//'_smooth.bin' open(IOUT,file=trim(ks_file),status='unknown',form='unformatted',iostat=ier) if (ier /= 0) stop 'Error opening smoothed kernel file' @@ -542,7 +581,7 @@ program smooth_sem_pde if (myrank == 0) print *,'written: ',trim(ks_file) deallocate(ibool,irregular_element_number) - deallocate(xixstore,xiystore,xizstore,etaxstore,etaystore,etazstore,& + deallocate(xixstore,xiystore,xizstore,etaxstore,etaystore,etazstore, & gammaxstore,gammaystore,gammazstore,jacobianstore) !! spherical coordinate !! !deallocate(rotate_r) @@ -551,11 +590,9 @@ program smooth_sem_pde deallocate(buffer_send_vector_ext_mesh_smooth, & buffer_recv_vector_ext_mesh_smooth) deallocate(rvol, rvol_local) - call finalize_mpi() - contains subroutine mxm5_single(A,n1,B,C,n3) @@ -637,12 +674,16 @@ subroutine mxm5_3dmat_single(A,n1,B,n2,C,n3) enddo end subroutine mxm5_3dmat_single - + end program smooth_sem_pde - subroutine assemble_MPI_send_smooth(NPROC,NGLOB_AB,& - array_val,buffer_send_vector_ext_mesh_smooth,& - buffer_recv_vector_ext_mesh_smooth,& +! +!------------------------------------------------------------------------------------------------- +! + + subroutine assemble_MPI_send_smooth(NPROC,NGLOB_AB, & + array_val,buffer_send_vector_ext_mesh_smooth, & + buffer_recv_vector_ext_mesh_smooth, & num_interfaces_ext_mesh,max_nibool_interfaces_ext_mesh, & nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & my_neighbors_ext_mesh, & @@ -706,9 +747,12 @@ subroutine assemble_MPI_send_smooth(NPROC,NGLOB_AB,& end subroutine assemble_MPI_send_smooth +! +!------------------------------------------------------------------------------------------------- +! subroutine assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB, & - array_val,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh,& + array_val,buffer_recv_vector_ext_mesh_smooth,num_interfaces_ext_mesh, & max_nibool_interfaces_ext_mesh, & nibool_interfaces_ext_mesh,ibool_interfaces_ext_mesh, & request_send_vector_ext_mesh,request_recv_vector_ext_mesh, & From 0f6158400156aa30bbf2e7fe5857c3a03c24430f Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 12 Aug 2024 10:39:08 +0200 Subject: [PATCH 43/56] removes unused parameters; updates compilation rules --- src/tomography/postprocess_sensitivity_kernels/rules.mk | 2 ++ .../postprocess_sensitivity_kernels/smooth_sem_pde.F90 | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tomography/postprocess_sensitivity_kernels/rules.mk b/src/tomography/postprocess_sensitivity_kernels/rules.mk index 49d42ec84..2e054dbe3 100644 --- a/src/tomography/postprocess_sensitivity_kernels/rules.mk +++ b/src/tomography/postprocess_sensitivity_kernels/rules.mk @@ -42,12 +42,14 @@ tomography/postprocess_sensitivity_kernels_OBJECTS = \ $(xclip_sem_OBJECTS) \ $(xcombine_sem_OBJECTS) \ $(xsmooth_sem_OBJECTS) \ + $(xsmooth_sem_pde_OBJECTS) \ $(EMPTY_MACRO) tomography/postprocess_sensitivity_kernels_SHARED_OBJECTS = \ $(xclip_sem_SHARED_OBJECTS) \ $(xcombine_sem_SHARED_OBJECTS) \ $(xsmooth_sem_SHARED_OBJECTS) \ + $(xsmooth_sem_pde_SHARED_OBJECTS) \ $(EMPTY_MACRO) tomography/postprocess_sensitivity_kernels_MODULES = \ diff --git a/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 index d59fab115..c60d765d4 100644 --- a/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 +++ b/src/tomography/postprocess_sensitivity_kernels/smooth_sem_pde.F90 @@ -46,9 +46,7 @@ program smooth_sem_pde - use constants, only: HUGEVAL, m1, m2 - use postprocess_par, only: CUSTOM_REAL,NGLLX,NGLLY,NGLLZ,NDIM,NGLLSQUARE, & - MAX_STRING_LEN,IIN,IOUT,GAUSSALPHA,GAUSSBETA,PI,TWO_PI + use constants, only: m1, m2, CUSTOM_REAL,NGLLX,NGLLY,NGLLZ, MAX_STRING_LEN,IIN,IOUT use specfem_par use specfem_par_elastic, only: & !ispec_is_elastic, & @@ -760,7 +758,7 @@ subroutine assemble_MPI_w_ord_smooth(NPROC,NGLOB_AB, & ! waits for data to receive and assembles - use constants, only: CUSTOM_REAL, itag + use constants, only: CUSTOM_REAL implicit none From e21caa60256ef92b25125df084cb7e6b793098e7 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Mon, 26 Aug 2024 16:41:04 +0200 Subject: [PATCH 44/56] updates doc --- doc/USER_MANUAL/02_getting_started.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/USER_MANUAL/02_getting_started.tex b/doc/USER_MANUAL/02_getting_started.tex index 530fe8406..b50309c11 100644 --- a/doc/USER_MANUAL/02_getting_started.tex +++ b/doc/USER_MANUAL/02_getting_started.tex @@ -505,6 +505,9 @@ \section{Visualizing the subroutine calling tree of the source code} \section{Becoming a developer of the code, or making small modifications in the source code} %-----------------------------------------------------------------------------------------------------------------------------------% -If you want to develop new features in the code, and/or if you want to make small changes, improvements, or bug fixes, you are very welcome to contribute. To do so, i.e. to access the development branch of the source code with read/write access (in a safe way, no need to worry too much about breaking the package, there are CI tests based on BuildBot, Travis-CI and Jenkins in place that are checking and validating all new contributions and changes), please visit this Web page:\newline +If you want to develop new features in the code, and/or if you want to make small changes, improvements, or bug fixes, you are very welcome to contribute! +To do so, i.e. to access the development branch of the source code with read/write access (in a safe way, no need to worry too much about breaking the package, +there are CI tests based on BuildBot, Travis-CI and Jenkins in place that are checking and validating all new contributions and changes), +please visit this Web page:\newline \url{https://github.com/SPECFEM/specfem3d/wiki} From 93cc8a24860c5213b490aa77c1ff9a627adb05a2 Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Wed, 11 Sep 2024 08:25:13 -0600 Subject: [PATCH 45/56] replace hdf5 io collective flag to shared param --- src/generate_databases/read_partition_files_hdf5.F90 | 2 +- src/generate_databases/save_arrays_solver_hdf5.F90 | 8 ++++++-- src/shared/hdf5_manager.F90 | 10 ++++++++-- src/shared/shared_par.F90 | 3 +++ src/specfem3D/read_mesh_databases_hdf5.F90 | 9 ++++++++- src/specfem3D/write_movie_output_HDF5.F90 | 12 ++++++++++-- 6 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/generate_databases/read_partition_files_hdf5.F90 b/src/generate_databases/read_partition_files_hdf5.F90 index ac62dde7c..2db20bc5a 100644 --- a/src/generate_databases/read_partition_files_hdf5.F90 +++ b/src/generate_databases/read_partition_files_hdf5.F90 @@ -195,7 +195,7 @@ subroutine read_partition_files_hdf5() if (ier /= 0) stop 'Error allocating array nodes_coords_ext_mesh' nodes_coords_ext_mesh(:,:) = 0.0 - call h5_read_dataset_collect_hyperslab(dsetname, nodes_coords_ext_mesh, (/0,sum(offset_nnodes(0:myrank-1))/),.true.) + call h5_read_dataset_collect_hyperslab(dsetname, nodes_coords_ext_mesh, (/0,sum(offset_nnodes(0:myrank-1))/),.true.) !!!!!!!!!!!!!! call sum_all_i(nnodes_ext_mesh,num) if (myrank == 0) then diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index 84bc5d9e8..2b16d2966 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -35,7 +35,8 @@ subroutine save_arrays_solver_mesh_hdf5() use shared_parameters, only: ACOUSTIC_SIMULATION, ELASTIC_SIMULATION, POROELASTIC_SIMULATION, & APPROXIMATE_OCEAN_LOAD, ANISOTROPY, & - COUPLE_WITH_INJECTION_TECHNIQUE, MESH_A_CHUNK_OF_THE_EARTH,NPROC + COUPLE_WITH_INJECTION_TECHNIQUE, MESH_A_CHUNK_OF_THE_EARTH,NPROC, & + HDF5_IO_COLLECTIVE ! global indices use generate_databases_par, only: NSPEC_AB, ibool, NGLOB_AB @@ -86,7 +87,7 @@ subroutine save_arrays_solver_mesh_hdf5() integer :: info, comm ! if collective write - logical, parameter :: if_col = .true. + logical :: if_col = .true. ! hdf5 valiables character(len=64) :: dset_name, tempstr @@ -135,6 +136,9 @@ subroutine save_arrays_solver_mesh_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy + ! use global setting for io mode + if_col = HDF5_IO_COLLECTIVE + ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 3a0427ef6..afca09649 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -562,7 +562,7 @@ end subroutine read_attenuation_file_hdf5 subroutine write_checkmesh_data_hdf5(dset_name,dump_array) #if defined(USE_HDF5) - use shared_parameters, only: LOCAL_PATH, NPROC + use shared_parameters, only: LOCAL_PATH, NPROC, HDF5_IO_COLLECTIVE use constants, only: myrank #endif @@ -584,6 +584,12 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! flag if dataset exists logical :: exists = .false. + ! io mode + logical :: if_collective = .true. + + ! use global settings for collective IO + if_collective = HDF5_IO_COLLECTIVE + ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) @@ -614,7 +620,7 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! open file call h5_open_file_p_collect(filename) - call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/),.true.) + call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), if_collective) call h5_close_file_p() call h5_finalize() diff --git a/src/shared/shared_par.F90 b/src/shared/shared_par.F90 index 92f50d866..bb424dbb3 100644 --- a/src/shared/shared_par.F90 +++ b/src/shared/shared_par.F90 @@ -192,6 +192,9 @@ module shared_input_parameters ! number of io dedicated nodes integer :: HDF5_IO_NODES = 0 + ! HDF5 IO writing mode (collective or independent) + logical :: HDF5_IO_COLLECTIVE = .true. + ! flag for io-dedicated/compute node. logical :: IO_storage_task = .false. logical :: IO_compute_task = .true. diff --git a/src/specfem3D/read_mesh_databases_hdf5.F90 b/src/specfem3D/read_mesh_databases_hdf5.F90 index e09a4ec01..514ef24d1 100644 --- a/src/specfem3D/read_mesh_databases_hdf5.F90 +++ b/src/specfem3D/read_mesh_databases_hdf5.F90 @@ -34,6 +34,7 @@ subroutine read_mesh_for_init_hdf5() #ifdef USE_HDF5 use specfem_par use manager_hdf5 + use shared_parameters, only: HDF5_IO_COLLECTIVE implicit none ! Local variables @@ -47,6 +48,9 @@ subroutine read_mesh_for_init_hdf5() ! if collective read logical :: if_col = .true. + ! overwrite the io mode by global variable + if_col = HDF5_IO_COLLECTIVE + if (I_should_read_the_database) then ! set file name tempstr = "/external_mesh.h5" @@ -127,7 +131,7 @@ subroutine read_mesh_databases_hdf5() integer :: info, comm ! if collective read - logical :: if_col = .true. + logical :: if_col ! offset arrays integer, dimension(0:NPROC-1) :: offset_nglob @@ -163,6 +167,9 @@ subroutine read_mesh_databases_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy + ! overwrite the io mode by global variable + if_col = HDF5_IO_COLLECTIVE + ! user output if (myrank == 0) then write(IMAIN,*) "Reading mesh databases..." diff --git a/src/specfem3D/write_movie_output_HDF5.F90 b/src/specfem3D/write_movie_output_HDF5.F90 index 7fcd4add3..1d8038f09 100644 --- a/src/specfem3D/write_movie_output_HDF5.F90 +++ b/src/specfem3D/write_movie_output_HDF5.F90 @@ -1033,6 +1033,7 @@ end subroutine wmo_movie_save_volume_snapshot_hdf5 subroutine prepare_vol_movie_hdf5() use specfem_par_movie_hdf5 + use shared_parameters, only: HDF5_IO_COLLECTIVE implicit none @@ -1042,7 +1043,10 @@ subroutine prepare_vol_movie_hdf5() integer :: iproc, ier, nglob_all, nspec_all character(len=MAX_STRING_LEN) :: fname_h5_data_vol - logical,parameter :: if_collective = .true. + logical :: if_collective = .true. + + ! overwrite with global values + if_collective = HDF5_IO_COLLECTIVE allocate(nglob_par_proc_nio(0:NPROC-1), stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array nglob_par_proc') @@ -1144,6 +1148,7 @@ end subroutine prepare_vol_movie_hdf5 subroutine write_vol_data_hdf5(darr, dset_name) use specfem_par_movie_hdf5 + use shared_parameters, only: HDF5_IO_COLLECTIVE implicit none @@ -1156,7 +1161,10 @@ subroutine write_vol_data_hdf5(darr, dset_name) character(len=MAX_STRING_LEN) :: fname_h5_data_vol integer, parameter :: rank = 1 - logical, parameter :: if_collective = .true. + logical :: if_collective = .true. + + ! overwrite with global values + if_collective = HDF5_IO_COLLECTIVE fname_h5_data_vol = trim(OUTPUT_FILES) // "/movie_volume.h5" From 756bab1e03af062bf28dc16177f8a1d79df85d0e Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Wed, 11 Sep 2024 11:03:26 -0600 Subject: [PATCH 46/56] remove unncessary local variable --- .../save_arrays_solver_hdf5.F90 | 390 +++++++++-------- src/shared/hdf5_manager.F90 | 8 +- src/specfem3D/read_mesh_databases_hdf5.F90 | 393 +++++++++--------- src/specfem3D/write_movie_output_HDF5.F90 | 19 +- 4 files changed, 389 insertions(+), 421 deletions(-) diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index 2b16d2966..9c6012918 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -86,9 +86,6 @@ subroutine save_arrays_solver_mesh_hdf5() ! MPI variables integer :: info, comm - ! if collective write - logical :: if_col = .true. - ! hdf5 valiables character(len=64) :: dset_name, tempstr @@ -136,9 +133,6 @@ subroutine save_arrays_solver_mesh_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy - ! use global setting for io mode - if_col = HDF5_IO_COLLECTIVE - ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) @@ -898,149 +892,149 @@ subroutine save_arrays_solver_mesh_hdf5() call flush_IMAIN() endif - ! set dwrite flagif_colto pre_define the dataset on file before write. + ! set dwrite flagHDF5_IO_COLLECTIVEto pre_define the dataset on file before write. dset_name = "nspec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_ab/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_ab/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nglob" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nglob_ab/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,(/nglob_ab/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec_irregular" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_irregular/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_irregular/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "ibool" ! 4 i (/0,0,0, offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "xstore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,xstore_unique,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,xstore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "ystore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,ystore_unique,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,ystore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "zstore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,zstore_unique,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,zstore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "irregular_element_number" ! 1 i (/offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "xix_regular" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/xix_regular/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,(/xix_regular/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "jacobian_regular" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/jacobian_regular/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,(/jacobian_regular/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "kappastore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "mustore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "ispec_is_acoustic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "ispec_is_elastic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "ispec_is_poroelastic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) ! acoustic if (ACOUSTIC_SIMULATION) then dset_name = "rmass_acoustic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif ! this array is needed for acoustic simulations but also for elastic simulations with CPML, ! thus we allocate it and read it in all cases (whether the simulation is acoustic, elastic, or acoustic/elastic) dset_name = "rhostore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) ! elastic if (ELASTIC_SIMULATION) then dset_name = "rmass" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass, (/sum(offset_nglob(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmass, (/sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) if (APPROXIMATE_OCEAN_LOAD) then dset_name = "rmass_ocean_load" ! 1 r (/offset_nglob_ocean/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif !pll Stacey dset_name = "rho_vp" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rho_vs" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif ! poroelastic if (POROELASTIC_SIMULATION) then dset_name = "rmass_solid_poroelastic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rmass_fluid_poroelastic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rhoarraystore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "kappaarraystore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, kappaarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, kappaarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "etastore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "tortstore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "permstore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "phistore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rho_vpI" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rho_vpII" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rho_vsI" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif ! C-PML absorbing boundary conditions if (PML_CONDITIONS) then dset_name = "nspec_cpml" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_cpml/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_cpml/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "CPML_width_x" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_x/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_x/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "CPML_width_y" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_y/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_y/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "CPML_width_z" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_z/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_z/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "min_distance_between_CPML_parameter" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/min_distance_between_CPML_parameter/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/min_distance_between_CPML_parameter/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_nspeccpml) > 0) then dset_name = "CPML_regions" ! 1 i (/offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "CPML_to_spec" ! 1 i (/offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "is_CPML" ! 1 l (/offset_nspecab/) - call h5_write_dataset_collect_hyperslab(dset_name, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "d_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "d_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "d_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "k_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "k_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "k_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "alpha_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "alpha_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "alpha_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) ! -------------------------------------------------------------------------------------------- ! for adjoint tomography @@ -1048,18 +1042,18 @@ subroutine save_arrays_solver_mesh_hdf5() ! -------------------------------------------------------------------------------------------- if ((SIMULATION_TYPE == 1 .and. SAVE_FORWARD) .or. SIMULATION_TYPE == 3) then dset_name = "nglob_interface_PML_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_acoustic/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_acoustic/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nglob_interface_PML_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_elastic/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_elastic/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_nglob_interface_PML_acoustic) > 0) then dset_name = "points_interface_PML_acoustic" ! 1 i (/offset_nglob_interface_PML_acoustic/) call h5_write_dataset_collect_hyperslab(dset_name, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),if_col) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nglob_interface_PML_elastic) > 0) then dset_name = "points_interface_PML_elastic" ! 1 i (/offset_nglob_interface_PML_elastic/) call h5_write_dataset_collect_hyperslab(dset_name, & - points_interface_PML_elastic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),if_col) + points_interface_PML_elastic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif endif endif @@ -1067,348 +1061,348 @@ subroutine save_arrays_solver_mesh_hdf5() ! absorbing boundary surface dset_name = "num_abs_boundary_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_abs_boundary_faces/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_abs_boundary_faces/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_abs_boundary_faces) > 0) then dset_name = "abs_boundary_ispec" ! 1 i (/offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_ispec, & - (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),if_col) + (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_ijk" ! 3 i (/0,0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_ijk, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_jacobian2Dw" ! 2 r (/0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_jacobian2Dw, & - (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_normal" ! 3 r (/0,0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_normal, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) if (STACEY_ABSORBING_CONDITIONS .and. (.not. PML_CONDITIONS)) then ! store mass matrix contributions if (ELASTIC_SIMULATION) then dset_name = "rmassx" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassx, (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmassx, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rmassy" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassy, (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmassy, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "rmassz" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassz, (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmassz, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (ACOUSTIC_SIMULATION) then dset_name = "rmassz_acoustic" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassz_acoustic, (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, rmassz_acoustic, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif endif else dset_name = "abs_boundary_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "abs_boundary_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) if (STACEY_ABSORBING_CONDITIONS .and. (.not. PML_CONDITIONS)) then ! store mass matrix contributions if (ELASTIC_SIMULATION) then dset_name = "rmassx" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "rmassy" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "rmassz" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) endif if (ACOUSTIC_SIMULATION) then dset_name = "rmassz_acoustic" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) endif endif endif dset_name = "nspec2D_xmin" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmin/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmin/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec2D_xmax" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmax/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmax/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec2D_ymin" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymin/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymin/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec2D_ymax" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymax/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymax/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "NSPEC2D_BOTTOM" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_bottom/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_bottom/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "NSPEC2D_TOP" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_top/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_top/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_nspec2D_xmin) > 0) then dset_name = "ibelm_xmin" ! 1 i (/offset_nspec2D_xmin/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_xmax) > 0) then dset_name = "ibelm_xmax" ! 1 i (/offset_nspec2D_xmax/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_ymin) > 0) then dset_name = "ibelm_ymin" ! 1 i (/offset_nspec2D_ymin/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_ymax) > 0) then dset_name = "ibelm_ymax" ! 1 i (/offset_nspec2D_ymax/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_bottom_ext) > 0) then dset_name = "ibelm_bottom" ! 1 i (/offset_nspec2D_bottom_ext/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_top_ext) > 0) then dset_name = "ibelm_top" ! 1 i (/offset_nspec2D_top_ext/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif ! free surface dset_name = "num_free_surface_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_free_surface_faces/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_free_surface_faces/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_free_surface_faces) > 0) then dset_name = "free_surface_ispec" ! 1 i (/offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_ispec, & - (/sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_ijk" ! 3 i (/0,0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_ijk, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_jacobian2Dw" ! 2 r (/0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_jacobian2Dw, & - (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_normal" ! 3 r (/0,0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_normal, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) else dset_name = "free_surface_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "free_surface_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) endif ! acoustic-elastic coupling surface dset_name = "num_coupling_ac_el_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_el_faces/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_el_faces/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_coupling_ac_el_faces) > 0) then dset_name = "coupling_ac_el_ispec" ! 1 i (/offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_ispec, & - (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_ijk" ! 3 i (/0,0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_ijk, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_jacobian2Dw" ! 2 r (/0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_normal" ! 3 r (/0,0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_normal, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) else dset_name = "coupling_ac_el_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_el_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) endif ! acoustic-poroelastic coupling surface dset_name = "num_coupling_ac_po_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_po_faces/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_po_faces/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_coupling_ac_po_faces) > 0) then dset_name = "coupling_ac_po_ispec" ! 1 i (/offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_ispec, & - (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_ijk" ! 3 i (/0,0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_ijk, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_jacobian2Dw" ! 2 r (/0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_normal" ! 3 r (/0,0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_normal, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_ac_po_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) endif ! elastic-poroelastic coupling surface dset_name = "num_coupling_el_po_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_el_po_faces/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_el_po_faces/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_coupling_el_po_faces) > 0) then dset_name = "coupling_el_po_ispec" ! 1 i (/offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_po_el_ispec" ! 1 i (/offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_po_el_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_ijk" ! 3 i (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_po_el_ijk" ! 3 i (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_po_el_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_jacobian2Dw" ! 2 r (/0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_normal" ! 3 r (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_normal, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) else dset_name = "coupling_el_po_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_po_el_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_po_el_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) dset_name = "coupling_el_po_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) endif dset_name = "num_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_interfaces_ext_mesh/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_interfaces_ext_mesh/), (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_interfaces_ext_mesh) > 0) then dset_name = "max_nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/max_nibool_interfaces_ext_mesh/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/max_nibool_interfaces_ext_mesh/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "my_neighbors_ext_mesh" ! 1 i (/offset_num_interfaces_ext_mesh/) call h5_write_dataset_collect_hyperslab(dset_name, my_neighbors_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "nibool_interfaces_ext_mesh" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, nibool_interfaces_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) dset_name = "ibool_interfaces_ext_mesh_dummy" ! 2 i (/offset_max_ni_bool_interfaces_ext_mesh/) call h5_write_dataset_collect_hyperslab(dset_name, ibool_interfaces_ext_mesh_dummy, & - (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) else dset_name = "max_nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "my_neighbors_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) dset_name = "ibool_interfaces_ext_mesh_dummy" ! 2 i (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy, (/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy, (/myrank/),HDF5_IO_COLLECTIVE) endif ! anisotropy if (ELASTIC_SIMULATION .and. ANISOTROPY) then dset_name = "c11store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c12store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c13store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c14store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c15store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c16store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c22store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c23store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c24store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c25store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c26store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c33store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c34store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c35store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c36store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c44store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c45store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c46store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c55store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c56store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "c66store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif ! inner/outer elements dset_name = "ispec_is_inner" ! 1 l (/offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) if (ACOUSTIC_SIMULATION) then dset_name = "nspec_inner_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_acoustic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec_outer_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_acoustic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_phase_ispec_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_acoustic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_phase_ispec_acoustic) > 0) then dset_name = "phase_ispec_inner_acoustic" ! 2 i (/offset_num_phase_ispec_acoustic, 0/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_acoustic, & - (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) else dset_name = "phase_ispec_inner_acoustic" ! 2 i (/myrank,0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) endif endif if (ELASTIC_SIMULATION) then dset_name = "nspec_inner_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_elastic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec_outer_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_elastic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_phase_ispec_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_elastic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_phase_ispec_elastic) > 0) then dset_name = "phase_ispec_inner_elastic" ! 2 i (/offset_num_phase_ispec_elastic,0/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_elastic, & - (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) else dset_name = "phase_ispec_inner_elastic" ! 2 i (/myrank, 0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) endif endif if (POROELASTIC_SIMULATION) then dset_name = "nspec_inner_poroelastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_poroelastic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_poroelastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "nspec_outer_poroelastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_poroelastic/),(/myrank/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_poroelastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_phase_ispec_poroelastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_poroelastic/), & - (/myrank/),if_col) + (/myrank/),HDF5_IO_COLLECTIVE) if (sum(offset_num_phase_ispec_poroelastic) > 0) then dset_name = "phase_ispec_inner_poroelastic" ! 2 i (/offset_num_phase_ispec_poroelastic/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_poroelastic, & - (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) dset_name = "phase_ispec_inner_poroelastic" ! 2 i (/myrank,0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),if_col) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) endif endif @@ -1417,51 +1411,51 @@ subroutine save_arrays_solver_mesh_hdf5() if (ACOUSTIC_SIMULATION) then dset_name = "num_colors_outer_acoustic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_outer_acoustic/),(/myrank/),if_col) + (/num_colors_outer_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_colors_inner_acoustic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_inner_acoustic/),(/myrank/),if_col) + (/num_colors_inner_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_elem_colors_acoustic" ! 1 i (/offset_num_colors_outer_acoustic+num_colors_inner_acoustic/) call h5_write_dataset_collect_hyperslab(dset_name, & - num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),if_col) + num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (ELASTIC_SIMULATION) then dset_name = "num_colors_outer_elastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_outer_elastic/),(/myrank/),if_col) + (/num_colors_outer_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_colors_inner_elastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_inner_elastic/),(/myrank/),if_col) + (/num_colors_inner_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) dset_name = "num_elem_colors_elastic" ! 1 i (/offset_num_colors_outer_elastic+num_colors_inner_elastic/) call h5_write_dataset_collect_hyperslab(dset_name, num_elem_colors_elastic, & - (/sum(offset_num_colors_elastic(0:myrank-1))/),if_col) + (/sum(offset_num_colors_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif endif ! surface points dset_name = "nfaces_surface" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nfaces_surface/), (/myrank/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/nfaces_surface/), (/myrank/), HDF5_IO_COLLECTIVE) dset_name = "ispec_is_surface_external_mesh" ! 1 l (/offset_nspec_ab/) call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_surface_external_mesh, & - (/sum(offset_nspec_ab(0:myrank-1))/), if_col) + (/sum(offset_nspec_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "iglob_is_surface_external_mesh" ! 1 l (/offset_nglob_ab/) call h5_write_dataset_collect_hyperslab(dset_name, iglob_is_surface_external_mesh, & - (/sum(offset_nglob_ab(0:myrank-1))/), if_col) + (/sum(offset_nglob_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) ! mesh adjacency dset_name = "num_neighbors_all" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_neighbors_all/), (/myrank/), if_col) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_neighbors_all/), (/myrank/), HDF5_IO_COLLECTIVE) dset_name = "neighbors_xadj" ! 1 i (/offset_nspec_ab+1/) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_xadj, & - (/sum(offset_neighbors_xadj(0:myrank-1))/), if_col) + (/sum(offset_neighbors_xadj(0:myrank-1))/), HDF5_IO_COLLECTIVE) dset_name = "neighbors_adjncy" ! 1 i (/offset_num_neighbors_all/) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), if_col) + (/sum(offset_neighbors_adjncy(0:myrank-1))/), HDF5_IO_COLLECTIVE) ! arrays for visualization dset_name = "spec_elm_conn_xdmf" ! 2 i (/0,offset_nspec*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/) call h5_write_dataset_collect_hyperslab(dset_name, spec_elm_conn_xdmf, & - (/0,sum(offset_nspec(0:myrank-1))*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/), if_col) + (/0,sum(offset_nspec(0:myrank-1))*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/), HDF5_IO_COLLECTIVE) ! stores arrays in binary files !if (SAVE_MESH_FILES) then diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index afca09649..91691c30d 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -584,12 +584,6 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! flag if dataset exists logical :: exists = .false. - ! io mode - logical :: if_collective = .true. - - ! use global settings for collective IO - if_collective = HDF5_IO_COLLECTIVE - ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) @@ -620,7 +614,7 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! open file call h5_open_file_p_collect(filename) - call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), if_collective) + call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), HDF5_IO_COLLECTIVE) call h5_close_file_p() call h5_finalize() diff --git a/src/specfem3D/read_mesh_databases_hdf5.F90 b/src/specfem3D/read_mesh_databases_hdf5.F90 index 514ef24d1..7b3f5e401 100644 --- a/src/specfem3D/read_mesh_databases_hdf5.F90 +++ b/src/specfem3D/read_mesh_databases_hdf5.F90 @@ -45,12 +45,6 @@ subroutine read_mesh_for_init_hdf5() ! MPI variables integer :: info, comm - ! if collective read - logical :: if_col = .true. - - ! overwrite the io mode by global variable - if_col = HDF5_IO_COLLECTIVE - if (I_should_read_the_database) then ! set file name tempstr = "/external_mesh.h5" @@ -69,13 +63,13 @@ subroutine read_mesh_for_init_hdf5() ! read datasets dsetname = "nspec" !call h5_read_dataset_p_scalar(dsetname, NSPEC_AB) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nglob" !call h5_read_dataset_p_scalar(dsetname, NGLOB_AB) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec_irregular" !call h5_read_dataset_p_scalar(dsetname, NSPEC_IRREGULAR) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),HDF5_IO_COLLECTIVE) ! close hdf5 call h5_close_file() @@ -130,9 +124,6 @@ subroutine read_mesh_databases_hdf5() ! MPI variables integer :: info, comm - ! if collective read - logical :: if_col - ! offset arrays integer, dimension(0:NPROC-1) :: offset_nglob integer, dimension(0:NPROC-1) :: offset_nspec @@ -167,8 +158,6 @@ subroutine read_mesh_databases_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy - ! overwrite the io mode by global variable - if_col = HDF5_IO_COLLECTIVE ! user output if (myrank == 0) then @@ -197,80 +186,80 @@ subroutine read_mesh_databases_hdf5() call h5_open_file_p_collect(database_hdf5) ! gets offsets - call h5_read_dataset_collect_hyperslab("offset_nglob",offset_nglob, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec",offset_nspec, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec_irregular",offset_nspec_irregular, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nglob",offset_nglob, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec",offset_nspec, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec_irregular",offset_nspec_irregular, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmin",offset_nspec2D_xmin, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmax",offset_nspec2D_xmax, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymin",offset_nspec2D_ymin, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymax",offset_nspec2D_ymax, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_bottom_ext",offset_nspec2D_bottom_ext, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_top_ext",offset_nspec2D_top_ext, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmin",offset_nspec2D_xmin, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmax",offset_nspec2D_xmax, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymin",offset_nspec2D_ymin, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymax",offset_nspec2D_ymax, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_bottom_ext",offset_nspec2D_bottom_ext, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_top_ext",offset_nspec2D_top_ext, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec_ab",offset_nspec_ab, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_nglob_ab",offset_nglob_ab, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nspec_ab",offset_nspec_ab, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nglob_ab",offset_nglob_ab, (/0/), HDF5_IO_COLLECTIVE) ! mesh adjacency - call h5_read_dataset_collect_hyperslab("offset_neighbors_xadj",offset_neighbors_xadj, (/0/), if_col) - call h5_read_dataset_collect_hyperslab("offset_neighbors_adjncy",offset_neighbors_adjncy, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_neighbors_xadj",offset_neighbors_xadj, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_neighbors_adjncy",offset_neighbors_adjncy, (/0/), HDF5_IO_COLLECTIVE) ! info about external mesh simulation dsetname = "nspec" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nglob" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec_irregular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "ibool" - call h5_read_dataset_collect_hyperslab(dsetname, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "xstore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,xstore,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,xstore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "ystore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,ystore,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,ystore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "zstore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,zstore,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,zstore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "irregular_element_number" - call h5_read_dataset_collect_hyperslab(dsetname,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "xix_regular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,xix_regular,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,xix_regular,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "jacobian_regular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,jacobian_regular,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,jacobian_regular,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "xixstore" - call h5_read_dataset_collect_hyperslab(dsetname,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "xiystore" - call h5_read_dataset_collect_hyperslab(dsetname,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "xizstore" - call h5_read_dataset_collect_hyperslab(dsetname,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "etaxstore" - call h5_read_dataset_collect_hyperslab(dsetname,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "etaystore" - call h5_read_dataset_collect_hyperslab(dsetname,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "etazstore" - call h5_read_dataset_collect_hyperslab(dsetname,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "gammaxstore" - call h5_read_dataset_collect_hyperslab(dsetname,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "gammaystore" - call h5_read_dataset_collect_hyperslab(dsetname,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "gammazstore" - call h5_read_dataset_collect_hyperslab(dsetname,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "jacobianstore" - call h5_read_dataset_collect_hyperslab(dsetname,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "ispec_is_acoustic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "ispec_is_elastic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "ispec_is_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "kappastore" - call h5_read_dataset_collect_hyperslab(dsetname,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "mustore" - call h5_read_dataset_collect_hyperslab(dsetname,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(NSPEC_AB, 1) @@ -361,7 +350,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmass_acoustic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rmass_acoustic) > 0) call bcast_all_cr_for_database(rmass_acoustic(1), size(rmass_acoustic)) @@ -377,7 +366,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rhostore" !call h5_read_dataset_p(dsetname, rhostore) - call h5_read_dataset_collect_hyperslab(dsetname, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif call bcast_all_cr_for_database(rhostore(1,1,1,1), size(rhostore)) @@ -541,7 +530,7 @@ subroutine read_mesh_databases_hdf5() ! reads mass matrices if (I_should_read_the_database) then dsetname = "rmass" - call h5_read_dataset_collect_hyperslab(dsetname, rmass, (/sum(offset_nglob(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rmass, (/sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif call bcast_all_cr_for_database(rmass(1), size(rmass)) if (ier /= 0) stop 'Error reading in array rmass' @@ -554,9 +543,9 @@ subroutine read_mesh_databases_hdf5() rmass_ocean_load(:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nglob_ocean",offset_nglob_ocean, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nglob_ocean",offset_nglob_ocean, (/0/), HDF5_IO_COLLECTIVE) dsetname = "rmass_ocean_load" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rmass_ocean_load) > 0) call bcast_all_cr_for_database(rmass_ocean_load(1), size(rmass_ocean_load)) else @@ -569,12 +558,12 @@ subroutine read_mesh_databases_hdf5() !pll material parameters for stacey conditions if (I_should_read_the_database) then dsetname = "rho_vp" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rho_vp) > 0) call bcast_all_cr_for_database(rho_vp(1,1,1,1), size(rho_vp)) if (I_should_read_the_database) then dsetname = "rho_vs" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rho_vs) > 0) call bcast_all_cr_for_database(rho_vs(1,1,1,1), size(rho_vs)) @@ -686,30 +675,30 @@ subroutine read_mesh_databases_hdf5() epsilons_trace_over_3(:,:,:,:) = 0.0_CUSTOM_REAL; epsilonw_trace_over_3(:,:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspecporo",offset_nspecporo, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nspecporo",offset_nspecporo, (/0/), HDF5_IO_COLLECTIVE) dsetname = "rmass_solid_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rmass_fluid_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rhoarraystore" - call h5_read_dataset_collect_hyperslab(dsetname, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "kappaarraystore" call h5_read_dataset_collect_hyperslab(dsetname, kappaarraystore, & - (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "etastore" - call h5_read_dataset_collect_hyperslab(dsetname, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "tortstore" - call h5_read_dataset_collect_hyperslab(dsetname, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "permstore" - call h5_read_dataset_collect_hyperslab(dsetname, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "phistore" - call h5_read_dataset_collect_hyperslab(dsetname, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rho_vpI" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rho_vpII" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rho_vsI" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rmass_solid_poroelastic) > 0) & call bcast_all_cr_for_database(rmass_solid_poroelastic(1), size(rmass_solid_poroelastic)) @@ -765,17 +754,17 @@ subroutine read_mesh_databases_hdf5() if (PML_CONDITIONS) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspeccpml",offset_nspeccpml, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nspeccpml",offset_nspeccpml, (/0/), HDF5_IO_COLLECTIVE) dsetname = "nspec_cpml" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_CPML, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_CPML, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "CPML_width_x" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_x, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_x, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "CPML_width_y" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_y, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_y, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "CPML_width_z" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_z, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_z, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "min_distance_between_CPML_parameter" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, min_distance_between_CPML_parameter, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, min_distance_between_CPML_parameter, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(NSPEC_CPML, 1) call bcast_all_cr_for_database(CPML_width_x, 1) @@ -827,29 +816,29 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "CPML_regions" - call h5_read_dataset_collect_hyperslab(dsetname, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "CPML_to_spec" - call h5_read_dataset_collect_hyperslab(dsetname, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "is_CPML" - call h5_read_dataset_collect_hyperslab(dsetname, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "d_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "d_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "d_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "k_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "k_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "k_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "alpha_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "alpha_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "alpha_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(CPML_regions) > 0) call bcast_all_i_for_database(CPML_regions(1), size(CPML_regions)) @@ -869,17 +858,17 @@ subroutine read_mesh_databases_hdf5() ! acoustic if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_nglob_interface_PML_acoustic",offset_nglob_interface_PML_acoustic, (/0/), if_col) + "offset_nglob_interface_PML_acoustic",offset_nglob_interface_PML_acoustic, (/0/), HDF5_IO_COLLECTIVE) dsetname = "nglob_interface_PML_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_acoustic, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_acoustic, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nglob_interface_PML_acoustic, 1) ! elastic if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_nglob_interface_PML_elastic",offset_nglob_interface_PML_elastic, (/0/), if_col) + "offset_nglob_interface_PML_elastic",offset_nglob_interface_PML_elastic, (/0/), HDF5_IO_COLLECTIVE) dsetname = "nglob_interface_PML_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_elastic, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_elastic, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nglob_interface_PML_elastic, 1) ! acoustic allocation @@ -892,7 +881,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "points_interface_PML_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),if_col) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(points_interface_PML_acoustic) > 0) & call bcast_all_i_for_database(points_interface_PML_acoustic(1), size(points_interface_PML_acoustic)) @@ -907,7 +896,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "points_interface_PML_elastic" call h5_read_dataset_collect_hyperslab(dsetname, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),if_col) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(points_interface_PML_elastic) > 0) & call bcast_all_i_for_database(points_interface_PML_elastic(1), size(points_interface_PML_elastic)) @@ -919,7 +908,7 @@ subroutine read_mesh_databases_hdf5() ! absorbing boundary surface if (I_should_read_the_database) then dsetname = "num_abs_boundary_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_abs_boundary_faces, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_abs_boundary_faces, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_abs_boundary_faces, 1) @@ -941,29 +930,29 @@ subroutine read_mesh_databases_hdf5() abs_boundary_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL; abs_boundary_normal(:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_abs_boundary_faces",offset_num_abs_boundary_faces, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_abs_boundary_faces",offset_num_abs_boundary_faces, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_abs_boundary_faces, size(offset_num_abs_boundary_faces)) if (sum(offset_num_abs_boundary_faces) > 0) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nglob_xy",offset_nglob_xy, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nglob_xy",offset_nglob_xy, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_nglob_xy, size(offset_nglob_xy)) if (I_should_read_the_database) then dsetname = "abs_boundary_ispec" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_ispec, & - (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),if_col) + (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "abs_boundary_ijk" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_ijk, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "abs_boundary_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_jacobian2Dw, & - (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "abs_boundary_normal" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_normal, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), if_col) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif if (size(abs_boundary_ispec) > 0) & call bcast_all_i_for_database(abs_boundary_ispec(1), size(abs_boundary_ispec)) @@ -980,13 +969,13 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmassx" call h5_read_dataset_collect_hyperslab(dsetname, rmassx(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rmassy" call h5_read_dataset_collect_hyperslab(dsetname, rmassy(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "rmassz" call h5_read_dataset_collect_hyperslab(dsetname, rmassz(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rmassx) > 0) call bcast_all_cr_for_database(rmassx(1), size(rmassx)) if (size(rmassy) > 0) call bcast_all_cr_for_database(rmassy(1), size(rmassy)) @@ -996,7 +985,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmassz_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, rmassz_acoustic(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),if_col) + (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(rmassz_acoustic) > 0) call bcast_all_cr_for_database(rmassz_acoustic(1), size(rmassz_acoustic)) endif @@ -1006,17 +995,17 @@ subroutine read_mesh_databases_hdf5() ! boundaries if (I_should_read_the_database) then dsetname = "nspec2D_xmin" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmin, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmin, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec2D_xmax" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmax, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmax, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec2D_ymin" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymin, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymin, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec2D_ymax" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymax, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymax, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "NSPEC2D_BOTTOM" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_bottom, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_bottom, (/myrank/),HDF5_IO_COLLECTIVE) dsetname = "NSPEC2D_TOP" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_top, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_top, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nspec2D_xmin, 1) call bcast_all_i_for_database(nspec2D_xmax, 1) @@ -1045,27 +1034,27 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then if (sum(offset_nspec2D_xmin) > 0) then dsetname = "ibelm_xmin" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_xmax) > 0) then dsetname = "ibelm_xmax" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_ymin) > 0) then dsetname = "ibelm_ymin" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_ymax) > 0) then dsetname = "ibelm_ymax" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_bottom_ext) > 0) then dsetname = "ibelm_bottom" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (sum(offset_nspec2D_top_ext) > 0) then dsetname = "ibelm_top" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif endif if (size(ibelm_xmin) > 0) call bcast_all_i_for_database(ibelm_xmin(1), size(ibelm_xmin)) @@ -1078,7 +1067,7 @@ subroutine read_mesh_databases_hdf5() ! free surface if (I_should_read_the_database) then dsetname = "num_free_surface_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_free_surface_faces, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_free_surface_faces, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_free_surface_faces, 1) @@ -1095,7 +1084,7 @@ subroutine read_mesh_databases_hdf5() free_surface_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL; free_surface_normal(:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_free_surface_faces",offset_num_free_surface_faces, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_free_surface_faces",offset_num_free_surface_faces, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_free_surface_faces, size(offset_num_free_surface_faces)) @@ -1103,16 +1092,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "free_surface_ispec" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_ispec, & - (/sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "free_surface_ijk" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_ijk, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "free_surface_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_jacobian2Dw, & - (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "free_surface_normal" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_normal, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(free_surface_ispec) > 0) & call bcast_all_i_for_database(free_surface_ispec(1), size(free_surface_ispec)) @@ -1127,7 +1116,7 @@ subroutine read_mesh_databases_hdf5() ! acoustic-elastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_ac_el_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_el_faces, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_el_faces, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_coupling_ac_el_faces, 1) @@ -1144,7 +1133,7 @@ subroutine read_mesh_databases_hdf5() coupling_ac_el_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_ac_el_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_el_faces",offset_num_coupling_ac_el_faces,(/0/),if_col) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_el_faces",offset_num_coupling_ac_el_faces,(/0/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_coupling_ac_el_faces, size(offset_num_coupling_ac_el_faces)) @@ -1152,16 +1141,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_ac_el_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_ispec, & - (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_el_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_ijk, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_el_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_el_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_normal, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(coupling_ac_el_ispec) > 0) & call bcast_all_i_for_database(coupling_ac_el_ispec(1), size(coupling_ac_el_ispec)) @@ -1176,7 +1165,7 @@ subroutine read_mesh_databases_hdf5() ! acoustic-poroelastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_ac_po_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_po_faces, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_po_faces, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_coupling_ac_po_faces, 1) @@ -1193,7 +1182,7 @@ subroutine read_mesh_databases_hdf5() coupling_ac_po_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_ac_po_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_po_faces",offset_num_coupling_ac_po_faces, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_po_faces",offset_num_coupling_ac_po_faces, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_coupling_ac_po_faces,size(offset_num_coupling_ac_po_faces)) @@ -1201,16 +1190,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_ac_po_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_ispec, & - (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_po_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_ijk, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_po_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_ac_po_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_normal, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(coupling_ac_po_ispec) > 0) & call bcast_all_i_for_database(coupling_ac_po_ispec(1), size(coupling_ac_po_ispec)) @@ -1225,7 +1214,7 @@ subroutine read_mesh_databases_hdf5() ! elastic-poroelastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_el_po_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_el_po_faces, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_el_po_faces, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_coupling_el_po_faces, 1) @@ -1247,7 +1236,7 @@ subroutine read_mesh_databases_hdf5() coupling_el_po_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_el_po_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_el_po_faces",offset_num_coupling_el_po_faces, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_el_po_faces",offset_num_coupling_el_po_faces, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_coupling_el_po_faces,size(offset_num_coupling_el_po_faces)) @@ -1255,22 +1244,22 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_el_po_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_po_el_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_po_el_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_el_po_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_po_el_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_po_el_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_el_po_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "coupling_el_po_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_normal, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),if_col) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(coupling_el_po_ispec) > 0) & call bcast_all_i_for_database(coupling_el_po_ispec(1), size(coupling_el_po_ispec)) @@ -1289,7 +1278,7 @@ subroutine read_mesh_databases_hdf5() ! MPI interfaces if (I_should_read_the_database) then dsetname = "num_interfaces_ext_mesh" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_interfaces_ext_mesh, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_interfaces_ext_mesh, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_interfaces_ext_mesh, 1) @@ -1301,14 +1290,14 @@ subroutine read_mesh_databases_hdf5() my_neighbors_ext_mesh(:) = -1; nibool_interfaces_ext_mesh(:) = 0 if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_interfaces_ext_mesh",offset_num_interfaces_ext_mesh, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_interfaces_ext_mesh",offset_num_interfaces_ext_mesh, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_interfaces_ext_mesh,size(offset_num_interfaces_ext_mesh)) if (sum(offset_num_interfaces_ext_mesh) > 0) then if (I_should_read_the_database) then dsetname = "max_nibool_interfaces_ext_mesh" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, max_nibool_interfaces_ext_mesh, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, max_nibool_interfaces_ext_mesh, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(max_nibool_interfaces_ext_mesh, 1) allocate(ibool_interfaces_ext_mesh(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh),stat=ier) @@ -1319,13 +1308,13 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "my_neighbors_ext_mesh" call h5_read_dataset_collect_hyperslab(dsetname, my_neighbors_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "nibool_interfaces_ext_mesh" call h5_read_dataset_collect_hyperslab(dsetname, nibool_interfaces_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) dsetname = "ibool_interfaces_ext_mesh_dummy" call h5_read_dataset_collect_hyperslab(dsetname, ibool_interfaces_ext_mesh, & - (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),if_col) + (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(my_neighbors_ext_mesh) > 0) & call bcast_all_i_for_database(my_neighbors_ext_mesh(1), size(my_neighbors_ext_mesh)) @@ -1344,49 +1333,49 @@ subroutine read_mesh_databases_hdf5() ! material properties if (ELASTIC_SIMULATION .and. ANISOTROPY) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspec_aniso",offset_nspec_aniso, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_nspec_aniso",offset_nspec_aniso, (/0/), HDF5_IO_COLLECTIVE) dsetname = "c11store" - call h5_read_dataset_collect_hyperslab(dsetname, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c12store" - call h5_read_dataset_collect_hyperslab(dsetname, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c13store" - call h5_read_dataset_collect_hyperslab(dsetname, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c14store" - call h5_read_dataset_collect_hyperslab(dsetname, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c15store" - call h5_read_dataset_collect_hyperslab(dsetname, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c16store" - call h5_read_dataset_collect_hyperslab(dsetname, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c22store" - call h5_read_dataset_collect_hyperslab(dsetname, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c23store" - call h5_read_dataset_collect_hyperslab(dsetname, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c24store" - call h5_read_dataset_collect_hyperslab(dsetname, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c25store" - call h5_read_dataset_collect_hyperslab(dsetname, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c26store" - call h5_read_dataset_collect_hyperslab(dsetname, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c33store" - call h5_read_dataset_collect_hyperslab(dsetname, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c34store" - call h5_read_dataset_collect_hyperslab(dsetname, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c35store" - call h5_read_dataset_collect_hyperslab(dsetname, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c36store" - call h5_read_dataset_collect_hyperslab(dsetname, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c44store" - call h5_read_dataset_collect_hyperslab(dsetname, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c45store" - call h5_read_dataset_collect_hyperslab(dsetname, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c46store" - call h5_read_dataset_collect_hyperslab(dsetname, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c55store" - call h5_read_dataset_collect_hyperslab(dsetname, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c56store" - call h5_read_dataset_collect_hyperslab(dsetname, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "c66store" - call h5_read_dataset_collect_hyperslab(dsetname, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), if_col) + call h5_read_dataset_collect_hyperslab(dsetname, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif if (size(c11store) > 0) call bcast_all_cr_for_database(c11store(1,1,1,1), size(c11store)) if (size(c12store) > 0) call bcast_all_cr_for_database(c12store(1,1,1,1), size(c12store)) @@ -1419,18 +1408,18 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "ispec_is_inner" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),if_col) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(ispec_is_inner) > 0) call bcast_all_l_for_database(ispec_is_inner(1), size(ispec_is_inner)) if (ACOUSTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_acoustic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec_outer_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_acoustic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "num_phase_ispec_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_acoustic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nspec_inner_acoustic, 1) call bcast_all_i_for_database(nspec_outer_acoustic, 1) @@ -1443,12 +1432,12 @@ subroutine read_mesh_databases_hdf5() phase_ispec_inner_acoustic(:,:) = 0 call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_acoustic", & - offset_num_phase_ispec_acoustic, (/0/), if_col) + offset_num_phase_ispec_acoustic, (/0/), HDF5_IO_COLLECTIVE) if (sum(offset_num_phase_ispec_acoustic) > 0) then if (I_should_read_the_database) then dsetname = "phase_ispec_inner_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_acoustic, & - (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) endif if (size(phase_ispec_inner_acoustic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_acoustic(1,1), size(phase_ispec_inner_acoustic)) @@ -1458,11 +1447,11 @@ subroutine read_mesh_databases_hdf5() if (ELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_elastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_elastic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec_outer_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_elastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_elastic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "num_phase_ispec_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_elastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_elastic,(/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nspec_inner_elastic, 1) call bcast_all_i_for_database(nspec_outer_elastic, 1) @@ -1475,7 +1464,7 @@ subroutine read_mesh_databases_hdf5() phase_ispec_inner_elastic(:,:) = 0 if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_elastic",offset_num_phase_ispec_elastic, (/0/), if_col) + call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_elastic",offset_num_phase_ispec_elastic, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_phase_ispec_elastic,size(offset_num_phase_ispec_elastic)) @@ -1483,7 +1472,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "phase_ispec_inner_elastic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_elastic, & - (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) endif if (size(phase_ispec_inner_elastic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_elastic(1,1), size(phase_ispec_inner_elastic)) @@ -1493,11 +1482,11 @@ subroutine read_mesh_databases_hdf5() if (POROELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_poroelastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_poroelastic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "nspec_outer_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_poroelastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_poroelastic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "num_phase_ispec_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_poroelastic, (/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_poroelastic, (/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nspec_inner_poroelastic, 1) call bcast_all_i_for_database(nspec_outer_poroelastic, 1) @@ -1511,14 +1500,14 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_poroelastic", & - offset_num_phase_ispec_poroelastic, (/0/), if_col) + offset_num_phase_ispec_poroelastic, (/0/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_array_for_database(offset_num_phase_ispec_poroelastic,size(offset_num_phase_ispec_poroelastic)) if (sum(offset_num_phase_ispec_poroelastic) > 0) then if (I_should_read_the_database) then dsetname = "phase_ispec_inner_poroelastic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_poroelastic, & - (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),if_col) + (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) endif if (size(phase_ispec_inner_poroelastic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_poroelastic(1,1), size(phase_ispec_inner_poroelastic)) @@ -1531,9 +1520,9 @@ subroutine read_mesh_databases_hdf5() if (ACOUSTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "num_colors_outer_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_acoustic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "num_colors_inner_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_acoustic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_colors_outer_acoustic, 1) call bcast_all_i_for_database(num_colors_inner_acoustic, 1) @@ -1545,10 +1534,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_num_colors_acoustic",offset_num_colors_acoustic, (/0/), if_col) + "offset_num_colors_acoustic",offset_num_colors_acoustic, (/0/), HDF5_IO_COLLECTIVE) dsetname = "num_elem_colors_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, & - num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),if_col) + num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(num_elem_colors_acoustic) > 0) & call bcast_all_i_for_database(num_elem_colors_acoustic(1), size(num_elem_colors_acoustic)) @@ -1557,9 +1546,9 @@ subroutine read_mesh_databases_hdf5() if (ELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "num_colors_outer_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_elastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_elastic,(/myrank/),HDF5_IO_COLLECTIVE) dsetname = "num_colors_inner_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_elastic,(/myrank/),if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_elastic,(/myrank/),HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_colors_outer_elastic, 1) call bcast_all_i_for_database(num_colors_inner_elastic, 1) @@ -1571,10 +1560,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_num_colors_elastic",offset_num_colors_elastic, (/0/), if_col) + "offset_num_colors_elastic",offset_num_colors_elastic, (/0/), HDF5_IO_COLLECTIVE) dsetname = "num_elem_colors_elastic" call h5_read_dataset_collect_hyperslab(dsetname, num_elem_colors_elastic, & - (/sum(offset_num_colors_elastic(0:myrank-1))/),if_col) + (/sum(offset_num_colors_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) endif if (size(num_elem_colors_elastic) > 0) & call bcast_all_i_for_database(num_elem_colors_elastic(1), size(num_elem_colors_elastic)) @@ -1611,13 +1600,13 @@ subroutine read_mesh_databases_hdf5() ! used for receiver detection, movie files and shakemaps if (I_should_read_the_database) then dsetname = "nfaces_surface" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nfaces_surface, (/myrank/), if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nfaces_surface, (/myrank/), HDF5_IO_COLLECTIVE) dsetname = "ispec_is_surface_external_mesh" call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_surface_external_mesh, & - (/sum(offset_nspec_ab(0:myrank-1))/), if_col) + (/sum(offset_nspec_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "iglob_is_surface_external_mesh" call h5_read_dataset_collect_hyperslab(dsetname, iglob_is_surface_external_mesh, & - (/sum(offset_nglob_ab(0:myrank-1))/), if_col) + (/sum(offset_nglob_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(nfaces_surface, 1) call bcast_all_l_for_database(ispec_is_surface_external_mesh(1), size(ispec_is_surface_external_mesh)) @@ -1626,7 +1615,7 @@ subroutine read_mesh_databases_hdf5() ! for mesh adjacency if (I_should_read_the_database) then dsetname = "num_neighbors_all" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_neighbors_all, (/myrank/), if_col) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_neighbors_all, (/myrank/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(num_neighbors_all, 1) @@ -1640,10 +1629,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "neighbors_xadj" call h5_read_dataset_collect_hyperslab(dsetname, neighbors_xadj, & - (/sum(offset_neighbors_xadj(0:myrank-1))/), if_col) + (/sum(offset_neighbors_xadj(0:myrank-1))/), HDF5_IO_COLLECTIVE) dsetname = "neighbors_adjncy" call h5_read_dataset_collect_hyperslab(dsetname, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), if_col) + (/sum(offset_neighbors_adjncy(0:myrank-1))/), HDF5_IO_COLLECTIVE) endif call bcast_all_i_for_database(neighbors_xadj(1), size(neighbors_xadj)) call bcast_all_i_for_database(neighbors_adjncy(1), size(neighbors_adjncy)) diff --git a/src/specfem3D/write_movie_output_HDF5.F90 b/src/specfem3D/write_movie_output_HDF5.F90 index 1d8038f09..3794db1ce 100644 --- a/src/specfem3D/write_movie_output_HDF5.F90 +++ b/src/specfem3D/write_movie_output_HDF5.F90 @@ -1043,11 +1043,6 @@ subroutine prepare_vol_movie_hdf5() integer :: iproc, ier, nglob_all, nspec_all character(len=MAX_STRING_LEN) :: fname_h5_data_vol - logical :: if_collective = .true. - - ! overwrite with global values - if_collective = HDF5_IO_COLLECTIVE - allocate(nglob_par_proc_nio(0:NPROC-1), stat=ier) if (ier /= 0) call exit_MPI_without_rank('error allocating array nglob_par_proc') if (ier /= 0) stop 'error allocating arrays for nglob_par_proc' @@ -1125,13 +1120,13 @@ subroutine prepare_vol_movie_hdf5() call h5_open_group(group_name) dset_name = "elm_conn" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,elm_conn_loc,(/0,nelm_offset(myrank)/),if_collective) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,elm_conn_loc,(/0,nelm_offset(myrank)/),HDF5_IO_COLLECTIVE) dset_name = "x" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,xstore,(/nglob_offset(myrank)/),if_collective) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,xstore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) dset_name = "y" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,ystore,(/nglob_offset(myrank)/),if_collective) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,ystore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) dset_name = "z" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,zstore,(/nglob_offset(myrank)/),if_collective) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,zstore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) call h5_close_group() call h5_close_file() @@ -1161,10 +1156,6 @@ subroutine write_vol_data_hdf5(darr, dset_name) character(len=MAX_STRING_LEN) :: fname_h5_data_vol integer, parameter :: rank = 1 - logical :: if_collective = .true. - - ! overwrite with global values - if_collective = HDF5_IO_COLLECTIVE fname_h5_data_vol = trim(OUTPUT_FILES) // "/movie_volume.h5" @@ -1196,7 +1187,7 @@ subroutine write_vol_data_hdf5(darr, dset_name) call h5_open_file_p(fname_h5_data_vol) call h5_open_group(group_name) call h5_write_dataset_collect_hyperslab_in_group(dset_name, & - darr, (/nglob_offset(myrank)/), if_collective) + darr, (/nglob_offset(myrank)/), HDF5_IO_COLLECTIVE) call h5_close_group() call h5_close_file() From 6c75f1da2c220c62baf48d2f30c36fff7c1fc8d6 Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Wed, 11 Sep 2024 13:14:01 -0600 Subject: [PATCH 47/56] change var name to be shorter --- .../save_arrays_solver_hdf5.F90 | 386 +++++++++--------- src/shared/hdf5_manager.F90 | 26 +- src/shared/shared_par.F90 | 2 +- src/specfem3D/read_mesh_databases_hdf5.F90 | 384 ++++++++--------- src/specfem3D/write_movie_output_HDF5.F90 | 14 +- 5 files changed, 406 insertions(+), 406 deletions(-) diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index 9c6012918..48e57041f 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -36,7 +36,7 @@ subroutine save_arrays_solver_mesh_hdf5() use shared_parameters, only: ACOUSTIC_SIMULATION, ELASTIC_SIMULATION, POROELASTIC_SIMULATION, & APPROXIMATE_OCEAN_LOAD, ANISOTROPY, & COUPLE_WITH_INJECTION_TECHNIQUE, MESH_A_CHUNK_OF_THE_EARTH,NPROC, & - HDF5_IO_COLLECTIVE + H5_COL ! global indices use generate_databases_par, only: NSPEC_AB, ibool, NGLOB_AB @@ -892,149 +892,149 @@ subroutine save_arrays_solver_mesh_hdf5() call flush_IMAIN() endif - ! set dwrite flagHDF5_IO_COLLECTIVEto pre_define the dataset on file before write. + ! set dwrite flagH5_COLto pre_define the dataset on file before write. dset_name = "nspec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_ab/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_ab/), (/myrank/),H5_COL) dset_name = "nglob" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nglob_ab/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,(/nglob_ab/), (/myrank/),H5_COL) dset_name = "nspec_irregular" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_irregular/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,(/nspec_irregular/), (/myrank/),H5_COL) dset_name = "ibool" ! 4 i (/0,0,0, offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), H5_COL) dset_name = "xstore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,xstore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,xstore_unique,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dset_name = "ystore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,ystore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,ystore_unique,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dset_name = "zstore_unique" ! 1 r (/offset_nglobs/) - call h5_write_dataset_collect_hyperslab(dset_name,zstore_unique,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,zstore_unique,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dset_name = "irregular_element_number" ! 1 i (/offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "xix_regular" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/xix_regular/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,(/xix_regular/),(/myrank/),H5_COL) dset_name = "jacobian_regular" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name,(/jacobian_regular/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,(/jacobian_regular/),(/myrank/),H5_COL) dset_name = "xixstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "xiystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "xizstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "etaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "etaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "etazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "gammaxstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "gammaystore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "gammazstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "jacobianstore" ! 4 r (/0,0,0,offset_nspec_irregular = offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dset_name = "kappastore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "mustore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "ispec_is_acoustic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "ispec_is_elastic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "ispec_is_poroelastic" ! 1 l (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) ! acoustic if (ACOUSTIC_SIMULATION) then dset_name = "rmass_acoustic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),H5_COL) endif ! this array is needed for acoustic simulations but also for elastic simulations with CPML, ! thus we allocate it and read it in all cases (whether the simulation is acoustic, elastic, or acoustic/elastic) dset_name = "rhostore" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) ! elastic if (ELASTIC_SIMULATION) then dset_name = "rmass" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass, (/sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmass, (/sum(offset_nglob(0:myrank-1))/), H5_COL) if (APPROXIMATE_OCEAN_LOAD) then dset_name = "rmass_ocean_load" ! 1 r (/offset_nglob_ocean/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),H5_COL) endif !pll Stacey dset_name = "rho_vp" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "rho_vs" ! 4 r (/0,0,0,offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) endif ! poroelastic if (POROELASTIC_SIMULATION) then dset_name = "rmass_solid_poroelastic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),H5_COL) dset_name = "rmass_fluid_poroelastic" ! 1 r (/offset_nglob/) - call h5_write_dataset_collect_hyperslab(dset_name, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),H5_COL) dset_name = "rhoarraystore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "kappaarraystore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, kappaarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, kappaarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "etastore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "tortstore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "permstore" ! 5 r (/0,0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "phistore" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "rho_vpI" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "rho_vpII" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dset_name = "rho_vsI" ! 4 r (/0,0,0,offset_nspecporo/) - call h5_write_dataset_collect_hyperslab(dset_name, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) endif ! C-PML absorbing boundary conditions if (PML_CONDITIONS) then dset_name = "nspec_cpml" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_cpml/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_cpml/), (/myrank/),H5_COL) dset_name = "CPML_width_x" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_x/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_x/), (/myrank/),H5_COL) dset_name = "CPML_width_y" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_y/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_y/), (/myrank/),H5_COL) dset_name = "CPML_width_z" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_z/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/CPML_width_z/), (/myrank/),H5_COL) dset_name = "min_distance_between_CPML_parameter" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/min_distance_between_CPML_parameter/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/min_distance_between_CPML_parameter/), (/myrank/),H5_COL) if (sum(offset_nspeccpml) > 0) then dset_name = "CPML_regions" ! 1 i (/offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "CPML_to_spec" ! 1 i (/offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "is_CPML" ! 1 l (/offset_nspecab/) - call h5_write_dataset_collect_hyperslab(dset_name, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),H5_COL) dset_name = "d_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "d_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "d_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "k_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "k_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "k_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "alpha_store_x" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "alpha_store_y" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dset_name = "alpha_store_z" ! 4 r (/0,0,0,offset_nspeccpml/) - call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) ! -------------------------------------------------------------------------------------------- ! for adjoint tomography @@ -1042,18 +1042,18 @@ subroutine save_arrays_solver_mesh_hdf5() ! -------------------------------------------------------------------------------------------- if ((SIMULATION_TYPE == 1 .and. SAVE_FORWARD) .or. SIMULATION_TYPE == 3) then dset_name = "nglob_interface_PML_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_acoustic/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_acoustic/), (/myrank/),H5_COL) dset_name = "nglob_interface_PML_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_elastic/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nglob_interface_PML_elastic/), (/myrank/),H5_COL) if (sum(offset_nglob_interface_PML_acoustic) > 0) then dset_name = "points_interface_PML_acoustic" ! 1 i (/offset_nglob_interface_PML_acoustic/) call h5_write_dataset_collect_hyperslab(dset_name, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),H5_COL) endif if (sum(offset_nglob_interface_PML_elastic) > 0) then dset_name = "points_interface_PML_elastic" ! 1 i (/offset_nglob_interface_PML_elastic/) call h5_write_dataset_collect_hyperslab(dset_name, & - points_interface_PML_elastic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + points_interface_PML_elastic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),H5_COL) endif endif endif @@ -1061,348 +1061,348 @@ subroutine save_arrays_solver_mesh_hdf5() ! absorbing boundary surface dset_name = "num_abs_boundary_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_abs_boundary_faces/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_abs_boundary_faces/), (/myrank/),H5_COL) if (sum(offset_num_abs_boundary_faces) > 0) then dset_name = "abs_boundary_ispec" ! 1 i (/offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_ispec, & - (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),H5_COL) dset_name = "abs_boundary_ijk" ! 3 i (/0,0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_ijk, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) dset_name = "abs_boundary_jacobian2Dw" ! 2 r (/0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_jacobian2Dw, & - (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) dset_name = "abs_boundary_normal" ! 3 r (/0,0,offset_num_abs_boundary_faces/) call h5_write_dataset_collect_hyperslab(dset_name, abs_boundary_normal, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) if (STACEY_ABSORBING_CONDITIONS .and. (.not. PML_CONDITIONS)) then ! store mass matrix contributions if (ELASTIC_SIMULATION) then dset_name = "rmassx" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassx, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmassx, (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) dset_name = "rmassy" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassy, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmassy, (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) dset_name = "rmassz" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassz, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmassz, (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) endif if (ACOUSTIC_SIMULATION) then dset_name = "rmassz_acoustic" ! 1 r (/offset_nglob_xy/) - call h5_write_dataset_collect_hyperslab(dset_name, rmassz_acoustic, (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, rmassz_acoustic, (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) endif endif else dset_name = "abs_boundary_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "abs_boundary_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "abs_boundary_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),H5_COL) dset_name = "abs_boundary_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),H5_COL) if (STACEY_ABSORBING_CONDITIONS .and. (.not. PML_CONDITIONS)) then ! store mass matrix contributions if (ELASTIC_SIMULATION) then dset_name = "rmassx" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),H5_COL) dset_name = "rmassy" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),H5_COL) dset_name = "rmassz" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),H5_COL) endif if (ACOUSTIC_SIMULATION) then dset_name = "rmassz_acoustic" ! 1 r (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0.0/), (/myrank/),H5_COL) endif endif endif dset_name = "nspec2D_xmin" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmin/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmin/), (/myrank/),H5_COL) dset_name = "nspec2D_xmax" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmax/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_xmax/), (/myrank/),H5_COL) dset_name = "nspec2D_ymin" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymin/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymin/), (/myrank/),H5_COL) dset_name = "nspec2D_ymax" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymax/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_ymax/), (/myrank/),H5_COL) dset_name = "NSPEC2D_BOTTOM" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_bottom/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_bottom/), (/myrank/),H5_COL) dset_name = "NSPEC2D_TOP" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_top/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec2D_top/), (/myrank/),H5_COL) if (sum(offset_nspec2D_xmin) > 0) then dset_name = "ibelm_xmin" ! 1 i (/offset_nspec2D_xmin/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_xmax) > 0) then dset_name = "ibelm_xmax" ! 1 i (/offset_nspec2D_xmax/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_ymin) > 0) then dset_name = "ibelm_ymin" ! 1 i (/offset_nspec2D_ymin/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_ymax) > 0) then dset_name = "ibelm_ymax" ! 1 i (/offset_nspec2D_ymax/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_bottom_ext) > 0) then dset_name = "ibelm_bottom" ! 1 i (/offset_nspec2D_bottom_ext/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_top_ext) > 0) then dset_name = "ibelm_top" ! 1 i (/offset_nspec2D_top_ext/) - call h5_write_dataset_collect_hyperslab(dset_name, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),H5_COL) endif ! free surface dset_name = "num_free_surface_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_free_surface_faces/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_free_surface_faces/), (/myrank/),H5_COL) if (sum(offset_num_free_surface_faces) > 0) then dset_name = "free_surface_ispec" ! 1 i (/offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_ispec, & - (/sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dset_name = "free_surface_ijk" ! 3 i (/0,0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_ijk, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dset_name = "free_surface_jacobian2Dw" ! 2 r (/0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_jacobian2Dw, & - (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dset_name = "free_surface_normal" ! 3 r (/0,0,offset_num_free_surface_faces/) call h5_write_dataset_collect_hyperslab(dset_name, free_surface_normal, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) else dset_name = "free_surface_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "free_surface_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "free_surface_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),H5_COL) dset_name = "free_surface_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),H5_COL) endif ! acoustic-elastic coupling surface dset_name = "num_coupling_ac_el_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_el_faces/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_el_faces/), (/myrank/),H5_COL) if (sum(offset_num_coupling_ac_el_faces) > 0) then dset_name = "coupling_ac_el_ispec" ! 1 i (/offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_ispec, & - (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_el_ijk" ! 3 i (/0,0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_ijk, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_el_jacobian2Dw" ! 2 r (/0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_el_normal" ! 3 r (/0,0,offset_num_coupling_ac_el_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_el_normal, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) else dset_name = "coupling_ac_el_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "coupling_ac_el_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "coupling_ac_el_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),H5_COL) dset_name = "coupling_ac_el_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),H5_COL) endif ! acoustic-poroelastic coupling surface dset_name = "num_coupling_ac_po_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_po_faces/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_ac_po_faces/), (/myrank/),H5_COL) if (sum(offset_num_coupling_ac_po_faces) > 0) then dset_name = "coupling_ac_po_ispec" ! 1 i (/offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_ispec, & - (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_po_ijk" ! 3 i (/0,0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_ijk, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_po_jacobian2Dw" ! 2 r (/0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_po_normal" ! 3 r (/0,0,offset_num_coupling_ac_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_ac_po_normal, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_ac_po_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "coupling_ac_po_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "coupling_ac_po_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),H5_COL) dset_name = "coupling_ac_po_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),H5_COL) endif ! elastic-poroelastic coupling surface dset_name = "num_coupling_el_po_faces" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_el_po_faces/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_coupling_el_po_faces/), (/myrank/),H5_COL) if (sum(offset_num_coupling_el_po_faces) > 0) then dset_name = "coupling_el_po_ispec" ! 1 i (/offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_po_el_ispec" ! 1 i (/offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_po_el_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_el_po_ijk" ! 3 i (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_po_el_ijk" ! 3 i (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_po_el_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_el_po_jacobian2Dw" ! 2 r (/0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dset_name = "coupling_el_po_normal" ! 3 r (/0,0,offset_num_coupling_el_po_faces/) call h5_write_dataset_collect_hyperslab(dset_name, coupling_el_po_normal, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) else dset_name = "coupling_el_po_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "coupling_po_el_ispec" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "coupling_el_po_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "coupling_po_el_ijk" ! 3 i (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i3d_dummy, (/0,0,myrank/),H5_COL) dset_name = "coupling_el_po_jacobian2Dw" ! 2 r (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r2d_dummy, (/0,myrank/),H5_COL) dset_name = "coupling_el_po_normal" ! 3 r (/0,0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, r3d_dummy, (/0,0,myrank/),H5_COL) endif dset_name = "num_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_interfaces_ext_mesh/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_interfaces_ext_mesh/), (/myrank/),H5_COL) if (sum(offset_num_interfaces_ext_mesh) > 0) then dset_name = "max_nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/max_nibool_interfaces_ext_mesh/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/max_nibool_interfaces_ext_mesh/), (/myrank/),H5_COL) dset_name = "my_neighbors_ext_mesh" ! 1 i (/offset_num_interfaces_ext_mesh/) call h5_write_dataset_collect_hyperslab(dset_name, my_neighbors_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) dset_name = "nibool_interfaces_ext_mesh" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, nibool_interfaces_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) dset_name = "ibool_interfaces_ext_mesh_dummy" ! 2 i (/offset_max_ni_bool_interfaces_ext_mesh/) call h5_write_dataset_collect_hyperslab(dset_name, ibool_interfaces_ext_mesh_dummy, & - (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) else dset_name = "max_nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "my_neighbors_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "nibool_interfaces_ext_mesh" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/0/), (/myrank/),H5_COL) dset_name = "ibool_interfaces_ext_mesh_dummy" ! 2 i (/0,myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy, (/myrank/),H5_COL) endif ! anisotropy if (ELASTIC_SIMULATION .and. ANISOTROPY) then dset_name = "c11store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c12store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c13store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c14store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c15store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c16store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c22store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c23store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c24store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c25store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c26store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c33store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c34store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c35store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c36store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c44store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c45store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c46store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c55store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c56store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dset_name = "c66store" ! 4 r (/0,0,0,offset_nspec_aniso/) - call h5_write_dataset_collect_hyperslab(dset_name, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) endif ! inner/outer elements dset_name = "ispec_is_inner" ! 1 l (/offset_nspec/) - call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),H5_COL) if (ACOUSTIC_SIMULATION) then dset_name = "nspec_inner_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_acoustic/),(/myrank/),H5_COL) dset_name = "nspec_outer_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_acoustic/),(/myrank/),H5_COL) dset_name = "num_phase_ispec_acoustic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_acoustic/),(/myrank/),H5_COL) if (sum(offset_num_phase_ispec_acoustic) > 0) then dset_name = "phase_ispec_inner_acoustic" ! 2 i (/offset_num_phase_ispec_acoustic, 0/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_acoustic, & - (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),H5_COL) else dset_name = "phase_ispec_inner_acoustic" ! 2 i (/myrank,0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),H5_COL) endif endif if (ELASTIC_SIMULATION) then dset_name = "nspec_inner_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_elastic/),(/myrank/),H5_COL) dset_name = "nspec_outer_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_elastic/),(/myrank/),H5_COL) dset_name = "num_phase_ispec_elastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_elastic/),(/myrank/),H5_COL) if (sum(offset_num_phase_ispec_elastic) > 0) then dset_name = "phase_ispec_inner_elastic" ! 2 i (/offset_num_phase_ispec_elastic,0/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_elastic, & - (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),H5_COL) else dset_name = "phase_ispec_inner_elastic" ! 2 i (/myrank, 0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),H5_COL) endif endif if (POROELASTIC_SIMULATION) then dset_name = "nspec_inner_poroelastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_poroelastic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_inner_poroelastic/),(/myrank/),H5_COL) dset_name = "nspec_outer_poroelastic" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_poroelastic/),(/myrank/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nspec_outer_poroelastic/),(/myrank/),H5_COL) dset_name = "num_phase_ispec_poroelastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, (/num_phase_ispec_poroelastic/), & - (/myrank/),HDF5_IO_COLLECTIVE) + (/myrank/),H5_COL) if (sum(offset_num_phase_ispec_poroelastic) > 0) then dset_name = "phase_ispec_inner_poroelastic" ! 2 i (/offset_num_phase_ispec_poroelastic/) call h5_write_dataset_collect_hyperslab(dset_name, phase_ispec_inner_poroelastic, & - (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),H5_COL) dset_name = "phase_ispec_inner_poroelastic" ! 2 i (/myrank,0/) - call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, i2d_dummy,(/myrank,0/),H5_COL) endif endif @@ -1411,51 +1411,51 @@ subroutine save_arrays_solver_mesh_hdf5() if (ACOUSTIC_SIMULATION) then dset_name = "num_colors_outer_acoustic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_outer_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) + (/num_colors_outer_acoustic/),(/myrank/),H5_COL) dset_name = "num_colors_inner_acoustic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_inner_acoustic/),(/myrank/),HDF5_IO_COLLECTIVE) + (/num_colors_inner_acoustic/),(/myrank/),H5_COL) dset_name = "num_elem_colors_acoustic" ! 1 i (/offset_num_colors_outer_acoustic+num_colors_inner_acoustic/) call h5_write_dataset_collect_hyperslab(dset_name, & - num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),H5_COL) endif if (ELASTIC_SIMULATION) then dset_name = "num_colors_outer_elastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_outer_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) + (/num_colors_outer_elastic/),(/myrank/),H5_COL) dset_name = "num_colors_inner_elastic" ! 1 i (/myrank/) call h5_write_dataset_collect_hyperslab(dset_name, & - (/num_colors_inner_elastic/),(/myrank/),HDF5_IO_COLLECTIVE) + (/num_colors_inner_elastic/),(/myrank/),H5_COL) dset_name = "num_elem_colors_elastic" ! 1 i (/offset_num_colors_outer_elastic+num_colors_inner_elastic/) call h5_write_dataset_collect_hyperslab(dset_name, num_elem_colors_elastic, & - (/sum(offset_num_colors_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_colors_elastic(0:myrank-1))/),H5_COL) endif endif ! surface points dset_name = "nfaces_surface" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/nfaces_surface/), (/myrank/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/nfaces_surface/), (/myrank/), H5_COL) dset_name = "ispec_is_surface_external_mesh" ! 1 l (/offset_nspec_ab/) call h5_write_dataset_collect_hyperslab(dset_name, ispec_is_surface_external_mesh, & - (/sum(offset_nspec_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_nspec_ab(0:myrank-1))/), H5_COL) dset_name = "iglob_is_surface_external_mesh" ! 1 l (/offset_nglob_ab/) call h5_write_dataset_collect_hyperslab(dset_name, iglob_is_surface_external_mesh, & - (/sum(offset_nglob_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_ab(0:myrank-1))/), H5_COL) ! mesh adjacency dset_name = "num_neighbors_all" ! 1 i (/myrank/) - call h5_write_dataset_collect_hyperslab(dset_name, (/num_neighbors_all/), (/myrank/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab(dset_name, (/num_neighbors_all/), (/myrank/), H5_COL) dset_name = "neighbors_xadj" ! 1 i (/offset_nspec_ab+1/) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_xadj, & - (/sum(offset_neighbors_xadj(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_neighbors_xadj(0:myrank-1))/), H5_COL) dset_name = "neighbors_adjncy" ! 1 i (/offset_num_neighbors_all/) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_neighbors_adjncy(0:myrank-1))/), H5_COL) ! arrays for visualization dset_name = "spec_elm_conn_xdmf" ! 2 i (/0,offset_nspec*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/) call h5_write_dataset_collect_hyperslab(dset_name, spec_elm_conn_xdmf, & - (/0,sum(offset_nspec(0:myrank-1))*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/), HDF5_IO_COLLECTIVE) + (/0,sum(offset_nspec(0:myrank-1))*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/), H5_COL) ! stores arrays in binary files !if (SAVE_MESH_FILES) then diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 91691c30d..1bcd3d3a9 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -410,7 +410,7 @@ end subroutine h5_initialize subroutine write_attenuation_file_hdf5(factor_common, scale_factor, factor_common_kappa, scale_factor_kappa) #if defined(USE_HDF5) - use shared_parameters, only: NPROC, LOCAL_PATH + use shared_parameters, only: NPROC, LOCAL_PATH,H5_COL use constants, only: myrank,N_SLS,NGLLX,NGLLY,NGLLZ #endif @@ -463,16 +463,16 @@ subroutine write_attenuation_file_hdf5(factor_common, scale_factor, factor_commo call h5_open_file_p_collect(filename) dset_name = "scale_factor" call h5_write_dataset_4d_r_collect_hyperslab(dset_name, & - scale_factor,(/0,0,0,sum(offset_nspec(0:myrank-1))/),.true.) + scale_factor,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "scale_factor_kappa" call h5_write_dataset_4d_r_collect_hyperslab(dset_name, & - scale_factor_kappa,(/0,0,0,sum(offset_nspec(0:myrank-1))/),.true.) + scale_factor_kappa,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "factor_common" call h5_write_dataset_5d_r_collect_hyperslab(dset_name, & - factor_common,(/0,0,0,0,sum(offset_nspec(0:myrank-1))/),.true.) + factor_common,(/0,0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dset_name = "factor_common_kappa" call h5_write_dataset_5d_r_collect_hyperslab(dset_name, & - factor_common_kappa,(/0,0,0,0,sum(offset_nspec(0:myrank-1))/),.true.) + factor_common_kappa,(/0,0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) call h5_close_file_p() call h5_finalize() @@ -499,7 +499,7 @@ end subroutine write_attenuation_file_hdf5 subroutine read_attenuation_file_hdf5(factor_common, scale_factor, factor_common_kappa, scale_factor_kappa) #if defined(USE_HDF5) - use shared_parameters, only: NPROC, LOCAL_PATH + use shared_parameters, only: NPROC, LOCAL_PATH, H5_COL use constants, only: myrank #endif @@ -526,16 +526,16 @@ subroutine read_attenuation_file_hdf5(factor_common, scale_factor, factor_common ! open file call h5_open_file_p_collect(fname) ! read offset array - call h5_read_dataset_1d_i_collect_hyperslab("offset_nspec",offset_nspec, (/0/), .true.) + call h5_read_dataset_1d_i_collect_hyperslab("offset_nspec",offset_nspec, (/0/), H5_COL) call h5_read_dataset_4d_r_collect_hyperslab("scale_factor", scale_factor, & - (/0,0,0,sum(offset_nspec(0:myrank-1))/), .true.) + (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) call h5_read_dataset_4d_r_collect_hyperslab("scale_factor_kappa", scale_factor_kappa, & - (/0,0,0,sum(offset_nspec(0:myrank-1))/), .true.) + (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) call h5_read_dataset_5d_r_collect_hyperslab("factor_common", factor_common, & - (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), .true.) + (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) call h5_read_dataset_5d_r_collect_hyperslab("factor_common_kappa", factor_common_kappa, & - (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), .true.) + (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) call h5_close_file_p() call h5_finalize() @@ -562,7 +562,7 @@ end subroutine read_attenuation_file_hdf5 subroutine write_checkmesh_data_hdf5(dset_name,dump_array) #if defined(USE_HDF5) - use shared_parameters, only: LOCAL_PATH, NPROC, HDF5_IO_COLLECTIVE + use shared_parameters, only: LOCAL_PATH, NPROC, H5_COL use constants, only: myrank #endif @@ -614,7 +614,7 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! open file call h5_open_file_p_collect(filename) - call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), H5_COL) call h5_close_file_p() call h5_finalize() diff --git a/src/shared/shared_par.F90 b/src/shared/shared_par.F90 index bb424dbb3..488ca1a8d 100644 --- a/src/shared/shared_par.F90 +++ b/src/shared/shared_par.F90 @@ -193,7 +193,7 @@ module shared_input_parameters integer :: HDF5_IO_NODES = 0 ! HDF5 IO writing mode (collective or independent) - logical :: HDF5_IO_COLLECTIVE = .true. + logical :: H5_COL = .true. ! flag for io-dedicated/compute node. logical :: IO_storage_task = .false. diff --git a/src/specfem3D/read_mesh_databases_hdf5.F90 b/src/specfem3D/read_mesh_databases_hdf5.F90 index 7b3f5e401..7c908506f 100644 --- a/src/specfem3D/read_mesh_databases_hdf5.F90 +++ b/src/specfem3D/read_mesh_databases_hdf5.F90 @@ -34,7 +34,7 @@ subroutine read_mesh_for_init_hdf5() #ifdef USE_HDF5 use specfem_par use manager_hdf5 - use shared_parameters, only: HDF5_IO_COLLECTIVE + use shared_parameters, only: H5_COL implicit none ! Local variables @@ -63,13 +63,13 @@ subroutine read_mesh_for_init_hdf5() ! read datasets dsetname = "nspec" !call h5_read_dataset_p_scalar(dsetname, NSPEC_AB) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),H5_COL) dsetname = "nglob" !call h5_read_dataset_p_scalar(dsetname, NGLOB_AB) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),H5_COL) dsetname = "nspec_irregular" !call h5_read_dataset_p_scalar(dsetname, NSPEC_IRREGULAR) - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),H5_COL) ! close hdf5 call h5_close_file() @@ -186,80 +186,80 @@ subroutine read_mesh_databases_hdf5() call h5_open_file_p_collect(database_hdf5) ! gets offsets - call h5_read_dataset_collect_hyperslab("offset_nglob",offset_nglob, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec",offset_nspec, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec_irregular",offset_nspec_irregular, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nglob",offset_nglob, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec",offset_nspec, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec_irregular",offset_nspec_irregular, (/0/), H5_COL) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmin",offset_nspec2D_xmin, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmax",offset_nspec2D_xmax, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymin",offset_nspec2D_ymin, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymax",offset_nspec2D_ymax, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_bottom_ext",offset_nspec2D_bottom_ext, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nspec2D_top_ext",offset_nspec2D_top_ext, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmin",offset_nspec2D_xmin, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_xmax",offset_nspec2D_xmax, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymin",offset_nspec2D_ymin, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_ymax",offset_nspec2D_ymax, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_bottom_ext",offset_nspec2D_bottom_ext, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec2D_top_ext",offset_nspec2D_top_ext, (/0/), H5_COL) - call h5_read_dataset_collect_hyperslab("offset_nspec_ab",offset_nspec_ab, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_nglob_ab",offset_nglob_ab, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec_ab",offset_nspec_ab, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nglob_ab",offset_nglob_ab, (/0/), H5_COL) ! mesh adjacency - call h5_read_dataset_collect_hyperslab("offset_neighbors_xadj",offset_neighbors_xadj, (/0/), HDF5_IO_COLLECTIVE) - call h5_read_dataset_collect_hyperslab("offset_neighbors_adjncy",offset_neighbors_adjncy, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_neighbors_xadj",offset_neighbors_xadj, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_neighbors_adjncy",offset_neighbors_adjncy, (/0/), H5_COL) ! info about external mesh simulation dsetname = "nspec" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_AB, (/myrank/),H5_COL) dsetname = "nglob" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NGLOB_AB, (/myrank/),H5_COL) dsetname = "nspec_irregular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_IRREGULAR, (/myrank/),H5_COL) dsetname = "ibool" - call h5_read_dataset_collect_hyperslab(dsetname, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibool, (/0,0,0,sum(offset_nglob(0:myrank-1))/), H5_COL) dsetname = "xstore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,xstore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,xstore,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dsetname = "ystore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,ystore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,ystore,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dsetname = "zstore_unique" - call h5_read_dataset_collect_hyperslab(dsetname,zstore,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,zstore,(/sum(offset_nglob(0:myrank-1))/),H5_COL) dsetname = "irregular_element_number" - call h5_read_dataset_collect_hyperslab(dsetname,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,irregular_element_number,(/sum(offset_nspec(0:myrank-1))/),H5_COL) dsetname = "xix_regular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,xix_regular,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,xix_regular,(/myrank/),H5_COL) dsetname = "jacobian_regular" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,jacobian_regular,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,jacobian_regular,(/myrank/),H5_COL) dsetname = "xixstore" - call h5_read_dataset_collect_hyperslab(dsetname,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,xixstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "xiystore" - call h5_read_dataset_collect_hyperslab(dsetname,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,xiystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "xizstore" - call h5_read_dataset_collect_hyperslab(dsetname,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,xizstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "etaxstore" - call h5_read_dataset_collect_hyperslab(dsetname,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,etaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "etaystore" - call h5_read_dataset_collect_hyperslab(dsetname,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,etaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "etazstore" - call h5_read_dataset_collect_hyperslab(dsetname,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,etazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "gammaxstore" - call h5_read_dataset_collect_hyperslab(dsetname,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,gammaxstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "gammaystore" - call h5_read_dataset_collect_hyperslab(dsetname,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,gammaystore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "gammazstore" - call h5_read_dataset_collect_hyperslab(dsetname,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,gammazstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "jacobianstore" - call h5_read_dataset_collect_hyperslab(dsetname,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,jacobianstore,(/0,0,0,sum(offset_nspec_irregular(0:myrank-1))/),H5_COL) dsetname = "ispec_is_acoustic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_acoustic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) dsetname = "ispec_is_elastic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_elastic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) dsetname = "ispec_is_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_poroelastic, (/sum(offset_nspec(0:myrank-1))/),H5_COL) dsetname = "kappastore" - call h5_read_dataset_collect_hyperslab(dsetname,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,kappastore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) dsetname = "mustore" - call h5_read_dataset_collect_hyperslab(dsetname,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname,mustore,(/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) endif call bcast_all_i_for_database(NSPEC_AB, 1) @@ -350,7 +350,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmass_acoustic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_acoustic,(/sum(offset_nglob(0:myrank-1))/),H5_COL) endif if (size(rmass_acoustic) > 0) call bcast_all_cr_for_database(rmass_acoustic(1), size(rmass_acoustic)) @@ -366,7 +366,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rhostore" !call h5_read_dataset_p(dsetname, rhostore) - call h5_read_dataset_collect_hyperslab(dsetname, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rhostore, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) endif call bcast_all_cr_for_database(rhostore(1,1,1,1), size(rhostore)) @@ -530,7 +530,7 @@ subroutine read_mesh_databases_hdf5() ! reads mass matrices if (I_should_read_the_database) then dsetname = "rmass" - call h5_read_dataset_collect_hyperslab(dsetname, rmass, (/sum(offset_nglob(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rmass, (/sum(offset_nglob(0:myrank-1))/), H5_COL) endif call bcast_all_cr_for_database(rmass(1), size(rmass)) if (ier /= 0) stop 'Error reading in array rmass' @@ -543,9 +543,9 @@ subroutine read_mesh_databases_hdf5() rmass_ocean_load(:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nglob_ocean",offset_nglob_ocean, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nglob_ocean",offset_nglob_ocean, (/0/), H5_COL) dsetname = "rmass_ocean_load" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_ocean_load, (/sum(offset_nglob_ocean(0:myrank-1))/),H5_COL) endif if (size(rmass_ocean_load) > 0) call bcast_all_cr_for_database(rmass_ocean_load(1), size(rmass_ocean_load)) else @@ -558,12 +558,12 @@ subroutine read_mesh_databases_hdf5() !pll material parameters for stacey conditions if (I_should_read_the_database) then dsetname = "rho_vp" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vp, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) endif if (size(rho_vp) > 0) call bcast_all_cr_for_database(rho_vp(1,1,1,1), size(rho_vp)) if (I_should_read_the_database) then dsetname = "rho_vs" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vs, (/0,0,0,sum(offset_nspec(0:myrank-1))/),H5_COL) endif if (size(rho_vs) > 0) call bcast_all_cr_for_database(rho_vs(1,1,1,1), size(rho_vs)) @@ -675,30 +675,30 @@ subroutine read_mesh_databases_hdf5() epsilons_trace_over_3(:,:,:,:) = 0.0_CUSTOM_REAL; epsilonw_trace_over_3(:,:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspecporo",offset_nspecporo, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspecporo",offset_nspecporo, (/0/), H5_COL) dsetname = "rmass_solid_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_solid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),H5_COL) dsetname = "rmass_fluid_poroelastic" - call h5_read_dataset_collect_hyperslab(dsetname, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rmass_fluid_poroelastic, (/sum(offset_nglob(0:myrank-1))/),H5_COL) dsetname = "rhoarraystore" - call h5_read_dataset_collect_hyperslab(dsetname, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rhoarraystore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "kappaarraystore" call h5_read_dataset_collect_hyperslab(dsetname, kappaarraystore, & - (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "etastore" - call h5_read_dataset_collect_hyperslab(dsetname, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, etastore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "tortstore" - call h5_read_dataset_collect_hyperslab(dsetname, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, tortstore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "permstore" - call h5_read_dataset_collect_hyperslab(dsetname, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, permstore, (/0,0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "phistore" - call h5_read_dataset_collect_hyperslab(dsetname, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, phistore, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "rho_vpI" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vpI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "rho_vpII" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vpII, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) dsetname = "rho_vsI" - call h5_read_dataset_collect_hyperslab(dsetname, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, rho_vsI, (/0,0,0,sum(offset_nspecporo(0:myrank-1))/),H5_COL) endif if (size(rmass_solid_poroelastic) > 0) & call bcast_all_cr_for_database(rmass_solid_poroelastic(1), size(rmass_solid_poroelastic)) @@ -754,17 +754,17 @@ subroutine read_mesh_databases_hdf5() if (PML_CONDITIONS) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspeccpml",offset_nspeccpml, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspeccpml",offset_nspeccpml, (/0/), H5_COL) dsetname = "nspec_cpml" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_CPML, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, NSPEC_CPML, (/myrank/),H5_COL) dsetname = "CPML_width_x" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_x, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_x, (/myrank/),H5_COL) dsetname = "CPML_width_y" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_y, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_y, (/myrank/),H5_COL) dsetname = "CPML_width_z" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_z, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, CPML_width_z, (/myrank/),H5_COL) dsetname = "min_distance_between_CPML_parameter" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, min_distance_between_CPML_parameter, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, min_distance_between_CPML_parameter, (/myrank/),H5_COL) endif call bcast_all_i_for_database(NSPEC_CPML, 1) call bcast_all_cr_for_database(CPML_width_x, 1) @@ -816,29 +816,29 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "CPML_regions" - call h5_read_dataset_collect_hyperslab(dsetname, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, CPML_regions, (/sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "CPML_to_spec" - call h5_read_dataset_collect_hyperslab(dsetname, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, CPML_to_spec, (/sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "is_CPML" - call h5_read_dataset_collect_hyperslab(dsetname, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, is_CPML, (/sum(offset_nspec_ab(0:myrank-1))/),H5_COL) dsetname = "d_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "d_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "d_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, d_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "k_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "k_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "k_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, k_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "alpha_store_x" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_x, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "alpha_store_y" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_y, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) dsetname = "alpha_store_z" - call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, alpha_store_z, (/0,0,0,sum(offset_nspeccpml(0:myrank-1))/),H5_COL) endif if (size(CPML_regions) > 0) call bcast_all_i_for_database(CPML_regions(1), size(CPML_regions)) @@ -858,17 +858,17 @@ subroutine read_mesh_databases_hdf5() ! acoustic if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_nglob_interface_PML_acoustic",offset_nglob_interface_PML_acoustic, (/0/), HDF5_IO_COLLECTIVE) + "offset_nglob_interface_PML_acoustic",offset_nglob_interface_PML_acoustic, (/0/), H5_COL) dsetname = "nglob_interface_PML_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_acoustic, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_acoustic, (/myrank/),H5_COL) endif call bcast_all_i_for_database(nglob_interface_PML_acoustic, 1) ! elastic if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_nglob_interface_PML_elastic",offset_nglob_interface_PML_elastic, (/0/), HDF5_IO_COLLECTIVE) + "offset_nglob_interface_PML_elastic",offset_nglob_interface_PML_elastic, (/0/), H5_COL) dsetname = "nglob_interface_PML_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_elastic, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nglob_interface_PML_elastic, (/myrank/),H5_COL) endif call bcast_all_i_for_database(nglob_interface_PML_elastic, 1) ! acoustic allocation @@ -881,7 +881,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "points_interface_PML_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_acoustic(0:myrank-1))/),H5_COL) endif if (size(points_interface_PML_acoustic) > 0) & call bcast_all_i_for_database(points_interface_PML_acoustic(1), size(points_interface_PML_acoustic)) @@ -896,7 +896,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "points_interface_PML_elastic" call h5_read_dataset_collect_hyperslab(dsetname, & - points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + points_interface_PML_acoustic, (/sum(offset_nglob_interface_PML_elastic(0:myrank-1))/),H5_COL) endif if (size(points_interface_PML_elastic) > 0) & call bcast_all_i_for_database(points_interface_PML_elastic(1), size(points_interface_PML_elastic)) @@ -908,7 +908,7 @@ subroutine read_mesh_databases_hdf5() ! absorbing boundary surface if (I_should_read_the_database) then dsetname = "num_abs_boundary_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_abs_boundary_faces, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_abs_boundary_faces, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_abs_boundary_faces, 1) @@ -930,29 +930,29 @@ subroutine read_mesh_databases_hdf5() abs_boundary_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL; abs_boundary_normal(:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_abs_boundary_faces",offset_num_abs_boundary_faces, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_abs_boundary_faces",offset_num_abs_boundary_faces, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_abs_boundary_faces, size(offset_num_abs_boundary_faces)) if (sum(offset_num_abs_boundary_faces) > 0) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nglob_xy",offset_nglob_xy, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nglob_xy",offset_nglob_xy, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_nglob_xy, size(offset_nglob_xy)) if (I_should_read_the_database) then dsetname = "abs_boundary_ispec" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_ispec, & - (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_abs_boundary_faces(0:myrank-1))/),H5_COL) dsetname = "abs_boundary_ijk" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_ijk, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) dsetname = "abs_boundary_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_jacobian2Dw, & - (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) dsetname = "abs_boundary_normal" call h5_read_dataset_collect_hyperslab(dsetname, abs_boundary_normal, & - (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_abs_boundary_faces(0:myrank-1))/), H5_COL) endif if (size(abs_boundary_ispec) > 0) & call bcast_all_i_for_database(abs_boundary_ispec(1), size(abs_boundary_ispec)) @@ -969,13 +969,13 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmassx" call h5_read_dataset_collect_hyperslab(dsetname, rmassx(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) dsetname = "rmassy" call h5_read_dataset_collect_hyperslab(dsetname, rmassy(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) dsetname = "rmassz" call h5_read_dataset_collect_hyperslab(dsetname, rmassz(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) endif if (size(rmassx) > 0) call bcast_all_cr_for_database(rmassx(1), size(rmassx)) if (size(rmassy) > 0) call bcast_all_cr_for_database(rmassy(1), size(rmassy)) @@ -985,7 +985,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "rmassz_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, rmassz_acoustic(1:offset_nglob_xy(myrank)), & - (/sum(offset_nglob_xy(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_xy(0:myrank-1))/),H5_COL) endif if (size(rmassz_acoustic) > 0) call bcast_all_cr_for_database(rmassz_acoustic(1), size(rmassz_acoustic)) endif @@ -995,17 +995,17 @@ subroutine read_mesh_databases_hdf5() ! boundaries if (I_should_read_the_database) then dsetname = "nspec2D_xmin" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmin, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmin, (/myrank/),H5_COL) dsetname = "nspec2D_xmax" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmax, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_xmax, (/myrank/),H5_COL) dsetname = "nspec2D_ymin" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymin, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymin, (/myrank/),H5_COL) dsetname = "nspec2D_ymax" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymax, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_ymax, (/myrank/),H5_COL) dsetname = "NSPEC2D_BOTTOM" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_bottom, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_bottom, (/myrank/),H5_COL) dsetname = "NSPEC2D_TOP" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_top, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec2D_top, (/myrank/),H5_COL) endif call bcast_all_i_for_database(nspec2D_xmin, 1) call bcast_all_i_for_database(nspec2D_xmax, 1) @@ -1034,27 +1034,27 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then if (sum(offset_nspec2D_xmin) > 0) then dsetname = "ibelm_xmin" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmin, (/sum(offset_nspec2D_xmin(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_xmax) > 0) then dsetname = "ibelm_xmax" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_xmax, (/sum(offset_nspec2D_xmax(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_ymin) > 0) then dsetname = "ibelm_ymin" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymin, (/sum(offset_nspec2D_ymin(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_ymax) > 0) then dsetname = "ibelm_ymax" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_ymax, (/sum(offset_nspec2D_ymax(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_bottom_ext) > 0) then dsetname = "ibelm_bottom" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_bottom, (/sum(offset_nspec2D_bottom_ext(0:myrank-1))/),H5_COL) endif if (sum(offset_nspec2D_top_ext) > 0) then dsetname = "ibelm_top" - call h5_read_dataset_collect_hyperslab(dsetname, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ibelm_top, (/sum(offset_nspec2D_top_ext(0:myrank-1))/),H5_COL) endif endif if (size(ibelm_xmin) > 0) call bcast_all_i_for_database(ibelm_xmin(1), size(ibelm_xmin)) @@ -1067,7 +1067,7 @@ subroutine read_mesh_databases_hdf5() ! free surface if (I_should_read_the_database) then dsetname = "num_free_surface_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_free_surface_faces, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_free_surface_faces, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_free_surface_faces, 1) @@ -1084,7 +1084,7 @@ subroutine read_mesh_databases_hdf5() free_surface_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL; free_surface_normal(:,:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_free_surface_faces",offset_num_free_surface_faces, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_free_surface_faces",offset_num_free_surface_faces, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_free_surface_faces, size(offset_num_free_surface_faces)) @@ -1092,16 +1092,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "free_surface_ispec" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_ispec, & - (/sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dsetname = "free_surface_ijk" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_ijk, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dsetname = "free_surface_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_jacobian2Dw, & - (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) dsetname = "free_surface_normal" call h5_read_dataset_collect_hyperslab(dsetname, free_surface_normal, & - (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_free_surface_faces(0:myrank-1))/),H5_COL) endif if (size(free_surface_ispec) > 0) & call bcast_all_i_for_database(free_surface_ispec(1), size(free_surface_ispec)) @@ -1116,7 +1116,7 @@ subroutine read_mesh_databases_hdf5() ! acoustic-elastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_ac_el_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_el_faces, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_el_faces, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_coupling_ac_el_faces, 1) @@ -1133,7 +1133,7 @@ subroutine read_mesh_databases_hdf5() coupling_ac_el_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_ac_el_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_el_faces",offset_num_coupling_ac_el_faces,(/0/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_el_faces",offset_num_coupling_ac_el_faces,(/0/),H5_COL) endif call bcast_all_i_array_for_database(offset_num_coupling_ac_el_faces, size(offset_num_coupling_ac_el_faces)) @@ -1141,16 +1141,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_ac_el_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_ispec, & - (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_el_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_ijk, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_el_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_el_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_el_normal, & - (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_el_faces(0:myrank-1))/),H5_COL) endif if (size(coupling_ac_el_ispec) > 0) & call bcast_all_i_for_database(coupling_ac_el_ispec(1), size(coupling_ac_el_ispec)) @@ -1165,7 +1165,7 @@ subroutine read_mesh_databases_hdf5() ! acoustic-poroelastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_ac_po_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_po_faces, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_ac_po_faces, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_coupling_ac_po_faces, 1) @@ -1182,7 +1182,7 @@ subroutine read_mesh_databases_hdf5() coupling_ac_po_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_ac_po_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_po_faces",offset_num_coupling_ac_po_faces, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_ac_po_faces",offset_num_coupling_ac_po_faces, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_coupling_ac_po_faces,size(offset_num_coupling_ac_po_faces)) @@ -1190,16 +1190,16 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_ac_po_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_ispec, & - (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_po_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_ijk, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_po_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_ac_po_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_ac_po_normal, & - (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_ac_po_faces(0:myrank-1))/),H5_COL) endif if (size(coupling_ac_po_ispec) > 0) & call bcast_all_i_for_database(coupling_ac_po_ispec(1), size(coupling_ac_po_ispec)) @@ -1214,7 +1214,7 @@ subroutine read_mesh_databases_hdf5() ! elastic-poroelastic coupling surface if (I_should_read_the_database) then dsetname = "num_coupling_el_po_faces" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_el_po_faces, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_coupling_el_po_faces, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_coupling_el_po_faces, 1) @@ -1236,7 +1236,7 @@ subroutine read_mesh_databases_hdf5() coupling_el_po_normal(:,:,:) = 0.0_CUSTOM_REAL; coupling_el_po_jacobian2Dw(:,:) = 0.0_CUSTOM_REAL if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_coupling_el_po_faces",offset_num_coupling_el_po_faces, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_coupling_el_po_faces",offset_num_coupling_el_po_faces, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_coupling_el_po_faces,size(offset_num_coupling_el_po_faces)) @@ -1244,22 +1244,22 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "coupling_el_po_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_po_el_ispec" call h5_read_dataset_collect_hyperslab(dsetname, coupling_po_el_ispec, & - (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_el_po_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_po_el_ijk" call h5_read_dataset_collect_hyperslab(dsetname, coupling_po_el_ijk, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_el_po_jacobian2Dw" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_jacobian2Dw, & - (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) dsetname = "coupling_el_po_normal" call h5_read_dataset_collect_hyperslab(dsetname, coupling_el_po_normal, & - (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,0,sum(offset_num_coupling_el_po_faces(0:myrank-1))/),H5_COL) endif if (size(coupling_el_po_ispec) > 0) & call bcast_all_i_for_database(coupling_el_po_ispec(1), size(coupling_el_po_ispec)) @@ -1278,7 +1278,7 @@ subroutine read_mesh_databases_hdf5() ! MPI interfaces if (I_should_read_the_database) then dsetname = "num_interfaces_ext_mesh" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_interfaces_ext_mesh, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_interfaces_ext_mesh, (/myrank/),H5_COL) endif call bcast_all_i_for_database(num_interfaces_ext_mesh, 1) @@ -1290,14 +1290,14 @@ subroutine read_mesh_databases_hdf5() my_neighbors_ext_mesh(:) = -1; nibool_interfaces_ext_mesh(:) = 0 if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_interfaces_ext_mesh",offset_num_interfaces_ext_mesh, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_interfaces_ext_mesh",offset_num_interfaces_ext_mesh, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_interfaces_ext_mesh,size(offset_num_interfaces_ext_mesh)) if (sum(offset_num_interfaces_ext_mesh) > 0) then if (I_should_read_the_database) then dsetname = "max_nibool_interfaces_ext_mesh" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, max_nibool_interfaces_ext_mesh, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, max_nibool_interfaces_ext_mesh, (/myrank/),H5_COL) endif call bcast_all_i_for_database(max_nibool_interfaces_ext_mesh, 1) allocate(ibool_interfaces_ext_mesh(max_nibool_interfaces_ext_mesh,num_interfaces_ext_mesh),stat=ier) @@ -1308,13 +1308,13 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "my_neighbors_ext_mesh" call h5_read_dataset_collect_hyperslab(dsetname, my_neighbors_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) dsetname = "nibool_interfaces_ext_mesh" call h5_read_dataset_collect_hyperslab(dsetname, nibool_interfaces_ext_mesh, & - (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) dsetname = "ibool_interfaces_ext_mesh_dummy" call h5_read_dataset_collect_hyperslab(dsetname, ibool_interfaces_ext_mesh, & - (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/0,sum(offset_num_interfaces_ext_mesh(0:myrank-1))/),H5_COL) endif if (size(my_neighbors_ext_mesh) > 0) & call bcast_all_i_for_database(my_neighbors_ext_mesh(1), size(my_neighbors_ext_mesh)) @@ -1333,49 +1333,49 @@ subroutine read_mesh_databases_hdf5() ! material properties if (ELASTIC_SIMULATION .and. ANISOTROPY) then if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_nspec_aniso",offset_nspec_aniso, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_nspec_aniso",offset_nspec_aniso, (/0/), H5_COL) dsetname = "c11store" - call h5_read_dataset_collect_hyperslab(dsetname, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c11store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c12store" - call h5_read_dataset_collect_hyperslab(dsetname, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c12store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c13store" - call h5_read_dataset_collect_hyperslab(dsetname, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c13store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c14store" - call h5_read_dataset_collect_hyperslab(dsetname, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c14store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c15store" - call h5_read_dataset_collect_hyperslab(dsetname, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c15store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c16store" - call h5_read_dataset_collect_hyperslab(dsetname, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c16store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c22store" - call h5_read_dataset_collect_hyperslab(dsetname, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c22store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c23store" - call h5_read_dataset_collect_hyperslab(dsetname, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c23store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c24store" - call h5_read_dataset_collect_hyperslab(dsetname, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c24store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c25store" - call h5_read_dataset_collect_hyperslab(dsetname, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c25store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c26store" - call h5_read_dataset_collect_hyperslab(dsetname, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c26store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c33store" - call h5_read_dataset_collect_hyperslab(dsetname, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c33store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c34store" - call h5_read_dataset_collect_hyperslab(dsetname, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c34store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c35store" - call h5_read_dataset_collect_hyperslab(dsetname, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c35store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c36store" - call h5_read_dataset_collect_hyperslab(dsetname, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c36store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c44store" - call h5_read_dataset_collect_hyperslab(dsetname, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c44store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c45store" - call h5_read_dataset_collect_hyperslab(dsetname, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c45store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c46store" - call h5_read_dataset_collect_hyperslab(dsetname, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c46store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c55store" - call h5_read_dataset_collect_hyperslab(dsetname, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c55store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c56store" - call h5_read_dataset_collect_hyperslab(dsetname, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c56store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) dsetname = "c66store" - call h5_read_dataset_collect_hyperslab(dsetname, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, c66store, (/0,0,0,sum(offset_nspec_aniso(0:myrank-1))/), H5_COL) endif if (size(c11store) > 0) call bcast_all_cr_for_database(c11store(1,1,1,1), size(c11store)) if (size(c12store) > 0) call bcast_all_cr_for_database(c12store(1,1,1,1), size(c12store)) @@ -1408,18 +1408,18 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "ispec_is_inner" - call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_inner,(/sum(offset_nspec(0:myrank-1))/),H5_COL) endif if (size(ispec_is_inner) > 0) call bcast_all_l_for_database(ispec_is_inner(1), size(ispec_is_inner)) if (ACOUSTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_acoustic,(/myrank/),H5_COL) dsetname = "nspec_outer_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_acoustic,(/myrank/),H5_COL) dsetname = "num_phase_ispec_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_acoustic,(/myrank/),H5_COL) endif call bcast_all_i_for_database(nspec_inner_acoustic, 1) call bcast_all_i_for_database(nspec_outer_acoustic, 1) @@ -1432,12 +1432,12 @@ subroutine read_mesh_databases_hdf5() phase_ispec_inner_acoustic(:,:) = 0 call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_acoustic", & - offset_num_phase_ispec_acoustic, (/0/), HDF5_IO_COLLECTIVE) + offset_num_phase_ispec_acoustic, (/0/), H5_COL) if (sum(offset_num_phase_ispec_acoustic) > 0) then if (I_should_read_the_database) then dsetname = "phase_ispec_inner_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_acoustic, & - (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_acoustic(0:myrank-1)),0/),H5_COL) endif if (size(phase_ispec_inner_acoustic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_acoustic(1,1), size(phase_ispec_inner_acoustic)) @@ -1447,11 +1447,11 @@ subroutine read_mesh_databases_hdf5() if (ELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_elastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_elastic,(/myrank/),H5_COL) dsetname = "nspec_outer_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_elastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_elastic,(/myrank/),H5_COL) dsetname = "num_phase_ispec_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_elastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_elastic,(/myrank/),H5_COL) endif call bcast_all_i_for_database(nspec_inner_elastic, 1) call bcast_all_i_for_database(nspec_outer_elastic, 1) @@ -1464,7 +1464,7 @@ subroutine read_mesh_databases_hdf5() phase_ispec_inner_elastic(:,:) = 0 if (I_should_read_the_database) then - call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_elastic",offset_num_phase_ispec_elastic, (/0/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_elastic",offset_num_phase_ispec_elastic, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_phase_ispec_elastic,size(offset_num_phase_ispec_elastic)) @@ -1472,7 +1472,7 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "phase_ispec_inner_elastic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_elastic, & - (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_elastic(0:myrank-1)),0/),H5_COL) endif if (size(phase_ispec_inner_elastic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_elastic(1,1), size(phase_ispec_inner_elastic)) @@ -1482,11 +1482,11 @@ subroutine read_mesh_databases_hdf5() if (POROELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "nspec_inner_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_poroelastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_inner_poroelastic,(/myrank/),H5_COL) dsetname = "nspec_outer_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_poroelastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nspec_outer_poroelastic,(/myrank/),H5_COL) dsetname = "num_phase_ispec_poroelastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_poroelastic, (/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_phase_ispec_poroelastic, (/myrank/),H5_COL) endif call bcast_all_i_for_database(nspec_inner_poroelastic, 1) call bcast_all_i_for_database(nspec_outer_poroelastic, 1) @@ -1500,14 +1500,14 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab("offset_num_phase_ispec_poroelastic", & - offset_num_phase_ispec_poroelastic, (/0/), HDF5_IO_COLLECTIVE) + offset_num_phase_ispec_poroelastic, (/0/), H5_COL) endif call bcast_all_i_array_for_database(offset_num_phase_ispec_poroelastic,size(offset_num_phase_ispec_poroelastic)) if (sum(offset_num_phase_ispec_poroelastic) > 0) then if (I_should_read_the_database) then dsetname = "phase_ispec_inner_poroelastic" call h5_read_dataset_collect_hyperslab(dsetname, phase_ispec_inner_poroelastic, & - (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_phase_ispec_poroelastic(0:myrank-1)),0/),H5_COL) endif if (size(phase_ispec_inner_poroelastic) > 0) & call bcast_all_i_for_database(phase_ispec_inner_poroelastic(1,1), size(phase_ispec_inner_poroelastic)) @@ -1520,9 +1520,9 @@ subroutine read_mesh_databases_hdf5() if (ACOUSTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "num_colors_outer_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_acoustic,(/myrank/),H5_COL) dsetname = "num_colors_inner_acoustic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_acoustic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_acoustic,(/myrank/),H5_COL) endif call bcast_all_i_for_database(num_colors_outer_acoustic, 1) call bcast_all_i_for_database(num_colors_inner_acoustic, 1) @@ -1534,10 +1534,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_num_colors_acoustic",offset_num_colors_acoustic, (/0/), HDF5_IO_COLLECTIVE) + "offset_num_colors_acoustic",offset_num_colors_acoustic, (/0/), H5_COL) dsetname = "num_elem_colors_acoustic" call h5_read_dataset_collect_hyperslab(dsetname, & - num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + num_elem_colors_acoustic,(/sum(offset_num_colors_acoustic(0:myrank-1))/),H5_COL) endif if (size(num_elem_colors_acoustic) > 0) & call bcast_all_i_for_database(num_elem_colors_acoustic(1), size(num_elem_colors_acoustic)) @@ -1546,9 +1546,9 @@ subroutine read_mesh_databases_hdf5() if (ELASTIC_SIMULATION) then if (I_should_read_the_database) then dsetname = "num_colors_outer_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_elastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_outer_elastic,(/myrank/),H5_COL) dsetname = "num_colors_inner_elastic" - call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_elastic,(/myrank/),HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname,num_colors_inner_elastic,(/myrank/),H5_COL) endif call bcast_all_i_for_database(num_colors_outer_elastic, 1) call bcast_all_i_for_database(num_colors_inner_elastic, 1) @@ -1560,10 +1560,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then call h5_read_dataset_collect_hyperslab( & - "offset_num_colors_elastic",offset_num_colors_elastic, (/0/), HDF5_IO_COLLECTIVE) + "offset_num_colors_elastic",offset_num_colors_elastic, (/0/), H5_COL) dsetname = "num_elem_colors_elastic" call h5_read_dataset_collect_hyperslab(dsetname, num_elem_colors_elastic, & - (/sum(offset_num_colors_elastic(0:myrank-1))/),HDF5_IO_COLLECTIVE) + (/sum(offset_num_colors_elastic(0:myrank-1))/),H5_COL) endif if (size(num_elem_colors_elastic) > 0) & call bcast_all_i_for_database(num_elem_colors_elastic(1), size(num_elem_colors_elastic)) @@ -1600,13 +1600,13 @@ subroutine read_mesh_databases_hdf5() ! used for receiver detection, movie files and shakemaps if (I_should_read_the_database) then dsetname = "nfaces_surface" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, nfaces_surface, (/myrank/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, nfaces_surface, (/myrank/), H5_COL) dsetname = "ispec_is_surface_external_mesh" call h5_read_dataset_collect_hyperslab(dsetname, ispec_is_surface_external_mesh, & - (/sum(offset_nspec_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_nspec_ab(0:myrank-1))/), H5_COL) dsetname = "iglob_is_surface_external_mesh" call h5_read_dataset_collect_hyperslab(dsetname, iglob_is_surface_external_mesh, & - (/sum(offset_nglob_ab(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_nglob_ab(0:myrank-1))/), H5_COL) endif call bcast_all_i_for_database(nfaces_surface, 1) call bcast_all_l_for_database(ispec_is_surface_external_mesh(1), size(ispec_is_surface_external_mesh)) @@ -1615,7 +1615,7 @@ subroutine read_mesh_databases_hdf5() ! for mesh adjacency if (I_should_read_the_database) then dsetname = "num_neighbors_all" - call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_neighbors_all, (/myrank/), HDF5_IO_COLLECTIVE) + call h5_read_dataset_scalar_collect_hyperslab(dsetname, num_neighbors_all, (/myrank/), H5_COL) endif call bcast_all_i_for_database(num_neighbors_all, 1) @@ -1629,10 +1629,10 @@ subroutine read_mesh_databases_hdf5() if (I_should_read_the_database) then dsetname = "neighbors_xadj" call h5_read_dataset_collect_hyperslab(dsetname, neighbors_xadj, & - (/sum(offset_neighbors_xadj(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_neighbors_xadj(0:myrank-1))/), H5_COL) dsetname = "neighbors_adjncy" call h5_read_dataset_collect_hyperslab(dsetname, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), HDF5_IO_COLLECTIVE) + (/sum(offset_neighbors_adjncy(0:myrank-1))/), H5_COL) endif call bcast_all_i_for_database(neighbors_xadj(1), size(neighbors_xadj)) call bcast_all_i_for_database(neighbors_adjncy(1), size(neighbors_adjncy)) diff --git a/src/specfem3D/write_movie_output_HDF5.F90 b/src/specfem3D/write_movie_output_HDF5.F90 index 3794db1ce..04d359f02 100644 --- a/src/specfem3D/write_movie_output_HDF5.F90 +++ b/src/specfem3D/write_movie_output_HDF5.F90 @@ -1033,7 +1033,7 @@ end subroutine wmo_movie_save_volume_snapshot_hdf5 subroutine prepare_vol_movie_hdf5() use specfem_par_movie_hdf5 - use shared_parameters, only: HDF5_IO_COLLECTIVE + use shared_parameters, only: H5_COL implicit none @@ -1120,13 +1120,13 @@ subroutine prepare_vol_movie_hdf5() call h5_open_group(group_name) dset_name = "elm_conn" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,elm_conn_loc,(/0,nelm_offset(myrank)/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,elm_conn_loc,(/0,nelm_offset(myrank)/),H5_COL) dset_name = "x" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,xstore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,xstore,(/nglob_offset(myrank)/),H5_COL) dset_name = "y" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,ystore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,ystore,(/nglob_offset(myrank)/),H5_COL) dset_name = "z" - call h5_write_dataset_collect_hyperslab_in_group(dset_name,zstore,(/nglob_offset(myrank)/),HDF5_IO_COLLECTIVE) + call h5_write_dataset_collect_hyperslab_in_group(dset_name,zstore,(/nglob_offset(myrank)/),H5_COL) call h5_close_group() call h5_close_file() @@ -1143,7 +1143,7 @@ end subroutine prepare_vol_movie_hdf5 subroutine write_vol_data_hdf5(darr, dset_name) use specfem_par_movie_hdf5 - use shared_parameters, only: HDF5_IO_COLLECTIVE + use shared_parameters, only: H5_COL implicit none @@ -1187,7 +1187,7 @@ subroutine write_vol_data_hdf5(darr, dset_name) call h5_open_file_p(fname_h5_data_vol) call h5_open_group(group_name) call h5_write_dataset_collect_hyperslab_in_group(dset_name, & - darr, (/nglob_offset(myrank)/), HDF5_IO_COLLECTIVE) + darr, (/nglob_offset(myrank)/), H5_COL) call h5_close_group() call h5_close_file() From 3761aab6ecd142d59827d5ea0dd537c10997b37f Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Wed, 11 Sep 2024 14:39:01 -0600 Subject: [PATCH 48/56] use generic function --- src/shared/check_mesh_resolution.f90 | 10 +++++----- src/shared/hdf5_manager.F90 | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/shared/check_mesh_resolution.f90 b/src/shared/check_mesh_resolution.f90 index 0a94ae223..42f4d909e 100644 --- a/src/shared/check_mesh_resolution.f90 +++ b/src/shared/check_mesh_resolution.f90 @@ -524,12 +524,12 @@ subroutine check_mesh_resolution(NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, & if (DT_PRESENT) then filename = 'res_Courant_number' call write_checkmesh_data_hdf5(filename,tmp1) - else - ! minimum period estimate - filename = 'res_minimum_period' - call write_checkmesh_data_hdf5(filename,tmp2) - call write_checkmesh_xdmf_hdf5(NSPEC_AB) endif + + ! minimum period estimate + filename = 'res_minimum_period' + call write_checkmesh_data_hdf5(filename,tmp2) + call write_checkmesh_xdmf_hdf5(NSPEC_AB) else ! default output call create_name_database(prname,myrank,LOCAL_PATH) diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 1bcd3d3a9..591b5515f 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -526,16 +526,16 @@ subroutine read_attenuation_file_hdf5(factor_common, scale_factor, factor_common ! open file call h5_open_file_p_collect(fname) ! read offset array - call h5_read_dataset_1d_i_collect_hyperslab("offset_nspec",offset_nspec, (/0/), H5_COL) + call h5_read_dataset_collect_hyperslab("offset_nspec",offset_nspec, (/0/), H5_COL) - call h5_read_dataset_4d_r_collect_hyperslab("scale_factor", scale_factor, & - (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) - call h5_read_dataset_4d_r_collect_hyperslab("scale_factor_kappa", scale_factor_kappa, & - (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) - call h5_read_dataset_5d_r_collect_hyperslab("factor_common", factor_common, & - (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) - call h5_read_dataset_5d_r_collect_hyperslab("factor_common_kappa", factor_common_kappa, & - (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) + call h5_read_dataset_collect_hyperslab("scale_factor", scale_factor, & + (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) + call h5_read_dataset_collect_hyperslab("scale_factor_kappa", scale_factor_kappa, & + (/0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) + call h5_read_dataset_collect_hyperslab("factor_common", factor_common, & + (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) + call h5_read_dataset_collect_hyperslab("factor_common_kappa", factor_common_kappa, & + (/0,0,0,0,sum(offset_nspec(0:myrank-1))/), H5_COL) call h5_close_file_p() call h5_finalize() @@ -614,7 +614,7 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) ! open file call h5_open_file_p_collect(filename) - call h5_write_dataset_1d_r_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), H5_COL) + call h5_write_dataset_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), H5_COL) call h5_close_file_p() call h5_finalize() From f62943947ebd5866a5e8a384297c645cf210b2e3 Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Wed, 11 Sep 2024 16:02:43 -0600 Subject: [PATCH 49/56] add workaround --- src/shared/hdf5_manager.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 591b5515f..6878e8700 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -612,8 +612,13 @@ subroutine write_checkmesh_data_hdf5(dset_name,dump_array) endif call synchronize_all() - ! open file - call h5_open_file_p_collect(filename) + ! open file (usually *_collect can be used with H5_COL = .false.) + ! but I got a strange error on some systems, so I use if statement here + if (H5_COL) then + call h5_open_file_p_collect(filename) + else + call h5_open_file_p(filename) + endif call h5_write_dataset_collect_hyperslab(dset_name, dump_array, (/sum(offset(0:myrank-1))/), H5_COL) call h5_close_file_p() From 87ae727748eb3217d059a97e429482ec1f00e31f Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Thu, 12 Sep 2024 11:27:19 -0600 Subject: [PATCH 50/56] support large integer --- .../read_partition_files_hdf5.F90 | 2 +- .../save_arrays_solver_hdf5.F90 | 9 +- src/shared/hdf5_manager.F90 | 133 +++++++++++++++++- 3 files changed, 139 insertions(+), 5 deletions(-) diff --git a/src/generate_databases/read_partition_files_hdf5.F90 b/src/generate_databases/read_partition_files_hdf5.F90 index 2db20bc5a..ac62dde7c 100644 --- a/src/generate_databases/read_partition_files_hdf5.F90 +++ b/src/generate_databases/read_partition_files_hdf5.F90 @@ -195,7 +195,7 @@ subroutine read_partition_files_hdf5() if (ier /= 0) stop 'Error allocating array nodes_coords_ext_mesh' nodes_coords_ext_mesh(:,:) = 0.0 - call h5_read_dataset_collect_hyperslab(dsetname, nodes_coords_ext_mesh, (/0,sum(offset_nnodes(0:myrank-1))/),.true.) !!!!!!!!!!!!!! + call h5_read_dataset_collect_hyperslab(dsetname, nodes_coords_ext_mesh, (/0,sum(offset_nnodes(0:myrank-1))/),.true.) call sum_all_i(nnodes_ext_mesh,num) if (myrank == 0) then diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index 48e57041f..df1cb526f 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -133,6 +133,9 @@ subroutine save_arrays_solver_mesh_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy + ! avoid integer overflow + integer(kind=8) :: sum_neighbors_adjncy, offset_neighbors_adjncy_this_proc + ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) @@ -871,7 +874,8 @@ subroutine save_arrays_solver_mesh_hdf5() dset_name = "neighbors_xadj" ! 1 i (/offset_neighbors_xadj/) ! actual array size: nspec_ab + 1 call h5_create_dataset_gen(dset_name,(/sum(offset_neighbors_xadj(:))/), 1, 0) dset_name = "neighbors_adjncy" ! 1 i (/offset_neighbors_adjncy/) - call h5_create_dataset_gen(dset_name,(/sum(offset_neighbors_adjncy(:))/), 1, 0) + sum_neighbors_adjncy = sum(offset_neighbors_adjncy(:)) ! to avoid integer overflow + call h5_create_dataset_gen(dset_name,(/sum_neighbors_adjncy/), 1, 1) ! 64bit integer ! arrays for visualization dset_name = "spec_elm_conn_xdmf" ! 2 i (/0,offset_nspec*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/) @@ -1449,8 +1453,9 @@ subroutine save_arrays_solver_mesh_hdf5() call h5_write_dataset_collect_hyperslab(dset_name, neighbors_xadj, & (/sum(offset_neighbors_xadj(0:myrank-1))/), H5_COL) dset_name = "neighbors_adjncy" ! 1 i (/offset_num_neighbors_all/) + offset_neighbors_adjncy_this_proc = sum(offset_neighbors_adjncy(0:myrank-1)) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), H5_COL) + (/offset_neighbors_adjncy_this_proc/), H5_COL) ! arrays for visualization dset_name = "spec_elm_conn_xdmf" ! 2 i (/0,offset_nspec*(NGLLX-1)*(NGLLY-1)*(NGLLZ-1)/) diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 6878e8700..82b9fc3e7 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -254,6 +254,7 @@ module manager_hdf5 interface h5_write_dataset_collect_hyperslab module procedure h5_write_dataset_1d_l_collect_hyperslab ! logical module procedure h5_write_dataset_1d_i_collect_hyperslab ! integer + module procedure h5_write_dataset_1d_i64_collect_hyperslab ! integer 64-bit module procedure h5_write_dataset_2d_i_collect_hyperslab module procedure h5_write_dataset_3d_i_collect_hyperslab module procedure h5_write_dataset_4d_i_collect_hyperslab @@ -265,6 +266,13 @@ module manager_hdf5 module procedure h5_write_dataset_2d_d_collect_hyperslab ! double end interface h5_write_dataset_collect_hyperslab +! generic interface to create dataset +interface h5_create_dataset_gen + module procedure h5_create_dataset_gen_int + module procedure h5_create_dataset_gen_int64 +end interface h5_create_dataset_gen + + ! object-oriented interface ! (Fortran 2003 standard style) ! @@ -1756,7 +1764,7 @@ end subroutine h5_open_file_p_collect !------------------------------------------------------------------------------- ! - subroutine h5_create_dataset_gen(dataset_name, dim_in, rank, dtype_id) + subroutine h5_create_dataset_gen_int(dataset_name, dim_in, rank, dtype_id) implicit none character(len=*), intent(in) :: dataset_name integer, dimension(:), intent(in) :: dim_in @@ -1817,7 +1825,75 @@ subroutine h5_create_dataset_gen(dataset_name, dim_in, rank, dtype_id) if (error /= 0) write(*,*) 'hdf5 dataspace close failed for ', dataset_name call check_error() - end subroutine h5_create_dataset_gen + end subroutine h5_create_dataset_gen_int + +! +!------------------------------------------------------------------------------- +! + + subroutine h5_create_dataset_gen_int64(dataset_name, dim_in, rank, dtype_id) + implicit none + character(len=*), intent(in) :: dataset_name + integer(kind=8), dimension(:), intent(in) :: dim_in + + integer(HSIZE_T), dimension(size(dim_in)) :: dim + integer, intent(in) :: dtype_id ! 1:int, 4:real4, 8:real8, + integer, intent(in) :: rank + + integer(HID_T) :: dspace_id + !logical :: if_chunk = .true. + !integer :: i + + dim = dim_in ! convert data type + + call h5screate_simple_f(rank, dim, dspace_id, error) + if (error /= 0) write(*,*) 'hdf5 dataspace create failed for ', dataset_name + call check_error() + call h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) + call check_error() + + ! chunk size setting + !do i = 1, rank + ! if (dim(i) <= 0) then + ! if_chunk = .false. + ! print *, "dataset not chunk set: ", dataset_name + ! endif + !enddo + !if (if_chunk) call h5pset_chunk_f(plist_id,rank,dim,error) + + if (dtype_id == 0) then ! bool uses integer + call h5dcreate_f(file_id, trim(dataset_name), H5T_NATIVE_INTEGER, dspace_id, dataset_id, error, & + dcpl_id=plist_id) + else if (dtype_id == 1) then ! integer + call h5dcreate_f(file_id, trim(dataset_name), H5T_NATIVE_INTEGER, dspace_id, dataset_id, error, & + dcpl_id=plist_id) + else if (dtype_id == 2) then ! character + call h5dcreate_f(file_id, trim(dataset_name), str_type, dspace_id, dataset_id, error, & + dcpl_id=plist_id) + else if (dtype_id == 4) then ! real + call h5dcreate_f(file_id, trim(dataset_name), H5T_NATIVE_REAL, dspace_id, dataset_id, error, & + dcpl_id=plist_id) + else if (dtype_id == 8) then ! double + call h5dcreate_f(file_id, trim(dataset_name), H5T_NATIVE_DOUBLE, dspace_id, dataset_id, error, & + dcpl_id=plist_id) + else + print *, "specified dtype_id is not implemented yet for hdf5 io. aborting..." + stop 'Invalid dtype_id, not implemented yet in h5_create_dataset_gen() routine' + endif + if (error /= 0) write(*,*) 'hdf5 dataset create failed for ', dataset_name + call check_error() + + call h5_close_prop_list_nocheck(dataset_name) + + call h5dclose_f(dataset_id,error) + if (error /= 0) write(*,*) 'hdf5 dataset close failed for ', dataset_name + call check_error() + call h5sclose_f(dspace_id, error) + if (error /= 0) write(*,*) 'hdf5 dataspace close failed for ', dataset_name + call check_error() + + end subroutine h5_create_dataset_gen_int64 + ! !------------------------------------------------------------------------------- @@ -3981,6 +4057,59 @@ end subroutine h5_write_dataset_1d_i_collect_hyperslab !------------------------------------------------------------------------------- ! +! store local 1d array to global 1d array + subroutine h5_write_dataset_1d_i64_collect_hyperslab(dataset_name, data, offset_in, if_collective) + implicit none + character(len=*), intent(in) :: dataset_name + integer, dimension(:), intent(in), target :: data + integer(kind=8), dimension(:), intent(in) :: offset_in + logical, intent(in) :: if_collective + ! local parameters + integer :: rank = 1 + integer(HSIZE_T), dimension(1) :: dim + integer(HSIZE_T), dimension(1) :: count ! size of hyperslab + integer(HSSIZE_T), dimension(1) :: offset ! the position where the datablock is inserted + + dim = shape(data) + offset = offset_in ! convert data type + + ! open dataset + call h5_open_dataset2(trim(dataset_name)) + + ! select a place where data is inserted. + count(1) = dim(1) + + ! select hyperslab in the file + call h5screate_simple_f(rank,count, mem_dspace_id, error) + call check_error() + call h5dget_space_f(dataset_id, file_dspace_id, error) + call check_error() + call h5sselect_hyperslab_f(file_dspace_id, H5S_SELECT_SET_F, offset, count, error) + call check_error() + call h5_create_dataset_prop_list(if_collective) + + call h5_check_arr_dim(dim) + ! write array using Fortran pointer + !call h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, data, dim, error, & + ! file_space_id=file_dspace_id, mem_space_id=mem_dspace_id, xfer_prp=plist_id) + ! use F2003 API + call h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, c_loc(data(1)), error, & + file_space_id=file_dspace_id, mem_space_id=mem_dspace_id, xfer_prp=plist_id) + if (error /= 0) write(*,*) 'hdf5 dataset write failed for ', dataset_name + call check_error() + call h5_close_prop_list(dataset_name) + call h5sclose_f(mem_dspace_id, error) + call check_error() + call h5sclose_f(file_dspace_id, error) + call check_error() + call h5_close_dataset() + end subroutine h5_write_dataset_1d_i64_collect_hyperslab + +! +!------------------------------------------------------------------------------- +! + + subroutine h5_write_dataset_1d_r_collect_hyperslab(dataset_name, data, offset_in, if_collective) implicit none character(len=*), intent(in) :: dataset_name From bebcb5afbae5d2d15d9f0857232adcf326769d6a Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Thu, 12 Sep 2024 12:19:18 -0600 Subject: [PATCH 51/56] copy to 64bit array --- src/generate_databases/save_arrays_solver_hdf5.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index df1cb526f..d8b75e9e5 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -135,6 +135,8 @@ subroutine save_arrays_solver_mesh_hdf5() ! avoid integer overflow integer(kind=8) :: sum_neighbors_adjncy, offset_neighbors_adjncy_this_proc + integer(kind=8), dimension(0:NPROC-1) :: offset_neighbors_adjncy_i8 + ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" @@ -249,6 +251,8 @@ subroutine save_arrays_solver_mesh_hdf5() ! mesh adjacency call gather_all_all_singlei(nspec_ab+1,offset_neighbors_xadj,NPROC) call gather_all_all_singlei(num_neighbors_all,offset_neighbors_adjncy,NPROC) + offset_neighbors_adjncy_i8 = offset_neighbors_adjncy + sum_neighbors_adjncy = sum(offset_neighbors_adjncy_i8) ! ! make datasets by main @@ -874,7 +878,6 @@ subroutine save_arrays_solver_mesh_hdf5() dset_name = "neighbors_xadj" ! 1 i (/offset_neighbors_xadj/) ! actual array size: nspec_ab + 1 call h5_create_dataset_gen(dset_name,(/sum(offset_neighbors_xadj(:))/), 1, 0) dset_name = "neighbors_adjncy" ! 1 i (/offset_neighbors_adjncy/) - sum_neighbors_adjncy = sum(offset_neighbors_adjncy(:)) ! to avoid integer overflow call h5_create_dataset_gen(dset_name,(/sum_neighbors_adjncy/), 1, 1) ! 64bit integer ! arrays for visualization @@ -1453,7 +1456,7 @@ subroutine save_arrays_solver_mesh_hdf5() call h5_write_dataset_collect_hyperslab(dset_name, neighbors_xadj, & (/sum(offset_neighbors_xadj(0:myrank-1))/), H5_COL) dset_name = "neighbors_adjncy" ! 1 i (/offset_num_neighbors_all/) - offset_neighbors_adjncy_this_proc = sum(offset_neighbors_adjncy(0:myrank-1)) + offset_neighbors_adjncy_this_proc = sum(offset_neighbors_adjncy_i8(0:myrank-1)) call h5_write_dataset_collect_hyperslab(dset_name, neighbors_adjncy, & (/offset_neighbors_adjncy_this_proc/), H5_COL) From d1d0415895182e3b429e14daea7e8fd9b87338bb Mon Sep 17 00:00:00 2001 From: Masaru Nagaso Date: Thu, 12 Sep 2024 13:15:57 -0600 Subject: [PATCH 52/56] read large adjncy --- .../save_arrays_solver_hdf5.F90 | 1 - src/shared/hdf5_manager.F90 | 54 +++++++++++++++++++ src/specfem3D/read_mesh_databases_hdf5.F90 | 8 ++- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/generate_databases/save_arrays_solver_hdf5.F90 b/src/generate_databases/save_arrays_solver_hdf5.F90 index d8b75e9e5..5a50efe26 100644 --- a/src/generate_databases/save_arrays_solver_hdf5.F90 +++ b/src/generate_databases/save_arrays_solver_hdf5.F90 @@ -137,7 +137,6 @@ subroutine save_arrays_solver_mesh_hdf5() integer(kind=8) :: sum_neighbors_adjncy, offset_neighbors_adjncy_this_proc integer(kind=8), dimension(0:NPROC-1) :: offset_neighbors_adjncy_i8 - ! saves mesh file external_mesh.h5 tempstr = "/external_mesh.h5" filename = LOCAL_PATH(1:len_trim(LOCAL_PATH))//trim(tempstr) diff --git a/src/shared/hdf5_manager.F90 b/src/shared/hdf5_manager.F90 index 82b9fc3e7..d781d4022 100644 --- a/src/shared/hdf5_manager.F90 +++ b/src/shared/hdf5_manager.F90 @@ -194,6 +194,7 @@ module manager_hdf5 interface h5_read_dataset_collect_hyperslab module procedure h5_read_dataset_1d_l_collect_hyperslab ! logical module procedure h5_read_dataset_1d_i_collect_hyperslab ! integer + module procedure h5_read_dataset_1d_i64_collect_hyperslab ! integer 64-bit module procedure h5_read_dataset_2d_i_collect_hyperslab module procedure h5_read_dataset_3d_i_collect_hyperslab module procedure h5_read_dataset_4d_i_collect_hyperslab @@ -2605,7 +2606,60 @@ subroutine h5_read_dataset_1d_i_collect_hyperslab(dataset_name, data, offset_in, call h5_close_dataset() end subroutine h5_read_dataset_1d_i_collect_hyperslab + ! +!------------------------------------------------------------------------------- ! + + subroutine h5_read_dataset_1d_i64_collect_hyperslab(dataset_name, data, offset_in, if_collective) + implicit none + character(len=*), intent(in) :: dataset_name + integer, dimension(:), intent(inout), target :: data + integer(kind=8), dimension(:), intent(in) :: offset_in + logical, intent(in) :: if_collective + ! local parameters + integer :: rank = 1 + integer(HSIZE_T), dimension(1) :: dim + integer(HSIZE_T), dimension(1) :: count ! size of hyperslab + integer(HSSIZE_T), dimension(1) :: offset ! the position where the datablock is inserted + + dim = shape(data) + offset = offset_in ! convert data type + + ! open dataset + call h5_open_dataset2(trim(dataset_name)) + + ! select a place where data is inserted. + count(1) = dim(1) + + ! select hyperslab in the file + call h5screate_simple_f(rank,count, mem_dspace_id, error) + call check_error() + call h5dget_space_f(dataset_id, file_dspace_id, error) + call check_error() + call h5sselect_hyperslab_f(file_dspace_id, H5S_SELECT_SET_F, offset, count, error) + call check_error() + call h5_create_dataset_prop_list(if_collective) + + call h5_check_arr_dim(dim) + + ! write array using Fortran pointer + !call h5dread_f(dataset_id, H5T_NATIVE_INTEGER, data, dim, error, & + ! file_space_id=file_dspace_id, mem_space_id=mem_dspace_id, xfer_prp=plist_id) + ! use F2003 API + f_ptr = c_loc(data(1)) + call h5dread_f(dataset_id, H5T_NATIVE_INTEGER, f_ptr, error, & + file_space_id=file_dspace_id, mem_space_id=mem_dspace_id, xfer_prp=plist_id) + if (error /= 0) write(*,*) 'hdf5 dataset write failed for ', dataset_name + call check_error() + call h5_close_prop_list(dataset_name) + call h5sclose_f(mem_dspace_id, error) + call check_error() + call h5sclose_f(file_dspace_id, error) + call check_error() + call h5_close_dataset() + end subroutine h5_read_dataset_1d_i64_collect_hyperslab + + !------------------------------------------------------------------------------- ! diff --git a/src/specfem3D/read_mesh_databases_hdf5.F90 b/src/specfem3D/read_mesh_databases_hdf5.F90 index 7c908506f..0b82b5556 100644 --- a/src/specfem3D/read_mesh_databases_hdf5.F90 +++ b/src/specfem3D/read_mesh_databases_hdf5.F90 @@ -158,6 +158,9 @@ subroutine read_mesh_databases_hdf5() integer, dimension(0:NPROC-1) :: offset_neighbors_xadj integer, dimension(0:NPROC-1) :: offset_neighbors_adjncy + ! avoid integer overflow + integer(kind=8) :: sum_offset_neighbors_adjncy_this_proc + integer(kind=8), dimension(0:NPROC-1) :: offset_neighbors_adjncy_i8 ! user output if (myrank == 0) then @@ -203,6 +206,8 @@ subroutine read_mesh_databases_hdf5() ! mesh adjacency call h5_read_dataset_collect_hyperslab("offset_neighbors_xadj",offset_neighbors_xadj, (/0/), H5_COL) call h5_read_dataset_collect_hyperslab("offset_neighbors_adjncy",offset_neighbors_adjncy, (/0/), H5_COL) + ! convert to 8-byte integers + offset_neighbors_adjncy_i8 = offset_neighbors_adjncy ! info about external mesh simulation dsetname = "nspec" @@ -1631,8 +1636,9 @@ subroutine read_mesh_databases_hdf5() call h5_read_dataset_collect_hyperslab(dsetname, neighbors_xadj, & (/sum(offset_neighbors_xadj(0:myrank-1))/), H5_COL) dsetname = "neighbors_adjncy" + sum_offset_neighbors_adjncy_this_proc = sum(offset_neighbors_adjncy_i8(0:myrank-1)) call h5_read_dataset_collect_hyperslab(dsetname, neighbors_adjncy, & - (/sum(offset_neighbors_adjncy(0:myrank-1))/), H5_COL) + (/sum_offset_neighbors_adjncy_this_proc/), H5_COL) endif call bcast_all_i_for_database(neighbors_xadj(1), size(neighbors_xadj)) call bcast_all_i_for_database(neighbors_adjncy(1), size(neighbors_adjncy)) From 184d8e5ad0e7cf0fc9a9b2afdada2ac48cffa826 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 19 Sep 2024 12:32:40 +0200 Subject: [PATCH 53/56] updates github actions --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c36258642..5e2cdbf16 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -147,7 +147,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest,ubuntu-20.04] + os: [ubuntu-latest,ubuntu-22.04] steps: - uses: actions/checkout@v4 @@ -164,8 +164,8 @@ jobs: linuxCheck-Intel: - name: Test Intel on ubuntu-20.04 - runs-on: ubuntu-20.04 + name: Test Intel on ubuntu-22.04 + runs-on: ubuntu-22.04 needs: changesCheck steps: @@ -173,7 +173,7 @@ jobs: - name: Cache Intel oneapi packages id: cache-intel-oneapi - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /opt/intel/oneapi key: install-${{ runner.os }}-all From e6edb69fb50fa331715f032d6543f6c21471c65d Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 1 Oct 2024 15:05:25 +0200 Subject: [PATCH 54/56] updates mesh adjacency setup (using a reverse lookup table) --- .../setup_mesh_adjacency.f90 | 586 ++++++------------ 1 file changed, 180 insertions(+), 406 deletions(-) diff --git a/src/generate_databases/setup_mesh_adjacency.f90 b/src/generate_databases/setup_mesh_adjacency.f90 index 571b308ef..6239c314b 100644 --- a/src/generate_databases/setup_mesh_adjacency.f90 +++ b/src/generate_databases/setup_mesh_adjacency.f90 @@ -31,73 +31,43 @@ subroutine setup_mesh_adjacency() ! setups mesh adjacency array to search element neighbors for point searches use constants, only: myrank, & - NDIM,NGLLX,NGLLY,NGLLZ,MIDX,MIDY,MIDZ,IMAIN,CUSTOM_REAL,MAX_STRING_LEN, & - DO_BRUTE_FORCE_POINT_SEARCH + NDIM,NGLLX,NGLLY,NGLLZ,MIDX,MIDY,MIDZ,IMAIN,CUSTOM_REAL,MAX_STRING_LEN use generate_databases_par, only: NSPEC_AB,NGLOB_AB,ibool,NPROC,prname - use create_regions_mesh_ext_par, only: xstore => xstore_unique, ystore => ystore_unique, zstore => zstore_unique - ! mesh adjacency for point searches use generate_databases_par, only: neighbors_xadj,neighbors_adjncy,num_neighbors_all - use kdtree_search, only: kdtree_setup,kdtree_delete, & - kdtree_nodes_location,kdtree_nodes_index,kdtree_num_nodes, & - kdtree_count_nearest_n_neighbors,kdtree_get_nearest_n_neighbors, & - kdtree_search_index,kdtree_search_num_nodes - use fault_generate_databases, only: ANY_FAULT_IN_THIS_PROC + ! debugging + use create_regions_mesh_ext_par, only: xstore => xstore_unique, ystore => ystore_unique, zstore => zstore_unique + implicit none ! local parameters ! maximum number of neighbors - !integer,parameter :: MAX_NEIGHBORS = 50 ! maximum number of neighbors + integer,parameter :: MAX_NEIGHBORS_DIRECT = 50 ! maximum number of neighbors (for direct element neighbors) integer,parameter :: MAX_NEIGHBORS = 300 ! maximum number of neighbors (with neighbor of neighbors) ! temporary integer,dimension(:),allocatable :: tmp_adjncy ! temporary adjacency integer :: inum_neighbor - ! coordinates of element midpoints - double precision, dimension(:,:), allocatable :: xyz_midpoints - ! timer MPI double precision :: time1,tCPU double precision, external :: wtime - integer :: ielem_counter,num_elements_actual_max integer :: num_neighbors,num_neighbors_max - integer :: ispec_ref,ispec,iglob,ier !icorner,jj - - double precision :: xyz_target(NDIM) - double precision :: dist_squared,dist_squared_max - double precision :: maximal_elem_size_squared - - real(kind=CUSTOM_REAL) :: distance_min_glob,distance_max_glob - real(kind=CUSTOM_REAL) :: elemsize_min_glob,elemsize_max_glob - real(kind=CUSTOM_REAL) :: x_min_glob,x_max_glob - real(kind=CUSTOM_REAL) :: y_min_glob,y_max_glob - real(kind=CUSTOM_REAL) :: z_min_glob,z_max_glob + integer :: num_elements_max + integer :: ispec_ref,ispec,iglob,ier,icorner + logical :: is_neighbor ! for all the elements in contact with the reference element integer, dimension(:,:), allocatable :: ibool_corner - logical, dimension(:), allocatable :: mask_ispec - logical, dimension(:), allocatable :: flag_topological ! making array allocatable, otherwise will crash for large meshes - logical, dimension(8) :: flag_iglob_corner - - ! kd-tree search - integer :: nsearch_points,inodes - integer :: num_elements,num_elements_max - ! alternative: to avoid allocating/deallocating search index arrays, though there is hardly a speedup - !integer, parameter :: max_search_points = 20000 - double precision :: r_search - logical :: use_kdtree_search - - logical :: is_neighbor ! neighbors of neighbors - integer :: ielem,ii,jj + integer :: ielem,ii,jj,ispec_neighbor integer :: num_neighbor_neighbors,num_neighbor_neighbors_max ! note: we add direct neighbors plus neighbors of neighbors. @@ -110,41 +80,28 @@ subroutine setup_mesh_adjacency() integer,dimension(:),allocatable :: tmp_num_neighbors logical,parameter :: DEBUG_VTK_OUTPUT = .false. + ! Node-to-element reverse lookup + integer, dimension(:,:), allocatable :: node_to_elem + integer, dimension(:), allocatable :: node_to_elem_count + integer :: icount + integer, dimension(MAX_NEIGHBORS_DIRECT) :: elem_neighbors + integer, dimension(MAX_NEIGHBORS) :: elem_neighbors_of_neighbors + ! user output if (myrank == 0) then write(IMAIN,*) write(IMAIN,*) ' mesh adjacency:' - write(IMAIN,*) ' total number of elements in this slice = ',NSPEC_AB - write(IMAIN,*) - write(IMAIN,*) ' maximum number of neighbors allowed = ',MAX_NEIGHBORS - write(IMAIN,*) ' minimum array memory required per slice = ',((MAX_NEIGHBORS + 1) * NSPEC_AB * 4)/1024./1024.,"(MB)" + write(IMAIN,*) ' total number of elements in this slice = ',NSPEC_AB write(IMAIN,*) + write(IMAIN,*) ' maximum number of neighbors allowed = ',MAX_NEIGHBORS + write(IMAIN,*) ' minimum array memory required per slice = ', & + ((MAX_NEIGHBORS + 1) * NSPEC_AB * 4)/1024./1024.,"(MB)" call flush_IMAIN() endif ! get MPI starting time time1 = wtime() - ! prepares midpoints coordinates - allocate(xyz_midpoints(NDIM,NSPEC_AB),stat=ier) - if (ier /= 0 ) call exit_MPI(myrank,'Error allocating array xyz_midpoints') - xyz_midpoints(:,:) = 0.d0 - - ! store x/y/z coordinates of center point - do ispec = 1,NSPEC_AB - iglob = ibool(MIDX,MIDY,MIDZ,ispec) - xyz_midpoints(1,ispec) = dble(xstore(iglob)) - xyz_midpoints(2,ispec) = dble(ystore(iglob)) - xyz_midpoints(3,ispec) = dble(zstore(iglob)) - enddo - - ! compute typical size of elements - ! gets mesh dimensions - call check_mesh_distances(myrank,NSPEC_AB,NGLOB_AB,ibool,xstore,ystore,zstore, & - x_min_glob,x_max_glob,y_min_glob,y_max_glob,z_min_glob,z_max_glob, & - elemsize_min_glob,elemsize_max_glob, & - distance_min_glob,distance_max_glob) - ! adjacency arrays ! ! how to use: @@ -163,11 +120,6 @@ subroutine setup_mesh_adjacency() if (ier /= 0) stop 'Error allocating tmp_adjncy' tmp_adjncy(:) = 0 - ! element mask - allocate(mask_ispec(NSPEC_AB),stat=ier) - if (ier /= 0) stop 'Error allocating mask_ispec array' - mask_ispec(:) = .false. - ! since we only need to check corner points for the adjacency, ! we build an extra ibool array with corner points only for faster accessing allocate(ibool_corner(8,NSPEC_AB),stat=ier) @@ -185,334 +137,193 @@ subroutine setup_mesh_adjacency() ibool_corner(8,ispec) = ibool(1,NGLLY,NGLLZ,ispec) enddo - ! topological flags to find neighboring elements - allocate(flag_topological(NGLOB_AB),stat=ier) - if (ier /= 0) stop 'Error allocating flag_topological array' - flag_topological(:) = .false. - - ! use 10 times the distance as a criterion for point detection - maximal_elem_size_squared = (10. * elemsize_max_glob)**2 - - ! select search type - if (DO_BRUTE_FORCE_POINT_SEARCH) then - use_kdtree_search = .false. - else - ! for kdtree search, the number of elements per slice should be large enough, - ! otherwise a simple brute force search is faster. - if (NSPEC_AB > 20000) then - use_kdtree_search = .true. - else - use_kdtree_search = .false. - endif - endif + ! setups node-to-element mapping counter + allocate(node_to_elem_count(NGLOB_AB),stat=ier) + if (ier /= 0) stop 'Error allocating node_to_elem_count arrays' + node_to_elem_count(:) = 0 + num_elements_max = 0 + ! determines maximum count per node + do ispec = 1,NSPEC_AB + ! only corner nodes used to check for shared nodes (conforming mesh) + do icorner = 1,8 + iglob = ibool_corner(icorner,ispec) - ! kd-tree search - if (use_kdtree_search) then - ! kd-tree search - ! search radius around element midpoints - ! - ! note: we take here 3.5 times the maximum element size to include also neighbors of neighbor elements - ! - since at low resolutions NEX and large element sizes, this search radius needs to be large enough, and, - ! - due to doubling layers (elements at depth will become bigger) - ! - ! the search radius r_search given as routine argument must be non-squared - r_search = 3.5 * elemsize_max_glob - - ! user output - if (myrank == 0) then - write(IMAIN,*) ' using kd-tree search radius = ',sngl(r_search) - call flush_IMAIN() - endif + ! add to mapping + icount = node_to_elem_count(iglob) + 1 - ! kd-tree setup for adjacency search - ! - ! uses only element midpoint location - kdtree_num_nodes = NSPEC_AB - - ! allocates tree arrays - allocate(kdtree_nodes_location(NDIM,kdtree_num_nodes),stat=ier) - if (ier /= 0) stop 'Error allocating kdtree_nodes_location arrays' - allocate(kdtree_nodes_index(kdtree_num_nodes),stat=ier) - if (ier /= 0) stop 'Error allocating kdtree_nodes_index arrays' - - ! prepares search arrays, each element takes its internal GLL points for tree search - kdtree_nodes_index(:) = 0 - kdtree_nodes_location(:,:) = 0.0 - ! adds tree nodes - inodes = 0 - do ispec = 1,NSPEC_AB - ! sets up tree nodes - iglob = ibool(MIDX,MIDY,MIDZ,ispec) - - ! counts nodes - inodes = inodes + 1 - if (inodes > kdtree_num_nodes ) stop 'Error index inodes bigger than kdtree_num_nodes' - - ! adds node index (index points to same ispec for all internal GLL points) - kdtree_nodes_index(inodes) = ispec - - ! adds node location - kdtree_nodes_location(1,inodes) = xstore(iglob) - kdtree_nodes_location(2,inodes) = ystore(iglob) - kdtree_nodes_location(3,inodes) = zstore(iglob) - enddo - if (inodes /= kdtree_num_nodes ) stop 'Error index inodes does not match nnodes_local' + ! gets maximum of elements sharing node + if (icount > num_elements_max) num_elements_max = icount - ! alternative: to avoid allocating/deallocating search index arrays, though there is hardly a speedup - !allocate(kdtree_search_index(max_search_points),stat=ier) - !if (ier /= 0) stop 'Error allocating array kdtree_search_index' + ! updates count + node_to_elem_count(iglob) = icount + enddo + enddo - ! creates kd-tree for searching - call kdtree_setup() + ! user output + if (myrank == 0) then + write(IMAIN,*) + write(IMAIN,*) ' maximum number of elements per shared node = ',num_elements_max + write(IMAIN,*) ' node-to-element array memory required per slice = ', & + (num_elements_max * NGLOB_AB * 4)/1024./1024.,"(MB)" + write(IMAIN,*) + call flush_IMAIN() endif - ! gets maximum number of neighbors - inum_neighbor = 0 - num_neighbors_max = 0 - num_neighbors_all = 0 - num_neighbor_neighbors_max = 0 + ! Node-to-element reverse lookup + allocate(node_to_elem(num_elements_max,NGLOB_AB),stat=ier) + if (ier /= 0) stop 'Error allocating node_to_elem arrays' + node_to_elem(:,:) = -1 + node_to_elem_count(:) = 0 - num_elements_max = 0 - num_elements_actual_max = 0 - dist_squared_max = 0.d0 - - do ispec_ref = 1,NSPEC_AB - ! flagging corners - flag_topological(:) = .false. - mask_ispec(:) = .false. - - ! mark the eight corners of the initial guess element - flag_topological(ibool_corner(:,ispec_ref)) = .true. - ! or w/ explicit ibool - !flag_topological(ibool(1,1,1,ispec_ref)) = .true. - !flag_topological(ibool(NGLLX,1,1,ispec_ref)) = .true. - !flag_topological(ibool(NGLLX,NGLLY,1,ispec_ref)) = .true. - !flag_topological(ibool(1,NGLLY,1,ispec_ref)) = .true. - !flag_topological(ibool(1,1,NGLLZ,ispec_ref)) = .true. - !flag_topological(ibool(NGLLX,1,NGLLZ,ispec_ref)) = .true. - !flag_topological(ibool(NGLLX,NGLLY,NGLLZ,ispec_ref)) = .true. - !flag_topological(ibool(1,NGLLY,NGLLZ,ispec_ref)) = .true. - - ! marks element for checking elements - mask_ispec(ispec_ref) = .true. - - ! midpoint for search radius - iglob = ibool(MIDX,MIDY,MIDZ,ispec_ref) - xyz_target(1) = xstore(iglob) - xyz_target(2) = ystore(iglob) - xyz_target(3) = zstore(iglob) - - if (use_kdtree_search) then - ! looks only at elements in kd-tree search radius - - ! gets number of tree points within search radius - ! (within search sphere) - call kdtree_count_nearest_n_neighbors(xyz_target,r_search,nsearch_points) - - ! debug - !print *,' total number of search elements: ',nsearch_points,'ispec',ispec_ref - - ! alternative: limits search results - !if (nsearch_points > max_search_points) nsearch_points = max_search_points - ! or stop if exceeded - !if (nsearch_points > max_search_points) stop 'Error increase max_search_points' - - ! sets number of search nodes to get - kdtree_search_num_nodes = nsearch_points - - ! allocates search index - dynamic instead of setting max_search_points - allocate(kdtree_search_index(kdtree_search_num_nodes),stat=ier) - if (ier /= 0) stop 'Error allocating array kdtree_search_index' - - ! gets closest n points around target (within search sphere) - call kdtree_get_nearest_n_neighbors(xyz_target,r_search,nsearch_points) - - ! loops over search radius - num_elements = nsearch_points - else - ! loops over all other elements to find closest neighbors - num_elements = NSPEC_AB - endif - - ! statistics - if (num_elements > num_elements_max) num_elements_max = num_elements + do ispec = 1,NSPEC_AB + ! only corner nodes used to check for shared nodes (conforming mesh) + do icorner = 1,8 + iglob = ibool_corner(icorner,ispec) - ! counts number of neighbors - num_neighbors = 0 - ielem_counter = 0 - - ! loops over all other elements to find closest neighbors - do ielem = 1,num_elements - ! gets element index - if (use_kdtree_search) then - ! kd-tree search radius - ! gets search point/element index - ispec = kdtree_search_index(ielem) - ! checks index - if (ispec < 1 .or. ispec > NSPEC_AB) stop 'Error element index is invalid' - else - ! loops over all elements - ispec = ielem - endif + ! add to mapping + icount = node_to_elem_count(iglob) + 1 - ! skip reference element - if (ispec == ispec_ref) cycle - - ! exclude elements that are too far from target - ! distance to reference element - dist_squared = (xyz_target(1) - xyz_midpoints(1,ispec))*(xyz_target(1) - xyz_midpoints(1,ispec)) & - + (xyz_target(2) - xyz_midpoints(2,ispec))*(xyz_target(2) - xyz_midpoints(2,ispec)) & - + (xyz_target(3) - xyz_midpoints(3,ispec))*(xyz_target(3) - xyz_midpoints(3,ispec)) - - ! we compare squared distances instead of distances themselves to significantly speed up calculations - if (dist_squared > maximal_elem_size_squared) cycle - - ielem_counter = ielem_counter + 1 - - ! checks if element has a corner iglob from reference element - is_neighbor = .false. - - ! corner flags - flag_iglob_corner(:) = flag_topological(ibool_corner(:,ispec)) - ! or w/ explicit ibool - !flag_iglob_corner(1) = flag_topological(ibool(1,1,1,ispec)) - !flag_iglob_corner(2) = flag_topological(ibool(NGLLX,1,1,ispec)) - !flag_iglob_corner(3) = flag_topological(ibool(NGLLX,NGLLY,1,ispec)) - !flag_iglob_corner(4) = flag_topological(ibool(1,NGLLY,1,ispec)) - !flag_iglob_corner(5) = flag_topological(ibool(1,1,NGLLZ,ispec)) - !flag_iglob_corner(6) = flag_topological(ibool(NGLLX,1,NGLLZ,ispec)) - !flag_iglob_corner(7) = flag_topological(ibool(NGLLX,NGLLY,NGLLZ,ispec)) - !flag_iglob_corner(8) = flag_topological(ibool(1,NGLLY,NGLLZ,ispec)) - - ! checks if corner also has reference element - if (any(flag_iglob_corner(:) .eqv. .true.)) then - is_neighbor = .true. - endif + ! adds entry to mapping array + node_to_elem_count(iglob) = icount + node_to_elem(icount,iglob) = ispec + enddo + enddo - ! counts neighbors to reference element - if (is_neighbor) then - ! marks element for checking later on - mask_ispec(ispec) = .true. + ! gets maximum number of neighbors + inum_neighbor = 0 ! counts total number of neighbors added - ! adds to adjacency - inum_neighbor = inum_neighbor + 1 - ! checks - if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors exceeded' + ! stats + num_neighbors_max = 0 + num_neighbor_neighbors_max = 0 - ! adds element - tmp_adjncy(inum_neighbor) = ispec + do ispec_ref = 1,NSPEC_AB + ! counts number of neighbors (for this element) + num_neighbors = 0 + elem_neighbors(:) = 0 - ! for statistics - num_neighbors = num_neighbors + 1 + ! only corner nodes used to check for shared nodes (conforming mesh) + do icorner = 1,8 + iglob = ibool_corner(icorner,ispec_ref) - ! maximum distance to reference element - if (dist_squared > dist_squared_max) dist_squared_max = dist_squared - endif - enddo + ! loops over all other elements to add neighbors + do ielem = 1,node_to_elem_count(iglob) + ispec = node_to_elem(ielem,iglob) - ! again loop to get neighbors of neighbors - if (ADD_NEIGHBOR_OF_NEIGHBORS) then - ! counter for statistics - num_neighbor_neighbors = 0 + ! skip reference element + if (ispec == ispec_ref) cycle - ! flag first neighbor elements corner - do ii = 1,num_neighbors - ! get neighbor - ispec = tmp_adjncy(inum_neighbor - num_neighbors + ii) - - ! mark the eight corners of the initial guess element - flag_topological(ibool_corner(:,ispec)) = .true. - ! or w/ explicit ibool - !flag_topological(ibool(1,1,1,ispec)) = .true. - !flag_topological(ibool(NGLLX,1,1,ispec)) = .true. - !flag_topological(ibool(NGLLX,NGLLY,1,ispec)) = .true. - !flag_topological(ibool(1,NGLLY,1,ispec)) = .true. - !flag_topological(ibool(1,1,NGLLZ,ispec)) = .true. - !flag_topological(ibool(NGLLX,1,NGLLZ,ispec)) = .true. - !flag_topological(ibool(NGLLX,NGLLY,NGLLZ,ispec)) = .true. - !flag_topological(ibool(1,NGLLY,NGLLZ,ispec)) = .true. - - ! check element - if (.not. mask_ispec(ispec)) stop 'error element flag topological' - enddo + ! checks if it is a new neighbor element + is_neighbor = .false. - ! full loop to get neighbors of neighbors - do ielem = 1,num_elements - ! gets element index - if (use_kdtree_search) then - ! kd-tree search radius - ! gets search point/element index - ispec = kdtree_search_index(ielem) + ! checks if first element + if (num_neighbors == 0) then + is_neighbor = .true. else - ! loops over all elements - ispec = ielem + ! check if not added to list yet + if (.not. any(elem_neighbors(1:num_neighbors) == ispec)) then + is_neighbor = .true. + endif endif - ! skip reference element - if (ispec == ispec_ref) cycle + ! adds as neighbor + if (is_neighbor) then + ! store neighbor elements + num_neighbors = num_neighbors + 1 - ! check if already added - if (mask_ispec(ispec)) cycle + ! check + if (num_neighbors > MAX_NEIGHBORS_DIRECT) stop 'Error maximum of direct neighbors exceeded' - ! exclude elements that are too far from target - ! distance to reference element - dist_squared = (xyz_target(1) - xyz_midpoints(1,ispec))*(xyz_target(1) - xyz_midpoints(1,ispec)) & - + (xyz_target(2) - xyz_midpoints(2,ispec))*(xyz_target(2) - xyz_midpoints(2,ispec)) & - + (xyz_target(3) - xyz_midpoints(3,ispec))*(xyz_target(3) - xyz_midpoints(3,ispec)) + ! store element + elem_neighbors(num_neighbors) = ispec + endif + enddo + enddo ! corners - ! exclude elements that are too far from target - ! we compare squared distances instead of distances themselves to significantly speed up calculations - if (dist_squared > maximal_elem_size_squared) cycle + ! statistics + if (num_neighbors > num_neighbors_max) num_neighbors_max = num_neighbors - ! checks if element has a corner iglob from reference element - is_neighbor = .false. + ! store to temporary adjacency array + if (num_neighbors > 0) then + ! updates total count + inum_neighbor = inum_neighbor + num_neighbors - ! corner flags - flag_iglob_corner(:) = flag_topological(ibool_corner(:,ispec)) - ! or w/ explicit ibool - !flag_iglob_corner(1) = flag_topological(ibool(1,1,1,ispec)) - !flag_iglob_corner(2) = flag_topological(ibool(NGLLX,1,1,ispec)) - !flag_iglob_corner(3) = flag_topological(ibool(NGLLX,NGLLY,1,ispec)) - !flag_iglob_corner(4) = flag_topological(ibool(1,NGLLY,1,ispec)) - !flag_iglob_corner(5) = flag_topological(ibool(1,1,NGLLZ,ispec)) - !flag_iglob_corner(6) = flag_topological(ibool(NGLLX,1,NGLLZ,ispec)) - !flag_iglob_corner(7) = flag_topological(ibool(NGLLX,NGLLY,NGLLZ,ispec)) - !flag_iglob_corner(8) = flag_topological(ibool(1,NGLLY,NGLLZ,ispec)) - - ! checks if corner also has reference element - if (any(flag_iglob_corner(:) .eqv. .true.)) then - is_neighbor = .true. - endif + ! checks + if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors exceeded' - ! counts neighbors to reference element - if (is_neighbor) then - ! marks element - mask_ispec(ispec) = .true. + ! adds to adjacency + tmp_adjncy(inum_neighbor-num_neighbors+1:inum_neighbor) = elem_neighbors(1:num_neighbors) + else + ! no neighbors + ! warning + print *,'*** Warning: found mesh element with no neighbors : slice ',myrank,' - element ',ispec_ref,' ***' + endif - ! adds to adjacency - inum_neighbor = inum_neighbor + 1 - ! checks - if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors with neighbors of neighbors exceeded' + ! again loop to get neighbors of neighbors + if (ADD_NEIGHBOR_OF_NEIGHBORS) then + ! counter for statistics + num_neighbor_neighbors = 0 + elem_neighbors_of_neighbors(:) = 0 - ! adds element - tmp_adjncy(inum_neighbor) = ispec + ! loops over neighbor elements + do ii = 1,num_neighbors + ! get neighbor + ispec_neighbor = elem_neighbors(ii) + + ! only corner nodes used to check for shared nodes (conforming mesh) + do icorner = 1,8 + iglob = ibool_corner(icorner,ispec_neighbor) + + ! loops over all other elements to add neighbors + do ielem = 1,node_to_elem_count(iglob) + ispec = node_to_elem(ielem,iglob) + + ! skip reference element + if (ispec == ispec_ref) cycle + + ! skip neighbor reference element (already added by elem_neighbors() array) + if (ispec == ispec_neighbor) cycle + + ! checks if element has a corner iglob from reference element + is_neighbor = .false. + + ! check if not added to neighbor list yet + if (.not. any(elem_neighbors(1:num_neighbors) == ispec)) then + ! check if added to neighbor of neighbors list + if (num_neighbor_neighbors == 0) then + is_neighbor = .true. + else + if (.not. any(elem_neighbors_of_neighbors(1:num_neighbor_neighbors) == ispec)) then + is_neighbor = .true. + endif + endif + endif + + ! adds neighbors to reference element + if (is_neighbor) then + ! adds to adjacency + num_neighbor_neighbors = num_neighbor_neighbors + 1 + elem_neighbors_of_neighbors(num_neighbor_neighbors) = ispec + endif + enddo + enddo ! corners + enddo ! num neighbors + + ! adds to temporary adjacency array + if (num_neighbor_neighbors > 0) then + ! updates total count + inum_neighbor = inum_neighbor + num_neighbor_neighbors - ! for statistics - num_neighbors = num_neighbors + 1 - num_neighbor_neighbors = num_neighbor_neighbors + 1 + ! checks + if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors exceeded' - ! maximum distance to reference element - if (dist_squared > dist_squared_max) dist_squared_max = dist_squared - endif - enddo + ! adds elements + tmp_adjncy(inum_neighbor-num_neighbor_neighbors+1:inum_neighbor) = elem_neighbors_of_neighbors(1:num_neighbor_neighbors) + endif ! statistics if (num_neighbor_neighbors > num_neighbor_neighbors_max) num_neighbor_neighbors_max = num_neighbor_neighbors - endif - ! statistics - if (num_neighbors > num_neighbors_max) num_neighbors_max = num_neighbors - if (ielem_counter > num_elements_actual_max) num_elements_actual_max = ielem_counter + endif ! ADD_NEIGHBOR_OF_NEIGHBORS ! adjacency indexing neighbors_xadj(ispec_ref + 1) = inum_neighbor @@ -523,12 +334,6 @@ subroutine setup_mesh_adjacency() ! ispec_neighbor = neighbors_adjncy(neighbors_xadj(ispec) + i) !enddo - ! frees kdtree search array - if (use_kdtree_search) then - ! dynamic instead of setting fixed max_search_points - deallocate(kdtree_search_index) - endif - ! user output progress if (myrank == 0) then if (mod(ispec_ref,max(NSPEC_AB/10,1)) == 0) then @@ -543,8 +348,6 @@ subroutine setup_mesh_adjacency() enddo ! ispec_ref ! frees temporary array - deallocate(flag_topological) - deallocate(mask_ispec) deallocate(ibool_corner) ! debug: for vtk output @@ -580,17 +383,9 @@ subroutine setup_mesh_adjacency() if (num_neighbors == 0 .and. NSPEC_AB > 1) then ! midpoint iglob = ibool(MIDX,MIDY,MIDZ,ispec_ref) - xyz_target(1) = xstore(iglob) - xyz_target(2) = ystore(iglob) - xyz_target(3) = zstore(iglob) ! error info print *,'Error: rank ',myrank,' - element ',ispec_ref,'has no neighbors!' - print *,' element midpoint location: ',xyz_target(:) - print *,' maximum element size : ',elemsize_max_glob - print *,' typical search distance : ',maximal_elem_size_squared - print *,' kdtree search : ',use_kdtree_search - if (use_kdtree_search) & - print *,' kd-tree r_search : ',r_search + print *,' element midpoint location: ',xstore(iglob),ystore(iglob),zstore(iglob) print *,' maximum search elements : ',num_elements_max call exit_MPI(myrank,'Error adjacency invalid') endif @@ -607,22 +402,14 @@ subroutine setup_mesh_adjacency() neighbors_adjncy(1:num_neighbors_all) = tmp_adjncy(1:num_neighbors_all) ! checks - if (minval(neighbors_adjncy(:)) < 1 .or. maxval(neighbors_adjncy(:)) > NSPEC_AB) stop 'Invalid adjncy array' - + if (minval(neighbors_adjncy(:)) < 1 .or. maxval(neighbors_adjncy(:)) > NSPEC_AB) then + print *,'Error: adjncy array invalid: slice ',myrank + print *,' number of all neighbors = ',num_neighbors_all + print *,' array min/max = ',minval(neighbors_adjncy(:)),'/',maxval(neighbors_adjncy(:)) + stop 'Invalid adjncy array' + endif ! frees temporary array deallocate(tmp_adjncy) - deallocate(xyz_midpoints) - - if (use_kdtree_search) then - ! frees current tree memory - ! deletes tree arrays - deallocate(kdtree_nodes_location) - deallocate(kdtree_nodes_index) - ! alternative: to avoid allocating/deallocating search index arrays by using max_search_points - !deallocate(kdtree_search_index) - ! deletes search tree nodes - call kdtree_delete() - endif ! checks neighbors for out-of-bounds indexing and duplicates do ispec_ref = 1,NSPEC_AB @@ -657,19 +444,6 @@ subroutine setup_mesh_adjacency() ! elapsed time since beginning of neighbor detection tCPU = wtime() - time1 write(IMAIN,*) - write(IMAIN,*) ' maximum search elements = ',num_elements_max - write(IMAIN,*) ' maximum of actual search elements (after distance criterion) = ',num_elements_actual_max - write(IMAIN,*) - write(IMAIN,*) ' estimated maximum element size = ',elemsize_max_glob - write(IMAIN,*) ' maximum distance between neighbor centers = ',real(sqrt(dist_squared_max),kind=CUSTOM_REAL) - if (use_kdtree_search) then - if (sqrt(dist_squared_max) > r_search - 0.5*elemsize_max_glob) then - write(IMAIN,*) '***' - write(IMAIN,*) '*** Warning: consider increasing the kd-tree search radius to improve this neighbor setup ***' - write(IMAIN,*) '***' - endif - endif - write(IMAIN,*) write(IMAIN,*) ' maximum neighbors found per element = ',num_neighbors_max if (ADD_NEIGHBOR_OF_NEIGHBORS) then write(IMAIN,*) ' (maximum neighbor of neighbors) = ',num_neighbor_neighbors_max From b5635a5bef0d4868c2e96f82e4fdb335dd4ae4fd Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 1 Oct 2024 15:41:10 +0200 Subject: [PATCH 55/56] updates neighbor limit (layered_halfspace mesh has at least 54 direct neighbors) --- src/generate_databases/setup_mesh_adjacency.f90 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/generate_databases/setup_mesh_adjacency.f90 b/src/generate_databases/setup_mesh_adjacency.f90 index 6239c314b..a53391f28 100644 --- a/src/generate_databases/setup_mesh_adjacency.f90 +++ b/src/generate_databases/setup_mesh_adjacency.f90 @@ -47,7 +47,7 @@ subroutine setup_mesh_adjacency() ! local parameters ! maximum number of neighbors - integer,parameter :: MAX_NEIGHBORS_DIRECT = 50 ! maximum number of neighbors (for direct element neighbors) + integer,parameter :: MAX_NEIGHBORS_DIRECT = 80 ! maximum number of neighbors (for direct element neighbors only) integer,parameter :: MAX_NEIGHBORS = 300 ! maximum number of neighbors (with neighbor of neighbors) ! temporary @@ -84,8 +84,8 @@ subroutine setup_mesh_adjacency() integer, dimension(:,:), allocatable :: node_to_elem integer, dimension(:), allocatable :: node_to_elem_count integer :: icount - integer, dimension(MAX_NEIGHBORS_DIRECT) :: elem_neighbors - integer, dimension(MAX_NEIGHBORS) :: elem_neighbors_of_neighbors + integer, dimension(MAX_NEIGHBORS_DIRECT) :: elem_neighbors ! direct neighbors + integer, dimension(MAX_NEIGHBORS) :: elem_neighbors_of_neighbors ! with neighboring element neighbors ! user output if (myrank == 0) then @@ -231,7 +231,7 @@ subroutine setup_mesh_adjacency() num_neighbors = num_neighbors + 1 ! check - if (num_neighbors > MAX_NEIGHBORS_DIRECT) stop 'Error maximum of direct neighbors exceeded' + if (num_neighbors > MAX_NEIGHBORS_DIRECT) stop 'Error maximum of neighbors (direct) exceeded' ! store element elem_neighbors(num_neighbors) = ispec @@ -248,7 +248,7 @@ subroutine setup_mesh_adjacency() inum_neighbor = inum_neighbor + num_neighbors ! checks - if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors exceeded' + if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum of total neighbors exceeded' ! adds to adjacency tmp_adjncy(inum_neighbor-num_neighbors+1:inum_neighbor) = elem_neighbors(1:num_neighbors) @@ -302,6 +302,11 @@ subroutine setup_mesh_adjacency() if (is_neighbor) then ! adds to adjacency num_neighbor_neighbors = num_neighbor_neighbors + 1 + + ! check + if (num_neighbor_neighbors > MAX_NEIGHBORS) stop 'Error maximum of neighbors (with neighbors) exceeded' + + ! store element elem_neighbors_of_neighbors(num_neighbor_neighbors) = ispec endif enddo @@ -314,7 +319,7 @@ subroutine setup_mesh_adjacency() inum_neighbor = inum_neighbor + num_neighbor_neighbors ! checks - if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum neighbors exceeded' + if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop 'Error maximum of total neighbors (with neighbors) exceeded' ! adds elements tmp_adjncy(inum_neighbor-num_neighbor_neighbors+1:inum_neighbor) = elem_neighbors_of_neighbors(1:num_neighbor_neighbors) From d885a2ce25800be36a23bf6df5a4f44d68284708 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 1 Oct 2024 15:48:00 +0200 Subject: [PATCH 56/56] adds array deallocation --- src/generate_databases/setup_mesh_adjacency.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/generate_databases/setup_mesh_adjacency.f90 b/src/generate_databases/setup_mesh_adjacency.f90 index a53391f28..2587cd9d4 100644 --- a/src/generate_databases/setup_mesh_adjacency.f90 +++ b/src/generate_databases/setup_mesh_adjacency.f90 @@ -354,6 +354,7 @@ subroutine setup_mesh_adjacency() ! frees temporary array deallocate(ibool_corner) + deallocate(node_to_elem,node_to_elem_count) ! debug: for vtk output if (DEBUG_VTK_OUTPUT) then