#
# History file 'qi2-pfa.h' for computation of S-wave travel times and
# synthetic seismograms in model QI2 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/" "qi-mod2.dat"
  chk.pl: "data/qi/" "qi-src.dat"
  chk.pl: "data/qi/" "qi-rec0.dat"
  chk.pl: "data/qi/" "qi-crtpf.dat"
  chk.pl: "data/qi/" "qi-rpapf.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.0   SPTDIV=3   SPTSUB=5
  SPXMIN=0.0   SPXMAX=0.60  SPXLEN=15.0  SPXDIV=6   SPXSUB=5
  SPTTEXT='Time (s)'  SPXTEXT='Depth (km)'
  NORMSP=1     SPAMP=1.
  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.000250  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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='qi-mod2.dat' CRTANI=1  RPAR='qi-rpapf.dat'
  SRC='qi-src.dat'      REC='qi-rec0.dat'      SOURCE='force.dat'
  DCRT='qi-crtpf.dat'   CODE='qi-crtpf.dat'    WRIT='writall.dat'
  INIPAR=3
  QIRAY=1
  CRTLOG='qi-crtaf.out'
  SS='qi2-sscf.gse'
  crt:
  SINGLF=50.
  green:
  greenss:
  ss:
  SP1='qi2-ss1f.ps'  SP2='qi2-ss2f.ps'  SP3='qi2-ss3f.ps'
  sp:
#  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=
#  PLIM1=0.  PLIM2=1.  PLIM3=0.  PLIM4=1.
#  RPPLOT='g.ps'
#  rpplot:

# 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
  echo.pl: "'r01-pfa.out' 's01-pfa.out' 'r01i-pfa.out' 't01-ok.out' / " "> crtnew.tmp"
  CRTOUT='crtnew.tmp'  MODEL=' '
  SS='qi2-sscp.gse'
  green:
  greenss:
  ss:
  SP1='qi2-ss1p.ps'  SP2='qi2-ss2p.ps'  SP3='qi2-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='qi2-sscf.gse' SRC=   REC=
  SS1='qi2-sscp.gse'
  SP1='qi2-s1fp.ps'  SP2='qi2-s2fp.ps'  SP3='qi2-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='qi-mod2.dat'
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
#  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='qi2-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='qi2-t00.out'
  mgrd:
  GRD='qi2-t00.out' PS='qi2-t01.ps'
  grdps:
  N4=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='qi2-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='qi2-t02.out' GRD2='qi2-t01.out' GRD3='qi2-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS= VCIRC=0.042 VREF=0  CREF=0.166667  VSIGN=
  GRD='qi2-tdif.out'  PS='qi2-tdif.ps'
  grdps:

# List of the output files
# ~~~~~~~~~~~~~~~~~~~~~~~~
# 'qi2-ss1?.ps','qi2-ss2?.ps','qi2-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
# 'qi2-s1fp.ps','qi2-s2fp.ps','qi2-s3fp.ps' ... Comparison of the seismograms.
#       Colors of seismograms are
#         Black - Seismograms calculated by GREEN
#         Red - Seismograms calculated by CRTPFA and GREEN
# 'qi2-t01.ps','qi2-t02.ps','qi2-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. 3,
#       online at "http://sw3d.cz".
#