#
# History file 'sc2-ani.h' for calculation of anisotropic S-wave rays
# and for visualisation of rays and wavefronts in model SC1_II.
# Figures calculated by this history file were used in
# Klimes & Bulant (2014) Anisotropic-ray-theory rays in velocity model
# SC1_II with a split intersection singularity.
# In Seismic Waves in Complex 3-D Structures, Report 24,
# Dep. Geophys., Charles Univ., Prague, pp. 189-205.
# and
# Klimes & Bulant (2015) 
# Ray tracing and geodesic deviation
# of the SH and SV reference rays
# in a heterogeneous generally anisotropic medium
# which is approximately transversely isotropic.
# In Seismic Waves in Complex 3-D Structures, Report 25,
# Dep. Geophys., Charles Univ., Prague, pp. 187-208.
# and in a paper for special issue of SGG with APSLIM proceedings.

# Input files required
# ~~~~~~~~~~~~~~~~~~~~
  chk.pl: "data/qi/" "sc2-mod.dat"
  chk.pl: "data/qi/" "sc1-src.dat"
  chk.pl: "data/qi/" "sc2-rec.dat"
  chk.pl: "data/qi/" "sc2-crta.dat"
  chk.pl: "data/qi/" "sc2-rpaw.dat"
  chk.pl: "data/qi/" "sc2-col.dat"
  chk.pl: "crt/"     "writall.dat"


# Anisotropic ray tracing
# ~~~~~~~~~~~~~~~~~~~~~~~
  SRC='sc1-src.dat'     REC='sc2-rec.dat'
  DCRT='sc2-crta.dat'   CODE='sc2-crta.dat'   WRIT='writall.dat'
  MODEL='sc2-mod.dat'   RPAR='sc2-rpaw.dat'
  INIPAR=3   CRTANI=1   INIE2=1.570796327
  KMAHI=-1
  CRTSCRO='sw'

# Common anisotropic ray
  KSWAVE=0  CRTLOG='sc2-crtc.out'
  crt:
# Plot of the ray-parameter domain
  CALCOPS='0.40 setlinewidth' COLORS='sc2-col.dat'
  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=  IHIST=  ICTWO=10
  HRTWO=0.8
  PLIM1=0.  PLIM2=1.  PLIM3=0.  PLIM4=1.
  RPPLOT='ca-gp.ps'     rpplot:
  RAYS='ca-rays.out'    crtray:
  WFTIME=0.1  VRTX='ca-v1.out' PLGN='ca-p1.out'   wfsrf:
  WFTIME=0.2  VRTX='ca-v2.out' PLGN='ca-p2.out'   wfsrf:
  WFTIME=0.3  VRTX='ca-v3.out' PLGN='ca-p3.out'   wfsrf:
  WFTIME=0.4  VRTX='ca-v4.out' PLGN='ca-p4.out'   wfsrf:
#
# S1 and S2 anisotropic rays
# First anisotropic ray
  DSWAVE=0.000004
  DSWAVE=0.000001
  DSWAVE=0.0000005
  DSWAVE=0.0000001
  DSWAVE=0.000000001
  DSWAVE=0.00000000001
 #DSWAVE=
  KSWAVE=1  CRTLOG='sc2-crt1.out'
  crt:
  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=  IHIST=1 ICTWO=10
  RPPLOT='s1-gp.ps'    rpplot:
  IRBAS=  IRTWO=  IRAUX=0 ITHOM=0 ISANG=1 ISHP=  ISUC=  IHIST=
  RPPLOT='s1-tp.ps'    rpplot:
  RAYS='s1-rays.out'   crtray:
  WFTIME=0.1  VRTX='s1-v1.out' PLGN='s1-p1.out'   wfsrf:
  WFTIME=0.2  VRTX='s1-v2.out' PLGN='s1-p2.out'   wfsrf:
  WFTIME=0.3  VRTX='s1-v3.out' PLGN='s1-p3.out'   wfsrf:
  WFTIME=0.4  VRTX='s1-v4.out' PLGN='s1-p4.out'   wfsrf:
#
# Second anisotropic ray
  KSWAVE=2  CRTLOG='sc2-crt2.out'
  crt:
  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=  IHIST=  ICTWO=10
  RPPLOT='s2-gp.ps'    rpplot:
  IRBAS=  IRTWO=  IRAUX=0 ITHOM=0 ISANG=1 ISHP=  ISUC=  IHIST=
  RPPLOT='s2-tp.ps'    rpplot:
  RAYS='s2-rays.out'   crtray:
  WFTIME=0.1   VRTX='s2-v10.out' PLGN='s2-p10.out'   wfsrf:
  WFTIME=0.2   VRTX='s2-v20.out' PLGN='s2-p20.out'   wfsrf:
  WFTIME=0.3   VRTX='s2-v30.out' PLGN='s2-p30.out'   wfsrf:
  WFTIME=0.35  VRTX='s2-v35.out' PLGN='s2-p35.out'   wfsrf:
  WFTIME=0.37  VRTX='s2-v37.out' PLGN='s2-p37.out'   wfsrf:
  WFTIME=0.394 VRTX='s2-v40.out' PLGN='s2-p40.out'   wfsrf:

# SH and SV anisotropic rays
  TIA1=0.866   TIA2=0.5  TIA3=1.  DEGREE=2
#
# SH ray
  DSWAVE=0.000004
  DSWAVE=0.000001
  DSWAVE=0.0000005
  DSWAVE=0.0000001
  DSWAVE=0.000000001
  DSWAVE=0.00000000001
 #DSWAVE=
  KSWAVE=1  CRTLOG='sc2-crth.out'
  crt:
  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=  IHIST=1 ICTWO=10
  RPPLOT='sh-gp.ps'    rpplot:
  IRBAS=  IRTWO=  IRAUX=0 ITHOM=0 ISANG=1 ISHP=  ISUC=  IHIST=
  RPPLOT='sh-tp.ps'    rpplot:
  RAYS='sh-rays.out'   crtray:
  WFTIME=0.1  VRTX='sh-v1.out' PLGN='sh-p1.out'   wfsrf:
  WFTIME=0.2  VRTX='sh-v2.out' PLGN='sh-p2.out'   wfsrf:
  WFTIME=0.3  VRTX='sh-v3.out' PLGN='sh-p3.out'   wfsrf:
  WFTIME=0.4  VRTX='sh-v4.out' PLGN='sh-p4.out'   wfsrf:
#
# SV ray
  KSWAVE=2  CRTLOG='sc2-crtv.out'
  crt:
  IRBAS=  IRTWO=  IRAUX=  ITHOM=  ISANG=1 ISHP=  ISUC=  IHIST=  ICTWO=10
  RPPLOT='sv-gp.ps'    rpplot:
  IRBAS=  IRTWO=  IRAUX=0 ITHOM=0 ISANG=1 ISHP=  ISUC=  IHIST=
  RPPLOT='sv-tp.ps'    rpplot:
  RAYS='sv-rays.out'   crtray:
  WFTIME=0.1   VRTX='sv-v10.out' PLGN='sv-p10.out'   wfsrf:
  WFTIME=0.2   VRTX='sv-v20.out' PLGN='sv-p20.out'   wfsrf:
  WFTIME=0.3   VRTX='sv-v30.out' PLGN='sv-p30.out'   wfsrf:
  WFTIME=0.35  VRTX='sv-v35.out' PLGN='sv-p35.out'   wfsrf:
  WFTIME=0.37  VRTX='sv-v37.out' PLGN='sv-p37.out'   wfsrf:
  WFTIME=0.394 VRTX='sv-v40.out' PLGN='sv-p40.out'   wfsrf:

# Generating output VRML or GOCAD file with rays and wavefronts
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Form and name of the file
  VRML='VRML2'  WRL='sc2-ray.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   # GOCAD                             #
  iniwrl:

# Adding model box wireframe
  LIN='sc2-bnd.out'
  KOLLIN=0  R=1.00  G=1.00  B=1.00
  NAME='ModelBox'  PROPERTIES=' '  # just for GOCAD
  bndlin:
  linwrl:

# Adding source and receivers into the VRML or GOCAD file
  PTS='sc1-src.dat'
  KOLPTS=0  R=1.00  G=0.00  B=1.00
  NAME='Source'  PROPERTIES=' '     # just for GOCAD
  ptswrl:
  PTS='sc2-rec.dat'
  KOLPTS=0  R=1.00  G=1.00  B=1.00  # SHIFT3=0.001
  NAME='Receivers'  PROPERTIES=' '  # just for GOCAD
  ptswrl:

# Adding the rays into the VRML or GOCAD file

# Just common or S1 or S2 or SH or SV rays - only for VRML
  WRL='sc2-ray.wrl' WRLOUT='sc2-rayc.wrl' # VRML
  R=0.00  G=0.00  B=1.00
  LIN='ca-rays.out'      linwrl:
  WRL='sc2-ray.wrl' WRLOUT='sc2-ray1.wrl' # VRML
  R=1.00  G=0.00  B=0.00
  LIN='s1-rays.out'      linwrl:
  WRL='sc2-ray.wrl' WRLOUT='sc2-rayh.wrl' # VRML
  R=1.00  G=0.00  B=0.00
  LIN='sh-rays.out'      linwrl:
  WRL='sc2-ray.wrl' WRLOUT='sc2-ray2.wrl' # VRML
  R=0.00  G=1.00  B=0.00
  LIN='s2-rays.out'      linwrl:
  WRL='sc2-ray.wrl' WRLOUT='sc2-rayv.wrl' # VRML
  R=0.00  G=1.00  B=0.00
  LIN='sv-rays.out'      linwrl:

# All rays together
  VRML='VRML2'  WRL='sc2-ray.wrl' WRLOUT=                 # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'  WRLOUT=                 # GOCAD      #
  NAME='Rays-ca'  PROPERTIES=' '                 # just for GOCAD
  R=0.00  G=0.00  B=1.00
  LIN='ca-rays.out'      linwrl:
  NAME='Rays-S1'  PROPERTIES=' '                 # just for GOCAD
  R=1.00  G=0.00  B=0.00
  LIN='s1-rays.out'      linwrl:
  NAME='Rays-S2'  PROPERTIES=' '                 # just for GOCAD
  R=0.00  G=1.00  B=0.00
  LIN='s2-rays.out'      linwrl:
  NAME='Rays-SH'  PROPERTIES=' '                 # just for GOCAD
  R=1.00  G=0.00  B=0.00
  LIN='sh-rays.out'      linwrl:
  NAME='Rays-SV'  PROPERTIES=' '                 # just for GOCAD
  R=0.00  G=1.00  B=0.00
  LIN='sv-rays.out'      linwrl:

# Adding wavefronts into the VRML or GOCAD files
  KOLSRF=0
  R=0. G=0. B=1.
  VRML='VRML2'  WRL='sc2-rayc.wrl' WRLOUT='sc2-wfca.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-ca-1'  PROPERTIES=' '          # just for GOCAD
  VRTX='ca-v1.out'  TRGL='ca-p1.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-wfca.wrl' WRLOUT=                # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-ca-2'  PROPERTIES=' '          # just for GOCAD
  VRTX='ca-v2.out'  TRGL='ca-p2.out'  srfwrl:
  NAME='Wavefront-ca-3'  PROPERTIES=' '          # just for GOCAD
  VRTX='ca-v3.out'  TRGL='ca-p3.out'  srfwrl:
  NAME='Wavefront-ca-4'  PROPERTIES=' '          # just for GOCAD
  VRTX='ca-v4.out'  TRGL='ca-p4.out'  srfwrl:
  R=1. G=0. B=0.
  VRML='VRML2'  WRL='sc2-ray1.wrl' WRLOUT='sc2-wfs1.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-S1-1'  PROPERTIES=' '          # just for GOCAD
  VRTX='s1-v1.out'  TRGL='s1-p1.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-wfs1.wrl' WRLOUT=                # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-S1-2'  PROPERTIES=' '          # just for GOCAD
  VRTX='s1-v2.out'  TRGL='s1-p2.out'  srfwrl:
  NAME='Wavefront-S1-3'  PROPERTIES=' '          # just for GOCAD
  VRTX='s1-v3.out'  TRGL='s1-p3.out'  srfwrl:
  NAME='Wavefront-S1-4'  PROPERTIES=' '          # just for GOCAD
  VRTX='s1-v4.out'  TRGL='s1-p4.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-rayh.wrl' WRLOUT='sc2-wfsh.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-SH-1'  PROPERTIES=' '          # just for GOCAD
  VRTX='sh-v1.out'  TRGL='sh-p1.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-wfsh.wrl' WRLOUT=                # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-SH-2'  PROPERTIES=' '          # just for GOCAD
  VRTX='sh-v2.out'  TRGL='sh-p2.out'  srfwrl:
  NAME='Wavefront-SH-3'  PROPERTIES=' '          # just for GOCAD
  VRTX='sh-v3.out'  TRGL='sh-p3.out'  srfwrl:
  NAME='Wavefront-SH-4'  PROPERTIES=' '          # just for GOCAD
  VRTX='sh-v4.out'  TRGL='sh-p4.out'  srfwrl:
  R=0. G=1. B=0.
  VRML='VRML2'  WRL='sc2-ray2.wrl' WRLOUT='sc2-wfs2.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-S2-1'  PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v10.out'  TRGL='s2-p10.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-wfs2.wrl' WRLOUT=                # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-S2-2'  PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v20.out'  TRGL='s2-p20.out'  srfwrl:
  NAME='Wavefront-S2-3'  PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v30.out'  TRGL='s2-p30.out'  srfwrl:
  NAME='Wavefront-S2-35' PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v35.out'  TRGL='s2-p35.out'  srfwrl:
  NAME='Wavefront-S2-37' PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v37.out'  TRGL='s2-p37.out'  srfwrl:
  NAME='Wavefront-S2-4'  PROPERTIES=' '          # just for GOCAD
  VRTX='s2-v40.out'  TRGL='s2-p40.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-rayv.wrl' WRLOUT='sc2-wfsv.wrl'  # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-SV-1'  PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v10.out'  TRGL='sv-p10.out'  srfwrl:
  VRML='VRML2'  WRL='sc2-wfsv.wrl' WRLOUT=                # VRML
 #VRML='GOCAD'  WRL='sc2-ray.mx'   WRLOUT=                # GOCAD      #
  NAME='Wavefront-SV-2'  PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v20.out'  TRGL='sv-p20.out'  srfwrl:
  NAME='Wavefront-SV-3'  PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v30.out'  TRGL='sv-p30.out'  srfwrl:
  NAME='Wavefront-SV-35' PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v35.out'  TRGL='sv-p35.out'  srfwrl:
  NAME='Wavefront-SV-37' PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v37.out'  TRGL='sv-p37.out'  srfwrl:
  NAME='Wavefront-SV-4'  PROPERTIES=' '          # just for GOCAD
  VRTX='sv-v40.out'  TRGL='sv-p40.out'  srfwrl:
#