# Ray tracing in a smoothed Marmousi model for a given point source
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This history file calculates the gridded values corresponding to
# the point source specified in file 'mar-src.out', and appends them
# to files 'mar-ntt.out', 'mar-gb1.out', 'mar-gb2.out', 'mar-gb3.out'.
# This history file is designed to be run from another history file
# (see e.g. 'mar-test.h'), which runs 'srp.for' to generate source
# coordinates 'mar-src.out' and then executes this history file
# for the source.

# Data required
  chk.pl: "data/mar/" "mar-mod.dat"
  chk.pl: "data/mar/" "mar-crt.dat"
  chk.pl: "crt/"      "codep.dat"
  chk.pl: "crt/"      "writall.dat"
  chk.pl: "data/mar/" "mar-pic.dat"
  chk.pl: ""          "mar-src.out"

# Grid for interpolation within ray cells
  N1=60  N2=184  D1=50  D2=50  O1=25  O2=25

# Ray tracing
  MODEL='mar-mod.dat'  # Model
  SRC='mar-src.out'    # File with the coordinates of the initial point
  REC=' '              # No receivers in this example
  DCRT='mar-crt.dat'   # Numerical parameters for complete ray tracing
  CODE='codep.dat'     # Ray codes (direct P wave)
  INIPAR=2             # Geographic-like spherical ray parameters
  RPAR='mar-crt.dat'   # Ray-parameter domain and control
  WRIT='writall.dat'   # Names and extent of output files with rays
  CRTLOG='mar-log.out' # Output log file of ray tracing
  crt:                 # Running program crt.for with the above data

# Interpolation between rays (accumulating numbers of arrivals in
# file 'mar-ntt.out' and widths of Gaussian beams in 'mar-gb1.out')
  GBE11=0  GBE21=0  GBE31=1  # Reference plane for the shape of GB
  MTT=' '  GBW2='mar-gbw.out'  # No travel times, file with GB width
  N4NEW=1  GNORM=999  # data for 'grdnorm.for' to compute maximum
  GBY22=0.050E-6  GBR22=-.000E-6  NUM='mar-num.out'
  mtt:
# Appending the number of arrivals to file 'mar-ntt.out'
  append.pl: "mar-ntt.out" "mar-num.out"
# Calculating maximum width of Gaussian beams over arrivals
  MGRD='mar-gbw.out' GRD='mar-gbw.tmp'
  mgrd:
  GRDNEW='mar-gbm.out'
  grdnorm:
# Appending maximum width of Gaussian beams to file 'mar-gb1.out'
  append.pl: "mar-gb1.out" "mar-gbm.out"

# Calculating maximum width of Gaussian beams (file 'mar-gb2.out')
  GBY22=0.250E-6  GBR22=-.000E-6  NUM=' '
  mtt:
  NUM='mar-num.out' MGRD='mar-gbw.out' GRD='mar-gbw.tmp' /
  mgrd:
  GRDNEW='mar-gbm.out'
  grdnorm:
  append.pl: "mar-gb2.out" "mar-gbm.out"

# Calculating maximum width of Gaussian beams (file 'mar-gb3.out')
  GBY22=0.250E-6  GBR22=-.400E-6  NUM=' '
  mtt:
  NUM='mar-num.out' MGRD='mar-gbw.out' GRD='mar-gbw.tmp'
  mgrd:
  GRDNEW='mar-gbm.out'
  grdnorm:
  append.pl: "mar-gb3.out" "mar-gbm.out"

# Similarly for files 'mar-gb4.out', 'mar-gb5.out', 'mar-gb6.out', ...,
# corresponding other initial conditions for Gaussian beams.

# Plotting rays (disabled by # in the basic version)
  LIN='mar-bnd.out'  # Filename for the edges of the model box
 #bndlin:
  NQ=3 KALL=1 RAYS='mar-rayt.out'
 #crtray:
  PICDAT='mar-pic.dat'  PICTURE='mar-ray.ps'  # Filenames to plot rays
 #pictures:

# Important output files
# ~~~~~~~~~~~~~~~~~~~~~~
# 'mar-ntt.out'... Gridded numbers of arrivals for all sources
# 'mar-gb*.out'... Maximum widths of Gaussian beams for all sources
# 'mar-rayt.out'.. Rays (disabled by # in the basic version)
# 'mar-ray.ps'...  Plot of rays (disabled by # in the basic version)

