Skip to content

Commit 753eb05

Browse files
committed
zoeppritz2
1 parent e5636b7 commit 753eb05

File tree

3 files changed

+122
-3
lines changed

3 files changed

+122
-3
lines changed

system/seismic/Mzoeppritz2.c

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/* Generate angle gathers using the Zoeppritz equation */
2+
/*
3+
Copyright (C) 2008 University of Texas at Austin
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program; if not, write to the Free Software
17+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
*/
19+
#include <rsf.h>
20+
21+
#include "zoeppritz.h"
22+
23+
int main(int argc, char* argv[])
24+
{
25+
bool incp, outp, refl;
26+
int ia, na, icoef, j, i1, i2, n1, n2, n3;
27+
float vp1,vp2,vs1,vs2,rho1,rho2;
28+
float a0, da, a, rc[4], ang[4], *r;
29+
float *vpt, *vst, *rhot;
30+
sf_file vp, vs, rho, out;
31+
32+
sf_init(argc,argv);
33+
vp = sf_input("in");
34+
vs = sf_input("vs");
35+
rho = sf_input("rho");
36+
out = sf_output("out");
37+
38+
if (SF_FLOAT != sf_gettype(vp)) sf_error("Need float type");
39+
if (!sf_histint(vp, "n1", &n1)) sf_error("Need n1=");
40+
n2 = sf_leftsize(vp, 1); /* number of traces */
41+
42+
vpt = sf_floatalloc(n1);
43+
vst = sf_floatalloc(n1);
44+
rhot = sf_floatalloc(n1);
45+
46+
n3 = sf_shiftdim(vp, out, 1);
47+
if (n3 != n1*n2) sf_error("size mismatch");
48+
49+
if (!sf_getint("na",&na)) na=90;
50+
/* number of angles */
51+
52+
if (!sf_getfloat("a0",&a0)) a0=0.;
53+
/* first angle */
54+
55+
if (!sf_getfloat("da",&da)) da=90./na;
56+
/* angle increment */
57+
58+
sf_putint(out,"n1",na);
59+
sf_putfloat(out,"o1",a0);
60+
sf_putfloat(out,"d1",da);
61+
62+
sf_putstring(out,"label1","Incident Angle");
63+
sf_putstring(out,"unit1","\\^o\\_");
64+
65+
a0 *= SF_PI/180.;
66+
da *= SF_PI/180.;
67+
68+
r = sf_floatalloc(na);
69+
70+
if (!sf_getint("icoef",&icoef)) icoef=4;
71+
/* [1,2,3,4] particle displacement, displacement potential, energy, real part */
72+
73+
if (!sf_getbool("incp",&incp)) incp=true;
74+
/* incident P (or S) */
75+
76+
if (!sf_getbool("outp",&outp)) outp=true;
77+
/* rellected/transmitted P (or S) */
78+
79+
if (!sf_getbool("refl",&refl)) refl=true;
80+
/* reflection or transmission */
81+
82+
if (outp) {
83+
j = refl? 0:2;
84+
} else {
85+
j = refl? 1:3;
86+
}
87+
88+
89+
for (i2=0; i2 < n2; i2++) {
90+
sf_floatread(vpt,n1,vp);
91+
sf_floatread(vst,n1,vs);
92+
sf_floatread(rhot,n1,rho);
93+
94+
vp1 = vpt[0];
95+
vs1 = SF_MAX(vst[0],SF_EPS);
96+
rho1 = rhot[0];
97+
for (i1=0; i1 < n1; i1++) {
98+
vp2 = vpt[i1];
99+
vs2 = SF_MAX(vst[i1],SF_EPS);
100+
rho2 = rhot[i1];
101+
102+
for (ia=0; ia < na; ia++) {
103+
a = a0 + ia*da;
104+
a = incp? sinf(a)/vp1: sinf(a)/vs1;
105+
106+
zoeppritz (icoef,vp1,vp2,vs1,vs2,rho1,rho2,incp,a,rc,ang);
107+
r[ia] = rc[j];
108+
}
109+
110+
sf_floatwrite(r,na,out);
111+
112+
vp1 = vp2;
113+
vs1 = vs2;
114+
rho1 = rho2;
115+
}
116+
}
117+
118+
exit(0);
119+
}

system/seismic/SConstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ segyread segywrite shifts shoot2 shot2cmp shotconstkirch shotholes
2020
shotprop simivscan sin slant srmva srseidel srsyn sstep2 stacks stolt
2121
stolt2 stoltstretch stretch stripes tan2ang taupmo time2depth
2222
tlagtoang2d tshift txpscan txpnmo vczo vczo2 vczo3 velmod veltran voft
23-
vofz vscan xlagtoang2d zoeppritz zomig zomva
23+
vofz vscan xlagtoang2d zoeppritz zoeppritz2 zomig zomva
2424
'''
2525

2626
libsrc = 'segy'

system/seismic/zomig.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void zomig_close(void)
156156

157157
/*------------------------------------------------------------*/
158158

159-
void zomig_aloc()
159+
void zomig_aloc(void)
160160
/*< allocate migration storage >*/
161161
{
162162
qq = sf_floatalloc2(amx.n,amy.n);
@@ -165,7 +165,7 @@ void zomig_aloc()
165165
}
166166
}
167167

168-
void zomig_free()
168+
void zomig_free(void)
169169
/*< free migration storage >*/
170170
{
171171
free( *qq); free( qq);

0 commit comments

Comments
 (0)