#
# History file 'kis-pfa.h' for computation of S-wave travel times and
# synthetic seismograms in model KIS using the prevailing-frequency
# approximation of the coupling-ray theory.
# Comparing synthetic seismograms calculated by program CRTPFA
# with synthetic seismograms calculated by program GREEN.
# Calculating coupling-ray-theory travel times of S1 and S2 waves
# and their differences.

# Input files required
# ~~~~~~~~~~~~~~~~~~~~
  chk.pl: "data/qi/" "kis-mod.dat"
  chk.pl: "data/qi/" "qi-src.dat"
  chk.pl: "data/qi/" "qi-rec0.dat"
  chk.pl: "data/qi/" "kis-crt.dat"
  chk.pl: "data/qi/" "kis-rpaa.dat"
  chk.pl: "data/qi/" "force.dat"
  chk.pl: "crt/"     "writall.dat"

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

# 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.002000  NFFT=2048
  OF=       NF=        DF=

# Coupling ray theory synthetic seismograms along two-point rays,
# anisotropic common ray,
# second-order perturbations of travel time,
# prevailing-frequency approximation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  SRC='qi-src.dat'      REC='qi-rec0.dat'     SOURCE='force.dat'
  DCRT='kis-crt.dat'    CODE='kis-crt.dat'    WRIT='writall.dat'
  INIPAR=3
  MODEL='kis-mod.dat' CRTANI=1  RPAR='kis-rpaa.dat' CRTLOG='kis-crta.out'
  QIRAY=1
  CRTSCRO='SWR'
  crt:
#  RPPLOT='g.ps'
#  rpplot:
  SS='kis-sscf.gse'
  SINGLF=50.
  green:
  greenss:
  ss:
  SP1='kis-ss1f.ps'  SP2='kis-ss2f.ps'  SP3='kis-ss3f.ps'
  sp:
  QIRAY=
# Coupling ray theory along all successful rays
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CRTOUT='crtout.tmp'  CRTNEW='crtnew.tmp'
  echo.pl: "'r01.out'     's01.out'     'r01i.out'     't01.out'    / " "> crtout.tmp"
  echo.pl: "'r01-pfa.out' 's01-pfa.out' 'r01i-pfa.out' 't01.out'    / " "> crtnew.tmp"
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
# Green function from the quantities already computed along two-point rays
  CRTOUT='crtnew.tmp'  MODEL=' '
  echo.pl: "'r01-pfa.out' 's01-pfa.out' 'r01i-pfa.out' 't01-ok.out' / " "> crtnew.tmp"
  SS='kis-sscp.gse'
  green:
  greenss:
  ss:
  SP1='kis-ss1p.ps'  SP2='kis-ss2p.ps'  SP3='kis-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='kis-sscf.gse' SRC=   REC=
  SS1='kis-sscp.gse'
  SP1='kis-s1fp.ps'  SP2='kis-s2fp.ps'  SP3='kis-s3fp.ps'
  sp:
# Green function by interpolation within ray tubes
  PTS='qi-rec0.dat'  MTTPTS='mtt.out'
  COLUMN01=X1  COLUMN02=X2  COLUMN03=X3  COLUMN04=MX4  COLUMN05=MX5
  COLUMN06=MX6  COLUMN07=MTT  COLUMN08=MTI  COLUMN09=MP1  COLUMN10=MP2
  COLUMN11=MP3  COLUMN12=MP4  COLUMN13=MP5  COLUMN14=MP6  COLUMN15=AMPR11
  COLUMN16=AMPI11  COLUMN17=AMPR21  COLUMN18=AMPI21  COLUMN19=AMPR31
  COLUMN20=AMPI31  COLUMN21=AMPR12  COLUMN22=AMPI12  COLUMN23=AMPR22
  COLUMN24=AMPI22  COLUMN25=AMPR32  COLUMN26=AMPI32  COLUMN27=AMPR13
  COLUMN28=AMPI13  COLUMN29=AMPR23  COLUMN30=AMPI23  COLUMN31=AMPR33
  COLUMN32=AMPI33
  mtt:
#  porovnej:
  PTS=               MTTPTS=

# Coupling ray theory along all rays
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CRTOUT='crtout.tmp'  CRTNEW='crtnew.tmp'
  echo.pl: "'r01.out'     ' '           'r01i.out'     't01.out'    / " "> crtout.tmp"
  echo.pl: "'r01-pfa.out' ' '           'r01i-pfa.out' 't01.out'    / " "> crtnew.tmp"
  MODEL='kis-mod.dat'
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
  CRTOUT='crtnew.tmp'  MODEL=' '
#  echo.pl: "'r01-pfa.out' ' '           'r01i-pfa.out' 't01-ko.out' / " "> crtnew.tmp"
#  RPPLOT='gnew-ko.ps'
#  rpplot:
#  echo.pl: "'r01-pfa.out' ' '           'r01i-pfa.out' 't01-ok.out' / " "> crtnew.tmp"
#  RPPLOT='gnew-ok.ps'
#  rpplot:
# Interpolation of coupling-ray-theory travel times within ray cells
  echo.pl: "'r01-pfa.out' ' '           'r01i-pfa.out' 't01-ok.out' / " "> crtnew.tmp"
  O1=50    O2=50  O3=0
  D1=0.001 D2=    D3=0.001
  N1=1001  N2=1   N3=601
  mtt:
# Plotting numbers of arrivals at the gridpoints
  VPLUS=2  CREF=0.166667  YSIGN=-1
  GRD='mtt-num.out' PS='kis-num.ps'
  grdps:
# Plotting travel times at the gridpoints, sorted according to their value
  VPLUS=   VCIRC=   VREF=0  CREF=0.166667 VSIGN=1.2
  NUM='mtt-num.out' MGRD='mtt-tt.out' GRD='kis-t00.out'
  mgrd:
  GRD='kis-t00.out' PS='kis-t01.ps'
  grdps:
  N4=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='kis-t01.out'
  mgrd:
  echo.pl: "DIF=$1-$2 " "> reldife.cal"
  echo.pl: "SUM=$1+$2 " ">>reldife.cal"
  echo.pl: "$3=DIF/SUM" ">>reldife.cal"
  CAL='reldife.cal' GRD1='kis-t02.out' GRD2='kis-t01.out' GRD3='kis-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS=  VCIRC=0.021 VREF=0  CREF=0.166667  VSIGN=
  GRD='kis-tdif.out'  PS='kis-tdif.ps'
  grdps:

# List of the output files
# ~~~~~~~~~~~~~~~~~~~~~~~~
# 'kis-ss1?.ps','kis-ss2?.ps','kis-ss3?.ps' ... Synthetic seismograms
#       where ? identifies the calculation
#             f ... prevailing-frequency approximation of the coupling ray
#                   theory, the S1 and S2 Green tensors are calculated by
#                   program GREEN considering anisotropic model along the
#                   reference common anisotropic S-wave rays
#             p ... prevailing-frequency approximation of the coupling ray
#                   theory, the S1 and S2 Green tensors are calculated using
#                   program CRTPFA along the two-point rays and then program
#                   GREEN
# 'kis-s1fp.ps','kis-s2fp.ps','kis-s3fp.ps' ... Comparison of the seismograms.
#       Colors of seismograms are
#         Black - Seismograms calculated by GREEN
#         Red - Seismograms calculated by CRTPFA and GREEN
# 'kis-t01.ps','kis-t02.ps','kis-tdif.ps' ... Interpolated travel times
#       of the S1 and S2 waves and travel-time differences.
#       Figures used in Klimes & Bulant (2013):
#       Interpolation of the coupling-ray-theory S-wave Green tensor
#       within ray cells.
#       In: Seismic Waves in Complex 3-D Structures, Report 23,
#       Dep. Geophys., Charles Univ., Prague, pp. 203-218, fig. 5,
#       online at "http://sw3d.cz".
#