#
# History file 'qi4-ss.h' for computation of anisotropic, isotropic, and
# coupling-ray theory S-wave synthetic seismograms in model QI4.

# Executables required
# ~~~~~~~~~~~~~~~~~~~~
# This history file requires programs FRESAN, SYNFAN and ANRAYGSE
# of package ANRAY, and modified version of program ANRAY, please link
# program 'anray_44.for' located in directory 'data/qi'.

# Input files required
# ~~~~~~~~~~~~~~~~~~~~
  chk.pl: "data/qi/" "anrayqi4.qi"
  chk.pl: "data/qi/" "fresan.anv"
  chk.pl: "data/qi/" "fresan.ant"
  chk.pl: "data/qi/" "fresan.anr"
  chk.pl: "data/qi/" "synfan.an"
  chk.pl: "data/qi/" "qi-mod4.dat"
  chk.pl: "data/qi/" "qi-src.dat"
  chk.pl: "data/qi/" "qi-rec0.dat"
  chk.pl: "data/qi/" "qi-crt.dat"
  chk.pl: "data/qi/" "qi-rpa.dat"
  chk.pl: "data/qi/" "qi-rpaa.dat"
  chk.pl: "data/qi/" "force.dat"
  chk.pl: "crt/"     "writ.dat"
# edited Green function combined from S1 and S2 rays
  chk.pl: "data/qi/" "qi4-gr12.dat"
# GSE files for FORT - results of "data/qi/fort/fort2gse.h"
  chk.pl: ""         "qi4-x-fo.gse"
  chk.pl: ""         "qi4-y-fo.gse"
  chk.pl: ""         "qi4-z-fo.gse"
# GSE files for FM - results of "data/qi/fm/fm2gse.h"
  chk.pl: ""         "qi4-x-fm.gse"
  chk.pl: ""         "qi4-y-fm.gse"
  chk.pl: ""         "qi4-z-fm.gse"

# Data to control seismogram plotting (program SP)
  KODESP=3     SPCHRH=0.25
  SPTMIN=0.40  SPTMAX=0.55  SPTLEN=6.0   SPTDIV=3   SPTSUB=5
  SPXMIN=0.0   SPXMAX=0.60  SPXLEN=15.0  SPXDIV=6   SPXSUB=5
  SPTTEXT='Time (s)'  SPXTEXT='Depth (km)'          SPTDEC=2
  NORMSP=1     SPAMP=1.
  CALCOPS='0.50 setlinewidth'
  GSEWIDTH=8 (writing GSE files in greenss.for)

# Anisotropic ray theory synthetic seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  anray_44:   'anrayqi4.qi' 1* 'lu1.out' 'lu2.out' /

# Vertical component
  fresan:  'fresan.anv' 1* 'lu2.out' 'lu7.out' ' ' /
  synfan:  'synfan.an'  1* 'lu7.out' 'lu8.out' /
  LU8='lu8.out'
  SS='qi4-ss3a.gse'
  anraygse:
  SP1=' '           SP2=' '           SP3='qi4-ss3a.ps'
  sp:

# Transverse component
  fresan:  'fresan.ant' 1* 'lu2.out' 'lu7.out' ' ' /
  synfan:  'synfan.an'  1* 'lu7.out' 'lu8.out' /
  SS='qi4-ss2a.gse'
  anraygse:
  SP1=' '           SP2='qi4-ss2a.ps' SP3=' '
  sp:

# Radial component
  fresan:  'fresan.anr' 1* 'lu2.out' 'lu7.out' ' ' /
  synfan:  'synfan.an'  1* 'lu7.out' 'lu8.out' /
  SS='qi4-ss1a.gse'
  anraygse:
  SP1='qi4-ss1a.ps' SP2=' '           SP3=' '
  sp:

# Isotropic ray theory synthetic seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  SRC='qi-src.dat'      REC='qi-rec0.dat'      SOURCE='force.dat'
  DCRT='qi-crt.dat'     CODE='qi-crt.dat'     WRIT='writ.dat'
  INIPAR=3

# Data describing the source time function
  KSIG=1 # (Gabor signal)
  SIGT=0.  SIGF=50.  SIGW=4.  SIGPH=0.  SIGA=100.

# Data describing the filtration of the source time function
  FMIN=0.0  FLOW=5.0  FHIGH=60.  FMAX=100.  # (cosine filter)

# Time and frequency step and interval for the Fast Fourier Transform
  DT=0.000250  NFFT=2048
# OF=0.0    NF=101
# DF=1.000576332
  OF=       NF=        DF=

# Ray tracing and synthetic seismograms
  MODEL='qi-mod4.dat' CRTANI=0  RPAR='qi-rpa.dat'  CRTLOG='qi-crt.out'
  crt:
  MODEL=' '  GREEN='green.out'  SS='qi4-ssi.gse'
  green:
  greenss:
  ss:
  SP1='qi4-ss1i.ps'  SP2='qi4-ss2i.ps'  SP3='qi4-ss3i.ps'
  sp:

# Coupling ray theory synthetic seismograms - anisotropic common ray
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='qi-mod4.dat' CRTANI=1  RPAR='qi-rpaa.dat'  CRTLOG='qi-crta.out'
  SS='qi4-ssc.gse'
  crt:
  green:
  greenss:
  ss:
  SP1='qi4-ss1c.ps'  SP2='qi4-ss2c.ps'  SP3='qi4-ss3c.ps'
  sp:

# Coupling ray theory synthetic seismograms - anisotropic common ray,
  second-order perturbations of travel time
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='qi-mod4.dat' CRTANI=1  RPAR='qi-rpaa.dat'  CRTLOG='qi-crta.out'
  QIRAY=1
  SS='qi4-sscs.gse'
  crt:
  green:
  greenss:
  ss:
  SP1='qi4-ss1s.ps'  SP2='qi4-ss2s.ps'  SP3='qi4-ss3s.ps'
  sp:
# Prevailing-frequency approximation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CRTLOG='qi-crtaf.out'
  SS='qi4-sscf.gse'
  crt:
  SINGLF=50.
  green:
  SINGLF=
  greenss:
  ss:
  SP1='qi4-ss1f.ps'  SP2='qi4-ss2f.ps'  SP3='qi4-ss3f.ps'
  sp:
  KOLOR=2 (red) KOLOR1=1 (black)
  SPAMP1=100000000000000.
  SP1='qi4-ca-1.ps'  SS1='qi4-x-fm.gse'  SP2=' '  SP3=' '  sp:
  SP2='qi4-ca-2.ps'  SS1='qi4-y-fm.gse'  SP1=' '  SP3=' '  sp:
  SP3='qi4-ca-3.ps'  SS1='qi4-z-fm.gse'  SP1=' '  SP2=' '  sp:
  SPAMP1=
  KOLOR= KOLOR1=
  SS= SS1=

# Coupling ray theory synthetic seismograms - two anisotropic rays,
# prevailing-frequency approximation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='qi-mod4.dat' CRTANI=1  RPAR='qi-rpaa.dat'
  QIRAY=
  KSWAVE=1
  SS=                 CRTLOG='qi-crts1.out'
  crt:
  SINGLF=50.
  GREEN='qi4-gr01.out'
  green:
  SINGLF=
  KSWAVE=2
  SS=                 CRTLOG='qi-crts2.out'
  crt:
  SINGLF=50.
  GREEN='qi4-gr02.out'
  green:
  SINGLF=
# Green functions 'qi4-gr01.out' and 'qi4-gr02.out' should be manually
# edited into file 'qi4-gr12.dat'
  SS='qi4-sf12.gse'
  GREEN='qi4-gr12.dat'
  greenss:
  ss:
  GREEN=
  KSWAVE=
  KOLOR=2 (red) KOLOR1=1 (black)
  SPAMP1=100000000000000.
  SP1='qi4-12-1.ps'  SS1='qi4-x-fm.gse'  SP2=' '  SP3=' '  sp:
  SP2='qi4-12-2.ps'  SS1='qi4-y-fm.gse'  SP1=' '  SP3=' '  sp:
  SP3='qi4-12-3.ps'  SS1='qi4-z-fm.gse'  SP1=' '  SP2=' '  sp:
  SPAMP1=
  KOLOR= KOLOR1=
  SS= SS1=

# Coupling, isotropic and anisotropic seismograms in a single plot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  SS='qi4-ssc.gse'   SRC=   REC=
#  SS2='qi4-ssi.gse'
#  SS1='qi4-ss1a.gse' SP1='qi4-ss1.ps'  SP2=' '           SP3=' '
#  sp:
#  SS1='qi4-ss2a.gse' SP1=' '           SP2='qi4-ss2.ps'  SP3=' '
#  sp:
#  SS1='qi4-ss3a.gse' SP1=' '           SP2=' '           SP3='qi4-ss3.ps'
#  sp:

# FM plus FORT plus both coupling ray theory seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  KOLOR=3 (green) KOLOR1=2 (red)    KOLOR2=4 (blue)    KOLOR3=1 (black)
  SS='qi4-ssc.gse'   SRC=   REC=
  SS1='qi4-x-fo.gse'
  SS2='qi4-sscs.gse'
  SS3='qi4-x-fm.gse' SPAMP3=100000000000000.
  SP1='qi4-ss1.ps'   SP2=' '            SP3=' '
  sp:
  SS1='qi4-y-fo.gse'
  SS3='qi4-y-fm.gse'
  SP1=' '            SP2='qi4-ss2.ps'   SP3=' '
  sp:
  SS1='qi4-z-fo.gse'
  SS3='qi4-z-fm.gse'
  SP1=' '            SP2=' '            SP3='qi4-ss3.ps'
  sp:
  KOLOR= KOLOR1= KOLOR2= KOLOR3=
  SS=    SS1=    SS2=    SS3=
  SPAMP= SPAMP1= SPAMP2= SPAMP3=

# Subtracting the seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DT=0.
  SS1='qi4-x-fm.gse' COEF1=-100000000000000.
  SS2='qi4-x-fo.gse' COEF2=1.
  SS='qi4-fo1.gse'
  gsecal:
  SS1='qi4-y-fm.gse'  SS2='qi4-y-fo.gse'  SS='qi4-fo2.gse'   gsecal:
  SS1='qi4-z-fm.gse'  SS2='qi4-z-fo.gse'  SS='qi4-fo3.gse'   gsecal:
  SS1='qi4-x-fm.gse'  SS2='qi4-ssc.gse'   SS='qi4-cr1.gse'   gsecal:
  SS1='qi4-y-fm.gse'  SS2='qi4-ssc.gse'   SS='qi4-cr2.gse'   gsecal:
  SS1='qi4-z-fm.gse'  SS2='qi4-ssc.gse'   SS='qi4-cr3.gse'   gsecal:
  SS1='qi4-x-fm.gse'  SS2='qi4-sscs.gse'  SS='qi4-crs1.gse'  gsecal:
  SS1='qi4-y-fm.gse'  SS2='qi4-sscs.gse'  SS='qi4-crs2.gse'  gsecal:
  SS1='qi4-z-fm.gse'  SS2='qi4-sscs.gse'  SS='qi4-crs3.gse'  gsecal:
  SPAMP=2.
  KOLOR=3 (green) KOLOR1=2 (red)    KOLOR2=4 (blue)    KOLOR3=
  SS='qi4-cr1.gse'
  SS1='qi4-fo1.gse'
  SS2='qi4-crs1.gse'
  SP1='qi4-sd1.ps'   SP2=' '            SP3=' '
  sp:
  SS='qi4-cr2.gse'
  SS1='qi4-fo2.gse'
  SS2='qi4-crs2.gse'
  SP1=' '            SP2='qi4-sd2.ps'   SP3=' '
  sp:
  SS='qi4-cr3.gse'
  SS1='qi4-fo3.gse'
  SS2='qi4-crs3.gse'
  SP1=' '            SP2=' '            SP3='qi4-sd3.ps'
  sp:
  KOLOR= KOLOR1= KOLOR2= KOLOR3=
  SS=    SS1=    SS2=    SS3=
  SPAMP= SPAMP1= SPAMP2= SPAMP3=

# FM plus coupling ray theory plus prevailing-frequency approximation
# seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  KOLOR=2 red   KOLOR1=3 green   KOLOR2=1 black
  SS='qi4-sscf.gse'  # prevailing-frequency approximation
  SS1='qi4-sscs.gse' # coupling ray theory
  SS2='qi4-x-fm.gse' SPAMP2=100000000000000.     # FM
  SP1='qi4-sf1.ps'   SP2=' '            SP3=' '
  sp:
  SS2='qi4-y-fm.gse'
  SP1=' '            SP2='qi4-sf2.ps'   SP3=' '
  sp:
  SS2='qi4-z-fm.gse'
  SP1=' '            SP2='           '  SP3='qi4-sf3.ps'
  sp:

# List of the output files
# ~~~~~~~~~~~~~~~~~~~~~~~~
# 'qi4-ss1?.ps','qi4-ss2?.ps','qi4-ss3?.ps' ... Synthetic seismograms
#       where ? identifies the calculation
#             a ... anisotropic ray theory
#             i ... isotropic ray theory
#             c ... coupling ray theory along anisotropic common ray
#             s ... coupling ray theory along anisotropic common ray
#                   with second-order travel time perturbation
#             f ... prevailing-frequency approximtion of the coupling
#                   ray theory
# 'qi4-ca-1.ps','qi4-ca-2.ps','qi4-ca-3.ps' ... Prevailing-frequency
#       approximation seismograms calculated along the common anisotropic
#       rays with second-order travel time perturbation (red) compared
#       with FM (black).
#       Figures used in Klimes & Bulant (2014): 
#       Prevailing-frequency approximation of the coupling ray theory
#       for S waves along the SH and SV reference rays in a transversely
#       isotropic medium, Seismic Waves in Complex 3-D Structures,
#       24, 165-177, fig. 4.
# 'qi4-12-1.ps','qi4-12-2.ps','qi4-12-3.ps' ... Prevailing-frequency
#       approximation seismograms calculated along S1 and S2
#       anisotropic-ray-theory rays (red) compared with FM (black).
#       Figures used in Klimes & Bulant (2014): 
#       Prevailing-frequency approximation of the coupling ray theory
#       for S waves along the SH and SV reference rays in a transversely
#       isotropic medium, Seismic Waves in Complex 3-D Structures,
#       24, 165-177, fig. 5.
# 'qi4-sf1.ps','qi4-sf2.ps','qi4-sf3.ps' ... Prevailing-frequency
#       approximation seismograms compared with standard coupling ray
#       theory and with FM.
#       Colors of seismograms are
#         Black - Fourier Method
#         Red - Prevailing-frequency approximation of the coupling ray
#               theory along anisotropic common rays
#         Green - CRT with second-order travel time perturbation
# 'qi4-ss1.ps','qi4-ss2.ps','qi4-ss3.ps' ... Coupling ray theory
#       seismograms compared with FORT and with FM.
# 'qi4-sd1.ps','qi4-sd2.ps','qi4-sd3.ps' ... Differences of the coupling
#       ray theory and FORT seismograms from FM seismograms.
#       Colors of seismograms are
#         Black - Fourier Method
#         Red - First Order Ray Tracing
#         Green - Coupling Ray Theory along anisotropic common rays
#         Blue - CRT with second-order travel time perturbation
#