Task: Generate Model File
To compute travel times and ray paths for a model, you need to store the model in
a .nd file. The file format is adopted from the TauP Toolkit by Crotwell et al. (1999),
but I have introduced some slight enhancements. A Detailed description is given in the
section on File Formats.
The easiest way to learn about .nd files is probably to look into an existing one. The format
is rather simple and human-beings-friendly.
There are essentially three ways to generate a .nd file:
- type it by hand
- write it using MKWRITEND, MODEL structure as input
- write it using MKWRITEND, 1D arrays as input
These methods are described in the following sections.
IMPORTANT: TTBOX needs the core mantle boundary and the inner core boundary
being defined. Without defining these discontinuities, MKX4P and MKTIM4P will
crash sooner or later, since CMB and ICB depths are used to restrict ray parameter
ranges.
The .nd file format is essentially a table. You mainly have to enter depths, velocities,
densities and Q factors into an ASCII file. If some of these quantities are not specified
in your model, don't worry, there are ways to leave values undefined. (However, if it is the
depths that are not defined, you will not get very far with your model...)
To put your model data into an .nd file, follow these steps:
- Open a new ASCII file.
- Define the model name.
To do so, enter a line beginning with "!name", followed by a blank and the model's name:
!name IASP91
- Define the Planet's Radius.
To do so, enter a line beginning with "!radius", followed by a blank and the planet's
radius in km:
!radius 6371
If you do not define the radius explicitly with this keyword, TTBOX will assume that
the deepest layer in the model describes the planet's center.
- Enter the model data.
Each line consists of up to six physical parameters. These
Parameters are (in the sequence they are to be entered):
- depth in km
- P-wave velocity vp in km/s
- S wave velocity vs in km/s
- density ρ in g/ccm
- P wave quality factor Qp, dimensionless
- S wave quality factor Qs, dimensionless
Values may be entered in fixed point or floating point format, as you like.
Separate entries by space (ASCII 32) or Tab stops (ASCII 9). A typical data line might
look like this:
0.000 5.8 3.20 2.60 1451.91656 600.00
If a certain value is not specified, enter -1.
At discontinuities, enter two lines with identical depth
values: one for the upper side of the discontinuity, one for the lower side:
24.400 6.80000 3.90000 2.90000 1345.91217 600.00000
24.4 8.11062 4.49100 3.38075 1441.7098 600
- Name the standard discontinuities.
To name a discontinuity, enter its name in a new line between the two lines that
define properties above and below the discontinuity. Discontinutiy names are
not case sensitive. A table of Standard Discontinuity Names is given in the
General Section of the Tutorial.
However, you can use any name for non-standard Discontinuities.
The following lines define a Moho at 24.4km depth:
24.400 6.80000 3.90000 2.90000 1345.91217 600.00000
moho
24.4 8.11062 4.49100 3.38075 1441.7098 600
- If you wish, you may add comments.
A comment begins with one of the character sequences "#", "/*" or "//" and ends at the
end of the line in which it begins. You may insert comment lines between data lines,
or you may append a comment at the end of any line. Comments are stripped off before
evaluating the file.
- Save the file.
- Set up a MODEL structure of your velocity model. For a description of such structures,
see the subsection "model" in the section on Data Structures.
- execute mkwritend(model,path);
where path is the full path and filename to store the file at.
In order to write a model file with MKREADND, you may also enter your model into several
1D arrays. You also need a string matrix containing all discontinuity names. The names of these
variables do not matter, the names used in the following are as used internally in MKWRITEND.
If your model contains first order discontinuities, it is necessary to enter parameters
for the upper and lower side of the discontinuity separately.
- Set up the following variables:
- name
- This is a string containing the model name.
- year
- This is a numeric scalar, denoting the year in which the model
was published (or constructed, if the model is unpublished).
- radius
- This is a numeric scalar, denoting the radius of the planet in km.
- Set up the following 1D arrays:
- z=[z1 z2 z3 ... zn];
- depth values in km (the z1, z2, z3, ..., zn being the depths at which your model is defined)
- vp
- P wave velocities in km/s at the depths given in z
- vs
- S wave velocities in km/s at the depths given in z
- rho
- densities in g/cm3 at the depths given in z
- qp
- P wave Q factors at the depths given in z
- qs
- S wave Q factors at the depths given in z
- dz
- discontinuity depths in km
- Use strvcat to set up a string matrix dname for
the discontinuity names. The first discontinuity corresponds to depth dz(1):
dz=[24 410 2890];
dname=strvcat('moho','olivine alpha beta','cmb');
defines a moho at 24km, the Olivine-&alpha to β-spinel phase transition at 410km and
the core-mantle-boundary at 2890km depth.
- call mkwritend(name,year,radius,z,vp,vs,rho,qp,qs,dz,dname,path); where
path defines the complete path and filename under which the file
is to be stored.
- If you wish, you may now open the newly written file with any ASCII editor and
add comments.
A comment begins with one of the character sequences "#", "/*" or "//" and ends at the
end of the line in which it begins. You may insert comment lines between data lines,
or you may append a comment at the end of any line. Comments are stripped off before
evaluating the file.
eof.