# Marmousi velocity model - tests
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input files required
  chk.pl: "data/mar/" "mar-crt.h"
  chk.pl: "data/mar/" "mar-vel.dat"
  chk.pl: "data/mar/" "mar-mod.dat"
  chk.pl: "data/mar/" "mar-crt.dat"
  chk.pl: "data/mar/" "mar-srp.dat"
  chk.pl: "data/mar/" "mar-pic.dat"
  chk.pl: "data/mar/" "mar-ple.dat"
  chk.pl: "crt/"      "codep.dat"
  chk.pl: "crt/"      "writall.dat"
  chk.pl: "data/mar/" "sob22-2d.cal"
  chk.pl: "forms/"    "inv.cal"
  chk.pl: "forms/"    "sub.cal"
  chk.pl: "forms/"    "div.cal"
  chk.pl: "forms/"    "copy.pl"
  chk.pl: "forms/"    "append.pl"
  chk.pl: "forms/"    "echo.pl"

# Updated model
  MODEL='mar-mod.dat'

# Tests of model
# ~~~~~~~~~~~~~~
# Coarse grid (intervals 40m*80m)
  N1=76  N2=116  D1=40  D2=80  O1=0  O2=0  HSIZE=7.60  VSIZE=23.20
  CAL='inv.cal' GRD1='mar-vel.dat' GRD2='mar-u0.out'
  grdcal:

# Optional denser grid (requires 'slowness.out' produced by 'mar-vel.h')
# N1=751  N2=2301  D1=4  D2=4  O1=0  O2=0
# N1NEW=376  N2NEW=576  D1NEW=8  D2NEW=16  O1NEW=0  O2NEW=0  GNORM=1
# GRD='slowness.out' GRDNEW='mar-u0.out'
# grdnorm:
# N1=376  N2=576  D1=8  D2=16  O1=0  O2=0  HSIZE=7.52  VSIZE=23.04

# Calculating gridded slowness, its standard deviation, and Sobolev norm
  MPAR=1  ICB=' '  VEL='vel.out'  VEL1='vel1.out'  VEL2='vel2.out'
  VEL11='vel11.out'  VEL12='vel12.out'  VEL22='vel22.out'
  grid:
  CAL='inv.cal'  GRD1='vel.out'  GRD2='mar-u.out'
  grdcal:
  CAL='sub.cal'  GRD1='mar-u.out'  GRD2='mar-u0.out'  GRD3='mar-ud.out'
  grdcal:
  CAL='div.cal'  GRD1='mar-ud.out'  GRD2='mar-u0.out'  GRD3='mar-ur.out'
  grdcal:
  CAL='sob22-2d.cal'  GRD1='vel.out'  GRD2='vel1.out'  GRD3='vel2.out'
  GRD4='vel11.out'  GRD5='vel12.out'  GRD6='vel22.out'  GRD7='sob.out'
  grdcal:
  GRD1=  GRD2=  GRD3=  GRD4=  GRD5=  GRD6=  GRD7=
  N1NEW=1  N2NEW=1  GNORM=2
  GRD='mar-ud.out'  GRDNEW='mar-ud2.out'
  grdnorm:
  GRD='mar-ur.out'  GRDNEW='mar-ur2.out'
  grdnorm:
  GRD='sob.out'     GRDNEW='mar-un2.out'
  grdnorm:

# Plotting gridded slowness
  VCIRC=.000581818  VREF=.000666667  CREF=0.666667  # 1/1500 blue,
# 1/1755 cyan, 1/2115 green, 1/2661 yellow, 1/3587 red, 1/5500 magenta
# Data
  GRD='mar-u0.out' PS='mar-u0.ps'
  grdps:
# Smoothed model
  GRD='mar-u.out'  PS='mar-u.ps'
  grdps:

# Estimation of the Lyapunov exponent for the model
  KOOR1=1  KOOR2=2  NA=180  DA=  OA=  NX=  NS=240  LEMAX=5.0
  MODLED='mar-led.out'  MODLEM='mar-lem.out'  MODLEF='mar-lef.out'
  modle2d:
  PICDAT='mar-ple.dat'  PICTURE='mar-le.ps'
  pictures:

# Tests of ray tracing
# ~~~~~~~~~~~~~~~~~~~~
# Creating blank files to accumulate gridded values for all sources
  echo.pl: "" ">mar-ntt.out"
  echo.pl: "" ">mar-gb1.out"
  echo.pl: "" ">mar-gb2.out"
  echo.pl: "" ">mar-gb3.out"
# etc.

# Ray tracing for individual source positions
  SRP='mar-srp.dat'  CPAR1=001  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=020  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=040  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=060  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=080  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=100  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=120  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=140  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=160  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=180  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=200  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=220  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=240  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=260  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=280  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=300  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=320  srp:
  go.pl: "mar-crt.h"
  SRP='mar-srp.dat'  CPAR1=335  srp:
  go.pl: "mar-crt.h"

# Grid for interpolation within ray cells
  N1=60  N2=184  D1=50  D2=50  O1=25  O2=25
# Number of source positions
  N3=18
# Data for 'grdps.for'
  NH=6  HOFFSET=1.5  VOFFSET=1.0  HSIZE=18.00  VSIZE=

# Plotting gridded number of arrivals
  CREF=0.166667  VREF=1  VCIRC=12  VMIN=0
# 0 light grey, 1 yellow, 3 green, 5 cyan, 7 blue, 9 magenta, 11 red
# If we do not know the numbers of travel times, it is better to
# specify VCIRC=  VPLUS=1 instead of VCIRC=12.
  GRD='mar-ntt.out' PS='mar-ntt.ps'
  grdps:

# Removing large GB widths for plotting
  echo.pl: "@2=MIN(@1,15000)" ">grdcal.tmp"
  CAL='grdcal.tmp' GRD1='mar-gb1.out' GRD2='mar-gb1.tmp'
  grdcal:
                   GRD1='mar-gb2.out' GRD2='mar-gb2.tmp'
  grdcal:
                   GRD1='mar-gb3.out' GRD2='mar-gb3.tmp'
  grdcal:

# Plotting widths of Gaussian beams for given initial conditions
  CREF=0.166667  VREF=0  VCIRC=18000  VMIN=
# 0 yellow, 3000 green, 6000 cyan, 9000 blue, 12000 magenta, 15000+ red
  GRD='mar-gb1.tmp'  PS='mar-gb1.ps'  grdps:
  GRD='mar-gb2.tmp'  PS='mar-gb2.ps'  grdps:
  GRD='mar-gb3.tmp'  PS='mar-gb3.ps'  grdps:

# PostScript plots to create GIFs
  UNIT='pt'  NH=18  VOFFSET=  HSIZE=  VSIZE=  ROTATE=-90
  HOFFSET=-896  # HOFFSET=N2*N3/NH-N1*NH
  CREF=0.166667  VREF=1  VCIRC=12  VMIN=0
  GRD='mar-ntt.out' PS='mar-ntg.ps'
  grdps:
  copy.pl:   "mar-gb1.tmp" "mar-gbg.out"
  append.pl: "mar-gbg.out" "mar-gb2.tmp"
  append.pl: "mar-gbg.out" "mar-gb3.tmp"
  N3=54  # Multiplied by the number of merged files 'mar-gb*.out'
  HOFFSET=-528  # HOFFSET=N2*N3/NH-N1*NH
  CREF=0.166667  VREF=0  VCIRC=18000  VMIN=
  GRD='mar-gbg.out' PS='mar-gbg.ps'
  grdps:

# Important output files
# ~~~~~~~~~~~~~~~~~~~~~~
# 'mar-u0.out'...  Gridded original slowness.
# 'mar-u0.ps'...   Plot of the gridded original slowness.
# 'mar-u.out'...   Gridded slowness in the model.
# 'mar-u.ps'...    Plot of the gridded slowness in the model.
# 'mar-ud.out'...  Gridded slowness deviation.
# 'mar-ur.out'...  Gridded relative slowness deviation.
# 'mar-ud2.out'... Standard slowness deviation over the grid.
# 'mar-ur2.out'... Standard relative slowness deviation over the grid.
# 'mar-un2.out'... Sobolev norm of the slowness in the model.
# 'mar-lem.out'... Average Lyapunov exponent for the model.
# 'mar-le.ps'...   Plot of average and directional Lyapunov exponents.

# 'mar-ntt.ps'...  Gridded number of arrivals.
# 'mar-gb*.ps'...  Gridded maximum width of Gaussian beams.
# 'mar-ntg.ps'...  Gridded number of arrivals to create GIF.
# 'mar-gbg.ps'...  Gridded maximum width of Gaussian beams to create GIF.

