[cig-commits] r22012 - in seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS: EXAMPLES/regional_Greece_small/DATA src/meshfem3D src/shared src/specfem3D

lefebvre at geodynamics.org lefebvre at geodynamics.org
Thu May 9 13:00:00 PDT 2013


Author: lefebvre
Date: 2013-05-09 13:00:00 -0700 (Thu, 09 May 2013)
New Revision: 22012

Added:
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_attenuation_adios.f90
Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/EXAMPLES/regional_Greece_small/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_arrays_solver_adios.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/shared/adios_helpers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/Makefile.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/get_attenuation.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/prepare_timerun.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_arrays_solver_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/specfem3D.F90
Log:
attenuation and boundary databases written with ADIOS.

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/EXAMPLES/regional_Greece_small/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/EXAMPLES/regional_Greece_small/DATA/Par_file	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/EXAMPLES/regional_Greece_small/DATA/Par_file	2013-05-09 20:00:00 UTC (rev 22012)
@@ -123,4 +123,5 @@
 ADIOS_ENABLED                   = .true.
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
+#ADIOS_FOR_ARRAYS_SOLVER         = .false.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -338,7 +338,9 @@
     ! saves mesh and model parameters
     if (ADIOS_FOR_ARRAYS_SOLVER) then
       call save_arrays_solver_adios(myrank,nspec,nglob,idoubling,ibool, &
-          iregion_code,xstore,ystore,zstore, NSPEC2D_TOP,NSPEC2D_BOTTOM)
+          iregion_code,xstore,ystore,zstore,  &
+          NSPEC2DMAX_XMIN_XMAX, NSPEC2DMAX_YMIN_YMAX, &
+          NSPEC2D_TOP,NSPEC2D_BOTTOM)
     else
       call save_arrays_solver(myrank,nspec,nglob,idoubling,ibool, &
           iregion_code,xstore,ystore,zstore, NSPEC2D_TOP,NSPEC2D_BOTTOM)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_arrays_solver_adios.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_arrays_solver_adios.F90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_arrays_solver_adios.F90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -27,6 +27,7 @@
 
 subroutine save_arrays_solver_adios(myrank,nspec,nglob,idoubling,ibool, &
                     iregion_code,xstore,ystore,zstore, &
+                    NSPEC2DMAX_XMIN_XMAX, NSPEC2DMAX_YMIN_YMAX, &
                     NSPEC2D_TOP,NSPEC2D_BOTTOM)
 
   use mpi
@@ -73,7 +74,8 @@
   double precision,dimension(NGLLX,NGLLY,NGLLZ,nspec) :: xstore,ystore,zstore
 
   ! boundary parameters locator
-  integer :: NSPEC2D_TOP,NSPEC2D_BOTTOM
+  integer :: NSPEC2D_TOP,NSPEC2D_BOTTOM, &
+      NSPEC2DMAX_XMIN_XMAX, NSPEC2DMAX_YMIN_YMAX
 
   ! local parameters
   integer :: i,j,k,ispec,iglob,ier
@@ -655,50 +657,268 @@
 !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
   ! absorbing boundary parameters
-  open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
-        status='unknown',form='unformatted',action='write',iostat=ier)
-  if( ier /= 0 ) call exit_mpi(myrank,'error opening boundary.bin file')
+  outputname = trim(reg_name) // "boundary.bp" 
 
-  write(27) nspec2D_xmin
-  write(27) nspec2D_xmax
-  write(27) nspec2D_ymin
-  write(27) nspec2D_ymax
-  write(27) NSPEC2D_BOTTOM
-  write(27) NSPEC2D_TOP
+  write(group_name,"('SPECFEM3D_GLOBE_BOUNDARY_reg',i1)") iregion_code
+  group_size_inc = 0
+  call adios_declare_group(adios_group, group_name, &
+      "", 0, adios_err)
+  call adios_select_method(adios_group, "MPI", "", "", adios_err)
 
-  write(27) ibelm_xmin
-  write(27) ibelm_xmax
-  write(27) ibelm_ymin
-  write(27) ibelm_ymax
-  write(27) ibelm_bottom
-  write(27) ibelm_top
+  call define_adios_integer_scalar (adios_group, "nspec2D_xmin", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "nspec2D_xmax", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "nspec2D_ymin", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "nspec2D_ymax", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "NSPEC2D_BOTTOM", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "NSPEC2D_TOP", "", &
+      group_size_inc)
+  
+  !local_dim = NSPEC2DMAX_XMIN_YMAX
+  local_dim = size (ibelm_xmin) 
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_xmin", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_xmax", &
+      local_dim, group_size_inc)
 
-  write(27) normal_xmin
-  write(27) normal_xmax
-  write(27) normal_ymin
-  write(27) normal_ymax
-  write(27) normal_bottom
-  write(27) normal_top
+  !local_dim = NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (ibelm_ymin) 
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_ymin", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_ymax", &
+      local_dim, group_size_inc)
 
-  write(27) jacobian2D_xmin
-  write(27) jacobian2D_xmax
-  write(27) jacobian2D_ymin
-  write(27) jacobian2D_ymax
-  write(27) jacobian2D_bottom
-  write(27) jacobian2D_top
+  !local_dim = NSPEC2D_BOTTOM
+  local_dim = size (ibelm_bottom) 
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_bottom", &
+      local_dim, group_size_inc)
 
-  close(27)
+  !local_dim = NSPEC2D_TOP
+  local_dim = size (ibelm_top) 
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_top", &
+      local_dim, group_size_inc)
 
+  !local_dim = NDIM*NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX
+  local_dim = size (normal_xmin) 
+  call define_adios_global_real_1d_array(adios_group, "normal_xmin", &
+      local_dim, group_size_inc)
+  call define_adios_global_real_1d_array(adios_group, "normal_xmax", &
+      local_dim, group_size_inc)
+
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (normal_ymin) 
+  call define_adios_global_real_1d_array(adios_group, "normal_ymin", &
+      local_dim, group_size_inc)
+  call define_adios_global_real_1d_array(adios_group, "normal_ymax", &
+      local_dim, group_size_inc)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM
+  local_dim = size (normal_bottom) 
+  call define_adios_global_real_1d_array(adios_group, "normal_bottom", &
+      local_dim, group_size_inc)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP
+  local_dim = size (normal_top) 
+  call define_adios_global_real_1d_array(adios_group, "normal_top", &
+      local_dim, group_size_inc)
+
+  !local_dim = NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX
+  local_dim = size (jacobian2D_xmin) 
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_xmin", &
+      local_dim, group_size_inc)
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_xmax", &
+      local_dim, group_size_inc)
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (jacobian2D_ymin) 
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_ymin", &
+      local_dim, group_size_inc)
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_ymax", &
+      local_dim, group_size_inc)
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM
+  local_dim = size (jacobian2D_bottom) 
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_bottom", &
+      local_dim, group_size_inc)
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP
+  local_dim = size (jacobian2D_top) 
+  call define_adios_global_real_1d_array(adios_group, "jacobian2D_top", &
+      local_dim, group_size_inc)
+
+  ! Open an ADIOS handler to the restart file.
+  call adios_open (adios_handle, group_name, &
+      outputname, "w", comm, adios_err);
+  call adios_group_size (adios_handle, group_size_inc, &
+                         adios_totalsize, adios_err)
+
+  call adios_write(adios_handle, "nspec2D_xmin", nspec2D_xmin, adios_err)
+  call adios_write(adios_handle, "nspec2D_xmax", nspec2D_xmax, adios_err)
+  call adios_write(adios_handle, "nspec2D_ymin", nspec2D_ymin, adios_err)
+  call adios_write(adios_handle, "nspec2D_ymax", nspec2D_ymax, adios_err)
+  call adios_write(adios_handle, "NSPEC2D_BOTTOM", NSPEC2D_BOTTOM, adios_err)
+  call adios_write(adios_handle, "NSPEC2D_TOP", NSPEC2D_TOP, adios_err)
+  
+  !local_dim = NSPEC2DMAX_XMIN_XMAX
+  local_dim = size (ibelm_xmin) 
+  call adios_set_path (adios_handle, "ibelm_xmin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_xmin, adios_err)
+  call adios_set_path (adios_handle, "ibelm_xmax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_xmax, adios_err)
+
+  !local_dim = NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (ibelm_ymin) 
+  call adios_set_path (adios_handle, "ibelm_ymin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_ymin, adios_err)
+  call adios_set_path (adios_handle, "ibelm_ymax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_ymax, adios_err)
+
+  !local_dim = NSPEC2D_BOTTOM
+  local_dim = size (ibelm_bottom) 
+  call adios_set_path (adios_handle, "ibelm_bottom", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_bottom, adios_err)
+
+  !local_dim = NSPEC2D_TOP
+  local_dim = size (ibelm_top) 
+  call adios_set_path (adios_handle, "ibelm_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_top, adios_err)
+
+  !local_dim = NDIM*NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX
+  local_dim = size (normal_xmin) 
+  call adios_set_path (adios_handle, "normal_xmin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_xmin, adios_err)
+  call adios_set_path (adios_handle, "normal_xmax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_xmax, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (normal_ymin) 
+  call adios_set_path (adios_handle, "normal_ymin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_ymin, adios_err)
+  call adios_set_path (adios_handle, "normal_ymax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_ymax, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM
+  local_dim = size (normal_bottom) 
+  call adios_set_path (adios_handle, "normal_bottom", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_bottom, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP
+  local_dim = size (normal_top) 
+  call adios_set_path (adios_handle, "normal_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_top, adios_err)
+
+  !local_dim = NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX
+  local_dim = size (jacobian2D_xmin) 
+  call adios_set_path (adios_handle, "jacobian2D_xmin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_xmin, adios_err)
+  call adios_set_path (adios_handle, "jacobian2D_xmax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_xmax, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX
+  local_dim = size (jacobian2D_ymin) 
+  call adios_set_path (adios_handle, "jacobian2D_ymin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_ymin, adios_err)
+  call adios_set_path (adios_handle, "jacobian2D_ymax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_ymax, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM
+  local_dim = size (jacobian2D_bottom) 
+  call adios_set_path (adios_handle, "jacobian2D_bottom", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_bottom, adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP
+  local_dim = size (jacobian2D_top) 
+  call adios_set_path (adios_handle, "jacobian2D_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", jacobian2D_top, adios_err)
+
+  call adios_set_path (adios_handle, "", adios_err)
+  call adios_close(adios_handle, adios_err)
+
+
   if(ATTENUATION) then
-    open(unit=27, file=prname(1:len_trim(prname))//'attenuation.bin', &
-          status='unknown', form='unformatted',action='write',iostat=ier)
-    if( ier /= 0 ) call exit_mpi(myrank,'error opening attenuation.bin file')
+    outputname = trim(reg_name) // "attenuation.bp" 
+    write(group_name,"('SPECFEM3D_GLOBE_ATTENUATION_reg',i1)") iregion_code
+    group_size_inc = 0
+    call adios_declare_group(adios_group, group_name, &
+        "", 0, adios_err)
+    call adios_select_method(adios_group, "MPI", "", "", adios_err)
 
-    write(27) tau_s
-    write(27) tau_e_store
-    write(27) Qmu_store
-    write(27) T_c_source
-    close(27)
+    call define_adios_double_scalar(adios_group, "T_c_source", "", &
+        group_size_inc)
+
+    local_dim = size(tau_s)
+    call define_adios_global_double_1d_array(adios_group, "tau_s", &
+        local_dim, group_size_inc)
+    local_dim = size(tau_e_store)
+    call define_adios_global_double_1d_array(adios_group, "tau_e_store", &
+        local_dim, group_size_inc)
+    local_dim = size(Qmu_store)
+    call define_adios_global_double_1d_array(adios_group, "Qmu_store", &
+        local_dim, group_size_inc)
+
+    ! Open an ADIOS handler to the restart file.
+    call adios_open (adios_handle, group_name, &
+        outputname, "w", comm, adios_err);
+    call adios_group_size (adios_handle, group_size_inc, &
+                           adios_totalsize, adios_err)
+
+    call adios_write(adios_handle, "T_c_source", T_c_source, adios_err)
+
+    local_dim = size (tau_s) 
+    call adios_set_path (adios_handle, "tau_s", adios_err)
+    call write_1D_global_array_adios_dims(adios_handle, myrank, &
+        local_dim, sizeprocs)
+    call adios_write(adios_handle, "array", tau_s, adios_err)
+    local_dim = size (tau_e_store) 
+    call adios_set_path (adios_handle, "tau_e_store", adios_err)
+    call write_1D_global_array_adios_dims(adios_handle, myrank, &
+        local_dim, sizeprocs)
+    call adios_write(adios_handle, "array", tau_e_store, adios_err)
+    local_dim = size (Qmu_store) 
+    call adios_set_path (adios_handle, "Qmu_store", adios_err)
+    call write_1D_global_array_adios_dims(adios_handle, myrank, &
+        local_dim, sizeprocs)
+    call adios_write(adios_handle, "array", Qmu_store, adios_err)
+
+    call adios_set_path (adios_handle, "", adios_err)
+    call adios_close(adios_handle, adios_err)
   endif
 
   if(HETEROGEN_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/shared/adios_helpers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/shared/adios_helpers.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/shared/adios_helpers.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -319,3 +319,38 @@
       array_name // "/offset", var_id)
   group_size_inc = group_size_inc + local_dim*1
 end subroutine define_adios_global_logical_1d_array
+
+!-------------------------------------------------------------------------------
+!> Define a global ADIOS 1D real array and autoincrement the adios
+!! group size.
+!! \param adios_group The adios group where the variables belongs
+!! \param array_name The variable to be defined. This is actually the path for
+!!                   ADIOS. The values are stored in array_name/array
+!! \param len The local dimension of the array.
+!! \param group_size_inc The inout adios group size to increment
+!!                       with the size of the variable
+!! \note This function define local, global and offset sizes as well as the
+!!       array to store the values in.
+subroutine define_adios_global_double_1d_array(adios_group, array_name, &
+    local_dim, group_size_inc)
+  use adios_write_mod
+  implicit none
+  ! Parameters
+  integer(kind=8), intent(in) :: adios_group
+  character(len=*), intent(in) :: array_name
+  integer, intent(in) :: local_dim
+  integer(kind=8), intent(inout) :: group_size_inc
+  ! Variables
+  integer(kind=8) :: var_id
+
+  call define_adios_integer_scalar (adios_group, "local_dim", array_name, &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "global_dim", array_name, &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "offset", array_name, &
+      group_size_inc)
+  call adios_define_var(adios_group, "array", array_name, 6, &
+      array_name // "/local_dim", array_name // "/global_dim", &
+      array_name // "/offset", var_id)
+  group_size_inc = group_size_inc + local_dim*8
+end subroutine define_adios_global_double_1d_array

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/Makefile.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/Makefile.in	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/Makefile.in	2013-05-09 20:00:00 UTC (rev 22012)
@@ -249,6 +249,7 @@
 
 # using ADIOS files
 ADIOS_OBJECTS= \
+	$O/read_attenuation_adios.adios.o \
 	$O/read_mesh_databases_adios.adios.o \
 	$O/read_arrays_solver_adios.adios.o \
 	$O/save_forward_arrays_adios.adios.o \

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/get_attenuation.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/get_attenuation.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/get_attenuation.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -32,7 +32,7 @@
                                            scale_factor, tau_s, &
                                            vx, vy, vz, vnspec)
 
-  use specfem_par,only: ATTENUATION_VAL
+  use specfem_par,only: ATTENUATION_VAL, ADIOS_FOR_ARRAYS_SOLVER
 
   implicit none
 
@@ -57,15 +57,20 @@
 
   ! All of the following reads use the output parameters as their temporary arrays
   ! use the filename to determine the actual contents of the read
-  open(unit=27, file=prname(1:len_trim(prname))//'attenuation.bin', &
-        status='old',action='read',form='unformatted',iostat=ier)
-  if( ier /= 0 ) call exit_MPI(myrank,'error opening file attenuation.bin')
+  if (ADIOS_FOR_ARRAYS_SOLVER) then
+    call read_attenuation_adios(myrank, prname, & 
+       factor_common, scale_factor, tau_s, vx, vy, vz, vnspec, T_c_source)
+  else
+    open(unit=27, file=prname(1:len_trim(prname))//'attenuation.bin', &
+          status='old',action='read',form='unformatted',iostat=ier)
+    if( ier /= 0 ) call exit_MPI(myrank,'error opening file attenuation.bin')
 
-  read(27) tau_s
-  read(27) factor_common ! tau_e_store
-  read(27) scale_factor  ! Qmu_store
-  read(27) T_c_source
-  close(27)
+    read(27) tau_s
+    read(27) factor_common ! tau_e_store
+    read(27) scale_factor  ! Qmu_store
+    read(27) T_c_source
+    close(27)
+  endif
 
   scale_t = ONE/dsqrt(PI*GRAV*RHOAV)
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/prepare_timerun.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/prepare_timerun.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/prepare_timerun.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -745,7 +745,11 @@
   tau_sigma_dble(:) = 0.d0
 
   ! reads in attenuation values
-  call create_name_database(prnamel, myrank, IREGION_CRUST_MANTLE, LOCAL_PATH)
+  if (ADIOS_FOR_ARRAYS_SOLVER) then
+    call create_name_database_adios(prnamel, IREGION_CRUST_MANTLE, LOCAL_PATH)
+  else 
+    call create_name_database(prnamel, myrank, IREGION_CRUST_MANTLE, LOCAL_PATH)
+  endif
   call get_attenuation_model_3D_or_1D(myrank, prnamel, &
                                      omsb_crust_mantle_dble, &
                                      factor_common_crust_mantle_dble, &
@@ -760,7 +764,11 @@
   tau_sigma_dble = 0.d0
 
   ! reads in attenuation values
-  call create_name_database(prnamel, myrank, IREGION_INNER_CORE, LOCAL_PATH)
+  if (ADIOS_FOR_ARRAYS_SOLVER) then
+    call create_name_database_adios(prnamel, IREGION_INNER_CORE, LOCAL_PATH)
+  else
+    call create_name_database(prnamel, myrank, IREGION_INNER_CORE, LOCAL_PATH)
+  endif
   call get_attenuation_model_3D_or_1D(myrank, prnamel, &
                                      omsb_inner_core_dble, &
                                      factor_common_inner_core_dble, &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_arrays_solver_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_arrays_solver_adios.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_arrays_solver_adios.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -113,8 +113,15 @@
   call check_adios_err(myrank,adios_err)
 
   ! read coordinates of the mesh
-  call adios_get_scalar(adios_handle, "nspec", lnspec, adios_err)
-  call adios_get_scalar(adios_handle, "nglob", lnglob, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec", 0, 1, &
+     lnspec, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nglob", 0, 1, &
+     lnglob, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec", lnspec, adios_err)
+  !call adios_get_scalar(adios_handle, "nglob", lnglob, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
 
   ! checks dimensions
   if( lnspec /= nspec ) then

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_attenuation_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_attenuation_adios.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_attenuation_adios.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -0,0 +1,124 @@
+!=====================================================================
+!
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          --------------------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!                        Princeton University, USA
+!             and University of Pau / CNRS / INRIA, France
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! 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 2 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 read_attenuation_adios(myrank, prname, &
+   factor_common, scale_factor, tau_s, vx, vy, vz, vnspec, T_c_source)
+
+  use adios_read_mod
+  use specfem_par,only: ATTENUATION_VAL
+
+  implicit none
+
+  include 'constants.h'
+  include 'mpif.h'
+
+  integer :: myrank
+
+  integer :: vx,vy,vz,vnspec
+  double precision, dimension(vx,vy,vz,vnspec)       :: scale_factor
+  double precision, dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
+  double precision, dimension(N_SLS)                 :: tau_s
+
+  character(len=150) :: prname
+
+  ! local parameters
+  integer :: i,j,k,ispec,ier
+  double precision, dimension(N_SLS) :: tau_e, fc
+  double precision :: omsb, Q_mu, sf, T_c_source, scale_t
+  integer :: sizeprocs, comm, ierr
+  character(len=150) :: file_name
+  integer(kind=8) :: group_size_inc
+  integer :: local_dim, global_dim, offset
+  ! ADIOS variables
+  integer                 :: adios_err
+  integer(kind=8)         :: adios_group, adios_handle, varid, sel
+  integer(kind=8)         :: adios_groupsize, adios_totalsize
+  integer :: vars_count, attrs_count, current_step, last_step, vsteps
+  character(len=128), dimension(:), allocatable :: adios_names 
+  integer(kind=8), dimension(1) :: start, count
+
+  ! checks if attenuation is on and anything to do
+  if( .not. ATTENUATION_VAL) return
+
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+
+  ! All of the following reads use the output parameters as their temporary arrays
+  ! use the filename to determine the actual contents of the read
+  file_name= trim(prname) // "attenuation.bp" 
+
+  call adios_read_init_method (ADIOS_READ_METHOD_BP, comm, &
+      "verbose=1", adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_open_file (adios_handle, file_name, 0, comm, ierr)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "T_c_source", 0, 1, &
+     T_c_source, adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  local_dim = size (tau_s) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "tau_s/array", 0, 1, &
+    tau_s, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  local_dim = size (factor_common) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "tau_e_store/array", 0, 1, &
+    factor_common, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  local_dim = size (scale_factor) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "Qmu_store/array", 0, 1, &
+    scale_factor, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  ! Close ADIOS handler to the restart file.
+  call adios_selection_delete(sel)
+  call adios_read_close(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+end subroutine read_attenuation_adios

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -54,7 +54,11 @@
   call read_mesh_databases_IC()
 
   ! reads "boundary.bin" files to couple mantle with outer core and inner core boundaries
-  call read_mesh_databases_coupling()
+  if (ADIOS_FOR_ARRAYS_SOLVER) then
+    call read_mesh_databases_coupling_adios()
+  else
+    call read_mesh_databases_coupling()
+  endif
 
   ! reads "addressing.txt" 2-D addressing (needed for stacey boundaries)
   call read_mesh_databases_addressing()

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases_adios.f90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases_adios.f90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -29,7 +29,8 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine read_mesh_databases_coupling_adios()
+subroutine read_mesh_databases_coupling_adios()
+  use adios_read_mod
 
 ! to couple mantle with outer core
 
@@ -44,46 +45,530 @@
 
   ! local parameters
   integer :: njunk1,njunk2,njunk3
-  integer :: ierr
+  integer :: sizeprocs, comm, ierr
+  character(len=150) :: file_name
+  integer(kind=8) :: group_size_inc
+  integer :: local_dim, global_dim, offset
+  ! ADIOS variables
+  integer                 :: adios_err
+  integer(kind=8)         :: adios_group, adios_handle, varid, sel
+  integer(kind=8)         :: adios_groupsize, adios_totalsize
+  integer :: vars_count, attrs_count, current_step, last_step, vsteps
+  character(len=128), dimension(:), allocatable :: adios_names 
+  integer(kind=8), dimension(1) :: start, count
 
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+
   ! crust and mantle
   ! create name of database
-  call create_name_database(prname,myrank,IREGION_CRUST_MANTLE,LOCAL_PATH)
+  call create_name_database_adios(prname, IREGION_CRUST_MANTLE, LOCAL_PATH)
+  file_name= trim(prname) // "boundary.bp" 
 
+  call adios_read_init_method (ADIOS_READ_METHOD_BP, comm, &
+      "verbose=1", adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_open_file (adios_handle, file_name, 0, comm, ierr)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmin", 0, 1, &
+     nspec2D_xmin_crust_mantle, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmax", 0, 1, &
+     nspec2D_xmax_crust_mantle, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymin", 0, 1, &
+     nspec2D_ymin_crust_mantle, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymax", 0, 1, &
+     nspec2D_ymax_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmin", &
+      !nspec2D_xmin_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmax", &
+      !nspec2D_xmax_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymin", &
+      !nspec2D_ymin_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymax", &
+      !nspec2D_ymax_crust_mantle, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2DMAX_XMIN_XMAX_CM
+  local_dim = size (ibelm_xmin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmin/array", 0, 1, &
+    ibelm_xmin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmax/array", 0, 1, &
+    ibelm_xmax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2DMAX_YMIN_YMAX_CM
+  local_dim = size (ibelm_ymin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymin/array", 0, 1, &
+    ibelm_ymin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymax/array", 0, 1, &
+    ibelm_ymax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_BOTTOM_CM
+  local_dim = size (ibelm_bottom_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_bottom/array", 0, 1, &
+    ibelm_bottom_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_TOP_CM
+  local_dim = size (ibelm_top_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_top/array", 0, 1, &
+    ibelm_top_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX_CM
+  local_dim = size (normal_xmin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_xmin/array", 0, 1, &
+    normal_xmin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "normal_xmax/array", 0, 1, &
+    normal_xmax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX_CM
+  local_dim = size (normal_ymin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_ymin/array", 0, 1, &
+    normal_ymin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "normal_ymax/array", 0, 1, &
+    normal_ymax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM_CM
+  local_dim = size (ibelm_bottom_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_bottom/array", 0, 1, &
+    normal_bottom_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP_CM
+  local_dim = size (ibelm_top_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_top/array", 0, 1, &
+    normal_top_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX_CM
+  local_dim = size (jacobian2D_xmin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_xmin/array", 0, 1, &
+    jacobian2D_xmin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_xmax/array", 0, 1, &
+    jacobian2D_xmax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX_CM
+  local_dim = size (jacobian2D_ymin_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_ymin/array", 0, 1, &
+    jacobian2D_ymin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_ymax/array", 0, 1, &
+    jacobian2D_ymax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLX*NGLLY*NSPEC2D_BOTTOM_CM
+  local_dim = size (jacobian2D_bottom_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_bottom/array", 0, 1, &
+    jacobian2D_bottom_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLX*NGLLY*NSPEC2D_TOP_CM
+  local_dim = size (jacobian2D_top_crust_mantle) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_top/array", 0, 1, &
+    jacobian2D_top_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+! boundary parameters
+
+  ! Close ADIOS handler to the restart file.
+  call adios_selection_delete(sel)
+  call adios_read_close(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  ! read parameters to couple fluid and solid regions
+  !
+  ! outer core
+
+  ! create name of database
+  call create_name_database_adios(prname, IREGION_OUTER_CORE, LOCAL_PATH)
+  file_name= trim(prname) // "boundary.bp" 
+
+  call adios_read_init_method (ADIOS_READ_METHOD_BP, comm, &
+      "verbose=1", adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_open_file (adios_handle, file_name, 0, comm, ierr)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmin", 0, 1, &
+     nspec2D_xmin_outer_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmax", 0, 1, &
+     nspec2D_xmax_outer_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymin", 0, 1, &
+     nspec2D_ymin_outer_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymax", 0, 1, &
+     nspec2D_ymax_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmin", &
+      !nspec2D_xmin_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmax", &
+      !nspec2D_xmax_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymin", &
+      !nspec2D_ymin_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymax", &
+      !nspec2D_ymax_outer_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  nspec2D_zmin_outer_core = NSPEC2D_BOTTOM(IREGION_OUTER_CORE)
+
+  !local_dim = NSPEC2DMAX_XMIN_XMAX_OC
+  local_dim = size (ibelm_xmin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmin/array", 0, 1, &
+    ibelm_xmin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmax/array", 0, 1, &
+    ibelm_xmax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2DMAX_YMIN_YMAX_OC
+  local_dim = size (ibelm_ymin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymin/array", 0, 1, &
+    ibelm_ymin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymax/array", 0, 1, &
+    ibelm_ymax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_BOTTOM_OC
+  local_dim = size (ibelm_bottom_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_bottom/array", 0, 1, &
+    ibelm_bottom_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_TOP_OC
+  local_dim = size (ibelm_top_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_top/array", 0, 1, &
+    ibelm_top_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX_OC
+  local_dim = size (normal_xmin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_xmin/array", 0, 1, &
+    normal_xmin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "normal_xmax/array", 0, 1, &
+    normal_xmax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX_OC
+  local_dim = size (normal_ymin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_ymin/array", 0, 1, &
+    normal_ymin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "normal_ymax/array", 0, 1, &
+    normal_ymax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_BOTTOM_OC
+  local_dim = size (normal_bottom_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_bottom/array", 0, 1, &
+    normal_bottom_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_TOP_OC
+  local_dim = size (normal_top_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "normal_top/array", 0, 1, &
+    normal_top_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLY*NGLLZ*NSPEC2DMAX_XMIN_XMAX_OC
+  local_dim = size (jacobian2D_xmin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_xmin/array", 0, 1, &
+    jacobian2D_xmin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_xmax/array", 0, 1, &
+    jacobian2D_xmax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLX*NGLLZ*NSPEC2DMAX_YMIN_YMAX_OC
+  local_dim = size (jacobian2D_ymin_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_ymin/array", 0, 1, &
+    jacobian2D_ymin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_ymax/array", 0, 1, &
+    jacobian2D_ymax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+
+  !local_dim = NGLLX*NGLLY*NSPEC2D_BOTTOM_OC
+  local_dim = size (jacobian2D_bottom_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_bottom/array", 0, 1, &
+    jacobian2D_bottom_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NGLLX*NGLLY*NSPEC2D_TOP_OC
+  local_dim = size (jacobian2D_top_outer_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "jacobian2D_top/array", 0, 1, &
+    jacobian2D_top_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  ! boundary parameters
+
+  ! Close ADIOS handler to the restart file.
+  call adios_selection_delete(sel)
+  call adios_read_close(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+
+  ! inner core
+
+  ! create name of database
+  call create_name_database_adios(prname, IREGION_INNER_CORE, LOCAL_PATH)
+  file_name= trim(prname) // "boundary.bp" 
+
+  call adios_read_init_method (ADIOS_READ_METHOD_BP, comm, &
+      "verbose=1", adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_open_file (adios_handle, file_name, 0, comm, ierr)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmin", 0, 1, &
+     nspec2D_xmin_inner_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_xmax", 0, 1, &
+     nspec2D_xmax_inner_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymin", 0, 1, &
+     nspec2D_ymin_inner_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec2D_ymax", 0, 1, &
+     nspec2D_ymax_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmin", &
+      !nspec2D_xmin_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_xmax", &
+      !nspec2D_xmax_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymin", &
+      !nspec2D_ymin_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec2D_ymax", &
+      !nspec2D_ymax_inner_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2DMAX_XMIN_XMAX_IC
+  local_dim = size (ibelm_xmin_inner_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmin/array", 0, 1, &
+    ibelm_xmin_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_xmax/array", 0, 1, &
+    ibelm_xmax_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2DMAX_YMIN_YMAX_IC
+  local_dim = size (ibelm_ymin_inner_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymin/array", 0, 1, &
+    ibelm_ymin_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_schedule_read(adios_handle, sel, "ibelm_ymax/array", 0, 1, &
+    ibelm_ymax_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_BOTTOM_IC
+  local_dim = size (ibelm_bottom_inner_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_bottom/array", 0, 1, &
+    ibelm_bottom_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !local_dim = NSPEC2D_TOP_IC
+  local_dim = size (ibelm_top_inner_core) 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "ibelm_top/array", 0, 1, &
+    ibelm_top_inner_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  ! Close ADIOS handler to the restart file.
+  call adios_selection_delete(sel)
+  call adios_read_close(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
+  call check_adios_err(myrank,adios_err)
+
+  !call create_name_database(prname,myrank,IREGION_CRUST_MANTLE,LOCAL_PATH)
+
   ! Stacey put back
-  open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
-        status='old',form='unformatted',action='read',iostat=ierr)
-  if( ierr /= 0 ) call exit_mpi(myrank,'error opening crust_mantle boundary.bin file')
+  !open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
+        !status='old',form='unformatted',action='read',iostat=ierr)
+  !if( ierr /= 0 ) call exit_mpi(myrank,'error opening crust_mantle boundary.bin file')
 
-  read(27) nspec2D_xmin_crust_mantle
-  read(27) nspec2D_xmax_crust_mantle
-  read(27) nspec2D_ymin_crust_mantle
-  read(27) nspec2D_ymax_crust_mantle
-  read(27) njunk1
-  read(27) njunk2
+  !read(27) nspec2D_xmin_crust_mantle
+  !read(27) nspec2D_xmax_crust_mantle
+  !read(27) nspec2D_ymin_crust_mantle
+  !read(27) nspec2D_ymax_crust_mantle
+  !read(27) njunk1
+  !read(27) njunk2
 
 ! boundary parameters
-  read(27) ibelm_xmin_crust_mantle
-  read(27) ibelm_xmax_crust_mantle
-  read(27) ibelm_ymin_crust_mantle
-  read(27) ibelm_ymax_crust_mantle
-  read(27) ibelm_bottom_crust_mantle
-  read(27) ibelm_top_crust_mantle
+  !read(27) ibelm_xmin_crust_mantle
+  !read(27) ibelm_xmax_crust_mantle
+  !read(27) ibelm_ymin_crust_mantle
+  !read(27) ibelm_ymax_crust_mantle
+  !read(27) ibelm_bottom_crust_mantle
+  !read(27) ibelm_top_crust_mantle
 
-  read(27) normal_xmin_crust_mantle
-  read(27) normal_xmax_crust_mantle
-  read(27) normal_ymin_crust_mantle
-  read(27) normal_ymax_crust_mantle
-  read(27) normal_bottom_crust_mantle
-  read(27) normal_top_crust_mantle
+  !read(27) normal_xmin_crust_mantle
+  !read(27) normal_xmax_crust_mantle
+  !read(27) normal_ymin_crust_mantle
+  !read(27) normal_ymax_crust_mantle
+  !read(27) normal_bottom_crust_mantle
+  !read(27) normal_top_crust_mantle
 
-  read(27) jacobian2D_xmin_crust_mantle
-  read(27) jacobian2D_xmax_crust_mantle
-  read(27) jacobian2D_ymin_crust_mantle
-  read(27) jacobian2D_ymax_crust_mantle
-  read(27) jacobian2D_bottom_crust_mantle
-  read(27) jacobian2D_top_crust_mantle
-  close(27)
+  !read(27) jacobian2D_xmin_crust_mantle
+  !read(27) jacobian2D_xmax_crust_mantle
+  !read(27) jacobian2D_ymin_crust_mantle
+  !read(27) jacobian2D_ymax_crust_mantle
+  !read(27) jacobian2D_bottom_crust_mantle
+  !read(27) jacobian2D_top_crust_mantle
+  !close(27)
 
 
   ! read parameters to couple fluid and solid regions
@@ -91,45 +576,46 @@
   ! outer core
 
   ! create name of database
-  call create_name_database(prname,myrank,IREGION_OUTER_CORE,LOCAL_PATH)
+  !call create_name_database(prname,myrank,IREGION_OUTER_CORE,LOCAL_PATH)
 
   ! boundary parameters
 
   ! Stacey put back
-  open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
-        status='old',form='unformatted',action='read',iostat=ierr)
-  if( ierr /= 0 ) call exit_mpi(myrank,'error opening outer_core boundary.bin file')
+  !open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
+        !status='old',form='unformatted',action='read',iostat=ierr)
+  !if( ierr /= 0 ) call exit_mpi(myrank,'error opening outer_core boundary.bin file')
 
-  read(27) nspec2D_xmin_outer_core
-  read(27) nspec2D_xmax_outer_core
-  read(27) nspec2D_ymin_outer_core
-  read(27) nspec2D_ymax_outer_core
-  read(27) njunk1
-  read(27) njunk2
+  !print *, myrank, "nspec2D_xmin_outer_core",nspec2D_xmin_outer_core
+  !read(27) nspec2D_xmin_outer_core
+  !read(27) nspec2D_xmax_outer_core
+  !read(27) nspec2D_ymin_outer_core
+  !read(27) nspec2D_ymax_outer_core
+  !read(27) njunk1
+  !read(27) njunk2
 
-  nspec2D_zmin_outer_core = NSPEC2D_BOTTOM(IREGION_OUTER_CORE)
+  !nspec2D_zmin_outer_core = NSPEC2D_BOTTOM(IREGION_OUTER_CORE)
 
-  read(27) ibelm_xmin_outer_core
-  read(27) ibelm_xmax_outer_core
-  read(27) ibelm_ymin_outer_core
-  read(27) ibelm_ymax_outer_core
-  read(27) ibelm_bottom_outer_core
-  read(27) ibelm_top_outer_core
+  !read(27) ibelm_xmin_outer_core
+  !read(27) ibelm_xmax_outer_core
+  !read(27) ibelm_ymin_outer_core
+  !read(27) ibelm_ymax_outer_core
+  !read(27) ibelm_bottom_outer_core
+  !read(27) ibelm_top_outer_core
 
-  read(27) normal_xmin_outer_core
-  read(27) normal_xmax_outer_core
-  read(27) normal_ymin_outer_core
-  read(27) normal_ymax_outer_core
-  read(27) normal_bottom_outer_core
-  read(27) normal_top_outer_core
+  !read(27) normal_xmin_outer_core
+  !read(27) normal_xmax_outer_core
+  !read(27) normal_ymin_outer_core
+  !read(27) normal_ymax_outer_core
+  !read(27) normal_bottom_outer_core
+  !read(27) normal_top_outer_core
 
-  read(27) jacobian2D_xmin_outer_core
-  read(27) jacobian2D_xmax_outer_core
-  read(27) jacobian2D_ymin_outer_core
-  read(27) jacobian2D_ymax_outer_core
-  read(27) jacobian2D_bottom_outer_core
-  read(27) jacobian2D_top_outer_core
-  close(27)
+  !read(27) jacobian2D_xmin_outer_core
+  !read(27) jacobian2D_xmax_outer_core
+  !read(27) jacobian2D_ymin_outer_core
+  !read(27) jacobian2D_ymax_outer_core
+  !read(27) jacobian2D_bottom_outer_core
+  !read(27) jacobian2D_top_outer_core
+  !close(27)
 
 
   !
@@ -137,28 +623,28 @@
   !
 
   ! create name of database
-  call create_name_database(prname,myrank,IREGION_INNER_CORE,LOCAL_PATH)
+  !call create_name_database(prname,myrank,IREGION_INNER_CORE,LOCAL_PATH)
 
-  ! read info for vertical edges for central cube matching in inner core
-  open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
-        status='old',form='unformatted',action='read',iostat=ierr)
-  if( ierr /= 0 ) call exit_mpi(myrank,'error opening inner_core boundary.bin file')
+  !! read info for vertical edges for central cube matching in inner core
+  !open(unit=27,file=prname(1:len_trim(prname))//'boundary.bin', &
+        !status='old',form='unformatted',action='read',iostat=ierr)
+  !if( ierr /= 0 ) call exit_mpi(myrank,'error opening inner_core boundary.bin file')
 
-  read(27) nspec2D_xmin_inner_core
-  read(27) nspec2D_xmax_inner_core
-  read(27) nspec2D_ymin_inner_core
-  read(27) nspec2D_ymax_inner_core
-  read(27) njunk1
-  read(27) njunk2
+  !read(27) nspec2D_xmin_inner_core
+  !read(27) nspec2D_xmax_inner_core
+  !read(27) nspec2D_ymin_inner_core
+  !read(27) nspec2D_ymax_inner_core
+  !read(27) njunk1
+  !read(27) njunk2
 
   ! boundary parameters
-  read(27) ibelm_xmin_inner_core
-  read(27) ibelm_xmax_inner_core
-  read(27) ibelm_ymin_inner_core
-  read(27) ibelm_ymax_inner_core
-  read(27) ibelm_bottom_inner_core
-  read(27) ibelm_top_inner_core
-  close(27)
+  !read(27) ibelm_xmin_inner_core
+  !read(27) ibelm_xmax_inner_core
+  !read(27) ibelm_ymin_inner_core
+  !read(27) ibelm_ymax_inner_core
+  !read(27) ibelm_bottom_inner_core
+  !read(27) ibelm_top_inner_core
+  !close(27)
 
 
   ! -- Boundary Mesh for crust and mantle ---
@@ -334,8 +820,13 @@
   call check_adios_err(myrank,adios_err)
 
   ! MPI interfaces
-  call adios_get_scalar(adios_handle, "num_interfaces", &
-      num_interfaces_crust_mantle, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "num_interfaces", 0, 1, &
+     num_interfaces_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "num_interfaces", &
+      !num_interfaces_crust_mantle, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
 
   allocate(my_neighbours_crust_mantle(num_interfaces_crust_mantle), &
           nibool_interfaces_crust_mantle(num_interfaces_crust_mantle), &
@@ -344,8 +835,14 @@
       'error allocating array my_neighbours_crust_mantle etc.')
 
   if( num_interfaces_crust_mantle > 0 ) then
-    call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
-      max_nibool_interfaces_cm, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    !call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
+      !max_nibool_interfaces_cm, adios_err)
+    call adios_schedule_read(adios_handle, sel, "max_nibool_interfaces", 0, 1, &
+       max_nibool_interfaces_cm, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
+
     allocate(ibool_interfaces_crust_mantle(max_nibool_interfaces_cm, &
         num_interfaces_crust_mantle), stat=ierr)
     if( ierr /= 0 ) call exit_mpi(myrank, &
@@ -383,12 +880,22 @@
   endif
 
   ! inner / outer elements
-  call adios_get_scalar(adios_handle, "nspec_inner", &
-      nspec_inner_crust_mantle, adios_err)
-  call adios_get_scalar(adios_handle, "nspec_outer", &
-      nspec_outer_crust_mantle, adios_err)
-  call adios_get_scalar(adios_handle, "num_phase_ispec", &
-      num_phase_ispec_crust_mantle, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec_inner", &
+    0, 1, nspec_inner_crust_mantle, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec_outer", &
+    0, 1, nspec_outer_crust_mantle, adios_err)
+  call adios_schedule_read(adios_handle, sel, "num_phase_ispec", &
+    0, 1, num_phase_ispec_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_inner", &
+      !nspec_inner_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_outer", &
+      !nspec_outer_crust_mantle, adios_err)
+  !call adios_get_scalar(adios_handle, "num_phase_ispec", &
+      !num_phase_ispec_crust_mantle, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
   if( num_phase_ispec_crust_mantle < 0 ) &
       call exit_mpi(myrank,'error num_phase_ispec_crust_mantle is < zero')
 
@@ -412,10 +919,17 @@
 
   ! mesh coloring for GPUs
   if( USE_MESH_COLORING_GPU ) then
-    call adios_get_scalar(adios_handle, "num_colors_outer", &
-        num_colors_outer_crust_mantle, adios_err)
-    call adios_get_scalar(adios_handle, "num_colors_inner", &
-        num_colors_inner_crust_mantle, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "num_colors_outer", &
+      0, 1, num_colors_outer_crust_mantle, adios_err)
+    call adios_schedule_read(adios_handle, sel, "num_colors_inner", &
+      0, 1, num_colors_inner_crust_mantle, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_outer", &
+        !num_colors_outer_crust_mantle, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_inner", &
+        !num_colors_inner_crust_mantle, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
     ! colors
 
     allocate(num_elem_colors_crust_mantle(num_colors_outer_crust_mantle +&
@@ -489,8 +1003,13 @@
   call check_adios_err(myrank,adios_err)
 
   ! MPI interfaces
-  call adios_get_scalar(adios_handle, "num_interfaces", &
-      num_interfaces_outer_core, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "num_interfaces", &
+    0, 1, num_interfaces_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "num_interfaces", &
+      !num_interfaces_outer_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
 
   allocate(my_neighbours_outer_core(num_interfaces_outer_core), &
           nibool_interfaces_outer_core(num_interfaces_outer_core), &
@@ -499,8 +1018,14 @@
       'error allocating array my_neighbours_outer_coreetc.')
 
   if( num_interfaces_outer_core> 0 ) then
-    call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
-      max_nibool_interfaces_oc, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "max_nibool_interfaces", &
+      0, 1, max_nibool_interfaces_oc, adios_err)
+    !call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
+      !max_nibool_interfaces_oc, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
+
     allocate(ibool_interfaces_outer_core(max_nibool_interfaces_oc, &
         num_interfaces_outer_core), stat=ierr)
     if( ierr /= 0 ) call exit_mpi(myrank, &
@@ -538,12 +1063,22 @@
   endif
 
   ! inner / outer elements
-  call adios_get_scalar(adios_handle, "nspec_inner", &
-      nspec_inner_outer_core, adios_err)
-  call adios_get_scalar(adios_handle, "nspec_outer", &
-      nspec_outer_outer_core, adios_err)
-  call adios_get_scalar(adios_handle, "num_phase_ispec", &
-      num_phase_ispec_outer_core, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec_inner", &
+  0, 1, nspec_inner_outer_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec_outer", &
+    0, 1, nspec_outer_outer_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "num_phase_ispec", &
+    0, 1, num_phase_ispec_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_inner", &
+      !nspec_inner_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_outer", &
+      !nspec_outer_outer_core, adios_err)
+  !call adios_get_scalar(adios_handle, "num_phase_ispec", &
+      !num_phase_ispec_outer_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
   if( num_phase_ispec_outer_core< 0 ) &
       call exit_mpi(myrank,'error num_phase_ispec_outer_core is < zero')
 
@@ -567,10 +1102,17 @@
 
   ! mesh coloring for GPUs
   if( USE_MESH_COLORING_GPU ) then
-    call adios_get_scalar(adios_handle, "num_colors_outer", &
-        num_colors_outer_outer_core, adios_err)
-    call adios_get_scalar(adios_handle, "num_colors_inner", &
-        num_colors_inner_outer_core, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "num_colors_outer", &
+      0, 1, num_colors_outer_outer_core, adios_err)
+    call adios_schedule_read(adios_handle, sel, "num_colors_inner", &
+      0, 1, num_colors_inner_outer_core, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_outer", &
+        !num_colors_outer_outer_core, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_inner", &
+        !num_colors_inner_outer_core, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
     ! colors
 
     allocate(num_elem_colors_outer_core(num_colors_outer_outer_core+&
@@ -646,8 +1188,13 @@
   call check_adios_err(myrank,adios_err)
 
   ! MPI interfaces
-  call adios_get_scalar(adios_handle, "num_interfaces", &
-      num_interfaces_inner_core, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "num_interfaces", &
+    0, 1, num_interfaces_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "num_interfaces", &
+      !num_interfaces_inner_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
 
   allocate(my_neighbours_inner_core(num_interfaces_inner_core), &
           nibool_interfaces_inner_core(num_interfaces_inner_core), &
@@ -656,8 +1203,14 @@
       'error allocating array my_neighbours_inner_core etc.')
 
   if( num_interfaces_inner_core > 0 ) then
-    call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
-      max_nibool_interfaces_ic, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "max_nibool_interfaces", &
+      0, 1, max_nibool_interfaces_ic, adios_err)
+    !call adios_get_scalar(adios_handle, "max_nibool_interfaces", &
+      !max_nibool_interfaces_ic, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
+
     allocate(ibool_interfaces_inner_core(max_nibool_interfaces_ic, &
         num_interfaces_inner_core), stat=ierr)
     if( ierr /= 0 ) call exit_mpi(myrank, &
@@ -695,12 +1248,22 @@
   endif
 
   ! inner / outer elements
-  call adios_get_scalar(adios_handle, "nspec_inner", &
-      nspec_inner_inner_core, adios_err)
-  call adios_get_scalar(adios_handle, "nspec_outer", &
-      nspec_outer_inner_core, adios_err)
-  call adios_get_scalar(adios_handle, "num_phase_ispec", &
-      num_phase_ispec_inner_core, adios_err)
+  call adios_selection_writeblock(sel, myrank)
+  call adios_schedule_read(adios_handle, sel, "nspec_inner", &
+    0, 1, nspec_inner_inner_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "nspec_outer", &
+    0, 1, nspec_outer_inner_core, adios_err)
+  call adios_schedule_read(adios_handle, sel, "num_phase_ispec", &
+    0, 1, num_phase_ispec_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_inner", &
+      !nspec_inner_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "nspec_outer", &
+      !nspec_outer_inner_core, adios_err)
+  !call adios_get_scalar(adios_handle, "num_phase_ispec", &
+      !num_phase_ispec_inner_core, adios_err)
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
+
   if( num_phase_ispec_inner_core < 0 ) &
       call exit_mpi(myrank,'error num_phase_ispec_inner_core is < zero')
 
@@ -724,10 +1287,17 @@
 
   ! mesh coloring for GPUs
   if( USE_MESH_COLORING_GPU ) then
-    call adios_get_scalar(adios_handle, "num_colors_outer", &
-        num_colors_outer_inner_core, adios_err)
-    call adios_get_scalar(adios_handle, "num_colors_inner", &
-        num_colors_inner_inner_core, adios_err)
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "num_colors_outer", &
+      0, 1, num_colors_outer_inner_core, adios_err)
+    call adios_schedule_read(adios_handle, sel, "num_colors_inner", &
+      0, 1, num_colors_inner_inner_core, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_outer", &
+        !num_colors_outer_inner_core, adios_err)
+    !call adios_get_scalar(adios_handle, "num_colors_inner", &
+        !num_colors_inner_inner_core, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
     ! colors
 
     allocate(num_elem_colors_inner_core(num_colors_outer_inner_core +&

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/specfem3D.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/specfem3D.F90	2013-05-09 19:20:35 UTC (rev 22011)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/specfem3D.F90	2013-05-09 20:00:00 UTC (rev 22012)
@@ -447,21 +447,26 @@
 
   ! starts reading the databases
   call read_mesh_databases()
-
+print*, "after read }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
   ! sets up reference element GLL points/weights/derivatives
   call setup_GLL_points()
+print*, "after GLL }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
 
   ! reads topography & bathymetry & ellipticity
   call read_topography_bathymetry()
+print*, "after tomo }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
 
   ! prepares sources and receivers
   call setup_sources_receivers()
+print*, "after source }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
 
   ! sets up and precomputes simulation arrays
   call prepare_timerun()
+print*, "after timerun }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
 
   ! steps through time iterations
   call iterate_time()
+print*, "after iterate }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
 
   ! saves last time frame and finishes kernel calculations
   call finalize_simulation()



More information about the CIG-COMMITS mailing list