Skip to content

Commit

Permalink
renames xstore_dummy/.. to xstore_unique/.. for generate databases
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Apr 19, 2021
1 parent c2d5c03 commit 2935eef
Show file tree
Hide file tree
Showing 26 changed files with 551 additions and 530 deletions.
6 changes: 3 additions & 3 deletions src/generate_databases/create_mass_matrices.f90
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ subroutine create_mass_matrices_ocean_load(nglob,nspec,ibool)
if (TOPOGRAPHY) then

! takes elevation from topography file
xloc = xstore_dummy(iglobnum)
yloc = ystore_dummy(iglobnum)
xloc = xstore_unique(iglobnum)
yloc = ystore_unique(iglobnum)

call get_topo_bathy_elevation(xloc,yloc,loc_elevation, &
itopo_bathy,NX_TOPO,NY_TOPO)
Expand All @@ -262,7 +262,7 @@ subroutine create_mass_matrices_ocean_load(nglob,nspec,ibool)
else

! takes elevation from z-coordinate of mesh point
elevation = zstore_dummy(iglobnum)
elevation = zstore_unique(iglobnum)

endif

Expand Down
80 changes: 41 additions & 39 deletions src/generate_databases/create_regions_mesh.f90
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ subroutine create_regions_mesh()
nodes_coords_ext_mesh,nnodes_ext_mesh, &
elmnts_ext_mesh,nelmnts_ext_mesh)
endif
! at this point (xyz)store_dummy are still open
! at this point (xyz)store_unique are still open
if (.not. PARALLEL_FAULT) then
call fault_setup(ibool,nnodes_ext_mesh,nodes_coords_ext_mesh, &
xstore,ystore,zstore,nspec,nglob)
endif
! this closes (xyz)store_dummy
! this closes (xyz)store_unique
endif


Expand All @@ -147,15 +147,15 @@ subroutine create_regions_mesh()
write(IMAIN,*) ' ...preparing MPI interfaces '
call flush_IMAIN()
endif
call get_MPI_interface(nglob_dummy,nspec,ibool)
call get_MPI_interface(nglob_unique,nspec,ibool)

! setting up parallel fault
if (PARALLEL_FAULT .and. ANY_FAULT) then
call synchronize_all()
!at this point (xyz)store_dummy are still open
!at this point (xyz)store_unique are still open
call fault_setup(ibool,nnodes_ext_mesh,nodes_coords_ext_mesh, &
xstore,ystore,zstore,nspec,nglob)
! this closes (xyz)store_dummy
! this closes (xyz)store_unique
endif

! sets up absorbing/free surface boundaries
Expand Down Expand Up @@ -247,7 +247,7 @@ subroutine create_regions_mesh()
write(IMAIN,*) ' ...creating C-PML damping profiles '
call flush_IMAIN()
endif
call pml_set_local_dampingcoeff(xstore_dummy,ystore_dummy,zstore_dummy)
call pml_set_local_dampingcoeff(xstore_unique,ystore_unique,zstore_unique)
endif

! creates mass matrix
Expand All @@ -257,7 +257,7 @@ subroutine create_regions_mesh()
write(IMAIN,*) ' ...creating mass matrix '
call flush_IMAIN()
endif
call create_mass_matrices(nglob_dummy,nspec,ibool,PML_CONDITIONS,STACEY_ABSORBING_CONDITIONS)
call create_mass_matrices(nglob_unique,nspec,ibool,PML_CONDITIONS,STACEY_ABSORBING_CONDITIONS)

! saves the binary mesh files
call synchronize_all()
Expand Down Expand Up @@ -301,7 +301,7 @@ subroutine create_regions_mesh()
call synchronize_all()

! computes the approximate amount of memory needed to run the solver
call memory_eval(nspec,nglob_dummy,maxval(nibool_interfaces_ext_mesh),num_interfaces_ext_mesh, &
call memory_eval(nspec,nglob_unique,maxval(nibool_interfaces_ext_mesh),num_interfaces_ext_mesh, &
APPROXIMATE_OCEAN_LOAD,memory_size)

call max_all_dp(memory_size, max_memory_size)
Expand All @@ -313,8 +313,8 @@ subroutine create_regions_mesh()
write(IMAIN,*) ' ...checking mesh resolution'
call flush_IMAIN()
endif
call check_mesh_resolution(nspec,nglob_dummy, &
ibool,xstore_dummy,ystore_dummy,zstore_dummy, &
call check_mesh_resolution(nspec,nglob_unique, &
ibool,xstore_unique,ystore_unique,zstore_unique, &
ispec_is_acoustic,ispec_is_elastic,ispec_is_poroelastic, &
kappastore,mustore,rhostore, &
phistore,tortstore,rhoarraystore,rho_vpI,rho_vpII,rho_vsI, &
Expand Down Expand Up @@ -346,7 +346,7 @@ subroutine create_regions_mesh()
deallocate(rho_vpI,rho_vpII,rho_vsI)
deallocate(rhoarraystore,kappaarraystore,etastore,phistore,tortstore,permstore)

if (.not. SAVE_MOHO_MESH) deallocate(xstore_dummy,ystore_dummy,zstore_dummy)
if (.not. SAVE_MOHO_MESH) deallocate(xstore_unique,ystore_unique,zstore_unique)

if (ACOUSTIC_SIMULATION) deallocate(rmass_acoustic)
if (ELASTIC_SIMULATION) deallocate(rmass)
Expand Down Expand Up @@ -1086,28 +1086,30 @@ subroutine crm_ext_setup_indexing(ibool, &
endif

! unique global point locations
nglob_dummy = nglob
allocate(xstore_dummy(nglob_dummy),stat=ier)
nglob_unique = nglob ! note: nglob => NGLOB_AB

! coordinates for global points
allocate(xstore_unique(nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 813')
xstore_dummy(:) = 0._CUSTOM_REAL
xstore_unique(:) = 0._CUSTOM_REAL

allocate(ystore_dummy(nglob_dummy),stat=ier)
allocate(ystore_unique(nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 814')
ystore_dummy(:) = 0._CUSTOM_REAL
ystore_unique(:) = 0._CUSTOM_REAL

allocate(zstore_dummy(nglob_dummy),stat=ier)
allocate(zstore_unique(nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 815')
if (ier /= 0) stop 'error in allocate'
zstore_dummy(:) = 0._CUSTOM_REAL
zstore_unique(:) = 0._CUSTOM_REAL

do ispec = 1, nspec
do k = 1, NGLLZ
do j = 1, NGLLY
do i = 1, NGLLX
iglobnum = ibool(i,j,k,ispec)
xstore_dummy(iglobnum) = real(xstore(i,j,k,ispec),kind=CUSTOM_REAL)
ystore_dummy(iglobnum) = real(ystore(i,j,k,ispec),kind=CUSTOM_REAL)
zstore_dummy(iglobnum) = real(zstore(i,j,k,ispec),kind=CUSTOM_REAL)
xstore_unique(iglobnum) = real(xstore(i,j,k,ispec),kind=CUSTOM_REAL)
ystore_unique(iglobnum) = real(ystore(i,j,k,ispec),kind=CUSTOM_REAL)
zstore_unique(iglobnum) = real(zstore(i,j,k,ispec),kind=CUSTOM_REAL)
enddo
enddo
enddo
Expand Down Expand Up @@ -1177,9 +1179,9 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &
reshape( (/ 1,2,2, NGLLX,2,2, 2,1,2, 2,NGLLY,2, 2,2,1, 2,2,NGLLZ /),(/3,6/)) ! top

! temporary arrays for passing information
allocate(iglob_is_surface(nglob_dummy),stat=ier)
allocate(iglob_is_surface(nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 816')
allocate(iglob_normals(NDIM,nglob_dummy),stat=ier)
allocate(iglob_normals(NDIM,nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 817')
if (ier /= 0) stop 'error allocating array iglob_is_surface'

Expand All @@ -1204,16 +1206,16 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &

! sets face id of reference element associated with this face
call get_element_face_id(ispec,xcoord,ycoord,zcoord, &
ibool,nspec,nglob_dummy, &
xstore_dummy,ystore_dummy,zstore_dummy, &
ibool,nspec,nglob_unique, &
xstore_unique,ystore_unique,zstore_unique, &
iface)

! ijk indices of GLL points for face id
call get_element_face_gll_indices(iface,ijk_face,NGLLX,NGLLZ)

! weighted jacobian and normal
call get_jacobian_boundary_face(nspec, &
xstore_dummy,ystore_dummy,zstore_dummy,ibool,nglob_dummy, &
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)
Expand All @@ -1223,8 +1225,8 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &
do j = 1,NGLLY
do i = 1,NGLLX
call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, &
ibool,nspec,nglob_dummy, &
xstore_dummy,ystore_dummy,zstore_dummy, &
ibool,nspec,nglob_unique, &
xstore_unique,ystore_unique,zstore_unique, &
normal_face(:,i,j))
enddo
enddo
Expand Down Expand Up @@ -1290,9 +1292,9 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &
counter = counter+1

! reference corner coordinates
xcoord(icorner) = xstore_dummy(iglob)
ycoord(icorner) = ystore_dummy(iglob)
zcoord(icorner) = zstore_dummy(iglob)
xcoord(icorner) = xstore_unique(iglob)
ycoord(icorner) = ystore_unique(iglob)
zcoord(icorner) = zstore_unique(iglob)
endif
enddo

Expand All @@ -1305,7 +1307,7 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &
! re-computes face infos
! weighted jacobian and normal
call get_jacobian_boundary_face(nspec, &
xstore_dummy,ystore_dummy,zstore_dummy,ibool,nglob_dummy, &
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)
Expand All @@ -1315,8 +1317,8 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &
do j = 1,NGLLZ
do i = 1,NGLLX
call get_element_face_normal(ispec,iface,xcoord,ycoord,zcoord, &
ibool,nspec,nglob_dummy, &
xstore_dummy,ystore_dummy,zstore_dummy, &
ibool,nspec,nglob_unique, &
xstore_unique,ystore_unique,zstore_unique, &
normal_face(:,i,j) )
enddo
enddo
Expand All @@ -1330,8 +1332,8 @@ subroutine crm_setup_moho(nspec,nspec2D_moho_ext,ibelm_moho,nodes_ibelm_moho, &

! determines whether normal points into element or not (top/bottom distinction)
call get_element_face_normal_idirect(ispec,iface,xcoord,ycoord,zcoord, &
ibool,nspec,nglob_dummy, &
xstore_dummy,ystore_dummy,zstore_dummy, &
ibool,nspec,nglob_unique, &
xstore_unique,ystore_unique,zstore_unique, &
normal,idirect)

! takes moho surface element id given by id on midpoint
Expand Down Expand Up @@ -1501,7 +1503,7 @@ subroutine crm_setup_inner_outer_elemnts(nspec,ibool,SAVE_MESH_FILES)
if (ier /= 0) stop 'error allocating array ispec_is_inner'

! temporary array
allocate(iglob_is_inner(nglob_dummy),stat=ier)
allocate(iglob_is_inner(nglob_unique),stat=ier)
if (ier /= 0) call exit_MPI_without_rank('error allocating array 827')
if (ier /= 0) stop 'error allocating temporary array iglob_is_inner'

Expand Down Expand Up @@ -1532,8 +1534,8 @@ subroutine crm_setup_inner_outer_elemnts(nspec,ibool,SAVE_MESH_FILES)

if (SAVE_MESH_FILES .and. DEBUG) then
filename = prname(1:len_trim(prname))//'ispec_is_inner'
call write_VTK_data_elem_l(nspec,nglob_dummy, &
xstore_dummy,ystore_dummy,zstore_dummy,ibool, &
call write_VTK_data_elem_l(nspec,nglob_unique, &
xstore_unique,ystore_unique,zstore_unique,ibool, &
ispec_is_inner,filename)
endif

Expand Down
Loading

0 comments on commit 2935eef

Please sign in to comment.