# History file 'sal-inv3.h' to fit the SEG/EAGE 3-D Salt Model by a model
# with interfaces. Input data for the salt interface are taken from the
# GOCAD surfaces, data from file 'fault_a.ts' are also used.
# =====================================================================

# Input files required
 #chk.pl: "data/sal/" "sal-m3.dat"
 #chk.pl: "model/"     "sob22.dat"
 #chk.pl: "forms/"     "inv.cal"
 #chk.pl: "forms/"     "addsob.cal"
# Output of 'sal-ts.h'
 #chk.pl: ""           "top.pts"
 #chk.pl: ""           "hrz_1.pts"
 #chk.pl: ""           "gp2.pts"
 #chk.pl: ""           "bottom.pts"
 #chk.pl: ""           "fault_a.pts"
# Output of 'sal-salt.h'
 #chk.pl: ""           "salt-to1.pts"
 #chk.pl: ""           "salt-to2.pts"
 #chk.pl: ""           "salt-bo1.pts"

# Initial model and its consistency check
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='sal-m3.dat'  MODIN='sal-m3.dat'
  N1=20  N2=20  N3=10  LFREE=1  MODLOG='modchk.out'
 #modchk:

# Form of the files with matrices
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  FORMM='formatted'
  FORMM='unformatted'

# Inversion of interfaces
# ~~~~~~~~~~~~~~~~~~~~~~~
  ICLASS=1            # 646 model parameters for surfaces

# Calculating matrices for inversion
  M1='m1.out'  M2='m2.out'
  SOBOLEV='sob22.dat'  MODSOB='modsob.out'  SOBW00=1
  invsoft:
                       MODSOB=              SOBW00=
  GM1='gm1.out'  GM2='gm2.out'  GM3=' '  DM1='dm1.out'
  MPAR=0
  PTS='top.pts'      INDFUN=1  ERRMUL=2.000  invpts:  #     4 points
  M2IN='m2.out'                                       #
  PTS='hrz_1.pts'    INDFUN=2  ERRMUL=24.52  invpts:  #   601 points
  PTS='gp2.pts'      INDFUN=3  ERRMUL=42.19  invpts:  #  1780 points
  PTS='bottom.pts'   INDFUN=4  ERRMUL=2.000  invpts:  #     4 points
  PTS='salt-t1.pts'  INDFUN=5  ERRMUL=28.16  invpts:  #   793 points
  PTS='salt-b1.pts'  INDFUN=6  ERRMUL=24.02  invpts:  #   577 points
  PTS='fault_a.pts'  INDFUN=7  ERRMUL=31.91  invpts:  #  1018 points
  PTS='salt-t2.pts'  INDFUN=8  ERRMUL=14.04  invpts:  #   197 points


  M2IN=' '  PTS=' '  INDFUN=   ERRMUL=                #       total

# Matrix operations
  N1=0  N2=1  N3=1  M1='m2.out'
  CAL='inv.cal' GRD1='dm1.out' GRD2='dm2.out'
  grdcal:
  M1='m1.out'  M2='m2.out'  GM1='gm1.out'  DM1='dm2.out'  SM1='sm1.out'
  gmdmgmt:
  N1=0  N2=0  N3=1  M1='m1.out' M2='m1.out'
  CAL='addsob.cal'  GRD1='sm1.out'  GRD2='modsob.out'  GRD3='sm2.out'
  SOBMUL=20000 8000
  grdcal:
  SOBMUL=
  M1='m1.out'               SM1='sm2.out'  SM2='sm3.out'
  sminv:
  M1='m2.out'  M2=' '       DM1='dm2.out'  GM1='gm2.out'  GM2='gm3.out'
  dmgm:
  M1='m1.out'  M2='m2.out'  GM1='gm1.out'  GM2='gm3.out'  GM3='gm4.out'
  gmgm:
  M1='m1.out'  M2=' '       SM1='sm3.out'  GM1='gm4.out'  GM2='gm5.out'
  smgm:

# Updating the model
  M1='m1.out'  MODNEW='gm5.out'
  MODOUT='sal-m3.tmp'
  modmod:


# Indices of complex blocks relevant to the velocities
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  N1=68   N2=68   N3=20  D1=200  D2=200  D3=200  O1=0    O2=0    O3=40
  N1=46   N2=46   N3=14  D1=300  D2=300  D3=300  O1=0    O2=0    O3=100
  N1=34   N2=34   N3=20  D1=400  D2=400  D3=200  O1=200  O2=200  O3=40
  N1=23   N2=23   N3=21  D1=600  D2=600  D3=200  O1=200  O2=200  O3=100
  N1=17   N2=17   N3=20  D1=800  D2=800  D3=200  O1=400  O2=400  O3=40
  N1=11   N2=11   N3=20  D1=1340 D2=1340 D3=200  O1=40   O2=40   O3=40
  N1=17   N2=17   N3=39  D1=800  D2=800  D3=100  O1=400  O2=400  O3=40

  ISRF=3  VEL='sal-s3.out'  grid:
  ISRF=4  VEL='sal-s4.out'  grid:
  ISRF=
  CAL='sal-icb.cal'
  GRD2='sal-s3.out' GRD3='sal-s4.out' GRD4='sal-icb.out'
  SALTV1=1000  SALTV2=1501  SALTV5=4449  SALTD3=152.4  SALTD4=1
  GRD1='s-va200.out'
  GRD1='s-vc200.out'
  GRD1='s-va200r.out'
  GRD1='s-vc200r.out'
  GRD1='s-va300.out'
  GRD1='s-va420.out'
  GRD1='s-va620.out'
  GRD1='s-va820.out'
  GRD1='s-va134.out'
  GRD1='s-vc810r.out'
  grdcal:


# Inversion of velocities
# ~~~~~~~~~~~~~~~~~~~~~~~
  MODEL='sal-m3.tmp'    MODIN='sal-m3.tmp'
  ICLASS=2
  NEGPAR=1

# Calculating matrices for inversion
  M1='m1.out'  M2='m2.out'
  SOBOLEV='sob22.dat'  MODSOB='modsob.out'  SOBW01=1
  invsoft:
                       MODSOB=              SOBW01=
  GM1='gm1.out'  GM2='gm2.out'  GM3=' '  DM1='dm1.out'
  GRDICB='sal-icb.out' MPAR=1 POWERM=-1
  GRD='s-sa200.out'   ERRMUL=304.11 #92480 points
  GRD='s-sc200.out'   ERRMUL=304.11 #92480 points
  GRD='s-sa200r.out'  ERRMUL=304.11 #92480 points
  GRD='s-sc200r.out'  ERRMUL=304.11 #92480 points
  GRD='s-sa300.out'   ERRMUL=172.12 #29624 points
  GRD='s-sa420.out'   ERRMUL=152.05 #23120 points
  GRD='s-sa620.out'   ERRMUL=105.40 #11109 points
  GRD='s-sa820.out'   ERRMUL=76.026 #5780  points
  GRD='s-sa134.out'   ERRMUL=50.408 #2541  points
  GRD='s-sc810r.out'  ERRMUL=106.16 #11271 points
  invpts:
  GRD= GRDICB= MPAR= POWERM= ERRMUL=

# Matrix operations
  N1=0  N2=1  N3=1  M1='m2.out'
  CAL='inv.cal' GRD1='dm1.out' GRD2='dm2.out'
  grdcal:
  M1='m1.out'  M2='m2.out'  GM1='gm1.out'  DM1='dm2.out'  SM1='sm1.out'
  gmdmgmt:

  N1=0  N2=0  N3=1  M1='m1.out' M2='m1.out'
  CAL='addsob.cal'  GRD1='sm1.out'  GRD2='modsob.out'  GRD3='sm2.out'
  SOBMUL=5000 2500 10000 25000 0 50000 200000 100000 1000 75000 150000
  grdcal:
  SOBMUL=
  M1='m1.out'               SM1='sm2.out'  SM2='sm3.out'
  sminv:
  M1='m2.out'  M2=' '       DM1='dm2.out'  GM1='gm2.out'  GM2='gm3.out'
  dmgm:
  M1='m1.out'  M2='m2.out'  GM1='gm1.out'  GM2='gm3.out'  GM3='gm4.out'
  gmgm:
  M1='m1.out'  M2=' '       SM1='sm3.out'  GM1='gm4.out'  GM2='gm5.out'
  smgm:

# Updating the model
  M1='m1.out'  MODNEW='gm5.out'
  MODOUT='sal-m3.out'
  modmod:

## Sobolev norm of the slowness in the updated model
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  M1='m1.out'  M2=' '  SM1='modsob.out' GM1='gm5.out'  GM2='gm6.out'
  smgm:
  M1=' '  M2='m1.out'  GM1='gm5.out'  GM2='gm6.out'  GM3='gm7.out'
  gmgm:
  N1=0  N2=1  N3=1  M1=' '
  CAL='sqrt.cal' GRD1='gm7.out' GRD2='s-sns.out' FORMMW='formatted'
  grdcal:

# List of output files
# ~~~~~~~~~~~~~~~~~~~~
# 'sal-m3.tmp' ... Inverted model after inversion of interfaces.
# 'sal-m3.out' ... Inverted model (after inversions of interfaces and
#             of velocities).
