[cig-commits] [commit] devel: renames output from xmeshfem3D to output_meshfem3D.txt (to avoid overwriting by xgenerate_databases); updates error messages (31e57e0)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue Sep 16 08:46:27 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/b8df327ddc585a0c855aa689967cdc9846ff7dd3...27c70c5c56f96bc7798b66bffb0b95d4c9783d30

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

commit 31e57e0512e998df53cf045548ff0fb1ab421915
Author: daniel peter <peterda at ethz.ch>
Date:   Tue Sep 16 16:16:21 2014 +0200

    renames output from xmeshfem3D to output_meshfem3D.txt (to avoid overwriting by xgenerate_databases); updates error messages


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

31e57e0512e998df53cf045548ff0fb1ab421915
 EXAMPLES/meshfem3D_examples/many_interfaces/README |   3 -
 .../many_interfaces/go_process_pbs.bash            |   1 -
 EXAMPLES/meshfem3D_examples/simple_model/README    |   3 -
 EXAMPLES/meshfem3D_examples/socal1D/README         |   3 -
 src/generate_databases/read_partition_files.f90    |  76 +++++------
 src/meshfem3D/create_regions_mesh.f90              |  18 +--
 src/meshfem3D/define_subregions.f90                |  97 +++++++-------
 src/meshfem3D/meshfem3D.f90                        | 142 +++++++++++----------
 src/meshfem3D/read_mesh_parameter_file.f90         |  12 +-
 9 files changed, 173 insertions(+), 182 deletions(-)

diff --git a/EXAMPLES/meshfem3D_examples/many_interfaces/README b/EXAMPLES/meshfem3D_examples/many_interfaces/README
index b9989b8..0175b59 100644
--- a/EXAMPLES/meshfem3D_examples/many_interfaces/README
+++ b/EXAMPLES/meshfem3D_examples/many_interfaces/README
@@ -33,9 +33,6 @@ WARNING: We do not recommend running this as a test example, due to its requirem
 
    - this should generate "proc000***_Database" files in OUTPUT_FILES/DATABASES_MPI/.
 
-   - save output file
-   > cp OUTPUT_FILES/output_mesher.txt OUTPUT_FILES/output_meshfem3D.txt
-
 3. generate databases:
 
    - compile and run generate_databases in directory SPECFEM3D/:
diff --git a/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash b/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash
index 583c3ef..46019aa 100755
--- a/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash
+++ b/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash
@@ -61,7 +61,6 @@ echo
 echo "  meshing..."
 echo
 mpiexec -np $numnodes ./bin/xmeshfem3D
-mv OUTPUT_FILES/output_mesher.txt OUTPUT_FILES/output_meshfem3D.txt
 
 # stores setup
 cp DATA/Par_file OUTPUT_FILES/
diff --git a/EXAMPLES/meshfem3D_examples/simple_model/README b/EXAMPLES/meshfem3D_examples/simple_model/README
index 6d42fbf..6dec4e9 100644
--- a/EXAMPLES/meshfem3D_examples/simple_model/README
+++ b/EXAMPLES/meshfem3D_examples/simple_model/README
@@ -42,9 +42,6 @@ Option 2: follow instructions below for submitting separate jobs with qsub (or b
    proc000003_.dx
    proc000003_.INP
 
-   - save output file
-   > cp OUTPUT_FILES/output_mesher.txt OUTPUT_FILES/output_meshfem3D.txt
-
 3. generate databases:
 
    - compile and run generate_databases in directory SPECFEM3D/:
diff --git a/EXAMPLES/meshfem3D_examples/socal1D/README b/EXAMPLES/meshfem3D_examples/socal1D/README
index 874a451..18861bd 100644
--- a/EXAMPLES/meshfem3D_examples/socal1D/README
+++ b/EXAMPLES/meshfem3D_examples/socal1D/README
@@ -42,9 +42,6 @@ Option 2: follow instructions below for submitting separate jobs with qsub (or b
     proc000000_.dx
     proc000000_.INP
 
-   - save output file:
-    > cp OUTPUT_FILES/output_mesher.txt OUTPUT_FILES/output_meshfem3D.txt
-
 3. generate databases:
 
    - compile and run generate_databases in directory SPECFEM3D/:
diff --git a/src/generate_databases/read_partition_files.f90 b/src/generate_databases/read_partition_files.f90
index 1a6cda4..2d1b0ef 100644
--- a/src/generate_databases/read_partition_files.f90
+++ b/src/generate_databases/read_partition_files.f90
@@ -46,14 +46,14 @@
   open(unit=IIN,file=prname(1:len_trim(prname))//'Database', &
         status='old',action='read',form='unformatted',iostat=ier)
   if( ier /= 0 ) then
-    print*,'rank ',myrank,' error opening file: ',prname(1:len_trim(prname))//'Database'
+    print*,'rank ',myrank,'- Error opening file: ',prname(1:len_trim(prname))//'Database'
     print*,'please make sure file exists'
-    call exit_mpi(myrank,'error opening database file')
+    call exit_mpi(myrank,'Error opening database file')
   endif
   read(IIN) nnodes_ext_mesh
 
   allocate(nodes_coords_ext_mesh(NDIM,nnodes_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array nodes_coords_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array nodes_coords_ext_mesh'
 
   do inode = 1, nnodes_ext_mesh
      read(IIN) dummy_node, nodes_coords_ext_mesh(1,inode), nodes_coords_ext_mesh(2,inode), &
@@ -62,7 +62,7 @@
 
   call sum_all_i(nnodes_ext_mesh,num)
   if(myrank == 0) then
-    write(IMAIN,*) '  external mesh points: ',num
+    write(IMAIN,*) 'external mesh points : ',num
   endif
   call synchronize_all()
 
@@ -71,7 +71,7 @@
   read(IIN) nmat_ext_mesh, nundefMat_ext_mesh
 
   allocate(materials_ext_mesh(16,nmat_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array materials_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array materials_ext_mesh'
   do imat = 1, nmat_ext_mesh
      ! (visco)elastic or acoustic format:
      ! #(1) rho   #(2) vp  #(3) vs  #(4) Q_mu  #(5) anisotropy_flag  #(6) material_domain_id  #(7) Q_kappa
@@ -88,12 +88,12 @@
   enddo
 
   if(myrank == 0) then
-    write(IMAIN,*) '  defined materials: ',nmat_ext_mesh
+    write(IMAIN,*) 'defined materials    : ',nmat_ext_mesh
   endif
   call synchronize_all()
 
   allocate(undef_mat_prop(6,nundefMat_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array undef_mat_prop'
+  if( ier /= 0 ) stop 'Error allocating array undef_mat_prop'
   do imat = 1, nundefMat_ext_mesh
      ! format example tomography:
      ! e.g.: -1 tomography elastic tomography_model.xyz 0 2
@@ -104,16 +104,16 @@
   enddo
 
   if(myrank == 0) then
-    write(IMAIN,*) '  undefined materials: ',nundefMat_ext_mesh
+    write(IMAIN,*) 'undefined materials  : ',nundefMat_ext_mesh
   endif
   call synchronize_all()
 
 ! element indexing
   read(IIN) nelmnts_ext_mesh
   allocate(elmnts_ext_mesh(NGNOD,nelmnts_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array elmnts_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array elmnts_ext_mesh'
   allocate(mat_ext_mesh(2,nelmnts_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array mat_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array mat_ext_mesh'
 
   ! reads in material association for each spectral element and corner node indices
   do ispec = 1, nelmnts_ext_mesh
@@ -124,14 +124,14 @@
      read(IIN) dummy_elmnt,mat_ext_mesh(1,ispec),mat_ext_mesh(2,ispec),(elmnts_ext_mesh(j,ispec),j=1,NGNOD)
 
      ! check debug
-     if( dummy_elmnt /= ispec) stop "error ispec order in materials file"
+     if( dummy_elmnt /= ispec) stop 'Error ispec order in materials file'
 
   enddo
   NSPEC_AB = nelmnts_ext_mesh
 
   call sum_all_i(nspec_ab,num)
   if(myrank == 0) then
-    write(IMAIN,*) ' total number of spectral elements: ',num
+    write(IMAIN,*) 'total number of spectral elements: ',num
   endif
   call synchronize_all()
 
@@ -158,37 +158,37 @@
   NSPEC2D_TOP = nspec2D_top_ext
 
   allocate(ibelm_xmin(nspec2D_xmin),nodes_ibelm_xmin(NGNOD2D,nspec2D_xmin),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_xmin etc.'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_xmin etc.'
   do ispec2D = 1,nspec2D_xmin
      read(IIN) ibelm_xmin(ispec2D),(nodes_ibelm_xmin(j,ispec2D),j=1,NGNOD2D)
   enddo
 
   allocate(ibelm_xmax(nspec2D_xmax),nodes_ibelm_xmax(NGNOD2D,nspec2D_xmax),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_xmax etc.'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_xmax etc.'
   do ispec2D = 1,nspec2D_xmax
      read(IIN) ibelm_xmax(ispec2D),(nodes_ibelm_xmax(j,ispec2D),j=1,NGNOD2D)
   enddo
 
   allocate(ibelm_ymin(nspec2D_ymin),nodes_ibelm_ymin(NGNOD2D,nspec2D_ymin),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_ymin'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_ymin'
   do ispec2D = 1,nspec2D_ymin
      read(IIN) ibelm_ymin(ispec2D),(nodes_ibelm_ymin(j,ispec2D),j=1,NGNOD2D)
   enddo
 
   allocate(ibelm_ymax(nspec2D_ymax),nodes_ibelm_ymax(NGNOD2D,nspec2D_ymax),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_ymax etc.'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_ymax etc.'
   do ispec2D = 1,nspec2D_ymax
      read(IIN) ibelm_ymax(ispec2D),(nodes_ibelm_ymax(j,ispec2D),j=1,NGNOD2D)
   enddo
 
   allocate(ibelm_bottom(nspec2D_bottom_ext),nodes_ibelm_bottom(NGNOD2D,nspec2D_bottom_ext),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_bottom etc.'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_bottom etc.'
   do ispec2D = 1,nspec2D_bottom_ext
      read(IIN) ibelm_bottom(ispec2D),(nodes_ibelm_bottom(j,ispec2D),j=1,NGNOD2D)
   enddo
 
   allocate(ibelm_top(nspec2D_top_ext),nodes_ibelm_top(NGNOD2D,nspec2D_top_ext),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibelm_top etc.'
+  if( ier /= 0 ) stop 'Error allocating array ibelm_top etc.'
   do ispec2D = 1,nspec2D_top_ext
      read(IIN) ibelm_top(ispec2D),(nodes_ibelm_top(j,ispec2D),j=1,NGNOD2D)
   enddo
@@ -201,10 +201,10 @@
   call sum_all_i(nspec2D_bottom_ext,num_bottom)
 
   if(myrank == 0) then
-    write(IMAIN,*) '  absorbing boundaries: '
-    write(IMAIN,*) '    xmin,xmax: ',num_xmin,num_xmax
-    write(IMAIN,*) '    ymin,ymax: ',num_ymin,num_ymax
-    write(IMAIN,*) '    bottom,top: ',num_bottom,num_top
+    write(IMAIN,*) 'absorbing boundaries: '
+    write(IMAIN,*) '  xmin,xmax : ',num_xmin,num_xmax
+    write(IMAIN,*) '  ymin,ymax : ',num_ymin,num_ymax
+    write(IMAIN,*) '  bottom,top: ',num_bottom,num_top
   endif
   call synchronize_all()
 
@@ -214,7 +214,7 @@
 
   read(IIN) nspec_cpml_tot
   if(myrank == 0) then
-     write(IMAIN,*) ' total number of C-PML elements in the global mesh: ',nspec_cpml_tot
+     write(IMAIN,*) 'total number of C-PML elements in the global mesh: ',nspec_cpml_tot
   endif
   call synchronize_all()
 
@@ -230,13 +230,13 @@
      call sum_all_i(nspec_cpml,num_cpml)
 
      ! checks that the sum of C-PML elements over all partitions is correct
-     if( myrank == 0 .and. nspec_cpml_tot /= num_cpml ) stop 'error while summing C-PML elements over all partitions'
+     if( myrank == 0 .and. nspec_cpml_tot /= num_cpml ) stop 'Error while summing C-PML elements over all partitions'
 
      ! reads C-PML regions and C-PML spectral elements global indexing
      allocate(CPML_to_spec(nspec_cpml),stat=ier)
-     if(ier /= 0) stop 'error allocating array CPML_to_spec'
+     if(ier /= 0) stop 'Error allocating array CPML_to_spec'
      allocate(CPML_regions(nspec_cpml),stat=ier)
-     if(ier /= 0) stop 'error allocating array CPML_regions'
+     if(ier /= 0) stop 'Error allocating array CPML_regions'
 
      do i=1,nspec_cpml
         ! #id_cpml_regions = 1 : X_surface C-PML
@@ -253,7 +253,7 @@
 
      ! reads mask of C-PML elements for all elements in this partition
      allocate(is_CPML(NSPEC_AB),stat=ier)
-     if(ier /= 0) stop 'error allocating array is_CPML'
+     if(ier /= 0) stop 'Error allocating array is_CPML'
 
      do i=1,NSPEC_AB
         read(IIN) is_CPML(i)
@@ -271,15 +271,15 @@
 
   ! allocates interfaces
   allocate(my_neighbours_ext_mesh(num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array my_neighbours_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array my_neighbours_ext_mesh'
   allocate(my_nelmnts_neighbours_ext_mesh(num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array my_nelmnts_neighbours_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array my_nelmnts_neighbours_ext_mesh'
   allocate(my_interfaces_ext_mesh(6,max_interface_size_ext_mesh,num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array my_interfaces_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array my_interfaces_ext_mesh'
   allocate(ibool_interfaces_ext_mesh(NGLLX*NGLLX*max_interface_size_ext_mesh,num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibool_interfaces_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array ibool_interfaces_ext_mesh'
   allocate(nibool_interfaces_ext_mesh(num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array nibool_interfaces_ext_mesh'
+  if( ier /= 0 ) stop 'Error allocating array nibool_interfaces_ext_mesh'
 
   ! loops over MPI interfaces with other partitions
   do num_interface = 1, num_interfaces_ext_mesh
@@ -305,7 +305,7 @@
 
   call sum_all_i(num_interfaces_ext_mesh,num)
   if(myrank == 0) then
-    write(IMAIN,*) '  number of MPI partition interfaces: ',num
+    write(IMAIN,*) 'number of MPI partition interfaces: ',num
   endif
   call synchronize_all()
 
@@ -318,15 +318,15 @@
       nspec2D_moho_ext = 0
       boundary_number = 7
     endif
-    if(boundary_number /= 7) stop "Error : invalid database file"
+    if(boundary_number /= 7) stop "Error invalid database file"
 
     ! checks total number of elements
     call sum_all_i(nspec2D_moho_ext,num_moho)
-    if( num_moho == 0 ) call exit_mpi(myrank,'error no moho mesh in database')
+    if( num_moho == 0 ) call exit_mpi(myrank,'Error no moho mesh in database')
 
     ! reads in element informations
     allocate(ibelm_moho(nspec2D_moho_ext),nodes_ibelm_moho(NGNOD2D,nspec2D_moho_ext),stat=ier)
-    if( ier /= 0 ) stop 'error allocating array ibelm_moho etc.'
+    if( ier /= 0 ) stop 'Error allocating array ibelm_moho etc.'
     do ispec2D = 1,nspec2D_moho_ext
       ! format: #element_id #node_id1 #node_id2 #node_id3 #node_id4
       read(IIN) ibelm_moho(ispec2D),(nodes_ibelm_moho(j,ispec2D),j=1,NGNOD2D)
@@ -334,14 +334,14 @@
 
     ! user output
     if(myrank == 0) then
-      write(IMAIN,*) '  moho surfaces: ',num_moho
+      write(IMAIN,*) 'moho surfaces: ',num_moho
     endif
     call synchronize_all()
   else
     ! allocate dummy array
     nspec2D_moho_ext = 0
     allocate(ibelm_moho(nspec2D_moho_ext),nodes_ibelm_moho(NGNOD2D,nspec2D_moho_ext),stat=ier)
-    if( ier /= 0 ) stop 'error allocating dumy array ibelm_moho etc.'
+    if( ier /= 0 ) stop 'Error allocating dumy array ibelm_moho etc.'
   endif
 
   close(IIN)
diff --git a/src/meshfem3D/create_regions_mesh.f90 b/src/meshfem3D/create_regions_mesh.f90
index 477c6bb..528c930 100644
--- a/src/meshfem3D/create_regions_mesh.f90
+++ b/src/meshfem3D/create_regions_mesh.f90
@@ -34,9 +34,9 @@ contains
                                NEX_PER_PROC_XI,NEX_PER_PROC_ETA,NER, &
                                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
                                NPROC_XI,NPROC_ETA, &
-                               nsubregions,subregions,nblayers,ner_layer,NMATERIALS,material_properties, &
+                               nsubregions,subregions,NMATERIALS,material_properties, &
                                myrank, sizeprocs, &
-                 LOCAL_PATH,UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK, &
+                               LOCAL_PATH,UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK, &
                                CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FILES, &
                                USE_REGULAR_MESH,NDOUBLINGS,ner_doublings, &
                                ADIOS_ENABLED, ADIOS_FOR_DATABASES)
@@ -99,10 +99,6 @@ contains
     !     #7 : material number
     integer subregions(nsubregions,7)
 
-    ! layers of the model
-    integer nblayers
-    integer ner_layer(nblayers)
-
     ! topology of the elements
     integer iaddx(NGNOD_EIGHT_CORNERS)
     integer iaddy(NGNOD_EIGHT_CORNERS)
@@ -221,9 +217,9 @@ contains
 
     do isubregion = 1,nsubregions
        call define_model_regions(NEX_PER_PROC_XI,NEX_PER_PROC_ETA,iproc_xi,iproc_eta,&
-            isubregion,nsubregions,subregions,nblayers,ner_layer, &
-            iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar, &
-            imaterial_number)
+                                 isubregion,nsubregions,subregions, &
+                                 iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar, &
+                                 imaterial_number)
 
        ! loop on all the mesh points in current subregion
        do ir = ir1,ir2,dir
@@ -257,8 +253,8 @@ contains
     do isubregion = 1,nmeshregions
       ! define shape of elements
       call define_mesh_regions(USE_REGULAR_MESH,isubregion,NER,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,iproc_xi,iproc_eta,&
-            nblayers,ner_layer,NDOUBLINGS,ner_doublings,&
-            iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar)
+                               NDOUBLINGS,ner_doublings,&
+                               iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar)
 
       ! loop on all the mesh points in current subregion
       do ir = ir1,ir2,dir
diff --git a/src/meshfem3D/define_subregions.f90 b/src/meshfem3D/define_subregions.f90
index c029ed2..ab4b34f 100644
--- a/src/meshfem3D/define_subregions.f90
+++ b/src/meshfem3D/define_subregions.f90
@@ -26,73 +26,67 @@
 !=====================================================================
 
   subroutine define_model_regions(NEX_PER_PROC_XI,NEX_PER_PROC_ETA,iproc_xi,iproc_eta,&
-       isubregion,nbsubregions,subregions,nblayers,ner_layer,&
-       iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar, &
-       num_material)
+                                  isubregion,nbsubregions,subregions, &
+                                  iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar, &
+                                  num_material)
 
-    use constants
+  use constants
 
-    implicit none
+  implicit none
 
-    integer NEX_PER_PROC_XI,NEX_PER_PROC_ETA
-    integer iproc_xi,iproc_eta
+  integer NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+  integer iproc_xi,iproc_eta
 
-    integer ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir
-    integer iax,iay,iar
-    integer isubregion,nbsubregions,nblayers
-    integer num_material
+  integer ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir
+  integer iax,iay,iar
+  integer isubregion,nbsubregions
+  integer num_material
 
-! topology of the elements
-    integer iaddx(NGNOD_EIGHT_CORNERS)
-    integer iaddy(NGNOD_EIGHT_CORNERS)
-    integer iaddz(NGNOD_EIGHT_CORNERS)
-    integer ner_layer(nblayers)
+  ! topology of the elements
+  integer iaddx(NGNOD_EIGHT_CORNERS)
+  integer iaddy(NGNOD_EIGHT_CORNERS)
+  integer iaddz(NGNOD_EIGHT_CORNERS)
 
-!  definition of the different regions of the model in the mesh (nx,ny,nz)
-!  #1 #2 : nx_begining,nx_end
-!  #3 #4 : ny_begining,ny_end
-!  #5 #6 : nz_begining,nz_end
-!     #7 : material number
-    integer subregions(nbsubregions,7)
+  !  definition of the different regions of the model in the mesh (nx,ny,nz)
+  !  #1 #2 : nx_begining,nx_end
+  !  #3 #4 : ny_begining,ny_end
+  !  #5 #6 : nz_begining,nz_end
+  !     #7 : material number
+  integer subregions(nbsubregions,7)
 
-    ! to avoid compiler warnings
-    integer idummy
-    idummy = ner_layer(1)
-! **************
+  call usual_hex_nodes(NGNOD_EIGHT_CORNERS,iaddx,iaddy,iaddz)
 
-     call usual_hex_nodes(NGNOD_EIGHT_CORNERS,iaddx,iaddy,iaddz)
+  ix1=2*(subregions(isubregion,1) - iproc_xi*NEX_PER_PROC_XI - 1)
+  if(ix1 < 0) ix1 = 0
+  ix2=2*(subregions(isubregion,2) - iproc_xi*NEX_PER_PROC_XI - 1)
+  if(ix2 > 2*(NEX_PER_PROC_XI - 1)) ix2 = 2*(NEX_PER_PROC_XI - 1)
+  dix=2
 
+  iy1=2*(subregions(isubregion,3) - iproc_eta*NEX_PER_PROC_ETA - 1)
+  if(iy1 < 0) iy1 = 0
+  iy2=2*(subregions(isubregion,4) - iproc_eta*NEX_PER_PROC_ETA - 1)
+  if(iy2 > 2*(NEX_PER_PROC_ETA - 1)) iy2 = 2*(NEX_PER_PROC_ETA - 1)
+  diy=2
 
-     ix1=2*(subregions(isubregion,1) - iproc_xi*NEX_PER_PROC_XI - 1)
-     if(ix1 < 0) ix1 = 0
-     ix2=2*(subregions(isubregion,2) - iproc_xi*NEX_PER_PROC_XI - 1)
-     if(ix2 > 2*(NEX_PER_PROC_XI - 1)) ix2 = 2*(NEX_PER_PROC_XI - 1)
-     dix=2
-
-     iy1=2*(subregions(isubregion,3) - iproc_eta*NEX_PER_PROC_ETA - 1)
-     if(iy1 < 0) iy1 = 0
-     iy2=2*(subregions(isubregion,4) - iproc_eta*NEX_PER_PROC_ETA - 1)
-     if(iy2 > 2*(NEX_PER_PROC_ETA - 1)) iy2 = 2*(NEX_PER_PROC_ETA - 1)
-     diy=2
-
-     ir1=2*(subregions(isubregion,5) - 1)
-     ir2=2*(subregions(isubregion,6) - 1)
-     dir=2
-
-     iax=1
-     iay=1
-     iar=1
+  ir1=2*(subregions(isubregion,5) - 1)
+  ir2=2*(subregions(isubregion,6) - 1)
+  dir=2
 
-     num_material = subregions(isubregion,7)
+  iax=1
+  iay=1
+  iar=1
 
+  num_material = subregions(isubregion,7)
 
   end subroutine define_model_regions
 
-
+!
+!------------------------------------------------------------------------------------
+!
 
   subroutine define_mesh_regions(USE_REGULAR_MESH,isubregion,NER,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,iproc_xi,iproc_eta,&
-       nblayers,ner_layer,ndoublings,ner_doublings,&
-       iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar)
+                                 ndoublings,ner_doublings,&
+                                 iaddx,iaddy,iaddz,ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir,iax,iay,iar)
 
     use constants
 
@@ -106,19 +100,16 @@
 
     integer ix1,ix2,dix,iy1,iy2,diy,ir1,ir2,dir
     integer iax,iay,iar
-    integer nblayers
     integer ndoublings
 
 ! topology of the elements
     integer iaddx(NGNOD_EIGHT_CORNERS)
     integer iaddy(NGNOD_EIGHT_CORNERS)
     integer iaddz(NGNOD_EIGHT_CORNERS)
-    integer ner_layer(nblayers)
     integer ner_doublings(2)
 
     ! to avoid compiler warnings
     integer idummy
-    idummy = ner_layer(1)
     idummy = iproc_xi
     idummy = iproc_eta
 
diff --git a/src/meshfem3D/meshfem3D.f90 b/src/meshfem3D/meshfem3D.f90
index e1b2c05..4f0ad1b 100644
--- a/src/meshfem3D/meshfem3D.f90
+++ b/src/meshfem3D/meshfem3D.f90
@@ -359,8 +359,13 @@
   call world_rank(myrank)
 
 ! 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_mesher.txt',status='unknown')
+  if(myrank == 0 .and. IMAIN /= ISTANDARD_OUTPUT) then
+    open(unit=IMAIN,file=trim(OUTPUT_FILES_PATH)//'/output_meshfem3D.txt',status='unknown',iostat=ier)
+    if (ier /= 0) then
+      print*,'Error could not open output file :',trim(OUTPUT_FILES_PATH)//'/output_meshfem3D.txt'
+      stop 'Error opening output file'
+    endif
+  endif
 
 ! get MPI starting time
   time_start = wtime()
@@ -394,57 +399,69 @@
 ! read the mesh parameter file (Data/meshfem3D_files/Mesh_Par_file)
 ! nullify(subregions,material_properties)
   call read_mesh_parameter_file(LATITUDE_MIN,LATITUDE_MAX,LONGITUDE_MIN,LONGITUDE_MAX, &
-                          UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK, &
-                          NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA,UTM_PROJECTION_ZONE, &
-                          LOCAL_PATH,SUPPRESS_UTM_PROJECTION,&
-                          INTERFACES_FILE,NSUBREGIONS,subregions,NMATERIALS,material_properties, &
-                          CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FILES, &
-                          USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
+                                UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK, &
+                                NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA,UTM_PROJECTION_ZONE, &
+                                LOCAL_PATH,SUPPRESS_UTM_PROJECTION,&
+                                INTERFACES_FILE,NSUBREGIONS,subregions,NMATERIALS,material_properties, &
+                                CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FILES, &
+                                USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
 
   if (sizeprocs == 1 .and. (NPROC_XI /= 1 .or. NPROC_ETA /= 1)) &
-    stop 'error: must have NPROC_XI = NPROC_ETA = 1 for a serial run'
+    stop 'Error: must have NPROC_XI = NPROC_ETA = 1 for a serial run'
 
 ! get interface data from external file to count the spectral elements along Z
   if(myrank == 0) then
-     write(IMAIN,*) 'Reading interface data from file ',&
-      MF_IN_DATA_FILES_PATH(1:len_trim(MF_IN_DATA_FILES_PATH))//INTERFACES_FILE(1:len_trim(INTERFACES_FILE)), &
+     write(IMAIN,*) 'Reading interface data from file ',trim(MF_IN_DATA_FILES_PATH)//trim(INTERFACES_FILE), &
       ' to count the spectral elements'
   endif
 
-  open(unit=IIN,file=MF_IN_DATA_FILES_PATH(1:len_trim(MF_IN_DATA_FILES_PATH))//INTERFACES_FILE, &
-      status='old')
+  open(unit=IIN,file=trim(MF_IN_DATA_FILES_PATH)//trim(INTERFACES_FILE),status='old',iostat=ier)
+  if (ier /= 0 ) then
+    print*,'Error opening interface file: ',trim(MF_IN_DATA_FILES_PATH)//trim(INTERFACES_FILE)
+    stop 'Error opening interface file'
+  endif
 
   max_npx_interface  = -1
   max_npy_interface  = -1
 
 ! read number of interfaces
   call read_value_integer_mesh(IIN,DONT_IGNORE_JUNK,number_of_interfaces,'NINTERFACES', ier)
-  if(number_of_interfaces < 1) stop 'error: not enough interfaces (minimum is 1, for topography)'
+  if (ier /= 0) stop 'Error reading interface parameter for NINTERFACES'
+
+  if (number_of_interfaces < 1) stop 'Error not enough interfaces (minimum is 1, for topography)'
 
 ! loop on all the interfaces
   do interface_current = 1,number_of_interfaces
     call read_interface_parameters(IIN,SUPPRESS_UTM_PROJECTION_BOTTOM,interface_top_file, &
-          npx_interface_bottom,npy_interface_bottom,&
-          orig_x_interface_bottom,orig_y_interface_bottom,&
-          spacing_x_interface_bottom,spacing_y_interface_bottom,ier)
+                                   npx_interface_bottom,npy_interface_bottom,&
+                                   orig_x_interface_bottom,orig_y_interface_bottom,&
+                                   spacing_x_interface_bottom,spacing_y_interface_bottom,ier)
+    if (ier /= 0) then
+      print*,'Error reading interface parameters: interface ',interface_current
+      stop 'Error reading interface parameters for interfaces'
+    endif
 
     max_npx_interface = max(npx_interface_bottom,max_npx_interface)
     max_npy_interface = max(npy_interface_bottom,max_npy_interface)
 
-    if((max_npx_interface < 2) .or.(max_npy_interface < 2)) stop 'not enough interface points (minimum is 2x2)'
-
+    if((max_npx_interface < 2) .or.(max_npy_interface < 2)) then
+      print*,'Error interface ',interface_current,': has not enough interface points (minimum is 2x2)'
+      stop 'Error not enough interface points (minimum is 2x2)'
+    endif
   enddo
 
   ! define number of layers
-  number_of_layers = number_of_interfaces! - 1
+  number_of_layers = number_of_interfaces ! - 1
   allocate(ner_layer(number_of_layers),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ner_layer'
+  if( ier /= 0 ) stop 'Error allocating array ner_layer'
 
 ! loop on all the layers
   do ilayer = 1,number_of_layers
 
 ! read number of spectral elements in vertical direction in this layer
     call read_value_integer_mesh(IIN,DONT_IGNORE_JUNK,ner_layer(ilayer),'NER_LAYER', ier)
+    if (ier /= 0) stop 'Error reading interface parameter for NER_LAYER'
+
     if(ner_layer(ilayer) < 1) stop 'not enough spectral elements along Z in layer (minimum is 1)'
 
   enddo
@@ -456,21 +473,21 @@
 
 ! compute other parameters based upon values read
   call compute_parameters(NER,NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
-                        NPROC,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                        NSPEC_AB,NSPEC2D_A_XI,NSPEC2D_B_XI, &
-                        NSPEC2D_A_ETA,NSPEC2D_B_ETA, &
-                        NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                        NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX,NGLOB_AB,&
-                        USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
+                          NPROC,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+                          NSPEC_AB,NSPEC2D_A_XI,NSPEC2D_B_XI, &
+                          NSPEC2D_A_ETA,NSPEC2D_B_ETA, &
+                          NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+                          NPOIN2DMAX_XMIN_XMAX,NPOIN2DMAX_YMIN_YMAX,NGLOB_AB,&
+                          USE_REGULAR_MESH,NDOUBLINGS,ner_doublings)
 
 ! check that the code is running with the requested nb of processes
   if(sizeprocs /= NPROC) then
     if( myrank == 0 ) then
-      write(IMAIN,*) 'error: number of processors supposed to run on: ',NPROC
-      write(IMAIN,*) 'error: number of MPI processors actually run on: ',sizeprocs
+      write(IMAIN,*) 'Error: number of processors supposed to run on: ',NPROC
+      write(IMAIN,*) 'Error: number of MPI processors actually run on: ',sizeprocs
       print*
-      print*, 'error meshfem3D: number of processors supposed to run on: ',NPROC
-      print*, 'error meshfem3D: number of MPI processors actually run on: ',sizeprocs
+      print*, 'Error meshfem3D: number of processors supposed to run on: ',NPROC
+      print*, 'Error meshfem3D: number of MPI processors actually run on: ',sizeprocs
       print*
     endif
     call exit_MPI(myrank,'wrong number of MPI processes')
@@ -478,21 +495,21 @@
 
 ! dynamic allocation of mesh arrays
   allocate(rns(0:2*NER),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array rns'
+  if( ier /= 0 ) stop 'Error allocating array rns'
 
   allocate(xgrid(0:2*NER,0:2*NEX_PER_PROC_XI,0:2*NEX_PER_PROC_ETA),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array xgrid'
+  if( ier /= 0 ) stop 'Error allocating array xgrid'
   allocate(ygrid(0:2*NER,0:2*NEX_PER_PROC_XI,0:2*NEX_PER_PROC_ETA),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ygrid'
+  if( ier /= 0 ) stop 'Error allocating array ygrid'
   allocate(zgrid(0:2*NER,0:2*NEX_PER_PROC_XI,0:2*NEX_PER_PROC_ETA),stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'not enough memory to allocate arrays')
 
   allocate(addressing(0:NPROC_XI-1,0:NPROC_ETA-1),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array addressing'
+  if( ier /= 0 ) stop 'Error allocating array addressing'
   allocate(iproc_xi_slice(0:NPROC-1),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array iproc_xi_slice'
+  if( ier /= 0 ) stop 'Error allocating array iproc_xi_slice'
   allocate(iproc_eta_slice(0:NPROC-1),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array iproc_eta_slice'
+  if( ier /= 0 ) stop 'Error allocating array iproc_eta_slice'
 
 ! clear arrays
   xgrid(:,:,:) = 0.d0
@@ -626,19 +643,17 @@
 
   if(myrank == 0) then
     write(IMAIN,*)
-    write(IMAIN,*) 'Reading interface data from file ', &
-          MF_IN_DATA_FILES_PATH(1:len_trim(MF_IN_DATA_FILES_PATH)) &
-          //INTERFACES_FILE(1:len_trim(INTERFACES_FILE))
+    write(IMAIN,*) 'Reading interface data from file ',trim(MF_IN_DATA_FILES_PATH)//trim(INTERFACES_FILE)
     write(IMAIN,*)
   endif
 
-  open(unit=IIN,file=MF_IN_DATA_FILES_PATH(1:len_trim(MF_IN_DATA_FILES_PATH)) &
-          //INTERFACES_FILE,status='old')
+  open(unit=IIN,file=trim(MF_IN_DATA_FILES_PATH)//trim(INTERFACES_FILE),status='old',iostat=ier)
+  if (ier /= 0 ) stop 'Error opening interfaces file'
 
   allocate(interface_bottom(max_npx_interface,max_npy_interface),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array interface_bottom'
+  if( ier /= 0 ) stop 'Error allocating array interface_bottom'
   allocate(interface_top(max_npx_interface,max_npy_interface),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array interface_top'
+  if( ier /= 0 ) stop 'Error allocating array interface_top'
 
   ! read number of interfaces
   call read_value_integer_mesh(IIN,DONT_IGNORE_JUNK,number_of_interfaces,'NINTERFACES', ier)
@@ -653,19 +668,18 @@
   interface_bottom(:,:) = - dabs(Z_DEPTH_BLOCK)
 
   ! loop on all the layers
-
   do ilayer = 1,number_of_layers
 
     ! read top interface
     call read_interface_parameters(IIN,SUPPRESS_UTM_PROJECTION_TOP,interface_top_file,&
-         npx_interface_top,npy_interface_top,&
-         orig_x_interface_top,orig_y_interface_top,&
-         spacing_x_interface_top,spacing_y_interface_top,ier)
+                                   npx_interface_top,npy_interface_top,&
+                                   orig_x_interface_top,orig_y_interface_top,&
+                                   spacing_x_interface_top,spacing_y_interface_top,ier)
 
     !npoints_interface_top = npx_interface_top * npy_interface
     ! loop on all the points describing this interface
-    open(unit=45,file=MF_IN_DATA_FILES_PATH(1:len_trim(MF_IN_DATA_FILES_PATH)) &
-         //interface_top_file,status='old')
+    open(unit=45,file=trim(MF_IN_DATA_FILES_PATH)//trim(interface_top_file),status='old',iostat=ier)
+    if ( ier /= 0 ) stop 'Error opening interface_top file'
     do iy=1,npy_interface_top
       do ix=1,npx_interface_top
         call read_value_dble_precision_mesh(45,DONT_IGNORE_JUNK,interface_top(ix,iy),'Z_INTERFACE_TOP',ier)
@@ -806,27 +820,27 @@
 
 ! use dynamic allocation to allocate memory for arrays
   allocate(ibool(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ibool'
+  if( ier /= 0 ) stop 'Error allocating array ibool'
   allocate(xstore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array xstore'
+  if( ier /= 0 ) stop 'Error allocating array xstore'
   allocate(ystore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array ystore'
+  if( ier /= 0 ) stop 'Error allocating array ystore'
   allocate(zstore(NGLLX_M,NGLLY_M,NGLLZ_M,nspec),stat=ier)
   ! exit if there is not enough memory to allocate all the arrays
   if(ier /= 0) call exit_MPI(myrank,'not enough memory to allocate arrays')
 
   call create_regions_mesh(xgrid,ygrid,zgrid,ibool, &
-                         xstore,ystore,zstore,iproc_xi,iproc_eta,addressing,nspec, &
-                         NGLOB_AB,npointot, &
-                         NEX_PER_PROC_XI,NEX_PER_PROC_ETA,NER, &
-                         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                         NPROC_XI,NPROC_ETA, &
-                         NSUBREGIONS,subregions,number_of_layers,ner_layer,NMATERIALS,material_properties, &
-                         myrank, sizeprocs, &
-                         LOCAL_PATH,UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK,&
-                         CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FILES, &
-                        USE_REGULAR_MESH,NDOUBLINGS,ner_doublings, &
-                        ADIOS_ENABLED, ADIOS_FOR_DATABASES)
+                           xstore,ystore,zstore,iproc_xi,iproc_eta,addressing,nspec, &
+                           NGLOB_AB,npointot, &
+                           NEX_PER_PROC_XI,NEX_PER_PROC_ETA,NER, &
+                           NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+                           NPROC_XI,NPROC_ETA, &
+                           NSUBREGIONS,subregions,NMATERIALS,material_properties, &
+                           myrank, sizeprocs, &
+                           LOCAL_PATH,UTM_X_MIN,UTM_X_MAX,UTM_Y_MIN,UTM_Y_MAX,Z_DEPTH_BLOCK,&
+                           CREATE_ABAQUS_FILES,CREATE_DX_FILES,CREATE_VTK_FILES, &
+                           USE_REGULAR_MESH,NDOUBLINGS,ner_doublings, &
+                           ADIOS_ENABLED, ADIOS_FOR_DATABASES)
 
   if(myrank == 0) then
 ! compare to exact theoretical value (bottom is always flat)
diff --git a/src/meshfem3D/read_mesh_parameter_file.f90 b/src/meshfem3D/read_mesh_parameter_file.f90
index b05e455..1f412b1 100644
--- a/src/meshfem3D/read_mesh_parameter_file.f90
+++ b/src/meshfem3D/read_mesh_parameter_file.f90
@@ -158,12 +158,12 @@ contains
 
 ! read materials properties
   allocate(material_properties(NMATERIALS,6),stat=ierr)
-  if (ierr /= 0) stop 'Allocation error of material_properties'
+  if (ierr /= 0) stop 'Error allocation of material_properties'
 
-  do imat =1,NMATERIALS
+  do imat = 1,NMATERIALS
      call read_material_parameters(IIN,i,rho,vp,vs,Q_flag,anisotropy_flag,domain_id,ierr)
-     if (i /= imat) stop "Incorrect material ID"
-     if(rho <= 0.d0 .or. vp <= 0.d0 .or. vs < 0.d0) stop 'negative value of velocity or density'
+     if (i /= imat) stop 'Error incorrect material ID'
+     if(rho <= 0.d0 .or. vp <= 0.d0 .or. vs < 0.d0) stop 'Error negative value of velocity or density'
      material_properties(imat,1) = rho
      material_properties(imat,2) = vp
      material_properties(imat,3) = vs
@@ -178,10 +178,10 @@ contains
 
 ! read subregions properties
   allocate(subregions(NSUBREGIONS,7),stat=ierr)
-  if (ierr /= 0) stop 'Allocation error of subregions'
+  if (ierr /= 0) stop 'Error allocation of subregions'
   do ireg =1,NSUBREGIONS
     call read_region_parameters(IIN,ix_beg_region,ix_end_region,iy_beg_region,iy_end_region,&
-         iz_beg_region,iz_end_region,imaterial_number,ierr)
+                                iz_beg_region,iz_end_region,imaterial_number,ierr)
     if (ix_beg_region < 1) stop 'XI coordinate of region negative!'
     if (ix_end_region > NEX_XI) stop 'XI coordinate of region too high!'
     if (iy_beg_region < 1) stop 'ETA coordinate of region negative!'



More information about the CIG-COMMITS mailing list