[cig-commits] r22388 - seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D

elliott.sales.de.andrade at geodynamics.org elliott.sales.de.andrade at geodynamics.org
Thu Jun 20 15:03:25 PDT 2013


Author: elliott.sales.de.andrade
Date: 2013-06-20 15:03:24 -0700 (Thu, 20 Jun 2013)
New Revision: 22388

Modified:
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_aniso_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_atten3D_QRFSI12.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crust.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crustmaps.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_epcrust.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_eucrust.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gapp2.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gll.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_heterogen_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_ppm.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s20rts.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s362ani.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s40rts.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_sea99_s.f90
Log:
Open model files in a consistent manner.

Use status='old' and action='read' to prevent permission problems as I
load the models from a read-only file-system. Also, print out the error
condition in all cases.

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_aniso_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_aniso_mantle.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_aniso_mantle.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -383,7 +383,7 @@
   type (model_aniso_mantle_variables) AMM_V
 ! model_aniso_mantle_variables
 
-  integer nx,ny,np1,np2,ipar,ipa1,ipa,ilat,ilon,il,idep,nfin,nfi0,nf,nri
+  integer ier,nx,ny,np1,np2,ipar,ipa1,ipa,ilat,ilon,il,idep,nfin,nfi0,nf,nri
   double precision xinf,yinf,pxy,ppp,angle,A,A2L,AL,af
   double precision ra(47),pari(14,47)
   double precision bet2(14,34,37,73)
@@ -398,7 +398,11 @@
 ! glob-prem3sm01: model with rho,A,L,xi-1,1-phi,eta
 !
   call get_value_string(glob_prem3sm01, 'model.glob_prem3sm01', 'DATA/Montagner_model/glob-prem3sm01')
-  open(19,file=glob_prem3sm01,status='old',action='read')
+  open(19,file=glob_prem3sm01,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(glob_prem3sm01), '": ', ier
+    call exit_MPI(0, 'error model aniso mantle')
+  endif
 
 !
 ! read the models
@@ -459,7 +463,11 @@
 ! normalized, in percents: 100 G/L
 !
   call get_value_string(globpreman3sm01, 'model.globpreman3sm01', 'DATA/Montagner_model/globpreman3sm01')
-  open(unit=15,file=globpreman3sm01,status='old',action='read')
+  open(unit=15,file=globpreman3sm01,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(globpreman3sm01), '": ', ier
+    call exit_MPI(0, 'error model aniso mantle')
+  endif
 
   do nf = 7,nfin,2
     ipa = nf
@@ -539,6 +547,8 @@
 
   implicit none
 
+  include "constants.h"
+
 ! read the reference Earth model: rho, Vph, Vsv, XI, PHI, ETA
 ! array par(i,nlayer)
 ! output: array pari(ipar, nlayer): rho, A, L, xi-1, phi-1, eta-1
@@ -556,7 +566,12 @@
   nri = 47
 
   call get_value_string(Adrem119, 'model.Adrem119', 'DATA/Montagner_model/Adrem119')
-  open(unit=13,file=Adrem119,status='old',action='read')
+  open(unit=13,file=Adrem119,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(Adrem119), '": ', ier
+    call exit_MPI(0, 'error model aniso mantle')
+  endif
+
   read(13,*,iostat=ier) nlayer,minlay,moho,nout,neff,nband,kiti,null
   if (ier /= 0) then
     close(13)

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_atten3D_QRFSI12.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_atten3D_QRFSI12.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_atten3D_QRFSI12.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -102,7 +102,7 @@
 ! three_d_model_atten3D_QRFSI12_variables
 
   integer j,k,l,m
-  integer index,ll,mm
+  integer index,ll,mm,ier
   double precision v1,v2
 
   character(len=150) QRFSI12,QRFSI12_ref
@@ -113,7 +113,12 @@
   QRFSI12_ref='DATA/QRFSI12/ref_QRFSI12'
 
 ! get the dq model coefficients
-  open(unit=10,file=QRFSI12,status='old',action='read')
+  open(unit=10,file=QRFSI12,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(QRFSI12), '": ', ier
+    call exit_MPI(0, 'error model QRFSI12')
+  endif
+
   do k=1,NKQ
     read(10,*)index
     j=0
@@ -146,7 +151,12 @@
   QRFSI12_Q%spknt(8) = 650.0
 
 ! get the depths and 1/Q values of the reference model
-  open(11,file=QRFSI12_ref,status='old',action='read')
+  open(11,file=QRFSI12_ref,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(QRFSI12_ref), '": ', ier
+    call exit_MPI(0, 'error model QRFSI12')
+  endif
+
   do j=1,NDEPTHS_REFQ
     read(11,*)QRFSI12_Q%refdepth(j),QRFSI12_Q%refqmu(j)
   enddo

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crust.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crust.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -208,7 +208,7 @@
 ! model_crust_variables
 
 ! local variables
-  integer i
+  integer i,ier
   integer ila,icolat
   integer ikey
 
@@ -219,13 +219,23 @@
   call get_value_string(CNtype2, 'model.CNtype2', 'DATA/crust2.0/CNtype2.txt')
   call get_value_string(CNtype2_key_modif, 'model.CNtype2_key_modif', 'DATA/crust2.0/CNtype2_key_modif.txt')
 
-  open(unit=1,file=CNtype2,status='old',action='read')
+  open(unit=1,file=CNtype2,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(CNtype2), '": ', ier
+    call exit_MPI(0, 'error model crust2.0')
+  endif
+
   do ila=1,NCAP_CRUST/2
     read(1,*) icolat,(CM_V%abbreviation(ila,i),i=1,NCAP_CRUST)
   enddo
   close(1)
 
-  open(unit=1,file=CNtype2_key_modif,status='old',action='read')
+  open(unit=1,file=CNtype2_key_modif,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(CNtype2_key_modif), '": ', ier
+    call exit_MPI(0, 'error model crust2.0')
+  endif
+
   h_moho_min=HUGEVAL
   h_moho_max=-HUGEVAL
   do ikey=1,NKEYS_CRUST

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crustmaps.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crustmaps.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_crustmaps.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -212,7 +212,7 @@
   character(len=50) :: config_name
   character(len=150) :: default_name
   character(len=150) :: eucrust
-  integer :: ila, iln
+  integer :: ier, ila, iln
 
   write(config_name,'(a,a1,i1)') 'model.eucrust', var_letter, ind
   write(default_name,'(a,a1,i1)') 'DATA/crustmap/eucrust', var_letter, ind
@@ -220,6 +220,11 @@
   call get_value_string(eucrust, config_name, default_name)
 
   open(unit=1,file=eucrust,status='old',action='read')
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(eucrust), '": ', ier
+    call exit_MPI(0, 'error model crustmap')
+  endif
+
   do ila=1,180*CRUSTMAP_RESOLUTION
     read(1,*) (var(ila,iln),iln=1,360*CRUSTMAP_RESOLUTION)
   enddo

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_epcrust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_epcrust.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_epcrust.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -94,10 +94,16 @@
   character(len=150) EPCRUST_FNM
   character(len=150),dimension(15) :: header
   double precision,dimension(15) :: tmp
-  integer:: ilon, jlat
+  integer:: ier, ilon, jlat
 
   call get_value_string(EPCRUST_FNM,'model.EPCRUST_FNM',PATHNAME_EPCRUST)
-  open(unit=1001,file=EPCRUST_FNM,status='old',action='read')
+
+  open(unit=1001,file=EPCRUST_FNM,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(EPCRUST_FNM), '": ', ier
+    call exit_MPI(0, 'error model epcrust')
+  endif
+
   read(1001,*) header
 
   do jlat = 1,EPCRUST_NLAT

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_eucrust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_eucrust.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_eucrust.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -122,7 +122,11 @@
 
   ! opens data file
   call get_value_string(filename, 'model.eu', 'DATA/eucrust-07/ds01.txt')
-  open(unit=11,file=filename,status='old',action='read')
+  open(unit=11,file=filename,status='old',action='read',iostat=ierror)
+  if ( ierror /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(filename), '": ', ierror
+    call exit_MPI(0, 'error model eucrust')
+  endif
 
   ! skip first line
   read(11,*)

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gapp2.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gapp2.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gapp2.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -105,7 +105,10 @@
 
   ! reads in GAP-P2 model from Obayashi
   open(unit=10,file=GAPP2,status='old',action='read',iostat=ier)
-  if( ier /= 0 ) call exit_MPI(0,'error opening file for GAPP2 model')
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(GAPP2), '": ', ier
+    call exit_MPI(0, 'error model GAPP2')
+  endif
 
   read(10,*) no,na,nnr,dela,delo
 

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gll.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gll.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_gll.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -256,8 +256,8 @@
     ! vp mesh
     open(unit=27,file=prname(1:len_trim(prname))//'vp_new.bin',&
           status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      write(IMAIN,*) 'error opening: ',prname(1:len_trim(prname))//'vp_new.bin'
+    if ( ier /= 0 ) then
+      write(IMAIN,*) 'error opening "',prname(1:len_trim(prname))//'vp_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vp_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -266,8 +266,8 @@
     ! vs mesh
     open(unit=27,file=prname(1:len_trim(prname))//'vs_new.bin', &
          status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      print*,'error opening: ',prname(1:len_trim(prname))//'vs_new.bin'
+    if ( ier /= 0 ) then
+      print*,'error opening "',prname(1:len_trim(prname))//'vs_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vs_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -279,8 +279,8 @@
     ! vp mesh
     open(unit=27,file=prname(1:len_trim(prname))//'vpv_new.bin',&
           status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      write(IMAIN,*) 'error opening: ',prname(1:len_trim(prname))//'vpv_new.bin'
+    if ( ier /= 0 ) then
+      write(IMAIN,*) 'error opening "',prname(1:len_trim(prname))//'vpv_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vpv_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -288,8 +288,8 @@
 
     open(unit=27,file=prname(1:len_trim(prname))//'vph_new.bin',&
           status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      write(IMAIN,*) 'error opening: ',prname(1:len_trim(prname))//'vph_new.bin'
+    if ( ier /= 0 ) then
+      write(IMAIN,*) 'error opening "',prname(1:len_trim(prname))//'vph_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vph_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -298,8 +298,8 @@
     ! vs mesh
     open(unit=27,file=prname(1:len_trim(prname))//'vsv_new.bin', &
          status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      print*,'error opening: ',prname(1:len_trim(prname))//'vsv_new.bin'
+    if ( ier /= 0 ) then
+      print*,'error opening "',prname(1:len_trim(prname))//'vsv_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vsv_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -307,8 +307,8 @@
 
     open(unit=27,file=prname(1:len_trim(prname))//'vsh_new.bin', &
          status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      print*,'error opening: ',prname(1:len_trim(prname))//'vsh_new.bin'
+    if ( ier /= 0 ) then
+      print*,'error opening "',prname(1:len_trim(prname))//'vsh_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%vsh_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -317,8 +317,8 @@
     ! eta mesh
     open(unit=27,file=prname(1:len_trim(prname))//'eta_new.bin', &
          status='old',action='read',form='unformatted',iostat=ier)
-    if( ier /= 0 ) then
-      print*,'error opening: ',prname(1:len_trim(prname))//'eta_new.bin'
+    if ( ier /= 0 ) then
+      print*,'error opening "',prname(1:len_trim(prname))//'eta_new.bin', '": ', ier
       call exit_MPI(myrank,'error model gll')
     endif
     read(27) MGLL_V%eta_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))
@@ -329,8 +329,8 @@
   ! rho mesh
   open(unit=27,file=prname(1:len_trim(prname))//'rho_new.bin', &
        status='old',action='read',form='unformatted',iostat=ier)
-  if( ier /= 0 ) then
-    print*,'error opening: ',prname(1:len_trim(prname))//'rho_new.bin'
+  if ( ier /= 0 ) then
+    print*,'error opening "',prname(1:len_trim(prname))//'rho_new.bin', '": ', ier
     call exit_MPI(myrank,'error model gll')
   endif
   read(27) MGLL_V%rho_new(:,:,:,1:nspec(IREGION_CRUST_MANTLE))

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_heterogen_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_heterogen_mantle.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_heterogen_mantle.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -85,7 +85,7 @@
 
   include "constants.h"
 
-  integer i,j
+  integer i,j,ier
 
 ! model_heterogen_m_variables
   type model_heterogen_m_variables
@@ -99,7 +99,11 @@
 
 ! open heterogen.dat
   open(unit=10,file='./DATA/heterogen/heterogen.dat',access='direct',&
-       form='formatted',recl=20,status='old',action='read')
+       form='formatted',recl=20,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "./DATA/heterogen/heterogen.dat": ', ier
+    call exit_MPI(0, 'error model heterogen')
+  endif
 
   j = N_R*N_THETA*N_PHI
 

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_ppm.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_ppm.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_ppm.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -173,9 +173,9 @@
   ! counts entries
   counter=0
   open(unit=10,file=trim(filename),status='old',action='read',iostat=ier)
-  if( ier /= 0 ) then
-    write(IMAIN,*) ' error count opening: ',trim(filename)
-    call exit_mpi(0,"error count opening model ppm")
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(filename), '": ', ier
+    call exit_mpi(0, "error opening model ppm")
   endif
 
   ! first line is text and will be ignored
@@ -214,7 +214,7 @@
   ! vs values
   open(unit=10,file=trim(filename),status='old',action='read',iostat=ier)
   if( ier /= 0 ) then
-    write(IMAIN,*) ' error opening: ',trim(filename)
+    write(IMAIN,*) ' error opening "', trim(filename), '": ', ier
     call exit_mpi(0,"error opening model ppm")
   endif
   read(10,'(a150)') line   ! first line is text

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s20rts.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s20rts.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s20rts.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -101,7 +101,7 @@
   type (model_s20rts_variables) S20RTS_V
 ! model_s20rts_variables
 
-  integer k,l,m
+  integer k,l,m,ier
 
   character(len=150) S20RTS, P12
 
@@ -109,7 +109,11 @@
   call get_value_string(P12, 'model.P12', 'DATA/s20rts/P12.dat')
 
 ! S20RTS degree 20 S model from Ritsema
-  open(unit=10,file=S20RTS,status='old',action='read')
+  open(unit=10,file=S20RTS,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(S20RTS), '": ', ier
+    call exit_MPI(0, 'error model s20rts')
+  endif
   do k=0,NK_20
     do l=0,NS_20
       read(10,*) S20RTS_V%dvs_a(k,l,0),(S20RTS_V%dvs_a(k,l,m),S20RTS_V%dvs_b(k,l,m),m=1,l)
@@ -118,7 +122,11 @@
   close(10)
 
 ! P12 degree 12 P model from Ritsema
-  open(unit=10,file=P12,status='old',action='read')
+  open(unit=10,file=P12,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(P12), '": ', ier
+    call exit_MPI(0, 'error model s20rts')
+  endif
   do k=0,NK_20
     do l=0,12
       read(10,*) S20RTS_V%dvp_a(k,l,0),(S20RTS_V%dvp_a(k,l,m),S20RTS_V%dvp_b(k,l,m),m=1,l)

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s362ani.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s362ani.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s362ani.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -954,6 +954,7 @@
     hsplfile,refmodel,kernstri,desckern)
 
   implicit none
+  include "constants.h"
 
   integer, parameter :: mxhpar=2
   integer, parameter :: mxkern=200
@@ -984,9 +985,10 @@
 
   integer :: ncoef,i,ihor,ifst,ilst,ifst1,ios,lstr,nmodkern,idummy,nhorpar,lmax
 
-  open(lu,file=filename,iostat=ios)
-  if(ios /= 0) then
-  stop 'error opening 3-d model'
+  open(lu,file=filename,status='old',action='read',iostat=ios)
+  if ( ios /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(filename), '": ', ios
+    call exit_MPI(0, 'error model s362ani')
   endif
   do while (ios == 0)
   read(lu,"(a)",iostat=ios) string

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s40rts.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s40rts.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_s40rts.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -106,14 +106,18 @@
   type (model_s40rts_variables) S40RTS_V
 ! model_s40rts_variables
 
-  integer k,l,m
+  integer k,l,m,ier
 
   character(len=150) S40RTS, P12
   call get_value_string(S40RTS, 'model.S40RTS', 'DATA/s40rts/S40RTS.dat')
   call get_value_string(P12, 'model.P12', 'DATA/s20rts/P12.dat')    !model P12 is in s20rts data directory
 
 ! S40RTS degree 20 S model from Ritsema
-  open(unit=10,file=S40RTS,status='old',action='read')
+  open(unit=10,file=S40RTS,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(S40RTS), '": ', ier
+    call exit_MPI(0, 'error model s40rts')
+  endif
   do k=0,NK_20
     do l=0,NS_40
       read(10,*) S40RTS_V%dvs_a(k,l,0),(S40RTS_V%dvs_a(k,l,m),S40RTS_V%dvs_b(k,l,m),m=1,l)
@@ -122,7 +126,11 @@
   close(10)
 
 ! P12 degree 12 P model from Ritsema
-  open(unit=10,file=P12,status='old',action='read')
+  open(unit=10,file=P12,status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "', trim(P12), '": ', ier
+    call exit_MPI(0, 'error model s40rts')
+  endif
   do k=0,NK_20
     do l=0,12
       read(10,*) S40RTS_V%dvp_a(k,l,0),(S40RTS_V%dvp_a(k,l,m),S40RTS_V%dvp_b(k,l,m),m=1,l)

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_sea99_s.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_sea99_s.f90	2013-06-20 22:03:13 UTC (rev 22387)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/src/meshfem3D/model_sea99_s.f90	2013-06-20 22:03:24 UTC (rev 22388)
@@ -119,13 +119,17 @@
   type (model_sea99_s_variables) SEA99M_V
   ! model_sea99_s_variables
 
-  integer :: i,ia,io,j
+  integer :: i,ia,io,j,ier
 
 !----------------------- choose input file:  ------------------
 ! relative anomaly
 
 
-  open(1,file='DATA/Lebedev_sea99/sea99_dvsvs')
+  open(1,file='DATA/Lebedev_sea99/sea99_dvsvs',status='old',action='read',iostat=ier)
+  if ( ier /= 0 ) then
+    write(IMAIN,*) 'error opening "DATA/Lebedev_sea99/sea99_dvsvs": ', ier
+    call exit_MPI(0, 'error model sea99_s')
+  endif
 
 !----------------------- read input file:  ------------------
 



More information about the CIG-COMMITS mailing list