[cig-commits] r22055 - in seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src: meshfem3D specfem3D

lefebvre at geodynamics.org lefebvre at geodynamics.org
Mon May 13 06:34:36 PDT 2013


Author: lefebvre
Date: 2013-05-13 06:34:36 -0700 (Mon, 13 May 2013)
New Revision: 22055

Added:
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb_adios.f90
Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/Makefile.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_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:
stacey mesh files saved (meshfem3d) and read (specfem3d) with ADIOS
	modified:   ../../src/meshfem3D/Makefile.in
	modified:   ../../src/meshfem3D/create_regions_mesh.f90
	modified:   ../../src/meshfem3D/get_absorb.f90
	new file:   ../../src/meshfem3D/get_absorb_adios.f90
	modified:   ../../src/meshfem3D/save_arrays_solver_adios.F90
	modified:   ../../src/specfem3D/read_mesh_databases.f90
	modified:   ../../src/specfem3D/read_mesh_databases_adios.f90
	modified:   ../../src/specfem3D/specfem3D.F90

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/Makefile.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/Makefile.in	2013-05-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/Makefile.in	2013-05-13 13:34:36 UTC (rev 22055)
@@ -197,6 +197,7 @@
 #
 # using ADIOS files
 ADIOS_OBJECTS= \
+	$O/get_absorb_adios.adios.o  \
 	$O/adios_manager.shared_adios.o  \
 	$O/adios_helpers.shared_adios.o  \
 	$O/save_arrays_solver_adios.adios.o

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-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/create_regions_mesh.f90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -170,8 +170,9 @@
 
     ! sets up Stacey absorbing boundary indices
     if(NCHUNKS /= 6) then
-      call get_absorb(myrank,prname,iboun,nspec,nimin,nimax,njmin,njmax,nkmin_xi,nkmin_eta, &
-                         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM)
+      call get_absorb(myrank,prname,iregion_code, iboun,nspec,nimin,nimax,&
+          njmin,njmax, nkmin_xi,nkmin_eta, NSPEC2DMAX_XMIN_XMAX, &
+          NSPEC2DMAX_YMIN_YMAX, NSPEC2D_BOTTOM)
     endif
 
   ! only create mass matrix and save all the final arrays in the second pass
@@ -368,7 +369,11 @@
         call flush_IMAIN()
       endif
       ! saves boundary file
-      call save_arrays_solver_boundary()
+      if (ADIOS_FOR_ARRAYS_SOLVER) then
+        call save_arrays_solver_boundary_adios()
+      else
+        call save_arrays_solver_boundary()
+      endif
 
     endif
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb.f90	2013-05-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb.f90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -25,17 +25,18 @@
 !
 !=====================================================================
 
-  subroutine get_absorb(myrank,prname,iboun,nspec, &
+  subroutine get_absorb(myrank,prname,iregion, iboun,nspec, &
                         nimin,nimax,njmin,njmax,nkmin_xi,nkmin_eta, &
                         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM)
 
 ! Stacey, define flags for absorbing boundaries
+  use meshfem3D_par, only: ADIOS_FOR_ARRAYS_SOLVER
 
   implicit none
 
   include "constants.h"
 
-  integer :: nspec,myrank
+  integer :: nspec,myrank, iregion
 
   integer :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM
 
@@ -133,19 +134,24 @@
   if(ispecb5 /= NSPEC2D_BOTTOM) &
     call exit_MPI(myrank,'ispecb5 should equal NSPEC2D_BOTTOM in absorbing boundary detection')
 
-  ! save these temporary arrays for the solver for Stacey conditions
-  open(unit=27,file=prname(1:len_trim(prname))//'stacey.bin', &
-        status='unknown',form='unformatted',action='write',iostat=ier)
-  if( ier /= 0 ) call exit_MPI(myrank,'error opening stacey.bin file')
+  if (ADIOS_FOR_ARRAYS_SOLVER) then
+    call get_absorb_adios(myrank, iregion, nimin, nimax, njmin, njmax, &
+        nkmin_xi, nkmin_eta, NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX)
+  else  
+    ! save these temporary arrays for the solver for Stacey conditions
+    open(unit=27,file=prname(1:len_trim(prname))//'stacey.bin', &
+          status='unknown',form='unformatted',action='write',iostat=ier)
+    if( ier /= 0 ) call exit_MPI(myrank,'error opening stacey.bin file')
 
-  write(27) nimin
-  write(27) nimax
-  write(27) njmin
-  write(27) njmax
-  write(27) nkmin_xi
-  write(27) nkmin_eta
+    write(27) nimin
+    write(27) nimax
+    write(27) njmin
+    write(27) njmax
+    write(27) nkmin_xi
+    write(27) nkmin_eta
 
-  close(27)
+    close(27)
+  endif
 
   end subroutine get_absorb
 

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb_adios.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/get_absorb_adios.f90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -0,0 +1,126 @@
+!=====================================================================
+!
+!          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 get_absorb_adios(myrank, iregion, nimin, nimax, njmin, njmax, &
+  nkmin_xi, nkmin_eta, NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX)
+
+  use mpi
+  use adios_write_mod
+  use meshfem3D_par, only: LOCAL_PATH
+
+  ! Stacey, define flags for absorbing boundaries
+  implicit none
+
+  include "constants.h"
+
+  integer :: myrank
+  integer :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX
+
+  integer,dimension(2,NSPEC2DMAX_YMIN_YMAX) :: nimin,nimax
+  integer,dimension(2,NSPEC2DMAX_XMIN_XMAX) :: njmin,njmax
+  integer,dimension(2,NSPEC2DMAX_XMIN_XMAX) :: nkmin_xi
+  integer,dimension(2,NSPEC2DMAX_YMIN_YMAX) :: nkmin_eta
+
+  character(len=150) :: reg_name, outputname, group_name
+  integer :: sizeprocs, comm, local_dim, ierr, iregion
+  integer(kind=8) :: group_size_inc
+  ! ADIOS variables
+  integer                 :: adios_err
+  integer(kind=8)         :: adios_group, adios_handle, varid
+  integer(kind=8)         :: adios_groupsize, adios_totalsize
+
+  call create_name_database_adios(reg_name,iregion,LOCAL_PATH)
+
+  outputname = trim(reg_name) // "stacey.bp" 
+
+  ! save these temporary arrays for the solver for Stacey conditions
+  write(group_name,"('SPECFEM3D_GLOBE_STACEY_reg',i1)") iregion
+  call world_size(sizeprocs) ! TODO keep it in parameters
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+  group_size_inc = 0
+  call adios_declare_group(adios_group, group_name, &
+      "", 0, adios_err)
+  call adios_select_method(adios_group, "MPI", "", "", adios_err)
+
+  local_dim = 2*NSPEC2DMAX_XMIN_XMAX 
+  call define_adios_global_integer_1d_array(adios_group, "njmin", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "njmax", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "nkmin_xi", &
+      local_dim, group_size_inc)
+  local_dim = 2*NSPEC2DMAX_YMIN_YMAX
+  call define_adios_global_integer_1d_array(adios_group, "nimin", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "nimax", &
+      local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "nkmin_eta", &
+      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)
+
+  local_dim = 2*NSPEC2DMAX_XMIN_XMAX 
+  call adios_set_path (adios_handle, "njmin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", njmin, adios_err)
+
+  call adios_set_path (adios_handle, "njmax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", njmax, adios_err)
+
+  call adios_set_path (adios_handle, "nkmin_xi", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", nkmin_xi, adios_err)
+
+  local_dim = 2*NSPEC2DMAX_YMIN_YMAX 
+  call adios_set_path (adios_handle, "nimin", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", nimin, adios_err)
+
+  call adios_set_path (adios_handle, "nimax", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", nimax, adios_err)
+
+  call adios_set_path (adios_handle, "nkmin_eta", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", nkmin_eta, adios_err)
+
+  call adios_set_path (adios_handle, "", adios_err)
+  call adios_close(adios_handle, adios_err)
+
+end subroutine get_absorb_adios
+

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-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/meshfem3D/save_arrays_solver_adios.F90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -923,12 +923,28 @@
   endif
 
   if(HETEROGEN_3D_MANTLE .and. iregion_code == IREGION_CRUST_MANTLE) then
-    open(unit=27,file=prname(1:len_trim(prname))//'dvp.bin', &
-          status='unknown',form='unformatted',action='write',iostat=ier)
-    if( ier /= 0 ) call exit_mpi(myrank,'error opening dvp.bin file')
+    outputname = trim(reg_name) // "dvp.bp" 
+    write(group_name,"('SPECFEM3D_GLOBE_DVP_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) dvpstore
-    close(27)
+    local_dim = size (dvpstore) 
+    call define_adios_global_real_1d_array(adios_group, "dvp", &
+        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_set_path (adios_handle, "dvp", adios_err)
+    call write_1D_global_array_adios_dims(adios_handle, myrank, &
+        local_dim, sizeprocs)
+    call adios_write(adios_handle, "array", dvpstore, adios_err)
+
+    call adios_set_path (adios_handle, "", adios_err)
+    call adios_close(adios_handle, adios_err)
   endif
 
 
@@ -1420,12 +1436,14 @@
 subroutine save_arrays_solver_boundary_adios()
 
 ! saves arrays for boundaries such as MOHO, 400 and 670 discontinuities
-
+  use mpi
+  
   use meshfem3d_par,only: &
-    myrank
+    myrank, LOCAL_PATH
 
   use meshfem3D_models_par,only: &
-    SAVE_BOUNDARY_MESH,HONOR_1D_SPHERICAL_MOHO,SUPPRESS_CRUSTAL_MESH
+    HONOR_1D_SPHERICAL_MOHO
+    !SAVE_BOUNDARY_MESH,HONOR_1D_SPHERICAL_MOHO,SUPPRESS_CRUSTAL_MESH
 
   use create_regions_mesh_par2, only: &
     NSPEC2D_MOHO, NSPEC2D_400, NSPEC2D_670, &
@@ -1436,9 +1454,17 @@
     prname
 
   implicit none
+  include "constants.h"
 
   ! local parameters
-  integer :: ier
+  ! local parameters
+  character(len=150) :: outputname, group_name
+  integer :: ierr, sizeprocs, comm, local_dim
+  integer(kind=8) :: group_size_inc
+  ! ADIOS variables
+  integer                 :: adios_err
+  integer(kind=8)         :: adios_group, adios_handle, varid
+  integer(kind=8)         :: adios_groupsize, adios_totalsize
 
   ! first check the number of surface elements are the same for Moho, 400, 670
   if (.not. SUPPRESS_CRUSTAL_MESH .and. HONOR_1D_SPHERICAL_MOHO) then
@@ -1450,28 +1476,107 @@
   if (ispec2D_670_top /= NSPEC2D_670 .or. ispec2D_670_bot /= NSPEC2D_670) &
            call exit_mpi(myrank,'Not the same number of 670 surface elements')
 
-  ! writing surface topology databases
-  open(unit=27,file=prname(1:len_trim(prname))//'boundary_disc.bin', &
-       status='unknown',form='unformatted',iostat=ier)
-  if( ier /= 0 ) call exit_mpi(myrank,'error opening boundary_disc.bin file')
+  outputname = trim(LOCAL_PATH) // "/boundary_disc.bp" 
+  group_name = "SPECFEM3D_GLOBE_BOUNDARY_DISC"
+  call world_size(sizeprocs) ! TODO keep it in parameters
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+  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) NSPEC2D_MOHO, NSPEC2D_400, NSPEC2D_670
+  call define_adios_integer_scalar (adios_group, "NSPEC2D_MOHO", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "NSPEC2D_400", "", &
+      group_size_inc)
+  call define_adios_integer_scalar (adios_group, "NSPEC2D_670", "", &
+      group_size_inc)
 
-  write(27) ibelm_moho_top
-  write(27) ibelm_moho_bot
+  local_dim = NSPEC2D_MOHO
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_moho_top", &
+        local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_moho_bot", &
+        local_dim, group_size_inc)
+  local_dim = NSPEC2D_400
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_400_top", &
+        local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_400_bot", &
+        local_dim, group_size_inc)
+  local_dim = NSPEC2D_670 
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_670_top", &
+        local_dim, group_size_inc)
+  call define_adios_global_integer_1d_array(adios_group, "ibelm_670_bot", &
+        local_dim, group_size_inc)
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_MOHO
+  call define_adios_global_real_1d_array(adios_group, "normal_moho", &
+        local_dim, group_size_inc)
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_400
+  call define_adios_global_real_1d_array(adios_group, "normal_400", &
+        local_dim, group_size_inc)
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_670
+  call define_adios_global_real_1d_array(adios_group, "normal_670", &
+        local_dim, group_size_inc)
 
-  write(27) ibelm_400_top
-  write(27) ibelm_400_bot
+  ! 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)
 
-  write(27) ibelm_670_top
-  write(27) ibelm_670_bot
+  call adios_write(adios_handle, "NSPEC2D_MOHO", NSPEC2D_MOHO, adios_err)
+  call adios_write(adios_handle, "NSPEC2D_400", NSPEC2D_400, adios_err)
+  call adios_write(adios_handle, "NSPEC2D_670", NSPEC2D_670, adios_err)
 
-  write(27) normal_moho
-  write(27) normal_400
-  write(27) normal_670
+  local_dim = NSPEC2D_MOHO
+  call adios_set_path (adios_handle, "ibelm_moho_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_moho_top, adios_err)
+  call adios_set_path (adios_handle, "ibelm_moho_bot", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_moho_bot, adios_err)
 
-  close(27)
+  local_dim = NSPEC2D_400 
+  call adios_set_path (adios_handle, "ibelm_400_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_400_top, adios_err)
+  call adios_set_path (adios_handle, "ibelm_400_bot", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_400_bot, adios_err)
 
+  local_dim = NSPEC2D_670
+  call adios_set_path (adios_handle, "ibelm_670_top", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_670_top, adios_err)
+  call adios_set_path (adios_handle, "ibelm_670_bot", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", ibelm_670_bot, adios_err)
+
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_MOHO
+  call adios_set_path (adios_handle, "normal_moho", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_moho, adios_err)
+
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_400
+  call adios_set_path (adios_handle, "normal_400", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_400, adios_err)
+
+  local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_670
+  call adios_set_path (adios_handle, "normal_670", adios_err)
+  call write_1D_global_array_adios_dims(adios_handle, myrank, &
+      local_dim, sizeprocs)
+  call adios_write(adios_handle, "array", normal_670, adios_err)
+
+  call adios_set_path (adios_handle, "", adios_err)
+  call adios_close(adios_handle, adios_err)
 end subroutine save_arrays_solver_boundary_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-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases.f90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -69,7 +69,11 @@
   ! absorbing boundaries
   if(ABSORBING_CONDITIONS) then
     ! reads "stacey.bin" files
-    call read_mesh_databases_stacey()
+    if (ADIOS_FOR_ARRAYS_SOLVER) then
+      call read_mesh_databases_stacey_adios()
+    else
+      call read_mesh_databases_stacey()
+    endif
   endif
 
   ! user output

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-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/read_mesh_databases_adios.f90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -533,143 +533,104 @@
   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)
+  ! -- Boundary Mesh for crust and mantle ---
+  if (SAVE_BOUNDARY_MESH .and. SIMULATION_TYPE == 3) then
+    file_name = LOCAL_PATH // "boundary_disc.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)
 
-  ! 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')
+    call adios_selection_writeblock(sel, myrank)
+    call adios_schedule_read(adios_handle, sel, "NSPEC2D_MOHO", 0, 1, &
+       njunk1, adios_err)
+    call adios_schedule_read(adios_handle, sel, "NSPEC2D_400", 0, 1, &
+       njunk2, adios_err)
+    call adios_schedule_read(adios_handle, sel, "NSPEC2D_670", 0, 1, &
+       njunk3, adios_err)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
+    if (njunk1 /= NSPEC2D_MOHO .and. njunk2 /= NSPEC2D_400 .and. &
+        njunk3 /= NSPEC2D_670) &
+        call exit_mpi(myrank, 'Error reading boundary_disc.bp 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
+    local_dim = NSPEC2D_MOHO
+    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_moho_top/array", 0, 1, &
+      ibelm_moho_bot, adios_err)
+    call check_adios_err(myrank,adios_err)
+    call adios_schedule_read(adios_handle, sel, "ibelm_moho_bot/array", 0, 1, &
+      ibelm_moho_top, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-! 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
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  !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
+    local_dim = NSPEC2D_400
+    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_400_top/array", 0, 1, &
+      ibelm_400_bot, adios_err)
+    call check_adios_err(myrank,adios_err)
+    call adios_schedule_read(adios_handle, sel, "ibelm_400_bot/array", 0, 1, &
+      ibelm_400_top, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  !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)
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
 
+    local_dim = NSPEC2D_670
+    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_670_top/array", 0, 1, &
+      ibelm_670_bot, adios_err)
+    call check_adios_err(myrank,adios_err)
+    call adios_schedule_read(adios_handle, sel, "ibelm_670_bot/array", 0, 1, &
+      ibelm_670_top, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  ! read parameters to couple fluid and solid regions
-  !
-  ! outer core
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  ! create name of database
-  !call create_name_database(prname,myrank,IREGION_OUTER_CORE,LOCAL_PATH)
+    local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_MOHO
+    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_moho/array", 0, 1, &
+      normal_moho, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  ! boundary parameters
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  ! 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')
+    local_dim = NDIM*NGLLX*NGLLY*NSPEC2D_400
+    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_400/array", 0, 1, &
+      normal_400, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  !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
+    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 = NDIM*NGLLX*NGLLY*NSPEC2D_670
+    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_670/array", 0, 1, &
+      normal_670, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  !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
+    call adios_perform_reads(adios_handle, adios_err)
+    call check_adios_err(myrank,adios_err)
 
-  !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
+    ! 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(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)
-
-
-  !
-  ! inner core
-  !
-
-  ! create name of database
-  !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(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)
-
-
-  ! -- Boundary Mesh for crust and mantle ---
-  if (SAVE_BOUNDARY_MESH .and. SIMULATION_TYPE == 3) then
-
-    call create_name_database(prname,myrank,IREGION_CRUST_MANTLE,LOCAL_PATH)
-
-    open(unit=27,file=prname(1:len_trim(prname))//'boundary_disc.bin', &
-          status='old',form='unformatted',action='read',iostat=ierr)
-    if( ierr /= 0 ) call exit_mpi(myrank,'error opening boundary_disc.bin file')
-
-    read(27) njunk1,njunk2,njunk3
-    if (njunk1 /= NSPEC2D_MOHO .and. njunk2 /= NSPEC2D_400 .and. njunk3 /= NSPEC2D_670) &
-               call exit_mpi(myrank, 'Error reading ibelm_disc.bin file')
-    read(27) ibelm_moho_top
-    read(27) ibelm_moho_bot
-    read(27) ibelm_400_top
-    read(27) ibelm_400_bot
-    read(27) ibelm_670_top
-    read(27) ibelm_670_bot
-    read(27) normal_moho
-    read(27) normal_400
-    read(27) normal_670
-    close(27)
-
     k_top = 1
     k_bot = NGLLZ
 
@@ -1341,8 +1302,11 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine read_mesh_databases_stacey_adios()
+subroutine read_mesh_databases_stacey_adios()
 
+  use mpi
+  use adios_read_mod
+
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_innercore
@@ -1351,43 +1315,131 @@
   implicit none
 
   ! local parameters
-  integer :: ierr
+  integer :: ierr, comm, lnspec, lnglob, local_dim
+  ! processor identification
+  character(len=150) :: reg_name, file_name
+  ! 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
 
   ! crust and mantle
 
   ! create name of database
-  call create_name_database(prname,myrank,IREGION_CRUST_MANTLE,LOCAL_PATH)
+  call create_name_database_adios(reg_name, IREGION_CRUST_MANTLE, LOCAL_PATH)
 
+  file_name= trim(reg_name) // "stacey.bp" 
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+
+  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)
   ! read arrays for Stacey conditions
-  open(unit=27,file=prname(1:len_trim(prname))//'stacey.bin', &
-        status='old',form='unformatted',action='read',iostat=ierr)
-  if( ierr /= 0 ) call exit_MPI(myrank,'error opening stacey.bin file for crust mantle')
 
-  read(27) nimin_crust_mantle
-  read(27) nimax_crust_mantle
-  read(27) njmin_crust_mantle
-  read(27) njmax_crust_mantle
-  read(27) nkmin_xi_crust_mantle
-  read(27) nkmin_eta_crust_mantle
-  close(27)
+  local_dim = 2*NSPEC2DMAX_XMIN_XMAX_CM 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "njmin/array", 0, 1, &
+      njmin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "njmax/array", 0, 1, &
+      njmax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nkmin_xi/array", 0, 1, &
+      nkmin_xi_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 = 2*NSPEC2DMAX_YMIN_YMAX_CM 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nimin/array", 0, 1, &
+      nimin_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nimax/array", 0, 1, &
+      nimax_crust_mantle, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nkmin_eta/array", 0, 1, &
+      nkmin_eta_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)
+
+  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)
+
   ! outer core
 
   ! create name of database
-  call create_name_database(prname,myrank,IREGION_OUTER_CORE,LOCAL_PATH)
+  call create_name_database_adios(reg_name, IREGION_OUTER_CORE, LOCAL_PATH)
 
+  file_name= trim(reg_name) // "stacey.bp" 
+  call MPI_Comm_dup (MPI_COMM_WORLD, comm, ierr)
+
+  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)
   ! read arrays for Stacey conditions
-  open(unit=27,file=prname(1:len_trim(prname))//'stacey.bin', &
-        status='old',form='unformatted',action='read',iostat=ierr)
-  if( ierr /= 0 ) call exit_MPI(myrank,'error opening stacey.bin file for outer core')
 
-  read(27) nimin_outer_core
-  read(27) nimax_outer_core
-  read(27) njmin_outer_core
-  read(27) njmax_outer_core
-  read(27) nkmin_xi_outer_core
-  read(27) nkmin_eta_outer_core
-  close(27)
+  local_dim = 2*NSPEC2DMAX_XMIN_XMAX_OC 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "njmin/array", 0, 1, &
+      njmin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "njmax/array", 0, 1, &
+      njmax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nkmin_xi/array", 0, 1, &
+      nkmin_xi_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
 
-  end subroutine read_mesh_databases_stacey_adios
+  call adios_perform_reads(adios_handle, adios_err)
+  call check_adios_err(myrank,adios_err)
 
+  local_dim = 2*NSPEC2DMAX_YMIN_YMAX_OC 
+  start(1) = local_dim*myrank; count(1) = local_dim
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nimin/array", 0, 1, &
+      nimin_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nimax/array", 0, 1, &
+      nimax_outer_core, adios_err)
+  call check_adios_err(myrank,adios_err)
+  call adios_selection_boundingbox (sel , 1, start, count)
+  call adios_schedule_read(adios_handle, sel, "nkmin_eta/array", 0, 1, &
+      nkmin_eta_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)
+
+  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_mesh_databases_stacey_adios
+

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-13 11:11:19 UTC (rev 22054)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SUNFLOWER_ADIOS/src/specfem3D/specfem3D.F90	2013-05-13 13:34:36 UTC (rev 22055)
@@ -447,26 +447,20 @@
 
   ! 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