Skip to content

Commit 5d6c127

Browse files
committed
fixes getting stats in mesh setup (for parallel simulations)
1 parent e1f2d3c commit 5d6c127

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

Diff for: src/specfem2D/define_external_model_from_tomo_file.f90

+7-6
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ subroutine define_external_model_from_tomo_file(rhoext,vpext,vsext, &
367367
c33ext,c35ext,c55ext
368368

369369
! local parameters
370-
integer :: i,j,ispec,iglob
370+
integer :: i,j,ispec,iglob,ival
371371
double precision :: xmesh,zmesh
372372
double precision :: rho_final
373373
double precision :: vp_final,vs_final
@@ -407,9 +407,10 @@ subroutine define_external_model_from_tomo_file(rhoext,vpext,vsext, &
407407
do ispec = 1,nspec
408408
do j = 1,NGLLZ
409409
do i = 1,NGLLX
410-
iglob = ibool(i,j,ispec)
410+
! determine material properties
411411
if (kmato(ispec) == tomo_material) then
412412
! If the material has been set to < 0 on the Par_file
413+
iglob = ibool(i,j,ispec)
413414
xmesh = coord(1,iglob)
414415
zmesh = coord(2,iglob)
415416

@@ -512,10 +513,10 @@ subroutine define_external_model_from_tomo_file(rhoext,vpext,vsext, &
512513
call synchronize_all()
513514

514515
! collect totals
515-
iglob = npoint_tomo
516-
call max_all_i(iglob,npoint_tomo)
517-
iglob = npoint_internal
518-
call max_all_i(iglob,npoint_internal)
516+
ival = npoint_tomo
517+
call max_all_i(ival,npoint_tomo)
518+
ival = npoint_internal
519+
call max_all_i(ival,npoint_internal)
519520

520521
! user output
521522
if (myrank == 0) then

Diff for: src/specfem2D/setup_mesh.F90

+19-8
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ subroutine setup_mesh_material_properties()
561561
double precision :: c33min_glob,c33max_glob,c35min_glob,c35max_glob
562562
double precision :: c55min_glob,c55max_glob
563563

564+
logical :: has_poroelasticity, has_anisotropy
565+
564566
! vtk output
565567
character(len=MAX_STRING_LEN) :: filename,prname
566568
double precision,dimension(:,:,:),allocatable :: tmp_store
@@ -945,16 +947,25 @@ subroutine setup_mesh_material_properties()
945947
tmp_val = maxval(qmu_attenuation_store)
946948
call max_all_dp(tmp_val, qmumax_glob)
947949

948-
if (any_poroelastic) then
950+
! poroelasticity
951+
! check if any poroelastic elements in domains
952+
call any_all_l(any_poroelastic,has_poroelasticity)
953+
if (has_poroelasticity) then
949954
! vpII
950-
call min_all_dp(vpIImin_glob, vpIImin_glob)
951-
call max_all_dp(vpIImax_glob, vpIImax_glob)
955+
tmp_val = vpIImin_glob
956+
call min_all_dp(tmp_val, vpIImin_glob)
957+
tmp_val = vpIImax_glob
958+
call max_all_dp(tmp_val, vpIImax_glob)
952959
! phi
953-
call min_all_dp(phimin_glob, phimin_glob)
954-
call max_all_dp(phimax_glob, phimax_glob)
960+
tmp_val = phimin_glob
961+
call min_all_dp(tmp_val, phimin_glob)
962+
tmp_val = phimax_glob
963+
call max_all_dp(tmp_val, phimax_glob)
955964
endif
956965

957-
if (any_anisotropy) then
966+
! anisotropy
967+
call any_all_l(any_anisotropy,has_anisotropy)
968+
if (has_anisotropy) then
958969
! c11
959970
tmp_val = minval(c11store)
960971
call min_all_dp(tmp_val, c11min_glob)
@@ -1017,13 +1028,13 @@ subroutine setup_mesh_material_properties()
10171028
write(IMAIN,*) ' vs : min/max = ',sngl(vsmin_glob),'/',sngl(vsmax_glob)
10181029
write(IMAIN,*) ' vp : min/max = ',sngl(vpmin_glob),'/',sngl(vpmax_glob)
10191030
write(IMAIN,*)
1020-
if (any_poroelastic) then
1031+
if (has_poroelasticity) then
10211032
write(IMAIN,*) ' poroelasticity:'
10221033
write(IMAIN,*) ' vpII: min/max = ',sngl(vpIImin_glob),'/',sngl(vpIImax_glob)
10231034
write(IMAIN,*) ' phi : min/max = ',sngl(phimin_glob),'/',sngl(phimax_glob)
10241035
write(IMAIN,*)
10251036
endif
1026-
if (any_anisotropy) then
1037+
if (has_anisotropy) then
10271038
write(IMAIN,*) ' anisotropy:'
10281039
write(IMAIN,*) ' c11: min/max = ',sngl(c11min_glob),'/',sngl(c11max_glob)
10291040
write(IMAIN,*) ' c12: min/max = ',sngl(c12min_glob),'/',sngl(c12max_glob)

Diff for: src/specfem2D/specfem2D_par.f90

+3
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,11 @@ module specfem_par
423423
! anisotropy
424424
integer :: nspec_aniso
425425

426+
! local flag if any anisotropic element is in this slice
426427
logical :: any_anisotropy
428+
! local flag if all elements are anisotropic in this slice
427429
logical :: all_anisotropic
430+
428431
logical, dimension(:), allocatable :: ispec_is_anisotropic
429432

430433
! inverse mass matrices

0 commit comments

Comments
 (0)