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

# 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/" "anrayqi2.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/" "qi2-gr12.dat"
# GSE files for FORT - results of "data/qi/fort/fort2gse.h"
  chk.pl: ""         "qi2-x-fo.gse"
  chk.pl: ""         "qi2-y-fo.gse"
  chk.pl: ""         "qi2-z-fo.gse"
# GSE files for FM - results of "data/qi/fm/fm2gse.h"
  chk.pl: ""         "qi2-x-fm.gse"
  chk.pl: ""         "qi2-y-fm.gse"
  chk.pl: ""         "qi2-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:   'anrayqi2.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='qi2-ss3a.gse'
  anraygse:
  SP1=' '           SP2=' '           SP3='qi2-ss3a.ps'
  sp:

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

# Radial component
  fresan:  'fresan.anr' 1* 'lu2.out' 'lu7.out' ' ' /
  synfan:  'synfan.an'  1* 'lu7.out' 'lu8.out' /
  SS='qi2-ss1a.gse'
  anraygse:
  SP1='qi2-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='qi2-ssi.gse'
  green:
  greenss:
  ss:
  SP1='qi2-ss1i.ps'  SP2='qi2-ss2i.ps'  SP3='qi2-ss3i.ps'
  sp:

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

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

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

# Broad-band synthetic seismograms
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  SIGW=1.
  FMIN=0.0  FLOW=5.0  FHIGH=200. FMAX=250.  # (cosine filter)
# Coupling ray theory synthetic seismograms - anisotropic common ray,
# second-order perturbations of travel time
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='qi-mod2.dat' CRTANI=1  RPAR='qi-rpaa.dat' CRTLOG='qi-crba.out'
  QIRAY=1
  SS='qi2-bscs.gse'
  crt:
  green:
  greenss:
  ss:
  SP1='qi2-bs1s.ps'  SP2='qi2-bs2s.ps'  SP3='qi2-bs3s.ps'
  sp:
# Prevailing-frequency approximation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CRTLOG='qi-crbaf.out'
  SS='qi2-bscf.gse'
  crt:
  SINGLF=50.
  green:
  SINGLF=
  greenss:
  ss:
  SP1='qi2-bs1f.ps'  SP2='qi2-bs2f.ps'  SP3='qi2-bs3f.ps'
  sp:

# Coupling, isotropic and anisotropic seismograms in a single plot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  SS='qi2-ssc.gse'   SRC=   REC=
#  SS2='qi2-ssi.gse'
#  SS1='qi2-ss1a.gse' SP1='qi2-ss1.ps'  SP2=' '           SP3=' '
#  sp:
#  SS1='qi2-ss2a.gse' SP1=' '           SP2='qi2-ss2.ps'  SP3=' '
#  sp:
#  SS1='qi2-ss3a.gse' SP1=' '           SP2=' '           SP3='qi2-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='qi2-ssc.gse'   SRC=   REC=
  SS1='qi2-x-fo.gse'
  SS2='qi2-sscs.gse'
  SS3='qi2-x-fm.gse' SPAMP3=100000000000000.
  SP1='qi2-ss1.ps'   SP2=' '            SP3=' '
  sp:
  SS1='qi2-y-fo.gse'
  SS3='qi2-y-fm.gse'
  SP1=' '            SP2='qi2-ss2.ps'   SP3=' '
  sp:
  SS1='qi2-z-fo.gse'
  SS3='qi2-z-fm.gse'
  SP1=' '            SP2='           '  SP3='qi2-ss3.ps'
  sp:
  KOLOR= KOLOR1= KOLOR2= KOLOR3=
  SS=    SS1=    SS2=    SS3=
  SPAMP= SPAMP1= SPAMP2= SPAMP3=

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

  COEF1= COEF2=
  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='qi2-sscf.gse'  # prevailing-frequency approximation
  SS1='qi2-sscs.gse' # coupling ray theory
  SS2='qi2-x-fm.gse' SPAMP2=100000000000000.     # FM
  SP1='qi2-sf1.ps'   SP2=' '            SP3=' '
  sp:
  SS2='qi2-y-fm.gse'
  SP1=' '            SP2='qi2-sf2.ps'   SP3=' '
  sp:
  SS2='qi2-z-fm.gse'
  SP1=' '            SP2='           '  SP3='qi2-sf3.ps'
  sp:
  KOLOR= KOLOR1= KOLOR2= KOLOR3=
  SS=    SS1=    SS2=    SS3=
  SPAMP= SPAMP1= SPAMP2= SPAMP3=

# Broad-band coupling ray theory plus prevailing-frequency approximation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  KOLOR=2 red   KOLOR1=1 black   KOLOR2=
  SS='qi2-bscf.gse'  # prevailing-frequency approximation
  SS1='qi2-bscs.gse' # coupling ray theory
  SP1='qi2-sfb1.ps'   SP2='qi2-sfb2.ps'   SP3='qi2-sfb3.ps'
  sp:

# List of the output files
# ~~~~~~~~~~~~~~~~~~~~~~~~
# 'qi2-ss1?.ps','qi2-ss2?.ps','qi2-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
# 'qi2-bs1?.ps','qi2-bs2?.ps','qi2-bs3?.ps' ... Broad-band synthetic
#       seismograms, where ? identifies the calculation
#             s ... coupling ray theory along anisotropic common ray
#                   with second-order travel time perturbation
#             f ... prevailing-frequency approximtion of the coupling ray
#                   theory
# 'qi2-ca-1.ps','qi2-ca-2.ps','qi2-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. 2.
# 'qi2-12-1.ps','qi2-12-2.ps','qi2-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. 3.
# 'qi2-sf1.ps','qi2-sf2.ps','qi2-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
# 'qi2-ss1.ps','qi2-ss2.ps','qi2-ss3.ps' ... Coupling ray theory
#       seismograms compared with FORT and with FM.
# 'qi2-sd1.ps','qi2-sd2.ps','qi2-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
# 'qi2-sf1.ps','qi2-sf2.ps','qi2-sf3.ps' ... Prevailing-frequency
#       approximation seismograms compared with standard coupling ray
#       theory for the broad-band signal.
# 'qi2-bsd1.ps','qi2-bsd2.ps','qi2-bsd3.ps' ... Differences of the coupling
#       ray theory and prevailing-frequency approximation seismograms for
#       the broad-band signal.
#