Fortran 77 package CRT version 7.50

Prague, December 2018
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.

The code of the complete ray tracing subroutine package CRT is build up on the basis of the model specification subroutine package MODEL. Thus this general description of C.R.T. should be understood as a continuation of the general description 'modeldoc.htm' of the seismic model specification subroutines.

Copyright note

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.

General remarks on the SW3D software

General description

Programming language, error messages, screen output, etc.

Unified memory management.

History files.

Alphabetical list of input parameters of all programs.

New in version 7.50

Compiling and linking programs of package CRT

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.

If linking 'crt.for' with a compiler's CalComp graphics library (e.g., with Lahey's F77L3 'graph3.lib' on a PC) in order to enable graphic screen output, do not forget to adjust the CalComp plotting area in 'scro.for'.

Compilation and linking:

Running programs of package CRT

All Fortran 77 source code and include files together with all the Perl scripts and data files of packages FORMS, MODEL and CRT 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, and 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 CRT

The Complete Ray Tracing consists of packages FORMS, MODEL and of the following FORTRAN77 source code and demo files:

(A) Documentation:
crt.htm
This file (main HTML file containing basic description and links to the files of this package).
crtver.htm
List of the released versions.
crterr.htm
List of error messages with the links to their descriptions.
(B) Basic complete ray tracing program and subroutines:
These files together with the forward modelling model specification routines of files 'model.for', 'metric.for', 'srfc.for', 'parm.for', 'val.for', 'fit.for' form a consistent basic version of the complete ray tracing program.
crt.for
Main program CRT for Complete Ray Tracing. It reads the input data and then controls the complete ray tracing of the specified elementary waves.
Input data are read in by the subroutine CRTIN of file 'crtin.for', called by main program CRT. The input data are described in file crtin.for.
Outputs written into disk files are concentrated in subroutine file writ.for.
Screen output is concentrated in subroutine file 'scro.for', in subroutines SCRO1, SCRO2, SCRO3, SCRO4 and SCRO5. Refer to file 'scro.for' for the description of the screen output, both textual and graphical. Users are encouraged to customize the screen output by means of preparing their own versions of 'scro.for'.
a) Textual screen output: Textual screen output is available on all the systems. The number of the source, the number of the wave, the number of the ray, activity, ray parameters, history, and end of the ray may be printed according to the user's selection of the input parameters for the textual screen output.
b) Graphical screen output: All graphic outputs are concentrated in the subroutine file 'scro.for', in subroutines SCRO1, SCRO2, SCRO3, SCRO4 and SCRO5. CalComp subroutines
PLOTS(0,0,0)
PLOT(XPAGE,YPAGE,IPEN)
NEWPEN(INP)
are called. Subroutine SYMBOL cannot be used because its CalComp specification is not conformal with the FORTRAN77 standard. Subroutine NUMBER is not employed. If the subroutines PLOTS, PLOT and NEWPEN are not present in the computer, they must be substituted by user-defined or void subroutines. The specification of their parameters can be found in the subroutine file scro.for. It is also possible to use the CalComp to Xlib interface calcompx.c, or the CalComp to PostScript interface calcops.for.
Edit INCLUDE commands at the end of the 'crt.for' program to enable screen graphics, and see also the input parameters for the graphical screen output.
Reasons of the termination of the computation of a ray are specified by the output parameter IEND of the subroutines INIT2 and RAY2 and are listed in the subroutine files ray.for (reasons 10 to 75) and init.for (reasons 71 to 75).
List of the computed quantities is given in the package ray.for.
crtin.for
Subroutines designed to open the data files for complete ray tracing and to read the input data sets CRT, MODEL, DCRT and INIT. Called e.g. by the main program 'crt.for'.
code.for
Subroutine file devoted to the codes for elementary waves. Contains the general description of the codes for elementary waves and subroutines designed to read the input data for the codes of elementary waves and to transform the used numerical code of the elementary wave under consideration into instructions specifying the behaviour of the wave at the initial points of rays and at all points of incidence of the rays at interfaces (see C.R.T.4).
code.inc
Include file with COMMON block for 'code.for'.
ray.for
Contains the subroutine designed to read the input data for complete ray tracing and to store them in the memory (see C.R.T.5.6), the list of the quantities computed along rays (see C.R.T.5.2), and the subroutine designed to continue the complete ray tracing of a ray from the given point (see C.R.T.5.7).
dcrt.inc
Include file with COMMON block with data controlling ray tracing. The data are read by 'ray.for' and are used by various ray tracing routines.
raycb.for
Subroutines for complete ray tracing within one complex block (see C.R.T.5.8).
raycb.inc
Include file with COMMON block for 'raycb.for'.
trans.for
Subroutine transforming the computed quantities across a curved interface (see C.R.T.5.9), and subroutine replacing the amplitudes by ones involving the appropriate conversion coefficients (see C.R.T.5.5.4).
coef.for
Subroutines computing the reflection/transmission coefficients (see C.R.T.5.9.7).
init.for
Subroutines designed to read the input data for the initial surface, and to define the initial values of the quantities for complete tracing of a ray with given take-off parameters (see C.R.T.6).
initd.inc
Include file with COMMON blocks for 'init.for', containing input data and related quantities.
initc.inc
Include file with COMMON block for 'init.for' and other routines, containing the quantities at the initial point of the ray being currently traced.
rpar.for
Subroutines controlling the take-off parameters of the rays. A user may introduce his own procedure of selection of the take-off parameters and his own two-point ray tracing algorithm by means of a modification of this subroutine file, or subsequently referred files 'rp2d.for' and 'rp3d.for' controlling the shooting algorithms.
rpard.inc
Include file with COMMON block for 'rpar.for', containing input data and related quantities.
rparc.inc
Include file with COMMON blocks for 'rpar.for' to record the ray histories and other related quantities.
rp2d.for
Subroutines controlling the one-parametric shooting algorithm determining the normalized take-off parameter of rays for 2-D two-point ray tracing.
rp2d.inc
Include file with COMMON block for 'rp2d.for'.
rp3d.for
Subroutines controlling the two-parametric shooting algorithm determining the normalized take-off parameters of rays for 3-D two-point ray tracing.
rp3d.inc
Include file with COMMON block for 'rp3d.for'.
rp3dnul.for
Void subroutines replacing 'rp3d.for' to save RAM if only 2-D ray tracing is performed. Not very interesting.
writ.for
Subroutines creating the output of complete ray tracing (see C.R.T.5.5).
writ.inc
Include file with COMMON blocks for 'writ.for'.
scro.for
Subroutine file for the screen output of program 'crt.for'. The screen output consists of a simple graphic output and of writing the brief messages on the status of the currently computed ray to the console. This output controls the console by means of the ANSI escape sequences supported by MS-DOS ANSI.SYS driver on IBM-compatible personal computers, and by the '+' ASA carriage control character in the first column to avoid line feed. This console output is just an example, the subroutines SCRO1, SCRO2, SCRO3, SCRO4 and SCRO5 have to be modified by a user for the particular computer system. Graphic output is accomplished by means of invocation of 'CalComp' subroutines PLOTS, PLOT, and NEWPEN. They may be already available on some computers for some FORTRAN77 compilers (e.g., PLOTS, PLOT, and NEWPEN are included in the Lahey FORTRAN77 compilers for PC's). Otherwise, 'scro.for' may be linked with 'plotnul.for' to disable plotting, or with user's own interface routines to his particular graphic system (see files 'plotnul.for' and 'calcomp.for').
scro.inc
Include file with COMMON block for 'scro.for'.
apw.for
Subroutines to write the quantities at the points of rays into unformatted output files.
pointc.inc
Include file with COMMON block /POINTC/ to store the quantities calculated at a point of a ray, used by 'apw.for' for writing to output files, by subroutine AP00 of of file 'ap.for' for reading from input files, and by subroutines of file 'ap.for' and other routines processing the results of the 'crt.for' program.
(C) The following subroutine files may be used to modify the basic version of the complete ray tracing program by means of additional screen output routines:
plotnul.for
Dummy version of the CalComp graphic containing the plot subroutines called by the subroutines of the package 'scro.for', see also the section graphics of this guide.
calcomp.cfg
Configuration file to the 'calcomp.for' routines, disabling the interactive communication and other features of 'calcomp.for' not required by the 'scro.for' routines. The 'calcomp.cfg' configuration file is active just if located in the current directory. Otherwise, the 'calcomp.for' routines run in an interactive way and may create another 'calcomp.cfg' configuration file. Refer to the FORMS package.
calcompx.c
CalComp to Xlib interface containing the CalComp plotting routines PLOTS, PLOT and NEWPEN. For compilation and linking see crtx.mak.
crtx.mak
Makefile for compilation and linking CalComp to Xlib interface calcompx.c
containing the CalComp plotting routines PLOTS, PLOT and NEWPEN.
(D) Application routines and programs facilitating the processing of the results of complete ray tracing:
When using the complete ray tracing program composed of the subroutine files listed above, we determine and store various quantities along the ray and at the points of intersection of the ray with some selected surfaces. The following sets of routines may be utilized when processing the results of the complete ray tracing, including a kinematic inversion:
ap.for
Applications and processing of the results of complete ray tracing. Subroutines designed to read from the files the quantities describing the points of rays, and to evaluate many other quantities used in seismology and discussed in the chapter C.R.T.7. These subroutines may be included in user's application programs following the complete ray tracing program. Individual subroutines correspond to the individual sections of the chapter C.R.T.7, and may call many subroutines of the above files composing the complete ray tracing program.
an.for
Subroutines to modify the output of subroutines of file 'ap.for' in anisotropic media.
apvar.for
Subroutines designed to evaluate the variations of the travel time with respect to the model coefficients.
rpplot.for
Program RPPLOT plotting ray parameters using the output files of program 'crt.for'.
Description of input data.
rpplot.inc
Include file with COMMON block for 'rpplot.for'.
rpsymb.for
Auxiliary subroutine for 'rpplot.for' to plot centred symbols.
crtpfa.for
Program CRTPFA to calculate two prevailing-frequency coupling-ray-theory S-wave Green tensors along each input reference ray. The Green tensors are continuous along the reference ray. The input reference ray is then doubled. The first of the doubled rays is written with the first Green tensor, the second of the doubled rays with the second Green tensor. The program may be used to enable interpolation of the prevailing-frequency coupling-ray-theory S-wave Green tensors by program MTT.
Description of input data.
crtpfa.inc
Include file with COMMON block for 'crtpfa.for'.
pfatubes.for
Program PFATUBES to modify the file 'CRT-T' with indices of triangles in order to enable interpolation within ray tubes formed by rays written by program CRTPFA.
Description of input data.
pfatubes.inc
Include file with COMMON block for 'pfatubes.for'.
crt2d3d.for
Program CRT2D3D to transform 2-D system of rays to 3-D system of rays to be processed by program MTT, which previous versions worked only in 3-D.
Description of input data.
mtt.for
Program MTT to calculate Multivalued Travel Times on a 3-D grid of points by means of bicubic interpolation within ray cells, and to calculate other quantities on the 3-D grid of points by means of bilinear interpolation within ray cells. Program MTT uses the rays stored in the output files of program CRT.
Description of input data.
mttq.for
Subroutine file to deal with the user-defined quantities to be interpolated by program MTT. A user is welcome to edit this file according to the instructions provided. He may read his input parameters and define new quantities in the points of the rays.
mtt.inc
Include file with COMMON block for 'mtt.for'.
mttwf.inc
Include file with COMMON block for 'mtt.for' and 'wfsrf.for'.
wfsrf.for
Program WFSRF using output files of program CRT to generate wavefronts composed of polygons for display purposes.
Description of input data.
wfsrf.inc
Include file with COMMON block for 'wfsrf.for'.
mttgrd.for
Program MTTGRD to convert multivalued travel times produced by program MTT into several singlevalued grids corresponding to individual ray histories.
Description of input data.
crt2p.for
Program CRT2P to single out two-point rays in the unformatted output program CRT. Simple illustrative example how to use 'ap.for'.
Description of input data.
crtcart.for
Program CRTCART to convert the rays calculated by program CRT from curvilinear to Cartesian coordinates, which are required by 'mtt.for'.
Description of input data.
crtout.for
Subroutines to facilitate conversion of the unformatted output of program CRT into formatted files.
ttsort.for
Subroutine to sort the quantities according to the receivers, and at each receiver according to the increasing travel time.
crtray.for
Program CRTRAY converting the unformatted output of program CRT into formatted files with rays suitable for plotting.
Description of input data.
crtpts.for
Program CRTPTS converting the unformatted output of program CRT into formatted file with endpoints of rays.
Description of input data.
crtlew.for
Program CRTLEW to calculate the directions of the projections of the ray segments into the given 2-D section, and to calculate the length of all ray segments according to the given angular intervals. The output then may be used, e.g., as weights for calculation of Lyapunov exponents.
Description of input data.
green.for
Program GREEN to convert the unformatted output of program CRT into a formatted file containing the ray-theory elastodynamic Green function.
Description of input data.
wan.for
Subroutines to compute quantities along a ray necessary for computation of the Green function by means of coupling ray-theory in weakly anisotropic models without interfaces. Subroutines to calculate second order perturbations. Called by 'green.for'.
wanpfa.for
Subroutines called by 'wan.for' and 'crtpfa.for'.
greenti.for
Program GREENTI to read two formatted output files of program GREEN containing Green tensors calculated by the prevailing-frequency approximation of the coupling ray theory along the SH-wave and SV-wave rays, and to generate new file containing the more accurate Green tensor composed of the two input Green tensors.
Description of input data.
watable.for
Program WATABLE to calculate differences between travel times and their approximations by the second order perturbations.
greenss.for
Program GREENSS to read a formatted file containing the ray-theory elastodynamic Green function and to generate ray-theory time-domain synthetic seismograms (without attenuation) or frequency-domain response functions (including causal Futterman's attenuation).
Description of input data.
rm.for
Interface between program 'greenss.for' and package RMATRIX.
rmnul.for
File containing void versions of two subroutines called by program 'greenss.for'.
invtt.for
Program INVTT designed to evaluate the derivatives of the travel time with respect to the model coefficients.
Description of input data.
(E) Perl scripts:
srpcrt.pl
Perl script to generate coordinates of the source and receiver points for given configuration parameters, perform two-point ray tracing, and convert unformatted output into a simple formatted file. It runs programs 'srp', 'crt' and 'crtpts'.
fcrt.pl
Perl script to compile the CRT package by means of predefined script 'f.pl' compiling and linking a single Fortran 77 source code file.
(F) Universal and demo data files:
codep.dat
Data specifying only the refracted P wave.
codep2.dat
Additional input data file for the CRT program, specifying the codes of 3 elementary P waves (2 reflected).
codes.dat
Data specifying only the refracted S wave.
writ.dat
Additional input data file for the CRT program, with names of the output files. Whole two-point rays are stored in files corresponding to individual elementary waves and the points of intersection with given surfaces are stored in files corresponding to individual surfaces.
writall.dat
Alternative data file specifying the names of the output files. All whole rays are stored, not only two-point rays.
writsrf.dat
Alternative data file specifying the names of the output files. No whole rays are stored. The points of intersection with given surfaces are stored in files corresponding to individual surfaces.
writnul.dat
Alternative data file specifying the names of the output files. Nothing is written.
source.dat
Sample main input data for the GREENSS program to specify the point source (moment-tensor or single-force seismic source).
sourcex.dat
Data specifying the seismic moment tensor of an explosive source (extracted from examples in 'source.dat').

Data related to particular models

Acknowledgements

The development of the complete ray tracing algorithm and the related Fortran 77 packages has been partially supported by:

References