[cig-commits] r18035 - in seismo/2D/SPECFEM2D/trunk: DATA src/meshfem2D src/specfem2D

carltape at geodynamics.org carltape at geodynamics.org
Fri Mar 4 11:25:55 PST 2011


Author: carltape
Date: 2011-03-04 11:25:55 -0800 (Fri, 04 Mar 2011)
New Revision: 18035

Modified:
   seismo/2D/SPECFEM2D/trunk/DATA/Par_file.in
   seismo/2D/SPECFEM2D/trunk/src/meshfem2D/read_parameter_file.F90
   seismo/2D/SPECFEM2D/trunk/src/meshfem2D/save_databases.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_databases.f90
   seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
Log:
added new parameter to Par_file, output_wavefield_snapshot, to output ascii files of the global wavefield at the designated time steps; also changed names OUTPUT_ENERGY --> output_energy and outputgrid --> output_grid for consistency; tested MPI version


Modified: seismo/2D/SPECFEM2D/trunk/DATA/Par_file.in
===================================================================
--- seismo/2D/SPECFEM2D/trunk/DATA/Par_file.in	2011-03-04 18:49:39 UTC (rev 18034)
+++ seismo/2D/SPECFEM2D/trunk/DATA/Par_file.in	2011-03-04 19:25:55 UTC (rev 18035)
@@ -62,8 +62,9 @@
 subsamp                         = 1              # subsampling of color snapshots
 sizemax_arrows                  = 1.d0           # maximum size of arrows on vector plots in cm
 gnuplot                         = .false.        # generate a GNUPLOT file for the grid
-outputgrid                      = .false.        # save the grid in a text file or not
-OUTPUT_ENERGY                   = .false.        # compute and output acoustic and elastic energy (slows down the code significantly)
+output_grid                     = .false.        # save the grid in a text file or not
+output_energy                   = .false.        # compute and output acoustic and elastic energy (slows down the code significantly)
+output_wavefield_snapshot       = .true.         # output Ux,Uy,Uz text file for each output time (big files)
 
 # velocity and density models
 nbmodels                        = 4              # nb of different models

Modified: seismo/2D/SPECFEM2D/trunk/src/meshfem2D/read_parameter_file.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/meshfem2D/read_parameter_file.F90	2011-03-04 18:49:39 UTC (rev 18034)
+++ seismo/2D/SPECFEM2D/trunk/src/meshfem2D/read_parameter_file.F90	2011-03-04 19:25:55 UTC (rev 18035)
@@ -103,7 +103,7 @@
   logical :: meshvect,modelvect,boundvect,interpol
   integer :: pointsdisp,subsamp
   double precision :: sizemax_arrows
-  logical :: gnuplot,outputgrid,OUTPUT_ENERGY
+  logical :: gnuplot,output_grid,output_energy,output_wavefield_snapshot
   logical :: plot_lowerleft_corner_only
 
   ! to store density and velocity model
@@ -211,8 +211,9 @@
   call read_value_integer(IIN,IGNORE_JUNK,subsamp)
   call read_value_double_precision(IIN,IGNORE_JUNK,sizemax_arrows)
   call read_value_logical(IIN,IGNORE_JUNK,gnuplot)
-  call read_value_logical(IIN,IGNORE_JUNK,outputgrid)
-  call read_value_logical(IIN,IGNORE_JUNK,OUTPUT_ENERGY)
+  call read_value_logical(IIN,IGNORE_JUNK,output_grid)
+  call read_value_logical(IIN,IGNORE_JUNK,output_energy)
+  call read_value_logical(IIN,IGNORE_JUNK,output_wavefield_snapshot)
 
   ! read the different material materials
   call read_value_integer(IIN,IGNORE_JUNK,nb_materials)

Modified: seismo/2D/SPECFEM2D/trunk/src/meshfem2D/save_databases.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/meshfem2D/save_databases.f90	2011-03-04 18:49:39 UTC (rev 18034)
+++ seismo/2D/SPECFEM2D/trunk/src/meshfem2D/save_databases.f90	2011-03-04 19:25:55 UTC (rev 18035)
@@ -127,8 +127,8 @@
     write(15,*) 'assign_external_model READ_EXTERNAL_SEP_FILE'
     write(15,*) assign_external_model,READ_EXTERNAL_SEP_FILE
 
-    write(15,*) 'outputgrid OUTPUT_ENERGY TURN_ATTENUATION_ON'
-    write(15,*) outputgrid,OUTPUT_ENERGY,TURN_ATTENUATION_ON
+    write(15,*) 'output_grid output_energy output_wavefield_snapshot TURN_ATTENUATION_ON'
+    write(15,*) output_grid,output_energy,output_wavefield_snapshot,TURN_ATTENUATION_ON
 
     write(15,*) 'TURN_VISCATTENUATION_ON Q0 freq0'
     write(15,*) TURN_VISCATTENUATION_ON,Q0,freq0

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_databases.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_databases.f90	2011-03-04 18:49:39 UTC (rev 18034)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/read_databases.f90	2011-03-04 19:25:55 UTC (rev 18035)
@@ -51,7 +51,7 @@
                   meshvect,modelvect,boundvect,cutsnaps,subsamp,sizemax_arrows, &
                   anglerec,initialfield,add_Bielak_conditions, &
                   seismotype,imagetype,assign_external_model,READ_EXTERNAL_SEP_FILE, &
-                  outputgrid,OUTPUT_ENERGY,TURN_ATTENUATION_ON, &
+                  output_grid,output_energy,output_wavefield_snapshot,TURN_ATTENUATION_ON, &
                   TURN_VISCATTENUATION_ON,Q0,freq0,p_sv, &
                   NSTEP,deltat,NTSTEP_BETWEEN_OUTPUT_SEISMO,NSOURCES)
 
@@ -68,7 +68,7 @@
     output_color_image
   logical :: meshvect,modelvect,boundvect,initialfield,add_Bielak_conditions, &
     assign_external_model,READ_EXTERNAL_SEP_FILE, &
-    outputgrid,OUTPUT_ENERGY,p_sv
+    output_grid,output_energy,output_wavefield_snapshot,p_sv
   logical :: TURN_ATTENUATION_ON,TURN_VISCATTENUATION_ON
 
   double precision :: cutsnaps,sizemax_arrows,anglerec
@@ -154,7 +154,7 @@
   read(IIN,*) assign_external_model,READ_EXTERNAL_SEP_FILE
 
   read(IIN,"(a80)") datlin
-  read(IIN,*) outputgrid,OUTPUT_ENERGY,TURN_ATTENUATION_ON
+  read(IIN,*) output_grid,output_energy,output_wavefield_snapshot,TURN_ATTENUATION_ON
 
   read(IIN,"(a80)") datlin
   read(IIN,*) TURN_VISCATTENUATION_ON,Q0,freq0
@@ -169,7 +169,7 @@
     write(IOUT,700) seismotype,anglerec
     write(IOUT,750) initialfield,add_Bielak_conditions,assign_external_model,&
                     READ_EXTERNAL_SEP_FILE,TURN_ATTENUATION_ON, &
-                    outputgrid,OUTPUT_ENERGY
+                    output_grid,output_energy
     write(IOUT,800) imagetype,100.d0*cutsnaps,subsamp
   endif
 
@@ -217,8 +217,8 @@
   'Assign external model . . . .(assign_external_model) = ',l6/5x, &
   'Read external SEP file . . .(READ_EXTERNAL_SEP_FILE) = ',l6/5x, &
   'Turn attenuation on or off. . .(TURN_ATTENUATION_ON) = ',l6/5x, &
-  'Save grid in external file or not. . . .(outputgrid) = ',l6/5x, &
-  'Save a file with total energy or not.(OUTPUT_ENERGY) = ',l6)
+  'Save grid in external file or not. . . (output_grid) = ',l6/5x, &
+  'Save a file with total energy or not.(output_energy) = ',l6)
 
 800 format(//1x,'C o n t r o l',/1x,13('='),//5x, &
   'Vector display type . . . . . . . . . . .(imagetype) = ',i6/5x, &

Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90	2011-03-04 18:49:39 UTC (rev 18034)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90	2011-03-04 19:25:55 UTC (rev 18035)
@@ -454,8 +454,9 @@
     nelemabs,nelem_acoustic_surface,ispecabs,UPPER_LIMIT_DISPLAY
 
   logical interpol,meshvect,modelvect,boundvect,assign_external_model,initialfield, &
-    outputgrid,gnuplot,TURN_ATTENUATION_ON,output_postscript_snapshot,output_color_image, &
-    plot_lowerleft_corner_only,add_Bielak_conditions,OUTPUT_ENERGY,READ_EXTERNAL_SEP_FILE
+    output_grid,gnuplot,TURN_ATTENUATION_ON,output_postscript_snapshot,output_color_image, &
+    plot_lowerleft_corner_only,add_Bielak_conditions,output_energy,READ_EXTERNAL_SEP_FILE, &
+    output_wavefield_snapshot
 
   double precision :: cutsnaps,sizemax_arrows,anglerec,xirec,gammarec
 
@@ -588,8 +589,8 @@
   integer  :: nb_pixel_loc
   integer, dimension(:), allocatable  :: num_pixel_loc
 
-!!$! CHT
-!!$  character(len=150) :: wavefield_file
+! wavefield snapshot
+  character(len=150) :: wavefield_file
 
 #ifdef USE_MPI
   integer, dimension(MPI_STATUS_SIZE)  :: request_mpi_status
@@ -801,7 +802,7 @@
                   meshvect,modelvect,boundvect,cutsnaps,subsamp,sizemax_arrows, &
                   anglerec,initialfield,add_Bielak_conditions, &
                   seismotype,imagetype,assign_external_model,READ_EXTERNAL_SEP_FILE, &
-                  outputgrid,OUTPUT_ENERGY,TURN_ATTENUATION_ON, &
+                  output_grid,output_energy,output_wavefield_snapshot,TURN_ATTENUATION_ON, &
                   TURN_VISCATTENUATION_ON,Q0,freq0,p_sv, &
                   NSTEP,deltat,NTSTEP_BETWEEN_OUTPUT_SEISMO,NSOURCES)
 
@@ -1743,7 +1744,7 @@
 !
 !--- save the grid of points in a file
 !
-  if(outputgrid .and. myrank == 0 .and. ipass == 1) then
+  if(output_grid .and. myrank == 0 .and. ipass == 1) then
      write(IOUT,*)
      write(IOUT,*) 'Saving the grid in a text file...'
      write(IOUT,*)
@@ -3652,10 +3653,10 @@
   endif
 
 #ifdef USE_MPI
-  if(OUTPUT_ENERGY) stop 'energy calculation currently serial only, should add an MPI_REDUCE in parallel'
+  if(output_energy) stop 'energy calculation currently serial only, should add an MPI_REDUCE in parallel'
 #endif
 ! open the file in which we will store the energy curve
-  if(OUTPUT_ENERGY) open(unit=IOUT_ENERGY,file='energy.gnu',status='unknown')
+  if(output_energy) open(unit=IOUT_ENERGY,file='energy.gnu',status='unknown')
 
 !
 !----          s t a r t   t i m e   i t e r a t i o n s
@@ -5891,7 +5892,7 @@
   endif
 
 !----  compute kinetic and potential energy
-  if(OUTPUT_ENERGY) &
+  if(output_energy) &
      call compute_energy(displ_elastic,veloc_elastic, &
                         displs_poroelastic,velocs_poroelastic, &
                         displw_poroelastic,velocw_poroelastic, &
@@ -6555,24 +6556,26 @@
 
   endif
 
-!!$!----------------------------------------------
-!!$! CHT: write the full (local) wavefield to file as three components (Uy = 0 for PSV; Ux,Uz = 0 for SH)
-!!$
-!!$  write(wavefield_file,"('OUTPUT_FILES/wavefield',i7.7,'_',i2.2,'.txt')") it,SIMULATION_TYPE
-!!$  open(unit=27,file=wavefield_file,status='unknown')
-!!$  do ispec = 1,nspec
-!!$     do j = 1,NGLLZ
-!!$        do i = 1,NGLLX
-!!$           iglob = ibool(i,j,ispec)
-!!$           write(27,*) sngl(coord(1,iglob)),sngl(coord(2,iglob)),&
-!!$             sngl(vector_field_display(1,iglob)), &
-!!$             sngl(vector_field_display(2,iglob)), &
-!!$             sngl(vector_field_display(3,iglob))
-!!$        enddo
-!!$     enddo
-!!$  enddo
-!!$  close(27)
+!----------------------------------------------
+! write the full (local) wavefield to file as three components (Uy = 0 for PSV; Ux,Uz = 0 for SH)
 
+if (output_wavefield_snapshot) then
+  write(wavefield_file,"('OUTPUT_FILES/wavefield',i7.7,'_',i2.2,'_',i3.3,'.txt')") it,SIMULATION_TYPE,myrank
+  open(unit=27,file=wavefield_file,status='unknown')
+  do ispec = 1,nspec
+     do j = 1,NGLLZ
+        do i = 1,NGLLX
+           iglob = ibool(i,j,ispec)
+           write(27,'(5e16.6)') coord(1,iglob), coord(2,iglob), &
+             vector_field_display(1,iglob), &
+             vector_field_display(2,iglob), &
+             vector_field_display(3,iglob)
+        enddo
+     enddo
+  enddo
+  close(27)
+endif
+
 !
 !----  display color image
 !
@@ -6808,7 +6811,7 @@
   deallocate(t0z_bot)
 
 !----  close energy file and create a gnuplot script to display it
-  if(OUTPUT_ENERGY .and. myrank == 0) then
+  if(output_energy .and. myrank == 0) then
     close(IOUT_ENERGY)
     open(unit=IOUT_ENERGY,file='plotenergy',status='unknown')
     write(IOUT_ENERGY,*) 'set term postscript landscape color solid "Helvetica" 22'



More information about the CIG-COMMITS mailing list