- Vaclav Bucha
- Department of Geophysics, Charles University Prague, Ke Karlovu 3, 121 16 Praha 2, Czech Republic
- Petr Bulant
- Department of Geophysics, Charles University Prague, Ke Karlovu 3, 121 16 Praha 2, Czech Republic
- Vlastislav Cerveny
- Department of Geophysics, Charles University Prague, Ke Karlovu 3, 121 16 Praha 2, Czech Republic
- Ludek Klimes
- Department of Geophysics, Charles University Prague, Ke Karlovu 3, 121 16 Praha 2, Czech Republic
- Ivan Psencik
- Institute of Geophysics, Acad. Sci. Czech Rep., Bocni II 1401, 141 31 Praha 4, Czech Republic

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.

This software package is property of its authors, is distributed in source form, and may be used free of charge. If any result obtained with help of any part of this package is published, we appreciate citation of all papers related to the used part of this package. Refer to the references related to this package.

Programming language, error messages, screen output, etc.

Alphabetical list of input parameters of all programs.

All Fortran 77 source code and include files 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`,`*.inc`and`*.pl`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`. At http://sw3d.cz, model.zip contains ASCII files in the DOS format. At http://sw3d.cz, model.tar contains ASCII files in the UNIX format. On the UNIX disk, model.zip and model.tar contain ASCII files in the UNIX format. On the DOS disk, model.zip and model.tar contain ASCII files in the DOS format. - 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.

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'.

All Fortran 77 source code and include files together with all the Perl scripts and data files of packages FORMS and MODEL are assumed to be located in the same single working directory in which the programs will be run.

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.

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 user-defined 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 user-defined 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 user-defined 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 user-defined 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 user-defined 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 spline-under-tension 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 model-treating 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 travel-time 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 model-treating 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 travel-time 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 low-level version is related rather to the low-level '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'.
- well.for
- Subroutine to extract a 1-D vertical profile from the given model.
- 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 2-D sections of a 3-D 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.
- coorchg.for
- Program COORCHG to transform the coordinates of lines or points from Cartesian coordinates to polar spherical or geographic spherical coordinates and vice versa.
- 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 B-spline 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.
- srcsrc.for
- Program SRCSRC designed to update the source coordinates during the simultaneous inversion of arrival times for both model and hypocentral parameters.
- Description of input data.
- modle2d.for
- Provisional version MODLE2D of the program designed to calculate directional Lyapunov exponents and average Lyapunov exponent for a 2-D model without interfaces. Optionally a 3-D 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.

- 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, 237/2001, 229/2002 and 375/2004.
- Grant Agency of the Czech Republic under Contracts 205/95/1465, 205/01/0927, 205/01/D097, 205/04/1104, 205/07/0032 and P210/10/0736.
- Ministry of Education, Youth and Sports of the Czech Republic within research project CzechGeo.
- European Commission within the framework of the JOULE II Project "Integrated Structural Imaging of Seismic Data".
- Members of consortium "Seismic Waves in Complex 3-D Structures".