[cig-commits] r12931 - seismo/3D/SPECFEM3D/branches/update_temporary

nlegoff at geodynamics.org nlegoff at geodynamics.org
Sun Sep 21 14:08:25 PDT 2008


Author: nlegoff
Date: 2008-09-21 14:08:25 -0700 (Sun, 21 Sep 2008)
New Revision: 12931

Modified:
   seismo/3D/SPECFEM3D/branches/update_temporary/constants.h.in
   seismo/3D/SPECFEM3D/branches/update_temporary/specfem3D.f90
Log:
added a few variables in constants.h.in that should be disposed of.
modified specfem3D.f90 to prepare for external meshes.


Modified: seismo/3D/SPECFEM3D/branches/update_temporary/constants.h.in
===================================================================
--- seismo/3D/SPECFEM3D/branches/update_temporary/constants.h.in	2008-09-21 19:57:33 UTC (rev 12930)
+++ seismo/3D/SPECFEM3D/branches/update_temporary/constants.h.in	2008-09-21 21:08:25 UTC (rev 12931)
@@ -116,6 +116,18 @@
   character(len=150), parameter :: LOCAL_PATH_Q = '/ibrixfs1/scratch/lqy/DATABASES_MPI_Q/'
 
 !------------------------------------------------------
+! nlegoff -- Variables that should be read/computed elsewhere.
+!            Temporary declared here.
+!------------------------------------------------------
+! whether or not an external mesh is used (provided by CUBIT for example)
+  logical, parameter :: USE_EXTERNAL_MESH = .false.
+
+! deltat
+  integer, parameter :: DT_ext_mesh = 100
+! NSTEP
+  double precision, parameter :: NSTEP_ext_mesh = 0.001d0
+
+!------------------------------------------------------
 !----------- do not modify anything below -------------
 !------------------------------------------------------
 

Modified: seismo/3D/SPECFEM3D/branches/update_temporary/specfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D/branches/update_temporary/specfem3D.f90	2008-09-21 19:57:33 UTC (rev 12930)
+++ seismo/3D/SPECFEM3D/branches/update_temporary/specfem3D.f90	2008-09-21 21:08:25 UTC (rev 12931)
@@ -439,6 +439,17 @@
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: dvxdxl,dvxdyl,dvxdzl,dvydxl,dvydyl,dvydzl,dvzdxl,dvzdyl,dvzdzl
   real(kind=CUSTOM_REAL), dimension(:,:,:,:),allocatable::  div, curl_x, curl_y, curl_z
 
+! for assembling in case of external mesh
+  integer :: ninterfaces_ext_mesh
+  integer :: max_nibool_interfaces_ext_mesh
+  integer, dimension(:), allocatable :: my_neighbours_ext_mesh
+  integer, dimension(:), allocatable :: nibool_interfaces_ext_mesh
+  integer, dimension(:,:), allocatable :: ibool_interfaces_ext_mesh
+  real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: buffer_send_vector_ext_mesh
+  real(kind=CUSTOM_REAL), dimension(:,:,:), allocatable :: buffer_recv_vector_ext_mesh
+  real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_send_scalar_ext_mesh
+  real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_recv_scalar_ext_mesh
+
 ! ************** PROGRAM STARTS HERE **************
 
 ! sizeprocs returns number of processes started
@@ -487,6 +498,19 @@
 ! get the base pathname for output files
   call get_value_string(OUTPUT_FILES, 'OUTPUT_FILES', 'OUTPUT_FILES')
 
+! info about external mesh simulation
+! nlegoff -- should be put in compute_parameters and read_parameter_file for clarity
+  if (USE_EXTERNAL_MESH) then
+    NPROC = sizeprocs
+    DT = DT_ext_mesh
+    NSTEP = NSTEP_ext_mesh
+    call create_name_database(prname,myrank,LOCAL_PATH)
+    open(unit=27,file=prname(1:len_trim(prname))//'.bin',status='old',action='read',form='unformatted')
+    read(27) NSPEC_AB
+    read(27) NGLOB_AB
+    close(27)
+  endif
+
 ! open main output file, only written to by process 0
   if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) &
     open(unit=IMAIN,file=trim(OUTPUT_FILES)//'/output_solver.txt',status='unknown')
@@ -540,6 +564,9 @@
 ! check that we have at least one source
   if(NSOURCES < 1) call exit_MPI(myrank,'need at least one source')
 
+! info on the addressing scheme that is not used in case of an external mesh simulation
+  if (.not. USE_EXTERNAL_MESH) then
+
 ! open file with global slice number addressing
   if(myrank == 0) then
     open(unit=IIN,file=trim(OUTPUT_FILES)//'/addressing.txt',status='old',action='read')
@@ -565,6 +592,8 @@
 ! define maximum size for message buffers
   NPOIN2DMAX_XY = max(NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX)
 
+  endif ! end of (.not. USE_EXTERNAL_MESH)
+
 ! start reading the databases
 
 ! allocate arrays for storing the databases
@@ -596,6 +625,49 @@
   allocate(veloc(NDIM,NGLOB_AB))
   allocate(accel(NDIM,NGLOB_AB))
 
+! info about external mesh simulation
+! nlegoff -- should be put in read_arrays_solver and read_arrays_buffer_solver for clarity
+  if (USE_EXTERNAL_MESH) then
+    call create_name_database(prname,myrank,LOCAL_PATH)
+    open(unit=27,file=prname(1:len_trim(prname))//'external_mesh.bin',status='old',action='read',form='unformatted')
+    read(27) NSPEC_AB
+    read(27) NGLOB_AB
+    read(27) xix
+    read(27) xiy
+    read(27) xiz
+    read(27) etax
+    read(27) etay
+    read(27) etaz
+    read(27) gammax
+    read(27) gammay
+    read(27) gammaz
+    read(27) jacobian
+    read(27) kappastore
+    read(27) mustore
+    read(27) rmass
+    read(27) ibool
+    read(27) xstore
+    read(27) ystore
+    read(27) zstore
+
+    read(27) ninterfaces_ext_mesh
+    read(27) max_nibool_interfaces_ext_mesh
+    allocate(my_neighbours_ext_mesh(ninterfaces_ext_mesh))
+    allocate(nibool_interfaces_ext_mesh(ninterfaces_ext_mesh))
+    allocate(ibool_interfaces_ext_mesh(max_nibool_interfaces_ext_mesh,ninterfaces_ext_mesh))
+    read(27) my_neighbours_ext_mesh
+    read(27) nibool_interfaces_ext_mesh
+    read(27) ibool_interfaces_ext_mesh
+
+    allocate(buffer_send_vector_ext_mesh(NDIM,max_nibool_interfaces_ext_mesh,ninterfaces_ext_mesh))
+    allocate(buffer_recv_vector_ext_mesh(NDIM,max_nibool_interfaces_ext_mesh,ninterfaces_ext_mesh))
+    allocate(buffer_send_scalar_ext_mesh(max_nibool_interfaces_ext_mesh,ninterfaces_ext_mesh))
+    allocate(buffer_recv_scalar_ext_mesh(max_nibool_interfaces_ext_mesh,ninterfaces_ext_mesh))
+
+    close(27)
+
+  else
+    
 ! read arrays created by the mesher
   call read_arrays_solver(myrank,NSPEC_AB,NGLOB_AB,xstore,ystore,zstore, &
             xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz,jacobian, &
@@ -615,6 +687,8 @@
      npoin2D_xi,npoin2D_eta, &
      NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX,LOCAL_PATH)
 
+  endif ! end of (USE_EXTERNAL_MESH)
+
 ! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
   if(myrank == 0) then



More information about the cig-commits mailing list