[cig-commits] r19051 - in seismo/2D/SPECFEM2D/trunk/EXAMPLES: noise_layered noise_layered/masks noise_layered/model_0 noise_layered/model_1 noise_layered/model_2 noise_uniform noise_uniform/masks

rmodrak at geodynamics.org rmodrak at geodynamics.org
Sat Oct 8 14:57:32 PDT 2011


Author: rmodrak
Date: 2011-10-08 14:57:32 -0700 (Sat, 08 Oct 2011)
New Revision: 19051

Added:
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changemask
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changerec
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/getdirect
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/drillbit
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/uniform
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/SOURCE_noise
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_best
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/SOURCE_noise
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_best
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/SOURCE_noise
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_fair
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_good
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/changemask
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/nonuniform
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/uniform
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_negative_branch
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_positive_branch
Removed:
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/par_m2/
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/process.bash
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_1
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_2
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/ellipse_large
Modified:
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/adj_mask.f90
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_adj
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_fwd
   seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/process.sh
Log:
added noise exploration test case

Modified: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/adj_mask.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/adj_mask.f90	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/adj_mask.f90	2011-10-08 21:57:32 UTC (rev 19051)
@@ -14,20 +14,20 @@
 logical, parameter :: use_custom_window = .false.
 
 !choose whether to time reverse, carried out subsequent to all other processing
-logical, parameter :: time_reverse = .true.
+logical, parameter :: time_reverse = .false.
 
 
 
 ! FILTERING PARAMETERS
 real  freq_low,freq_high
-data  freq_low  / 2.d-4 /
-data  freq_high / 5.d-1 /
+data  freq_low  / 1.d-2 /
+data  freq_high / 1.5d1 /
 
-! WINDOW PARAMETERS
+! CUSTOM WINDOW PARAMETERS
 real :: t_begin, t_end, w_tukey
-data t_begin / 45.d0  /
+data t_begin / 45.d0 /
 data t_end   / 65.d0 /
-data w_tukey / 0.4    /
+data w_tukey / 0.4   /
 !see explanation below
 
 ! time variables
@@ -145,17 +145,25 @@
   it_end   = ceiling((t_end - t(1))/dt)
   if (it_begin < 1) it_begin = 1
   if (it_end > nt) it_end = nt
+
 elseif (use_positive_branch) then
   write(*,*) 'Choosing positive branch'
-  it_begin = nthalf+1
+  it_begin = nthalf + floor(off/dt)
   it_end   = nt
+  if (it_begin < nthalf) it_begin = nthalf
+  if (it_end > nt) it_end = nt
+
 elseif (use_negative_branch) then
   write(*,*) 'Choosing negative branch'
   it_begin = 1
-  it_end   = nthalf
+  it_end   = nthalf - floor(off/dt)
+  if (it_begin < 1) it_begin = 1
+  if (it_end > nthalf) it_end = nthalf
+
 else
   write(*,*) 'Must select one of the following: positive_branch, &
               negative_branch, custom_window.'
+
 endif
 
 write(*,'(a,2f10.3)') ' Time range: ', t(1), t(nt)
@@ -163,6 +171,7 @@
 write(*,'(a,f10.3,f10.3)') ' Filtering:  ', 1./freq_high, 1./freq_low
 
 !! Tukey taper
+alpha = w_tukey
 k=0
 do it = it_begin,it_end
   k=k+1
@@ -183,7 +192,8 @@
 
 
 !!!!!!!!!! NORMALIZE !!!!!!!!!!!!!!!!!!!!
-seismo_adj = - seismo_4/(DOT_PRODUCT(seismo_4,seismo_4)*dt)
+seismo_adj = - seismo_4/(DOT_PRODUCT(seismo_1,seismo_1)*dt)
+!seismo_adj = w
 
 !!!!!!!!!! WRITE ADJOINT SOURCE !!!!!!!!!!!!!!!!!!!!
 open(unit=1002,file=trim(filename)//'.adj',status='unknown',iostat=ios)

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changemask
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changemask	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changemask	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+codefile=../../src/specfem2D/noise_tomography.f90
+
+cd masks
+select maskfile in `find -type f`
+do
+case $maskfile in
+    *) echo $maskfile; break;;
+esac
+done
+cd ..
+
+
+line1=`grep -n '^[ \t]*subroutine create_mask_noise' $codefile | cut -d':' -f1`
+line2=`grep -n '^[ \t]*end subroutine create_mask_noise' $codefile | cut -d':' -f1`
+
+if [ `echo $line1 | wc -l` -ne 1 ]; then echo "Error reading noise_tomography.f90"; exit 1; fi
+if [ `echo $line2 | wc -l` -ne 1 ]; then echo "Error reading noise_tomography.f90"; exit 2; fi
+if [ ! -n "$line1" ]; then echo "Error reading noise_tomography.f90"; exit 3; fi
+if [ ! -n "$line2" ]; then echo "Error reading noise_tomography.f90"; exit 4; fi
+
+awk -vline1=$line1 '{if (NR < line1) print $0}' < $codefile > temp1
+awk -vline2=$line2 '{if (NR > line2) print $0}' < $codefile > temp2
+
+cat temp1 masks/$maskfile temp2 > $codefile
+rm temp?


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changemask
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changerec
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changerec	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changerec	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+if [ $# -ne 2 ]; then echo "Usage:  change_rec  dir  nrec"; exit 1; fi
+if [ ! -d $1 ];  then echo "Directory not found: $1"; exit 1; fi
+if [ $2 -lt 1 ]; then echo "Need at least 1 receiver."; exit 1; fi
+
+DIR=$1
+NREC=$2
+
+cd $DIR
+
+for file in `ls Par_file*`
+do
+
+    echo $file
+
+    Line1=`grep "^nrec\s" $file`
+
+    if [ `echo $Line1 | wc -l` -ne 1 ]; then echo "Error reading file: $file."; exit 1; fi
+
+    sed -i -e "s:${Line1}:nrec                            = ${NREC}:"  $file
+
+done
+
+
+


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/changerec
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/getdirect
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/getdirect	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/getdirect	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,10 @@
+#!/bin/sh
+NREC=$1
+ISRC=$2
+IREC=$3
+
+XINC=`echo "scale=3; (2000-300)/($NREC-1)" | bc`
+IOFF=`echo "scale=0; $IREC - $ISRC" | bc`
+XOFF=`echo "scale=3; $IOFF*$XINC" | bc`
+TOFF=`echo "scale=3; ($XOFF)/1300" | bc`
+echo $TOFF


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/getdirect
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/drillbit
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/drillbit	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/drillbit	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,26 @@
+  subroutine create_mask_noise(nglob,coord,mask_noise)
+
+  implicit none
+  include "constants.h"
+
+  !input
+  integer :: nglob
+  real(kind=CUSTOM_REAL), dimension(2,nglob) :: coord
+
+  !output
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mask_noise
+
+  !local
+  integer :: iglob
+  real(kind=CUSTOM_REAL) :: xx,zz
+
+  !specify distribution of noise sources as a function of xx, zz
+  do iglob = 1,nglob
+    xx = coord(1,iglob)
+    zz = coord(2,iglob)
+
+    mask_noise(iglob) = 1.e24 * 30.5577 * exp(-((xx-1250.)**2 + (zz-750)**2)/(2.*150**2) )
+
+  enddo
+
+  end subroutine create_mask_noise

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/uniform
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/uniform	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/masks/uniform	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,28 @@
+  subroutine create_mask_noise(nglob,coord,mask_noise)
+
+  implicit none
+  include "constants.h"
+
+  !input
+  integer :: nglob
+  real(kind=CUSTOM_REAL), dimension(2,nglob) :: coord
+
+  !output
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mask_noise
+
+  !local
+  integer :: iglob
+  real(kind=CUSTOM_REAL) :: xx,zz
+
+  !specify distribution of noise sources as a function of xx, zz
+  do iglob = 1,nglob
+    xx = coord(1,iglob)
+    zz = coord(2,iglob)
+
+    !below, the noise is assumed to be uniform; users are free to
+    !to change this expression to one involving xx, zz
+    mask_noise(iglob) = 1.
+
+  enddo
+
+  end subroutine create_mask_noise

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,116 @@
+# title of job
+title                           = Passive Imaging - 0 Interfaces
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29
+xdeb                            = 150.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 1850.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 1              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2000.d0        # abscissa of right side of the model
+nx                              = 40             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 1              # nb of regions and model number for each
+1 40  1 30 1

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/Par_file_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,116 @@
+s# title of job
+4itle                           = Passive Imaging - 0 Interfaces
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29
+xdeb                            = 400.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 2100.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 1              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2500.d0        # abscissa of right side of the model
+nx                              = 50             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 1              # nb of regions and model number for each
+1 50  1 30 1

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/SOURCE_noise
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/SOURCE_noise	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/SOURCE_noise	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,13 @@
+#source 1.  The components of a moment tensor source must be given in N.m, not in dyne.cm as in the DATA/CMTSOLUTION source file of the 3D version of the code.
+source_surf                     = .false.        # source inside the medium or at the surface
+xs                              = 0.
+zs                              = 0.
+source_type                     = 1              # elastic force or acoustic pressure = 1 or moment tensor = 2
+time_function_type              = 3              # Ricker = 1, first derivative = 2, Gaussian = 3, Dirac = 4, Heaviside = 5
+f0                              = 10.0           # dominant source frequency (Hz) if not Dirac or Heaviside
+tshift                          = 0.0            # time shift when multi sources (if one source, must be zero)
+angleforce                      = 0.             # angle of the source (for a force only)
+Mxx                             = 0.d0           # Mxx component (for a moment tensor source only)
+Mzz                             = 0.d0           # Mzz component (for a moment tensor source only)
+Mxz                             = 0.d0           # Mxz component (for a moment tensor source only)
+factor                          = 0.d0          # amplification factor

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,26 @@
+#
+# number of interfaces
+#
+ 2
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2000 0
+#
+# interface number 2 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2000 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1
+#
+ 30

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_0/interfaces_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,26 @@
+#
+# number of interfaces
+#
+ 2
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2500 0
+#
+# interface number 2 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2500 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1
+#
+ 30

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_best
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_best	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_best	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,118 @@
+# title of job
+title                           = PASSIVE IMAGING - 1 INTERFACE
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29
+xdeb                            = 400.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 2100.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 2              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2700.d0 3000.d0 1732.051d0 0 0 9999 9999 0 0 0 0 0 0
+2 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2500.d0        # abscissa of right side of the model
+nx                              = 50             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 2              # nb of regions and model number for each
+1 50  1 15 1
+1 50 16 40 2

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,118 @@
+# title of job
+title                           = PASSIVE IMAGING - 1 INTERFACE
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29
+xdeb                            = 150.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 1850.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 2              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2700.d0 3000.d0 1732.051d0 0 0 9999 9999 0 0 0 0 0 0
+2 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2000.d0        # abscissa of right side of the model
+nx                              = 40             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 2              # nb of regions and model number for each
+1 40  1 15 1
+1 40 16 30 2

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/Par_file_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,118 @@
+# title of job
+title                           = PASSIVE IMAGING - 1 INTERFACE
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29
+xdeb                            = 400.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 2100.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 2              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2700.d0 3000.d0 1732.051d0 0 0 9999 9999 0 0 0 0 0 0
+2 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2500.d0        # abscissa of right side of the model
+nx                              = 50             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 2              # nb of regions and model number for each
+1 50  1 15 1
+1 50 16 30 2

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/SOURCE_noise
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/SOURCE_noise	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/SOURCE_noise	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,13 @@
+#source 1.  The components of a moment tensor source must be given in N.m, not in dyne.cm as in the DATA/CMTSOLUTION source file of the 3D version of the code.
+source_surf                     = .false.        # source inside the medium or at the surface
+xs                              = 0.
+zs                              = 0.
+source_type                     = 1              # elastic force or acoustic pressure = 1 or moment tensor = 2
+time_function_type              = 3              # Ricker = 1, first derivative = 2, Gaussian = 3, Dirac = 4, Heaviside = 5
+f0                              = 10.0           # dominant source frequency (Hz) if not Dirac or Heaviside
+tshift                          = 0.0            # time shift when multi sources (if one source, must be zero)
+angleforce                      = 0.             # angle of the source (for a force only)
+Mxx                             = 0.d0           # Mxx component (for a moment tensor source only)
+Mzz                             = 0.d0           # Mzz component (for a moment tensor source only)
+Mxz                             = 0.d0           # Mxz component (for a moment tensor source only)
+factor                          = 0.d0          # amplification factor

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_best
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_best	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_best	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,36 @@
+#
+# number of interfaces
+#
+ 3
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2500 0
+#
+# interface number 2
+#
+ 2
+    0  750
+ 2500  750
+#
+# interface number 3 (topography, top of the mesh)
+#
+ 2
+    0 2000
+ 2500 2000
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1 (bottom layer)
+#
+ 15
+#
+# layer number 2 (top layer)
+#
+ 25

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,36 @@
+#
+# number of interfaces
+#
+ 3
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2000 0
+#
+# interface number 2
+#
+ 2
+    0  750
+ 2000  750
+#
+# interface number 3 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2000 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1 (bottom layer)
+#
+ 15
+#
+# layer number 2 (top layer)
+#
+ 15

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_1/interfaces_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,36 @@
+#
+# number of interfaces
+#
+ 3
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2500 0
+#
+# interface number 2
+#
+ 2
+    0  750
+ 2500  750
+#
+# interface number 3 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2500 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1 (bottom layer)
+#
+ 15
+#
+# layer number 2 (top layer)
+#
+ 15

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,120 @@
+# title of job
+title                           = PASSIVE IMAGING - 2 INTERFACES
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29             # number of receivers
+xdeb                            = 150.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 1850.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 3              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2700.d0 3000.d0 1732.051d0 0 0 9999 9999 0 0 0 0 0 0
+2 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+3 1 2200.d0 2500.d0 1443.375d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2000.d0        # abscissa of right side of the model
+nx                              = 40             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 3              # nb of regions and model number for each
+1 40  1 10 1
+1 40 11 20 2
+1 40 21 30 3

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/Par_file_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,120 @@
+# title of job
+title                           = PASSIVE IMAGING - 2 INTERFACES
+
+# forward or adjoint simulation
+SIMULATION_TYPE                 = 1
+NOISE_TOMOGRAPHY                = 1
+SAVE_FORWARD                    = .false.
+
+# parameters concerning partitioning
+nproc                           = 1              # number of processes
+partitioning_method             = 3              # SCOTCH = 3, ascending order (very bad idea) = 1
+
+ngnod                           = 9              # number of control nodes per element (4 or 9)
+initialfield                    = .false.        # use a plane wave as source or not
+add_Bielak_conditions           = .false.        # add Bielak conditions or not if initial plane wave
+assign_external_model           = .false.        # define external earth model or not
+READ_EXTERNAL_SEP_FILE          = .false.        # Read external SEP file from DATA/model_velocity.dat_input, or use routine
+TURN_ATTENUATION_ON             = .false.        # turn attenuation on or off for solid medium
+TURN_VISCATTENUATION_ON         = .false.        # turn viscous attenuation on or off
+Q0                              =  1             # quality factor for viscous attenuation
+freq0                           =  10            # frequency for viscous attenuation
+p_sv                            = .false.        # set the type of calculation (P-SV or SH/membrane waves)
+
+# time step parameters
+nt                              = 3000           # total number of time steps
+deltat                          = 1.d-3          # duration of a time step
+
+# source parameters
+NSOURCES                        = 1              # number of sources [source info read in CMTSOLUTION file]
+force_normal_to_surface         = .false.        # angleforce normal to surface (external mesh and curve file needed)
+
+# constants for attenuation
+N_SLS                           = 2                      # number of standard linear solids for attenuation
+f0_attenuation                  = 5.196152422706633      # (Hz) relevant only if source is a Dirac or a Heaviside, else it is f0
+
+# receiver line parameters for seismograms
+seismotype                      = 1              # record 1=displ 2=veloc 3=accel 4=pressure
+generate_STATIONS               = .true.         # creates a STATION file in ./DATA
+nreceiverlines                  = 1              # number of receiver lines
+anglerec                        = 0.d0           # angle to rotate components at receivers
+rec_normal_to_surface           = .false.        # base anglerec normal to surface (external mesh and curve file needed)
+
+# first receiver line (repeat these 6 lines and adjust nreceiverlines accordingly)
+nrec                            = 29             # number of receivers
+xdeb                            = 400.           # first receiver x in meters
+zdeb                            = 1500.          # first receiver z in meters
+xfin                            = 2100.          # last receiver x in meters (ignored if onlyone receiver)
+zfin                            = 1500.          # last receiver z in meters (ignored if onlyone receiver)
+enreg_surf_same_vertical        = .true.         # receivers inside the medium or at the surface
+
+# display parameters
+NTSTEP_BETWEEN_OUTPUT_INFO      = 250            # display frequency in time steps
+output_postscript_snapshot      = .false.        # output Postscript snapshot of the results
+output_color_image              = .false.        # output color image of the results
+imagetype                       = 1              # display 1=displ 2=veloc 3=accel 4=pressure
+cutsnaps                        = 1.             # minimum amplitude in % for snapshots
+meshvect                        = .true.         # display mesh on vector plots or not
+modelvect                       = .false.        # display velocity model on vector plots
+boundvect                       = .true.         # display boundary conditions on plots
+interpol                        = .true.         # interpolation of the display or not
+pointsdisp                      = 6              # points for interpolation of display (set to 1 for lower-left corner only)
+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
+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       = .false.         # output Ux,Uy,Uz text file for each output time (big files)
+
+# velocity and density models
+nbmodels                        = 3              # nb of different models
+# define models as
+# I:   (model_number 1 rho Vp Vs 0 0 Qp Qs 0 0 0 0 0 0) or
+# II:  (model_number 2 rho c11 c13 c15 c33 c35 c55 0 0 0 0 0 0) or
+# III: (model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qs).
+# For istropic elastic/acoustic material use I and set Vs to zero to make a given model acoustic, for anisotropic elastic use II,
+# and for isotropic poroelastic material use III. The mesh can contain acoustic, elastic, and poroelastic models simultaneously.
+1 1 2700.d0 3000.d0 1732.051d0 0 0 9999 9999 0 0 0 0 0 0
+2 1 2500.d0 2700.d0 1600.000d0 0 0 9999 9999 0 0 0 0 0 0
+3 1 2200.d0 2500.d0 1443.375d0 0 0 9999 9999 0 0 0 0 0 0
+
+# external mesh or not
+read_external_mesh              = .false.
+
+# absorbing boundary active or not
+absorbing_conditions            = .true.
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR EXTERNAL MESHING
+
+# data concerning mesh, when generated using third-party app (more info in README)
+# (see also absorbing_conditions above)
+mesh_file                       = ./DATA/Mesh_canyon/canyon_mesh_file   # file containing the mesh
+nodes_coords_file               = ./DATA/Mesh_canyon/canyon_nodes_coords_file   # file containing the nodes coordinates
+materials_file                  = ./DATA/Mesh_canyon/canyon_materials_file   # file containing the material number for each element
+free_surface_file               = ./DATA/Mesh_canyon/canyon_free_surface_file   # file containing the free surface
+absorbing_surface_file          = ./DATA/Mesh_canyon/canyon_absorbing_surface_file   # file containing the absorbing surface
+tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model
+
+#-----------------------------------------------------------------------------
+# PARAMETERS FOR INTERNAL MESHING
+
+# file containing interfaces for internal mesh
+interfacesfile                  = interfaces.dat
+
+# geometry of the model (origin lower-left corner = 0,0) and mesh description
+xmin                            = 0.d0           # abscissa of left side of the model
+xmax                            = 2500.d0        # abscissa of right side of the model
+nx                              = 50             # number of elements along X
+
+# absorbing boundary parameters (see absorbing_conditions above)
+absorbbottom                    = .true.
+absorbright                     = .true.
+absorbtop                       = .false.
+absorbleft                      = .true.
+
+# define the different regions of the model in the (nx,nz) spectral element mesh
+nbregions                       = 3              # nb of regions and model number for each
+1 50  1 10 1
+1 50 11 20 2
+1 50 21 30 3

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/SOURCE_noise
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/SOURCE_noise	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/SOURCE_noise	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,13 @@
+#source 1.  The components of a moment tensor source must be given in N.m, not in dyne.cm as in the DATA/CMTSOLUTION source file of the 3D version of the code.
+source_surf                     = .false.        # source inside the medium or at the surface
+xs                              = 0.
+zs                              = 0.
+source_type                     = 1              # elastic force or acoustic pressure = 1 or moment tensor = 2
+time_function_type              = 3              # Ricker = 1, first derivative = 2, Gaussian = 3, Dirac = 4, Heaviside = 5
+f0                              = 10.0           # dominant source frequency (Hz) if not Dirac or Heaviside
+tshift                          = 0.0            # time shift when multi sources (if one source, must be zero)
+angleforce                      = 0.             # angle of the source (for a force only)
+Mxx                             = 0.d0           # Mxx component (for a moment tensor source only)
+Mzz                             = 0.d0           # Mzz component (for a moment tensor source only)
+Mxz                             = 0.d0           # Mxz component (for a moment tensor source only)
+factor                          = 0.d0          # amplification factor

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_fair
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_fair	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_fair	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,46 @@
+#
+# number of interfaces
+#
+ 4
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2000 0
+#
+# interface number 2
+#
+ 2
+    0  500
+ 2000  500
+#
+# interface number 3
+#
+ 2
+    0 1000
+ 2000 1000
+#
+# interface number 4 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2000 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1 (bottom layer)
+#
+ 10
+#
+# layer number 2
+#
+ 10
+#
+# layer number 3 (top layer)
+#
+ 10

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_good
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_good	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/model_2/interfaces_good	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,46 @@
+#
+# number of interfaces
+#
+ 4
+#
+# for each interface below, we give the number of points and then x,z for each point
+#
+#
+# interface number 1 (bottom of the mesh)
+#
+ 2
+ 0 0
+ 2500 0
+#
+# interface number 2
+#
+ 2
+    0  500
+ 2500  500
+#
+# interface number 3
+#
+ 2
+    0 1000
+ 2500 1000
+#
+# interface number 4 (topography, top of the mesh)
+#
+ 2
+    0 1500
+ 2500 1500
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+#
+#
+# layer number 1 (bottom layer)
+#
+ 10
+#
+# layer number 2
+#
+ 10
+#
+# layer number 3 (top layer)
+#
+ 10

Deleted: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/process.bash
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/process.bash	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/process.bash	2011-10-08 21:57:32 UTC (rev 19051)
@@ -1,5 +0,0 @@
-!#/bin/bash
-
-cd drillbit
-../run_fwd 29 15
-../run_adj 29 15

Modified: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_adj
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_adj	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_adj	2011-10-08 21:57:32 UTC (rev 19051)
@@ -2,13 +2,17 @@
 #
 # noise tomography simulation 3
 #
+
+if [ $# -ne 2 ]; then echo "Usage:  run_adj  nrec  irec"; exit 1; fi
+
+
 NREC=$1
 IREC=$2
 ISRC=$IREC
 
 rm log.*
 rm DATA/Par_file
-rm OUTPUT_FILES/image*
+#rm OUTPUT_FILES/image*
 rm OUTPUT_FILES/*.semd
 
 
@@ -23,7 +27,7 @@
     WF_DIR=`printf ../../WF_DIR/noise_cc_%02d/step_2/ $IREC`
     YTRACE=`printf "S%04d.AA.BXY" $ii`
     cp ../OUTPUT_ALL/step_2/$YTRACE.semd .
-    TOFF=`../../get_time $NREC $ISRC $ii` 
+    TOFF=`../../getdirect $NREC $ISRC $ii` 
     ../adj_run $YTRACE.semd $TOFF >> ../log.adj
     rename '.semd' '' $YTRACE.semd.adj
 

Modified: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_fwd
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_fwd	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_layered/run_fwd	2011-10-08 21:57:32 UTC (rev 19051)
@@ -3,6 +3,9 @@
 # runs first and second noise tomography simulations
 #
 
+if [ $# -ne 2 ]; then echo "Usage:  run_fwd  nrec  irec"; exit 1; fi
+
+
 NREC=$1
 IREC=$2
 
@@ -16,7 +19,7 @@
 
 
 # prepare files
-../change_rec . $NREC &> /dev/null
+../changerec . $NREC &> /dev/null
 
 cp SOURCE_noise DATA/SOURCE
 cp interfaces*  DATA/

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/changemask
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/changemask	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/changemask	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+codefile=../../src/specfem2D/noise_tomography.f90
+
+cd masks
+select maskfile in `find -type f`
+do
+case $maskfile in
+    *) echo $maskfile; break;;
+esac
+done
+cd ..
+
+
+line1=`grep -n '^[ \t]*subroutine create_mask_noise' $codefile | cut -d':' -f1`
+line2=`grep -n '^[ \t]*end subroutine create_mask_noise' $codefile | cut -d':' -f1`
+
+if [ `echo $line1 | wc -l` -ne 1 ]; then echo "Error reading noise_tomography.f90"; exit 1; fi
+if [ `echo $line2 | wc -l` -ne 1 ]; then echo "Error reading noise_tomography.f90"; exit 2; fi
+if [ ! -n "$line1" ]; then echo "Error reading noise_tomography.f90"; exit 3; fi
+if [ ! -n "$line2" ]; then echo "Error reading noise_tomography.f90"; exit 4; fi
+
+awk -vline1=$line1 '{if (NR < line1) print $0}' < $codefile > temp1
+awk -vline2=$line2 '{if (NR > line2) print $0}' < $codefile > temp2
+
+cat temp1 masks/$maskfile temp2 > $codefile
+rm temp?


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/changemask
___________________________________________________________________
Name: svn:executable
   + *

Deleted: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_1
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_1	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_1	2011-10-08 21:57:32 UTC (rev 19051)
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-
-RUN_DIR=$PWD
-
-
-#prepare directories
-rm -rf   DATA SEM OUTPUT_FILES OUTPUT_ALL
-mkdir -p DATA SEM OUTPUT_FILES OUTPUT_ALL DATA/NOISE_TOMOGRAPHY OUTPUT_FILES/NOISE_TOMOGRAPHY
-
-
-#prepare files
-cp SOURCE_noise           DATA/SOURCE
-cp STATIONS_target_noise  DATA/STATIONS_target
-cp uniform.dat            DATA/
-echo 1 >                  DATA/NOISE_TOMOGRAPHY/irec_master
-if [ -f S_squared ]; then cp S_squared DATA/NOISE_TOMOGRAPHY/; fi
-if [ -f model_velocity.dat_input ]; then cp model_velocity.dat_input DATA/; fi
-
-
-#compile
-rm xmshefem2D
-rm xspecfem2D
-cd ../..
-make
-cd $RUN_DIR
-ln -s ../../bin/xmeshfem2D .
-ln -s ../../bin/xspecfem2D .
-
-
-#simulation 1
-cp Par_file_noise_1  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_1
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_1
-mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_1
-mv DATA/Par_file           OUTPUT_ALL/step_1
-mv OUTPUT_FILES/mask_noise OUTPUT_ALL/
-mv OUTPUT_FILES/mesh_????  OUTPUT_ALL/
-
-
-#simulation 2
-cp Par_file_noise_2  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_2
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_2
-mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_2
-mv DATA/Par_file           OUTPUT_ALL/step_2
-
-
-#prepare adjoint source
-ADJ_CODE=adj_cc.f90
-sed -i'.bak' 's/use_positive_branch = .[a-z]*./use_positive_branch = .true./' $ADJ_CODE
-sed -i'.bak' 's/use_negative_branch = .[a-z]*./use_negative_branch = .false./' $ADJ_CODE
-sed -i'.bak' 's/use_custom_window = .[a-z]*./use_custom_window = .false./' $ADJ_CODE
-sed -i'.bak' 's/time_reverse = .[a-z]*./time_reverse = .false./' $ADJ_CODE
-
-gfortran $ADJ_CODE -o adj_run
-cp OUTPUT_ALL/step_2/*.semd SEM/
-./adj_run SEM/S0003.AA.BXY.semd
-
-cd SEM
-rename '.semd' '' *.adj
-awk '{printf(" %20.10f %20.10f\n",$1,0.)}' < S0003.AA.BXY.adj > ZEROS
-cp ZEROS S0001.AA.BXX.adj; cp ZEROS S0001.AA.BXY.adj; cp ZEROS S0001.AA.BXZ.adj
-cp ZEROS S0002.AA.BXX.adj; cp ZEROS S0002.AA.BXY.adj; cp ZEROS S0002.AA.BXZ.adj
-cp ZEROS S0003.AA.BXX.adj; cp ZEROS S0003.AA.BXZ.adj
-cd ..
-
-
-#simulation 3
-cp Par_file_noise_3  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_3
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_3
-mv SEM/*Y.adj              OUTPUT_ALL/step_3
-mv OUTPUT_FILES/proc*      OUTPUT_ALL/step_3
-mv DATA/Par_file           OUTPUT_ALL/step_3
-mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
-

Deleted: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_2
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_2	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/contribution_2	2011-10-08 21:57:32 UTC (rev 19051)
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-
-RUN_DIR=$PWD
-
-
-#prepare directories
-rm -rf   DATA SEM OUTPUT_FILES OUTPUT_ALL
-mkdir -p DATA SEM OUTPUT_FILES OUTPUT_ALL DATA/NOISE_TOMOGRAPHY OUTPUT_FILES/NOISE_TOMOGRAPHY
-
-
-#prepare files
-cp SOURCE_noise           DATA/SOURCE
-cp STATIONS_target_noise  DATA/STATIONS_target
-cp uniform.dat            DATA/
-echo 3 >                  DATA/NOISE_TOMOGRAPHY/irec_master
-if [ -f S_squared ]; then cp S_squared DATA/NOISE_TOMOGRAPHY/; fi
-if [ -f model_velocity.dat_input ]; then cp model_velocity.dat_input DATA/; fi
-
-
-#compile
-rm xmshefem2D
-rm xspecfem2D
-cd ../..
-make
-cd $RUN_DIR
-ln -s ../../bin/xmeshfem2D .
-ln -s ../../bin/xspecfem2D .
-
-
-#simulation 1
-cp Par_file_noise_1  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_1
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_1
-mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_1
-mv DATA/Par_file           OUTPUT_ALL/step_1
-mv OUTPUT_FILES/mask_noise OUTPUT_ALL/
-#mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
-
-
-#simulation 2
-cp Par_file_noise_2  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_2
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_2
-mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_2
-mv DATA/Par_file           OUTPUT_ALL/step_2
-#mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
-
-
-#prepare adjoint source
-ADJ_CODE=adj_cc.f90
-sed -i'.bak' 's/use_positive_branch = .[a-z]*./use_positive_branch = .false./' $ADJ_CODE
-sed -i'.bak' 's/use_negative_branch = .[a-z]*./use_negative_branch = .true./' $ADJ_CODE
-sed -i'.bak' 's/use_custom_window = .[a-z]*./use_custom_window = .false./' $ADJ_CODE
-sed -i'.bak' 's/time_reverse = .[a-z]*./time_reverse = .false./' $ADJ_CODE
-
-gfortran $ADJ_CODE -o adj_run
-cp OUTPUT_ALL/step_2/*.semd SEM/
-./adj_run SEM/S0001.AA.BXY.semd
-
-cd SEM
-rename '.semd' '' *.adj
-awk '{printf(" %20.10f %20.10f\n",$1,0.)}' < S0001.AA.BXY.adj > ZEROS
-cp ZEROS S0001.AA.BXX.adj; cp ZEROS S0001.AA.BXZ.adj
-cp ZEROS S0002.AA.BXX.adj; cp ZEROS S0002.AA.BXY.adj; cp ZEROS S0002.AA.BXZ.adj
-cp ZEROS S0003.AA.BXX.adj; cp ZEROS S0003.AA.BXY.adj; cp ZEROS S0003.AA.BXZ.adj
-cd ..
-
-
-#simulation 3
-cp Par_file_noise_3  DATA/Par_file
-./xmeshfem2D; ./xspecfem2D
-mkdir OUTPUT_ALL/step_3
-#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_3
-mv SEM/*Y.adj              OUTPUT_ALL/step_3
-mv OUTPUT_FILES/proc*      OUTPUT_ALL/step_3
-mv DATA/Par_file           OUTPUT_ALL/step_3
-mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
-

Deleted: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/ellipse_large
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/ellipse_large	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/ellipse_large	2011-10-08 21:57:32 UTC (rev 19051)
@@ -1,42 +0,0 @@
-! =============================================================================================================
-! specify spatial distribution of microseismic noise sources
-! USERS need to modify this subroutine to suit their own needs
-  subroutine create_mask_noise(nglob,coord,mask_noise)
-
-  implicit none
-  include "constants.h"
-
-  !input
-  integer :: nglob
-  real(kind=CUSTOM_REAL), dimension(2,nglob) :: coord
-
-  !output
-  real(kind=CUSTOM_REAL), dimension(nglob) :: mask_noise
-
-  !local
-  integer :: iglob
-  real(kind=CUSTOM_REAL) :: xx,zz,aa,phi
-
-  aa = PI/8.
-
-  !specify distribution of noise sources as a function of xx, zz
-  do iglob = 1,nglob
-    xx = coord(1,iglob)
-    zz = coord(2,iglob)
-
-    phi = (((xx-105.e3)*cos(aa)+(zz-92.e3)*sin(aa))/28.e3)**2. + &
-          (((xx-105.e3)*sin(aa)-(zz-92.e3)*cos(aa))/20.e3)**2. 
-
-    if (phi < 0.9) then
-        mask_noise(iglob) = 1.
-    elseif (phi < 1.1) then
-        mask_noise(iglob) = 0.5*(1.+cos(5.*PI*(phi/1.1-0.8)))
-    else
-        mask_noise(iglob) = 0.
-    endif
-
-
-  enddo
-
-  end subroutine create_mask_noise
-

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/nonuniform
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/nonuniform	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/nonuniform	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,38 @@
+  subroutine create_mask_noise(nglob,coord,mask_noise)
+
+  implicit none
+  include "constants.h"
+
+  !input
+  integer :: nglob
+  real(kind=CUSTOM_REAL), dimension(2,nglob) :: coord
+
+  !output
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mask_noise
+
+  !local
+  integer :: iglob
+  real(kind=CUSTOM_REAL) :: xx,zz,aa,phi
+
+  aa = PI/8.
+
+  !specify distribution of noise sources as a function of xx, zz
+  do iglob = 1,nglob
+    xx = coord(1,iglob)
+    zz = coord(2,iglob)
+
+    phi = (((xx-105.e3)*cos(aa)+(zz-92.e3)*sin(aa))/28.e3)**2. + &
+          (((xx-105.e3)*sin(aa)-(zz-92.e3)*cos(aa))/20.e3)**2. 
+
+    if (phi < 0.9) then
+        mask_noise(iglob) = 1.
+    elseif (phi < 1.1) then
+        mask_noise(iglob) = 0.5*(1.+cos(5.*PI*(phi/1.1-0.8)))
+    else
+        mask_noise(iglob) = 0.
+    endif
+
+
+  enddo
+
+  end subroutine create_mask_noise

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/uniform
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/uniform	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/masks/uniform	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,28 @@
+  subroutine create_mask_noise(nglob,coord,mask_noise)
+
+  implicit none
+  include "constants.h"
+
+  !input
+  integer :: nglob
+  real(kind=CUSTOM_REAL), dimension(2,nglob) :: coord
+
+  !output
+  real(kind=CUSTOM_REAL), dimension(nglob) :: mask_noise
+
+  !local
+  integer :: iglob
+  real(kind=CUSTOM_REAL) :: xx,zz
+
+  !specify distribution of noise sources as a function of xx, zz
+  do iglob = 1,nglob
+    xx = coord(1,iglob)
+    zz = coord(2,iglob)
+
+    !below, the noise is assumed to be uniform; users are free to
+    !to change this expression to one involving xx, zz
+    mask_noise(iglob) = 1.0
+
+  enddo
+
+  end subroutine create_mask_noise

Modified: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/process.sh
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/process.sh	2011-10-08 01:09:46 UTC (rev 19050)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/process.sh	2011-10-08 21:57:32 UTC (rev 19051)
@@ -1,8 +1,10 @@
 #!/bin/bash
 
-./contribution_1
-mv OUTPUT_ALL OUTPUT_ALL_1
+#reproduce results from Tromp et al. 2010
 
-./contribution_2
-mv OUTPUT_ALL OUTPUT_ALL_2
+./use_negative_branch 3 1
+mv OUTPUT_ALL CBA_NEG
 
+./use_positive_branch 1 3
+mv OUTPUT_ALL CAB_POS
+

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_negative_branch
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_negative_branch	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_negative_branch	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then echo "USAGE:  use_negative_branch  slave  master"; exit; fi
+
+RUNDIR=$PWD
+SLAVE=$1
+MASTER=$2
+TRACE=`printf 'S%04d.AA.BXY.semd' $SLAVE`
+ADJCC='adj_cc.f90'
+
+
+#prepare directories
+rm -rf   DATA SEM OUTPUT_FILES OUTPUT_ALL
+mkdir -p DATA SEM OUTPUT_FILES OUTPUT_ALL DATA/NOISE_TOMOGRAPHY OUTPUT_FILES/NOISE_TOMOGRAPHY
+
+
+#prepare files
+cp SOURCE_noise           DATA/SOURCE
+cp STATIONS_target_noise  DATA/STATIONS_target
+cp uniform.dat            DATA/
+echo $MASTER >            DATA/NOISE_TOMOGRAPHY/irec_master
+if [ -f S_squared ]; then cp S_squared DATA/NOISE_TOMOGRAPHY/; fi
+if [ -f model_velocity.dat_input ]; then cp model_velocity.dat_input DATA/; fi
+
+
+#compile
+rm xmshefem2D
+rm xspecfem2D
+cd ../..
+make
+cd $RUNDIR
+ln -s ../../bin/xmeshfem2D .
+ln -s ../../bin/xspecfem2D .
+
+
+#simulation 1
+cp Par_file_noise_1  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_1
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_1
+mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_1
+mv DATA/Par_file           OUTPUT_ALL/step_1
+mv OUTPUT_FILES/mask*      OUTPUT_ALL/
+mv OUTPUT_FILES/mesh_????  OUTPUT_ALL/
+mv OUTPUT_FILES/model*     OUTPUT_ALL/
+
+
+#simulation 2
+cp Par_file_noise_2  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_2
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_2
+cp OUTPUT_FILES/*.semd     OUTPUT_ALL/step_2
+mv DATA/Par_file           OUTPUT_ALL/step_2
+
+
+#write zero traces
+awk '{printf(" %12.6f %12.6f\n",$1,0.)}' < OUTPUT_FILES/$TRACE > SEM/zero
+cd SEM/
+for ((ii=1; ii<=3; ++ii))
+do
+  cp zero `printf S%04d.AA.BXX.adj $ii`
+  cp zero `printf S%04d.AA.BXY.adj $ii`
+  cp zero `printf S%04d.AA.BXZ.adj $ii`
+done
+cd ..
+
+
+#write master trace
+sed -i'.bak' 's/use_positive_branch = .[a-z]*./use_positive_branch = .false./' $ADJCC
+sed -i'.bak' 's/use_negative_branch = .[a-z]*./use_negative_branch = .true./' $ADJCC
+sed -i'.bak' 's/use_custom_window = .[a-z]*./use_custom_window = .false./' $ADJCC
+sed -i'.bak' 's/time_reverse = .[a-z]*./time_reverse = .false./' $ADJCC
+
+gfortran $ADJCC -o adj_run
+cp OUTPUT_FILES/$TRACE SEM/
+./adj_run SEM/$TRACE
+rename '.semd' '' SEM/$TRACE.adj
+
+
+#simulation 3
+cp Par_file_noise_3  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_3
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_3
+mv SEM/*Y.adj              OUTPUT_ALL/step_3
+mv OUTPUT_FILES/proc*      OUTPUT_ALL/step_3
+mv DATA/Par_file           OUTPUT_ALL/step_3
+mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
+


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_negative_branch
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_positive_branch
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_positive_branch	                        (rev 0)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_positive_branch	2011-10-08 21:57:32 UTC (rev 19051)
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then echo "USAGE:  use_positive_branch  slave  master"; exit; fi
+
+RUNDIR=$PWD
+SLAVE=$1
+MASTER=$2
+TRACE=`printf 'S%04d.AA.BXY.semd' $SLAVE`
+ADJCC='adj_cc.f90'
+
+
+#prepare directories
+rm -rf   DATA SEM OUTPUT_FILES OUTPUT_ALL
+mkdir -p DATA SEM OUTPUT_FILES OUTPUT_ALL DATA/NOISE_TOMOGRAPHY OUTPUT_FILES/NOISE_TOMOGRAPHY
+
+
+#prepare files
+cp SOURCE_noise           DATA/SOURCE
+cp STATIONS_target_noise  DATA/STATIONS_target
+cp uniform.dat            DATA/
+echo $MASTER >            DATA/NOISE_TOMOGRAPHY/irec_master
+if [ -f S_squared ]; then cp S_squared DATA/NOISE_TOMOGRAPHY/; fi
+if [ -f model_velocity.dat_input ]; then cp model_velocity.dat_input DATA/; fi
+
+
+#compile
+rm xmshefem2D
+rm xspecfem2D
+cd ../..
+make
+cd $RUNDIR
+ln -s ../../bin/xmeshfem2D .
+ln -s ../../bin/xspecfem2D .
+
+
+#simulation 1
+cp Par_file_noise_1  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_1
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_1
+mv OUTPUT_FILES/*.semd     OUTPUT_ALL/step_1
+mv DATA/Par_file           OUTPUT_ALL/step_1
+mv OUTPUT_FILES/mask*      OUTPUT_ALL/
+mv OUTPUT_FILES/mesh_????  OUTPUT_ALL/
+mv OUTPUT_FILES/model*     OUTPUT_ALL/
+
+
+#simulation 2
+cp Par_file_noise_2  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_2
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_2
+cp OUTPUT_FILES/*.semd     OUTPUT_ALL/step_2
+mv DATA/Par_file           OUTPUT_ALL/step_2
+
+
+#write zero traces
+awk '{printf(" %12.6f %12.6f\n",$1,0.)}' < OUTPUT_FILES/$TRACE > SEM/zero
+cd SEM/
+for ((ii=1; ii<=3; ++ii))
+do
+  cp zero `printf S%04d.AA.BXX.adj $ii`
+  cp zero `printf S%04d.AA.BXY.adj $ii`
+  cp zero `printf S%04d.AA.BXZ.adj $ii`
+done
+cd ..
+
+
+#write master trace
+sed -i'.bak' 's/use_positive_branch = .[a-z]*./use_positive_branch = .true./' $ADJCC
+sed -i'.bak' 's/use_negative_branch = .[a-z]*./use_negative_branch = .false./' $ADJCC
+sed -i'.bak' 's/use_custom_window = .[a-z]*./use_custom_window = .false./' $ADJCC
+sed -i'.bak' 's/time_reverse = .[a-z]*./time_reverse = .false./' $ADJCC
+
+gfortran $ADJCC -o adj_run
+cp OUTPUT_FILES/$TRACE SEM/
+./adj_run SEM/$TRACE
+rename '.semd' '' SEM/$TRACE.adj
+
+
+#simulation 3
+cp Par_file_noise_3  DATA/Par_file
+./xmeshfem2D; ./xspecfem2D
+mkdir OUTPUT_ALL/step_3
+#mv OUTPUT_FILES/image*     OUTPUT_ALL/step_3
+mv SEM/*Y.adj              OUTPUT_ALL/step_3
+mv OUTPUT_FILES/proc*      OUTPUT_ALL/step_3
+mv DATA/Par_file           OUTPUT_ALL/step_3
+mv OUTPUT_FILES/snapshot*  OUTPUT_ALL/
+


Property changes on: seismo/2D/SPECFEM2D/trunk/EXAMPLES/noise_uniform/use_positive_branch
___________________________________________________________________
Name: svn:executable
   + *



More information about the CIG-COMMITS mailing list