[cig-commits] [commit] devel: renamed the existing read_mesh_for_init() to read_mesh_for_init_ADIOS(), and created a new one called read_mesh_for_init() for the non-ADIOS case (61ecf41)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Sun Sep 21 16:45:39 PDT 2014


Repository : https://github.com/geodynamics/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/9cddf018793bc5365a51420f1c3d270d25b0af22...61ecf413d57c15d89e475191e5c7994085f5a613

>---------------------------------------------------------------

commit 61ecf413d57c15d89e475191e5c7994085f5a613
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Mon Sep 22 01:30:47 2014 +0200

    renamed the existing read_mesh_for_init() to read_mesh_for_init_ADIOS(), and created a new one called read_mesh_for_init() for the non-ADIOS case


>---------------------------------------------------------------

61ecf413d57c15d89e475191e5c7994085f5a613
 src/shared/recompute_jacobian.f90           |  5 +++--
 src/specfem3D/initialize_simulation.f90     | 15 ++++-----------
 src/specfem3D/read_mesh_databases.F90       | 30 ++++++++++++++++++++++++++++-
 src/specfem3D/read_mesh_databases_adios.F90 |  4 ++--
 src/specfem3D/specfem3D_adios_stubs.f90     |  4 ++--
 5 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/src/shared/recompute_jacobian.f90 b/src/shared/recompute_jacobian.f90
index 56512bf..6b8abac 100644
--- a/src/shared/recompute_jacobian.f90
+++ b/src/shared/recompute_jacobian.f90
@@ -59,8 +59,8 @@
 ! recompute jacobian for any (xi,eta,gamma) point, not necessarily a GLL point
 
 ! check that the parameter file is correct
-  if(NGNOD /= 8 .and. NGNOD /= 27) &
-       stop 'elements should have 8 or 27 control nodes'
+  if(NGNOD /= 8 .and. NGNOD /= 27) stop 'elements should have 8 or 27 control nodes'
+
   if(NGNOD == 8) then
 
 ! ***
@@ -119,6 +119,7 @@
     ! note: put further setup for ngnod == 27 into subroutine
     !       to avoid compilation errors in case ngnod == 8
     call recompute_jacobian_27(NGNOD,NDIM,xi,eta,gamma,shape3D,dershape3D)
+
   endif
 
 ! compute coordinates and jacobian matrix
diff --git a/src/specfem3D/initialize_simulation.f90 b/src/specfem3D/initialize_simulation.f90
index a328e77..06bbe04 100644
--- a/src/specfem3D/initialize_simulation.f90
+++ b/src/specfem3D/initialize_simulation.f90
@@ -78,6 +78,7 @@
   ! open main output file, only written to by process 0
   if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) &
     open(unit=IMAIN,file=trim(OUTPUT_FILES_PATH)//'/output_solver.txt',status='unknown')
+
   ! user output
   if(myrank == 0) then
     write(IMAIN,*)
@@ -147,19 +148,11 @@
 ! for coupling with DSM
   if (COUPLE_WITH_DSM) call create_name_database(dsmname,myrank,TRACTION_PATH)
 
+! read the value of NSPEC_AB and NGLOB_AB because we need it to define some array sizes below
   if (ADIOS_FOR_MESH) then
-    call read_mesh_for_init(NSPEC_AB, NGLOB_AB)
+    call read_mesh_for_init_ADIOS(NSPEC_AB, NGLOB_AB)
   else
-    open(unit=IIN,file=prname(1:len_trim(prname))//'external_mesh.bin',status='old',&
-         action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      print*,'error: could not open database '
-      print*,'path: ',prname(1:len_trim(prname))//'external_mesh.bin'
-      call exit_mpi(myrank,'error opening database')
-    endif
-    read(IIN) NSPEC_AB
-    read(IIN) NGLOB_AB
-    close(IIN)
+    call read_mesh_for_init()
   endif
 
   ! attenuation arrays size
diff --git a/src/specfem3D/read_mesh_databases.F90 b/src/specfem3D/read_mesh_databases.F90
index 328d86d..41f30ff 100644
--- a/src/specfem3D/read_mesh_databases.F90
+++ b/src/specfem3D/read_mesh_databases.F90
@@ -729,12 +729,13 @@
 
   subroutine read_mesh_databases_adjoint()
 
-! reads in moho meshes
+! reads in Moho meshes
 
   use specfem_par
   use specfem_par_elastic
   use specfem_par_acoustic
   use specfem_par_poroelastic
+
   implicit none
 
   integer :: ier
@@ -1120,3 +1121,30 @@
 
   end subroutine read_mesh_databases_adjoint
 
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine read_mesh_for_init()
+
+! reads in the value of NSPEC_AB and NGLOB_AB
+
+  use specfem_par
+
+  implicit none
+
+  integer :: ier
+
+  open(unit=IIN,file=prname(1:len_trim(prname))//'external_mesh.bin',status='old',&
+       action='read',form='unformatted',iostat=ier)
+  if( ier /= 0 ) then
+    print*,'error: could not open database '
+    print*,'path: ',prname(1:len_trim(prname))//'external_mesh.bin'
+    call exit_mpi(myrank,'error opening database')
+  endif
+  read(IIN) NSPEC_AB
+  read(IIN) NGLOB_AB
+  close(IIN)
+
+  end subroutine read_mesh_for_init
+
diff --git a/src/specfem3D/read_mesh_databases_adios.F90 b/src/specfem3D/read_mesh_databases_adios.F90
index 61caa34..5fad120 100644
--- a/src/specfem3D/read_mesh_databases_adios.F90
+++ b/src/specfem3D/read_mesh_databases_adios.F90
@@ -28,7 +28,7 @@
 ! United States and French Government Sponsorship Acknowledged.
 
 !==============================================================================
-subroutine read_mesh_for_init(nspec, nglob)
+subroutine read_mesh_for_init_ADIOS(nspec, nglob)
 
   use adios_read_mod
   use specfem_par, only : myrank, LOCAL_PATH, MAX_STRING_LEN
@@ -69,7 +69,7 @@ subroutine read_mesh_for_init(nspec, nglob)
   call adios_read_close(handle,ier)
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, ier)
 
-end subroutine read_mesh_for_init
+end subroutine read_mesh_for_init_ADIOS
 
 !==============================================================================
 subroutine read_mesh_databases_adios()
diff --git a/src/specfem3D/specfem3D_adios_stubs.f90 b/src/specfem3D/specfem3D_adios_stubs.f90
index 2c400e1..d738ec5 100644
--- a/src/specfem3D/specfem3D_adios_stubs.f90
+++ b/src/specfem3D/specfem3D_adios_stubs.f90
@@ -38,7 +38,7 @@
 ! Subroutines from read_mesh_databases_adios.F90 |
 !------------------------------------------------'
 
-subroutine read_mesh_for_init(nspec, nglob)
+subroutine read_mesh_for_init_ADIOS(nspec, nglob)
   use unused_mod
   use adios_manager_mod
 
@@ -49,7 +49,7 @@ subroutine read_mesh_for_init(nspec, nglob)
   unused_i4 = nglob
 
   call no_adios_err()
-end subroutine read_mesh_for_init
+end subroutine read_mesh_for_init_ADIOS
 
 subroutine read_mesh_databases_adios()
   use adios_manager_mod



More information about the CIG-COMMITS mailing list