[cig-commits] r18942 - in seismo/3D/SPECFEM3D/trunk: examples examples/BENCHMARK_CLAERBOUT_ADJOINT examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files src/shared

yangl at geodynamics.org yangl at geodynamics.org
Mon Sep 19 15:45:56 PDT 2011


Author: yangl
Date: 2011-09-19 15:45:55 -0700 (Mon, 19 Sep 2011)
New Revision: 18942

Added:
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/README
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/adj_seismogram.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/constants.h
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_external.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_internal.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/CMTSOLUTION
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/Par_file
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS_ADJOINT
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/Mesh_Par_file
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interface3.dat
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interfaces.dat
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/postprocessing.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/random_model_generation.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/save_adjoint_kernels.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/write_seismograms.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/README
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/adj_seismogram.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/constants.h
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_external.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_internal.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/CMTSOLUTION
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/Par_file
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS_ADJOINT
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/Mesh_Par_file
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interface3.dat
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interfaces.dat
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/postprocessing.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/random_model_generation.f90
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash
   seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/save_adjoint_kernels.f90
Modified:
   seismo/3D/SPECFEM3D/trunk/src/shared/compute_kernels.f90
Log:
(SPECFEM3D_SESAME) examples/BENCHMARK_CLAERBOUT_ADJOINT added

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/README
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/README	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/README	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,17 @@
+this test can be done on your workstation, as long as you have FOUR CPUs available.
+it should be done within 15 minutes. 
+
+
+to run this test, simply use (after ./configure FC=ifort MPIFC=mpif90):
+
+./run_inhomogeneous.bash
+
+
+you will be given information at the very end:
+
+ DATASPACE=       ?
+ MODELSPACE=      ?
+ relative error=  ?
+
+check "relative error", it must be small enough (~0.001 should be OK).
+If you fail the test, PURE ACOUSTIC kernel calculation is problematic.

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/adj_seismogram.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/adj_seismogram.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/adj_seismogram.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,107 @@
+program adj_seismogram
+
+  implicit none
+
+  include "mpif.h"
+
+  integer :: myrank,ier
+
+  integer :: ios,irec,i,j,NSTEP,NPROC
+  double precision :: DT
+  real(kind=4),dimension(:),allocatable :: syn,dat,adj
+  integer(kind=4) :: r4head(60)
+  integer(kind=4) :: header4(1)
+  integer(kind=2) :: header2(2)
+  equivalence(header2,header4)
+  character(len=512) :: filename,procname,arg
+
+  call MPI_Init(ier)
+  call MPI_Comm_Rank(MPI_COMM_WORLD,myrank,ier)
+  call MPI_Comm_Size(MPI_COMM_WORLD,NPROC,ier)
+
+  write(procname,"(i4)") myrank
+
+  !! input parameters
+  if( iargc() .ne. 2 ) stop 'Usage: ./xadj NSTEP DT'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) NSTEP;   if (ios /= 0) stop 'Error reading NSTEP'
+  j=2;  call getarg(j, arg); read(arg,*,iostat=ios)    DT;   if (ios /= 0) stop 'Error reading DT'
+
+  !!!! read NSTEP from seismograms
+  !!!filename=trim(adjustl(procname))//"_dx_SU"
+  !!!open(111,file="../in_out_files/OUTPUT_FILES/"//trim(filename),access='direct',recl=240,iostat = ios)
+  !!!read(111,rec=1,iostat=ios) r4head
+  !!!close(111)
+  !!!header4=r4head(29)
+  !!!NSTEP=header2(2)
+  !!!header4=r4head(30)
+  !!!DT=header2(1)*1.0d-6
+  !!!print*, 'irec=',r4head(1)
+  !!!print*, 'xs=',r4head(19)
+  !!!print*, 'zs=',r4head(20)
+  !!!print*, 'xr=',r4head(21)
+  !!!print*, 'zr=',r4head(22)
+  !!!print*, 'NSTEP=',NSTEP
+  !!!print*, "DT=",DT
+
+  allocate(syn(NSTEP),dat(NSTEP),adj(NSTEP))
+
+! read 'syn', 'dat' and then write 'adj'
+  ! x-component
+  filename=trim(adjustl(procname))//"_dx_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+  ! y-component
+  filename=trim(adjustl(procname))//"_dy_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+  ! z-component
+  filename=trim(adjustl(procname))//"_dz_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+
+  call MPI_BARRIER(MPI_COMM_WORLD,ier)
+  call MPI_Finalize(ier)
+
+end program adj_seismogram

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/constants.h
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/constants.h	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/constants.h	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,334 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+
+! src/shared/constants.h.  Generated from constants.h.in by configure.
+
+!
+! solver in single or double precision depending on the machine (4 or 8 bytes)
+!
+! ALSO CHANGE FILE precision.h ACCORDINGLY
+!
+  integer, parameter :: SIZE_REAL = 4
+  integer, parameter :: SIZE_DOUBLE = 8
+
+! usually the size of integer and logical variables is the same as regular single-precision real variable
+  integer, parameter :: SIZE_INTEGER = SIZE_REAL
+  integer, parameter :: SIZE_LOGICAL = SIZE_REAL
+
+! set to SIZE_REAL to run in single precision
+! set to SIZE_DOUBLE to run in double precision (increases memory size by 2)
+  integer, parameter :: CUSTOM_REAL = SIZE_REAL
+
+!----------- parameters that can be changed by the user -----------
+
+! set to .false.  if running on a Beowulf-type machine with local disks
+! set to .true. if running on a shared-memory machine with common file system
+! if running on a Beowulf, also modify name of nodes in filter_machine_file.f90
+  logical, parameter :: LOCAL_PATH_IS_ALSO_GLOBAL = .true.
+
+! apply heuristic rule to modify doubling regions to balance angles
+  logical, parameter :: APPLY_HEURISTIC_RULE = .true.
+
+! adds/superimposes velocity model values from 'model_external_values.f90'
+  logical, parameter :: USE_MODEL_EXTERNAL_VALUES = .false.
+
+! use inlined products of Deville et al. (2002) to speedup the calculations to compute internal forces
+  logical, parameter :: USE_DEVILLE_PRODUCTS = .true.
+
+! number of GLL points in each direction of an element (degree plus one)
+  integer, parameter :: NGLLX = 5
+  integer, parameter :: NGLLY = NGLLX
+  integer, parameter :: NGLLZ = NGLLX
+
+! number of points per surface element
+  integer, parameter :: NGLLSQUARE = NGLLX * NGLLY
+
+! number of points per spectral element
+  integer, parameter :: NGLLCUBE = NGLLX * NGLLY * NGLLZ
+
+! for optimized routines by Deville et al. (2002)
+  integer, parameter :: m1 = NGLLX, m2 = NGLLX * NGLLY
+
+! ouput format of seismograms, ASCII or binary
+  logical, parameter :: SEISMOGRAMS_BINARY = .false.
+! output format of seismograms, Seismic Unix (binary with 240-byte-headers)
+  logical, parameter :: SU_FORMAT=.true.
+
+! input, output and main MPI I/O files
+  integer, parameter :: ISTANDARD_OUTPUT = 6
+  integer, parameter :: IIN = 40,IOUT = 41
+! uncomment this to write messages to a text file
+  integer, parameter :: IMAIN = 42
+! uncomment this to write messages to the screen
+! integer, parameter :: IMAIN = ISTANDARD_OUTPUT
+! I/O unit for source and receiver vtk file
+  integer, parameter :: IOVTK = 98
+! I/O unit for absorbing boundary snapshots
+!  integer, parameter :: IOABS = 31
+!  integer, parameter :: IOABS_AC = 32
+! I/O unit for plotting source time function
+  integer, Parameter :: IOSTF = 71
+! I/O unit for interface file
+  integer, parameter :: IIN_INTERFACES = 43
+! I/O unit for noise simulations
+  integer, parameter :: IIN_NOISE = 44,IOUT_NOISE = 45
+! I/O unit for SU formatted seismograms
+  integer, parameter :: IOUT_SU = 46
+! I/O unit for SU formatted adjoint sources
+  integer, parameter :: IIN_SU1 = 47, IIN_SU2 = 48, IIN_SU3 = 49
+
+! ignore variable name field (junk) at the beginning of each input line
+  logical, parameter :: IGNORE_JUNK = .true.,DONT_IGNORE_JUNK = .false.
+
+! flag to print the details of source location
+  logical, parameter :: SHOW_DETAILS_LOCATE_SOURCE = .false.
+
+! maximum length of station and network name for receivers
+  integer, parameter :: MAX_LENGTH_STATION_NAME = 32
+  integer, parameter :: MAX_LENGTH_NETWORK_NAME = 8
+
+! number of sources to be gathered by MPI_Gather
+  integer, parameter :: NGATHER_SOURCES = 100
+
+! we mimic a triangle of half duration equal to half_duration_triangle
+! using a Gaussian having a very close shape, as explained in Figure 4.2
+! of the manual. This source decay rate to mimic an equivalent triangle
+! was found by trial and error
+  double precision, parameter :: SOURCE_DECAY_MIMIC_TRIANGLE = 1.628d0
+
+! decide if master process writes all the seismograms or if all processes do it in parallel
+  logical, parameter :: WRITE_SEISMOGRAMS_BY_MASTER = .false.
+
+! use directory OUTPUT_FILES/ for seismogram output
+  logical,parameter :: USE_OUTPUT_FILES_PATH = .true.
+
+! absorb top surface
+! (defined in mesh as 'free_surface_file')
+  logical,parameter :: ABSORB_FREE_SURFACE = .false.
+
+! absorb boundaries using a PML region
+! (EXPERIMENTAL feature)
+! (only acoustic domains supported...)
+! (user parameters can be specified in PML_init.f90)
+  logical,parameter :: ABSORB_USE_PML = .false.
+
+! paths for inputs and outputs files
+  character(len=256), parameter :: IN_DATA_FILES_PATH = '../in_data_files/'
+  character(len=256), parameter :: MF_IN_DATA_FILES_PATH = '../in_data_files/meshfem3D_files/'
+  character(len=256), parameter :: OUTPUT_FILES_PATH = '../in_out_files/OUTPUT_FILES/'
+
+
+! ---------------------------------------------------------------------------------------
+! LQY -- Following 3 variables stays here temporarily,
+!        we need to move them to Par_file at a proper time
+! ---------------------------------------------------------------------------------------
+! save moho mesh and compute Moho boundary kernels
+  logical, parameter :: SAVE_MOHO_MESH = .false.
+
+! outputs approximate hessian for preconditioning
+  logical, parameter :: APPROXIMATE_HESS_KL = .false.
+
+! number of steps to save the state variables in the forward simulation,
+! to be used in the backward reconstruction in the presence of attenuation
+  integer, parameter :: NSTEP_Q_SAVE = 50 ! depending on stability of reconstruction, up to 200
+
+! the scratch disk to save the state variables saved in the forward
+! simulation, this can be a global scratch disk in case you run out of
+! space on the local scratch disk, e.g. '/ibrixfs1/scratch/lqy/DATABASES_MPI_Q/'
+  character(len=256), parameter :: LOCAL_PATH_Q = '../in_out_files/DATABASES_MPI'
+
+!------------------------------------------------------
+! nlegoff -- Variables that should be read/computed elsewhere.
+!            Temporarily declared here.
+!------------------------------------------------------
+
+! no lagrange interpolation on seismograms (we take the value on one NGLL point)
+  logical, parameter :: FASTER_RECEIVERS_POINTS_ONLY = .false.
+
+! use a force source located exactly at a grid point instead of a CMTSOLUTION source
+! this can be useful e.g. for oil industry foothills simulations or asteroid simulations
+! in which the source is a vertical force, normal force, impact etc.
+  logical, parameter :: USE_FORCE_POINT_SOURCE = .false.
+  double precision, parameter :: FACTOR_FORCE_SOURCE = 1.d15
+  integer, parameter :: COMPONENT_FORCE_SOURCE = 3  ! takes direction in comp E/N/Z = 1/2/3
+
+! use this t0 as earliest starting time rather than the automatically calculated one
+! (must be positive and bigger than the automatically one to be effective;
+!  simulation will start at t = - t0)
+  double precision, parameter :: USER_T0 = 0.0d0
+
+! the receivers can be located inside the model
+  logical, parameter :: RECVS_CAN_BE_BURIED_EXT_MESH = .true.
+  logical, parameter :: SOURCES_CAN_BE_BURIED_EXT_MESH = .true.
+
+! sources and receivers Z coordinates given directly instead of with depth
+  logical, parameter :: USE_SOURCES_RECVS_Z = .false.
+
+! the seismograms are normal to surface
+! Z record corresponds to the normal, while E and N are two tangent vectors
+! that completes an orthonormal.
+  logical, parameter :: EXT_MESH_RECV_NORMAL = .false.
+
+! shakemaps and movies can not be generated during the same run. Mutually exclusive.
+  logical, parameter :: EXTERNAL_MESH_MOVIE_SURFACE = .false.
+  logical, parameter :: EXTERNAL_MESH_CREATE_SHAKEMAP = .false.
+
+! plots VTK cross-section planes instead of model surface
+! (EXPERIMENTAL feature)
+! (requires EXTERNAL_MESH_MOVIE_SURFACE set to true)
+  logical, parameter :: PLOT_CROSS_SECTIONS = .false.
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_X = 67000.0
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Y = 65500.0
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Z = -30000.0
+
+! plots GIF cross-section image
+! (EXPERIMENTAL feature)
+! (cross-section plane parameters can be specified in create_color_image.f90)
+  logical, parameter :: PNM_GIF_IMAGE = .false.
+
+! number of nodes per element as provided by the external mesh
+  integer, parameter :: ESIZE = 8
+
+! geometry tolerance parameter to calculate number of independent grid points
+! sensitive to actual size of model, assumes reference sphere of radius 1
+! this is an absolute value for normalized coordinates in the Earth
+  double precision, parameter :: SMALLVAL_TOL = 1.d-10
+
+!------------------------------------------------------
+!----------- do not modify anything below -------------
+!------------------------------------------------------
+
+! on some processors (e.g. Pentiums) it is necessary to suppress underflows
+! by using a small initial field instead of zero
+  logical, parameter :: FIX_UNDERFLOW_PROBLEM = .false.
+
+! some useful constants
+  double precision, parameter :: PI = 3.141592653589793d0
+  double precision, parameter :: TWO_PI = 2.d0 * PI
+
+! 3-D simulation
+  integer, parameter :: NDIM = 3
+
+! dimension of the boundaries of the slices
+  integer, parameter :: NDIM2D = 2
+
+! for vectorization of loops
+  integer, parameter :: NGLLSQUARE_NDIM = NGLLSQUARE * NDIM
+  integer, parameter :: NGLLCUBE_NDIM = NGLLCUBE * NDIM
+
+! number of nodes for 2D and 3D shape functions for hexahedra
+! we use 8-node mesh bricks, which are more stable than 27-node elements
+  integer, parameter :: NGNOD = 8, NGNOD2D = 4
+
+! a few useful constants
+  double precision, parameter :: ZERO = 0.d0,ONE = 1.d0,TWO = 2.d0 !,HALF = 0.5d0
+
+  real(kind=CUSTOM_REAL), parameter :: &
+    ONE_THIRD   = 1._CUSTOM_REAL/3._CUSTOM_REAL, &
+    FOUR_THIRDS = 4._CUSTOM_REAL/3._CUSTOM_REAL
+
+! very large and very small values
+  double precision, parameter :: HUGEVAL = 1.d+30,TINYVAL = 1.d-9
+
+! tiny real value declared independently of the machine
+  real(kind=CUSTOM_REAL), parameter :: TINYVAL_SNGL = 1.e-25_CUSTOM_REAL
+
+! Olsen's constant for Q_mu = constant * v_s attenuation rule
+  real, parameter :: OLSEN_ATTENUATION_RATIO = 0.05
+
+! number of standard linear solids in parallel for attenuation
+  integer, parameter :: N_SLS = 3
+
+! computation of standard linear solids
+! ATTENUATION_COMP_RESOLUTION: Number of Digits after decimal
+! ATTENUATION_COMP_MAXIMUM:    Maximum Q Value
+  integer, parameter :: ATTENUATION_COMP_RESOLUTION = 1
+  integer, parameter :: ATTENUATION_COMP_MAXIMUM    = 9000
+
+! reference frequency for target velocity values in velocity model
+! arbitrarily set to typical resolution of model (3 sec)
+  double precision, parameter :: ATTENUATION_f0_REFERENCE = 0.3d0
+
+! define flag for regions for anisotropy
+  integer, parameter :: IANISOTROPY_MODEL1 = 1
+  integer, parameter :: IANISOTROPY_MODEL2 = 2
+
+! smallest real number on the Pentium and the SGI =  1.1754944E-38
+! largest real number on the Pentium and the SGI  =  3.4028235E+38
+! small negligible initial value to avoid very slow underflow trapping
+! but not too small to avoid trapping on velocity and acceleration in Newmark
+  real(kind=CUSTOM_REAL), parameter :: VERYSMALLVAL = 1.E-24_CUSTOM_REAL
+
+! displacement threshold above which we consider the code became unstable
+  real(kind=CUSTOM_REAL), parameter :: STABILITY_THRESHOLD = 1.E+25_CUSTOM_REAL
+
+! geometrical tolerance for boundary detection
+  double precision, parameter :: SMALLVAL = 0.00001d0
+
+! do not use tags for MPI messages, use dummy tag instead
+  integer, parameter :: itag = 0,itag2 = 0
+
+! for the Gauss-Lobatto-Legendre points and weights
+  double precision, parameter :: GAUSSALPHA = 0.d0,GAUSSBETA = 0.d0
+
+! number of lines per source in CMTSOLUTION file
+  integer, parameter :: NLINES_PER_CMTSOLUTION_SOURCE = 13
+
+! number of iterations to solve the system for xi and eta
+  integer, parameter :: NUM_ITER = 4
+
+! size of topography and bathymetry file for Southern California
+  integer, parameter :: NX_TOPO_SOCAL = 1401,NY_TOPO_SOCAL = 1001
+  double precision, parameter :: ORIG_LAT_TOPO_SOCAL = 32.d0
+  double precision, parameter :: ORIG_LONG_TOPO_SOCAL = -121.d0
+  double precision, parameter :: DEGREES_PER_CELL_TOPO_SOCAL = 5.d0 / 1000.d0
+  character(len=100), parameter :: TOPO_FILE_SOCAL = 'DATA/la_topography/topo_bathy_final.dat'
+
+! ! size of topography and bathymetry file for Piero Basini's model
+!   integer, parameter :: NX_TOPO = 787, NY_TOPO = 793
+!   double precision, parameter :: ORIG_LAT_TOPO = -102352.d0
+!   double precision, parameter :: ORIG_LONG_TOPO = 729806.d0
+! ! for Piero Basini's model this is the resolution in meters of the topo file
+!   double precision, parameter :: DEGREES_PER_CELL_TOPO = 250.d0
+!   character(len=256), parameter :: TOPO_FILE = 'DATA/piero_model/dem_EV_UTM_regular_250_reordered.dat'
+
+! flag for projection from latitude/longitude to UTM, and back
+  integer, parameter :: ILONGLAT2UTM = 0, IUTM2LONGLAT = 1
+
+! minimum thickness in meters to include the effect of the oceans
+! to avoid taking into account spurious oscillations in topography model
+  double precision, parameter :: MINIMUM_THICKNESS_3D_OCEANS = 10.d0
+! density of sea water
+  real(kind=CUSTOM_REAL), parameter :: RHO_OCEANS = 1020.0
+
+! material domain ids
+  integer, parameter :: IDOMAIN_ACOUSTIC    = 1
+  integer, parameter :: IDOMAIN_ELASTIC     = 2
+  integer, parameter :: IDOMAIN_POROELASTIC = 3
+
+! number of points in each AVS or OpenDX quadrangular cell for movies
+  integer, parameter :: NGNOD2D_AVS_DX = 4

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_external.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_external.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_external.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,366 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+  subroutine get_model(myrank,nspec,ibool,mat_ext_mesh,nelmnts_ext_mesh, &
+                        materials_ext_mesh,nmat_ext_mesh, &
+                        undef_mat_prop,nundefMat_ext_mesh, &
+                        ANISOTROPY,LOCAL_PATH)
+
+  use create_regions_mesh_ext_par
+  implicit none
+
+  ! number of spectral elements in each block
+  integer :: myrank,nspec
+
+  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: ibool
+
+  ! external mesh
+  integer :: nelmnts_ext_mesh
+  integer :: nmat_ext_mesh,nundefMat_ext_mesh
+
+  integer, dimension(2,nelmnts_ext_mesh) :: mat_ext_mesh
+  double precision, dimension(6,nmat_ext_mesh) :: materials_ext_mesh
+  character (len=30), dimension(6,nundefMat_ext_mesh):: undef_mat_prop
+
+  ! anisotropy
+  logical :: ANISOTROPY
+
+  ! local parameters
+  real(kind=CUSTOM_REAL) :: vp,vs,rho,qmu_atten
+  real(kind=CUSTOM_REAL) :: c11,c12,c13,c14,c15,c16,c22,c23,c24,c25, &
+                        c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66
+  integer :: ispec,i,j,k,iundef,ier
+  integer :: iflag,flag_below,flag_above
+  integer :: iflag_aniso,idomain_id,imaterial_id
+
+  ! gll point location
+  double precision :: xloc,yloc,zloc
+  integer :: iglob
+  character(len=256) LOCAL_PATH,prname_lp
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read
+
+  ! variables for importing models from files in SPECFEM format, e.g.,  proc000000_vp.bin etc.
+  ! can be used for importing updated model in iterative inversions
+  logical,parameter :: USE_EXTERNAL_FILES = .true.
+
+  ! use acoustic domains for simulation
+  logical,parameter :: USE_PURE_ACOUSTIC_MOD = .false.
+
+
+
+  ! initializes element domain flags
+  ispec_is_acoustic(:) = .false.
+  ispec_is_elastic(:) = .false.
+  ispec_is_poroelastic(:) = .false.
+
+  ! prepares tomography model if needed for elements with undefined material definitions
+  if( nundefMat_ext_mesh > 0 ) then
+    call model_tomography_broadcast(myrank)
+  endif
+
+  ! prepares external model values if needed
+  if( USE_MODEL_EXTERNAL_VALUES ) then
+    call model_external_broadcast(myrank)
+  endif
+
+! !  Piero, read bedrock file
+! in case, see file model_interface_bedrock.f90:
+!  call model_bedrock_broadcast(myrank)
+
+
+  ! material properties on all GLL points: taken from material values defined for
+  ! each spectral element in input mesh
+  do ispec = 1, nspec
+    do k = 1, NGLLZ
+      do j = 1, NGLLY
+        do i = 1, NGLLX
+
+           ! material index 1: associated material number
+           imaterial_id = mat_ext_mesh(1,ispec)
+
+           ! check if the material is known or unknown
+           if( imaterial_id > 0) then
+              ! gets velocity model as specified by (cubit) mesh files
+
+              ! density
+              ! materials_ext_mesh format:
+              ! #index1 = rho #index2 = vp #index3 = vs #index4 = Q_flag #index5 = 0
+              rho = materials_ext_mesh(1,imaterial_id)
+
+              ! isotropic values: vp, vs
+              vp = materials_ext_mesh(2,imaterial_id)
+              vs = materials_ext_mesh(3,imaterial_id)
+
+              ! attenuation
+              qmu_atten = materials_ext_mesh(4,imaterial_id)
+
+              ! anisotropy
+              iflag_aniso = materials_ext_mesh(5,imaterial_id)
+
+              ! material domain_id
+              idomain_id = materials_ext_mesh(6,imaterial_id)
+
+           else if (mat_ext_mesh(2,ispec) == 1) then
+
+              stop 'material: interface not implemented yet'
+
+              do iundef = 1,nundefMat_ext_mesh
+                 if(trim(undef_mat_prop(2,iundef)) == 'interface') then
+                    read(undef_mat_prop(3,iundef),'(1i3)') flag_below
+                    read(undef_mat_prop(4,iundef),'(1i3)') flag_above
+                 endif
+              enddo
+
+              ! see file model_interface_bedrock.f90: routine interface()
+              !call interface(iflag,flag_below,flag_above,ispec,nspec,i,j,k,xstore,ystore,zstore,ibedrock)
+
+              ! dummy: takes 1. defined material
+              iflag = 1
+              rho = materials_ext_mesh(1,iflag)
+              vp = materials_ext_mesh(2,iflag)
+              vs = materials_ext_mesh(3,iflag)
+              qmu_atten = materials_ext_mesh(4,iflag)
+              iflag_aniso = materials_ext_mesh(5,iflag)
+              idomain_id = materials_ext_mesh(6,iflag)
+
+           else if ( mat_ext_mesh(2,ispec) == 2 ) then
+
+              ! material definition undefined, uses definition from tomography model
+              ! GLL point location
+              iglob = ibool(i,j,k,ispec)
+              xloc = xstore_dummy(iglob)
+              yloc = ystore_dummy(iglob)
+              zloc = zstore_dummy(iglob)
+
+              ! gets model values from tomography file
+              call model_tomography(xloc,yloc,zloc, &
+                                  rho,vp,vs)
+
+              qmu_atten = ATTENUATION_COMP_MAXIMUM   ! attenuation: arbitrary value, see maximum in constants.h
+              iflag_aniso = 0   ! no anisotropy
+
+              ! sets acoustic/elastic domain as given in materials properties
+              iundef = - imaterial_id    ! iundef must be positive
+              read(undef_mat_prop(6,iundef),*) idomain_id
+              ! or
+              !idomain_id = IDOMAIN_ELASTIC    ! forces to be elastic domain
+
+           else
+
+              stop 'material: not implemented yet'
+
+           end if
+
+           ! adds/gets velocity model as specified in model_external_values.f90
+           if( USE_MODEL_EXTERNAL_VALUES ) then
+             call model_external_values(i,j,k,ispec,idomain_id,imaterial_id, &
+                            nspec,ibool, &
+                            iflag_aniso,qmu_atten, &
+                            rho,vp,vs, &
+                            c11,c12,c13,c14,c15,c16, &
+                            c22,c23,c24,c25,c26,c33, &
+                            c34,c35,c36,c44,c45,c46, &
+                            c55,c56,c66,ANISOTROPY)
+           endif
+
+           ! adds anisotropic default model
+           if( ANISOTROPY .and. .not. USE_MODEL_EXTERNAL_VALUES ) then
+             call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+                     c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45, &
+                     c46,c55,c56,c66)
+
+           endif
+
+           ! stores velocity model
+
+           ! density
+           rhostore(i,j,k,ispec) = rho
+
+           ! kappa, mu
+           kappastore(i,j,k,ispec) = rho*( vp*vp - FOUR_THIRDS*vs*vs )
+           mustore(i,j,k,ispec) = rho*vs*vs
+
+           ! attenuation
+           qmu_attenuation_store(i,j,k,ispec) = qmu_atten
+
+           ! Stacey, a completer par la suite
+           rho_vp(i,j,k,ispec) = rho*vp
+           rho_vs(i,j,k,ispec) = rho*vs
+           !end pll
+
+           ! adds anisotropic perturbation to vp, vs
+           if( ANISOTROPY ) then
+             !call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+             !        c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66)
+             c11store(i,j,k,ispec) = c11
+             c12store(i,j,k,ispec) = c12
+             c13store(i,j,k,ispec) = c13
+             c14store(i,j,k,ispec) = c14
+             c15store(i,j,k,ispec) = c15
+             c16store(i,j,k,ispec) = c16
+             c22store(i,j,k,ispec) = c22
+             c23store(i,j,k,ispec) = c23
+             c24store(i,j,k,ispec) = c24
+             c25store(i,j,k,ispec) = c25
+             c26store(i,j,k,ispec) = c26
+             c33store(i,j,k,ispec) = c33
+             c34store(i,j,k,ispec) = c34
+             c35store(i,j,k,ispec) = c35
+             c36store(i,j,k,ispec) = c36
+             c44store(i,j,k,ispec) = c44
+             c45store(i,j,k,ispec) = c45
+             c46store(i,j,k,ispec) = c46
+             c55store(i,j,k,ispec) = c55
+             c56store(i,j,k,ispec) = c56
+             c66store(i,j,k,ispec) = c66
+           endif
+
+           ! for pure acoustic simulations (a way of avoiding re-mesh, re-partition etc.)
+           ! can be used to compare elastic & acoustic reflections in exploration seismology
+           ! do NOT use it unless you are confident
+           if( USE_PURE_ACOUSTIC_MOD ) then
+             idomain_id = IDOMAIN_ACOUSTIC
+           endif
+
+           ! material domain
+           !print*,'velocity model:',ispec,idomain_id
+           if( idomain_id == IDOMAIN_ACOUSTIC ) then
+             ispec_is_acoustic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_ELASTIC ) then
+             ispec_is_elastic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_POROELASTIC ) then
+             stop 'poroelastic material domain not implemented yet'
+             ispec_is_poroelastic(ispec) = .true.
+           else
+             stop 'error material domain index'
+           endif
+
+        enddo
+      enddo
+    enddo
+    !print*,myrank,'ispec:',ispec,'rho:',rhostore(1,1,1,ispec),'vp:',vpstore(1,1,1,ispec),'vs:',vsstore(1,1,1,ispec)
+  enddo
+
+  ! checks material domains
+  do ispec=1,nspec
+    ! checks if domain is set
+    if( (ispec_is_acoustic(ispec) .eqv. .false.) &
+          .and. (ispec_is_elastic(ispec) .eqv. .false.) &
+          .and. (ispec_is_poroelastic(ispec) .eqv. .false.) ) then
+      print*,'error material domain not assigned to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+    ! checks if domain is unique
+    if( ispec_is_acoustic(ispec) .eqv. .true. .and. ispec_is_elastic(ispec) .eqv. .true. ) then
+      print*,'error material domain assigned twice to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+  enddo
+
+! !! DK DK store the position of the six stations to be able to
+! !! DK DK exclude circles around each station to make sure they are on the bedrock
+! !! DK DK and not in the ice
+! in case, see file model_interface_bedrock.f90: routine model_bedrock_store()
+
+
+! import the model from files in SPECFEM format
+! note that those those files should be saved in LOCAL_PATH
+
+  if( USE_EXTERNAL_FILES ) then
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! if only vp structure is available (as is often the case in exploration seismology),
+!!! use lines for vp only
+
+    ! processors name
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+
+    allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array rho_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'rho.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) rho_read
+    close(28)
+
+    allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vp_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vp.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vp_read
+    close(28)
+
+    allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vs_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vs.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vs_read
+    close(28)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where density structure is not given
+!!! modify according to your desire
+
+!  rho_read = 1000.0
+!  where ( mustore > 100.0 )  &
+!           rho_read = (1.6612 * (vp_read / 1000.0)     &
+!                      -0.4720 * (vp_read / 1000.0)**2  &
+!                      +0.0671 * (vp_read / 1000.0)**3  &
+!                      -0.0043 * (vp_read / 1000.0)**4  &
+!                      +0.000106*(vp_read / 1000.0)**5 )*1000.0
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where shear wavespeed structure is not given
+!!! modify according to your desire
+
+!   vs_read = 0.0
+!   where ( mustore > 100.0 )       vs_read = vp_read / sqrt(3.0)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! update arrays that will be saved and used in the solver xspecfem3D
+!!! the following part is neccessary if you uncommented something above
+
+    rhostore    = rho_read
+    kappastore  = rhostore * ( vp_read * vp_read - FOUR_THIRDS * vs_read * vs_read )
+    mustore     = rhostore * vs_read * vs_read
+    rho_vp = rhostore * vp_read
+    rho_vs = rhostore * vs_read
+
+    ! free memory
+    deallocate( rho_read,vp_read,vs_read)
+
+  endif ! USE_EXTERNAL_FILES
+
+  end subroutine get_model
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_internal.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_internal.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/get_model_internal.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,366 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+  subroutine get_model(myrank,nspec,ibool,mat_ext_mesh,nelmnts_ext_mesh, &
+                        materials_ext_mesh,nmat_ext_mesh, &
+                        undef_mat_prop,nundefMat_ext_mesh, &
+                        ANISOTROPY,LOCAL_PATH)
+
+  use create_regions_mesh_ext_par
+  implicit none
+
+  ! number of spectral elements in each block
+  integer :: myrank,nspec
+
+  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: ibool
+
+  ! external mesh
+  integer :: nelmnts_ext_mesh
+  integer :: nmat_ext_mesh,nundefMat_ext_mesh
+
+  integer, dimension(2,nelmnts_ext_mesh) :: mat_ext_mesh
+  double precision, dimension(6,nmat_ext_mesh) :: materials_ext_mesh
+  character (len=30), dimension(6,nundefMat_ext_mesh):: undef_mat_prop
+
+  ! anisotropy
+  logical :: ANISOTROPY
+
+  ! local parameters
+  real(kind=CUSTOM_REAL) :: vp,vs,rho,qmu_atten
+  real(kind=CUSTOM_REAL) :: c11,c12,c13,c14,c15,c16,c22,c23,c24,c25, &
+                        c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66
+  integer :: ispec,i,j,k,iundef,ier
+  integer :: iflag,flag_below,flag_above
+  integer :: iflag_aniso,idomain_id,imaterial_id
+
+  ! gll point location
+  double precision :: xloc,yloc,zloc
+  integer :: iglob
+  character(len=256) LOCAL_PATH,prname_lp
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read
+
+  ! variables for importing models from files in SPECFEM format, e.g.,  proc000000_vp.bin etc.
+  ! can be used for importing updated model in iterative inversions
+  logical,parameter :: USE_EXTERNAL_FILES = .false.
+
+  ! use acoustic domains for simulation
+  logical,parameter :: USE_PURE_ACOUSTIC_MOD = .false.
+
+
+
+  ! initializes element domain flags
+  ispec_is_acoustic(:) = .false.
+  ispec_is_elastic(:) = .false.
+  ispec_is_poroelastic(:) = .false.
+
+  ! prepares tomography model if needed for elements with undefined material definitions
+  if( nundefMat_ext_mesh > 0 ) then
+    call model_tomography_broadcast(myrank)
+  endif
+
+  ! prepares external model values if needed
+  if( USE_MODEL_EXTERNAL_VALUES ) then
+    call model_external_broadcast(myrank)
+  endif
+
+! !  Piero, read bedrock file
+! in case, see file model_interface_bedrock.f90:
+!  call model_bedrock_broadcast(myrank)
+
+
+  ! material properties on all GLL points: taken from material values defined for
+  ! each spectral element in input mesh
+  do ispec = 1, nspec
+    do k = 1, NGLLZ
+      do j = 1, NGLLY
+        do i = 1, NGLLX
+
+           ! material index 1: associated material number
+           imaterial_id = mat_ext_mesh(1,ispec)
+
+           ! check if the material is known or unknown
+           if( imaterial_id > 0) then
+              ! gets velocity model as specified by (cubit) mesh files
+
+              ! density
+              ! materials_ext_mesh format:
+              ! #index1 = rho #index2 = vp #index3 = vs #index4 = Q_flag #index5 = 0
+              rho = materials_ext_mesh(1,imaterial_id)
+
+              ! isotropic values: vp, vs
+              vp = materials_ext_mesh(2,imaterial_id)
+              vs = materials_ext_mesh(3,imaterial_id)
+
+              ! attenuation
+              qmu_atten = materials_ext_mesh(4,imaterial_id)
+
+              ! anisotropy
+              iflag_aniso = materials_ext_mesh(5,imaterial_id)
+
+              ! material domain_id
+              idomain_id = materials_ext_mesh(6,imaterial_id)
+
+           else if (mat_ext_mesh(2,ispec) == 1) then
+
+              stop 'material: interface not implemented yet'
+
+              do iundef = 1,nundefMat_ext_mesh
+                 if(trim(undef_mat_prop(2,iundef)) == 'interface') then
+                    read(undef_mat_prop(3,iundef),'(1i3)') flag_below
+                    read(undef_mat_prop(4,iundef),'(1i3)') flag_above
+                 endif
+              enddo
+
+              ! see file model_interface_bedrock.f90: routine interface()
+              !call interface(iflag,flag_below,flag_above,ispec,nspec,i,j,k,xstore,ystore,zstore,ibedrock)
+
+              ! dummy: takes 1. defined material
+              iflag = 1
+              rho = materials_ext_mesh(1,iflag)
+              vp = materials_ext_mesh(2,iflag)
+              vs = materials_ext_mesh(3,iflag)
+              qmu_atten = materials_ext_mesh(4,iflag)
+              iflag_aniso = materials_ext_mesh(5,iflag)
+              idomain_id = materials_ext_mesh(6,iflag)
+
+           else if ( mat_ext_mesh(2,ispec) == 2 ) then
+
+              ! material definition undefined, uses definition from tomography model
+              ! GLL point location
+              iglob = ibool(i,j,k,ispec)
+              xloc = xstore_dummy(iglob)
+              yloc = ystore_dummy(iglob)
+              zloc = zstore_dummy(iglob)
+
+              ! gets model values from tomography file
+              call model_tomography(xloc,yloc,zloc, &
+                                  rho,vp,vs)
+
+              qmu_atten = ATTENUATION_COMP_MAXIMUM   ! attenuation: arbitrary value, see maximum in constants.h
+              iflag_aniso = 0   ! no anisotropy
+
+              ! sets acoustic/elastic domain as given in materials properties
+              iundef = - imaterial_id    ! iundef must be positive
+              read(undef_mat_prop(6,iundef),*) idomain_id
+              ! or
+              !idomain_id = IDOMAIN_ELASTIC    ! forces to be elastic domain
+
+           else
+
+              stop 'material: not implemented yet'
+
+           end if
+
+           ! adds/gets velocity model as specified in model_external_values.f90
+           if( USE_MODEL_EXTERNAL_VALUES ) then
+             call model_external_values(i,j,k,ispec,idomain_id,imaterial_id, &
+                            nspec,ibool, &
+                            iflag_aniso,qmu_atten, &
+                            rho,vp,vs, &
+                            c11,c12,c13,c14,c15,c16, &
+                            c22,c23,c24,c25,c26,c33, &
+                            c34,c35,c36,c44,c45,c46, &
+                            c55,c56,c66,ANISOTROPY)
+           endif
+
+           ! adds anisotropic default model
+           if( ANISOTROPY .and. .not. USE_MODEL_EXTERNAL_VALUES ) then
+             call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+                     c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45, &
+                     c46,c55,c56,c66)
+
+           endif
+
+           ! stores velocity model
+
+           ! density
+           rhostore(i,j,k,ispec) = rho
+
+           ! kappa, mu
+           kappastore(i,j,k,ispec) = rho*( vp*vp - FOUR_THIRDS*vs*vs )
+           mustore(i,j,k,ispec) = rho*vs*vs
+
+           ! attenuation
+           qmu_attenuation_store(i,j,k,ispec) = qmu_atten
+
+           ! Stacey, a completer par la suite
+           rho_vp(i,j,k,ispec) = rho*vp
+           rho_vs(i,j,k,ispec) = rho*vs
+           !end pll
+
+           ! adds anisotropic perturbation to vp, vs
+           if( ANISOTROPY ) then
+             !call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+             !        c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66)
+             c11store(i,j,k,ispec) = c11
+             c12store(i,j,k,ispec) = c12
+             c13store(i,j,k,ispec) = c13
+             c14store(i,j,k,ispec) = c14
+             c15store(i,j,k,ispec) = c15
+             c16store(i,j,k,ispec) = c16
+             c22store(i,j,k,ispec) = c22
+             c23store(i,j,k,ispec) = c23
+             c24store(i,j,k,ispec) = c24
+             c25store(i,j,k,ispec) = c25
+             c26store(i,j,k,ispec) = c26
+             c33store(i,j,k,ispec) = c33
+             c34store(i,j,k,ispec) = c34
+             c35store(i,j,k,ispec) = c35
+             c36store(i,j,k,ispec) = c36
+             c44store(i,j,k,ispec) = c44
+             c45store(i,j,k,ispec) = c45
+             c46store(i,j,k,ispec) = c46
+             c55store(i,j,k,ispec) = c55
+             c56store(i,j,k,ispec) = c56
+             c66store(i,j,k,ispec) = c66
+           endif
+
+           ! for pure acoustic simulations (a way of avoiding re-mesh, re-partition etc.)
+           ! can be used to compare elastic & acoustic reflections in exploration seismology
+           ! do NOT use it unless you are confident
+           if( USE_PURE_ACOUSTIC_MOD ) then
+             idomain_id = IDOMAIN_ACOUSTIC
+           endif
+
+           ! material domain
+           !print*,'velocity model:',ispec,idomain_id
+           if( idomain_id == IDOMAIN_ACOUSTIC ) then
+             ispec_is_acoustic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_ELASTIC ) then
+             ispec_is_elastic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_POROELASTIC ) then
+             stop 'poroelastic material domain not implemented yet'
+             ispec_is_poroelastic(ispec) = .true.
+           else
+             stop 'error material domain index'
+           endif
+
+        enddo
+      enddo
+    enddo
+    !print*,myrank,'ispec:',ispec,'rho:',rhostore(1,1,1,ispec),'vp:',vpstore(1,1,1,ispec),'vs:',vsstore(1,1,1,ispec)
+  enddo
+
+  ! checks material domains
+  do ispec=1,nspec
+    ! checks if domain is set
+    if( (ispec_is_acoustic(ispec) .eqv. .false.) &
+          .and. (ispec_is_elastic(ispec) .eqv. .false.) &
+          .and. (ispec_is_poroelastic(ispec) .eqv. .false.) ) then
+      print*,'error material domain not assigned to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+    ! checks if domain is unique
+    if( ispec_is_acoustic(ispec) .eqv. .true. .and. ispec_is_elastic(ispec) .eqv. .true. ) then
+      print*,'error material domain assigned twice to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+  enddo
+
+! !! DK DK store the position of the six stations to be able to
+! !! DK DK exclude circles around each station to make sure they are on the bedrock
+! !! DK DK and not in the ice
+! in case, see file model_interface_bedrock.f90: routine model_bedrock_store()
+
+
+! import the model from files in SPECFEM format
+! note that those those files should be saved in LOCAL_PATH
+
+  if( USE_EXTERNAL_FILES ) then
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! if only vp structure is available (as is often the case in exploration seismology),
+!!! use lines for vp only
+
+    ! processors name
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+
+    allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array rho_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'rho.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) rho_read
+    close(28)
+
+    allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vp_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vp.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vp_read
+    close(28)
+
+    allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vs_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vs.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vs_read
+    close(28)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where density structure is not given
+!!! modify according to your desire
+
+!  rho_read = 1000.0
+!  where ( mustore > 100.0 )  &
+!           rho_read = (1.6612 * (vp_read / 1000.0)     &
+!                      -0.4720 * (vp_read / 1000.0)**2  &
+!                      +0.0671 * (vp_read / 1000.0)**3  &
+!                      -0.0043 * (vp_read / 1000.0)**4  &
+!                      +0.000106*(vp_read / 1000.0)**5 )*1000.0
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where shear wavespeed structure is not given
+!!! modify according to your desire
+
+!   vs_read = 0.0
+!   where ( mustore > 100.0 )       vs_read = vp_read / sqrt(3.0)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! update arrays that will be saved and used in the solver xspecfem3D
+!!! the following part is neccessary if you uncommented something above
+
+    rhostore    = rho_read
+    kappastore  = rhostore * ( vp_read * vp_read - FOUR_THIRDS * vs_read * vs_read )
+    mustore     = rhostore * vs_read * vs_read
+    rho_vp = rhostore * vp_read
+    rho_vs = rhostore * vs_read
+
+    ! free memory
+    deallocate( rho_read,vp_read,vs_read)
+
+  endif ! USE_EXTERNAL_FILES
+
+  end subroutine get_model
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/CMTSOLUTION
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/CMTSOLUTION	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/CMTSOLUTION	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,13 @@
+PDE  1999 01 01 00 00 00.00  67000 67000 -25000 4.2 4.2 hom_explosion
+event name:       hom_explosion
+time shift:       0.0000
+half duration:    5.0
+latitude:       1320.0
+longitude:      660.0
+depth:           0.020
+Mrr:       1.000000e+23
+Mtt:       1.000000e+23
+Mpp:       1.000000e+23
+Mrt:       0.000000
+Mrp:       0.000000
+Mtp:       0.000000

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/Par_file
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/Par_file	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/Par_file	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,55 @@
+
+# forward or adjoint simulation
+SIMULATION_TYPE = 3 
+NOISE_TOMOGRAPHY                = 0   # 0 = earthquake simulation,  1/2/3 = three steps in noise simulation
+SAVE_FORWARD = .false. 
+
+# UTM projection parameters
+UTM_PROJECTION_ZONE             = 11
+SUPPRESS_UTM_PROJECTION         = .true.
+
+# number of MPI processors
+NPROC                           = 4
+
+# time step parameters
+NSTEP = 3000 
+DT = 0.001 
+
+# parameters describing the model
+OCEANS                          = .false.
+TOPOGRAPHY                      = .false.
+ATTENUATION                     = .false.
+USE_OLSEN_ATTENUATION           = .false.
+ANISOTROPY                      = .false.
+
+# absorbing boundary conditions for a regional simulation
+ABSORBING_CONDITIONS            = .true.
+
+# save AVS or OpenDX movies
+MOVIE_SURFACE                   = .false.
+MOVIE_VOLUME                    = .false.
+NTSTEP_BETWEEN_FRAMES           = 100
+CREATE_SHAKEMAP                 = .false.
+SAVE_DISPLACEMENT               = .true.
+USE_HIGHRES_FOR_MOVIES          = .false.
+HDUR_MOVIE                      = 0.0
+
+# save AVS or OpenDX mesh files to check the mesh
+SAVE_MESH_FILES                 = .true.
+
+# path to store the local database file on each node
+LOCAL_PATH                      = ../in_out_files/DATABASES_MPI/
+
+# interval at which we output time step info and max of norm of displacement
+NTSTEP_BETWEEN_OUTPUT_INFO      = 100
+
+# interval in time steps for writing of seismograms
+NTSTEP_BETWEEN_OUTPUT_SEISMOS   = 10000
+
+# interval in time steps for reading adjoint traces
+NTSTEP_BETWEEN_READ_ADJSRC      = 0      # 0 = read the whole adjoint sources at the same time
+
+# print source time function
+PRINT_SOURCE_TIME_FUNCTION      = .true.
+
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,729 @@
+X1 Y1 0 0 10 10
+X2 Y1 0 100 10 10
+X3 Y1 0 200 10 10
+X4 Y1 0 300 10 10
+X5 Y1 0 400 10 10
+X6 Y1 0 500 10 10
+X7 Y1 0 600 10 10
+X8 Y1 0 700 10 10
+X9 Y1 0 800 10 10
+X10 Y1 0 900 10 10
+X11 Y1 0 1000 10 10
+X12 Y1 0 1100 10 10
+X13 Y1 0 1200 10 10
+X14 Y1 0 1300 10 10
+X15 Y1 0 1400 10 10
+X16 Y1 0 1500 10 10
+X17 Y1 0 1600 10 10
+X18 Y1 0 1700 10 10
+X19 Y1 0 1800 10 10
+X20 Y1 0 1900 10 10
+X21 Y1 0 2000 10 10
+X22 Y1 0 2100 10 10
+X23 Y1 0 2200 10 10
+X24 Y1 0 2300 10 10
+X25 Y1 0 2400 10 10
+X26 Y1 0 2500 10 10
+X27 Y1 0 2600 10 10
+X1 Y2 100 0 10 10
+X2 Y2 100 100 10 10
+X3 Y2 100 200 10 10
+X4 Y2 100 300 10 10
+X5 Y2 100 400 10 10
+X6 Y2 100 500 10 10
+X7 Y2 100 600 10 10
+X8 Y2 100 700 10 10
+X9 Y2 100 800 10 10
+X10 Y2 100 900 10 10
+X11 Y2 100 1000 10 10
+X12 Y2 100 1100 10 10
+X13 Y2 100 1200 10 10
+X14 Y2 100 1300 10 10
+X15 Y2 100 1400 10 10
+X16 Y2 100 1500 10 10
+X17 Y2 100 1600 10 10
+X18 Y2 100 1700 10 10
+X19 Y2 100 1800 10 10
+X20 Y2 100 1900 10 10
+X21 Y2 100 2000 10 10
+X22 Y2 100 2100 10 10
+X23 Y2 100 2200 10 10
+X24 Y2 100 2300 10 10
+X25 Y2 100 2400 10 10
+X26 Y2 100 2500 10 10
+X27 Y2 100 2600 10 10
+X1 Y3 200 0 10 10
+X2 Y3 200 100 10 10
+X3 Y3 200 200 10 10
+X4 Y3 200 300 10 10
+X5 Y3 200 400 10 10
+X6 Y3 200 500 10 10
+X7 Y3 200 600 10 10
+X8 Y3 200 700 10 10
+X9 Y3 200 800 10 10
+X10 Y3 200 900 10 10
+X11 Y3 200 1000 10 10
+X12 Y3 200 1100 10 10
+X13 Y3 200 1200 10 10
+X14 Y3 200 1300 10 10
+X15 Y3 200 1400 10 10
+X16 Y3 200 1500 10 10
+X17 Y3 200 1600 10 10
+X18 Y3 200 1700 10 10
+X19 Y3 200 1800 10 10
+X20 Y3 200 1900 10 10
+X21 Y3 200 2000 10 10
+X22 Y3 200 2100 10 10
+X23 Y3 200 2200 10 10
+X24 Y3 200 2300 10 10
+X25 Y3 200 2400 10 10
+X26 Y3 200 2500 10 10
+X27 Y3 200 2600 10 10
+X1 Y4 300 0 10 10
+X2 Y4 300 100 10 10
+X3 Y4 300 200 10 10
+X4 Y4 300 300 10 10
+X5 Y4 300 400 10 10
+X6 Y4 300 500 10 10
+X7 Y4 300 600 10 10
+X8 Y4 300 700 10 10
+X9 Y4 300 800 10 10
+X10 Y4 300 900 10 10
+X11 Y4 300 1000 10 10
+X12 Y4 300 1100 10 10
+X13 Y4 300 1200 10 10
+X14 Y4 300 1300 10 10
+X15 Y4 300 1400 10 10
+X16 Y4 300 1500 10 10
+X17 Y4 300 1600 10 10
+X18 Y4 300 1700 10 10
+X19 Y4 300 1800 10 10
+X20 Y4 300 1900 10 10
+X21 Y4 300 2000 10 10
+X22 Y4 300 2100 10 10
+X23 Y4 300 2200 10 10
+X24 Y4 300 2300 10 10
+X25 Y4 300 2400 10 10
+X26 Y4 300 2500 10 10
+X27 Y4 300 2600 10 10
+X1 Y5 400 0 10 10
+X2 Y5 400 100 10 10
+X3 Y5 400 200 10 10
+X4 Y5 400 300 10 10
+X5 Y5 400 400 10 10
+X6 Y5 400 500 10 10
+X7 Y5 400 600 10 10
+X8 Y5 400 700 10 10
+X9 Y5 400 800 10 10
+X10 Y5 400 900 10 10
+X11 Y5 400 1000 10 10
+X12 Y5 400 1100 10 10
+X13 Y5 400 1200 10 10
+X14 Y5 400 1300 10 10
+X15 Y5 400 1400 10 10
+X16 Y5 400 1500 10 10
+X17 Y5 400 1600 10 10
+X18 Y5 400 1700 10 10
+X19 Y5 400 1800 10 10
+X20 Y5 400 1900 10 10
+X21 Y5 400 2000 10 10
+X22 Y5 400 2100 10 10
+X23 Y5 400 2200 10 10
+X24 Y5 400 2300 10 10
+X25 Y5 400 2400 10 10
+X26 Y5 400 2500 10 10
+X27 Y5 400 2600 10 10
+X1 Y6 500 0 10 10
+X2 Y6 500 100 10 10
+X3 Y6 500 200 10 10
+X4 Y6 500 300 10 10
+X5 Y6 500 400 10 10
+X6 Y6 500 500 10 10
+X7 Y6 500 600 10 10
+X8 Y6 500 700 10 10
+X9 Y6 500 800 10 10
+X10 Y6 500 900 10 10
+X11 Y6 500 1000 10 10
+X12 Y6 500 1100 10 10
+X13 Y6 500 1200 10 10
+X14 Y6 500 1300 10 10
+X15 Y6 500 1400 10 10
+X16 Y6 500 1500 10 10
+X17 Y6 500 1600 10 10
+X18 Y6 500 1700 10 10
+X19 Y6 500 1800 10 10
+X20 Y6 500 1900 10 10
+X21 Y6 500 2000 10 10
+X22 Y6 500 2100 10 10
+X23 Y6 500 2200 10 10
+X24 Y6 500 2300 10 10
+X25 Y6 500 2400 10 10
+X26 Y6 500 2500 10 10
+X27 Y6 500 2600 10 10
+X1 Y7 600 0 10 10
+X2 Y7 600 100 10 10
+X3 Y7 600 200 10 10
+X4 Y7 600 300 10 10
+X5 Y7 600 400 10 10
+X6 Y7 600 500 10 10
+X7 Y7 600 600 10 10
+X8 Y7 600 700 10 10
+X9 Y7 600 800 10 10
+X10 Y7 600 900 10 10
+X11 Y7 600 1000 10 10
+X12 Y7 600 1100 10 10
+X13 Y7 600 1200 10 10
+X14 Y7 600 1300 10 10
+X15 Y7 600 1400 10 10
+X16 Y7 600 1500 10 10
+X17 Y7 600 1600 10 10
+X18 Y7 600 1700 10 10
+X19 Y7 600 1800 10 10
+X20 Y7 600 1900 10 10
+X21 Y7 600 2000 10 10
+X22 Y7 600 2100 10 10
+X23 Y7 600 2200 10 10
+X24 Y7 600 2300 10 10
+X25 Y7 600 2400 10 10
+X26 Y7 600 2500 10 10
+X27 Y7 600 2600 10 10
+X1 Y8 700 0 10 10
+X2 Y8 700 100 10 10
+X3 Y8 700 200 10 10
+X4 Y8 700 300 10 10
+X5 Y8 700 400 10 10
+X6 Y8 700 500 10 10
+X7 Y8 700 600 10 10
+X8 Y8 700 700 10 10
+X9 Y8 700 800 10 10
+X10 Y8 700 900 10 10
+X11 Y8 700 1000 10 10
+X12 Y8 700 1100 10 10
+X13 Y8 700 1200 10 10
+X14 Y8 700 1300 10 10
+X15 Y8 700 1400 10 10
+X16 Y8 700 1500 10 10
+X17 Y8 700 1600 10 10
+X18 Y8 700 1700 10 10
+X19 Y8 700 1800 10 10
+X20 Y8 700 1900 10 10
+X21 Y8 700 2000 10 10
+X22 Y8 700 2100 10 10
+X23 Y8 700 2200 10 10
+X24 Y8 700 2300 10 10
+X25 Y8 700 2400 10 10
+X26 Y8 700 2500 10 10
+X27 Y8 700 2600 10 10
+X1 Y9 800 0 10 10
+X2 Y9 800 100 10 10
+X3 Y9 800 200 10 10
+X4 Y9 800 300 10 10
+X5 Y9 800 400 10 10
+X6 Y9 800 500 10 10
+X7 Y9 800 600 10 10
+X8 Y9 800 700 10 10
+X9 Y9 800 800 10 10
+X10 Y9 800 900 10 10
+X11 Y9 800 1000 10 10
+X12 Y9 800 1100 10 10
+X13 Y9 800 1200 10 10
+X14 Y9 800 1300 10 10
+X15 Y9 800 1400 10 10
+X16 Y9 800 1500 10 10
+X17 Y9 800 1600 10 10
+X18 Y9 800 1700 10 10
+X19 Y9 800 1800 10 10
+X20 Y9 800 1900 10 10
+X21 Y9 800 2000 10 10
+X22 Y9 800 2100 10 10
+X23 Y9 800 2200 10 10
+X24 Y9 800 2300 10 10
+X25 Y9 800 2400 10 10
+X26 Y9 800 2500 10 10
+X27 Y9 800 2600 10 10
+X1 Y10 900 0 10 10
+X2 Y10 900 100 10 10
+X3 Y10 900 200 10 10
+X4 Y10 900 300 10 10
+X5 Y10 900 400 10 10
+X6 Y10 900 500 10 10
+X7 Y10 900 600 10 10
+X8 Y10 900 700 10 10
+X9 Y10 900 800 10 10
+X10 Y10 900 900 10 10
+X11 Y10 900 1000 10 10
+X12 Y10 900 1100 10 10
+X13 Y10 900 1200 10 10
+X14 Y10 900 1300 10 10
+X15 Y10 900 1400 10 10
+X16 Y10 900 1500 10 10
+X17 Y10 900 1600 10 10
+X18 Y10 900 1700 10 10
+X19 Y10 900 1800 10 10
+X20 Y10 900 1900 10 10
+X21 Y10 900 2000 10 10
+X22 Y10 900 2100 10 10
+X23 Y10 900 2200 10 10
+X24 Y10 900 2300 10 10
+X25 Y10 900 2400 10 10
+X26 Y10 900 2500 10 10
+X27 Y10 900 2600 10 10
+X1 Y11 1000 0 10 10
+X2 Y11 1000 100 10 10
+X3 Y11 1000 200 10 10
+X4 Y11 1000 300 10 10
+X5 Y11 1000 400 10 10
+X6 Y11 1000 500 10 10
+X7 Y11 1000 600 10 10
+X8 Y11 1000 700 10 10
+X9 Y11 1000 800 10 10
+X10 Y11 1000 900 10 10
+X11 Y11 1000 1000 10 10
+X12 Y11 1000 1100 10 10
+X13 Y11 1000 1200 10 10
+X14 Y11 1000 1300 10 10
+X15 Y11 1000 1400 10 10
+X16 Y11 1000 1500 10 10
+X17 Y11 1000 1600 10 10
+X18 Y11 1000 1700 10 10
+X19 Y11 1000 1800 10 10
+X20 Y11 1000 1900 10 10
+X21 Y11 1000 2000 10 10
+X22 Y11 1000 2100 10 10
+X23 Y11 1000 2200 10 10
+X24 Y11 1000 2300 10 10
+X25 Y11 1000 2400 10 10
+X26 Y11 1000 2500 10 10
+X27 Y11 1000 2600 10 10
+X1 Y12 1100 0 10 10
+X2 Y12 1100 100 10 10
+X3 Y12 1100 200 10 10
+X4 Y12 1100 300 10 10
+X5 Y12 1100 400 10 10
+X6 Y12 1100 500 10 10
+X7 Y12 1100 600 10 10
+X8 Y12 1100 700 10 10
+X9 Y12 1100 800 10 10
+X10 Y12 1100 900 10 10
+X11 Y12 1100 1000 10 10
+X12 Y12 1100 1100 10 10
+X13 Y12 1100 1200 10 10
+X14 Y12 1100 1300 10 10
+X15 Y12 1100 1400 10 10
+X16 Y12 1100 1500 10 10
+X17 Y12 1100 1600 10 10
+X18 Y12 1100 1700 10 10
+X19 Y12 1100 1800 10 10
+X20 Y12 1100 1900 10 10
+X21 Y12 1100 2000 10 10
+X22 Y12 1100 2100 10 10
+X23 Y12 1100 2200 10 10
+X24 Y12 1100 2300 10 10
+X25 Y12 1100 2400 10 10
+X26 Y12 1100 2500 10 10
+X27 Y12 1100 2600 10 10
+X1 Y13 1200 0 10 10
+X2 Y13 1200 100 10 10
+X3 Y13 1200 200 10 10
+X4 Y13 1200 300 10 10
+X5 Y13 1200 400 10 10
+X6 Y13 1200 500 10 10
+X7 Y13 1200 600 10 10
+X8 Y13 1200 700 10 10
+X9 Y13 1200 800 10 10
+X10 Y13 1200 900 10 10
+X11 Y13 1200 1000 10 10
+X12 Y13 1200 1100 10 10
+X13 Y13 1200 1200 10 10
+X14 Y13 1200 1300 10 10
+X15 Y13 1200 1400 10 10
+X16 Y13 1200 1500 10 10
+X17 Y13 1200 1600 10 10
+X18 Y13 1200 1700 10 10
+X19 Y13 1200 1800 10 10
+X20 Y13 1200 1900 10 10
+X21 Y13 1200 2000 10 10
+X22 Y13 1200 2100 10 10
+X23 Y13 1200 2200 10 10
+X24 Y13 1200 2300 10 10
+X25 Y13 1200 2400 10 10
+X26 Y13 1200 2500 10 10
+X27 Y13 1200 2600 10 10
+X1 Y14 1300 0 10 10
+X2 Y14 1300 100 10 10
+X3 Y14 1300 200 10 10
+X4 Y14 1300 300 10 10
+X5 Y14 1300 400 10 10
+X6 Y14 1300 500 10 10
+X7 Y14 1300 600 10 10
+X8 Y14 1300 700 10 10
+X9 Y14 1300 800 10 10
+X10 Y14 1300 900 10 10
+X11 Y14 1300 1000 10 10
+X12 Y14 1300 1100 10 10
+X13 Y14 1300 1200 10 10
+X14 Y14 1300 1300 10 10
+X15 Y14 1300 1400 10 10
+X16 Y14 1300 1500 10 10
+X17 Y14 1300 1600 10 10
+X18 Y14 1300 1700 10 10
+X19 Y14 1300 1800 10 10
+X20 Y14 1300 1900 10 10
+X21 Y14 1300 2000 10 10
+X22 Y14 1300 2100 10 10
+X23 Y14 1300 2200 10 10
+X24 Y14 1300 2300 10 10
+X25 Y14 1300 2400 10 10
+X26 Y14 1300 2500 10 10
+X27 Y14 1300 2600 10 10
+X1 Y15 1400 0 10 10
+X2 Y15 1400 100 10 10
+X3 Y15 1400 200 10 10
+X4 Y15 1400 300 10 10
+X5 Y15 1400 400 10 10
+X6 Y15 1400 500 10 10
+X7 Y15 1400 600 10 10
+X8 Y15 1400 700 10 10
+X9 Y15 1400 800 10 10
+X10 Y15 1400 900 10 10
+X11 Y15 1400 1000 10 10
+X12 Y15 1400 1100 10 10
+X13 Y15 1400 1200 10 10
+X14 Y15 1400 1300 10 10
+X15 Y15 1400 1400 10 10
+X16 Y15 1400 1500 10 10
+X17 Y15 1400 1600 10 10
+X18 Y15 1400 1700 10 10
+X19 Y15 1400 1800 10 10
+X20 Y15 1400 1900 10 10
+X21 Y15 1400 2000 10 10
+X22 Y15 1400 2100 10 10
+X23 Y15 1400 2200 10 10
+X24 Y15 1400 2300 10 10
+X25 Y15 1400 2400 10 10
+X26 Y15 1400 2500 10 10
+X27 Y15 1400 2600 10 10
+X1 Y16 1500 0 10 10
+X2 Y16 1500 100 10 10
+X3 Y16 1500 200 10 10
+X4 Y16 1500 300 10 10
+X5 Y16 1500 400 10 10
+X6 Y16 1500 500 10 10
+X7 Y16 1500 600 10 10
+X8 Y16 1500 700 10 10
+X9 Y16 1500 800 10 10
+X10 Y16 1500 900 10 10
+X11 Y16 1500 1000 10 10
+X12 Y16 1500 1100 10 10
+X13 Y16 1500 1200 10 10
+X14 Y16 1500 1300 10 10
+X15 Y16 1500 1400 10 10
+X16 Y16 1500 1500 10 10
+X17 Y16 1500 1600 10 10
+X18 Y16 1500 1700 10 10
+X19 Y16 1500 1800 10 10
+X20 Y16 1500 1900 10 10
+X21 Y16 1500 2000 10 10
+X22 Y16 1500 2100 10 10
+X23 Y16 1500 2200 10 10
+X24 Y16 1500 2300 10 10
+X25 Y16 1500 2400 10 10
+X26 Y16 1500 2500 10 10
+X27 Y16 1500 2600 10 10
+X1 Y17 1600 0 10 10
+X2 Y17 1600 100 10 10
+X3 Y17 1600 200 10 10
+X4 Y17 1600 300 10 10
+X5 Y17 1600 400 10 10
+X6 Y17 1600 500 10 10
+X7 Y17 1600 600 10 10
+X8 Y17 1600 700 10 10
+X9 Y17 1600 800 10 10
+X10 Y17 1600 900 10 10
+X11 Y17 1600 1000 10 10
+X12 Y17 1600 1100 10 10
+X13 Y17 1600 1200 10 10
+X14 Y17 1600 1300 10 10
+X15 Y17 1600 1400 10 10
+X16 Y17 1600 1500 10 10
+X17 Y17 1600 1600 10 10
+X18 Y17 1600 1700 10 10
+X19 Y17 1600 1800 10 10
+X20 Y17 1600 1900 10 10
+X21 Y17 1600 2000 10 10
+X22 Y17 1600 2100 10 10
+X23 Y17 1600 2200 10 10
+X24 Y17 1600 2300 10 10
+X25 Y17 1600 2400 10 10
+X26 Y17 1600 2500 10 10
+X27 Y17 1600 2600 10 10
+X1 Y18 1700 0 10 10
+X2 Y18 1700 100 10 10
+X3 Y18 1700 200 10 10
+X4 Y18 1700 300 10 10
+X5 Y18 1700 400 10 10
+X6 Y18 1700 500 10 10
+X7 Y18 1700 600 10 10
+X8 Y18 1700 700 10 10
+X9 Y18 1700 800 10 10
+X10 Y18 1700 900 10 10
+X11 Y18 1700 1000 10 10
+X12 Y18 1700 1100 10 10
+X13 Y18 1700 1200 10 10
+X14 Y18 1700 1300 10 10
+X15 Y18 1700 1400 10 10
+X16 Y18 1700 1500 10 10
+X17 Y18 1700 1600 10 10
+X18 Y18 1700 1700 10 10
+X19 Y18 1700 1800 10 10
+X20 Y18 1700 1900 10 10
+X21 Y18 1700 2000 10 10
+X22 Y18 1700 2100 10 10
+X23 Y18 1700 2200 10 10
+X24 Y18 1700 2300 10 10
+X25 Y18 1700 2400 10 10
+X26 Y18 1700 2500 10 10
+X27 Y18 1700 2600 10 10
+X1 Y19 1800 0 10 10
+X2 Y19 1800 100 10 10
+X3 Y19 1800 200 10 10
+X4 Y19 1800 300 10 10
+X5 Y19 1800 400 10 10
+X6 Y19 1800 500 10 10
+X7 Y19 1800 600 10 10
+X8 Y19 1800 700 10 10
+X9 Y19 1800 800 10 10
+X10 Y19 1800 900 10 10
+X11 Y19 1800 1000 10 10
+X12 Y19 1800 1100 10 10
+X13 Y19 1800 1200 10 10
+X14 Y19 1800 1300 10 10
+X15 Y19 1800 1400 10 10
+X16 Y19 1800 1500 10 10
+X17 Y19 1800 1600 10 10
+X18 Y19 1800 1700 10 10
+X19 Y19 1800 1800 10 10
+X20 Y19 1800 1900 10 10
+X21 Y19 1800 2000 10 10
+X22 Y19 1800 2100 10 10
+X23 Y19 1800 2200 10 10
+X24 Y19 1800 2300 10 10
+X25 Y19 1800 2400 10 10
+X26 Y19 1800 2500 10 10
+X27 Y19 1800 2600 10 10
+X1 Y20 1900 0 10 10
+X2 Y20 1900 100 10 10
+X3 Y20 1900 200 10 10
+X4 Y20 1900 300 10 10
+X5 Y20 1900 400 10 10
+X6 Y20 1900 500 10 10
+X7 Y20 1900 600 10 10
+X8 Y20 1900 700 10 10
+X9 Y20 1900 800 10 10
+X10 Y20 1900 900 10 10
+X11 Y20 1900 1000 10 10
+X12 Y20 1900 1100 10 10
+X13 Y20 1900 1200 10 10
+X14 Y20 1900 1300 10 10
+X15 Y20 1900 1400 10 10
+X16 Y20 1900 1500 10 10
+X17 Y20 1900 1600 10 10
+X18 Y20 1900 1700 10 10
+X19 Y20 1900 1800 10 10
+X20 Y20 1900 1900 10 10
+X21 Y20 1900 2000 10 10
+X22 Y20 1900 2100 10 10
+X23 Y20 1900 2200 10 10
+X24 Y20 1900 2300 10 10
+X25 Y20 1900 2400 10 10
+X26 Y20 1900 2500 10 10
+X27 Y20 1900 2600 10 10
+X1 Y21 2000 0 10 10
+X2 Y21 2000 100 10 10
+X3 Y21 2000 200 10 10
+X4 Y21 2000 300 10 10
+X5 Y21 2000 400 10 10
+X6 Y21 2000 500 10 10
+X7 Y21 2000 600 10 10
+X8 Y21 2000 700 10 10
+X9 Y21 2000 800 10 10
+X10 Y21 2000 900 10 10
+X11 Y21 2000 1000 10 10
+X12 Y21 2000 1100 10 10
+X13 Y21 2000 1200 10 10
+X14 Y21 2000 1300 10 10
+X15 Y21 2000 1400 10 10
+X16 Y21 2000 1500 10 10
+X17 Y21 2000 1600 10 10
+X18 Y21 2000 1700 10 10
+X19 Y21 2000 1800 10 10
+X20 Y21 2000 1900 10 10
+X21 Y21 2000 2000 10 10
+X22 Y21 2000 2100 10 10
+X23 Y21 2000 2200 10 10
+X24 Y21 2000 2300 10 10
+X25 Y21 2000 2400 10 10
+X26 Y21 2000 2500 10 10
+X27 Y21 2000 2600 10 10
+X1 Y22 2100 0 10 10
+X2 Y22 2100 100 10 10
+X3 Y22 2100 200 10 10
+X4 Y22 2100 300 10 10
+X5 Y22 2100 400 10 10
+X6 Y22 2100 500 10 10
+X7 Y22 2100 600 10 10
+X8 Y22 2100 700 10 10
+X9 Y22 2100 800 10 10
+X10 Y22 2100 900 10 10
+X11 Y22 2100 1000 10 10
+X12 Y22 2100 1100 10 10
+X13 Y22 2100 1200 10 10
+X14 Y22 2100 1300 10 10
+X15 Y22 2100 1400 10 10
+X16 Y22 2100 1500 10 10
+X17 Y22 2100 1600 10 10
+X18 Y22 2100 1700 10 10
+X19 Y22 2100 1800 10 10
+X20 Y22 2100 1900 10 10
+X21 Y22 2100 2000 10 10
+X22 Y22 2100 2100 10 10
+X23 Y22 2100 2200 10 10
+X24 Y22 2100 2300 10 10
+X25 Y22 2100 2400 10 10
+X26 Y22 2100 2500 10 10
+X27 Y22 2100 2600 10 10
+X1 Y23 2200 0 10 10
+X2 Y23 2200 100 10 10
+X3 Y23 2200 200 10 10
+X4 Y23 2200 300 10 10
+X5 Y23 2200 400 10 10
+X6 Y23 2200 500 10 10
+X7 Y23 2200 600 10 10
+X8 Y23 2200 700 10 10
+X9 Y23 2200 800 10 10
+X10 Y23 2200 900 10 10
+X11 Y23 2200 1000 10 10
+X12 Y23 2200 1100 10 10
+X13 Y23 2200 1200 10 10
+X14 Y23 2200 1300 10 10
+X15 Y23 2200 1400 10 10
+X16 Y23 2200 1500 10 10
+X17 Y23 2200 1600 10 10
+X18 Y23 2200 1700 10 10
+X19 Y23 2200 1800 10 10
+X20 Y23 2200 1900 10 10
+X21 Y23 2200 2000 10 10
+X22 Y23 2200 2100 10 10
+X23 Y23 2200 2200 10 10
+X24 Y23 2200 2300 10 10
+X25 Y23 2200 2400 10 10
+X26 Y23 2200 2500 10 10
+X27 Y23 2200 2600 10 10
+X1 Y24 2300 0 10 10
+X2 Y24 2300 100 10 10
+X3 Y24 2300 200 10 10
+X4 Y24 2300 300 10 10
+X5 Y24 2300 400 10 10
+X6 Y24 2300 500 10 10
+X7 Y24 2300 600 10 10
+X8 Y24 2300 700 10 10
+X9 Y24 2300 800 10 10
+X10 Y24 2300 900 10 10
+X11 Y24 2300 1000 10 10
+X12 Y24 2300 1100 10 10
+X13 Y24 2300 1200 10 10
+X14 Y24 2300 1300 10 10
+X15 Y24 2300 1400 10 10
+X16 Y24 2300 1500 10 10
+X17 Y24 2300 1600 10 10
+X18 Y24 2300 1700 10 10
+X19 Y24 2300 1800 10 10
+X20 Y24 2300 1900 10 10
+X21 Y24 2300 2000 10 10
+X22 Y24 2300 2100 10 10
+X23 Y24 2300 2200 10 10
+X24 Y24 2300 2300 10 10
+X25 Y24 2300 2400 10 10
+X26 Y24 2300 2500 10 10
+X27 Y24 2300 2600 10 10
+X1 Y25 2400 0 10 10
+X2 Y25 2400 100 10 10
+X3 Y25 2400 200 10 10
+X4 Y25 2400 300 10 10
+X5 Y25 2400 400 10 10
+X6 Y25 2400 500 10 10
+X7 Y25 2400 600 10 10
+X8 Y25 2400 700 10 10
+X9 Y25 2400 800 10 10
+X10 Y25 2400 900 10 10
+X11 Y25 2400 1000 10 10
+X12 Y25 2400 1100 10 10
+X13 Y25 2400 1200 10 10
+X14 Y25 2400 1300 10 10
+X15 Y25 2400 1400 10 10
+X16 Y25 2400 1500 10 10
+X17 Y25 2400 1600 10 10
+X18 Y25 2400 1700 10 10
+X19 Y25 2400 1800 10 10
+X20 Y25 2400 1900 10 10
+X21 Y25 2400 2000 10 10
+X22 Y25 2400 2100 10 10
+X23 Y25 2400 2200 10 10
+X24 Y25 2400 2300 10 10
+X25 Y25 2400 2400 10 10
+X26 Y25 2400 2500 10 10
+X27 Y25 2400 2600 10 10
+X1 Y26 2500 0 10 10
+X2 Y26 2500 100 10 10
+X3 Y26 2500 200 10 10
+X4 Y26 2500 300 10 10
+X5 Y26 2500 400 10 10
+X6 Y26 2500 500 10 10
+X7 Y26 2500 600 10 10
+X8 Y26 2500 700 10 10
+X9 Y26 2500 800 10 10
+X10 Y26 2500 900 10 10
+X11 Y26 2500 1000 10 10
+X12 Y26 2500 1100 10 10
+X13 Y26 2500 1200 10 10
+X14 Y26 2500 1300 10 10
+X15 Y26 2500 1400 10 10
+X16 Y26 2500 1500 10 10
+X17 Y26 2500 1600 10 10
+X18 Y26 2500 1700 10 10
+X19 Y26 2500 1800 10 10
+X20 Y26 2500 1900 10 10
+X21 Y26 2500 2000 10 10
+X22 Y26 2500 2100 10 10
+X23 Y26 2500 2200 10 10
+X24 Y26 2500 2300 10 10
+X25 Y26 2500 2400 10 10
+X26 Y26 2500 2500 10 10
+X27 Y26 2500 2600 10 10
+X1 Y27 2600 0 10 10
+X2 Y27 2600 100 10 10
+X3 Y27 2600 200 10 10
+X4 Y27 2600 300 10 10
+X5 Y27 2600 400 10 10
+X6 Y27 2600 500 10 10
+X7 Y27 2600 600 10 10
+X8 Y27 2600 700 10 10
+X9 Y27 2600 800 10 10
+X10 Y27 2600 900 10 10
+X11 Y27 2600 1000 10 10
+X12 Y27 2600 1100 10 10
+X13 Y27 2600 1200 10 10
+X14 Y27 2600 1300 10 10
+X15 Y27 2600 1400 10 10
+X16 Y27 2600 1500 10 10
+X17 Y27 2600 1600 10 10
+X18 Y27 2600 1700 10 10
+X19 Y27 2600 1800 10 10
+X20 Y27 2600 1900 10 10
+X21 Y27 2600 2000 10 10
+X22 Y27 2600 2100 10 10
+X23 Y27 2600 2200 10 10
+X24 Y27 2600 2300 10 10
+X25 Y27 2600 2400 10 10
+X26 Y27 2600 2500 10 10
+X27 Y27 2600 2600 10 10

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS_ADJOINT
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS_ADJOINT	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/STATIONS_ADJOINT	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,729 @@
+X1 Y1 0 0 10 10
+X2 Y1 0 100 10 10
+X3 Y1 0 200 10 10
+X4 Y1 0 300 10 10
+X5 Y1 0 400 10 10
+X6 Y1 0 500 10 10
+X7 Y1 0 600 10 10
+X8 Y1 0 700 10 10
+X9 Y1 0 800 10 10
+X10 Y1 0 900 10 10
+X11 Y1 0 1000 10 10
+X12 Y1 0 1100 10 10
+X13 Y1 0 1200 10 10
+X14 Y1 0 1300 10 10
+X15 Y1 0 1400 10 10
+X16 Y1 0 1500 10 10
+X17 Y1 0 1600 10 10
+X18 Y1 0 1700 10 10
+X19 Y1 0 1800 10 10
+X20 Y1 0 1900 10 10
+X21 Y1 0 2000 10 10
+X22 Y1 0 2100 10 10
+X23 Y1 0 2200 10 10
+X24 Y1 0 2300 10 10
+X25 Y1 0 2400 10 10
+X26 Y1 0 2500 10 10
+X27 Y1 0 2600 10 10
+X1 Y2 100 0 10 10
+X2 Y2 100 100 10 10
+X3 Y2 100 200 10 10
+X4 Y2 100 300 10 10
+X5 Y2 100 400 10 10
+X6 Y2 100 500 10 10
+X7 Y2 100 600 10 10
+X8 Y2 100 700 10 10
+X9 Y2 100 800 10 10
+X10 Y2 100 900 10 10
+X11 Y2 100 1000 10 10
+X12 Y2 100 1100 10 10
+X13 Y2 100 1200 10 10
+X14 Y2 100 1300 10 10
+X15 Y2 100 1400 10 10
+X16 Y2 100 1500 10 10
+X17 Y2 100 1600 10 10
+X18 Y2 100 1700 10 10
+X19 Y2 100 1800 10 10
+X20 Y2 100 1900 10 10
+X21 Y2 100 2000 10 10
+X22 Y2 100 2100 10 10
+X23 Y2 100 2200 10 10
+X24 Y2 100 2300 10 10
+X25 Y2 100 2400 10 10
+X26 Y2 100 2500 10 10
+X27 Y2 100 2600 10 10
+X1 Y3 200 0 10 10
+X2 Y3 200 100 10 10
+X3 Y3 200 200 10 10
+X4 Y3 200 300 10 10
+X5 Y3 200 400 10 10
+X6 Y3 200 500 10 10
+X7 Y3 200 600 10 10
+X8 Y3 200 700 10 10
+X9 Y3 200 800 10 10
+X10 Y3 200 900 10 10
+X11 Y3 200 1000 10 10
+X12 Y3 200 1100 10 10
+X13 Y3 200 1200 10 10
+X14 Y3 200 1300 10 10
+X15 Y3 200 1400 10 10
+X16 Y3 200 1500 10 10
+X17 Y3 200 1600 10 10
+X18 Y3 200 1700 10 10
+X19 Y3 200 1800 10 10
+X20 Y3 200 1900 10 10
+X21 Y3 200 2000 10 10
+X22 Y3 200 2100 10 10
+X23 Y3 200 2200 10 10
+X24 Y3 200 2300 10 10
+X25 Y3 200 2400 10 10
+X26 Y3 200 2500 10 10
+X27 Y3 200 2600 10 10
+X1 Y4 300 0 10 10
+X2 Y4 300 100 10 10
+X3 Y4 300 200 10 10
+X4 Y4 300 300 10 10
+X5 Y4 300 400 10 10
+X6 Y4 300 500 10 10
+X7 Y4 300 600 10 10
+X8 Y4 300 700 10 10
+X9 Y4 300 800 10 10
+X10 Y4 300 900 10 10
+X11 Y4 300 1000 10 10
+X12 Y4 300 1100 10 10
+X13 Y4 300 1200 10 10
+X14 Y4 300 1300 10 10
+X15 Y4 300 1400 10 10
+X16 Y4 300 1500 10 10
+X17 Y4 300 1600 10 10
+X18 Y4 300 1700 10 10
+X19 Y4 300 1800 10 10
+X20 Y4 300 1900 10 10
+X21 Y4 300 2000 10 10
+X22 Y4 300 2100 10 10
+X23 Y4 300 2200 10 10
+X24 Y4 300 2300 10 10
+X25 Y4 300 2400 10 10
+X26 Y4 300 2500 10 10
+X27 Y4 300 2600 10 10
+X1 Y5 400 0 10 10
+X2 Y5 400 100 10 10
+X3 Y5 400 200 10 10
+X4 Y5 400 300 10 10
+X5 Y5 400 400 10 10
+X6 Y5 400 500 10 10
+X7 Y5 400 600 10 10
+X8 Y5 400 700 10 10
+X9 Y5 400 800 10 10
+X10 Y5 400 900 10 10
+X11 Y5 400 1000 10 10
+X12 Y5 400 1100 10 10
+X13 Y5 400 1200 10 10
+X14 Y5 400 1300 10 10
+X15 Y5 400 1400 10 10
+X16 Y5 400 1500 10 10
+X17 Y5 400 1600 10 10
+X18 Y5 400 1700 10 10
+X19 Y5 400 1800 10 10
+X20 Y5 400 1900 10 10
+X21 Y5 400 2000 10 10
+X22 Y5 400 2100 10 10
+X23 Y5 400 2200 10 10
+X24 Y5 400 2300 10 10
+X25 Y5 400 2400 10 10
+X26 Y5 400 2500 10 10
+X27 Y5 400 2600 10 10
+X1 Y6 500 0 10 10
+X2 Y6 500 100 10 10
+X3 Y6 500 200 10 10
+X4 Y6 500 300 10 10
+X5 Y6 500 400 10 10
+X6 Y6 500 500 10 10
+X7 Y6 500 600 10 10
+X8 Y6 500 700 10 10
+X9 Y6 500 800 10 10
+X10 Y6 500 900 10 10
+X11 Y6 500 1000 10 10
+X12 Y6 500 1100 10 10
+X13 Y6 500 1200 10 10
+X14 Y6 500 1300 10 10
+X15 Y6 500 1400 10 10
+X16 Y6 500 1500 10 10
+X17 Y6 500 1600 10 10
+X18 Y6 500 1700 10 10
+X19 Y6 500 1800 10 10
+X20 Y6 500 1900 10 10
+X21 Y6 500 2000 10 10
+X22 Y6 500 2100 10 10
+X23 Y6 500 2200 10 10
+X24 Y6 500 2300 10 10
+X25 Y6 500 2400 10 10
+X26 Y6 500 2500 10 10
+X27 Y6 500 2600 10 10
+X1 Y7 600 0 10 10
+X2 Y7 600 100 10 10
+X3 Y7 600 200 10 10
+X4 Y7 600 300 10 10
+X5 Y7 600 400 10 10
+X6 Y7 600 500 10 10
+X7 Y7 600 600 10 10
+X8 Y7 600 700 10 10
+X9 Y7 600 800 10 10
+X10 Y7 600 900 10 10
+X11 Y7 600 1000 10 10
+X12 Y7 600 1100 10 10
+X13 Y7 600 1200 10 10
+X14 Y7 600 1300 10 10
+X15 Y7 600 1400 10 10
+X16 Y7 600 1500 10 10
+X17 Y7 600 1600 10 10
+X18 Y7 600 1700 10 10
+X19 Y7 600 1800 10 10
+X20 Y7 600 1900 10 10
+X21 Y7 600 2000 10 10
+X22 Y7 600 2100 10 10
+X23 Y7 600 2200 10 10
+X24 Y7 600 2300 10 10
+X25 Y7 600 2400 10 10
+X26 Y7 600 2500 10 10
+X27 Y7 600 2600 10 10
+X1 Y8 700 0 10 10
+X2 Y8 700 100 10 10
+X3 Y8 700 200 10 10
+X4 Y8 700 300 10 10
+X5 Y8 700 400 10 10
+X6 Y8 700 500 10 10
+X7 Y8 700 600 10 10
+X8 Y8 700 700 10 10
+X9 Y8 700 800 10 10
+X10 Y8 700 900 10 10
+X11 Y8 700 1000 10 10
+X12 Y8 700 1100 10 10
+X13 Y8 700 1200 10 10
+X14 Y8 700 1300 10 10
+X15 Y8 700 1400 10 10
+X16 Y8 700 1500 10 10
+X17 Y8 700 1600 10 10
+X18 Y8 700 1700 10 10
+X19 Y8 700 1800 10 10
+X20 Y8 700 1900 10 10
+X21 Y8 700 2000 10 10
+X22 Y8 700 2100 10 10
+X23 Y8 700 2200 10 10
+X24 Y8 700 2300 10 10
+X25 Y8 700 2400 10 10
+X26 Y8 700 2500 10 10
+X27 Y8 700 2600 10 10
+X1 Y9 800 0 10 10
+X2 Y9 800 100 10 10
+X3 Y9 800 200 10 10
+X4 Y9 800 300 10 10
+X5 Y9 800 400 10 10
+X6 Y9 800 500 10 10
+X7 Y9 800 600 10 10
+X8 Y9 800 700 10 10
+X9 Y9 800 800 10 10
+X10 Y9 800 900 10 10
+X11 Y9 800 1000 10 10
+X12 Y9 800 1100 10 10
+X13 Y9 800 1200 10 10
+X14 Y9 800 1300 10 10
+X15 Y9 800 1400 10 10
+X16 Y9 800 1500 10 10
+X17 Y9 800 1600 10 10
+X18 Y9 800 1700 10 10
+X19 Y9 800 1800 10 10
+X20 Y9 800 1900 10 10
+X21 Y9 800 2000 10 10
+X22 Y9 800 2100 10 10
+X23 Y9 800 2200 10 10
+X24 Y9 800 2300 10 10
+X25 Y9 800 2400 10 10
+X26 Y9 800 2500 10 10
+X27 Y9 800 2600 10 10
+X1 Y10 900 0 10 10
+X2 Y10 900 100 10 10
+X3 Y10 900 200 10 10
+X4 Y10 900 300 10 10
+X5 Y10 900 400 10 10
+X6 Y10 900 500 10 10
+X7 Y10 900 600 10 10
+X8 Y10 900 700 10 10
+X9 Y10 900 800 10 10
+X10 Y10 900 900 10 10
+X11 Y10 900 1000 10 10
+X12 Y10 900 1100 10 10
+X13 Y10 900 1200 10 10
+X14 Y10 900 1300 10 10
+X15 Y10 900 1400 10 10
+X16 Y10 900 1500 10 10
+X17 Y10 900 1600 10 10
+X18 Y10 900 1700 10 10
+X19 Y10 900 1800 10 10
+X20 Y10 900 1900 10 10
+X21 Y10 900 2000 10 10
+X22 Y10 900 2100 10 10
+X23 Y10 900 2200 10 10
+X24 Y10 900 2300 10 10
+X25 Y10 900 2400 10 10
+X26 Y10 900 2500 10 10
+X27 Y10 900 2600 10 10
+X1 Y11 1000 0 10 10
+X2 Y11 1000 100 10 10
+X3 Y11 1000 200 10 10
+X4 Y11 1000 300 10 10
+X5 Y11 1000 400 10 10
+X6 Y11 1000 500 10 10
+X7 Y11 1000 600 10 10
+X8 Y11 1000 700 10 10
+X9 Y11 1000 800 10 10
+X10 Y11 1000 900 10 10
+X11 Y11 1000 1000 10 10
+X12 Y11 1000 1100 10 10
+X13 Y11 1000 1200 10 10
+X14 Y11 1000 1300 10 10
+X15 Y11 1000 1400 10 10
+X16 Y11 1000 1500 10 10
+X17 Y11 1000 1600 10 10
+X18 Y11 1000 1700 10 10
+X19 Y11 1000 1800 10 10
+X20 Y11 1000 1900 10 10
+X21 Y11 1000 2000 10 10
+X22 Y11 1000 2100 10 10
+X23 Y11 1000 2200 10 10
+X24 Y11 1000 2300 10 10
+X25 Y11 1000 2400 10 10
+X26 Y11 1000 2500 10 10
+X27 Y11 1000 2600 10 10
+X1 Y12 1100 0 10 10
+X2 Y12 1100 100 10 10
+X3 Y12 1100 200 10 10
+X4 Y12 1100 300 10 10
+X5 Y12 1100 400 10 10
+X6 Y12 1100 500 10 10
+X7 Y12 1100 600 10 10
+X8 Y12 1100 700 10 10
+X9 Y12 1100 800 10 10
+X10 Y12 1100 900 10 10
+X11 Y12 1100 1000 10 10
+X12 Y12 1100 1100 10 10
+X13 Y12 1100 1200 10 10
+X14 Y12 1100 1300 10 10
+X15 Y12 1100 1400 10 10
+X16 Y12 1100 1500 10 10
+X17 Y12 1100 1600 10 10
+X18 Y12 1100 1700 10 10
+X19 Y12 1100 1800 10 10
+X20 Y12 1100 1900 10 10
+X21 Y12 1100 2000 10 10
+X22 Y12 1100 2100 10 10
+X23 Y12 1100 2200 10 10
+X24 Y12 1100 2300 10 10
+X25 Y12 1100 2400 10 10
+X26 Y12 1100 2500 10 10
+X27 Y12 1100 2600 10 10
+X1 Y13 1200 0 10 10
+X2 Y13 1200 100 10 10
+X3 Y13 1200 200 10 10
+X4 Y13 1200 300 10 10
+X5 Y13 1200 400 10 10
+X6 Y13 1200 500 10 10
+X7 Y13 1200 600 10 10
+X8 Y13 1200 700 10 10
+X9 Y13 1200 800 10 10
+X10 Y13 1200 900 10 10
+X11 Y13 1200 1000 10 10
+X12 Y13 1200 1100 10 10
+X13 Y13 1200 1200 10 10
+X14 Y13 1200 1300 10 10
+X15 Y13 1200 1400 10 10
+X16 Y13 1200 1500 10 10
+X17 Y13 1200 1600 10 10
+X18 Y13 1200 1700 10 10
+X19 Y13 1200 1800 10 10
+X20 Y13 1200 1900 10 10
+X21 Y13 1200 2000 10 10
+X22 Y13 1200 2100 10 10
+X23 Y13 1200 2200 10 10
+X24 Y13 1200 2300 10 10
+X25 Y13 1200 2400 10 10
+X26 Y13 1200 2500 10 10
+X27 Y13 1200 2600 10 10
+X1 Y14 1300 0 10 10
+X2 Y14 1300 100 10 10
+X3 Y14 1300 200 10 10
+X4 Y14 1300 300 10 10
+X5 Y14 1300 400 10 10
+X6 Y14 1300 500 10 10
+X7 Y14 1300 600 10 10
+X8 Y14 1300 700 10 10
+X9 Y14 1300 800 10 10
+X10 Y14 1300 900 10 10
+X11 Y14 1300 1000 10 10
+X12 Y14 1300 1100 10 10
+X13 Y14 1300 1200 10 10
+X14 Y14 1300 1300 10 10
+X15 Y14 1300 1400 10 10
+X16 Y14 1300 1500 10 10
+X17 Y14 1300 1600 10 10
+X18 Y14 1300 1700 10 10
+X19 Y14 1300 1800 10 10
+X20 Y14 1300 1900 10 10
+X21 Y14 1300 2000 10 10
+X22 Y14 1300 2100 10 10
+X23 Y14 1300 2200 10 10
+X24 Y14 1300 2300 10 10
+X25 Y14 1300 2400 10 10
+X26 Y14 1300 2500 10 10
+X27 Y14 1300 2600 10 10
+X1 Y15 1400 0 10 10
+X2 Y15 1400 100 10 10
+X3 Y15 1400 200 10 10
+X4 Y15 1400 300 10 10
+X5 Y15 1400 400 10 10
+X6 Y15 1400 500 10 10
+X7 Y15 1400 600 10 10
+X8 Y15 1400 700 10 10
+X9 Y15 1400 800 10 10
+X10 Y15 1400 900 10 10
+X11 Y15 1400 1000 10 10
+X12 Y15 1400 1100 10 10
+X13 Y15 1400 1200 10 10
+X14 Y15 1400 1300 10 10
+X15 Y15 1400 1400 10 10
+X16 Y15 1400 1500 10 10
+X17 Y15 1400 1600 10 10
+X18 Y15 1400 1700 10 10
+X19 Y15 1400 1800 10 10
+X20 Y15 1400 1900 10 10
+X21 Y15 1400 2000 10 10
+X22 Y15 1400 2100 10 10
+X23 Y15 1400 2200 10 10
+X24 Y15 1400 2300 10 10
+X25 Y15 1400 2400 10 10
+X26 Y15 1400 2500 10 10
+X27 Y15 1400 2600 10 10
+X1 Y16 1500 0 10 10
+X2 Y16 1500 100 10 10
+X3 Y16 1500 200 10 10
+X4 Y16 1500 300 10 10
+X5 Y16 1500 400 10 10
+X6 Y16 1500 500 10 10
+X7 Y16 1500 600 10 10
+X8 Y16 1500 700 10 10
+X9 Y16 1500 800 10 10
+X10 Y16 1500 900 10 10
+X11 Y16 1500 1000 10 10
+X12 Y16 1500 1100 10 10
+X13 Y16 1500 1200 10 10
+X14 Y16 1500 1300 10 10
+X15 Y16 1500 1400 10 10
+X16 Y16 1500 1500 10 10
+X17 Y16 1500 1600 10 10
+X18 Y16 1500 1700 10 10
+X19 Y16 1500 1800 10 10
+X20 Y16 1500 1900 10 10
+X21 Y16 1500 2000 10 10
+X22 Y16 1500 2100 10 10
+X23 Y16 1500 2200 10 10
+X24 Y16 1500 2300 10 10
+X25 Y16 1500 2400 10 10
+X26 Y16 1500 2500 10 10
+X27 Y16 1500 2600 10 10
+X1 Y17 1600 0 10 10
+X2 Y17 1600 100 10 10
+X3 Y17 1600 200 10 10
+X4 Y17 1600 300 10 10
+X5 Y17 1600 400 10 10
+X6 Y17 1600 500 10 10
+X7 Y17 1600 600 10 10
+X8 Y17 1600 700 10 10
+X9 Y17 1600 800 10 10
+X10 Y17 1600 900 10 10
+X11 Y17 1600 1000 10 10
+X12 Y17 1600 1100 10 10
+X13 Y17 1600 1200 10 10
+X14 Y17 1600 1300 10 10
+X15 Y17 1600 1400 10 10
+X16 Y17 1600 1500 10 10
+X17 Y17 1600 1600 10 10
+X18 Y17 1600 1700 10 10
+X19 Y17 1600 1800 10 10
+X20 Y17 1600 1900 10 10
+X21 Y17 1600 2000 10 10
+X22 Y17 1600 2100 10 10
+X23 Y17 1600 2200 10 10
+X24 Y17 1600 2300 10 10
+X25 Y17 1600 2400 10 10
+X26 Y17 1600 2500 10 10
+X27 Y17 1600 2600 10 10
+X1 Y18 1700 0 10 10
+X2 Y18 1700 100 10 10
+X3 Y18 1700 200 10 10
+X4 Y18 1700 300 10 10
+X5 Y18 1700 400 10 10
+X6 Y18 1700 500 10 10
+X7 Y18 1700 600 10 10
+X8 Y18 1700 700 10 10
+X9 Y18 1700 800 10 10
+X10 Y18 1700 900 10 10
+X11 Y18 1700 1000 10 10
+X12 Y18 1700 1100 10 10
+X13 Y18 1700 1200 10 10
+X14 Y18 1700 1300 10 10
+X15 Y18 1700 1400 10 10
+X16 Y18 1700 1500 10 10
+X17 Y18 1700 1600 10 10
+X18 Y18 1700 1700 10 10
+X19 Y18 1700 1800 10 10
+X20 Y18 1700 1900 10 10
+X21 Y18 1700 2000 10 10
+X22 Y18 1700 2100 10 10
+X23 Y18 1700 2200 10 10
+X24 Y18 1700 2300 10 10
+X25 Y18 1700 2400 10 10
+X26 Y18 1700 2500 10 10
+X27 Y18 1700 2600 10 10
+X1 Y19 1800 0 10 10
+X2 Y19 1800 100 10 10
+X3 Y19 1800 200 10 10
+X4 Y19 1800 300 10 10
+X5 Y19 1800 400 10 10
+X6 Y19 1800 500 10 10
+X7 Y19 1800 600 10 10
+X8 Y19 1800 700 10 10
+X9 Y19 1800 800 10 10
+X10 Y19 1800 900 10 10
+X11 Y19 1800 1000 10 10
+X12 Y19 1800 1100 10 10
+X13 Y19 1800 1200 10 10
+X14 Y19 1800 1300 10 10
+X15 Y19 1800 1400 10 10
+X16 Y19 1800 1500 10 10
+X17 Y19 1800 1600 10 10
+X18 Y19 1800 1700 10 10
+X19 Y19 1800 1800 10 10
+X20 Y19 1800 1900 10 10
+X21 Y19 1800 2000 10 10
+X22 Y19 1800 2100 10 10
+X23 Y19 1800 2200 10 10
+X24 Y19 1800 2300 10 10
+X25 Y19 1800 2400 10 10
+X26 Y19 1800 2500 10 10
+X27 Y19 1800 2600 10 10
+X1 Y20 1900 0 10 10
+X2 Y20 1900 100 10 10
+X3 Y20 1900 200 10 10
+X4 Y20 1900 300 10 10
+X5 Y20 1900 400 10 10
+X6 Y20 1900 500 10 10
+X7 Y20 1900 600 10 10
+X8 Y20 1900 700 10 10
+X9 Y20 1900 800 10 10
+X10 Y20 1900 900 10 10
+X11 Y20 1900 1000 10 10
+X12 Y20 1900 1100 10 10
+X13 Y20 1900 1200 10 10
+X14 Y20 1900 1300 10 10
+X15 Y20 1900 1400 10 10
+X16 Y20 1900 1500 10 10
+X17 Y20 1900 1600 10 10
+X18 Y20 1900 1700 10 10
+X19 Y20 1900 1800 10 10
+X20 Y20 1900 1900 10 10
+X21 Y20 1900 2000 10 10
+X22 Y20 1900 2100 10 10
+X23 Y20 1900 2200 10 10
+X24 Y20 1900 2300 10 10
+X25 Y20 1900 2400 10 10
+X26 Y20 1900 2500 10 10
+X27 Y20 1900 2600 10 10
+X1 Y21 2000 0 10 10
+X2 Y21 2000 100 10 10
+X3 Y21 2000 200 10 10
+X4 Y21 2000 300 10 10
+X5 Y21 2000 400 10 10
+X6 Y21 2000 500 10 10
+X7 Y21 2000 600 10 10
+X8 Y21 2000 700 10 10
+X9 Y21 2000 800 10 10
+X10 Y21 2000 900 10 10
+X11 Y21 2000 1000 10 10
+X12 Y21 2000 1100 10 10
+X13 Y21 2000 1200 10 10
+X14 Y21 2000 1300 10 10
+X15 Y21 2000 1400 10 10
+X16 Y21 2000 1500 10 10
+X17 Y21 2000 1600 10 10
+X18 Y21 2000 1700 10 10
+X19 Y21 2000 1800 10 10
+X20 Y21 2000 1900 10 10
+X21 Y21 2000 2000 10 10
+X22 Y21 2000 2100 10 10
+X23 Y21 2000 2200 10 10
+X24 Y21 2000 2300 10 10
+X25 Y21 2000 2400 10 10
+X26 Y21 2000 2500 10 10
+X27 Y21 2000 2600 10 10
+X1 Y22 2100 0 10 10
+X2 Y22 2100 100 10 10
+X3 Y22 2100 200 10 10
+X4 Y22 2100 300 10 10
+X5 Y22 2100 400 10 10
+X6 Y22 2100 500 10 10
+X7 Y22 2100 600 10 10
+X8 Y22 2100 700 10 10
+X9 Y22 2100 800 10 10
+X10 Y22 2100 900 10 10
+X11 Y22 2100 1000 10 10
+X12 Y22 2100 1100 10 10
+X13 Y22 2100 1200 10 10
+X14 Y22 2100 1300 10 10
+X15 Y22 2100 1400 10 10
+X16 Y22 2100 1500 10 10
+X17 Y22 2100 1600 10 10
+X18 Y22 2100 1700 10 10
+X19 Y22 2100 1800 10 10
+X20 Y22 2100 1900 10 10
+X21 Y22 2100 2000 10 10
+X22 Y22 2100 2100 10 10
+X23 Y22 2100 2200 10 10
+X24 Y22 2100 2300 10 10
+X25 Y22 2100 2400 10 10
+X26 Y22 2100 2500 10 10
+X27 Y22 2100 2600 10 10
+X1 Y23 2200 0 10 10
+X2 Y23 2200 100 10 10
+X3 Y23 2200 200 10 10
+X4 Y23 2200 300 10 10
+X5 Y23 2200 400 10 10
+X6 Y23 2200 500 10 10
+X7 Y23 2200 600 10 10
+X8 Y23 2200 700 10 10
+X9 Y23 2200 800 10 10
+X10 Y23 2200 900 10 10
+X11 Y23 2200 1000 10 10
+X12 Y23 2200 1100 10 10
+X13 Y23 2200 1200 10 10
+X14 Y23 2200 1300 10 10
+X15 Y23 2200 1400 10 10
+X16 Y23 2200 1500 10 10
+X17 Y23 2200 1600 10 10
+X18 Y23 2200 1700 10 10
+X19 Y23 2200 1800 10 10
+X20 Y23 2200 1900 10 10
+X21 Y23 2200 2000 10 10
+X22 Y23 2200 2100 10 10
+X23 Y23 2200 2200 10 10
+X24 Y23 2200 2300 10 10
+X25 Y23 2200 2400 10 10
+X26 Y23 2200 2500 10 10
+X27 Y23 2200 2600 10 10
+X1 Y24 2300 0 10 10
+X2 Y24 2300 100 10 10
+X3 Y24 2300 200 10 10
+X4 Y24 2300 300 10 10
+X5 Y24 2300 400 10 10
+X6 Y24 2300 500 10 10
+X7 Y24 2300 600 10 10
+X8 Y24 2300 700 10 10
+X9 Y24 2300 800 10 10
+X10 Y24 2300 900 10 10
+X11 Y24 2300 1000 10 10
+X12 Y24 2300 1100 10 10
+X13 Y24 2300 1200 10 10
+X14 Y24 2300 1300 10 10
+X15 Y24 2300 1400 10 10
+X16 Y24 2300 1500 10 10
+X17 Y24 2300 1600 10 10
+X18 Y24 2300 1700 10 10
+X19 Y24 2300 1800 10 10
+X20 Y24 2300 1900 10 10
+X21 Y24 2300 2000 10 10
+X22 Y24 2300 2100 10 10
+X23 Y24 2300 2200 10 10
+X24 Y24 2300 2300 10 10
+X25 Y24 2300 2400 10 10
+X26 Y24 2300 2500 10 10
+X27 Y24 2300 2600 10 10
+X1 Y25 2400 0 10 10
+X2 Y25 2400 100 10 10
+X3 Y25 2400 200 10 10
+X4 Y25 2400 300 10 10
+X5 Y25 2400 400 10 10
+X6 Y25 2400 500 10 10
+X7 Y25 2400 600 10 10
+X8 Y25 2400 700 10 10
+X9 Y25 2400 800 10 10
+X10 Y25 2400 900 10 10
+X11 Y25 2400 1000 10 10
+X12 Y25 2400 1100 10 10
+X13 Y25 2400 1200 10 10
+X14 Y25 2400 1300 10 10
+X15 Y25 2400 1400 10 10
+X16 Y25 2400 1500 10 10
+X17 Y25 2400 1600 10 10
+X18 Y25 2400 1700 10 10
+X19 Y25 2400 1800 10 10
+X20 Y25 2400 1900 10 10
+X21 Y25 2400 2000 10 10
+X22 Y25 2400 2100 10 10
+X23 Y25 2400 2200 10 10
+X24 Y25 2400 2300 10 10
+X25 Y25 2400 2400 10 10
+X26 Y25 2400 2500 10 10
+X27 Y25 2400 2600 10 10
+X1 Y26 2500 0 10 10
+X2 Y26 2500 100 10 10
+X3 Y26 2500 200 10 10
+X4 Y26 2500 300 10 10
+X5 Y26 2500 400 10 10
+X6 Y26 2500 500 10 10
+X7 Y26 2500 600 10 10
+X8 Y26 2500 700 10 10
+X9 Y26 2500 800 10 10
+X10 Y26 2500 900 10 10
+X11 Y26 2500 1000 10 10
+X12 Y26 2500 1100 10 10
+X13 Y26 2500 1200 10 10
+X14 Y26 2500 1300 10 10
+X15 Y26 2500 1400 10 10
+X16 Y26 2500 1500 10 10
+X17 Y26 2500 1600 10 10
+X18 Y26 2500 1700 10 10
+X19 Y26 2500 1800 10 10
+X20 Y26 2500 1900 10 10
+X21 Y26 2500 2000 10 10
+X22 Y26 2500 2100 10 10
+X23 Y26 2500 2200 10 10
+X24 Y26 2500 2300 10 10
+X25 Y26 2500 2400 10 10
+X26 Y26 2500 2500 10 10
+X27 Y26 2500 2600 10 10
+X1 Y27 2600 0 10 10
+X2 Y27 2600 100 10 10
+X3 Y27 2600 200 10 10
+X4 Y27 2600 300 10 10
+X5 Y27 2600 400 10 10
+X6 Y27 2600 500 10 10
+X7 Y27 2600 600 10 10
+X8 Y27 2600 700 10 10
+X9 Y27 2600 800 10 10
+X10 Y27 2600 900 10 10
+X11 Y27 2600 1000 10 10
+X12 Y27 2600 1100 10 10
+X13 Y27 2600 1200 10 10
+X14 Y27 2600 1300 10 10
+X15 Y27 2600 1400 10 10
+X16 Y27 2600 1500 10 10
+X17 Y27 2600 1600 10 10
+X18 Y27 2600 1700 10 10
+X19 Y27 2600 1800 10 10
+X20 Y27 2600 1900 10 10
+X21 Y27 2600 2000 10 10
+X22 Y27 2600 2100 10 10
+X23 Y27 2600 2200 10 10
+X24 Y27 2600 2300 10 10
+X25 Y27 2600 2400 10 10
+X26 Y27 2600 2500 10 10
+X27 Y27 2600 2600 10 10

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/Mesh_Par_file
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/Mesh_Par_file	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/Mesh_Par_file	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,54 @@
+
+# coordinates of mesh block in latitude/longitude and depth in km
+LATITUDE_MIN                    = 0.0d0
+LATITUDE_MAX                    = 2640.0d0
+LONGITUDE_MIN                   = 0.0d0
+LONGITUDE_MAX                   = 2640.0d0
+DEPTH_BLOCK_KM                  = 1.440d0
+UTM_PROJECTION_ZONE             = 11
+SUPPRESS_UTM_PROJECTION         = .true.
+
+# file that contains the interfaces of the model / mesh
+INTERFACES_FILE                 = interfaces.dat
+
+# number of elements at the surface along edges of the mesh at the surface
+# (must be 8 * multiple of NPROC below if mesh is not regular and contains mesh doublings)
+# (must be multiple of NPROC below if mesh is regular)
+NEX_XI                          = 32
+NEX_ETA                         = 32
+
+# number of MPI processors along xi and eta (can be different)
+NPROC_XI                        = 2
+NPROC_ETA                       = 2
+
+# Regular/irregular mesh
+USE_REGULAR_MESH                = .true.
+# Only for irregular meshes, number of doubling layers (1 or 2) and their position
+NDOUBLINGS                      = 1
+# NZ_DOUGLING_1 is the parameter to set up if there is only one doubling layer
+NZ_DOUGLING_1                   = 11
+NZ_DOUGLING_2                   = 0
+
+# create mesh files for visualisation or further checking
+CREATE_ABAQUS_FILES             = .false.
+CREATE_DX_FILES                 = .false.
+
+# path to store the databases files
+LOCAL_PATH                      = ../in_out_files/DATABASES_MPI/
+
+# number of materials
+NMATERIALS                      = 4
+# define the different materials in the model as :
+# #material_id  #rho  #vp  #vs  #Q  #anisotropy_flag #domain_id
+#     Q                : quality factor
+#     anisotropy_flag  : 0=no anisotropy/ 1,2,.. check with implementation in aniso_model.f90
+#     domain_id        : 1=acoustic / 2=elastic
+1  2000  2000  1500  0.0   0  2
+2  2000  2000  0     0.0   0  1
+3  1000  1500  700   0     0  2
+4  1300  1400  700   50.0  0  2
+# number of regions
+NREGIONS                        = 1
+# define the different regions of the model as :
+#NEX_XI_BEGIN  #NEX_XI_END  #NEX_ETA_BEGIN  #NEX_ETA_END  #NZ_BEGIN #NZ_END  #material_id
+1              32            1               32             1         8        2

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interface3.dat
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interface3.dat	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interface3.dat	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,4 @@
+0.0
+0.0
+0.0
+0.0

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interfaces.dat
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interfaces.dat	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/in_data_files/meshfem3D_files/interfaces.dat	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,22 @@
+# number of interfaces
+ 1
+#
+# We describe each interface below, structured as a 2D-grid, with several parameters : 
+# number of points along XI and ETA, minimal XI ETA coordinates 
+# and spacing between points which must be constant.
+# Then the records contain the Z coordinates of the NXI x NETA points.
+#
+# interface number 1 
+# SUPPRESS_UTM_PROJECTION  NXI  NETA LONG_MIN   LAT_MIN    SPACING_XI SPACING_ETA
+# .true.                    161  144  316000.d0  3655000.d0 20000.d0    20000.d0
+# interface1.dat
+# interface number 2 (topography, top of the mesh)
+ .true. 2 2 0.d0 0.d0 2640.00d0 2640.00d0
+ interface3.dat
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+# layer number 1 (bottom layer)
+# 11
+# layer number 2 (top layer)
+# 4
+8

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/postprocessing.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/postprocessing.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/postprocessing.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,101 @@
+program random_model
+
+  implicit none
+
+  integer,parameter :: NGLLX=5,NGLLY=5,NGLLZ=5,IOUT=20
+
+  integer :: myrank,ier,nspec,nglob,NPROC,j,ios,NSTEP,irec
+  real :: DATASPACE,MODELSPACE,DT
+  character(len=256) prname,arg,procname,filename
+  real,dimension(:,:,:,:),allocatable :: vp,vs,rho,weights
+  real,dimension(:,:,:,:),allocatable :: vp0,vs0,rho0,krhop,kalpha,kbeta
+  integer(kind=4) :: r4head(60)
+  integer(kind=4) :: header4(1)
+  integer(kind=2) :: header2(2)
+  equivalence(header2,header4)
+
+  real,dimension(:), allocatable :: adj
+
+  !! input parameters
+  if( iargc() .ne. 3 ) stop 'Usage: ./xpostprocessing NSTEP DT NPROC'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) NSTEP;   if (ios /= 0) stop 'Error reading NSTEP'
+  j=2;  call getarg(j, arg); read(arg,*,iostat=ios)    DT;   if (ios /= 0) stop 'Error reading DT'
+  j=3;  call getarg(j, arg); read(arg,*,iostat=ios) NPROC;   if (ios /= 0) stop 'Error reading NPROC'
+
+  MODELSPACE=0.0
+  DATASPACE=0.0
+  allocate(adj(NSTEP))
+
+  do myrank=0,NPROC-1
+    !!! calculate inner product in model space --- <F* F dm, dm>
+    ! processors name
+    write(prname,'(a,i6.6,a)') 'proc',myrank,'_'
+    ! nspec & nglob
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'external_mesh.bin',status='old',action='read',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening database proc######_external_mesh.bin'
+    read(IOUT) nspec
+    read(IOUT) nglob
+    close(IOUT)
+    ! weights
+    allocate(weights(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array weights'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'weights_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) weights
+    close(IOUT)
+    ! kernels
+    allocate(krhop(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array krhop'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'rhop_acoustic_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) krhop
+    close(IOUT)
+    allocate(kalpha(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array kalpha'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'alpha_acoustic_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) kalpha
+    close(IOUT)
+    allocate(kbeta(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array kbeta'
+    ! rho
+    allocate(rho(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho'
+    allocate(rho0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho0'
+    open(unit=IOUT,file='../models/target_model/'//trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+    read(IOUT) rho
+    close(IOUT)
+    open(unit=IOUT,file='../models/initial_model/'//trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+    read(IOUT) rho0
+    close(IOUT)
+    ! vp
+    allocate(vp(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp'
+    allocate(vp0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp0'
+    open(unit=IOUT,file='../models/target_model/'//trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vp
+    close(IOUT)
+    open(unit=IOUT,file='../models/initial_model/'//trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vp0
+    close(IOUT)
+    ! vs
+    allocate(vs(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs'
+    allocate(vs0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs0'
+
+    ! F dm = S(m+dm) - S(m), we backpropogate syn-dat (see adj_seismogram.f90) => we have to add a minus sign in front of kernels
+    MODELSPACE=MODELSPACE+ &
+               sum(weights*(-krhop)*(rho-rho0)/rho0)+ &
+               sum(weights*(-kalpha)*(vp-vp0)/vp0)
+
+    deallocate(rho,rho0,vp,vp0,vs,vs0,weights,krhop,kalpha,kbeta)
+    !!! calculate inner product in data space --- <F dm, F dm>
+    write(procname,"(i4)") myrank
+    filename=trim(adjustl(procname))//"_dx_SU"
+    open(111,file="../in_out_files/SEM/"//trim(adjustl(filename))//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+    irec=1
+    do while(ios==0)
+       read(111,rec=irec,iostat=ios) r4head,adj
+                if (ios /= 0) cycle
+       DATASPACE=DATASPACE+sum(adj(:)*adj(:))*DT
+       irec=irec+1
+    enddo
+    close(111)
+
+  enddo
+
+  print*, 'DATASPACE=',DATASPACE
+  print*, 'MODELSPACE=',MODELSPACE
+  print*, 'relative error=',(DATASPACE-MODELSPACE)/DATASPACE,irec
+
+end program random_model

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/random_model_generation.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/random_model_generation.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/random_model_generation.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,81 @@
+program random_model
+
+  implicit none
+
+  include "mpif.h"
+
+  integer,parameter :: NGLLX=5,NGLLY=5,NGLLZ=5,IOUT=20
+  character(len=512),parameter :: LOCAL_PATH='../in_out_files/DATABASES_MPI/'
+
+  integer :: myrank,ier,nspec,nglob,NPROC,j,ios
+  double precision :: percent
+  character(len=256) prname,arg
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read,random
+
+
+  call MPI_Init(ier)
+  call MPI_Comm_Rank(MPI_COMM_WORLD,myrank,ier)
+  call MPI_Comm_Size(MPI_COMM_WORLD,NPROC,ier)
+
+  !! input parameters
+  if( iargc() .ne. 1 ) stop 'Usage: ./xrandom_model percent [must be small enough (~1d-5) for F*dm=S(m+dm)-S(m) to be valid]'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) percent;   if (ios /= 0) stop 'Error reading percent'
+
+  ! processors name
+  write(prname,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+  ! nspec & nglob
+  open(unit=IOUT,file=trim(adjustl(prname))//'external_mesh.bin',status='old',action='read',form='unformatted',iostat=ier)
+  if( ier /= 0 ) stop 'error opening database proc######_external_mesh.bin'
+  read(IOUT) nspec
+  read(IOUT) nglob
+  close(IOUT)
+  ! rho
+  allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+  read(IOUT) rho_read
+  close(IOUT)
+  ! vp
+  allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+  read(IOUT) vp_read
+  close(IOUT)
+  ! vs
+  allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'vs.bin',status='old',action='read',form='unformatted')
+  read(IOUT) vs_read
+  close(IOUT)
+
+  ! perturb model randomly
+  allocate( random(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array random'
+  CALL RANDOM_SEED()
+  
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  rho_read=rho_read*(1.0+percent*random)
+
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  vp_read= vp_read*(1.0+percent*random)
+
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  vs_read= vs_read*(1.0+percent*random)
+
+  ! store perturbed model
+  ! rho
+  open(unit=IOUT,file=trim(adjustl(prname))//'rho.bin',status='old',action='write',form='unformatted')
+  write(IOUT) rho_read
+  close(IOUT)
+  ! vp
+  open(unit=IOUT,file=trim(adjustl(prname))//'vp.bin',status='old',action='write',form='unformatted')
+  write(IOUT) vp_read
+  close(IOUT)
+  ! vs
+  open(unit=IOUT,file=trim(adjustl(prname))//'vs.bin',status='old',action='write',form='unformatted')
+  write(IOUT) vs_read
+  close(IOUT)
+
+  call MPI_BARRIER(MPI_COMM_WORLD,ier)
+  call MPI_Finalize(ier)
+
+end program random_model

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,108 @@
+#!/bin/bash -eu
+
+NSTEP=`grep NSTEP   ./in_data_files/Par_file | cut -d = -f 2 | sed 's/ //g'`
+DT=`grep       DT   ./in_data_files/Par_file | cut -d = -f 2 | sed 's/ //g'`
+NPROC=`grep NPROC   ./in_data_files/Par_file | cut -d = -f 2 `
+
+NSTEP=3000
+DT=0.001
+percent=0.0001
+
+echo "NSTEP=$NSTEP"
+echo "DT=$DT"
+echo "NPROC=$NPROC"
+
+bin="$PWD/bin"
+in_data_files="$bin/../in_data_files"
+in_out_files="$bin/../in_out_files"
+models="$bin/../models"
+SESAME="$bin/../../../../"
+
+
+MPIRUN="mpirun -np $NPROC "
+MPIFC="mpif90 -assume byterecl "
+
+rm -rf $in_out_files $models $bin
+mkdir -p $in_out_files/DATABASES_MPI $in_out_files/OUTPUT_FILES $in_out_files/SEM/dat $in_out_files/SEM/syn
+mkdir -p $models/initial_model $models/target_model $bin
+
+cd $SESAME
+cp ./src/shared/constants.h ./src/shared/constants.h_backup
+cp ./src/specfem3D/save_adjoint_kernels.f90 ./src/specfem3D/save_adjoint_kernels.f90_backup
+cp ./src/generate_databases/get_model.f90 ./src/generate_databases/get_model.f90_backup
+cp ./src/specfem3D/write_seismograms.f90  ./src/specfem3D/write_seismograms.f90_backup
+cp $bin/../constants.h ./src/shared/constants.h
+cp $bin/../get_model_internal.f90 ./src/generate_databases/get_model.f90
+cp $bin/../save_adjoint_kernels.f90 ./src/specfem3D/save_adjoint_kernels.f90
+cp $bin/../write_seismograms.f90 ./src/specfem3D/write_seismograms.f90
+make > $bin/../make.log
+
+cp ./bin/xmeshfem3D            $bin/xmeshfem3D
+cp ./bin/xgenerate_databases   $bin/xgenerate_databases_internal
+cp ./bin/xspecfem3D            $bin/xspecfem3D
+
+cp $bin/../get_model_external.f90 ./src/generate_databases/get_model.f90
+make > $bin/../make.log
+cp ./bin/xgenerate_databases   $bin/xgenerate_databases_external
+
+cd $bin
+$MPIFC $bin/../random_model_generation.f90 -o ./xrandom_model > $bin/../compile.log
+$MPIFC $bin/../adj_seismogram.f90 -o ./xadj > $bin/../compile.log
+$MPIFC $bin/../postprocessing.f90 -o ./xpostprocessing > $bin/../compile.log
+
+########################### dat ########################################
+FILE="$in_data_files/Par_file"
+sed -e "s#^SIMULATION_TYPE.*#SIMULATION_TYPE = 1 #g"  < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^SAVE_FORWARD.*#SAVE_FORWARD = .true. #g"   < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^NSTEP.*#NSTEP = $NSTEP #g"                 < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^DT.*#DT = $DT #g"                          < $FILE > ./tmp; mv ./tmp $FILE
+
+cd $bin
+
+echo "data simulation: $MPIRUN ./xmeshfem3D ..."
+$MPIRUN ./xmeshfem3D
+echo "data simulation: $MPIRUN ./xgenerate_databases ..."
+$MPIRUN ./xgenerate_databases_internal
+echo "data simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+mv $in_out_files/OUTPUT_FILES/*SU $in_out_files/SEM/dat/
+cp $in_out_files/DATABASES_MPI/*rho.bin $models/target_model/
+cp $in_out_files/DATABASES_MPI/*vp.bin  $models/target_model/
+cp $in_out_files/DATABASES_MPI/*vs.bin  $models/target_model/
+########################### syn ########################################
+
+$MPIRUN ./xrandom_model $percent
+
+echo "syn simulation: $MPIRUN ./xgenerate_databases ..."
+$MPIRUN ./xgenerate_databases_external
+echo "syn simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+mv $in_out_files/OUTPUT_FILES/*SU $in_out_files/SEM/syn/
+cp $in_out_files/DATABASES_MPI/*rho.bin $models/initial_model/
+cp $in_out_files/DATABASES_MPI/*vp.bin  $models/initial_model/
+cp $in_out_files/DATABASES_MPI/*vs.bin  $models/initial_model/
+########################### adj sources ################################
+
+$MPIRUN ./xadj $NSTEP $DT
+
+########################### adj ########################################
+FILE="$in_data_files/Par_file"
+sed -e "s#^SIMULATION_TYPE.*#SIMULATION_TYPE = 3 #g"  < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^SAVE_FORWARD.*#SAVE_FORWARD = .false. #g"  < $FILE > ./tmp; mv ./tmp $FILE
+
+echo "adj simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+./xpostprocessing $NSTEP $DT $NPROC 
+
+cd $SESAME
+mv ./src/generate_databases/get_model.f90_backup ./src/generate_databases/get_model.f90
+mv ./src/specfem3D/save_adjoint_kernels.f90_backup ./src/specfem3D/save_adjoint_kernels.f90
+mv ./src/shared/constants.h_backup ./src/shared/constants.h
+mv ./src/specfem3D/write_seismograms.f90_backup ./src/specfem3D/write_seismograms.f90
+
+cd $bin/../
+rm -f compile.log make.log
+rm -rf $in_out_files $models $bin


Property changes on: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/save_adjoint_kernels.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/save_adjoint_kernels.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/save_adjoint_kernels.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,242 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+!
+! United States and French Government Sponsorship Acknowledged.
+
+  subroutine save_adjoint_kernels()
+
+  use specfem_par
+  use specfem_par_elastic
+  use specfem_par_acoustic
+
+  implicit none
+  integer:: ispec,i,j,k,iglob,ier
+  real(kind=CUSTOM_REAL) :: rhol,mul,kappal
+  real(kind=CUSTOM_REAL), dimension(:,:,:,:), allocatable :: weights_kernel
+  ! flag to save GLL weights
+  logical,parameter :: SAVE_WEIGHTS = .true.
+
+  ! finalizes calculation of rhop, beta, alpha kernels
+  do ispec = 1, NSPEC_AB
+
+    ! elastic simulations
+    if( ispec_is_elastic(ispec) ) then
+
+      do k = 1, NGLLZ
+        do j = 1, NGLLY
+          do i = 1, NGLLX
+            iglob = ibool(i,j,k,ispec)
+
+            ! isotropic adjoint kernels (see e.g. Tromp et al. 2005)
+            rhol = rho_vs(i,j,k,ispec)**2 / mustore(i,j,k,ispec)
+            mul = mustore(i,j,k,ispec)
+            kappal = kappastore(i,j,k,ispec)
+
+            ! for a parameterization: (rho,mu,kappa) "primary" kernels
+            ! density kernel
+            ! multiplies with rho
+            rho_kl(i,j,k,ispec) = - rhol * rho_kl(i,j,k,ispec)
+
+            ! shear modulus kernel
+            mu_kl(i,j,k,ispec) = - 2._CUSTOM_REAL * mul * mu_kl(i,j,k,ispec)
+
+            ! bulk modulus kernel
+            kappa_kl(i,j,k,ispec) = - kappal * kappa_kl(i,j,k,ispec)
+
+            ! for a parameterization: (rho,alpha,beta)
+            ! density prime kernel
+            rhop_kl(i,j,k,ispec) = rho_kl(i,j,k,ispec) + kappa_kl(i,j,k,ispec) + mu_kl(i,j,k,ispec)
+
+            ! vs kernel
+            beta_kl(i,j,k,ispec) = 2._CUSTOM_REAL * (mu_kl(i,j,k,ispec) &
+                  - 4._CUSTOM_REAL * mul / (3._CUSTOM_REAL * kappal) * kappa_kl(i,j,k,ispec))
+
+            ! vp kernel
+            alpha_kl(i,j,k,ispec) = 2._CUSTOM_REAL * (1._CUSTOM_REAL &
+                  + 4._CUSTOM_REAL * mul / (3._CUSTOM_REAL * kappal) ) * kappa_kl(i,j,k,ispec)
+
+            ! for a parameterization: (rho,bulk, beta)
+            ! where bulk wave speed is c = sqrt( kappa / rho)
+            ! note: rhoprime is the same as for (rho,alpha,beta) parameterization
+            !bulk_c_kl_crust_mantle(i,j,k,ispec) = 2._CUSTOM_REAL * kappa_kl(i,j,k,ispec)
+            !bulk_beta_kl_crust_mantle(i,j,k,ispec ) = 2._CUSTOM_REAL * mu_kl(i,j,k,ispec)
+
+          enddo
+        enddo
+      enddo
+
+    endif ! elastic
+
+    ! acoustic simulations
+    if( ispec_is_acoustic(ispec) ) then
+
+      do k = 1, NGLLZ
+        do j = 1, NGLLY
+          do i = 1, NGLLX
+            ! rho prime kernel
+            rhop_ac_kl(i,j,k,ispec) = rho_ac_kl(i,j,k,ispec) + kappa_ac_kl(i,j,k,ispec)
+
+            ! kappa kernel
+            alpha_ac_kl(i,j,k,ispec) = TWO *  kappa_ac_kl(i,j,k,ispec)
+          enddo
+        enddo
+      enddo
+
+    endif ! acoustic
+
+
+  enddo
+
+  ! save kernels to binary files
+  if( ELASTIC_SIMULATION ) then
+    open(unit=27,file=prname(1:len_trim(prname))//'rho_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rho_kernel.bin'
+    write(27) rho_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'mu_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file mu_kernel.bin'
+    write(27) mu_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'kappa_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file kappa_kernel.bin'
+    write(27) kappa_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'rhop_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rhop_kernel.bin'
+    write(27) rhop_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'beta_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file beta_kernel.bin'
+    write(27) beta_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'alpha_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file alpha_kernel.bin'
+    write(27) alpha_kl
+    close(27)
+
+    if (SAVE_MOHO_MESH) then
+      open(unit=27,file=prname(1:len_trim(prname))//'moho_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+      if( ier /= 0 ) stop 'error opening file moho_kernel.bin'
+      write(27) moho_kl
+      close(27)
+    endif
+
+  endif
+
+
+  ! save kernels to binary files
+  if( ACOUSTIC_SIMULATION ) then
+    open(unit=27,file=prname(1:len_trim(prname))//'rho_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rho_acoustic_kernel.bin'
+    write(27) rho_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'kappa_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file kappa_acoustic_kernel.bin'
+    write(27) kappa_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'rhop_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rhop_acoustic_kernel.bin'
+    write(27) rhop_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'alpha_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file alpha_acoustic_kernel.bin'
+    write(27) alpha_ac_kl
+    close(27)
+
+  endif
+
+  ! save weights for volume integration, in order to benchmark the kernels with analytical expressions
+  if( SAVE_WEIGHTS ) then
+    allocate(weights_kernel(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array weights_kernel'
+    do ispec = 1, NSPEC_AB
+        do k = 1, NGLLZ
+          do j = 1, NGLLY
+            do i = 1, NGLLX
+              weights_kernel(i,j,k,ispec) = wxgll(i) * wygll(j) * wzgll(k) * jacobian(i,j,k,ispec)
+            enddo ! i
+          enddo ! j
+        enddo ! k
+    enddo ! ispec
+    open(unit=27,file=prname(1:len_trim(prname))//'weights_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file weights_kernel.bin'
+    write(27) weights_kernel
+    close(27)
+  endif
+
+  ! for noise simulations --- noise strength kernel
+  if (NOISE_TOMOGRAPHY == 3) then
+    call save_kernels_strength_noise(myrank,LOCAL_PATH,sigma_kl,NSPEC_AB)
+  endif
+
+  ! for preconditioner
+  if ( APPROXIMATE_HESS_KL ) then
+    call save_kernels_hessian()
+  endif
+  
+  end subroutine save_adjoint_kernels
+  
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine save_kernels_hessian()
+
+  use specfem_par
+  use specfem_par_elastic
+  use specfem_par_acoustic
+
+  implicit none
+  integer :: ier
+  
+  ! acoustic domains
+  if( ACOUSTIC_SIMULATION ) then
+    ! scales approximate hessian
+    hess_ac_kl(:,:,:,:) = 2._CUSTOM_REAL * hess_ac_kl(:,:,:,:)
+
+    ! stores into file
+    open(unit=27,file=trim(prname)//'hess_acoustic_kernel.bin', &
+          status='unknown',form='unformatted',action='write',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file hess_acoustic_kernel.bin'
+    write(27) hess_ac_kl
+    close(27)
+  endif  
+
+  ! elastic domains
+  if( ELASTIC_SIMULATION ) then
+    ! scales approximate hessian
+    hess_kl(:,:,:,:) = 2._CUSTOM_REAL * hess_kl(:,:,:,:)
+
+    ! stores into file
+    open(unit=27,file=trim(prname)//'hess_kernel.bin', &
+          status='unknown',form='unformatted',action='write',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file hess_kernel.bin'
+    write(27) hess_kl
+    close(27)
+  endif  
+  
+  end subroutine save_kernels_hessian
+  

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/write_seismograms.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/write_seismograms.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/write_seismograms.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,864 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+
+  subroutine write_seismograms()
+
+! writes the seismograms with time shift
+
+  use specfem_par
+  use specfem_par_acoustic
+  use specfem_par_elastic
+  use specfem_par_poroelastic
+  implicit none
+  ! local parameters
+  real(kind=CUSTOM_REAL),dimension(NDIM,NGLLX,NGLLY,NGLLZ):: displ_element,veloc_element
+  double precision :: dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd
+  integer :: irec_local,irec
+  integer :: iglob,ispec,i,j,k
+  ! adjoint locals
+  real(kind=CUSTOM_REAL),dimension(NDIM,NDIM):: eps_s
+  real(kind=CUSTOM_REAL),dimension(NDIM):: eps_m_s
+  real(kind=CUSTOM_REAL):: stf_deltat
+  double precision :: stf
+
+  do irec_local = 1,nrec_local
+
+    ! gets global number of that receiver
+    irec = number_receiver_global(irec_local)
+
+    ! gets local receiver interpolators
+    ! (1-D Lagrange interpolators)
+    hxir(:) = hxir_store(irec_local,:)
+    hetar(:) = hetar_store(irec_local,:)
+    hgammar(:) = hgammar_store(irec_local,:)
+
+    ! forward simulations
+    if (SIMULATION_TYPE == 1)  then
+
+      ! receiver's spectral element
+      ispec = ispec_selected_rec(irec)
+
+      ! elastic wave field
+      if( ispec_is_elastic(ispec) ) then
+        ! interpolates displ/veloc/accel at receiver locations
+        call compute_interpolated_dva(displ,veloc,accel,NGLOB_AB, &
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+      endif !elastic
+
+      ! acoustic wave field
+      if( ispec_is_acoustic(ispec) ) then
+        ! displacement vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
+                        potential_acoustic, displ_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+        ! velocity vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
+                        potential_dot_acoustic, veloc_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+
+        ! interpolates displ/veloc/pressure at receiver locations
+        call compute_interpolated_dva_ac(displ_element,veloc_element,&
+                        potential_dot_dot_acoustic,potential_dot_acoustic,&
+                        potential_acoustic,NGLOB_AB, &
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+      endif ! acoustic
+
+    !adjoint simulations
+    else if (SIMULATION_TYPE == 2) then
+
+      ! adjoint source is placed at receiver
+      ispec = ispec_selected_source(irec)
+
+      ! elastic wave field
+      if( ispec_is_elastic(ispec) ) then
+        ! interpolates displ/veloc/accel at receiver locations
+        call compute_interpolated_dva(displ,veloc,accel,NGLOB_AB, &
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+
+        ! stores elements displacement field
+        do k = 1,NGLLZ
+          do j = 1,NGLLY
+            do i = 1,NGLLX
+              iglob = ibool(i,j,k,ispec)
+              displ_element(:,i,j,k) = displ(:,iglob)
+            enddo
+          enddo
+        enddo
+
+        ! gets derivatives of local receiver interpolators
+        hpxir(:) = hpxir_store(irec_local,:)
+        hpetar(:) = hpetar_store(irec_local,:)
+        hpgammar(:) = hpgammar_store(irec_local,:)
+
+        ! computes the integrated derivatives of source parameters (M_jk and X_s)
+        call compute_adj_source_frechet(displ_element,Mxx(irec),Myy(irec),Mzz(irec),&
+                      Mxy(irec),Mxz(irec),Myz(irec),eps_s,eps_m_s, &
+                      hxir,hetar,hgammar,hpxir,hpetar,hpgammar, &
+                      hprime_xx,hprime_yy,hprime_zz, &
+                      xix(:,:,:,ispec),xiy(:,:,:,ispec),xiz(:,:,:,ispec), &
+                      etax(:,:,:,ispec),etay(:,:,:,ispec),etaz(:,:,:,ispec), &
+                      gammax(:,:,:,ispec),gammay(:,:,:,ispec),gammaz(:,:,:,ispec))
+
+        stf = comp_source_time_function(dble(NSTEP-it)*DT-t0-tshift_cmt(irec),hdur_gaussian(irec))
+        stf_deltat = stf * deltat
+        Mxx_der(irec_local) = Mxx_der(irec_local) + eps_s(1,1) * stf_deltat
+        Myy_der(irec_local) = Myy_der(irec_local) + eps_s(2,2) * stf_deltat
+        Mzz_der(irec_local) = Mzz_der(irec_local) + eps_s(3,3) * stf_deltat
+        Mxy_der(irec_local) = Mxy_der(irec_local) + 2 * eps_s(1,2) * stf_deltat
+        Mxz_der(irec_local) = Mxz_der(irec_local) + 2 * eps_s(1,3) * stf_deltat
+        Myz_der(irec_local) = Myz_der(irec_local) + 2 * eps_s(2,3) * stf_deltat
+
+        sloc_der(:,irec_local) = sloc_der(:,irec_local) + eps_m_s(:) * stf_deltat
+      endif ! elastic
+
+      ! acoustic wave field
+      if( ispec_is_acoustic(ispec) ) then
+        ! displacement vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
+                        potential_acoustic, displ_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+        ! velocity vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
+                        potential_dot_acoustic, veloc_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+
+        ! interpolates displ/veloc/pressure at receiver locations
+        call compute_interpolated_dva_ac(displ_element,veloc_element,&
+                        potential_dot_dot_acoustic,potential_dot_acoustic,&
+                        potential_acoustic,NGLOB_AB, &
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+      endif ! acoustic
+
+    !adjoint simulations
+    else if (SIMULATION_TYPE == 3) then
+
+      ispec = ispec_selected_rec(irec)
+
+      ! elastic wave field
+      if( ispec_is_elastic(ispec) ) then
+        ! backward fields: interpolates displ/veloc/accel at receiver locations
+        call compute_interpolated_dva(b_displ,b_veloc,b_accel,NGLOB_ADJOINT,&
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+      endif ! elastic
+
+      ! acoustic wave field
+      if( ispec_is_acoustic(ispec) ) then
+        ! backward fields: displacement vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_ADJOINT, &
+                        b_potential_acoustic, displ_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+        ! backward fields: velocity vector
+        call compute_gradient(ispec,NSPEC_AB,NGLOB_ADJOINT, &
+                        b_potential_dot_acoustic, veloc_element,&
+                        hprime_xx,hprime_yy,hprime_zz, &
+                        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+                        ibool,rhostore)
+
+        ! backward fields: interpolates displ/veloc/pressure at receiver locations
+        call compute_interpolated_dva_ac(displ_element,veloc_element,&
+                        b_potential_dot_dot_acoustic,b_potential_dot_acoustic,&
+                        b_potential_acoustic,NGLOB_ADJOINT, &
+                        ispec,NSPEC_AB,ibool, &
+                        xi_receiver(irec),eta_receiver(irec),gamma_receiver(irec), &
+                        hxir,hetar,hgammar, &
+                        dxd,dyd,dzd,vxd,vyd,vzd,axd,ayd,azd)
+      endif ! acoustic
+
+    endif ! SIMULATION_TYPE
+
+! store North, East and Vertical components
+! distinguish between single and double precision for reals
+    if(CUSTOM_REAL == SIZE_REAL) then
+      seismograms_d(:,irec_local,it) = sngl((nu(:,1,irec)*dxd + nu(:,2,irec)*dyd + nu(:,3,irec)*dzd))
+      seismograms_v(:,irec_local,it) = sngl((nu(:,1,irec)*vxd + nu(:,2,irec)*vyd + nu(:,3,irec)*vzd))
+      seismograms_a(:,irec_local,it) = sngl((nu(:,1,irec)*axd + nu(:,2,irec)*ayd + nu(:,3,irec)*azd))
+    else
+      seismograms_d(:,irec_local,it) = (nu(:,1,irec)*dxd + nu(:,2,irec)*dyd + nu(:,3,irec)*dzd)
+      seismograms_v(:,irec_local,it) = (nu(:,1,irec)*vxd + nu(:,2,irec)*vyd + nu(:,3,irec)*vzd)
+      seismograms_a(:,irec_local,it) = (nu(:,1,irec)*axd + nu(:,2,irec)*ayd + nu(:,3,irec)*azd)
+    endif
+
+!<FOR BENCHMARK_CLAERBOUT_ADJOINT
+    if( ispec_is_acoustic(ispec) ) then
+      seismograms_d(1,irec_local,it) = axd ! potential
+      seismograms_d(2,irec_local,it) = ayd ! potential_dot
+      seismograms_d(3,irec_local,it) = azd ! potential_dot_dot
+    endif
+!>FOR BENCHMARK_CLAERBOUT_ADJOINT
+
+    !adjoint simulations
+    if (SIMULATION_TYPE == 2) seismograms_eps(:,:,irec_local,it) = eps_s(:,:)
+
+  enddo ! nrec_local
+
+! write the current or final seismograms
+  if((mod(it,NTSTEP_BETWEEN_OUTPUT_SEISMOS) == 0 .or. it == NSTEP) .and. (.not.SU_FORMAT)) then
+    if (SIMULATION_TYPE == 1 .or. SIMULATION_TYPE == 3) then
+      call write_seismograms_to_file(myrank,seismograms_d,number_receiver_global,station_name, &
+            network_name,nrec,nrec_local,it,DT,NSTEP,t0,LOCAL_PATH,1,SIMULATION_TYPE)
+      call write_seismograms_to_file(myrank,seismograms_v,number_receiver_global,station_name, &
+            network_name,nrec,nrec_local,it,DT,NSTEP,t0,LOCAL_PATH,2,SIMULATION_TYPE)
+      call write_seismograms_to_file(myrank,seismograms_a,number_receiver_global,station_name, &
+            network_name,nrec,nrec_local,it,DT,NSTEP,t0,LOCAL_PATH,3,SIMULATION_TYPE)
+    else
+      call write_adj_seismograms_to_file(myrank,seismograms_d,number_receiver_global, &
+            nrec_local,it,DT,NSTEP,t0,LOCAL_PATH,1)
+    endif
+  endif
+
+! write ONE binary file for all receivers (nrec_local) within one proc
+! SU format, with 240-byte-header for each trace
+  if ((mod(it,NTSTEP_BETWEEN_OUTPUT_SEISMOS) == 0 .or. it==NSTEP) .and. SU_FORMAT) &
+     call write_seismograms_su() 
+
+  end subroutine write_seismograms
+
+
+!================================================================
+
+
+! write seismograms to text files
+
+  subroutine write_seismograms_to_file(myrank,seismograms,number_receiver_global, &
+               station_name,network_name,nrec,nrec_local, &
+               it,DT,NSTEP,t0,LOCAL_PATH,istore,SIMULATION_TYPE)
+
+  implicit none
+
+  include "constants.h"
+
+  integer :: NSTEP,it
+  integer :: nrec,nrec_local
+  integer :: myrank,istore
+  integer :: SIMULATION_TYPE
+
+  integer, dimension(nrec_local) :: number_receiver_global
+  real(kind=CUSTOM_REAL), dimension(NDIM,nrec_local,NSTEP) :: seismograms
+
+  double precision t0,DT
+
+  character(len=256) LOCAL_PATH
+  character(len=MAX_LENGTH_STATION_NAME), dimension(nrec) :: station_name
+  character(len=MAX_LENGTH_NETWORK_NAME), dimension(nrec) :: network_name
+
+  ! local parameters
+  integer irec,irec_local
+  integer irecord
+
+  character(len=1) component
+
+  ! parameters for master collects seismograms
+  real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: one_seismogram
+  integer :: nrec_local_received,NPROCTOT,total_seismos,receiver,sender
+  integer :: iproc,ier
+
+  ! saves displacement, velocity or acceleration
+  if(istore == 1) then
+    component = 'd'
+  else if(istore == 2) then
+    component = 'v'
+  else if(istore == 3) then
+    component = 'a'
+  else
+    call exit_MPI(myrank,'wrong component to save for seismograms')
+  endif
+
+  allocate(one_seismogram(NDIM,NSTEP),stat=ier)
+  if(ier /= 0) stop 'error while allocating one temporary seismogram'
+
+  ! all processes write their local seismograms themselves
+  if( .not. WRITE_SEISMOGRAMS_BY_MASTER ) then
+
+    ! loop on all the local receivers
+    do irec_local = 1,nrec_local
+
+      ! get global number of that receiver
+      irec = number_receiver_global(irec_local)
+
+      ! save three components of displacement vector
+      irecord = 1
+
+      ! writes out this seismogram
+      one_seismogram = seismograms(:,irec_local,:)
+
+      call write_one_seismogram(one_seismogram,irec, &
+              station_name,network_name,nrec, &
+              DT,t0,it,NSTEP,SIMULATION_TYPE, &
+              myrank,irecord,component,LOCAL_PATH)
+
+    enddo ! nrec_local
+
+! now only the master process does the writing of seismograms and
+! collects the data from all other processes
+  else ! WRITE_SEISMOGRAMS_BY_MASTER
+
+    if(myrank == 0) then ! on the master, gather all the seismograms
+
+      total_seismos = 0
+
+      ! loop on all the slices
+      call world_size(NPROCTOT)
+      do iproc = 0,NPROCTOT-1
+
+        ! receive except from proc 0, which is me and therefore I already have this value
+        sender = iproc
+        if(iproc /= 0) then
+          call recv_i(nrec_local_received,1,sender,itag)
+          if(nrec_local_received < 0) call exit_MPI(myrank,'error while receiving local number of receivers')
+        else
+          nrec_local_received = nrec_local
+        endif
+
+        if (nrec_local_received > 0) then
+          do irec_local = 1,nrec_local_received
+            ! receive except from proc 0, which is myself and therefore I already have these values
+            if(iproc == 0) then
+              ! get global number of that receiver
+              irec = number_receiver_global(irec_local)
+              one_seismogram(:,:) = seismograms(:,irec_local,:)
+            else
+              call recv_i(irec,1,sender,itag)
+              if(irec < 1 .or. irec > nrec) call exit_MPI(myrank,'error while receiving global receiver number')
+
+              call recvv_cr(one_seismogram,NDIM*NSTEP,sender,itag)
+            endif
+
+            total_seismos = total_seismos + 1
+
+            ! save three components of displacement vector
+            irecord = 1
+
+            ! writes out this seismogram
+            call write_one_seismogram(one_seismogram,irec, &
+                              station_name,network_name,nrec, &
+                              DT,t0,it,NSTEP,SIMULATION_TYPE, &
+                              myrank,irecord,component,LOCAL_PATH)
+
+          enddo ! nrec_local_received
+        endif ! if(nrec_local_received > 0 )
+      enddo ! NPROCTOT-1
+
+      write(IMAIN,*) 'Component: .sem'//component
+      write(IMAIN,*) '  total number of receivers saved is ',total_seismos,' out of ',nrec
+      write(IMAIN,*)
+
+      if(total_seismos /= nrec) call exit_MPI(myrank,'incorrect total number of receivers saved')
+
+    else  ! on the nodes, send the seismograms to the master
+       receiver = 0
+       call send_i(nrec_local,1,receiver,itag)
+       if (nrec_local > 0) then
+         do irec_local = 1,nrec_local
+           ! get global number of that receiver
+           irec = number_receiver_global(irec_local)
+           call send_i(irec,1,receiver,itag)
+
+           ! sends seismogram of that receiver
+           one_seismogram(:,:) = seismograms(:,irec_local,:)
+           call sendv_cr(one_seismogram,NDIM*NSTEP,receiver,itag)
+         enddo
+       endif
+    endif ! myrank
+
+  endif ! WRITE_SEISMOGRAMS_BY_MASTER
+
+  deallocate(one_seismogram)
+
+  end subroutine write_seismograms_to_file
+
+!=====================================================================
+
+  subroutine write_one_seismogram(one_seismogram,irec, &
+              station_name,network_name,nrec, &
+              DT,t0,it,NSTEP,SIMULATION_TYPE, &
+              myrank,irecord,component,LOCAL_PATH)
+
+  implicit none
+
+  include "constants.h"
+
+  integer :: NSTEP,it,SIMULATION_TYPE
+  real(kind=CUSTOM_REAL), dimension(NDIM,NSTEP) :: one_seismogram
+
+  integer myrank,irecord
+  double precision t0,DT
+
+  integer :: nrec,irec
+  character(len=MAX_LENGTH_STATION_NAME), dimension(nrec) :: station_name
+  character(len=MAX_LENGTH_NETWORK_NAME), dimension(nrec) :: network_name
+  character(len=1) component
+  character(len=256) LOCAL_PATH
+
+  ! local parameters
+  integer iorientation
+  integer length_station_name,length_network_name
+  character(len=256) sisname,clean_LOCAL_PATH,final_LOCAL_PATH
+  character(len=3) channel
+
+  ! loops over each seismogram component
+  do iorientation = 1,NDIM
+
+    ! gets channel name
+    call write_channel_name(iorientation,channel)
+
+    ! create the name of the seismogram file for each slice
+    ! file name includes the name of the station, the network and the component
+    length_station_name = len_trim(station_name(irec))
+    length_network_name = len_trim(network_name(irec))
+
+    ! check that length conforms to standard
+    if(length_station_name < 1 .or. length_station_name > MAX_LENGTH_STATION_NAME) &
+       call exit_MPI(myrank,'wrong length of station name')
+
+    if(length_network_name < 1 .or. length_network_name > MAX_LENGTH_NETWORK_NAME) &
+       call exit_MPI(myrank,'wrong length of network name')
+
+    write(sisname,"(a,'.',a,'.',a3,'.sem',a1)") station_name(irec)(1:length_station_name),&
+       network_name(irec)(1:length_network_name),channel,component
+
+    ! directory to store seismograms
+    if( USE_OUTPUT_FILES_PATH ) then
+      final_LOCAL_PATH = OUTPUT_FILES_PATH(1:len_trim(OUTPUT_FILES_PATH)) // '/'
+    else
+      ! suppress white spaces if any
+      clean_LOCAL_PATH = adjustl(LOCAL_PATH)
+      ! create full final local path
+      final_LOCAL_PATH = clean_LOCAL_PATH(1:len_trim(clean_LOCAL_PATH)) // '/'
+    endif
+
+    ! ASCII output format
+    call write_output_ASCII(one_seismogram, &
+              NSTEP,it,SIMULATION_TYPE,DT,t0,myrank, &
+              iorientation,irecord,sisname,final_LOCAL_PATH)
+
+  enddo ! do iorientation
+
+  end subroutine write_one_seismogram
+
+!=====================================================================
+
+! write adjoint seismograms (displacement) to text files
+
+  subroutine write_adj_seismograms_to_file(myrank,seismograms,number_receiver_global, &
+               nrec_local,it,DT,NSTEP,t0,LOCAL_PATH,istore)
+
+  implicit none
+
+  include "constants.h"
+
+  integer nrec_local,NSTEP,it,myrank,istore
+  integer, dimension(nrec_local) :: number_receiver_global
+  real(kind=CUSTOM_REAL), dimension(NDIM,nrec_local,NSTEP) :: seismograms
+  double precision t0,DT
+  character(len=256) LOCAL_PATH
+
+
+  integer irec,irec_local
+  integer iorientation,irecord,isample
+
+  character(len=3) channel
+  character(len=1) component
+  character(len=256) sisname,clean_LOCAL_PATH,final_LOCAL_PATH
+
+! save displacement, velocity or acceleration
+  if(istore == 1) then
+    component = 'd'
+  else if(istore == 2) then
+    component = 'v'
+  else if(istore == 3) then
+    component = 'a'
+  else
+    call exit_MPI(myrank,'wrong component to save for seismograms')
+  endif
+
+  do irec_local = 1,nrec_local
+
+    ! get global number of that receiver
+    irec = number_receiver_global(irec_local)
+
+    ! save three components of displacement vector
+    irecord = 1
+
+    do iorientation = 1,NDIM
+
+      ! gets channel name
+      call write_channel_name(iorientation,channel)
+
+      ! create the name of the seismogram file for each slice
+      ! file name includes the name of the station, the network and the component
+      write(sisname,"(a,i5.5,'.',a,'.',a3,'.sem',a1)") 'S',irec_local,&
+           'NT',channel,component
+
+      ! directory to store seismograms
+      if( USE_OUTPUT_FILES_PATH ) then
+        final_LOCAL_PATH = OUTPUT_FILES_PATH(1:len_trim(OUTPUT_FILES_PATH)) // '/'
+      else
+        ! suppress white spaces if any
+        clean_LOCAL_PATH = adjustl(LOCAL_PATH)
+        ! create full final local path
+        final_LOCAL_PATH = clean_LOCAL_PATH(1:len_trim(clean_LOCAL_PATH)) // '/'
+      endif
+
+
+      ! save seismograms in text format with no subsampling.
+      ! Because we do not subsample the output, this can result in large files
+      ! if the simulation uses many time steps. However, subsampling the output
+      ! here would result in a loss of accuracy when one later convolves
+      ! the results with the source time function
+      open(unit=IOUT,file=final_LOCAL_PATH(1:len_trim(final_LOCAL_PATH))//sisname(1:len_trim(sisname)),status='unknown')
+
+      ! make sure we never write more than the maximum number of time steps
+      ! subtract half duration of the source to make sure travel time is correct
+      do isample = 1,min(it,NSTEP)
+        if(irecord == 1) then
+          ! distinguish between single and double precision for reals
+          if(CUSTOM_REAL == SIZE_REAL) then
+            write(IOUT,*) sngl(dble(isample-1)*DT - t0),' ',seismograms(iorientation,irec_local,isample)
+          else
+            write(IOUT,*) dble(isample-1)*DT - t0,' ',seismograms(iorientation,irec_local,isample)
+          endif
+        else
+          call exit_MPI(myrank,'incorrect record label')
+        endif
+      enddo
+
+      close(IOUT)
+
+    enddo
+
+  enddo
+
+  end subroutine write_adj_seismograms_to_file
+
+!=====================================================================
+
+! write adjoint seismograms (strain) to text files
+
+  subroutine write_adj_seismograms2_to_file(myrank,seismograms,number_receiver_global, &
+               nrec_local,it,DT,NSTEP,t0,LOCAL_PATH)
+
+  implicit none
+
+  include "constants.h"
+
+  integer nrec_local,NSTEP,it,myrank
+  integer, dimension(nrec_local) :: number_receiver_global
+  real(kind=CUSTOM_REAL), dimension(NDIM,NDIM,nrec_local,NSTEP) :: seismograms
+  double precision t0,DT
+  character(len=256) LOCAL_PATH
+
+
+  integer irec,irec_local
+  integer idim,jdim,irecord,isample
+
+  character(len=4) chn
+  character(len=1) component
+  character(len=256) sisname,clean_LOCAL_PATH,final_LOCAL_PATH
+
+  do irec_local = 1,nrec_local
+
+    ! get global number of that receiver
+    irec = number_receiver_global(irec_local)
+
+    ! save three components of displacement vector
+    irecord = 1
+
+    do idim = 1, 3
+      do jdim = idim, 3
+
+        if(idim == 1 .and. jdim == 1) then
+          chn = 'SNN'
+        else if(idim == 1 .and. jdim == 2) then
+          chn = 'SEN'
+        else if(idim == 1 .and. jdim == 3) then
+          chn = 'SEZ'
+        else if(idim == 2 .and. jdim == 2) then
+          chn = 'SEE'
+        else if(idim == 2 .and. jdim == 3) then
+          chn = 'SNZ'
+        else if(idim == 3 .and. jdim == 3) then
+          chn = 'SZZ'
+        else
+          call exit_MPI(myrank,'incorrect channel value')
+        endif
+
+        ! create the name of the seismogram file for each slice
+        ! file name includes the name of the station, the network and the component
+        write(sisname,"(a,i5.5,'.',a,'.',a3,'.sem',a1)") 'S',irec_local,&
+           'NT',chn,component
+
+        ! directory to store seismograms
+        if( USE_OUTPUT_FILES_PATH ) then
+          final_LOCAL_PATH = OUTPUT_FILES_PATH(1:len_trim(OUTPUT_FILES_PATH)) // '/'
+        else
+          ! suppress white spaces if any
+          clean_LOCAL_PATH = adjustl(LOCAL_PATH)
+          ! create full final local path
+          final_LOCAL_PATH = clean_LOCAL_PATH(1:len_trim(clean_LOCAL_PATH)) // '/'
+        endif
+
+        ! save seismograms in text format with no subsampling.
+        ! Because we do not subsample the output, this can result in large files
+        ! if the simulation uses many time steps. However, subsampling the output
+        ! here would result in a loss of accuracy when one later convolves
+        ! the results with the source time function
+        open(unit=IOUT,file=final_LOCAL_PATH(1:len_trim(final_LOCAL_PATH))//sisname(1:len_trim(sisname)),status='unknown')
+
+        ! make sure we never write more than the maximum number of time steps
+        ! subtract half duration of the source to make sure travel time is correct
+        do isample = 1,min(it,NSTEP)
+          if(irecord == 1) then
+            ! distinguish between single and double precision for reals
+            if(CUSTOM_REAL == SIZE_REAL) then
+              write(IOUT,*) sngl(dble(isample-1)*DT - t0),' ',seismograms(jdim,idim,irec_local,isample)
+            else
+              write(IOUT,*) dble(isample-1)*DT - t0,' ',seismograms(jdim,idim,irec_local,isample)
+            endif
+          else
+            call exit_MPI(myrank,'incorrect record label')
+          endif
+        enddo
+
+        close(IOUT)
+
+      enddo ! jdim
+    enddo ! idim
+  enddo ! irec_local
+
+end subroutine write_adj_seismograms2_to_file
+
+!=====================================================================
+
+subroutine write_channel_name(iorientation,channel)
+
+  use specfem_par,only: DT,SUPPRESS_UTM_PROJECTION
+  implicit none
+
+  integer :: iorientation
+  character(len=3) :: channel
+
+  ! local parameters
+  character(len=2) :: bic
+  double precision:: sampling_rate
+
+  ! gets band and instrument code
+  sampling_rate = DT
+  call band_instrument_code(sampling_rate,bic)
+
+  ! sets channel name
+  if( SUPPRESS_UTM_PROJECTION ) then
+
+    ! no UTM, pure Cartesian reference
+    ! uses Cartesian X/Y/Z direction to denote channel
+    select case(iorientation)
+    case(1)
+      channel = bic(1:2)//'X'
+    case(2)
+      channel = bic(1:2)//'Y'
+    case(3)
+      channel = bic(1:2)//'Z'
+    case default
+      call exit_mpi(0,'error channel orientation value')
+    end select
+
+  else
+
+    ! UTM conversion
+    ! uses convention for N/E/Z to denote channel
+    select case(iorientation)
+    case(1)
+      channel = bic(1:2)//'E'
+    case(2)
+      channel = bic(1:2)//'N'
+    case(3)
+      channel = bic(1:2)//'Z'
+    case default
+      call exit_mpi(0,'error channel orientation value')
+    end select
+
+  endif
+
+end subroutine write_channel_name
+
+!=====================================================================
+
+subroutine band_instrument_code(DT,bic)
+  ! This subroutine is to choose the appropriate band and instrument codes for channel names of seismograms
+  ! based on the IRIS convention (first two letters of channel codes, respectively,
+  ! which were LH(Z/E/N) previously).
+  ! For consistency with observed data, we now use the IRIS convention for band codes (first letter in channel codes) of
+  ! SEM seismograms governed by their sampling rate.
+  ! Instrument code (second letter in channel codes) is fixed to "X" which is assigned by IRIS for synthetic seismograms.
+  ! See the manual for further explanations!
+  ! Ebru, November 2010
+  implicit none
+  double precision :: DT
+  character(len=2) :: bic
+  ! local parameter
+  logical,parameter :: SUPPRESS_IRIS_CONVENTION = .false.
+
+  ! see manual for ranges
+  if (DT .ge. 1.0d0)  bic = 'LX'
+  if (DT .lt. 1.0d0 .and. DT .gt. 0.1d0) bic = 'MX'
+  if (DT .le. 0.1d0 .and. DT .gt. 0.0125d0) bic = 'BX'
+  if (DT .le. 0.0125d0 .and. DT .gt. 0.004d0) bic = 'HX'
+  if (DT .le. 0.004d0 .and. DT .gt. 0.001d0) bic = 'CX'
+  if (DT .le. 0.001d0) bic = 'FX'
+
+  ! ignores IRIS convention, uses previous, constant band and instrument code
+  if( SUPPRESS_IRIS_CONVENTION ) then
+    bic = 'BH'
+  endif
+
+ end subroutine band_instrument_code
+
+!=====================================================================
+
+ subroutine write_seismograms_su()
+ 
+ use specfem_par
+ use specfem_par_acoustic
+ use specfem_par_elastic
+ use specfem_par_poroelastic
+
+ implicit none
+
+ character(len=256) procname,final_LOCAL_PATH
+ integer :: irec_local,irec,ios
+ real :: x_station,y_station
+ 
+ ! headers
+ integer,parameter :: nheader=240      ! 240 bytes
+ integer(kind=2) :: i2head(nheader/2)  ! 2-byte-integer
+ integer(kind=4) :: i4head(nheader/4)  ! 4-byte-integer
+ real(kind=4)    :: r4head(nheader/4)  ! 4-byte-real
+ equivalence (i2head,i4head,r4head)    ! share the same 240-byte-memory
+
+ double precision, allocatable, dimension(:) :: stlat,stlon,stele,stbur,stutm_x,stutm_y,elevation
+ double precision, allocatable, dimension(:) :: x_found,y_found,z_found
+ double precision :: x_found_source,y_found_source,z_found_source
+
+ allocate(x_found(nrec))
+ allocate(y_found(nrec))
+ allocate(z_found(nrec))
+ open(unit=IIN_SU1,file=trim(OUTPUT_FILES)//'/output_list_stations.txt',status='unknown')
+ do irec=1,nrec
+   read(IIN_SU1,*) x_found(irec),y_found(irec),z_found(irec)
+ enddo
+ close(IIN_SU1)
+ open(unit=IIN_SU1,file=trim(OUTPUT_FILES)//'/output_list_sources.txt',status='unknown')
+ read(IIN_SU1,*) x_found_source,y_found_source,z_found_source
+ close(IIN_SU1)
+ ! directory to store seismograms
+ if( USE_OUTPUT_FILES_PATH ) then
+   final_LOCAL_PATH = OUTPUT_FILES_PATH(1:len_trim(OUTPUT_FILES_PATH)) // '/'
+ else
+   ! create full final local path
+   final_LOCAL_PATH = trim(adjustl(LOCAL_PATH)) // '/'
+ endif
+ write(procname,"(i4)") myrank
+
+ ! write seismograms (dx)
+ open(unit=IOUT_SU, file=trim(adjustl(final_LOCAL_PATH))//trim(adjustl(procname))//'_dx_SU' ,&
+      form='unformatted', access='direct', recl=240+4*(NSTEP))
+ do irec_local = 1,nrec_local
+   irec = number_receiver_global(irec_local)
+   i4head(1)  =irec
+   i4head(11) =z_found(irec)
+   i4head(13) =z_found_source
+   i4head(19) =x_found_source !utm_x_source(1)
+   i4head(20) =y_found_source !utm_y_source(1)
+   i4head(21) =x_found(irec)  !stutm_x(irec)
+   i4head(22) =y_found(irec)  !stutm_y(irec)
+   i2head(58) =NSTEP
+   i2head(59) =DT*1.0d6
+   write(IOUT_SU,rec=irec_local) r4head, seismograms_d(1,irec_local,:)
+ enddo 
+ close(IOUT_SU)
+ ! write seismograms (dy)
+ open(unit=IOUT_SU, file=trim(adjustl(final_LOCAL_PATH))//trim(adjustl(procname))//'_dy_SU' ,&
+      form='unformatted', access='direct', recl=240+4*(NSTEP))
+ do irec_local = 1,nrec_local
+   irec = number_receiver_global(irec_local)
+   i4head(1)  =irec
+   i4head(11) =z_found(irec)
+   i4head(13) =z_found_source
+   i4head(19) =x_found_source !utm_x_source(1)
+   i4head(20) =y_found_source !utm_y_source(1)
+   i4head(21) =x_found(irec)  !stutm_x(irec)
+   i4head(22) =y_found(irec)  !stutm_y(irec)
+   i2head(58) =NSTEP
+   i2head(59) =DT*1.0d6
+   write(IOUT_SU,rec=irec_local) r4head, seismograms_d(2,irec_local,:)
+ enddo 
+ close(IOUT_SU)
+
+ ! write seismograms (dz)
+ open(unit=IOUT_SU, file=trim(adjustl(final_LOCAL_PATH))//trim(adjustl(procname))//'_dz_SU' ,&
+      form='unformatted', access='direct', recl=240+4*(NSTEP))
+ do irec_local = 1,nrec_local
+   irec = number_receiver_global(irec_local)
+   i4head(1)  =irec
+   i4head(11) =z_found(irec)
+   i4head(13) =z_found_source
+   i4head(19) =x_found_source !utm_x_source(1)
+   i4head(20) =y_found_source !utm_y_source(1)
+   i4head(21) =x_found(irec)  !stutm_x(irec)
+   i4head(22) =y_found(irec)  !stutm_y(irec)
+   i2head(58) =NSTEP
+   i2head(59) =DT*1.0d6
+   write(IOUT_SU,rec=irec_local) r4head, seismograms_d(3,irec_local,:)
+ enddo 
+ close(IOUT_SU)
+
+ end subroutine write_seismograms_su
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/README
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/README	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/README	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,17 @@
+this test can be done on your workstation, as long as you have FOUR CPUs available.
+it should be done within 15 minutes. 
+
+
+to run this test, simply use (after ./configure FC=ifort MPIFC=mpif90):
+
+./run_inhomogeneous.bash
+
+
+you will be given information at the very end:
+
+ DATASPACE=       ?
+ MODELSPACE=      ?
+ relative error=  ?
+
+check "relative error", it must be small enough (~0.001 should be OK).
+If you fail the test, PURE ELASTIC kernel calculation is problematic.

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/adj_seismogram.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/adj_seismogram.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/adj_seismogram.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,107 @@
+program adj_seismogram
+
+  implicit none
+
+  include "mpif.h"
+
+  integer :: myrank,ier
+
+  integer :: ios,irec,i,j,NSTEP,NPROC
+  double precision :: DT
+  real(kind=4),dimension(:),allocatable :: syn,dat,adj
+  integer(kind=4) :: r4head(60)
+  integer(kind=4) :: header4(1)
+  integer(kind=2) :: header2(2)
+  equivalence(header2,header4)
+  character(len=512) :: filename,procname,arg
+
+  call MPI_Init(ier)
+  call MPI_Comm_Rank(MPI_COMM_WORLD,myrank,ier)
+  call MPI_Comm_Size(MPI_COMM_WORLD,NPROC,ier)
+
+  write(procname,"(i4)") myrank
+
+  !! input parameters
+  if( iargc() .ne. 2 ) stop 'Usage: ./xadj NSTEP DT'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) NSTEP;   if (ios /= 0) stop 'Error reading NSTEP'
+  j=2;  call getarg(j, arg); read(arg,*,iostat=ios)    DT;   if (ios /= 0) stop 'Error reading DT'
+
+  !!!! read NSTEP from seismograms
+  !!!filename=trim(adjustl(procname))//"_dx_SU"
+  !!!open(111,file="../in_out_files/OUTPUT_FILES/"//trim(filename),access='direct',recl=240,iostat = ios)
+  !!!read(111,rec=1,iostat=ios) r4head
+  !!!close(111)
+  !!!header4=r4head(29)
+  !!!NSTEP=header2(2)
+  !!!header4=r4head(30)
+  !!!DT=header2(1)*1.0d-6
+  !!!print*, 'irec=',r4head(1)
+  !!!print*, 'xs=',r4head(19)
+  !!!print*, 'zs=',r4head(20)
+  !!!print*, 'xr=',r4head(21)
+  !!!print*, 'zr=',r4head(22)
+  !!!print*, 'NSTEP=',NSTEP
+  !!!print*, "DT=",DT
+
+  allocate(syn(NSTEP),dat(NSTEP),adj(NSTEP))
+
+! read 'syn', 'dat' and then write 'adj'
+  ! x-component
+  filename=trim(adjustl(procname))//"_dx_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+  ! y-component
+  filename=trim(adjustl(procname))//"_dy_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+  ! z-component
+  filename=trim(adjustl(procname))//"_dz_SU"
+  open(111,file="../in_out_files/SEM/syn/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(112,file="../in_out_files/SEM/dat/"//trim(filename),access='direct',recl=240+4*NSTEP,iostat = ios)
+  open(113,file="../in_out_files/SEM/"//trim(filename)//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+  irec=1
+  do while(ios==0)
+     read(111,rec=irec,iostat=ios) r4head,syn
+              if (ios /= 0) cycle
+     read(112,rec=irec,iostat=ios) r4head,dat
+              if (ios /= 0) cycle
+     write(113,rec=irec,iostat=ios) r4head,syn-dat
+              if (ios /= 0) cycle
+     irec=irec+1
+  enddo
+  close(111)
+  close(112)
+  close(113)
+
+  call MPI_BARRIER(MPI_COMM_WORLD,ier)
+  call MPI_Finalize(ier)
+
+end program adj_seismogram

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/constants.h
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/constants.h	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/constants.h	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,334 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+
+! src/shared/constants.h.  Generated from constants.h.in by configure.
+
+!
+! solver in single or double precision depending on the machine (4 or 8 bytes)
+!
+! ALSO CHANGE FILE precision.h ACCORDINGLY
+!
+  integer, parameter :: SIZE_REAL = 4
+  integer, parameter :: SIZE_DOUBLE = 8
+
+! usually the size of integer and logical variables is the same as regular single-precision real variable
+  integer, parameter :: SIZE_INTEGER = SIZE_REAL
+  integer, parameter :: SIZE_LOGICAL = SIZE_REAL
+
+! set to SIZE_REAL to run in single precision
+! set to SIZE_DOUBLE to run in double precision (increases memory size by 2)
+  integer, parameter :: CUSTOM_REAL = SIZE_REAL
+
+!----------- parameters that can be changed by the user -----------
+
+! set to .false.  if running on a Beowulf-type machine with local disks
+! set to .true. if running on a shared-memory machine with common file system
+! if running on a Beowulf, also modify name of nodes in filter_machine_file.f90
+  logical, parameter :: LOCAL_PATH_IS_ALSO_GLOBAL = .true.
+
+! apply heuristic rule to modify doubling regions to balance angles
+  logical, parameter :: APPLY_HEURISTIC_RULE = .true.
+
+! adds/superimposes velocity model values from 'model_external_values.f90'
+  logical, parameter :: USE_MODEL_EXTERNAL_VALUES = .false.
+
+! use inlined products of Deville et al. (2002) to speedup the calculations to compute internal forces
+  logical, parameter :: USE_DEVILLE_PRODUCTS = .true.
+
+! number of GLL points in each direction of an element (degree plus one)
+  integer, parameter :: NGLLX = 5
+  integer, parameter :: NGLLY = NGLLX
+  integer, parameter :: NGLLZ = NGLLX
+
+! number of points per surface element
+  integer, parameter :: NGLLSQUARE = NGLLX * NGLLY
+
+! number of points per spectral element
+  integer, parameter :: NGLLCUBE = NGLLX * NGLLY * NGLLZ
+
+! for optimized routines by Deville et al. (2002)
+  integer, parameter :: m1 = NGLLX, m2 = NGLLX * NGLLY
+
+! ouput format of seismograms, ASCII or binary
+  logical, parameter :: SEISMOGRAMS_BINARY = .false.
+! output format of seismograms, Seismic Unix (binary with 240-byte-headers)
+  logical, parameter :: SU_FORMAT=.true.
+
+! input, output and main MPI I/O files
+  integer, parameter :: ISTANDARD_OUTPUT = 6
+  integer, parameter :: IIN = 40,IOUT = 41
+! uncomment this to write messages to a text file
+  integer, parameter :: IMAIN = 42
+! uncomment this to write messages to the screen
+! integer, parameter :: IMAIN = ISTANDARD_OUTPUT
+! I/O unit for source and receiver vtk file
+  integer, parameter :: IOVTK = 98
+! I/O unit for absorbing boundary snapshots
+!  integer, parameter :: IOABS = 31
+!  integer, parameter :: IOABS_AC = 32
+! I/O unit for plotting source time function
+  integer, Parameter :: IOSTF = 71
+! I/O unit for interface file
+  integer, parameter :: IIN_INTERFACES = 43
+! I/O unit for noise simulations
+  integer, parameter :: IIN_NOISE = 44,IOUT_NOISE = 45
+! I/O unit for SU formatted seismograms
+  integer, parameter :: IOUT_SU = 46
+! I/O unit for SU formatted adjoint sources
+  integer, parameter :: IIN_SU1 = 47, IIN_SU2 = 48, IIN_SU3 = 49
+
+! ignore variable name field (junk) at the beginning of each input line
+  logical, parameter :: IGNORE_JUNK = .true.,DONT_IGNORE_JUNK = .false.
+
+! flag to print the details of source location
+  logical, parameter :: SHOW_DETAILS_LOCATE_SOURCE = .false.
+
+! maximum length of station and network name for receivers
+  integer, parameter :: MAX_LENGTH_STATION_NAME = 32
+  integer, parameter :: MAX_LENGTH_NETWORK_NAME = 8
+
+! number of sources to be gathered by MPI_Gather
+  integer, parameter :: NGATHER_SOURCES = 100
+
+! we mimic a triangle of half duration equal to half_duration_triangle
+! using a Gaussian having a very close shape, as explained in Figure 4.2
+! of the manual. This source decay rate to mimic an equivalent triangle
+! was found by trial and error
+  double precision, parameter :: SOURCE_DECAY_MIMIC_TRIANGLE = 1.628d0
+
+! decide if master process writes all the seismograms or if all processes do it in parallel
+  logical, parameter :: WRITE_SEISMOGRAMS_BY_MASTER = .false.
+
+! use directory OUTPUT_FILES/ for seismogram output
+  logical,parameter :: USE_OUTPUT_FILES_PATH = .true.
+
+! absorb top surface
+! (defined in mesh as 'free_surface_file')
+  logical,parameter :: ABSORB_FREE_SURFACE = .false.
+
+! absorb boundaries using a PML region
+! (EXPERIMENTAL feature)
+! (only acoustic domains supported...)
+! (user parameters can be specified in PML_init.f90)
+  logical,parameter :: ABSORB_USE_PML = .false.
+
+! paths for inputs and outputs files
+  character(len=256), parameter :: IN_DATA_FILES_PATH = '../in_data_files/'
+  character(len=256), parameter :: MF_IN_DATA_FILES_PATH = '../in_data_files/meshfem3D_files/'
+  character(len=256), parameter :: OUTPUT_FILES_PATH = '../in_out_files/OUTPUT_FILES/'
+
+
+! ---------------------------------------------------------------------------------------
+! LQY -- Following 3 variables stays here temporarily,
+!        we need to move them to Par_file at a proper time
+! ---------------------------------------------------------------------------------------
+! save moho mesh and compute Moho boundary kernels
+  logical, parameter :: SAVE_MOHO_MESH = .false.
+
+! outputs approximate hessian for preconditioning
+  logical, parameter :: APPROXIMATE_HESS_KL = .false.
+
+! number of steps to save the state variables in the forward simulation,
+! to be used in the backward reconstruction in the presence of attenuation
+  integer, parameter :: NSTEP_Q_SAVE = 50 ! depending on stability of reconstruction, up to 200
+
+! the scratch disk to save the state variables saved in the forward
+! simulation, this can be a global scratch disk in case you run out of
+! space on the local scratch disk, e.g. '/ibrixfs1/scratch/lqy/DATABASES_MPI_Q/'
+  character(len=256), parameter :: LOCAL_PATH_Q = '../in_out_files/DATABASES_MPI'
+
+!------------------------------------------------------
+! nlegoff -- Variables that should be read/computed elsewhere.
+!            Temporarily declared here.
+!------------------------------------------------------
+
+! no lagrange interpolation on seismograms (we take the value on one NGLL point)
+  logical, parameter :: FASTER_RECEIVERS_POINTS_ONLY = .false.
+
+! use a force source located exactly at a grid point instead of a CMTSOLUTION source
+! this can be useful e.g. for oil industry foothills simulations or asteroid simulations
+! in which the source is a vertical force, normal force, impact etc.
+  logical, parameter :: USE_FORCE_POINT_SOURCE = .false.
+  double precision, parameter :: FACTOR_FORCE_SOURCE = 1.d15
+  integer, parameter :: COMPONENT_FORCE_SOURCE = 3  ! takes direction in comp E/N/Z = 1/2/3
+
+! use this t0 as earliest starting time rather than the automatically calculated one
+! (must be positive and bigger than the automatically one to be effective;
+!  simulation will start at t = - t0)
+  double precision, parameter :: USER_T0 = 0.0d0
+
+! the receivers can be located inside the model
+  logical, parameter :: RECVS_CAN_BE_BURIED_EXT_MESH = .true.
+  logical, parameter :: SOURCES_CAN_BE_BURIED_EXT_MESH = .true.
+
+! sources and receivers Z coordinates given directly instead of with depth
+  logical, parameter :: USE_SOURCES_RECVS_Z = .false.
+
+! the seismograms are normal to surface
+! Z record corresponds to the normal, while E and N are two tangent vectors
+! that completes an orthonormal.
+  logical, parameter :: EXT_MESH_RECV_NORMAL = .false.
+
+! shakemaps and movies can not be generated during the same run. Mutually exclusive.
+  logical, parameter :: EXTERNAL_MESH_MOVIE_SURFACE = .false.
+  logical, parameter :: EXTERNAL_MESH_CREATE_SHAKEMAP = .false.
+
+! plots VTK cross-section planes instead of model surface
+! (EXPERIMENTAL feature)
+! (requires EXTERNAL_MESH_MOVIE_SURFACE set to true)
+  logical, parameter :: PLOT_CROSS_SECTIONS = .false.
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_X = 67000.0
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Y = 65500.0
+  real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Z = -30000.0
+
+! plots GIF cross-section image
+! (EXPERIMENTAL feature)
+! (cross-section plane parameters can be specified in create_color_image.f90)
+  logical, parameter :: PNM_GIF_IMAGE = .false.
+
+! number of nodes per element as provided by the external mesh
+  integer, parameter :: ESIZE = 8
+
+! geometry tolerance parameter to calculate number of independent grid points
+! sensitive to actual size of model, assumes reference sphere of radius 1
+! this is an absolute value for normalized coordinates in the Earth
+  double precision, parameter :: SMALLVAL_TOL = 1.d-10
+
+!------------------------------------------------------
+!----------- do not modify anything below -------------
+!------------------------------------------------------
+
+! on some processors (e.g. Pentiums) it is necessary to suppress underflows
+! by using a small initial field instead of zero
+  logical, parameter :: FIX_UNDERFLOW_PROBLEM = .false.
+
+! some useful constants
+  double precision, parameter :: PI = 3.141592653589793d0
+  double precision, parameter :: TWO_PI = 2.d0 * PI
+
+! 3-D simulation
+  integer, parameter :: NDIM = 3
+
+! dimension of the boundaries of the slices
+  integer, parameter :: NDIM2D = 2
+
+! for vectorization of loops
+  integer, parameter :: NGLLSQUARE_NDIM = NGLLSQUARE * NDIM
+  integer, parameter :: NGLLCUBE_NDIM = NGLLCUBE * NDIM
+
+! number of nodes for 2D and 3D shape functions for hexahedra
+! we use 8-node mesh bricks, which are more stable than 27-node elements
+  integer, parameter :: NGNOD = 8, NGNOD2D = 4
+
+! a few useful constants
+  double precision, parameter :: ZERO = 0.d0,ONE = 1.d0,TWO = 2.d0 !,HALF = 0.5d0
+
+  real(kind=CUSTOM_REAL), parameter :: &
+    ONE_THIRD   = 1._CUSTOM_REAL/3._CUSTOM_REAL, &
+    FOUR_THIRDS = 4._CUSTOM_REAL/3._CUSTOM_REAL
+
+! very large and very small values
+  double precision, parameter :: HUGEVAL = 1.d+30,TINYVAL = 1.d-9
+
+! tiny real value declared independently of the machine
+  real(kind=CUSTOM_REAL), parameter :: TINYVAL_SNGL = 1.e-25_CUSTOM_REAL
+
+! Olsen's constant for Q_mu = constant * v_s attenuation rule
+  real, parameter :: OLSEN_ATTENUATION_RATIO = 0.05
+
+! number of standard linear solids in parallel for attenuation
+  integer, parameter :: N_SLS = 3
+
+! computation of standard linear solids
+! ATTENUATION_COMP_RESOLUTION: Number of Digits after decimal
+! ATTENUATION_COMP_MAXIMUM:    Maximum Q Value
+  integer, parameter :: ATTENUATION_COMP_RESOLUTION = 1
+  integer, parameter :: ATTENUATION_COMP_MAXIMUM    = 9000
+
+! reference frequency for target velocity values in velocity model
+! arbitrarily set to typical resolution of model (3 sec)
+  double precision, parameter :: ATTENUATION_f0_REFERENCE = 0.3d0
+
+! define flag for regions for anisotropy
+  integer, parameter :: IANISOTROPY_MODEL1 = 1
+  integer, parameter :: IANISOTROPY_MODEL2 = 2
+
+! smallest real number on the Pentium and the SGI =  1.1754944E-38
+! largest real number on the Pentium and the SGI  =  3.4028235E+38
+! small negligible initial value to avoid very slow underflow trapping
+! but not too small to avoid trapping on velocity and acceleration in Newmark
+  real(kind=CUSTOM_REAL), parameter :: VERYSMALLVAL = 1.E-24_CUSTOM_REAL
+
+! displacement threshold above which we consider the code became unstable
+  real(kind=CUSTOM_REAL), parameter :: STABILITY_THRESHOLD = 1.E+25_CUSTOM_REAL
+
+! geometrical tolerance for boundary detection
+  double precision, parameter :: SMALLVAL = 0.00001d0
+
+! do not use tags for MPI messages, use dummy tag instead
+  integer, parameter :: itag = 0,itag2 = 0
+
+! for the Gauss-Lobatto-Legendre points and weights
+  double precision, parameter :: GAUSSALPHA = 0.d0,GAUSSBETA = 0.d0
+
+! number of lines per source in CMTSOLUTION file
+  integer, parameter :: NLINES_PER_CMTSOLUTION_SOURCE = 13
+
+! number of iterations to solve the system for xi and eta
+  integer, parameter :: NUM_ITER = 4
+
+! size of topography and bathymetry file for Southern California
+  integer, parameter :: NX_TOPO_SOCAL = 1401,NY_TOPO_SOCAL = 1001
+  double precision, parameter :: ORIG_LAT_TOPO_SOCAL = 32.d0
+  double precision, parameter :: ORIG_LONG_TOPO_SOCAL = -121.d0
+  double precision, parameter :: DEGREES_PER_CELL_TOPO_SOCAL = 5.d0 / 1000.d0
+  character(len=100), parameter :: TOPO_FILE_SOCAL = 'DATA/la_topography/topo_bathy_final.dat'
+
+! ! size of topography and bathymetry file for Piero Basini's model
+!   integer, parameter :: NX_TOPO = 787, NY_TOPO = 793
+!   double precision, parameter :: ORIG_LAT_TOPO = -102352.d0
+!   double precision, parameter :: ORIG_LONG_TOPO = 729806.d0
+! ! for Piero Basini's model this is the resolution in meters of the topo file
+!   double precision, parameter :: DEGREES_PER_CELL_TOPO = 250.d0
+!   character(len=256), parameter :: TOPO_FILE = 'DATA/piero_model/dem_EV_UTM_regular_250_reordered.dat'
+
+! flag for projection from latitude/longitude to UTM, and back
+  integer, parameter :: ILONGLAT2UTM = 0, IUTM2LONGLAT = 1
+
+! minimum thickness in meters to include the effect of the oceans
+! to avoid taking into account spurious oscillations in topography model
+  double precision, parameter :: MINIMUM_THICKNESS_3D_OCEANS = 10.d0
+! density of sea water
+  real(kind=CUSTOM_REAL), parameter :: RHO_OCEANS = 1020.0
+
+! material domain ids
+  integer, parameter :: IDOMAIN_ACOUSTIC    = 1
+  integer, parameter :: IDOMAIN_ELASTIC     = 2
+  integer, parameter :: IDOMAIN_POROELASTIC = 3
+
+! number of points in each AVS or OpenDX quadrangular cell for movies
+  integer, parameter :: NGNOD2D_AVS_DX = 4

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_external.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_external.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_external.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,366 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+  subroutine get_model(myrank,nspec,ibool,mat_ext_mesh,nelmnts_ext_mesh, &
+                        materials_ext_mesh,nmat_ext_mesh, &
+                        undef_mat_prop,nundefMat_ext_mesh, &
+                        ANISOTROPY,LOCAL_PATH)
+
+  use create_regions_mesh_ext_par
+  implicit none
+
+  ! number of spectral elements in each block
+  integer :: myrank,nspec
+
+  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: ibool
+
+  ! external mesh
+  integer :: nelmnts_ext_mesh
+  integer :: nmat_ext_mesh,nundefMat_ext_mesh
+
+  integer, dimension(2,nelmnts_ext_mesh) :: mat_ext_mesh
+  double precision, dimension(6,nmat_ext_mesh) :: materials_ext_mesh
+  character (len=30), dimension(6,nundefMat_ext_mesh):: undef_mat_prop
+
+  ! anisotropy
+  logical :: ANISOTROPY
+
+  ! local parameters
+  real(kind=CUSTOM_REAL) :: vp,vs,rho,qmu_atten
+  real(kind=CUSTOM_REAL) :: c11,c12,c13,c14,c15,c16,c22,c23,c24,c25, &
+                        c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66
+  integer :: ispec,i,j,k,iundef,ier
+  integer :: iflag,flag_below,flag_above
+  integer :: iflag_aniso,idomain_id,imaterial_id
+
+  ! gll point location
+  double precision :: xloc,yloc,zloc
+  integer :: iglob
+  character(len=256) LOCAL_PATH,prname_lp
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read
+
+  ! variables for importing models from files in SPECFEM format, e.g.,  proc000000_vp.bin etc.
+  ! can be used for importing updated model in iterative inversions
+  logical,parameter :: USE_EXTERNAL_FILES = .true.
+
+  ! use acoustic domains for simulation
+  logical,parameter :: USE_PURE_ACOUSTIC_MOD = .false.
+
+
+
+  ! initializes element domain flags
+  ispec_is_acoustic(:) = .false.
+  ispec_is_elastic(:) = .false.
+  ispec_is_poroelastic(:) = .false.
+
+  ! prepares tomography model if needed for elements with undefined material definitions
+  if( nundefMat_ext_mesh > 0 ) then
+    call model_tomography_broadcast(myrank)
+  endif
+
+  ! prepares external model values if needed
+  if( USE_MODEL_EXTERNAL_VALUES ) then
+    call model_external_broadcast(myrank)
+  endif
+
+! !  Piero, read bedrock file
+! in case, see file model_interface_bedrock.f90:
+!  call model_bedrock_broadcast(myrank)
+
+
+  ! material properties on all GLL points: taken from material values defined for
+  ! each spectral element in input mesh
+  do ispec = 1, nspec
+    do k = 1, NGLLZ
+      do j = 1, NGLLY
+        do i = 1, NGLLX
+
+           ! material index 1: associated material number
+           imaterial_id = mat_ext_mesh(1,ispec)
+
+           ! check if the material is known or unknown
+           if( imaterial_id > 0) then
+              ! gets velocity model as specified by (cubit) mesh files
+
+              ! density
+              ! materials_ext_mesh format:
+              ! #index1 = rho #index2 = vp #index3 = vs #index4 = Q_flag #index5 = 0
+              rho = materials_ext_mesh(1,imaterial_id)
+
+              ! isotropic values: vp, vs
+              vp = materials_ext_mesh(2,imaterial_id)
+              vs = materials_ext_mesh(3,imaterial_id)
+
+              ! attenuation
+              qmu_atten = materials_ext_mesh(4,imaterial_id)
+
+              ! anisotropy
+              iflag_aniso = materials_ext_mesh(5,imaterial_id)
+
+              ! material domain_id
+              idomain_id = materials_ext_mesh(6,imaterial_id)
+
+           else if (mat_ext_mesh(2,ispec) == 1) then
+
+              stop 'material: interface not implemented yet'
+
+              do iundef = 1,nundefMat_ext_mesh
+                 if(trim(undef_mat_prop(2,iundef)) == 'interface') then
+                    read(undef_mat_prop(3,iundef),'(1i3)') flag_below
+                    read(undef_mat_prop(4,iundef),'(1i3)') flag_above
+                 endif
+              enddo
+
+              ! see file model_interface_bedrock.f90: routine interface()
+              !call interface(iflag,flag_below,flag_above,ispec,nspec,i,j,k,xstore,ystore,zstore,ibedrock)
+
+              ! dummy: takes 1. defined material
+              iflag = 1
+              rho = materials_ext_mesh(1,iflag)
+              vp = materials_ext_mesh(2,iflag)
+              vs = materials_ext_mesh(3,iflag)
+              qmu_atten = materials_ext_mesh(4,iflag)
+              iflag_aniso = materials_ext_mesh(5,iflag)
+              idomain_id = materials_ext_mesh(6,iflag)
+
+           else if ( mat_ext_mesh(2,ispec) == 2 ) then
+
+              ! material definition undefined, uses definition from tomography model
+              ! GLL point location
+              iglob = ibool(i,j,k,ispec)
+              xloc = xstore_dummy(iglob)
+              yloc = ystore_dummy(iglob)
+              zloc = zstore_dummy(iglob)
+
+              ! gets model values from tomography file
+              call model_tomography(xloc,yloc,zloc, &
+                                  rho,vp,vs)
+
+              qmu_atten = ATTENUATION_COMP_MAXIMUM   ! attenuation: arbitrary value, see maximum in constants.h
+              iflag_aniso = 0   ! no anisotropy
+
+              ! sets acoustic/elastic domain as given in materials properties
+              iundef = - imaterial_id    ! iundef must be positive
+              read(undef_mat_prop(6,iundef),*) idomain_id
+              ! or
+              !idomain_id = IDOMAIN_ELASTIC    ! forces to be elastic domain
+
+           else
+
+              stop 'material: not implemented yet'
+
+           end if
+
+           ! adds/gets velocity model as specified in model_external_values.f90
+           if( USE_MODEL_EXTERNAL_VALUES ) then
+             call model_external_values(i,j,k,ispec,idomain_id,imaterial_id, &
+                            nspec,ibool, &
+                            iflag_aniso,qmu_atten, &
+                            rho,vp,vs, &
+                            c11,c12,c13,c14,c15,c16, &
+                            c22,c23,c24,c25,c26,c33, &
+                            c34,c35,c36,c44,c45,c46, &
+                            c55,c56,c66,ANISOTROPY)
+           endif
+
+           ! adds anisotropic default model
+           if( ANISOTROPY .and. .not. USE_MODEL_EXTERNAL_VALUES ) then
+             call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+                     c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45, &
+                     c46,c55,c56,c66)
+
+           endif
+
+           ! stores velocity model
+
+           ! density
+           rhostore(i,j,k,ispec) = rho
+
+           ! kappa, mu
+           kappastore(i,j,k,ispec) = rho*( vp*vp - FOUR_THIRDS*vs*vs )
+           mustore(i,j,k,ispec) = rho*vs*vs
+
+           ! attenuation
+           qmu_attenuation_store(i,j,k,ispec) = qmu_atten
+
+           ! Stacey, a completer par la suite
+           rho_vp(i,j,k,ispec) = rho*vp
+           rho_vs(i,j,k,ispec) = rho*vs
+           !end pll
+
+           ! adds anisotropic perturbation to vp, vs
+           if( ANISOTROPY ) then
+             !call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+             !        c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66)
+             c11store(i,j,k,ispec) = c11
+             c12store(i,j,k,ispec) = c12
+             c13store(i,j,k,ispec) = c13
+             c14store(i,j,k,ispec) = c14
+             c15store(i,j,k,ispec) = c15
+             c16store(i,j,k,ispec) = c16
+             c22store(i,j,k,ispec) = c22
+             c23store(i,j,k,ispec) = c23
+             c24store(i,j,k,ispec) = c24
+             c25store(i,j,k,ispec) = c25
+             c26store(i,j,k,ispec) = c26
+             c33store(i,j,k,ispec) = c33
+             c34store(i,j,k,ispec) = c34
+             c35store(i,j,k,ispec) = c35
+             c36store(i,j,k,ispec) = c36
+             c44store(i,j,k,ispec) = c44
+             c45store(i,j,k,ispec) = c45
+             c46store(i,j,k,ispec) = c46
+             c55store(i,j,k,ispec) = c55
+             c56store(i,j,k,ispec) = c56
+             c66store(i,j,k,ispec) = c66
+           endif
+
+           ! for pure acoustic simulations (a way of avoiding re-mesh, re-partition etc.)
+           ! can be used to compare elastic & acoustic reflections in exploration seismology
+           ! do NOT use it unless you are confident
+           if( USE_PURE_ACOUSTIC_MOD ) then
+             idomain_id = IDOMAIN_ACOUSTIC
+           endif
+
+           ! material domain
+           !print*,'velocity model:',ispec,idomain_id
+           if( idomain_id == IDOMAIN_ACOUSTIC ) then
+             ispec_is_acoustic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_ELASTIC ) then
+             ispec_is_elastic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_POROELASTIC ) then
+             stop 'poroelastic material domain not implemented yet'
+             ispec_is_poroelastic(ispec) = .true.
+           else
+             stop 'error material domain index'
+           endif
+
+        enddo
+      enddo
+    enddo
+    !print*,myrank,'ispec:',ispec,'rho:',rhostore(1,1,1,ispec),'vp:',vpstore(1,1,1,ispec),'vs:',vsstore(1,1,1,ispec)
+  enddo
+
+  ! checks material domains
+  do ispec=1,nspec
+    ! checks if domain is set
+    if( (ispec_is_acoustic(ispec) .eqv. .false.) &
+          .and. (ispec_is_elastic(ispec) .eqv. .false.) &
+          .and. (ispec_is_poroelastic(ispec) .eqv. .false.) ) then
+      print*,'error material domain not assigned to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+    ! checks if domain is unique
+    if( ispec_is_acoustic(ispec) .eqv. .true. .and. ispec_is_elastic(ispec) .eqv. .true. ) then
+      print*,'error material domain assigned twice to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+  enddo
+
+! !! DK DK store the position of the six stations to be able to
+! !! DK DK exclude circles around each station to make sure they are on the bedrock
+! !! DK DK and not in the ice
+! in case, see file model_interface_bedrock.f90: routine model_bedrock_store()
+
+
+! import the model from files in SPECFEM format
+! note that those those files should be saved in LOCAL_PATH
+
+  if( USE_EXTERNAL_FILES ) then
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! if only vp structure is available (as is often the case in exploration seismology),
+!!! use lines for vp only
+
+    ! processors name
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+
+    allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array rho_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'rho.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) rho_read
+    close(28)
+
+    allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vp_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vp.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vp_read
+    close(28)
+
+    allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vs_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vs.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vs_read
+    close(28)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where density structure is not given
+!!! modify according to your desire
+
+!  rho_read = 1000.0
+!  where ( mustore > 100.0 )  &
+!           rho_read = (1.6612 * (vp_read / 1000.0)     &
+!                      -0.4720 * (vp_read / 1000.0)**2  &
+!                      +0.0671 * (vp_read / 1000.0)**3  &
+!                      -0.0043 * (vp_read / 1000.0)**4  &
+!                      +0.000106*(vp_read / 1000.0)**5 )*1000.0
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where shear wavespeed structure is not given
+!!! modify according to your desire
+
+!   vs_read = 0.0
+!   where ( mustore > 100.0 )       vs_read = vp_read / sqrt(3.0)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! update arrays that will be saved and used in the solver xspecfem3D
+!!! the following part is neccessary if you uncommented something above
+
+    rhostore    = rho_read
+    kappastore  = rhostore * ( vp_read * vp_read - FOUR_THIRDS * vs_read * vs_read )
+    mustore     = rhostore * vs_read * vs_read
+    rho_vp = rhostore * vp_read
+    rho_vs = rhostore * vs_read
+
+    ! free memory
+    deallocate( rho_read,vp_read,vs_read)
+
+  endif ! USE_EXTERNAL_FILES
+
+  end subroutine get_model
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_internal.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_internal.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/get_model_internal.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,366 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+  subroutine get_model(myrank,nspec,ibool,mat_ext_mesh,nelmnts_ext_mesh, &
+                        materials_ext_mesh,nmat_ext_mesh, &
+                        undef_mat_prop,nundefMat_ext_mesh, &
+                        ANISOTROPY,LOCAL_PATH)
+
+  use create_regions_mesh_ext_par
+  implicit none
+
+  ! number of spectral elements in each block
+  integer :: myrank,nspec
+
+  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: ibool
+
+  ! external mesh
+  integer :: nelmnts_ext_mesh
+  integer :: nmat_ext_mesh,nundefMat_ext_mesh
+
+  integer, dimension(2,nelmnts_ext_mesh) :: mat_ext_mesh
+  double precision, dimension(6,nmat_ext_mesh) :: materials_ext_mesh
+  character (len=30), dimension(6,nundefMat_ext_mesh):: undef_mat_prop
+
+  ! anisotropy
+  logical :: ANISOTROPY
+
+  ! local parameters
+  real(kind=CUSTOM_REAL) :: vp,vs,rho,qmu_atten
+  real(kind=CUSTOM_REAL) :: c11,c12,c13,c14,c15,c16,c22,c23,c24,c25, &
+                        c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66
+  integer :: ispec,i,j,k,iundef,ier
+  integer :: iflag,flag_below,flag_above
+  integer :: iflag_aniso,idomain_id,imaterial_id
+
+  ! gll point location
+  double precision :: xloc,yloc,zloc
+  integer :: iglob
+  character(len=256) LOCAL_PATH,prname_lp
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read
+
+  ! variables for importing models from files in SPECFEM format, e.g.,  proc000000_vp.bin etc.
+  ! can be used for importing updated model in iterative inversions
+  logical,parameter :: USE_EXTERNAL_FILES = .false.
+
+  ! use acoustic domains for simulation
+  logical,parameter :: USE_PURE_ACOUSTIC_MOD = .false.
+
+
+
+  ! initializes element domain flags
+  ispec_is_acoustic(:) = .false.
+  ispec_is_elastic(:) = .false.
+  ispec_is_poroelastic(:) = .false.
+
+  ! prepares tomography model if needed for elements with undefined material definitions
+  if( nundefMat_ext_mesh > 0 ) then
+    call model_tomography_broadcast(myrank)
+  endif
+
+  ! prepares external model values if needed
+  if( USE_MODEL_EXTERNAL_VALUES ) then
+    call model_external_broadcast(myrank)
+  endif
+
+! !  Piero, read bedrock file
+! in case, see file model_interface_bedrock.f90:
+!  call model_bedrock_broadcast(myrank)
+
+
+  ! material properties on all GLL points: taken from material values defined for
+  ! each spectral element in input mesh
+  do ispec = 1, nspec
+    do k = 1, NGLLZ
+      do j = 1, NGLLY
+        do i = 1, NGLLX
+
+           ! material index 1: associated material number
+           imaterial_id = mat_ext_mesh(1,ispec)
+
+           ! check if the material is known or unknown
+           if( imaterial_id > 0) then
+              ! gets velocity model as specified by (cubit) mesh files
+
+              ! density
+              ! materials_ext_mesh format:
+              ! #index1 = rho #index2 = vp #index3 = vs #index4 = Q_flag #index5 = 0
+              rho = materials_ext_mesh(1,imaterial_id)
+
+              ! isotropic values: vp, vs
+              vp = materials_ext_mesh(2,imaterial_id)
+              vs = materials_ext_mesh(3,imaterial_id)
+
+              ! attenuation
+              qmu_atten = materials_ext_mesh(4,imaterial_id)
+
+              ! anisotropy
+              iflag_aniso = materials_ext_mesh(5,imaterial_id)
+
+              ! material domain_id
+              idomain_id = materials_ext_mesh(6,imaterial_id)
+
+           else if (mat_ext_mesh(2,ispec) == 1) then
+
+              stop 'material: interface not implemented yet'
+
+              do iundef = 1,nundefMat_ext_mesh
+                 if(trim(undef_mat_prop(2,iundef)) == 'interface') then
+                    read(undef_mat_prop(3,iundef),'(1i3)') flag_below
+                    read(undef_mat_prop(4,iundef),'(1i3)') flag_above
+                 endif
+              enddo
+
+              ! see file model_interface_bedrock.f90: routine interface()
+              !call interface(iflag,flag_below,flag_above,ispec,nspec,i,j,k,xstore,ystore,zstore,ibedrock)
+
+              ! dummy: takes 1. defined material
+              iflag = 1
+              rho = materials_ext_mesh(1,iflag)
+              vp = materials_ext_mesh(2,iflag)
+              vs = materials_ext_mesh(3,iflag)
+              qmu_atten = materials_ext_mesh(4,iflag)
+              iflag_aniso = materials_ext_mesh(5,iflag)
+              idomain_id = materials_ext_mesh(6,iflag)
+
+           else if ( mat_ext_mesh(2,ispec) == 2 ) then
+
+              ! material definition undefined, uses definition from tomography model
+              ! GLL point location
+              iglob = ibool(i,j,k,ispec)
+              xloc = xstore_dummy(iglob)
+              yloc = ystore_dummy(iglob)
+              zloc = zstore_dummy(iglob)
+
+              ! gets model values from tomography file
+              call model_tomography(xloc,yloc,zloc, &
+                                  rho,vp,vs)
+
+              qmu_atten = ATTENUATION_COMP_MAXIMUM   ! attenuation: arbitrary value, see maximum in constants.h
+              iflag_aniso = 0   ! no anisotropy
+
+              ! sets acoustic/elastic domain as given in materials properties
+              iundef = - imaterial_id    ! iundef must be positive
+              read(undef_mat_prop(6,iundef),*) idomain_id
+              ! or
+              !idomain_id = IDOMAIN_ELASTIC    ! forces to be elastic domain
+
+           else
+
+              stop 'material: not implemented yet'
+
+           end if
+
+           ! adds/gets velocity model as specified in model_external_values.f90
+           if( USE_MODEL_EXTERNAL_VALUES ) then
+             call model_external_values(i,j,k,ispec,idomain_id,imaterial_id, &
+                            nspec,ibool, &
+                            iflag_aniso,qmu_atten, &
+                            rho,vp,vs, &
+                            c11,c12,c13,c14,c15,c16, &
+                            c22,c23,c24,c25,c26,c33, &
+                            c34,c35,c36,c44,c45,c46, &
+                            c55,c56,c66,ANISOTROPY)
+           endif
+
+           ! adds anisotropic default model
+           if( ANISOTROPY .and. .not. USE_MODEL_EXTERNAL_VALUES ) then
+             call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+                     c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45, &
+                     c46,c55,c56,c66)
+
+           endif
+
+           ! stores velocity model
+
+           ! density
+           rhostore(i,j,k,ispec) = rho
+
+           ! kappa, mu
+           kappastore(i,j,k,ispec) = rho*( vp*vp - FOUR_THIRDS*vs*vs )
+           mustore(i,j,k,ispec) = rho*vs*vs
+
+           ! attenuation
+           qmu_attenuation_store(i,j,k,ispec) = qmu_atten
+
+           ! Stacey, a completer par la suite
+           rho_vp(i,j,k,ispec) = rho*vp
+           rho_vs(i,j,k,ispec) = rho*vs
+           !end pll
+
+           ! adds anisotropic perturbation to vp, vs
+           if( ANISOTROPY ) then
+             !call model_aniso(iflag_aniso,rho,vp,vs,c11,c12,c13,c14,c15,c16, &
+             !        c22,c23,c24,c25,c26,c33,c34,c35,c36,c44,c45,c46,c55,c56,c66)
+             c11store(i,j,k,ispec) = c11
+             c12store(i,j,k,ispec) = c12
+             c13store(i,j,k,ispec) = c13
+             c14store(i,j,k,ispec) = c14
+             c15store(i,j,k,ispec) = c15
+             c16store(i,j,k,ispec) = c16
+             c22store(i,j,k,ispec) = c22
+             c23store(i,j,k,ispec) = c23
+             c24store(i,j,k,ispec) = c24
+             c25store(i,j,k,ispec) = c25
+             c26store(i,j,k,ispec) = c26
+             c33store(i,j,k,ispec) = c33
+             c34store(i,j,k,ispec) = c34
+             c35store(i,j,k,ispec) = c35
+             c36store(i,j,k,ispec) = c36
+             c44store(i,j,k,ispec) = c44
+             c45store(i,j,k,ispec) = c45
+             c46store(i,j,k,ispec) = c46
+             c55store(i,j,k,ispec) = c55
+             c56store(i,j,k,ispec) = c56
+             c66store(i,j,k,ispec) = c66
+           endif
+
+           ! for pure acoustic simulations (a way of avoiding re-mesh, re-partition etc.)
+           ! can be used to compare elastic & acoustic reflections in exploration seismology
+           ! do NOT use it unless you are confident
+           if( USE_PURE_ACOUSTIC_MOD ) then
+             idomain_id = IDOMAIN_ACOUSTIC
+           endif
+
+           ! material domain
+           !print*,'velocity model:',ispec,idomain_id
+           if( idomain_id == IDOMAIN_ACOUSTIC ) then
+             ispec_is_acoustic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_ELASTIC ) then
+             ispec_is_elastic(ispec) = .true.
+           else if( idomain_id == IDOMAIN_POROELASTIC ) then
+             stop 'poroelastic material domain not implemented yet'
+             ispec_is_poroelastic(ispec) = .true.
+           else
+             stop 'error material domain index'
+           endif
+
+        enddo
+      enddo
+    enddo
+    !print*,myrank,'ispec:',ispec,'rho:',rhostore(1,1,1,ispec),'vp:',vpstore(1,1,1,ispec),'vs:',vsstore(1,1,1,ispec)
+  enddo
+
+  ! checks material domains
+  do ispec=1,nspec
+    ! checks if domain is set
+    if( (ispec_is_acoustic(ispec) .eqv. .false.) &
+          .and. (ispec_is_elastic(ispec) .eqv. .false.) &
+          .and. (ispec_is_poroelastic(ispec) .eqv. .false.) ) then
+      print*,'error material domain not assigned to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+    ! checks if domain is unique
+    if( ispec_is_acoustic(ispec) .eqv. .true. .and. ispec_is_elastic(ispec) .eqv. .true. ) then
+      print*,'error material domain assigned twice to element:',ispec
+      print*,'acoustic: ',ispec_is_acoustic(ispec)
+      print*,'elastic: ',ispec_is_elastic(ispec)
+      print*,'poroelastic: ',ispec_is_poroelastic(ispec)
+      stop 'error material domain index element'
+    endif
+  enddo
+
+! !! DK DK store the position of the six stations to be able to
+! !! DK DK exclude circles around each station to make sure they are on the bedrock
+! !! DK DK and not in the ice
+! in case, see file model_interface_bedrock.f90: routine model_bedrock_store()
+
+
+! import the model from files in SPECFEM format
+! note that those those files should be saved in LOCAL_PATH
+
+  if( USE_EXTERNAL_FILES ) then
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! if only vp structure is available (as is often the case in exploration seismology),
+!!! use lines for vp only
+
+    ! processors name
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+
+    allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array rho_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'rho.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) rho_read
+    close(28)
+
+    allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vp_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vp.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vp_read
+    close(28)
+
+    allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array vs_read'
+    write(prname_lp,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+    open(unit=28,file=prname_lp(1:len_trim(prname_lp))//'vs.bin',&
+            status='unknown',action='read',form='unformatted')
+    read(28) vs_read
+    close(28)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where density structure is not given
+!!! modify according to your desire
+
+!  rho_read = 1000.0
+!  where ( mustore > 100.0 )  &
+!           rho_read = (1.6612 * (vp_read / 1000.0)     &
+!                      -0.4720 * (vp_read / 1000.0)**2  &
+!                      +0.0671 * (vp_read / 1000.0)**3  &
+!                      -0.0043 * (vp_read / 1000.0)**4  &
+!                      +0.000106*(vp_read / 1000.0)**5 )*1000.0
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! in cases where shear wavespeed structure is not given
+!!! modify according to your desire
+
+!   vs_read = 0.0
+!   where ( mustore > 100.0 )       vs_read = vp_read / sqrt(3.0)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!! update arrays that will be saved and used in the solver xspecfem3D
+!!! the following part is neccessary if you uncommented something above
+
+    rhostore    = rho_read
+    kappastore  = rhostore * ( vp_read * vp_read - FOUR_THIRDS * vs_read * vs_read )
+    mustore     = rhostore * vs_read * vs_read
+    rho_vp = rhostore * vp_read
+    rho_vs = rhostore * vs_read
+
+    ! free memory
+    deallocate( rho_read,vp_read,vs_read)
+
+  endif ! USE_EXTERNAL_FILES
+
+  end subroutine get_model
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/CMTSOLUTION
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/CMTSOLUTION	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/CMTSOLUTION	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,13 @@
+PDE  1999 01 01 00 00 00.00  67000 67000 -25000 4.2 4.2 hom_explosion
+event name:       hom_explosion
+time shift:       0.0000
+half duration:    5.0
+latitude:       1320.0
+longitude:      660.0
+depth:           0.020
+Mrr:       1.000000e+23
+Mtt:       1.000000e+23
+Mpp:       1.000000e+23
+Mrt:       0.000000
+Mrp:       0.000000
+Mtp:       0.000000

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/Par_file
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/Par_file	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/Par_file	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,55 @@
+
+# forward or adjoint simulation
+SIMULATION_TYPE = 3 
+NOISE_TOMOGRAPHY                = 0   # 0 = earthquake simulation,  1/2/3 = three steps in noise simulation
+SAVE_FORWARD = .false. 
+
+# UTM projection parameters
+UTM_PROJECTION_ZONE             = 11
+SUPPRESS_UTM_PROJECTION         = .true.
+
+# number of MPI processors
+NPROC                           = 4
+
+# time step parameters
+NSTEP = 3000 
+DT = 0.001 
+
+# parameters describing the model
+OCEANS                          = .false.
+TOPOGRAPHY                      = .false.
+ATTENUATION                     = .false.
+USE_OLSEN_ATTENUATION           = .false.
+ANISOTROPY                      = .false.
+
+# absorbing boundary conditions for a regional simulation
+ABSORBING_CONDITIONS            = .true.
+
+# save AVS or OpenDX movies
+MOVIE_SURFACE                   = .false.
+MOVIE_VOLUME                    = .false.
+NTSTEP_BETWEEN_FRAMES           = 100
+CREATE_SHAKEMAP                 = .false.
+SAVE_DISPLACEMENT               = .true.
+USE_HIGHRES_FOR_MOVIES          = .false.
+HDUR_MOVIE                      = 0.0
+
+# save AVS or OpenDX mesh files to check the mesh
+SAVE_MESH_FILES                 = .true.
+
+# path to store the local database file on each node
+LOCAL_PATH                      = ../in_out_files/DATABASES_MPI/
+
+# interval at which we output time step info and max of norm of displacement
+NTSTEP_BETWEEN_OUTPUT_INFO      = 100
+
+# interval in time steps for writing of seismograms
+NTSTEP_BETWEEN_OUTPUT_SEISMOS   = 10000
+
+# interval in time steps for reading adjoint traces
+NTSTEP_BETWEEN_READ_ADJSRC      = 0      # 0 = read the whole adjoint sources at the same time
+
+# print source time function
+PRINT_SOURCE_TIME_FUNCTION      = .true.
+
+

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,729 @@
+X1 Y1 0 0 10 10
+X2 Y1 0 100 10 10
+X3 Y1 0 200 10 10
+X4 Y1 0 300 10 10
+X5 Y1 0 400 10 10
+X6 Y1 0 500 10 10
+X7 Y1 0 600 10 10
+X8 Y1 0 700 10 10
+X9 Y1 0 800 10 10
+X10 Y1 0 900 10 10
+X11 Y1 0 1000 10 10
+X12 Y1 0 1100 10 10
+X13 Y1 0 1200 10 10
+X14 Y1 0 1300 10 10
+X15 Y1 0 1400 10 10
+X16 Y1 0 1500 10 10
+X17 Y1 0 1600 10 10
+X18 Y1 0 1700 10 10
+X19 Y1 0 1800 10 10
+X20 Y1 0 1900 10 10
+X21 Y1 0 2000 10 10
+X22 Y1 0 2100 10 10
+X23 Y1 0 2200 10 10
+X24 Y1 0 2300 10 10
+X25 Y1 0 2400 10 10
+X26 Y1 0 2500 10 10
+X27 Y1 0 2600 10 10
+X1 Y2 100 0 10 10
+X2 Y2 100 100 10 10
+X3 Y2 100 200 10 10
+X4 Y2 100 300 10 10
+X5 Y2 100 400 10 10
+X6 Y2 100 500 10 10
+X7 Y2 100 600 10 10
+X8 Y2 100 700 10 10
+X9 Y2 100 800 10 10
+X10 Y2 100 900 10 10
+X11 Y2 100 1000 10 10
+X12 Y2 100 1100 10 10
+X13 Y2 100 1200 10 10
+X14 Y2 100 1300 10 10
+X15 Y2 100 1400 10 10
+X16 Y2 100 1500 10 10
+X17 Y2 100 1600 10 10
+X18 Y2 100 1700 10 10
+X19 Y2 100 1800 10 10
+X20 Y2 100 1900 10 10
+X21 Y2 100 2000 10 10
+X22 Y2 100 2100 10 10
+X23 Y2 100 2200 10 10
+X24 Y2 100 2300 10 10
+X25 Y2 100 2400 10 10
+X26 Y2 100 2500 10 10
+X27 Y2 100 2600 10 10
+X1 Y3 200 0 10 10
+X2 Y3 200 100 10 10
+X3 Y3 200 200 10 10
+X4 Y3 200 300 10 10
+X5 Y3 200 400 10 10
+X6 Y3 200 500 10 10
+X7 Y3 200 600 10 10
+X8 Y3 200 700 10 10
+X9 Y3 200 800 10 10
+X10 Y3 200 900 10 10
+X11 Y3 200 1000 10 10
+X12 Y3 200 1100 10 10
+X13 Y3 200 1200 10 10
+X14 Y3 200 1300 10 10
+X15 Y3 200 1400 10 10
+X16 Y3 200 1500 10 10
+X17 Y3 200 1600 10 10
+X18 Y3 200 1700 10 10
+X19 Y3 200 1800 10 10
+X20 Y3 200 1900 10 10
+X21 Y3 200 2000 10 10
+X22 Y3 200 2100 10 10
+X23 Y3 200 2200 10 10
+X24 Y3 200 2300 10 10
+X25 Y3 200 2400 10 10
+X26 Y3 200 2500 10 10
+X27 Y3 200 2600 10 10
+X1 Y4 300 0 10 10
+X2 Y4 300 100 10 10
+X3 Y4 300 200 10 10
+X4 Y4 300 300 10 10
+X5 Y4 300 400 10 10
+X6 Y4 300 500 10 10
+X7 Y4 300 600 10 10
+X8 Y4 300 700 10 10
+X9 Y4 300 800 10 10
+X10 Y4 300 900 10 10
+X11 Y4 300 1000 10 10
+X12 Y4 300 1100 10 10
+X13 Y4 300 1200 10 10
+X14 Y4 300 1300 10 10
+X15 Y4 300 1400 10 10
+X16 Y4 300 1500 10 10
+X17 Y4 300 1600 10 10
+X18 Y4 300 1700 10 10
+X19 Y4 300 1800 10 10
+X20 Y4 300 1900 10 10
+X21 Y4 300 2000 10 10
+X22 Y4 300 2100 10 10
+X23 Y4 300 2200 10 10
+X24 Y4 300 2300 10 10
+X25 Y4 300 2400 10 10
+X26 Y4 300 2500 10 10
+X27 Y4 300 2600 10 10
+X1 Y5 400 0 10 10
+X2 Y5 400 100 10 10
+X3 Y5 400 200 10 10
+X4 Y5 400 300 10 10
+X5 Y5 400 400 10 10
+X6 Y5 400 500 10 10
+X7 Y5 400 600 10 10
+X8 Y5 400 700 10 10
+X9 Y5 400 800 10 10
+X10 Y5 400 900 10 10
+X11 Y5 400 1000 10 10
+X12 Y5 400 1100 10 10
+X13 Y5 400 1200 10 10
+X14 Y5 400 1300 10 10
+X15 Y5 400 1400 10 10
+X16 Y5 400 1500 10 10
+X17 Y5 400 1600 10 10
+X18 Y5 400 1700 10 10
+X19 Y5 400 1800 10 10
+X20 Y5 400 1900 10 10
+X21 Y5 400 2000 10 10
+X22 Y5 400 2100 10 10
+X23 Y5 400 2200 10 10
+X24 Y5 400 2300 10 10
+X25 Y5 400 2400 10 10
+X26 Y5 400 2500 10 10
+X27 Y5 400 2600 10 10
+X1 Y6 500 0 10 10
+X2 Y6 500 100 10 10
+X3 Y6 500 200 10 10
+X4 Y6 500 300 10 10
+X5 Y6 500 400 10 10
+X6 Y6 500 500 10 10
+X7 Y6 500 600 10 10
+X8 Y6 500 700 10 10
+X9 Y6 500 800 10 10
+X10 Y6 500 900 10 10
+X11 Y6 500 1000 10 10
+X12 Y6 500 1100 10 10
+X13 Y6 500 1200 10 10
+X14 Y6 500 1300 10 10
+X15 Y6 500 1400 10 10
+X16 Y6 500 1500 10 10
+X17 Y6 500 1600 10 10
+X18 Y6 500 1700 10 10
+X19 Y6 500 1800 10 10
+X20 Y6 500 1900 10 10
+X21 Y6 500 2000 10 10
+X22 Y6 500 2100 10 10
+X23 Y6 500 2200 10 10
+X24 Y6 500 2300 10 10
+X25 Y6 500 2400 10 10
+X26 Y6 500 2500 10 10
+X27 Y6 500 2600 10 10
+X1 Y7 600 0 10 10
+X2 Y7 600 100 10 10
+X3 Y7 600 200 10 10
+X4 Y7 600 300 10 10
+X5 Y7 600 400 10 10
+X6 Y7 600 500 10 10
+X7 Y7 600 600 10 10
+X8 Y7 600 700 10 10
+X9 Y7 600 800 10 10
+X10 Y7 600 900 10 10
+X11 Y7 600 1000 10 10
+X12 Y7 600 1100 10 10
+X13 Y7 600 1200 10 10
+X14 Y7 600 1300 10 10
+X15 Y7 600 1400 10 10
+X16 Y7 600 1500 10 10
+X17 Y7 600 1600 10 10
+X18 Y7 600 1700 10 10
+X19 Y7 600 1800 10 10
+X20 Y7 600 1900 10 10
+X21 Y7 600 2000 10 10
+X22 Y7 600 2100 10 10
+X23 Y7 600 2200 10 10
+X24 Y7 600 2300 10 10
+X25 Y7 600 2400 10 10
+X26 Y7 600 2500 10 10
+X27 Y7 600 2600 10 10
+X1 Y8 700 0 10 10
+X2 Y8 700 100 10 10
+X3 Y8 700 200 10 10
+X4 Y8 700 300 10 10
+X5 Y8 700 400 10 10
+X6 Y8 700 500 10 10
+X7 Y8 700 600 10 10
+X8 Y8 700 700 10 10
+X9 Y8 700 800 10 10
+X10 Y8 700 900 10 10
+X11 Y8 700 1000 10 10
+X12 Y8 700 1100 10 10
+X13 Y8 700 1200 10 10
+X14 Y8 700 1300 10 10
+X15 Y8 700 1400 10 10
+X16 Y8 700 1500 10 10
+X17 Y8 700 1600 10 10
+X18 Y8 700 1700 10 10
+X19 Y8 700 1800 10 10
+X20 Y8 700 1900 10 10
+X21 Y8 700 2000 10 10
+X22 Y8 700 2100 10 10
+X23 Y8 700 2200 10 10
+X24 Y8 700 2300 10 10
+X25 Y8 700 2400 10 10
+X26 Y8 700 2500 10 10
+X27 Y8 700 2600 10 10
+X1 Y9 800 0 10 10
+X2 Y9 800 100 10 10
+X3 Y9 800 200 10 10
+X4 Y9 800 300 10 10
+X5 Y9 800 400 10 10
+X6 Y9 800 500 10 10
+X7 Y9 800 600 10 10
+X8 Y9 800 700 10 10
+X9 Y9 800 800 10 10
+X10 Y9 800 900 10 10
+X11 Y9 800 1000 10 10
+X12 Y9 800 1100 10 10
+X13 Y9 800 1200 10 10
+X14 Y9 800 1300 10 10
+X15 Y9 800 1400 10 10
+X16 Y9 800 1500 10 10
+X17 Y9 800 1600 10 10
+X18 Y9 800 1700 10 10
+X19 Y9 800 1800 10 10
+X20 Y9 800 1900 10 10
+X21 Y9 800 2000 10 10
+X22 Y9 800 2100 10 10
+X23 Y9 800 2200 10 10
+X24 Y9 800 2300 10 10
+X25 Y9 800 2400 10 10
+X26 Y9 800 2500 10 10
+X27 Y9 800 2600 10 10
+X1 Y10 900 0 10 10
+X2 Y10 900 100 10 10
+X3 Y10 900 200 10 10
+X4 Y10 900 300 10 10
+X5 Y10 900 400 10 10
+X6 Y10 900 500 10 10
+X7 Y10 900 600 10 10
+X8 Y10 900 700 10 10
+X9 Y10 900 800 10 10
+X10 Y10 900 900 10 10
+X11 Y10 900 1000 10 10
+X12 Y10 900 1100 10 10
+X13 Y10 900 1200 10 10
+X14 Y10 900 1300 10 10
+X15 Y10 900 1400 10 10
+X16 Y10 900 1500 10 10
+X17 Y10 900 1600 10 10
+X18 Y10 900 1700 10 10
+X19 Y10 900 1800 10 10
+X20 Y10 900 1900 10 10
+X21 Y10 900 2000 10 10
+X22 Y10 900 2100 10 10
+X23 Y10 900 2200 10 10
+X24 Y10 900 2300 10 10
+X25 Y10 900 2400 10 10
+X26 Y10 900 2500 10 10
+X27 Y10 900 2600 10 10
+X1 Y11 1000 0 10 10
+X2 Y11 1000 100 10 10
+X3 Y11 1000 200 10 10
+X4 Y11 1000 300 10 10
+X5 Y11 1000 400 10 10
+X6 Y11 1000 500 10 10
+X7 Y11 1000 600 10 10
+X8 Y11 1000 700 10 10
+X9 Y11 1000 800 10 10
+X10 Y11 1000 900 10 10
+X11 Y11 1000 1000 10 10
+X12 Y11 1000 1100 10 10
+X13 Y11 1000 1200 10 10
+X14 Y11 1000 1300 10 10
+X15 Y11 1000 1400 10 10
+X16 Y11 1000 1500 10 10
+X17 Y11 1000 1600 10 10
+X18 Y11 1000 1700 10 10
+X19 Y11 1000 1800 10 10
+X20 Y11 1000 1900 10 10
+X21 Y11 1000 2000 10 10
+X22 Y11 1000 2100 10 10
+X23 Y11 1000 2200 10 10
+X24 Y11 1000 2300 10 10
+X25 Y11 1000 2400 10 10
+X26 Y11 1000 2500 10 10
+X27 Y11 1000 2600 10 10
+X1 Y12 1100 0 10 10
+X2 Y12 1100 100 10 10
+X3 Y12 1100 200 10 10
+X4 Y12 1100 300 10 10
+X5 Y12 1100 400 10 10
+X6 Y12 1100 500 10 10
+X7 Y12 1100 600 10 10
+X8 Y12 1100 700 10 10
+X9 Y12 1100 800 10 10
+X10 Y12 1100 900 10 10
+X11 Y12 1100 1000 10 10
+X12 Y12 1100 1100 10 10
+X13 Y12 1100 1200 10 10
+X14 Y12 1100 1300 10 10
+X15 Y12 1100 1400 10 10
+X16 Y12 1100 1500 10 10
+X17 Y12 1100 1600 10 10
+X18 Y12 1100 1700 10 10
+X19 Y12 1100 1800 10 10
+X20 Y12 1100 1900 10 10
+X21 Y12 1100 2000 10 10
+X22 Y12 1100 2100 10 10
+X23 Y12 1100 2200 10 10
+X24 Y12 1100 2300 10 10
+X25 Y12 1100 2400 10 10
+X26 Y12 1100 2500 10 10
+X27 Y12 1100 2600 10 10
+X1 Y13 1200 0 10 10
+X2 Y13 1200 100 10 10
+X3 Y13 1200 200 10 10
+X4 Y13 1200 300 10 10
+X5 Y13 1200 400 10 10
+X6 Y13 1200 500 10 10
+X7 Y13 1200 600 10 10
+X8 Y13 1200 700 10 10
+X9 Y13 1200 800 10 10
+X10 Y13 1200 900 10 10
+X11 Y13 1200 1000 10 10
+X12 Y13 1200 1100 10 10
+X13 Y13 1200 1200 10 10
+X14 Y13 1200 1300 10 10
+X15 Y13 1200 1400 10 10
+X16 Y13 1200 1500 10 10
+X17 Y13 1200 1600 10 10
+X18 Y13 1200 1700 10 10
+X19 Y13 1200 1800 10 10
+X20 Y13 1200 1900 10 10
+X21 Y13 1200 2000 10 10
+X22 Y13 1200 2100 10 10
+X23 Y13 1200 2200 10 10
+X24 Y13 1200 2300 10 10
+X25 Y13 1200 2400 10 10
+X26 Y13 1200 2500 10 10
+X27 Y13 1200 2600 10 10
+X1 Y14 1300 0 10 10
+X2 Y14 1300 100 10 10
+X3 Y14 1300 200 10 10
+X4 Y14 1300 300 10 10
+X5 Y14 1300 400 10 10
+X6 Y14 1300 500 10 10
+X7 Y14 1300 600 10 10
+X8 Y14 1300 700 10 10
+X9 Y14 1300 800 10 10
+X10 Y14 1300 900 10 10
+X11 Y14 1300 1000 10 10
+X12 Y14 1300 1100 10 10
+X13 Y14 1300 1200 10 10
+X14 Y14 1300 1300 10 10
+X15 Y14 1300 1400 10 10
+X16 Y14 1300 1500 10 10
+X17 Y14 1300 1600 10 10
+X18 Y14 1300 1700 10 10
+X19 Y14 1300 1800 10 10
+X20 Y14 1300 1900 10 10
+X21 Y14 1300 2000 10 10
+X22 Y14 1300 2100 10 10
+X23 Y14 1300 2200 10 10
+X24 Y14 1300 2300 10 10
+X25 Y14 1300 2400 10 10
+X26 Y14 1300 2500 10 10
+X27 Y14 1300 2600 10 10
+X1 Y15 1400 0 10 10
+X2 Y15 1400 100 10 10
+X3 Y15 1400 200 10 10
+X4 Y15 1400 300 10 10
+X5 Y15 1400 400 10 10
+X6 Y15 1400 500 10 10
+X7 Y15 1400 600 10 10
+X8 Y15 1400 700 10 10
+X9 Y15 1400 800 10 10
+X10 Y15 1400 900 10 10
+X11 Y15 1400 1000 10 10
+X12 Y15 1400 1100 10 10
+X13 Y15 1400 1200 10 10
+X14 Y15 1400 1300 10 10
+X15 Y15 1400 1400 10 10
+X16 Y15 1400 1500 10 10
+X17 Y15 1400 1600 10 10
+X18 Y15 1400 1700 10 10
+X19 Y15 1400 1800 10 10
+X20 Y15 1400 1900 10 10
+X21 Y15 1400 2000 10 10
+X22 Y15 1400 2100 10 10
+X23 Y15 1400 2200 10 10
+X24 Y15 1400 2300 10 10
+X25 Y15 1400 2400 10 10
+X26 Y15 1400 2500 10 10
+X27 Y15 1400 2600 10 10
+X1 Y16 1500 0 10 10
+X2 Y16 1500 100 10 10
+X3 Y16 1500 200 10 10
+X4 Y16 1500 300 10 10
+X5 Y16 1500 400 10 10
+X6 Y16 1500 500 10 10
+X7 Y16 1500 600 10 10
+X8 Y16 1500 700 10 10
+X9 Y16 1500 800 10 10
+X10 Y16 1500 900 10 10
+X11 Y16 1500 1000 10 10
+X12 Y16 1500 1100 10 10
+X13 Y16 1500 1200 10 10
+X14 Y16 1500 1300 10 10
+X15 Y16 1500 1400 10 10
+X16 Y16 1500 1500 10 10
+X17 Y16 1500 1600 10 10
+X18 Y16 1500 1700 10 10
+X19 Y16 1500 1800 10 10
+X20 Y16 1500 1900 10 10
+X21 Y16 1500 2000 10 10
+X22 Y16 1500 2100 10 10
+X23 Y16 1500 2200 10 10
+X24 Y16 1500 2300 10 10
+X25 Y16 1500 2400 10 10
+X26 Y16 1500 2500 10 10
+X27 Y16 1500 2600 10 10
+X1 Y17 1600 0 10 10
+X2 Y17 1600 100 10 10
+X3 Y17 1600 200 10 10
+X4 Y17 1600 300 10 10
+X5 Y17 1600 400 10 10
+X6 Y17 1600 500 10 10
+X7 Y17 1600 600 10 10
+X8 Y17 1600 700 10 10
+X9 Y17 1600 800 10 10
+X10 Y17 1600 900 10 10
+X11 Y17 1600 1000 10 10
+X12 Y17 1600 1100 10 10
+X13 Y17 1600 1200 10 10
+X14 Y17 1600 1300 10 10
+X15 Y17 1600 1400 10 10
+X16 Y17 1600 1500 10 10
+X17 Y17 1600 1600 10 10
+X18 Y17 1600 1700 10 10
+X19 Y17 1600 1800 10 10
+X20 Y17 1600 1900 10 10
+X21 Y17 1600 2000 10 10
+X22 Y17 1600 2100 10 10
+X23 Y17 1600 2200 10 10
+X24 Y17 1600 2300 10 10
+X25 Y17 1600 2400 10 10
+X26 Y17 1600 2500 10 10
+X27 Y17 1600 2600 10 10
+X1 Y18 1700 0 10 10
+X2 Y18 1700 100 10 10
+X3 Y18 1700 200 10 10
+X4 Y18 1700 300 10 10
+X5 Y18 1700 400 10 10
+X6 Y18 1700 500 10 10
+X7 Y18 1700 600 10 10
+X8 Y18 1700 700 10 10
+X9 Y18 1700 800 10 10
+X10 Y18 1700 900 10 10
+X11 Y18 1700 1000 10 10
+X12 Y18 1700 1100 10 10
+X13 Y18 1700 1200 10 10
+X14 Y18 1700 1300 10 10
+X15 Y18 1700 1400 10 10
+X16 Y18 1700 1500 10 10
+X17 Y18 1700 1600 10 10
+X18 Y18 1700 1700 10 10
+X19 Y18 1700 1800 10 10
+X20 Y18 1700 1900 10 10
+X21 Y18 1700 2000 10 10
+X22 Y18 1700 2100 10 10
+X23 Y18 1700 2200 10 10
+X24 Y18 1700 2300 10 10
+X25 Y18 1700 2400 10 10
+X26 Y18 1700 2500 10 10
+X27 Y18 1700 2600 10 10
+X1 Y19 1800 0 10 10
+X2 Y19 1800 100 10 10
+X3 Y19 1800 200 10 10
+X4 Y19 1800 300 10 10
+X5 Y19 1800 400 10 10
+X6 Y19 1800 500 10 10
+X7 Y19 1800 600 10 10
+X8 Y19 1800 700 10 10
+X9 Y19 1800 800 10 10
+X10 Y19 1800 900 10 10
+X11 Y19 1800 1000 10 10
+X12 Y19 1800 1100 10 10
+X13 Y19 1800 1200 10 10
+X14 Y19 1800 1300 10 10
+X15 Y19 1800 1400 10 10
+X16 Y19 1800 1500 10 10
+X17 Y19 1800 1600 10 10
+X18 Y19 1800 1700 10 10
+X19 Y19 1800 1800 10 10
+X20 Y19 1800 1900 10 10
+X21 Y19 1800 2000 10 10
+X22 Y19 1800 2100 10 10
+X23 Y19 1800 2200 10 10
+X24 Y19 1800 2300 10 10
+X25 Y19 1800 2400 10 10
+X26 Y19 1800 2500 10 10
+X27 Y19 1800 2600 10 10
+X1 Y20 1900 0 10 10
+X2 Y20 1900 100 10 10
+X3 Y20 1900 200 10 10
+X4 Y20 1900 300 10 10
+X5 Y20 1900 400 10 10
+X6 Y20 1900 500 10 10
+X7 Y20 1900 600 10 10
+X8 Y20 1900 700 10 10
+X9 Y20 1900 800 10 10
+X10 Y20 1900 900 10 10
+X11 Y20 1900 1000 10 10
+X12 Y20 1900 1100 10 10
+X13 Y20 1900 1200 10 10
+X14 Y20 1900 1300 10 10
+X15 Y20 1900 1400 10 10
+X16 Y20 1900 1500 10 10
+X17 Y20 1900 1600 10 10
+X18 Y20 1900 1700 10 10
+X19 Y20 1900 1800 10 10
+X20 Y20 1900 1900 10 10
+X21 Y20 1900 2000 10 10
+X22 Y20 1900 2100 10 10
+X23 Y20 1900 2200 10 10
+X24 Y20 1900 2300 10 10
+X25 Y20 1900 2400 10 10
+X26 Y20 1900 2500 10 10
+X27 Y20 1900 2600 10 10
+X1 Y21 2000 0 10 10
+X2 Y21 2000 100 10 10
+X3 Y21 2000 200 10 10
+X4 Y21 2000 300 10 10
+X5 Y21 2000 400 10 10
+X6 Y21 2000 500 10 10
+X7 Y21 2000 600 10 10
+X8 Y21 2000 700 10 10
+X9 Y21 2000 800 10 10
+X10 Y21 2000 900 10 10
+X11 Y21 2000 1000 10 10
+X12 Y21 2000 1100 10 10
+X13 Y21 2000 1200 10 10
+X14 Y21 2000 1300 10 10
+X15 Y21 2000 1400 10 10
+X16 Y21 2000 1500 10 10
+X17 Y21 2000 1600 10 10
+X18 Y21 2000 1700 10 10
+X19 Y21 2000 1800 10 10
+X20 Y21 2000 1900 10 10
+X21 Y21 2000 2000 10 10
+X22 Y21 2000 2100 10 10
+X23 Y21 2000 2200 10 10
+X24 Y21 2000 2300 10 10
+X25 Y21 2000 2400 10 10
+X26 Y21 2000 2500 10 10
+X27 Y21 2000 2600 10 10
+X1 Y22 2100 0 10 10
+X2 Y22 2100 100 10 10
+X3 Y22 2100 200 10 10
+X4 Y22 2100 300 10 10
+X5 Y22 2100 400 10 10
+X6 Y22 2100 500 10 10
+X7 Y22 2100 600 10 10
+X8 Y22 2100 700 10 10
+X9 Y22 2100 800 10 10
+X10 Y22 2100 900 10 10
+X11 Y22 2100 1000 10 10
+X12 Y22 2100 1100 10 10
+X13 Y22 2100 1200 10 10
+X14 Y22 2100 1300 10 10
+X15 Y22 2100 1400 10 10
+X16 Y22 2100 1500 10 10
+X17 Y22 2100 1600 10 10
+X18 Y22 2100 1700 10 10
+X19 Y22 2100 1800 10 10
+X20 Y22 2100 1900 10 10
+X21 Y22 2100 2000 10 10
+X22 Y22 2100 2100 10 10
+X23 Y22 2100 2200 10 10
+X24 Y22 2100 2300 10 10
+X25 Y22 2100 2400 10 10
+X26 Y22 2100 2500 10 10
+X27 Y22 2100 2600 10 10
+X1 Y23 2200 0 10 10
+X2 Y23 2200 100 10 10
+X3 Y23 2200 200 10 10
+X4 Y23 2200 300 10 10
+X5 Y23 2200 400 10 10
+X6 Y23 2200 500 10 10
+X7 Y23 2200 600 10 10
+X8 Y23 2200 700 10 10
+X9 Y23 2200 800 10 10
+X10 Y23 2200 900 10 10
+X11 Y23 2200 1000 10 10
+X12 Y23 2200 1100 10 10
+X13 Y23 2200 1200 10 10
+X14 Y23 2200 1300 10 10
+X15 Y23 2200 1400 10 10
+X16 Y23 2200 1500 10 10
+X17 Y23 2200 1600 10 10
+X18 Y23 2200 1700 10 10
+X19 Y23 2200 1800 10 10
+X20 Y23 2200 1900 10 10
+X21 Y23 2200 2000 10 10
+X22 Y23 2200 2100 10 10
+X23 Y23 2200 2200 10 10
+X24 Y23 2200 2300 10 10
+X25 Y23 2200 2400 10 10
+X26 Y23 2200 2500 10 10
+X27 Y23 2200 2600 10 10
+X1 Y24 2300 0 10 10
+X2 Y24 2300 100 10 10
+X3 Y24 2300 200 10 10
+X4 Y24 2300 300 10 10
+X5 Y24 2300 400 10 10
+X6 Y24 2300 500 10 10
+X7 Y24 2300 600 10 10
+X8 Y24 2300 700 10 10
+X9 Y24 2300 800 10 10
+X10 Y24 2300 900 10 10
+X11 Y24 2300 1000 10 10
+X12 Y24 2300 1100 10 10
+X13 Y24 2300 1200 10 10
+X14 Y24 2300 1300 10 10
+X15 Y24 2300 1400 10 10
+X16 Y24 2300 1500 10 10
+X17 Y24 2300 1600 10 10
+X18 Y24 2300 1700 10 10
+X19 Y24 2300 1800 10 10
+X20 Y24 2300 1900 10 10
+X21 Y24 2300 2000 10 10
+X22 Y24 2300 2100 10 10
+X23 Y24 2300 2200 10 10
+X24 Y24 2300 2300 10 10
+X25 Y24 2300 2400 10 10
+X26 Y24 2300 2500 10 10
+X27 Y24 2300 2600 10 10
+X1 Y25 2400 0 10 10
+X2 Y25 2400 100 10 10
+X3 Y25 2400 200 10 10
+X4 Y25 2400 300 10 10
+X5 Y25 2400 400 10 10
+X6 Y25 2400 500 10 10
+X7 Y25 2400 600 10 10
+X8 Y25 2400 700 10 10
+X9 Y25 2400 800 10 10
+X10 Y25 2400 900 10 10
+X11 Y25 2400 1000 10 10
+X12 Y25 2400 1100 10 10
+X13 Y25 2400 1200 10 10
+X14 Y25 2400 1300 10 10
+X15 Y25 2400 1400 10 10
+X16 Y25 2400 1500 10 10
+X17 Y25 2400 1600 10 10
+X18 Y25 2400 1700 10 10
+X19 Y25 2400 1800 10 10
+X20 Y25 2400 1900 10 10
+X21 Y25 2400 2000 10 10
+X22 Y25 2400 2100 10 10
+X23 Y25 2400 2200 10 10
+X24 Y25 2400 2300 10 10
+X25 Y25 2400 2400 10 10
+X26 Y25 2400 2500 10 10
+X27 Y25 2400 2600 10 10
+X1 Y26 2500 0 10 10
+X2 Y26 2500 100 10 10
+X3 Y26 2500 200 10 10
+X4 Y26 2500 300 10 10
+X5 Y26 2500 400 10 10
+X6 Y26 2500 500 10 10
+X7 Y26 2500 600 10 10
+X8 Y26 2500 700 10 10
+X9 Y26 2500 800 10 10
+X10 Y26 2500 900 10 10
+X11 Y26 2500 1000 10 10
+X12 Y26 2500 1100 10 10
+X13 Y26 2500 1200 10 10
+X14 Y26 2500 1300 10 10
+X15 Y26 2500 1400 10 10
+X16 Y26 2500 1500 10 10
+X17 Y26 2500 1600 10 10
+X18 Y26 2500 1700 10 10
+X19 Y26 2500 1800 10 10
+X20 Y26 2500 1900 10 10
+X21 Y26 2500 2000 10 10
+X22 Y26 2500 2100 10 10
+X23 Y26 2500 2200 10 10
+X24 Y26 2500 2300 10 10
+X25 Y26 2500 2400 10 10
+X26 Y26 2500 2500 10 10
+X27 Y26 2500 2600 10 10
+X1 Y27 2600 0 10 10
+X2 Y27 2600 100 10 10
+X3 Y27 2600 200 10 10
+X4 Y27 2600 300 10 10
+X5 Y27 2600 400 10 10
+X6 Y27 2600 500 10 10
+X7 Y27 2600 600 10 10
+X8 Y27 2600 700 10 10
+X9 Y27 2600 800 10 10
+X10 Y27 2600 900 10 10
+X11 Y27 2600 1000 10 10
+X12 Y27 2600 1100 10 10
+X13 Y27 2600 1200 10 10
+X14 Y27 2600 1300 10 10
+X15 Y27 2600 1400 10 10
+X16 Y27 2600 1500 10 10
+X17 Y27 2600 1600 10 10
+X18 Y27 2600 1700 10 10
+X19 Y27 2600 1800 10 10
+X20 Y27 2600 1900 10 10
+X21 Y27 2600 2000 10 10
+X22 Y27 2600 2100 10 10
+X23 Y27 2600 2200 10 10
+X24 Y27 2600 2300 10 10
+X25 Y27 2600 2400 10 10
+X26 Y27 2600 2500 10 10
+X27 Y27 2600 2600 10 10

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS_ADJOINT
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS_ADJOINT	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/STATIONS_ADJOINT	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,729 @@
+X1 Y1 0 0 10 10
+X2 Y1 0 100 10 10
+X3 Y1 0 200 10 10
+X4 Y1 0 300 10 10
+X5 Y1 0 400 10 10
+X6 Y1 0 500 10 10
+X7 Y1 0 600 10 10
+X8 Y1 0 700 10 10
+X9 Y1 0 800 10 10
+X10 Y1 0 900 10 10
+X11 Y1 0 1000 10 10
+X12 Y1 0 1100 10 10
+X13 Y1 0 1200 10 10
+X14 Y1 0 1300 10 10
+X15 Y1 0 1400 10 10
+X16 Y1 0 1500 10 10
+X17 Y1 0 1600 10 10
+X18 Y1 0 1700 10 10
+X19 Y1 0 1800 10 10
+X20 Y1 0 1900 10 10
+X21 Y1 0 2000 10 10
+X22 Y1 0 2100 10 10
+X23 Y1 0 2200 10 10
+X24 Y1 0 2300 10 10
+X25 Y1 0 2400 10 10
+X26 Y1 0 2500 10 10
+X27 Y1 0 2600 10 10
+X1 Y2 100 0 10 10
+X2 Y2 100 100 10 10
+X3 Y2 100 200 10 10
+X4 Y2 100 300 10 10
+X5 Y2 100 400 10 10
+X6 Y2 100 500 10 10
+X7 Y2 100 600 10 10
+X8 Y2 100 700 10 10
+X9 Y2 100 800 10 10
+X10 Y2 100 900 10 10
+X11 Y2 100 1000 10 10
+X12 Y2 100 1100 10 10
+X13 Y2 100 1200 10 10
+X14 Y2 100 1300 10 10
+X15 Y2 100 1400 10 10
+X16 Y2 100 1500 10 10
+X17 Y2 100 1600 10 10
+X18 Y2 100 1700 10 10
+X19 Y2 100 1800 10 10
+X20 Y2 100 1900 10 10
+X21 Y2 100 2000 10 10
+X22 Y2 100 2100 10 10
+X23 Y2 100 2200 10 10
+X24 Y2 100 2300 10 10
+X25 Y2 100 2400 10 10
+X26 Y2 100 2500 10 10
+X27 Y2 100 2600 10 10
+X1 Y3 200 0 10 10
+X2 Y3 200 100 10 10
+X3 Y3 200 200 10 10
+X4 Y3 200 300 10 10
+X5 Y3 200 400 10 10
+X6 Y3 200 500 10 10
+X7 Y3 200 600 10 10
+X8 Y3 200 700 10 10
+X9 Y3 200 800 10 10
+X10 Y3 200 900 10 10
+X11 Y3 200 1000 10 10
+X12 Y3 200 1100 10 10
+X13 Y3 200 1200 10 10
+X14 Y3 200 1300 10 10
+X15 Y3 200 1400 10 10
+X16 Y3 200 1500 10 10
+X17 Y3 200 1600 10 10
+X18 Y3 200 1700 10 10
+X19 Y3 200 1800 10 10
+X20 Y3 200 1900 10 10
+X21 Y3 200 2000 10 10
+X22 Y3 200 2100 10 10
+X23 Y3 200 2200 10 10
+X24 Y3 200 2300 10 10
+X25 Y3 200 2400 10 10
+X26 Y3 200 2500 10 10
+X27 Y3 200 2600 10 10
+X1 Y4 300 0 10 10
+X2 Y4 300 100 10 10
+X3 Y4 300 200 10 10
+X4 Y4 300 300 10 10
+X5 Y4 300 400 10 10
+X6 Y4 300 500 10 10
+X7 Y4 300 600 10 10
+X8 Y4 300 700 10 10
+X9 Y4 300 800 10 10
+X10 Y4 300 900 10 10
+X11 Y4 300 1000 10 10
+X12 Y4 300 1100 10 10
+X13 Y4 300 1200 10 10
+X14 Y4 300 1300 10 10
+X15 Y4 300 1400 10 10
+X16 Y4 300 1500 10 10
+X17 Y4 300 1600 10 10
+X18 Y4 300 1700 10 10
+X19 Y4 300 1800 10 10
+X20 Y4 300 1900 10 10
+X21 Y4 300 2000 10 10
+X22 Y4 300 2100 10 10
+X23 Y4 300 2200 10 10
+X24 Y4 300 2300 10 10
+X25 Y4 300 2400 10 10
+X26 Y4 300 2500 10 10
+X27 Y4 300 2600 10 10
+X1 Y5 400 0 10 10
+X2 Y5 400 100 10 10
+X3 Y5 400 200 10 10
+X4 Y5 400 300 10 10
+X5 Y5 400 400 10 10
+X6 Y5 400 500 10 10
+X7 Y5 400 600 10 10
+X8 Y5 400 700 10 10
+X9 Y5 400 800 10 10
+X10 Y5 400 900 10 10
+X11 Y5 400 1000 10 10
+X12 Y5 400 1100 10 10
+X13 Y5 400 1200 10 10
+X14 Y5 400 1300 10 10
+X15 Y5 400 1400 10 10
+X16 Y5 400 1500 10 10
+X17 Y5 400 1600 10 10
+X18 Y5 400 1700 10 10
+X19 Y5 400 1800 10 10
+X20 Y5 400 1900 10 10
+X21 Y5 400 2000 10 10
+X22 Y5 400 2100 10 10
+X23 Y5 400 2200 10 10
+X24 Y5 400 2300 10 10
+X25 Y5 400 2400 10 10
+X26 Y5 400 2500 10 10
+X27 Y5 400 2600 10 10
+X1 Y6 500 0 10 10
+X2 Y6 500 100 10 10
+X3 Y6 500 200 10 10
+X4 Y6 500 300 10 10
+X5 Y6 500 400 10 10
+X6 Y6 500 500 10 10
+X7 Y6 500 600 10 10
+X8 Y6 500 700 10 10
+X9 Y6 500 800 10 10
+X10 Y6 500 900 10 10
+X11 Y6 500 1000 10 10
+X12 Y6 500 1100 10 10
+X13 Y6 500 1200 10 10
+X14 Y6 500 1300 10 10
+X15 Y6 500 1400 10 10
+X16 Y6 500 1500 10 10
+X17 Y6 500 1600 10 10
+X18 Y6 500 1700 10 10
+X19 Y6 500 1800 10 10
+X20 Y6 500 1900 10 10
+X21 Y6 500 2000 10 10
+X22 Y6 500 2100 10 10
+X23 Y6 500 2200 10 10
+X24 Y6 500 2300 10 10
+X25 Y6 500 2400 10 10
+X26 Y6 500 2500 10 10
+X27 Y6 500 2600 10 10
+X1 Y7 600 0 10 10
+X2 Y7 600 100 10 10
+X3 Y7 600 200 10 10
+X4 Y7 600 300 10 10
+X5 Y7 600 400 10 10
+X6 Y7 600 500 10 10
+X7 Y7 600 600 10 10
+X8 Y7 600 700 10 10
+X9 Y7 600 800 10 10
+X10 Y7 600 900 10 10
+X11 Y7 600 1000 10 10
+X12 Y7 600 1100 10 10
+X13 Y7 600 1200 10 10
+X14 Y7 600 1300 10 10
+X15 Y7 600 1400 10 10
+X16 Y7 600 1500 10 10
+X17 Y7 600 1600 10 10
+X18 Y7 600 1700 10 10
+X19 Y7 600 1800 10 10
+X20 Y7 600 1900 10 10
+X21 Y7 600 2000 10 10
+X22 Y7 600 2100 10 10
+X23 Y7 600 2200 10 10
+X24 Y7 600 2300 10 10
+X25 Y7 600 2400 10 10
+X26 Y7 600 2500 10 10
+X27 Y7 600 2600 10 10
+X1 Y8 700 0 10 10
+X2 Y8 700 100 10 10
+X3 Y8 700 200 10 10
+X4 Y8 700 300 10 10
+X5 Y8 700 400 10 10
+X6 Y8 700 500 10 10
+X7 Y8 700 600 10 10
+X8 Y8 700 700 10 10
+X9 Y8 700 800 10 10
+X10 Y8 700 900 10 10
+X11 Y8 700 1000 10 10
+X12 Y8 700 1100 10 10
+X13 Y8 700 1200 10 10
+X14 Y8 700 1300 10 10
+X15 Y8 700 1400 10 10
+X16 Y8 700 1500 10 10
+X17 Y8 700 1600 10 10
+X18 Y8 700 1700 10 10
+X19 Y8 700 1800 10 10
+X20 Y8 700 1900 10 10
+X21 Y8 700 2000 10 10
+X22 Y8 700 2100 10 10
+X23 Y8 700 2200 10 10
+X24 Y8 700 2300 10 10
+X25 Y8 700 2400 10 10
+X26 Y8 700 2500 10 10
+X27 Y8 700 2600 10 10
+X1 Y9 800 0 10 10
+X2 Y9 800 100 10 10
+X3 Y9 800 200 10 10
+X4 Y9 800 300 10 10
+X5 Y9 800 400 10 10
+X6 Y9 800 500 10 10
+X7 Y9 800 600 10 10
+X8 Y9 800 700 10 10
+X9 Y9 800 800 10 10
+X10 Y9 800 900 10 10
+X11 Y9 800 1000 10 10
+X12 Y9 800 1100 10 10
+X13 Y9 800 1200 10 10
+X14 Y9 800 1300 10 10
+X15 Y9 800 1400 10 10
+X16 Y9 800 1500 10 10
+X17 Y9 800 1600 10 10
+X18 Y9 800 1700 10 10
+X19 Y9 800 1800 10 10
+X20 Y9 800 1900 10 10
+X21 Y9 800 2000 10 10
+X22 Y9 800 2100 10 10
+X23 Y9 800 2200 10 10
+X24 Y9 800 2300 10 10
+X25 Y9 800 2400 10 10
+X26 Y9 800 2500 10 10
+X27 Y9 800 2600 10 10
+X1 Y10 900 0 10 10
+X2 Y10 900 100 10 10
+X3 Y10 900 200 10 10
+X4 Y10 900 300 10 10
+X5 Y10 900 400 10 10
+X6 Y10 900 500 10 10
+X7 Y10 900 600 10 10
+X8 Y10 900 700 10 10
+X9 Y10 900 800 10 10
+X10 Y10 900 900 10 10
+X11 Y10 900 1000 10 10
+X12 Y10 900 1100 10 10
+X13 Y10 900 1200 10 10
+X14 Y10 900 1300 10 10
+X15 Y10 900 1400 10 10
+X16 Y10 900 1500 10 10
+X17 Y10 900 1600 10 10
+X18 Y10 900 1700 10 10
+X19 Y10 900 1800 10 10
+X20 Y10 900 1900 10 10
+X21 Y10 900 2000 10 10
+X22 Y10 900 2100 10 10
+X23 Y10 900 2200 10 10
+X24 Y10 900 2300 10 10
+X25 Y10 900 2400 10 10
+X26 Y10 900 2500 10 10
+X27 Y10 900 2600 10 10
+X1 Y11 1000 0 10 10
+X2 Y11 1000 100 10 10
+X3 Y11 1000 200 10 10
+X4 Y11 1000 300 10 10
+X5 Y11 1000 400 10 10
+X6 Y11 1000 500 10 10
+X7 Y11 1000 600 10 10
+X8 Y11 1000 700 10 10
+X9 Y11 1000 800 10 10
+X10 Y11 1000 900 10 10
+X11 Y11 1000 1000 10 10
+X12 Y11 1000 1100 10 10
+X13 Y11 1000 1200 10 10
+X14 Y11 1000 1300 10 10
+X15 Y11 1000 1400 10 10
+X16 Y11 1000 1500 10 10
+X17 Y11 1000 1600 10 10
+X18 Y11 1000 1700 10 10
+X19 Y11 1000 1800 10 10
+X20 Y11 1000 1900 10 10
+X21 Y11 1000 2000 10 10
+X22 Y11 1000 2100 10 10
+X23 Y11 1000 2200 10 10
+X24 Y11 1000 2300 10 10
+X25 Y11 1000 2400 10 10
+X26 Y11 1000 2500 10 10
+X27 Y11 1000 2600 10 10
+X1 Y12 1100 0 10 10
+X2 Y12 1100 100 10 10
+X3 Y12 1100 200 10 10
+X4 Y12 1100 300 10 10
+X5 Y12 1100 400 10 10
+X6 Y12 1100 500 10 10
+X7 Y12 1100 600 10 10
+X8 Y12 1100 700 10 10
+X9 Y12 1100 800 10 10
+X10 Y12 1100 900 10 10
+X11 Y12 1100 1000 10 10
+X12 Y12 1100 1100 10 10
+X13 Y12 1100 1200 10 10
+X14 Y12 1100 1300 10 10
+X15 Y12 1100 1400 10 10
+X16 Y12 1100 1500 10 10
+X17 Y12 1100 1600 10 10
+X18 Y12 1100 1700 10 10
+X19 Y12 1100 1800 10 10
+X20 Y12 1100 1900 10 10
+X21 Y12 1100 2000 10 10
+X22 Y12 1100 2100 10 10
+X23 Y12 1100 2200 10 10
+X24 Y12 1100 2300 10 10
+X25 Y12 1100 2400 10 10
+X26 Y12 1100 2500 10 10
+X27 Y12 1100 2600 10 10
+X1 Y13 1200 0 10 10
+X2 Y13 1200 100 10 10
+X3 Y13 1200 200 10 10
+X4 Y13 1200 300 10 10
+X5 Y13 1200 400 10 10
+X6 Y13 1200 500 10 10
+X7 Y13 1200 600 10 10
+X8 Y13 1200 700 10 10
+X9 Y13 1200 800 10 10
+X10 Y13 1200 900 10 10
+X11 Y13 1200 1000 10 10
+X12 Y13 1200 1100 10 10
+X13 Y13 1200 1200 10 10
+X14 Y13 1200 1300 10 10
+X15 Y13 1200 1400 10 10
+X16 Y13 1200 1500 10 10
+X17 Y13 1200 1600 10 10
+X18 Y13 1200 1700 10 10
+X19 Y13 1200 1800 10 10
+X20 Y13 1200 1900 10 10
+X21 Y13 1200 2000 10 10
+X22 Y13 1200 2100 10 10
+X23 Y13 1200 2200 10 10
+X24 Y13 1200 2300 10 10
+X25 Y13 1200 2400 10 10
+X26 Y13 1200 2500 10 10
+X27 Y13 1200 2600 10 10
+X1 Y14 1300 0 10 10
+X2 Y14 1300 100 10 10
+X3 Y14 1300 200 10 10
+X4 Y14 1300 300 10 10
+X5 Y14 1300 400 10 10
+X6 Y14 1300 500 10 10
+X7 Y14 1300 600 10 10
+X8 Y14 1300 700 10 10
+X9 Y14 1300 800 10 10
+X10 Y14 1300 900 10 10
+X11 Y14 1300 1000 10 10
+X12 Y14 1300 1100 10 10
+X13 Y14 1300 1200 10 10
+X14 Y14 1300 1300 10 10
+X15 Y14 1300 1400 10 10
+X16 Y14 1300 1500 10 10
+X17 Y14 1300 1600 10 10
+X18 Y14 1300 1700 10 10
+X19 Y14 1300 1800 10 10
+X20 Y14 1300 1900 10 10
+X21 Y14 1300 2000 10 10
+X22 Y14 1300 2100 10 10
+X23 Y14 1300 2200 10 10
+X24 Y14 1300 2300 10 10
+X25 Y14 1300 2400 10 10
+X26 Y14 1300 2500 10 10
+X27 Y14 1300 2600 10 10
+X1 Y15 1400 0 10 10
+X2 Y15 1400 100 10 10
+X3 Y15 1400 200 10 10
+X4 Y15 1400 300 10 10
+X5 Y15 1400 400 10 10
+X6 Y15 1400 500 10 10
+X7 Y15 1400 600 10 10
+X8 Y15 1400 700 10 10
+X9 Y15 1400 800 10 10
+X10 Y15 1400 900 10 10
+X11 Y15 1400 1000 10 10
+X12 Y15 1400 1100 10 10
+X13 Y15 1400 1200 10 10
+X14 Y15 1400 1300 10 10
+X15 Y15 1400 1400 10 10
+X16 Y15 1400 1500 10 10
+X17 Y15 1400 1600 10 10
+X18 Y15 1400 1700 10 10
+X19 Y15 1400 1800 10 10
+X20 Y15 1400 1900 10 10
+X21 Y15 1400 2000 10 10
+X22 Y15 1400 2100 10 10
+X23 Y15 1400 2200 10 10
+X24 Y15 1400 2300 10 10
+X25 Y15 1400 2400 10 10
+X26 Y15 1400 2500 10 10
+X27 Y15 1400 2600 10 10
+X1 Y16 1500 0 10 10
+X2 Y16 1500 100 10 10
+X3 Y16 1500 200 10 10
+X4 Y16 1500 300 10 10
+X5 Y16 1500 400 10 10
+X6 Y16 1500 500 10 10
+X7 Y16 1500 600 10 10
+X8 Y16 1500 700 10 10
+X9 Y16 1500 800 10 10
+X10 Y16 1500 900 10 10
+X11 Y16 1500 1000 10 10
+X12 Y16 1500 1100 10 10
+X13 Y16 1500 1200 10 10
+X14 Y16 1500 1300 10 10
+X15 Y16 1500 1400 10 10
+X16 Y16 1500 1500 10 10
+X17 Y16 1500 1600 10 10
+X18 Y16 1500 1700 10 10
+X19 Y16 1500 1800 10 10
+X20 Y16 1500 1900 10 10
+X21 Y16 1500 2000 10 10
+X22 Y16 1500 2100 10 10
+X23 Y16 1500 2200 10 10
+X24 Y16 1500 2300 10 10
+X25 Y16 1500 2400 10 10
+X26 Y16 1500 2500 10 10
+X27 Y16 1500 2600 10 10
+X1 Y17 1600 0 10 10
+X2 Y17 1600 100 10 10
+X3 Y17 1600 200 10 10
+X4 Y17 1600 300 10 10
+X5 Y17 1600 400 10 10
+X6 Y17 1600 500 10 10
+X7 Y17 1600 600 10 10
+X8 Y17 1600 700 10 10
+X9 Y17 1600 800 10 10
+X10 Y17 1600 900 10 10
+X11 Y17 1600 1000 10 10
+X12 Y17 1600 1100 10 10
+X13 Y17 1600 1200 10 10
+X14 Y17 1600 1300 10 10
+X15 Y17 1600 1400 10 10
+X16 Y17 1600 1500 10 10
+X17 Y17 1600 1600 10 10
+X18 Y17 1600 1700 10 10
+X19 Y17 1600 1800 10 10
+X20 Y17 1600 1900 10 10
+X21 Y17 1600 2000 10 10
+X22 Y17 1600 2100 10 10
+X23 Y17 1600 2200 10 10
+X24 Y17 1600 2300 10 10
+X25 Y17 1600 2400 10 10
+X26 Y17 1600 2500 10 10
+X27 Y17 1600 2600 10 10
+X1 Y18 1700 0 10 10
+X2 Y18 1700 100 10 10
+X3 Y18 1700 200 10 10
+X4 Y18 1700 300 10 10
+X5 Y18 1700 400 10 10
+X6 Y18 1700 500 10 10
+X7 Y18 1700 600 10 10
+X8 Y18 1700 700 10 10
+X9 Y18 1700 800 10 10
+X10 Y18 1700 900 10 10
+X11 Y18 1700 1000 10 10
+X12 Y18 1700 1100 10 10
+X13 Y18 1700 1200 10 10
+X14 Y18 1700 1300 10 10
+X15 Y18 1700 1400 10 10
+X16 Y18 1700 1500 10 10
+X17 Y18 1700 1600 10 10
+X18 Y18 1700 1700 10 10
+X19 Y18 1700 1800 10 10
+X20 Y18 1700 1900 10 10
+X21 Y18 1700 2000 10 10
+X22 Y18 1700 2100 10 10
+X23 Y18 1700 2200 10 10
+X24 Y18 1700 2300 10 10
+X25 Y18 1700 2400 10 10
+X26 Y18 1700 2500 10 10
+X27 Y18 1700 2600 10 10
+X1 Y19 1800 0 10 10
+X2 Y19 1800 100 10 10
+X3 Y19 1800 200 10 10
+X4 Y19 1800 300 10 10
+X5 Y19 1800 400 10 10
+X6 Y19 1800 500 10 10
+X7 Y19 1800 600 10 10
+X8 Y19 1800 700 10 10
+X9 Y19 1800 800 10 10
+X10 Y19 1800 900 10 10
+X11 Y19 1800 1000 10 10
+X12 Y19 1800 1100 10 10
+X13 Y19 1800 1200 10 10
+X14 Y19 1800 1300 10 10
+X15 Y19 1800 1400 10 10
+X16 Y19 1800 1500 10 10
+X17 Y19 1800 1600 10 10
+X18 Y19 1800 1700 10 10
+X19 Y19 1800 1800 10 10
+X20 Y19 1800 1900 10 10
+X21 Y19 1800 2000 10 10
+X22 Y19 1800 2100 10 10
+X23 Y19 1800 2200 10 10
+X24 Y19 1800 2300 10 10
+X25 Y19 1800 2400 10 10
+X26 Y19 1800 2500 10 10
+X27 Y19 1800 2600 10 10
+X1 Y20 1900 0 10 10
+X2 Y20 1900 100 10 10
+X3 Y20 1900 200 10 10
+X4 Y20 1900 300 10 10
+X5 Y20 1900 400 10 10
+X6 Y20 1900 500 10 10
+X7 Y20 1900 600 10 10
+X8 Y20 1900 700 10 10
+X9 Y20 1900 800 10 10
+X10 Y20 1900 900 10 10
+X11 Y20 1900 1000 10 10
+X12 Y20 1900 1100 10 10
+X13 Y20 1900 1200 10 10
+X14 Y20 1900 1300 10 10
+X15 Y20 1900 1400 10 10
+X16 Y20 1900 1500 10 10
+X17 Y20 1900 1600 10 10
+X18 Y20 1900 1700 10 10
+X19 Y20 1900 1800 10 10
+X20 Y20 1900 1900 10 10
+X21 Y20 1900 2000 10 10
+X22 Y20 1900 2100 10 10
+X23 Y20 1900 2200 10 10
+X24 Y20 1900 2300 10 10
+X25 Y20 1900 2400 10 10
+X26 Y20 1900 2500 10 10
+X27 Y20 1900 2600 10 10
+X1 Y21 2000 0 10 10
+X2 Y21 2000 100 10 10
+X3 Y21 2000 200 10 10
+X4 Y21 2000 300 10 10
+X5 Y21 2000 400 10 10
+X6 Y21 2000 500 10 10
+X7 Y21 2000 600 10 10
+X8 Y21 2000 700 10 10
+X9 Y21 2000 800 10 10
+X10 Y21 2000 900 10 10
+X11 Y21 2000 1000 10 10
+X12 Y21 2000 1100 10 10
+X13 Y21 2000 1200 10 10
+X14 Y21 2000 1300 10 10
+X15 Y21 2000 1400 10 10
+X16 Y21 2000 1500 10 10
+X17 Y21 2000 1600 10 10
+X18 Y21 2000 1700 10 10
+X19 Y21 2000 1800 10 10
+X20 Y21 2000 1900 10 10
+X21 Y21 2000 2000 10 10
+X22 Y21 2000 2100 10 10
+X23 Y21 2000 2200 10 10
+X24 Y21 2000 2300 10 10
+X25 Y21 2000 2400 10 10
+X26 Y21 2000 2500 10 10
+X27 Y21 2000 2600 10 10
+X1 Y22 2100 0 10 10
+X2 Y22 2100 100 10 10
+X3 Y22 2100 200 10 10
+X4 Y22 2100 300 10 10
+X5 Y22 2100 400 10 10
+X6 Y22 2100 500 10 10
+X7 Y22 2100 600 10 10
+X8 Y22 2100 700 10 10
+X9 Y22 2100 800 10 10
+X10 Y22 2100 900 10 10
+X11 Y22 2100 1000 10 10
+X12 Y22 2100 1100 10 10
+X13 Y22 2100 1200 10 10
+X14 Y22 2100 1300 10 10
+X15 Y22 2100 1400 10 10
+X16 Y22 2100 1500 10 10
+X17 Y22 2100 1600 10 10
+X18 Y22 2100 1700 10 10
+X19 Y22 2100 1800 10 10
+X20 Y22 2100 1900 10 10
+X21 Y22 2100 2000 10 10
+X22 Y22 2100 2100 10 10
+X23 Y22 2100 2200 10 10
+X24 Y22 2100 2300 10 10
+X25 Y22 2100 2400 10 10
+X26 Y22 2100 2500 10 10
+X27 Y22 2100 2600 10 10
+X1 Y23 2200 0 10 10
+X2 Y23 2200 100 10 10
+X3 Y23 2200 200 10 10
+X4 Y23 2200 300 10 10
+X5 Y23 2200 400 10 10
+X6 Y23 2200 500 10 10
+X7 Y23 2200 600 10 10
+X8 Y23 2200 700 10 10
+X9 Y23 2200 800 10 10
+X10 Y23 2200 900 10 10
+X11 Y23 2200 1000 10 10
+X12 Y23 2200 1100 10 10
+X13 Y23 2200 1200 10 10
+X14 Y23 2200 1300 10 10
+X15 Y23 2200 1400 10 10
+X16 Y23 2200 1500 10 10
+X17 Y23 2200 1600 10 10
+X18 Y23 2200 1700 10 10
+X19 Y23 2200 1800 10 10
+X20 Y23 2200 1900 10 10
+X21 Y23 2200 2000 10 10
+X22 Y23 2200 2100 10 10
+X23 Y23 2200 2200 10 10
+X24 Y23 2200 2300 10 10
+X25 Y23 2200 2400 10 10
+X26 Y23 2200 2500 10 10
+X27 Y23 2200 2600 10 10
+X1 Y24 2300 0 10 10
+X2 Y24 2300 100 10 10
+X3 Y24 2300 200 10 10
+X4 Y24 2300 300 10 10
+X5 Y24 2300 400 10 10
+X6 Y24 2300 500 10 10
+X7 Y24 2300 600 10 10
+X8 Y24 2300 700 10 10
+X9 Y24 2300 800 10 10
+X10 Y24 2300 900 10 10
+X11 Y24 2300 1000 10 10
+X12 Y24 2300 1100 10 10
+X13 Y24 2300 1200 10 10
+X14 Y24 2300 1300 10 10
+X15 Y24 2300 1400 10 10
+X16 Y24 2300 1500 10 10
+X17 Y24 2300 1600 10 10
+X18 Y24 2300 1700 10 10
+X19 Y24 2300 1800 10 10
+X20 Y24 2300 1900 10 10
+X21 Y24 2300 2000 10 10
+X22 Y24 2300 2100 10 10
+X23 Y24 2300 2200 10 10
+X24 Y24 2300 2300 10 10
+X25 Y24 2300 2400 10 10
+X26 Y24 2300 2500 10 10
+X27 Y24 2300 2600 10 10
+X1 Y25 2400 0 10 10
+X2 Y25 2400 100 10 10
+X3 Y25 2400 200 10 10
+X4 Y25 2400 300 10 10
+X5 Y25 2400 400 10 10
+X6 Y25 2400 500 10 10
+X7 Y25 2400 600 10 10
+X8 Y25 2400 700 10 10
+X9 Y25 2400 800 10 10
+X10 Y25 2400 900 10 10
+X11 Y25 2400 1000 10 10
+X12 Y25 2400 1100 10 10
+X13 Y25 2400 1200 10 10
+X14 Y25 2400 1300 10 10
+X15 Y25 2400 1400 10 10
+X16 Y25 2400 1500 10 10
+X17 Y25 2400 1600 10 10
+X18 Y25 2400 1700 10 10
+X19 Y25 2400 1800 10 10
+X20 Y25 2400 1900 10 10
+X21 Y25 2400 2000 10 10
+X22 Y25 2400 2100 10 10
+X23 Y25 2400 2200 10 10
+X24 Y25 2400 2300 10 10
+X25 Y25 2400 2400 10 10
+X26 Y25 2400 2500 10 10
+X27 Y25 2400 2600 10 10
+X1 Y26 2500 0 10 10
+X2 Y26 2500 100 10 10
+X3 Y26 2500 200 10 10
+X4 Y26 2500 300 10 10
+X5 Y26 2500 400 10 10
+X6 Y26 2500 500 10 10
+X7 Y26 2500 600 10 10
+X8 Y26 2500 700 10 10
+X9 Y26 2500 800 10 10
+X10 Y26 2500 900 10 10
+X11 Y26 2500 1000 10 10
+X12 Y26 2500 1100 10 10
+X13 Y26 2500 1200 10 10
+X14 Y26 2500 1300 10 10
+X15 Y26 2500 1400 10 10
+X16 Y26 2500 1500 10 10
+X17 Y26 2500 1600 10 10
+X18 Y26 2500 1700 10 10
+X19 Y26 2500 1800 10 10
+X20 Y26 2500 1900 10 10
+X21 Y26 2500 2000 10 10
+X22 Y26 2500 2100 10 10
+X23 Y26 2500 2200 10 10
+X24 Y26 2500 2300 10 10
+X25 Y26 2500 2400 10 10
+X26 Y26 2500 2500 10 10
+X27 Y26 2500 2600 10 10
+X1 Y27 2600 0 10 10
+X2 Y27 2600 100 10 10
+X3 Y27 2600 200 10 10
+X4 Y27 2600 300 10 10
+X5 Y27 2600 400 10 10
+X6 Y27 2600 500 10 10
+X7 Y27 2600 600 10 10
+X8 Y27 2600 700 10 10
+X9 Y27 2600 800 10 10
+X10 Y27 2600 900 10 10
+X11 Y27 2600 1000 10 10
+X12 Y27 2600 1100 10 10
+X13 Y27 2600 1200 10 10
+X14 Y27 2600 1300 10 10
+X15 Y27 2600 1400 10 10
+X16 Y27 2600 1500 10 10
+X17 Y27 2600 1600 10 10
+X18 Y27 2600 1700 10 10
+X19 Y27 2600 1800 10 10
+X20 Y27 2600 1900 10 10
+X21 Y27 2600 2000 10 10
+X22 Y27 2600 2100 10 10
+X23 Y27 2600 2200 10 10
+X24 Y27 2600 2300 10 10
+X25 Y27 2600 2400 10 10
+X26 Y27 2600 2500 10 10
+X27 Y27 2600 2600 10 10

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/Mesh_Par_file
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/Mesh_Par_file	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/Mesh_Par_file	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,54 @@
+
+# coordinates of mesh block in latitude/longitude and depth in km
+LATITUDE_MIN                    = 0.0d0
+LATITUDE_MAX                    = 2640.0d0
+LONGITUDE_MIN                   = 0.0d0
+LONGITUDE_MAX                   = 2640.0d0
+DEPTH_BLOCK_KM                  = 1.440d0
+UTM_PROJECTION_ZONE             = 11
+SUPPRESS_UTM_PROJECTION         = .true.
+
+# file that contains the interfaces of the model / mesh
+INTERFACES_FILE                 = interfaces.dat
+
+# number of elements at the surface along edges of the mesh at the surface
+# (must be 8 * multiple of NPROC below if mesh is not regular and contains mesh doublings)
+# (must be multiple of NPROC below if mesh is regular)
+NEX_XI                          = 32
+NEX_ETA                         = 32
+
+# number of MPI processors along xi and eta (can be different)
+NPROC_XI                        = 2
+NPROC_ETA                       = 2
+
+# Regular/irregular mesh
+USE_REGULAR_MESH                = .true.
+# Only for irregular meshes, number of doubling layers (1 or 2) and their position
+NDOUBLINGS                      = 1
+# NZ_DOUGLING_1 is the parameter to set up if there is only one doubling layer
+NZ_DOUGLING_1                   = 11
+NZ_DOUGLING_2                   = 0
+
+# create mesh files for visualisation or further checking
+CREATE_ABAQUS_FILES             = .false.
+CREATE_DX_FILES                 = .false.
+
+# path to store the databases files
+LOCAL_PATH                      = ../in_out_files/DATABASES_MPI/
+
+# number of materials
+NMATERIALS                      = 4
+# define the different materials in the model as :
+# #material_id  #rho  #vp  #vs  #Q  #anisotropy_flag #domain_id
+#     Q                : quality factor
+#     anisotropy_flag  : 0=no anisotropy/ 1,2,.. check with implementation in aniso_model.f90
+#     domain_id        : 1=acoustic / 2=elastic
+1  2000  2000  1500  0.0   0  2
+2  2000  2000  0     0.0   0  1
+3  1000  1500  700   0     0  2
+4  1300  1400  700   50.0  0  2
+# number of regions
+NREGIONS                        = 1
+# define the different regions of the model as :
+#NEX_XI_BEGIN  #NEX_XI_END  #NEX_ETA_BEGIN  #NEX_ETA_END  #NZ_BEGIN #NZ_END  #material_id
+1              32            1               32             1         8        1

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interface3.dat
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interface3.dat	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interface3.dat	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,4 @@
+0.0
+0.0
+0.0
+0.0

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interfaces.dat
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interfaces.dat	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/in_data_files/meshfem3D_files/interfaces.dat	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,22 @@
+# number of interfaces
+ 1
+#
+# We describe each interface below, structured as a 2D-grid, with several parameters : 
+# number of points along XI and ETA, minimal XI ETA coordinates 
+# and spacing between points which must be constant.
+# Then the records contain the Z coordinates of the NXI x NETA points.
+#
+# interface number 1 
+# SUPPRESS_UTM_PROJECTION  NXI  NETA LONG_MIN   LAT_MIN    SPACING_XI SPACING_ETA
+# .true.                    161  144  316000.d0  3655000.d0 20000.d0    20000.d0
+# interface1.dat
+# interface number 2 (topography, top of the mesh)
+ .true. 2 2 0.d0 0.d0 2640.00d0 2640.00d0
+ interface3.dat
+#
+# for each layer, we give the number of spectral elements in the vertical direction
+# layer number 1 (bottom layer)
+# 11
+# layer number 2 (top layer)
+# 4
+8

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/postprocessing.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/postprocessing.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/postprocessing.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,131 @@
+program random_model
+
+  implicit none
+
+  integer,parameter :: NGLLX=5,NGLLY=5,NGLLZ=5,IOUT=20
+
+  integer :: myrank,ier,nspec,nglob,NPROC,j,ios,NSTEP,irec
+  real :: DATASPACE,MODELSPACE,DT
+  character(len=256) prname,arg,procname,filename
+  real,dimension(:,:,:,:),allocatable :: vp,vs,rho,weights
+  real,dimension(:,:,:,:),allocatable :: vp0,vs0,rho0,krhop,kalpha,kbeta
+  integer(kind=4) :: r4head(60)
+  integer(kind=4) :: header4(1)
+  integer(kind=2) :: header2(2)
+  equivalence(header2,header4)
+
+  real,dimension(:), allocatable :: adj
+
+  !! input parameters
+  if( iargc() .ne. 3 ) stop 'Usage: ./xpostprocessing NSTEP DT NPROC'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) NSTEP;   if (ios /= 0) stop 'Error reading NSTEP'
+  j=2;  call getarg(j, arg); read(arg,*,iostat=ios)    DT;   if (ios /= 0) stop 'Error reading DT'
+  j=3;  call getarg(j, arg); read(arg,*,iostat=ios) NPROC;   if (ios /= 0) stop 'Error reading NPROC'
+
+  MODELSPACE=0.0
+  DATASPACE=0.0
+  allocate(adj(NSTEP))
+
+  do myrank=0,NPROC-1
+    !!! calculate inner product in model space --- <F* F dm, dm>
+    ! processors name
+    write(prname,'(a,i6.6,a)') 'proc',myrank,'_'
+    ! nspec & nglob
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'external_mesh.bin',status='old',action='read',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening database proc######_external_mesh.bin'
+    read(IOUT) nspec
+    read(IOUT) nglob
+    close(IOUT)
+    ! weights
+    allocate(weights(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array weights'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'weights_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) weights
+    close(IOUT)
+    ! kernels
+    allocate(krhop(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array krhop'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'rhop_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) krhop
+    close(IOUT)
+    allocate(kalpha(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array kalpha'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'alpha_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) kalpha
+    close(IOUT)
+    allocate(kbeta(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array kbeta'
+    open(unit=IOUT,file='../in_out_files/DATABASES_MPI/'//trim(adjustl(prname))//'beta_kernel.bin',status='old',action='read',form='unformatted',iostat=ier)
+    read(IOUT) kbeta
+    close(IOUT)
+    ! rho
+    allocate(rho(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho'
+    allocate(rho0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho0'
+    open(unit=IOUT,file='../models/target_model/'//trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+    read(IOUT) rho
+    close(IOUT)
+    open(unit=IOUT,file='../models/initial_model/'//trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+    read(IOUT) rho0
+    close(IOUT)
+    ! vp
+    allocate(vp(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp'
+    allocate(vp0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp0'
+    open(unit=IOUT,file='../models/target_model/'//trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vp
+    close(IOUT)
+    open(unit=IOUT,file='../models/initial_model/'//trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vp0
+    close(IOUT)
+    ! vs
+    allocate(vs(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs'
+    allocate(vs0(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs0'
+    open(unit=IOUT,file='../models/target_model/'//trim(adjustl(prname))//'vs.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vs
+    close(IOUT)
+    open(unit=IOUT,file='../models/initial_model/'//trim(adjustl(prname))//'vs.bin',status='old',action='read',form='unformatted')
+    read(IOUT) vs0
+    close(IOUT)
+
+    ! F dm = S(m+dm) - S(m), we backpropogate syn-dat (see adj_seismogram.f90) => we have to add a minus sign in front of kernels
+    MODELSPACE=MODELSPACE+ &
+               (sum(weights*(-krhop)*(rho-rho0)/rho0)+ &
+               sum(weights*(-kalpha)*(vp-vp0)/vp0)+   &
+               sum(weights*(-kbeta)*(vs-vs0)/vs0))
+
+    deallocate(rho,rho0,vp,vp0,vs,vs0,weights,krhop,kalpha,kbeta)
+    !!! calculate inner product in data space --- <F dm, F dm>
+    write(procname,"(i4)") myrank
+    filename=trim(adjustl(procname))//"_dx_SU"
+    open(111,file="../in_out_files/SEM/"//trim(adjustl(filename))//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+    irec=1
+    do while(ios==0)
+       read(111,rec=irec,iostat=ios) r4head,adj
+                if (ios /= 0) cycle
+       DATASPACE=DATASPACE+sum(adj(:)*adj(:))*DT
+       irec=irec+1
+    enddo
+    close(111)
+    filename=trim(adjustl(procname))//"_dy_SU"
+    open(111,file="../in_out_files/SEM/"//trim(adjustl(filename))//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+    irec=1
+    do while(ios==0)
+       read(111,rec=irec,iostat=ios) r4head,adj
+                if (ios /= 0) cycle
+       DATASPACE=DATASPACE+sum(adj(:)*adj(:))*DT
+       irec=irec+1
+    enddo
+    close(111)
+    filename=trim(adjustl(procname))//"_dz_SU"
+    open(111,file="../in_out_files/SEM/"//trim(adjustl(filename))//".adj",access='direct',recl=240+4*NSTEP,iostat = ios)
+    irec=1
+    do while(ios==0)
+       read(111,rec=irec,iostat=ios) r4head,adj
+                if (ios /= 0) cycle
+       DATASPACE=DATASPACE+sum(adj(:)*adj(:))*DT
+       irec=irec+1
+    enddo
+    close(111)
+
+  enddo
+
+  print*, 'DATASPACE=',DATASPACE
+  print*, 'MODELSPACE=',MODELSPACE
+  print*, 'relative error=',(DATASPACE-MODELSPACE)/DATASPACE,irec
+
+end program random_model

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/random_model_generation.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/random_model_generation.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/random_model_generation.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,81 @@
+program random_model
+
+  implicit none
+
+  include "mpif.h"
+
+  integer,parameter :: NGLLX=5,NGLLY=5,NGLLZ=5,IOUT=20
+  character(len=512),parameter :: LOCAL_PATH='../in_out_files/DATABASES_MPI/'
+
+  integer :: myrank,ier,nspec,nglob,NPROC,j,ios
+  double precision :: percent
+  character(len=256) prname,arg
+  real, dimension(:,:,:,:),allocatable :: vp_read,vs_read,rho_read,random
+
+
+  call MPI_Init(ier)
+  call MPI_Comm_Rank(MPI_COMM_WORLD,myrank,ier)
+  call MPI_Comm_Size(MPI_COMM_WORLD,NPROC,ier)
+
+  !! input parameters
+  if( iargc() .ne. 1 ) stop 'Usage: ./xrandom_model percent [must be small enough (~1d-5) for F*dm=S(m+dm)-S(m) to be valid]'
+  j=1;  call getarg(j, arg); read(arg,*,iostat=ios) percent;   if (ios /= 0) stop 'Error reading percent'
+
+  ! processors name
+  write(prname,'(a,i6.6,a)') trim(LOCAL_PATH)//'proc',myrank,'_'
+  ! nspec & nglob
+  open(unit=IOUT,file=trim(adjustl(prname))//'external_mesh.bin',status='old',action='read',form='unformatted',iostat=ier)
+  if( ier /= 0 ) stop 'error opening database proc######_external_mesh.bin'
+  read(IOUT) nspec
+  read(IOUT) nglob
+  close(IOUT)
+  ! rho
+  allocate( rho_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array rho_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'rho.bin',status='old',action='read',form='unformatted')
+  read(IOUT) rho_read
+  close(IOUT)
+  ! vp
+  allocate( vp_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vp_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'vp.bin',status='old',action='read',form='unformatted')
+  read(IOUT) vp_read
+  close(IOUT)
+  ! vs
+  allocate( vs_read(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array vs_read'
+  open(unit=IOUT,file=trim(adjustl(prname))//'vs.bin',status='old',action='read',form='unformatted')
+  read(IOUT) vs_read
+  close(IOUT)
+
+  ! perturb model randomly
+  allocate( random(NGLLX,NGLLY,NGLLZ,nspec),stat=ier); if( ier /= 0 ) stop 'error allocating array random'
+  CALL RANDOM_SEED()
+  
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  rho_read=rho_read*(1.0+percent*random)
+
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  vp_read= vp_read*(1.0+percent*random)
+
+  CALL RANDOM_NUMBER(random)
+  random=random/maxval(abs(random))*2.0-1.0
+  vs_read= vs_read*(1.0+percent*random)
+
+  ! store perturbed model
+  ! rho
+  open(unit=IOUT,file=trim(adjustl(prname))//'rho.bin',status='old',action='write',form='unformatted')
+  write(IOUT) rho_read
+  close(IOUT)
+  ! vp
+  open(unit=IOUT,file=trim(adjustl(prname))//'vp.bin',status='old',action='write',form='unformatted')
+  write(IOUT) vp_read
+  close(IOUT)
+  ! vs
+  open(unit=IOUT,file=trim(adjustl(prname))//'vs.bin',status='old',action='write',form='unformatted')
+  write(IOUT) vs_read
+  close(IOUT)
+
+  call MPI_BARRIER(MPI_COMM_WORLD,ier)
+  call MPI_Finalize(ier)
+
+end program random_model

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,105 @@
+#!/bin/bash -eu
+
+NSTEP=`grep NSTEP   ./in_data_files/Par_file | cut -d = -f 2 | sed 's/ //g'`
+DT=`grep       DT   ./in_data_files/Par_file | cut -d = -f 2 | sed 's/ //g'`
+NPROC=`grep NPROC   ./in_data_files/Par_file | cut -d = -f 2 `
+
+NSTEP=3000
+DT=0.001
+percent=0.0001
+
+echo "NSTEP=$NSTEP"
+echo "DT=$DT"
+echo "NPROC=$NPROC"
+
+bin="$PWD/bin"
+in_data_files="$bin/../in_data_files"
+in_out_files="$bin/../in_out_files"
+models="$bin/../models"
+SESAME="$bin/../../../../"
+
+
+MPIRUN="mpirun -np $NPROC "
+MPIFC="mpif90 -assume byterecl "
+
+rm -rf $in_out_files $models $bin
+mkdir -p $in_out_files/DATABASES_MPI $in_out_files/OUTPUT_FILES $in_out_files/SEM/dat $in_out_files/SEM/syn
+mkdir -p $models/initial_model $models/target_model $bin
+
+cd $SESAME
+cp ./src/shared/constants.h ./src/shared/constants.h_backup
+cp ./src/specfem3D/save_adjoint_kernels.f90 ./src/specfem3D/save_adjoint_kernels.f90_backup
+cp ./src/generate_databases/get_model.f90 ./src/generate_databases/get_model.f90_backup
+cp $bin/../constants.h ./src/shared/constants.h
+cp $bin/../get_model_internal.f90 ./src/generate_databases/get_model.f90
+cp $bin/../save_adjoint_kernels.f90 ./src/specfem3D/save_adjoint_kernels.f90
+make > $bin/../make.log
+
+cp ./bin/xmeshfem3D            $bin/xmeshfem3D
+cp ./bin/xgenerate_databases   $bin/xgenerate_databases_internal
+cp ./bin/xspecfem3D            $bin/xspecfem3D
+
+cp $bin/../get_model_external.f90 ./src/generate_databases/get_model.f90
+make > $bin/../make.log
+cp ./bin/xgenerate_databases   $bin/xgenerate_databases_external
+
+cd $bin
+$MPIFC $bin/../random_model_generation.f90 -o ./xrandom_model > $bin/../compile.log
+$MPIFC $bin/../adj_seismogram.f90 -o ./xadj > $bin/../compile.log
+$MPIFC $bin/../postprocessing.f90 -o ./xpostprocessing > $bin/../compile.log
+
+########################### dat ########################################
+FILE="$in_data_files/Par_file"
+sed -e "s#^SIMULATION_TYPE.*#SIMULATION_TYPE = 1 #g"  < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^SAVE_FORWARD.*#SAVE_FORWARD = .true. #g"   < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^NSTEP.*#NSTEP = $NSTEP #g"                 < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^DT.*#DT = $DT #g"                          < $FILE > ./tmp; mv ./tmp $FILE
+
+cd $bin
+
+echo "data simulation: $MPIRUN ./xmeshfem3D ..."
+$MPIRUN ./xmeshfem3D
+echo "data simulation: $MPIRUN ./xgenerate_databases ..."
+$MPIRUN ./xgenerate_databases_internal
+echo "data simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+mv $in_out_files/OUTPUT_FILES/*SU $in_out_files/SEM/dat/
+cp $in_out_files/DATABASES_MPI/*rho.bin $models/target_model/
+cp $in_out_files/DATABASES_MPI/*vp.bin  $models/target_model/
+cp $in_out_files/DATABASES_MPI/*vs.bin  $models/target_model/
+########################### syn ########################################
+
+$MPIRUN ./xrandom_model $percent
+
+echo "syn simulation: $MPIRUN ./xgenerate_databases ..."
+$MPIRUN ./xgenerate_databases_external
+echo "syn simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+mv $in_out_files/OUTPUT_FILES/*SU $in_out_files/SEM/syn/
+cp $in_out_files/DATABASES_MPI/*rho.bin $models/initial_model/
+cp $in_out_files/DATABASES_MPI/*vp.bin  $models/initial_model/
+cp $in_out_files/DATABASES_MPI/*vs.bin  $models/initial_model/
+########################### adj sources ################################
+
+$MPIRUN ./xadj $NSTEP $DT
+
+########################### adj ########################################
+FILE="$in_data_files/Par_file"
+sed -e "s#^SIMULATION_TYPE.*#SIMULATION_TYPE = 3 #g"  < $FILE > ./tmp; mv ./tmp $FILE
+sed -e "s#^SAVE_FORWARD.*#SAVE_FORWARD = .false. #g"  < $FILE > ./tmp; mv ./tmp $FILE
+
+echo "adj simulation: $MPIRUN ./xspecfem3D ..."
+$MPIRUN ./xspecfem3D
+
+./xpostprocessing $NSTEP $DT $NPROC 
+
+cd $SESAME
+mv ./src/generate_databases/get_model.f90_backup ./src/generate_databases/get_model.f90
+mv ./src/specfem3D/save_adjoint_kernels.f90_backup ./src/specfem3D/save_adjoint_kernels.f90
+mv ./src/shared/constants.h_backup ./src/shared/constants.h
+
+cd $bin/../
+rm -f compile.log make.log
+rm -rf $in_out_files $models $bin


Property changes on: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash
___________________________________________________________________
Name: svn:executable
   + *

Added: seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/save_adjoint_kernels.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/save_adjoint_kernels.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D/trunk/examples/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/save_adjoint_kernels.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -0,0 +1,242 @@
+!=====================================================================
+!
+!               S p e c f e m 3 D  V e r s i o n  2 . 0
+!               ---------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Princeton University, USA and University of Pau / CNRS / INRIA
+! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+!                            April 2011
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+!
+! United States and French Government Sponsorship Acknowledged.
+
+  subroutine save_adjoint_kernels()
+
+  use specfem_par
+  use specfem_par_elastic
+  use specfem_par_acoustic
+
+  implicit none
+  integer:: ispec,i,j,k,iglob,ier
+  real(kind=CUSTOM_REAL) :: rhol,mul,kappal
+  real(kind=CUSTOM_REAL), dimension(:,:,:,:), allocatable :: weights_kernel
+  ! flag to save GLL weights
+  logical,parameter :: SAVE_WEIGHTS = .true.
+
+  ! finalizes calculation of rhop, beta, alpha kernels
+  do ispec = 1, NSPEC_AB
+
+    ! elastic simulations
+    if( ispec_is_elastic(ispec) ) then
+
+      do k = 1, NGLLZ
+        do j = 1, NGLLY
+          do i = 1, NGLLX
+            iglob = ibool(i,j,k,ispec)
+
+            ! isotropic adjoint kernels (see e.g. Tromp et al. 2005)
+            rhol = rho_vs(i,j,k,ispec)**2 / mustore(i,j,k,ispec)
+            mul = mustore(i,j,k,ispec)
+            kappal = kappastore(i,j,k,ispec)
+
+            ! for a parameterization: (rho,mu,kappa) "primary" kernels
+            ! density kernel
+            ! multiplies with rho
+            rho_kl(i,j,k,ispec) = - rhol * rho_kl(i,j,k,ispec)
+
+            ! shear modulus kernel
+            mu_kl(i,j,k,ispec) = - 2._CUSTOM_REAL * mul * mu_kl(i,j,k,ispec)
+
+            ! bulk modulus kernel
+            kappa_kl(i,j,k,ispec) = - kappal * kappa_kl(i,j,k,ispec)
+
+            ! for a parameterization: (rho,alpha,beta)
+            ! density prime kernel
+            rhop_kl(i,j,k,ispec) = rho_kl(i,j,k,ispec) + kappa_kl(i,j,k,ispec) + mu_kl(i,j,k,ispec)
+
+            ! vs kernel
+            beta_kl(i,j,k,ispec) = 2._CUSTOM_REAL * (mu_kl(i,j,k,ispec) &
+                  - 4._CUSTOM_REAL * mul / (3._CUSTOM_REAL * kappal) * kappa_kl(i,j,k,ispec))
+
+            ! vp kernel
+            alpha_kl(i,j,k,ispec) = 2._CUSTOM_REAL * (1._CUSTOM_REAL &
+                  + 4._CUSTOM_REAL * mul / (3._CUSTOM_REAL * kappal) ) * kappa_kl(i,j,k,ispec)
+
+            ! for a parameterization: (rho,bulk, beta)
+            ! where bulk wave speed is c = sqrt( kappa / rho)
+            ! note: rhoprime is the same as for (rho,alpha,beta) parameterization
+            !bulk_c_kl_crust_mantle(i,j,k,ispec) = 2._CUSTOM_REAL * kappa_kl(i,j,k,ispec)
+            !bulk_beta_kl_crust_mantle(i,j,k,ispec ) = 2._CUSTOM_REAL * mu_kl(i,j,k,ispec)
+
+          enddo
+        enddo
+      enddo
+
+    endif ! elastic
+
+    ! acoustic simulations
+    if( ispec_is_acoustic(ispec) ) then
+
+      do k = 1, NGLLZ
+        do j = 1, NGLLY
+          do i = 1, NGLLX
+            ! rho prime kernel
+            rhop_ac_kl(i,j,k,ispec) = rho_ac_kl(i,j,k,ispec) + kappa_ac_kl(i,j,k,ispec)
+
+            ! kappa kernel
+            alpha_ac_kl(i,j,k,ispec) = TWO *  kappa_ac_kl(i,j,k,ispec)
+          enddo
+        enddo
+      enddo
+
+    endif ! acoustic
+
+
+  enddo
+
+  ! save kernels to binary files
+  if( ELASTIC_SIMULATION ) then
+    open(unit=27,file=prname(1:len_trim(prname))//'rho_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rho_kernel.bin'
+    write(27) rho_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'mu_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file mu_kernel.bin'
+    write(27) mu_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'kappa_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file kappa_kernel.bin'
+    write(27) kappa_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'rhop_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rhop_kernel.bin'
+    write(27) rhop_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'beta_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file beta_kernel.bin'
+    write(27) beta_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'alpha_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file alpha_kernel.bin'
+    write(27) alpha_kl
+    close(27)
+
+    if (SAVE_MOHO_MESH) then
+      open(unit=27,file=prname(1:len_trim(prname))//'moho_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+      if( ier /= 0 ) stop 'error opening file moho_kernel.bin'
+      write(27) moho_kl
+      close(27)
+    endif
+
+  endif
+
+
+  ! save kernels to binary files
+  if( ACOUSTIC_SIMULATION ) then
+    open(unit=27,file=prname(1:len_trim(prname))//'rho_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rho_acoustic_kernel.bin'
+    write(27) rho_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'kappa_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file kappa_acoustic_kernel.bin'
+    write(27) kappa_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'rhop_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file rhop_acoustic_kernel.bin'
+    write(27) rhop_ac_kl
+    close(27)
+    open(unit=27,file=prname(1:len_trim(prname))//'alpha_acoustic_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file alpha_acoustic_kernel.bin'
+    write(27) alpha_ac_kl
+    close(27)
+
+  endif
+
+  ! save weights for volume integration, in order to benchmark the kernels with analytical expressions
+  if( SAVE_WEIGHTS ) then
+    allocate(weights_kernel(NGLLX,NGLLY,NGLLZ,NSPEC_AB),stat=ier)
+    if( ier /= 0 ) stop 'error allocating array weights_kernel'
+    do ispec = 1, NSPEC_AB
+        do k = 1, NGLLZ
+          do j = 1, NGLLY
+            do i = 1, NGLLX
+              weights_kernel(i,j,k,ispec) = wxgll(i) * wygll(j) * wzgll(k) * jacobian(i,j,k,ispec)
+            enddo ! i
+          enddo ! j
+        enddo ! k
+    enddo ! ispec
+    open(unit=27,file=prname(1:len_trim(prname))//'weights_kernel.bin',status='unknown',form='unformatted',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file weights_kernel.bin'
+    write(27) weights_kernel
+    close(27)
+  endif
+
+  ! for noise simulations --- noise strength kernel
+  if (NOISE_TOMOGRAPHY == 3) then
+    call save_kernels_strength_noise(myrank,LOCAL_PATH,sigma_kl,NSPEC_AB)
+  endif
+
+  ! for preconditioner
+  if ( APPROXIMATE_HESS_KL ) then
+    call save_kernels_hessian()
+  endif
+  
+  end subroutine save_adjoint_kernels
+  
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine save_kernels_hessian()
+
+  use specfem_par
+  use specfem_par_elastic
+  use specfem_par_acoustic
+
+  implicit none
+  integer :: ier
+  
+  ! acoustic domains
+  if( ACOUSTIC_SIMULATION ) then
+    ! scales approximate hessian
+    hess_ac_kl(:,:,:,:) = 2._CUSTOM_REAL * hess_ac_kl(:,:,:,:)
+
+    ! stores into file
+    open(unit=27,file=trim(prname)//'hess_acoustic_kernel.bin', &
+          status='unknown',form='unformatted',action='write',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file hess_acoustic_kernel.bin'
+    write(27) hess_ac_kl
+    close(27)
+  endif  
+
+  ! elastic domains
+  if( ELASTIC_SIMULATION ) then
+    ! scales approximate hessian
+    hess_kl(:,:,:,:) = 2._CUSTOM_REAL * hess_kl(:,:,:,:)
+
+    ! stores into file
+    open(unit=27,file=trim(prname)//'hess_kernel.bin', &
+          status='unknown',form='unformatted',action='write',iostat=ier)
+    if( ier /= 0 ) stop 'error opening file hess_kernel.bin'
+    write(27) hess_kl
+    close(27)
+  endif  
+  
+  end subroutine save_kernels_hessian
+  

Modified: seismo/3D/SPECFEM3D/trunk/src/shared/compute_kernels.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/src/shared/compute_kernels.f90	2011-09-19 21:04:34 UTC (rev 18941)
+++ seismo/3D/SPECFEM3D/trunk/src/shared/compute_kernels.f90	2011-09-19 22:45:55 UTC (rev 18942)
@@ -105,28 +105,52 @@
                       xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
                       ibool,rhostore)
       ! adjoint fields: acceleration vector
+      !<YANGL
+      !!!! old expression (\bfs\dagger=\frac{1}{\rho}\bfnabla\phi^\dagger)
+      !!!call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
+      !!!                potential_dot_dot_acoustic, accel_elm,&
+      !!!                hprime_xx,hprime_yy,hprime_zz, &
+      !!!                xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
+      !!!                ibool,rhostore)
+      ! new expression (\partial_t^2\bfs^\dagger=-\frac{1}{\rho}\bfnabla\phi^\dagger)
       call compute_gradient(ispec,NSPEC_AB,NGLOB_AB, &
-                      potential_dot_dot_acoustic, accel_elm,&
+                      potential_acoustic, accel_elm,&
                       hprime_xx,hprime_yy,hprime_zz, &
                       xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
                       ibool,rhostore)
+      !>YANGL
 
       do k = 1, NGLLZ
         do j = 1, NGLLY
           do i = 1, NGLLX
             iglob = ibool(i,j,k,ispec)
 
+            !<YANGL
+            !!!! old expression
+            !!!! density kernel
+            !!!rhol = rhostore(i,j,k,ispec)
+            !!!rho_ac_kl(i,j,k,ispec) =  rho_ac_kl(i,j,k,ispec) &
+            !!!          - deltat * rhol * dot_product(accel_elm(:,i,j,k), b_displ_elm(:,i,j,k))
+
+            !!!! bulk modulus kernel
+            !!!kappal = kappastore(i,j,k,ispec)
+            !!!kappa_ac_kl(i,j,k,ispec) = kappa_ac_kl(i,j,k,ispec) &
+            !!!                      - deltat / kappal  &
+            !!!                      * potential_dot_dot_acoustic(iglob) &
+            !!!                      * b_potential_dot_dot_acoustic(iglob)
+            ! new expression
             ! density kernel
             rhol = rhostore(i,j,k,ispec)
             rho_ac_kl(i,j,k,ispec) =  rho_ac_kl(i,j,k,ispec) &
-                      - deltat * rhol * dot_product(accel_elm(:,i,j,k), b_displ_elm(:,i,j,k))
+                      + deltat * rhol * dot_product(accel_elm(:,i,j,k), b_displ_elm(:,i,j,k))
 
             ! bulk modulus kernel
             kappal = kappastore(i,j,k,ispec)
             kappa_ac_kl(i,j,k,ispec) = kappa_ac_kl(i,j,k,ispec) &
-                                  - deltat / kappal  &
-                                  * potential_dot_dot_acoustic(iglob) &
-                                  * b_potential_dot_dot_acoustic(iglob)
+                                  + deltat * kappal  &
+                                  * potential_acoustic(iglob) / kappal &
+                                  * b_potential_dot_dot_acoustic(iglob) / kappal
+            !>YANGL
 
           enddo
         enddo



More information about the CIG-COMMITS mailing list