Skip to content

Commit 0533bba

Browse files
committed
updates mesher array initialization (and comments out unneeded parameters)
1 parent 53e2ae2 commit 0533bba

File tree

6 files changed

+57
-33
lines changed

6 files changed

+57
-33
lines changed

src/generate_databases/model_vs30.f90

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ subroutine model_vs30_setup_check()
7474
! model values
7575
real(kind=CUSTOM_REAL) :: vs,min_vs,max_vs
7676

77-
! checks is USGS Vs30 model interface is provided in folder USGS_VS30/
77+
! initializes
78+
USE_MODEL_LAYER_VS30 = .false.
79+
80+
! checks if USGS Vs30 model interface is provided in folder USGS_VS30/
7881
!
7982
! the script ./utils/scripts/run_get_USGS_Vs30.py can create an interface file for a given region
8083
! and stores it in folder USGS_VS30/ as 'interface_vs30.dat'
@@ -83,7 +86,7 @@ subroutine model_vs30_setup_check()
8386

8487
inquire(file=trim(filename),exist=file_exists)
8588

86-
! checks is anything to do
89+
! checks if anything to do
8790
if (.not. file_exists) return
8891

8992
! user info

src/meshfem3D/compute_parameters.f90

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
3030
NSPEC_AB,NSPEC2D_A_XI,NSPEC2D_B_XI, &
3131
NSPEC2D_A_ETA,NSPEC2D_B_ETA, &
3232
NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
33-
NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX,NGLOB_AB, &
33+
NGLOB_AB, &
3434
USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
3535

3636
use constants
@@ -53,7 +53,6 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
5353
integer,intent(out) :: NSPEC2D_A_XI,NSPEC2D_B_XI,NSPEC2D_A_ETA,NSPEC2D_B_ETA
5454

5555
integer,intent(out) :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP
56-
integer,intent(out) :: NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX
5756

5857
! local parameters
5958
integer :: NGLOB_DOUBLING,NGLOB_DOUBLING_SINGLE
@@ -102,8 +101,9 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
102101
NSPEC2DMAX_YMIN_YMAX = 0
103102
NSPEC2D_BOTTOM = 0
104103
NSPEC2D_TOP = 0
105-
NPOIN2DMAX_XMIN_XMAX = 0
106-
NPOIN2DMAX_YMIN_YMAX = 0
104+
105+
!NPOIN2DMAX_XMIN_XMAX = 0 - not needed..
106+
!NPOIN2DMAX_YMIN_YMAX = 0
107107

108108
!
109109
!--- case of a regular mesh
@@ -152,8 +152,8 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
152152

153153
! 2-D addressing and buffers for summation between slices
154154
! we add one to number of points because of the flag after the last point
155-
NPOIN2DMAX_XMIN_XMAX = NSPEC2DMAX_XMIN_XMAX*NGLLY_M*NGLLZ_M + 1
156-
NPOIN2DMAX_YMIN_YMAX = NSPEC2DMAX_YMIN_YMAX*NGLLX_M*NGLLZ_M + 1
155+
!NPOIN2DMAX_XMIN_XMAX = NSPEC2DMAX_XMIN_XMAX*NGLLY_M*NGLLZ_M + 1 - not needed..
156+
!NPOIN2DMAX_YMIN_YMAX = NSPEC2DMAX_YMIN_YMAX*NGLLX_M*NGLLZ_M + 1
157157

158158
! exact number of global points per slice
159159
NGLOB_AB = (NEX_PER_PROC_XI*(NGLLX_M-1)+1) * (NEX_PER_PROC_ETA*(NGLLY_M-1)+1) * (NER*(NGLLZ_M-1)+1)
@@ -402,8 +402,8 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
402402

403403
! 2-D addressing and buffers for summation between slices
404404
! we add one to number of points because of the flag after the last point
405-
NPOIN2DMAX_XMIN_XMAX = NSPEC2DMAX_XMIN_XMAX * NGLLY_M * NGLLZ_M + 1
406-
NPOIN2DMAX_YMIN_YMAX = NSPEC2DMAX_YMIN_YMAX * NGLLX_M * NGLLZ_M + 1
405+
!NPOIN2DMAX_XMIN_XMAX = NSPEC2DMAX_XMIN_XMAX * NGLLY_M * NGLLZ_M + 1 - not needed..
406+
!NPOIN2DMAX_YMIN_YMAX = NSPEC2DMAX_YMIN_YMAX * NGLLX_M * NGLLZ_M + 1
407407

408408
! exact number of global points
409409
NGLOB_AB = NGLOB_DOUBLING + NGLOB_NO_DOUBLING
@@ -610,7 +610,6 @@ subroutine compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
610610
! NPOIN2DMAX_XMIN_XMAX = NSPEC2DMAX_XMIN_XMAX*NGLLY_M*NGLLZ_M + 1
611611
! NPOIN2DMAX_YMIN_YMAX = NSPEC2DMAX_YMIN_YMAX*NGLLX_M*NGLLZ_M + 1
612612
!
613-
!
614613
! ! exact number of global points
615614
!
616615
! ! case of the doubling regions

src/meshfem3D/create_meshfem_mesh.f90

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ module create_meshfem_par
4545

4646
! flag indicating whether point is in the sediments
4747
! logical point_is_in_sediments
48-
logical, dimension(:,:,:,:), allocatable :: flag_sediments
49-
logical, dimension(:), allocatable :: not_fully_in_bedrock
48+
!logical, dimension(:,:,:,:), allocatable :: flag_sediments - not used yet..
49+
!logical, dimension(:), allocatable :: not_fully_in_bedrock
5050

5151
! boundary parameters locator
5252
integer, dimension(:), allocatable :: ibelm_xmin,ibelm_xmax,ibelm_ymin,ibelm_ymax,ibelm_bottom,ibelm_top
@@ -146,7 +146,7 @@ subroutine create_meshfem_mesh()
146146
nspec,nglob, &
147147
prname,nodes_coords,ibool,ispec_material_id)
148148

149-
!! setting up wavefield discontinuity interface
149+
! setting up wavefield discontinuity interface
150150
if (IS_WAVEFIELD_DISCONTINUITY) then
151151
call find_wavefield_discontinuity_elements()
152152
endif
@@ -248,23 +248,27 @@ subroutine cmm_allocate_arrays()
248248
! use dynamic allocation to allocate memory for arrays
249249
allocate(ibool(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
250250
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1257')
251+
ibool(:,:,:,:) = 0
251252

252253
allocate(xstore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
253254
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1258')
254255
allocate(ystore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
255256
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1259')
256257
allocate(zstore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
257258
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1260')
259+
xstore(:,:,:,:) = 0.d0; ystore(:,:,:,:) = 0.d0; zstore(:,:,:,:) = 0.d0
258260

259261
! flag indicating whether point is in the sediments
260-
allocate(flag_sediments(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
261-
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1261')
262-
allocate(not_fully_in_bedrock(nspec),stat=ier)
263-
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1262')
262+
!allocate(flag_sediments(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
263+
!if (ier /= 0) call exit_MPI(myrank,'error allocating array 1261')
264+
!allocate(not_fully_in_bedrock(nspec),stat=ier)
265+
!if (ier /= 0) call exit_MPI(myrank,'error allocating array 1262')
266+
!flag_sediments(:,:,:,:) = .false.; not_fully_in_bedrock(:) = .false.
264267

265268
! boundary locator
266269
allocate(iboun(6,nspec),stat=ier)
267270
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1263')
271+
iboun(:,:) = .false.
268272

269273
! boundary parameters locator
270274
allocate(ibelm_xmin(NSPEC2DMAX_XMIN_XMAX),stat=ier)
@@ -279,15 +283,19 @@ subroutine cmm_allocate_arrays()
279283
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1268')
280284
allocate(ibelm_top(NSPEC2D_TOP),stat=ier)
281285
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1269')
286+
ibelm_xmin(:) = 0; ibelm_xmax(:) = 0; ibelm_ymin(:) = 0; ibelm_ymax(:) = 0
287+
ibelm_bottom(:) = 0; ibelm_top(:) = 0
282288

283289
! MPI cut-planes parameters along xi and along eta
284290
allocate(iMPIcut_xi(2,nspec),stat=ier)
285291
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1270')
286292
allocate(iMPIcut_eta(2,nspec),stat=ier)
287293
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1271')
294+
iMPIcut_xi(:,:) = .false.; iMPIcut_eta(:,:) = .false.
288295

289296
allocate(ispec_material_id(nspec),stat=ier)
290297
if (ier /= 0) call exit_MPI(myrank,'error allocating array 1279')
298+
ispec_material_id(:) = 0
291299

292300
! synchronize
293301
call synchronize_all()

src/meshfem3D/meshfem3D.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ program xmeshfem3D
193193
NSPEC_AB,NSPEC2D_A_XI,NSPEC2D_B_XI, &
194194
NSPEC2D_A_ETA,NSPEC2D_B_ETA, &
195195
NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
196-
NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX,NGLOB_AB, &
196+
NGLOB_AB, &
197197
USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
198198

199199
! check that the code is running with the requested nb of processes

src/meshfem3D/meshfem3D_par.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ module meshfem_par
109109
integer :: NSPEC2D_A_XI,NSPEC2D_B_XI, &
110110
NSPEC2D_A_ETA,NSPEC2D_B_ETA, &
111111
NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
112-
NSPEC2D_BOTTOM,NSPEC2D_TOP, &
113-
NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX
112+
NSPEC2D_BOTTOM,NSPEC2D_TOP
113+
114+
!integer :: NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX - not needed...
114115

115116
! interfaces parameters
116117
integer :: number_of_interfaces,number_of_layers

src/meshfem3D/store_boundaries.f90

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,49 +59,62 @@ subroutine store_boundaries(iboun,nspec, &
5959
ispecb5 = 0
6060
ispecb6 = 0
6161

62+
! boundary element arrays
63+
ibelm_xmin(:) = 0
64+
ibelm_xmax(:) = 0
65+
ibelm_ymin(:) = 0
66+
ibelm_ymax(:) = 0
67+
ibelm_bottom(:) = 0
68+
ibelm_top(:) = 0
69+
70+
nspec2D_xmin = 0
71+
nspec2D_xmax = 0
72+
nspec2D_ymin = 0
73+
nspec2D_ymax = 0
74+
6275
! determine if the element falls on a boundary
6376
do ispec = 1,nspec
6477

6578
! on boundary: xmin
6679
if (iboun(1,ispec)) then
67-
ispecb1 = ispecb1+1
80+
ispecb1 = ispecb1 + 1
6881
if (ispecb1 > NSPEC2DMAX_XMIN_XMAX) stop 'error NSPEC2DMAX_XMIN_XMAX too small'
69-
ibelm_xmin(ispecb1)=ispec
82+
ibelm_xmin(ispecb1) = ispec
7083
endif
7184

7285
! on boundary: xmax
7386
if (iboun(2,ispec)) then
74-
ispecb2 = ispecb2+1
87+
ispecb2 = ispecb2 + 1
7588
if (ispecb2 > NSPEC2DMAX_XMIN_XMAX) stop 'error NSPEC2DMAX_XMIN_XMAX too small'
76-
ibelm_xmax(ispecb2)=ispec
89+
ibelm_xmax(ispecb2) = ispec
7790
endif
7891

7992
! on boundary: ymin
8093
if (iboun(3,ispec)) then
81-
ispecb3 = ispecb3+1
94+
ispecb3 = ispecb3 + 1
8295
if (ispecb3 > NSPEC2DMAX_YMIN_YMAX) stop 'error NSPEC2DMAX_YMIN_YMAX too small'
83-
ibelm_ymin(ispecb3)=ispec
96+
ibelm_ymin(ispecb3) = ispec
8497
endif
8598

8699
! on boundary: ymax
87100
if (iboun(4,ispec)) then
88-
ispecb4 = ispecb4+1
101+
ispecb4 = ispecb4 + 1
89102
if (ispecb4 > NSPEC2DMAX_YMIN_YMAX) stop 'error NSPEC2DMAX_YMIN_YMAX too small'
90-
ibelm_ymax(ispecb4)=ispec
103+
ibelm_ymax(ispecb4) = ispec
91104
endif
92105

93106
! on boundary: bottom
94107
if (iboun(5,ispec)) then
95-
ispecb5 = ispecb5+1
108+
ispecb5 = ispecb5 + 1
96109
if (ispecb5 > NSPEC2D_BOTTOM) stop 'error NSPEC2D_BOTTOM too small'
97-
ibelm_bottom(ispecb5)=ispec
110+
ibelm_bottom(ispecb5) = ispec
98111
endif
99112

100113
! on boundary: top
101114
if (iboun(6,ispec)) then
102-
ispecb6 = ispecb6+1
115+
ispecb6 = ispecb6 + 1
103116
if (ispecb6 > NSPEC2D_TOP) stop 'error NSPEC2D_TOP too small'
104-
ibelm_top(ispecb6)=ispec
117+
ibelm_top(ispecb6) = ispec
105118
endif
106119

107120
enddo

0 commit comments

Comments
 (0)