[cig-commits] r8479 - seismo/2D/SPECFEM2D/trunk

walter at geodynamics.org walter at geodynamics.org
Fri Dec 7 15:49:30 PST 2007


Author: walter
Date: 2007-12-07 15:49:29 -0800 (Fri, 07 Dec 2007)
New Revision: 8479

Modified:
   seismo/2D/SPECFEM2D/trunk/constants.h
   seismo/2D/SPECFEM2D/trunk/specfem2D.f90
   seismo/2D/SPECFEM2D/trunk/write_seismograms.f90
Log:
fixed open(IOUT...) and close(IOUT) bug when IOUT is the standard output (which can cause some F95 compilers to crash)


Modified: seismo/2D/SPECFEM2D/trunk/constants.h
===================================================================
--- seismo/2D/SPECFEM2D/trunk/constants.h	2005-11-07 12:18:38 UTC (rev 8478)
+++ seismo/2D/SPECFEM2D/trunk/constants.h	2007-12-07 23:49:29 UTC (rev 8479)
@@ -14,9 +14,9 @@
 
 ! input and output files
   integer, parameter :: IIN  = 40
-
+  integer, parameter :: ISTANDARD_OUTPUT = 6
 ! uncomment this to write to standard output
-  integer, parameter :: IOUT = 6
+  integer, parameter :: IOUT = ISTANDARD_OUTPUT
 ! uncomment this to write to file instead
 ! integer, parameter :: IOUT = 41
 

Modified: seismo/2D/SPECFEM2D/trunk/specfem2D.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/specfem2D.f90	2005-11-07 12:18:38 UTC (rev 8478)
+++ seismo/2D/SPECFEM2D/trunk/specfem2D.f90	2007-12-07 23:49:29 UTC (rev 8479)
@@ -203,8 +203,8 @@
 
   open (IIN,file='OUTPUT_FILES/Database')
 
-! uncomment this to write to file instead of standard output
-! open (IOUT,file='results_simulation.txt')
+! determine if we write to file instead of standard output
+  if(IOUT /= ISTANDARD_OUTPUT) open (IOUT,file='simulation_results.txt')
 
 !
 !---  read job title and skip remaining titles of the input file
@@ -1804,7 +1804,7 @@
 !
 !----  close output file
 !
-  close(IOUT)
+  if(IOUT /= ISTANDARD_OUTPUT) close(IOUT)
 
 !
 !----  formats

Modified: seismo/2D/SPECFEM2D/trunk/write_seismograms.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/write_seismograms.f90	2005-11-07 12:18:38 UTC (rev 8478)
+++ seismo/2D/SPECFEM2D/trunk/write_seismograms.f90	2007-12-07 23:49:29 UTC (rev 8479)
@@ -99,19 +99,19 @@
 ! if the simulation uses many time steps. However, subsampling the output
 ! here would result in a loss of accuracy when one later convolves
 ! the results with the source time function
-      open(unit=IOUT,file=sisname(1:len_trim(sisname)),status='unknown')
+      open(unit=11,file=sisname(1:len_trim(sisname)),status='unknown')
 
 ! make sure we never write more than the maximum number of time steps
 ! subtract offset of the source to make sure travel time is correct
       do isample = 1,min(it,NSTEP)
         if(iorientation == 1) then
-          write(IOUT,*) sngl(dble(isample-1)*deltat - t0),' ',sngl(sisux(isample,irec))
+          write(11,*) sngl(dble(isample-1)*deltat - t0),' ',sngl(sisux(isample,irec))
         else
-          write(IOUT,*) sngl(dble(isample-1)*deltat - t0),' ',sngl(sisuz(isample,irec))
+          write(11,*) sngl(dble(isample-1)*deltat - t0),' ',sngl(sisuz(isample,irec))
         endif
       enddo
 
-      close(IOUT)
+      close(11)
 
       enddo
 



More information about the cig-commits mailing list