#
# History file 'qih-pfa.h' for computation of S-wave travel times and
# synthetic seismograms in model QIH 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-modh.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-modh.dat' CRTANI=1  RPAR='qi-rpapf.dat'  WRIT='writall.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='qih-sscf.gse'
  crt:
  SINGLF=50.
  green:
  greenss:
  ss:
  SP1='qih-ss1f.ps'  SP2='qih-ss2f.ps'  SP3='qih-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='qih-sscp.gse'
  green:
  greenss:
  ss:
  SP1='qih-ss1p.ps'  SP2='qih-ss2p.ps'  SP3='qih-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='qih-sscf.gse' SRC=   REC=
  SS1='qih-sscp.gse'
  SP1='qih-s1fp.ps'  SP2='qih-s2fp.ps'  SP3='qih-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-modh.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='qih-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='qih-t00.out'
  mgrd:
  GRD='qih-t00.out' PS='qih-t01.ps'
  grdps:
  N4=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='qih-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='qih-t02.out' GRD2='qih-t01.out' GRD3='qih-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS= VCIRC=0.0105 VREF=0  CREF=0.166667  VSIGN=
  GRD='qih-tdif.out'  PS='qih-tdif.ps'
  grdps:

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