-
Notifications
You must be signed in to change notification settings - Fork 7
/
prem.h
88 lines (66 loc) · 2.05 KB
/
prem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
header file for PREM utilities
$Id: prem.h,v 1.4 2006/04/18 01:08:39 twb Exp twb $
*/
#ifndef __READ_PREM_HEADER__
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define PREM_F_STRING "%lf"
/* default number of layers */
#define PREM_N 13
/* number of coefficients */
#define PREM_NP 4
#ifndef hc_boolean
#define hc_boolean unsigned short
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*
PREM model structure
*/
struct prem_model{
double crho[PREM_N*PREM_NP]; /* density parameters */
double cvp[PREM_N*PREM_NP]; /* v_p */
double cvs[PREM_N*PREM_NP]; /* v_s */
double cvpv[PREM_N*PREM_NP]; /* anisotropic velocities */
double cvph[PREM_N*PREM_NP];
double cvsv[PREM_N*PREM_NP];
double cvsh[PREM_N*PREM_NP];
double ceta[PREM_N*PREM_NP]; /* anisotropy parameter */
double cqmu[PREM_N]; /* q factors */
double cqkappa[PREM_N];
int n; /* number of layers */
int np; /* number of polynomial coefficients
in general (except qmu and qkappa)
*/
double rb[PREM_N]; /* top boundary of layers, in meters */
double r[PREM_N]; /* non-dimensionalized version */
double r0; /* surface r in meters */
char model_filename[2000]; /* model file name */
hc_boolean init;
};
/*
constants:
radius of earth in km
*/
#define PREM_RE_KM 6371.0087714
/*
functions
*/
int prem_find_layer_x(double, double, double *, int, int, double *);
double prem_compute_pval(double *, double *, int, double);
double prem_compute_dpval(double *, double *, int, double);
double prem_vs_voigt(double, double, double, double, double);
void prem_get_rhodrho(double *, double *, double, struct prem_model *);
void prem_get_rho(double *, double, struct prem_model *);
void prem_get_values(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, struct prem_model *);
int prem_read_model(char *, struct prem_model *, unsigned short);
int prem_read_para_set(double *, int, int, FILE *);
#define __READ_PREM_HEADER__
#endif