DOCUMENTATION

SYNOPSIS

PERL PROGRAM NAME:  SUEA2DF - SU version of (an)elastic anisotropic 2D finite difference 	
AUTHOR: Juan Lorenzo (Perl module only)
DATE:   
DESCRIPTION:
Version: 

USE

NOTES

Examples

SEISMIC UNIX NOTES

 SUEA2DF - SU version of (an)elastic anisotropic 2D finite difference 	
		forward modeling, 4th order in space			

 suea2df > outfile c11file= c55file=  [optional parameters]		

 Required Parameters:							
 c11file=c11_file	c11 voigt elasticity parameter filename		
 c55file=c55_file	c55 voigt elasticity parameter filename		

 Optional Parameters:							
 rhofile=rho_file	density filename				
			(if rhofile is not set, rho=1000 is assumed)	
 Anisotropy parameters:						
 aniso=0	 	 =1 - include anisotropy parameters		
 mode=0		=0 output particle velocity, =1 output stresses 
			(snapshots only)				

 ... the next 3 parameters become active only when aniso=1....		
 c13file=c13_file	c13 voigt elasticity parameter filename		
 c33file=c33_file	c33 voigt elasticity parameter filename		
 c15file=c15_file	c15 voigt elasticity parameter filename		
 c35file=c35_file	c35 voigt elasticity parameter filename		

 Attenuation parameters:						 
 qsw=0		 switch to include attenuation =1 - include		
 ... the next parameter becomes active only when qsw=1....	     	
 qfile=Q_file	  Q parameter filename	    				

 dt=0.001		time sampling interval (s)			
 ft=0.0 		first time (s)				 	
 lt=1.0 		last time (s)					

 nx=200		number of values in slow (x-direction)		
 dx=10.0	 	spatial sampling interval (m) x-coor		
 fx=-1000		first x coor (m)				

 nz=100		number of values in fast (z)-dimension		
 dz=dx			spatial sampling interval (m) z-coor		
 fz=0			firstz coor (m)  				

 Source parameters:							
 sx=0			source x position (m)				
 sz=500		source location (m)  				
 stype='p'		source type					
			  p: P-wave					
			  v: velocity					
			 pw: P plane-wave				
 sang=0		for stype='pw': plane wave angle		
 wtype='dg'		wave type					
 			 dg: Gaussian derivative 			
 			 ga: Gaussian		 			
 			 ri: Ricker					
 			 sp: spike, sp2: double spike   		
 ts=0.05		source duration (s)				
 favg=50		source average frequency			

 Attenuation parameters:						
 qsw=0		 	switch to include attenuation =1 - include	

 Boundary condition parameters:					
 bc=10,10,10,10 	Top,left,bottom,right boundary condition	
 			=0 none						
 			=1 symmetry 					
 			=2 free surface (top only)			
 			>2 absorbing (value indicates width of absorbing
			layer	 					
 bc_a=0.95;		bc initial taper value for absorbing boundary  
 bc_r=0.;		bc exponential factor for absorbing boundary  	
 			variables are scaled by bc_a*pow(i,-bc_r)	

 Optional output parameters:						
 sofile=		name of source file				
 snfile=		name of file containing for snapshots		
 snaptime=		times of snapshots i.e. snaptime=0.1,0.2,0.3	

 vsx=			x coordinate of vertical line of seismograms	
 hsz=			z coordinate of horizontal line of seismograms	
 vrslfile="vsp.su"	output file for vertical line of seismograms[nz][nt]
 hsfile="hs.su" 	output file for horizontal line of seismograms[nx][nt]
 tsw=0		 	switch to use shear stress only in non-fluid	
			media - may help reduce dispersion tsw=1. If	
			tsw=0 then standard calculation	  		
 verbose=0		=1 to print progress on screen			

 Notes:								
 1) The outfile contains information generated by the input parameters,
    such as memory allocation, stability, etc. If your input file does	
    not work, check this file first.					

 The model is specified as binary files of stiffness parameters and    
 densities. These may be created any way the user desires. The program 
 unif2 or makevel may be used to generate densities, and the program	
 unif2aniso may be used to generate the stiffnesses. You will need to	
 transpose these files (stiffnesses and densities), as the input	
 format for suea2df assumes that the fast dimesion is the horizontal or 
 the x-dimension. You may do this via					

  transp n1=nz < c11_file > transp_c11_file				

 If aniso=1 then the program will expect the additional stiffnesss files.

 If qsw=1 unif2anis can be used to generate the Q values on a grid	
 These value also need to be transposed, as with the stiffnesses.	

Output files (always generated) hsfile vrslfile hsfile.chd - header for hsfile vrslfile.chd - header for vrslfile hsfile.mod - model file

 Output files (if requested)						
	sofile - ascii source file					
	snfile  - su format snapshots file				

 Caveat:								
 A common error in using this program is to compute stiffnesses with	
 a specified density, but forget to specify this density as the rhofile.

 
 Credits: UU GEOPHY Chris Juhlin 15 May 1999
 Copyright (c) Uppsala University, 1998.
 All rights reserved.			
 Parts of program use Seismic Unix Package - CSM
 Changes - C. Juhlin

 1. Fixed upgrading of stresses. There was an error in the coding for
 the Tzz term, c15 was being used instead of c35. This only caused
 problems for dipping anisotropic layers

 2. Added some header information for hutput of snapshots.

 3. 2001-01-30: Added option to set absorbing bc constants bc_a and bc_r 

 4. 2001-02-23: Corrected bug in outputting model boundaries to standard
 output in 
 routine get_econst

 5. 2001-04-26: Added option for updating velocities to only use 
 shear stress if material is non-fluid, this appears to reduce dispersion at 
 near grazing angles for fluid-solid boundary. Set tsw=1 to invoke

 6. 2001-05-14: Changed loop in free-surface boundary condition for velocties
 Thanks goes to Mike Holzrichter for pointing out this problem and the wrong
 scaling factor in the updating.

 7. 2001-05-16: Changed set_layers function to avoid negative indexing.
 Thanks goes to Mike Holzrichter for pointing out this problem

 8. 2001-05-17: Modified make_seis to take into account VSP geometry
 correctly and not store unnecessary data.

 9. 2001-08-21: Fixed set_layers so mode fills properly in depth. Earlier
 versions were accessing incorrect array locations at last defined depth.

 10. 2003-04-21: Fixed boundary conditions.

 11. 2003-05-02: Extended the model area by half the grid spacing on the RHS.
 This makes the model area symmetric allowing a plane wave source to be
 introduced into the model (stype=pw). The w, txx and tzz grids contain now
 one more column than the u and txz grids.

 12. 2003-05-02: Added routines to allow plane waves to be introduced at a 
 specified angle (sang) into the model with functions add_pw_source_V and
 add_pw_source_S.

 13. 15 Oct 2005 -- tossed all the model building stuff. Read models
	from binary files made by  unif2aniso (CWP:John Stockwell)

 14. 25 Feb 2008 -- Fixed attenutation option (qsw=1) so that Q values are
	from binary files made by makevel or similar program

 15. 1 April 2010 -- Changed free surface velocity BC back to original.
	Someone had changed the scaling factor from 2.0 to 0.5 in fs4v_bc_top

 Algorithm based on Juhlin (1995, Geophys. Prosp.)
	and Levander (1988, Geophysics)
 Attenuation included as in Graves (1996, BSSA)

CHANGES and their DATES

sub Step

collects switches and assembles bash instructions by adding the program name

suea2df reads anisotropy files locally wherever the executable is run

sub note

collects switches and assembles bash instructions by adding the program name

sub clear

sub aniso

sub asw

sub bc

sub bc_a

sub bc_r

sub c11file

sub c13file

sub c15file

sub c33file

sub c35file

sub c55file

sub dt

sub dx

sub dz

sub favg

sub ft

sub fx

sub fz

sub hsfile

sub hsz

sub lt

sub mode

sub nx

sub nz

sub qfile

sub qsw

sub rho

sub rhofile

sub sang

sub snaptime

sub snfile

sub sofile

sub stype

sub sx

sub sz

sub ts

sub tsw

sub verbose

sub vrslfile

sub vsx

sub wtype

sub get_max_index

max index = number of input variables -1