Fortran 77 package MODEL version 5.50
 Vaclav Bucha
 Department of Geophysics, Charles University Prague,
Ke Karlovu 3, 121 16 Praha 2, Czech Republic
 Email:
bucha@seis.karlov.mff.cuni.cz
 Petr Bulant
 Department of Geophysics, Charles University Prague,
Ke Karlovu 3, 121 16 Praha 2, Czech Republic
 Email:
bulant@seis.karlov.mff.cuni.cz
 Vlastislav Cerveny
 Department of Geophysics, Charles University Prague,
Ke Karlovu 3, 121 16 Praha 2, Czech Republic
 Email:
vcerveny@seis.karlov.mff.cuni.cz
 Ludek Klimes
 Department of Geophysics, Charles University Prague,
Ke Karlovu 3, 121 16 Praha 2, Czech Republic
 Email:
klimes@seis.karlov.mff.cuni.cz
 Ivan Psencik
 Geophysical Institute, Acad. Sci. Czech Rep.,
Bocni II 1401, 141 31 Praha 4, Czech Republic
 Email:
ip@ig.cas.cz
This is just a general overview, the detailed description of input
data, procedures, and other important topics is included within the
individual FORTRAN77 source code files.
General description
Programming language, error messages, screen output, etc.
Unified memory management.
History files.
Alphabetical list of input parameters of all programs.
VRML (Virtual Reality Modeling Language).
VRML97 examples:
lensrf.wrl:
surfaces in the model with a lenticular inclusion.
lenvp.wrl:
velocity in the model with a lenticular inclusion.
elf1srf.wrl:
surfaces in model "elf1".
elf1icb.wrl:
layers in model "elf1".
sd1srf.wrl:
surfaces in model "sd1".
sd1vp.wrl:
velocity in model "sd1".
sd2srf.wrl:
surfaces in model "sd2".
sd2vp.wrl:
velocity in model "sd2".
wb2vp.wrl:
velocity in model "wb2".
wb2vps.wrl:
parallel velocity sections in model "wb2".
l7srf.wrl:
surfaces in model "l7".
salsrf.wrl:
surfaces in the SEG/EAGE Salt Model smoothed for ray tracing.
New in version 5.50
Examples of GOCAD files
generated by the programs creating
virtual representation of models, rays and other objects
in the VRML or GOCAD format:
lensrf.mx:
surfaces in the model with a lenticular inclusion.
lenvp.mx:
velocity in the model with a lenticular inclusion.
lenvpv.mx with
lenvpv.bin:
velocity voxet in the model with a lenticular inclusion.
Both files have to be copied into the same directory before
reading them into the GOCAD software.
lenray.mx:
surfaces and rays in the model with a lenticular inclusion.
elf1srf.mx:
surfaces in model "elf1".
elf1icb.mx:
layers in model "elf1".
sd1srf.mx:
surfaces in model "sd1".
sd1vp.mx:
velocity in model "sd1".
sd2srf.mx:
surfaces in model "sd2".
sd2vp.mx:
velocity in model "sd2".
wb2vp.mx:
98srf.mx:
surfaces in model "98".
98vp.mx:
velocity in model "98".
98vpv.mx with
98vpv.bin:
velocity voxet in model "98".
Both files have to be copied into the same directory before
reading them into the GOCAD software.
98ray.mx:
surfaces and rays in model "98".
salsrf.mx:
surfaces in the SEG/EAGE Salt Model smoothed for ray tracing.
Compiling and linking programs of package MODEL
All Fortran 77 source code and include files of packages
NR, FORMS and MODEL are assumed
to be located in a single directory when being compiled and linked.
The files with main programs contain, at their ends, Fortran 90
INCLUDE command for all subroutine files required. In this way,
each program may simply be compiled and linked as a single file.
All filenames are assumed to be expressed in lowercase (since version
5.00) which should be more convenient than uppercase on Unix systems.
Fortran 77 source code files have extension '.for'. The corresponding
files with specifications of the COMMON blocks have extension '.inc'
and are included in the Fortran 77 source code by means of Fortran 90
INCLUDE command.
Compilation and linking:
 Install package FORMS into your working directory
according to the description in
forms.htm.
 Copy all files (or at least all *.for and *.inc
files) of package MODEL
into your working directory.
All the files may also be extracted using
pkunzip d model.zip or
tar xvf model.tar.
 Run Perl script fmod.pl
by entering command
perl fmod.pl
to compile and link the programs of package MODEL.
For the list of files to compile and link, refer to
Perl script fmod.pl,
which employs Perl script f.pl
of package FORMS to compile each program.
All necessary subroutine files and include files are included
by the Fortran 90 INCLUDE command.
Fortran 77 subroutine files are included at the end of above
listed files containing main programs.
Specification of the model
The way of building the model is concisely described in the
paper on C.R.T. The model building technique is independent of
the coordinate system, independent of the method used to specify
and interpolate the surfaces covering structural interfaces, and
independent of the functions describing the distribution of
material properties within the individual complex geological
blocks.
The model is specified in terms of subroutines
(e.g., subroutines to evaluate the values and partial derivatives
of the functions describing surfaces or material parameters)
and of the input data for the subroutines.
Although both the subroutines and the data may be modified by a user,
most of the users wish to modify only the input data, using
the interpolation routines contained within the basic version
of the MODEL package.
The basic subroutines to deal with general blocky geological
structures are located within the source code file 'model.for'.
Among them, the most important subroutine is BLOCK determining
the relation of a given point with respect to geological blocks.
The data describing the model topology are described within the
source code file 'model.for'.
To specify a particular model, the following routines should be
available:
 METR1 (file 'metric.for')... Memorizes the type of the model
coordinate system.
 KOOR (file 'metric.for')... Recalls the type of the model
coordinate system (zero for Cartesian coordinates).
 METRIC (file 'metric.for')... Evaluates the metric tensor and
Christoffel symbols at a given point.
 CARTES (file 'metric.for')... Transforms the model coordinates to
Cartesian coordinates. Not employed within the complete
ray tracing, used rather for model imaging.
 SRFC1 (file 'srfc.for')... Reads the input data for smooth
surfaces.
 SRFC2 (file 'srfc.for')... Evaluates functions describing the
smooth surfaces.
 PARM1 (file 'parm.for')... Reads the input data for the material
parameters of the model.
 PARM2 (file 'parm.for')... Evaluates the material parameters of a
given complex geological block at a given point.
To deal with the first order model variations for the purposes of
inverse problems, the routines VAR1 to VAR5 should be called
properly during the evaluation of functions describing surfaces or
material properties in order to memorize the variations. The
invocations of VAR1 to VAR5 are irrelevant for forward modelling.
These invocations are denoted by '*V' in the first two columns of
source code (files 'model.for', 'parm.for', 'val.for', and
'fit.for'). The source code lines with '*V' should be modified or
removed by means of the program 'clean.for' or a text editor.
When submitting different subroutines SRFC2 and PARM2 while
dealing with inverse problems, the user is responsible for proper
invocation of routines VAR1 to VAR5.
Description of input data to specify the model
The data are read by the subroutine MODEL1 and are
described in the FORTRAN77 source code file 'model.for'.
Running programs of package MODEL
It is recommended to run the programs from the
history files.
The history files may contain the information how to execute the programs,
the data read from standard input (Fortran)
or from the command line (Perl) and the data read
from the SEP parameter files.
Data from standard input *:
Main input data of each program are read from the standard input
(denoted by * in Fortran code),
and mostly consist of a single line containing filenames and
at most few numerical parameters.
For the description of input data of individual programs refer to
the list of files below.
List of error messages
File list of package MODEL
The model specification software consists of package FORMS and of the
following FORTRAN77 source code and demo files:
 (A) Documentation:
 model.htm

This file.
 modelver.htm

List of the released versions.
 modelerr.htm

List of error messages.
 (B) General subroutines dealing with blocky geological structures:
 model.for

Subroutines reading input data to specify a blocky
seismic model for complete ray tracing (see C.R.T.3.2.1),
routines to determine the position of a given point with
respect to geological blocks and structural interfaces,
and other auxiliary subroutines related to the model (see
C.R.T.3.3). These routines assume a general form of
userdefined subroutines METR1 (file 'metric.for') to
define the coordinate system.
 modelv.for

Version of 'model.for' for inverse problems.
 model.inc

Include file with COMMON blocks for 'model.for'.
 (C) Sample userdefined model specification routines required for
forward modelling:
 metric.for

Subroutine evaluating the metric tensor and
Christoffel symbols at a given point (see C.R.T.2), and
the related subroutines and external functions.
Any userdefined coordinate system may simply be
introduced by modification of these subroutines.
 metric.inc

Include file with COMMON block for 'metric.for'.
 srfc.for

Subroutines for specification and interpolation, in
rectangular grids, of the functions describing smooth
surfaces in the model (see C.R.T.3.2.2).
Any userdefined surfaces may simply be included within
the whole system by modification of these subroutines.
 parm.for

Subroutines for specification and interpolation, in
rectangular grids, of the material parameters within
individual complex blocks in the model (see C.R.T.3.2.3).
Any userdefined spatial distribution of material
properties may simply be included within the whole system
by modification of these subroutines.
 parmv.for

Version of 'parm.for' for inverse problems.
 val.for

Subroutines controlling function specification and
interpolation. Designed to perform the interpolation
of a set of functions in a rectangular grid, employing
splines under tension. These subroutines are referred
by the subroutines of files 'srfc', 'parm', and sample
complete ray tracing source code file 'init'.
 valv.for

Version of 'val.for' for inverse problems.
 val.inc

Include file with COMMON block for 'val.for'.
 fit.for

Some routines taken from Cline's software package
'FITPACK', called by the subroutines of the package 'val'
to perform the splineundertension interpolation.
Note that not all of the subroutines of the software
package 'fit' are used at the same time.
 fitv.for

Version of 'fit.for' for inverse problems.
 auxmod.inc

Include file with COMMON block containing
auxiliary storage locations for local model parameters
required to call subroutines METRIC, SRFC2, PARM2 and VELOC.
 (D) Additional model specification routines related to inverse modelling:
 var.for

Subroutine VAR1 and its entries VAR2, VAR3, VAR4 and
VAR5 are called from the modeltreating subroutine
packages in order to keep in the memory variations of the
functions describing the model, with respect to their
coefficients. The variations are required for the
traveltime inversion of the model and are recalled from
the memory by calling the entry VAR6.
 varnul.for

Empty versions of the subroutine VAR1 and its
entries VAR2 to VAR6 called from the modeltreating
subroutine files in order to keep in the memory
variations of the functions describing the model, with
respect to their coefficients.
The variations are required for the traveltime inversion
of the model, see also the subroutine file 'var.for'. In
the case of forward modelling, the variations are useless.
 spsp.for

Subroutines evaluating the Sobolev scalar products
of variations of the functions describing the model, with
respect to their coefficients. This raw lowlevel version
is related rather to the lowlevel 'fit.for' subroutines
than to 'srfc.for' and 'parm.for' model specification
subroutines.
 soft.for

Subroutine accumulating the prior subjective information
covariance matrix describing the smoothness of the functions
interpolated by means of subroutines of the file 'val.for'.
 (E) Service routines useful to handle the model and to perform
some calculations:
 means.for

Service subroutines facilitating the work with the
model. E.g., subroutine CROSS determining the point of
intersection of a given curve with a given surface
described by a general subroutine SRFC2 of 'srfc.for',
subroutine CDE searching for the point of intersection of
the given curve with the boundaries of the complex block
based on the subroutine BLOCK of 'model.for', or
subroutine SMVPRD mutually transforming covariant and
contravariant coordinates of a vector.
These routines are employed by complete ray tracing and by
model imaging routines 'modsec.for'.
 hpcg.for

Subroutine of the IBM Scientific Subroutine Package
solving a system of general first order ordinary
differential equations with given initial values. It is
called, e.g., by the subroutine RAYCB of the complete ray
tracing source code file 'raycb.for'.
 rkgs.for

Subroutine of the IBM Scientific Subroutine Package
solving a system of general first order ordinary
differential equations with given initial values. It is
called, e.g., by the subroutines of the file 'modsec.for'.
 (F) Sample application programs and routines working with the model:
 modchk.for

Program MODCHK
checking the model consistency.

Description of input data.
 modsrf.for

Program MODSRF
to triangulate structural interfaces in the model.

Description of input data.
 modsrf.inc

Include file with COMMON blocks for 'modsrf.for'.
 bndlin.for

Program BNDLIN
to write the lines forming the edges of the model box
for displaying purposes.

Description of input data.
 grid.for

Program GRID
generating velocities in a rectangular grid
required for full wave finite differences, shortest path
calculation of seismic rays, eikonal equation 'finite
differences', raster imaging of the model, or debugging
purposes.

Description of input data.
 sec.for

Program SEC
to determine interfaces and velocity
isolines in 2D sections of a 3D seismic model. May be
used to generate a wireframe representing some model
properties to be displayed, or to approximate interfaces
by small tetragonal facets for display purposes.

Description of input data.
 sec.inc

Include file with COMMON blocks for 'sec.for'.
 intf.for

Program INTF
to check the positions of given points with
respect to interfaces in the model.

Description of input data.
 invsoft.for

Program INVSOFT
to evaluate the coefficients of the soft subjective
a priori information on the perturbations of the model parameters.
The subjective a priori information is composed of the squares of the
Sobolev norms of the functions describing the model.

Description of input data.
 invpts.for

Program INVPTS
to calculate the derivatives of functions, describing
interfaces or material parameters, with respect to the model Bspline
coefficients.

Description of input data.
 modmod.for

Program MODMOD
designed to MODify the MODel (change the parametrization
of the functions describing the model, or to update the model
according to the results of smoothing or inversion).

Description of input data.
 modle2d.for

Provisional version MODLE2D of the program
designed to calculate directional Lyapunov exponents
and average Lyapunov exponent for a 2D model without interfaces.
Optionally a 3D model may be considered.

Description of input data.
 (G) Source code editing programs:
 clean.for

Program CLEAN
to modify the lines with given letters in the first two columns.

Description of input data.
 mod.pl

Perl script executing program 'clean.for' to convert
model specification routines 'model.for', 'parm.for',
'val.for' and 'fit.for' for forward modelling programs
into the model specification routines 'modelv.for',
'parmv.for', 'valv.for' and 'fitv.for', for inverse
modelling programs.
 (H) Perl script:
 fmod.pl

Perl script to compile the MODEL package by means of
predefined script 'f.pl'.
 (I) Universal and demo data files:
 sob11.dat
 sob22.dat
 sob22n.dat
 sob22l.dat
 sob33.dat
 sob33n.dat
 sob33l.dat

Input data for the 'invsoft.for' program specifying
particular isotropic kinds of the Sobolev norm.
Notes:
Model specification routines (B) and (C) for forward modelling are
likely to be required by all applications.
Example: 'grid.for' program linked with all files of (B)
and (C).
In addition, some of service routines (E) are required by some
applications.
Example 1: 'sec.for' program linked with the files
'modsec.for', 'means.for', 'rkgs.for', and all files of
(B) and (C).
Example 2: complete ray tracing program and routines
linked with 'means.for', 'hpcg.for', and all files of
(B) and (C).
Inverse modelling programs are likely to require model
specification routines (B) and (C) for forward modelling
together with the model specification routines (D) for
inverse modelling. Do not forget to use the versions with
'*V' in the first two columns of source code replaced by a
pair of spaces.
Data files related to particular models
Data located in package DATA:
 len

 lenmod.dat

Sample input data for the model specification
routines. The 3D model consists of two layers and of the
lenticular inclusion with edges, situated in the upper
layer, see the schematic Figure 5 in the paper on C.R.T.
mentioned above. The data are read by the subroutine
MODEL1 of 'model.for' with the help from the subroutines
of files 'srfc.for', 'parm.for', 'val.for', and 'fit.for'.
 VRML97 view of interfaces
 VRML97 view of Pwave velocities
 lenmod.h

History file to display 3D interfaces and Pwave velocities
in model 'lenmod.dat' in VRML (Virtual Reality Modeling Language).
 lencam.dat

Data for 'lenmod.h' specifying the initial position of the camera.
 lendli1.dat (interfaces) and
lendli2.dat (velocities)

Data for 'lenmod.h' specifying the directional lights for VRML.
 lengrid.h

Sample history file to run the 'grid.for' program.
 lensec.dat

Sample input data for the 'sec.for' program to
generate the file with isolines.
 lensecp.dat

Sample input data for the 'sec.for' program to
generate the file with points at structural interfaces.
 lengrd.h

History file to display 2D velocity sections across
the demo model 'lenmod.dat' in PostScript.
 prem

Preliminary Reference Earth Model by Dziewonski and Anderson (1981).
 elf1

Homogeneous layers separated by dipping plane interfaces (model MI).
 Data for the model
 VRML97 view of interfaces
 VRML97 view of solid complex blocks
 sd

Salt dome model and dislocated salt dome model.
 Data for salt dome model SD1
 VRML97 view of interfaces in SD1
 VRML97 view of Pwave velocities in SD1
 Data for dislocated salt dome model SD2
 VRML97 view of interfaces in SD2
 VRML97 view of Pwave velocities in SD2
 slit

Slit model.
 wb

Western Bohemia a priori model.
 Data for model WB2
 VRML97 view of Pwave velocities in WB2
 VRML97 view of vertical Pwave velocity sections
 l7

Model L7.
 Data for the model
 VRML97 view of interfaces
 mar

INRIA benchmark versions of the 2D Marmousi model.
 Smoothing the Marmousi model
for Gaussianpacket migrations
 u2d

Unconformity 2D model by Cormier and Mellen (1984).
Acknowledgements
The development of this package and the related algorithms has
been partially supported by:
 Faculty of Mathematics and Physics, Charles University, Prague.
 Energy, Mines and Resources Canada, Ottawa, Ontario.
 Institute of Geotechnics, Czechoslovak Academy of Sciences, Prague.
 Geophysical Institute, Academy of Sciences of the Czech Republic.
 Grant Agency of the Academy of Sciences of the Czech Republic
under Contracts 31223 and 346110.
 Grant Agency of the Charles University under Contracts 8/94,
38/94 and 237/2001.
 Grant Agency of the Czech Republic under Contracts 205/95/1465
and 205/01/0927.
 European Commission within the framework of the JOULE II Project
"Integrated Structural Imaging of Seismic Data".
 Members of consortium "Seismic Waves in Complex 3D Structures".
References
 Cerveny V., Klimes L. and Psencik I. (1988): Complete seismicray
tracing in threedimensional structures. In: Seismological
Algorithms, ed. Doornbos D.J., Academic Press, New York.
The above paper contains detailed description of the model
construction and is frequently referred throughout the FORTRAN77
code of model specification routines. The references like
(C.R.T.5.4) or (5.4) are related to the paper. The detailed
description of the input data, subroutine and function parameters,
and other specifications not contained in the paper, is included
within the individual source code files.
 Cline, A.K. (1974): Scalar and planarvalued curve fitting using
splines under tension. Commun. ACM, 17, 218220.
 Cline, A.K. (1974): Algorithm 476  Six subprograms for curve
fitting using splines under tension. Commun. ACM, 17,
220223.
 Cline, A.K. (1981): FITPACK  software package for curve and
surface fitting employing splines under tension. Dept. of
Comp. Sci., Univ. of Texas, Austin.
The above three references are related to the interpolation subroutines
located in file 'fit.for'.