#
# History file 'sc-pfa.h' for computation of S-wave travel times and
# synthetic seismograms in models SC1_I, SC1_II and ORT 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/" "sc1-mod.dat"
  chk.pl: "data/qi/" "sc1-src.dat"
  chk.pl: "data/qi/" "sc1-rec.dat"
  chk.pl: "data/qi/" "sc1-crpf.dat"
  chk.pl: "data/qi/" "sc1-rppf.dat"
  chk.pl: "data/qi/" "force.dat"
  chk.pl: "crt/"     "writall.dat"
  chk.pl: "data/qi/" "sc2-mod.dat"
  chk.pl: "data/qi/" "sc2-crpf.dat"
  chk.pl: "data/qi/" "sc2-rpaa.dat"
  chk.pl: "data/qi/" "ort-mod.dat"
  chk.pl: "data/qi/" "ort-rec.dat"
  chk.pl: "data/qi/" "ort-crpf.dat"
  chk.pl: "data/qi/" "ort-rppf.dat"

# Data to control seismogram plotting (program SP)
  KODESP=3     SPCHRH=0.25
  SPTMIN=0.35  SPTMAX=0.65  SPTLEN=6.0   SPTDIV=3   SPTSUB=10
  SPXMIN=0.00  SPXMAX=1.40  SPXLEN=15.0  SPXDIV=7   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=


# Ray tracing and synthetic seismograms - model SC1_I
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Coupling ray theory synthetic seismograms along two-point rays,
# anisotropic common ray,
# second-order perturbations of travel time,
# prevailing-frequency approximation
  MODEL='sc1-mod.dat'  CRTANI=1  RPAR='sc1-rppf.dat' CRTLOG='sc1-crta.out'
  SRC='sc1-src.dat'     REC='sc1-rec.dat'     SOURCE='force.dat'
  DCRT='sc1-crpf.dat'    CODE='sc1-crpf.dat'    WRIT='writall.dat'
  INIPAR=3
  QIRAY=1
  crt:
#  RPPLOT='g.ps'
#  rpplot:
  SS='sc1-sscf.gse'
  SINGLF=50.
  green:
  greenss:
  ss:
  QIRAY=
  SP1='sc1-ss1f.ps'  SP2='sc1-ss2f.ps'  SP3='sc1-ss3f.ps'
  sp:
# 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='sc1-sscp.gse'
  green:
  greenss:
  ss:
  SP1='sc1-ss1p.ps'  SP2='sc1-ss2p.ps'  SP3='sc1-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='sc1-sscf.gse' SRC=   REC=
  SS1='sc1-sscp.gse'
  SP1='sc1-s1fp.ps'  SP2='sc1-s2fp.ps'  SP3='sc1-s3fp.ps'
  sp:
  SS1=
# Green function by interpolation within ray tubes
  PTS='sc1-rec.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='sc1-mod.dat'
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
  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=0     O2=0   O3=0
  D1=0.002 D2=    D3=0.002
  N1=501   N2=1   N3=701
  mtt:
  CRTOUT=              CRTNEW=
# Plotting numbers of arrivals at the gridpoints
  VPLUS=2  CREF=0.166667  YSIGN=-1
  GRD='mtt-num.out' PS='sc1-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='sc1-t00.out'
  mgrd:
  GRD='sc1-t00.out' PS='sc1-t01.ps'
  grdps:
  N4=
  SINGLF=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='sc1-t01.out'
  mgrd:
  IMGRD=
  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='sc1-t02.out' GRD2='sc1-t01.out' GRD3='sc1-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS=   VCIRC=0.06 VREF=0  CREF=0.166667  VSIGN=
  GRD='sc1-tdif.out'  PS='sc1-tdif.ps'
  grdps:


# Ray tracing and synthetic seismograms - model SC1_II
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Coupling ray theory synthetic seismograms along two-point rays,
# anisotropic common ray,
# second-order perturbations of travel time,
# prevailing-frequency approximation
  MODEL='sc2-mod.dat'  CRTANI=1  RPAR='sc2-rpaa.dat' CRTLOG='sc2-crta.out'
  SRC='sc1-src.dat'    REC='sc1-rec.dat'
  DCRT='sc2-crpf.dat'  CODE='sc2-crpf.dat'
  QIRAY=1
  crt:
#  RPPLOT='g.ps'
#  rpplot:
  SS='sc2-sscf.gse'
  SINGLF=50.
  green:
  greenss:
  ss:
  QIRAY=
  SP1='sc2-ss1f.ps'  SP2='sc2-ss2f.ps'  SP3='sc2-ss3f.ps'
  sp:
# 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='sc2-sscp.gse'
  green:
  greenss:
  ss:
  SP1='sc2-ss1p.ps'  SP2='sc2-ss2p.ps'  SP3='sc2-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='sc2-sscf.gse' SRC=   REC=
  SS1='sc2-sscp.gse'
  SP1='sc2-s1fp.ps'  SP2='sc2-s2fp.ps'  SP3='sc2-s3fp.ps'
  sp:
  SS1=
# Green function by interpolation within ray tubes
  PTS='sc1-rec.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='sc2-mod.dat'
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
  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=0     O2=0   O3=0
  D1=0.002 D2=    D3=0.002
  N1=501   N2=1   N3=701
  mtt:
  CRTOUT=              CRTNEW=
# Plotting numbers of arrivals at the gridpoints
  VPLUS=2  CREF=0.166667  YSIGN=-1
  GRD='mtt-num.out' PS='sc2-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='sc2-t00.out'
  mgrd:
  GRD='sc2-t00.out' PS='sc2-t01.ps'
  grdps:
  N4=
  SINGLF=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='sc2-t01.out'
  mgrd:
  IMGRD=
  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='sc2-t02.out' GRD2='sc2-t01.out' GRD3='sc2-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS=   VCIRC=0.036 VREF=0  CREF=0.166667  VSIGN=
  GRD='sc2-tdif.out'  PS='sc2-tdif.ps'
  grdps:


# Ray tracing and synthetic seismograms - model ORT
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Coupling ray theory synthetic seismograms along two-point rays,
# anisotropic common ray,
# second-order perturbations of travel time,
# prevailing-frequency approximation
  MODEL='ort-mod.dat'  CRTANI=1  RPAR='ort-rppf.dat' CRTLOG='ort-crta.out'
  SRC='sc1-src.dat'    REC='ort-rec.dat'
  DCRT='ort-crpf.dat'  CODE='ort-crpf.dat'
  SPTMIN=0.65  SPTMAX=1.15  SPTLEN=6.0   SPTDIV=5   SPTSUB=10
  SPXMIN=0.00  SPXMAX=1.60  SPXLEN=15.0  SPXDIV=8   SPXSUB=5
  DT=0.002000  NFFT=2048
  OF=       NF=        DF=
  QIRAY=1
  crt:
#  RPPLOT='g.ps'
#  rpplot:
  SS='ort-sscf.gse'
  SINGLF=50.
  green:
  greenss:
  ss:
  QIRAY=
  SP1='ort-ss1f.ps'  SP2='ort-ss2f.ps'  SP3='ort-ss3f.ps'
  sp:
# 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='ort-sscp.gse'
  green:
  greenss:
  ss:
  SP1='ort-ss1p.ps'  SP2='ort-ss2p.ps'  SP3='ort-ss3p.ps'
  sp:
# Comparison of the seismograms
  SS='ort-sscf.gse' SRC=   REC=
  SS1='ort-sscp.gse'
  SP1='ort-s1fp.ps'  SP2='ort-s2fp.ps'  SP3='ort-s3fp.ps'
  sp:
  SS1=
# Green function by interpolation within ray tubes
  PTS='ort-rec.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='ort-mod.dat'
  crtpfa:
  FTRGL1='t01-ok.out'  FTRGL2='t01-ko.out'
  CRTOUT='crtnew.tmp'
  pfatubes:
  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=0     O2=0   O3=0
  D1=0.002 D2=    D3=0.002
  N1=501   N2=1   N3=801
  mtt:
  CRTOUT=              CRTNEW=
# Plotting numbers of arrivals at the gridpoints
  VPLUS=2  CREF=0.166667  YSIGN=-1
  GRD='mtt-num.out' PS='ort-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='ort-t00.out'
  mgrd:
  GRD='ort-t00.out' PS='ort-t01.ps'
  grdps:
  N4=
  SINGLF=
# Calculating and plotting travel-time differences between S1 and S2 waves
  IMGRD=1  GRD='ort-t01.out'
  mgrd:
  IMGRD=
  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='ort-t02.out' GRD2='ort-t01.out' GRD3='ort-tdif.out'
  grdcal:
  GRD1= GRD2= GRD3=
  VPLUS=   VCIRC=0.042 VREF=0  CREF=0.166667  VSIGN=
  GRD='ort-tdif.out'  PS='ort-tdif.ps'
  grdps:


# List of the output files
# ~~~~~~~~~~~~~~~~~~~~~~~~
# '???-ss1?.ps','???-ss2?.ps','???-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
#       and "???" identifies the model
#         sc1 ... model SC1_I
#         sc2 ... model SC1_II
#         ort ... model ORT
# '???-s1fp.ps','???-s2fp.ps','???-s3fp.ps' ... Comparison of the seismograms.
#       Colors of seismograms are
#         Black - Seismograms calculated by GREEN
#         Red - Seismograms calculated by CRTPFA and GREEN
# '???-t01.ps','???-t02.ps','???-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. 6-8,
#       online at "http://sw3d.cz".
#