pdf 260K - Madagascar
pdf 260K - Madagascar
pdf 260K - Madagascar
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Homework 1<br />
Isaac Newton<br />
ABSTRACT<br />
This homework has three parts. In the theoretical part, you will derive some new<br />
forms of ray tracing equations and their solutions. In the computational part,<br />
you will experiment with wave propagation in a simple synthetic model. In the<br />
programming part, you will modify a finite-difference wave modeling program.<br />
PREREQUISITES<br />
Completing the computational part of this homework assignment requires<br />
• <strong>Madagascar</strong> software environment available from<br />
http://www.ahay.org<br />
• L A TEX environment with SEGTeX available from<br />
http://www.ahay.org/wiki/SEGTeX<br />
You are welcome to do the assignment on your personal computer by installing<br />
the required environments. In this case, you can obtain all homework assignments<br />
from the <strong>Madagascar</strong> repository by running<br />
svn co http://svn.code.sf.net/p/rsf/code/trunk/book/geo384w/hw1<br />
You can also do this assignment in the computer lab at the Department of Geological<br />
Sciences (JGB 3.216B).<br />
THEORETICAL PART<br />
You can either write your answers on paper or edit them in the file hw1/paper.tex.<br />
Please show all the mathematical derivations that you perform.<br />
1. In class, we used a mysterious parameter σ to represent a variable continuously<br />
increasing along a ray. There are other variables that can play a similar role.
2<br />
(a) Transform the isotropic ray tracing system<br />
dp<br />
dσ<br />
= S(x) ∇S (1)<br />
dx<br />
dσ = p (2)<br />
dT<br />
dσ = S2 (x) (3)<br />
into an equivalent system that uses ξ instead of σ, where ξ is constrained<br />
by equation (4):<br />
dp<br />
dξ<br />
dx<br />
dξ<br />
dT<br />
dξ<br />
What are the physical units of ξ?<br />
= ∇S<br />
S 2 (x)<br />
(4)<br />
= (5)<br />
= (6)<br />
(b) Suppose you are given T (x) – the traveltime from the source to all points<br />
x in the domain of interest. Your task is to find ξ(x) for all x. Derive a<br />
first-order partial differential equation that connects ∇ξ and ∇T .<br />
2. The so-called “parabolic” or 15 ◦ eikonal equation (Tappert, 1977; Claerbout,<br />
1985; Bamberger et al., 1988) has the form<br />
∂T<br />
+ 1<br />
∂x 1 2 S(x)<br />
( ∂T<br />
∂x 2<br />
) 2<br />
= S(x) (7)<br />
where x = {x 1 , x 2 } is a point in space, T (x) is the traveltime, and S(x) is<br />
slowness.<br />
(a) Derive the ray tracing system for equation (7)<br />
dx 2<br />
dx 1<br />
= (8)<br />
dp 1<br />
dx 1<br />
= (9)<br />
dp 2<br />
dx 1<br />
= (10)<br />
dT<br />
dx 1<br />
= (11)<br />
where p 1 represents ∂T/∂x 1 and p 2 represents ∂T/∂x 2 .<br />
(b) Assuming constant slowness S(x) ≡ S 0 , solve the ray tracing system for a<br />
point source at the origin {x 1 , x 2 } = {0, 0}.
3<br />
(c) Using the ray tracing solution, find the shape of the wavefronts defined by<br />
equation (7 in the case of a constant slowness.<br />
(d) The isotropic eikonal equation<br />
describes wavefronts of the wave equation<br />
( ) 2 ( ) 2<br />
∂T ∂T<br />
+ = S 2 (x) (12)<br />
∂x 1 ∂x 2<br />
S 2 (x) ∂2 P<br />
∂t 2 = ∇2 P + · · · (13)<br />
with omitted possible first- and zero-order terms.<br />
corresponds to equation (7)?<br />
What wave equation<br />
S(x) ∂2 P<br />
∂t 2 = (14)<br />
COMPUTATIONAL PART<br />
In this part, we will simulate and observe acoustic wave propagation in a simple<br />
velocity model shown in Figure 1a. A wave snapshot is shown in Figure 1b.<br />
1. Change directory to geo384w/hw1/wave<br />
2. Run<br />
scons model.view<br />
to generate and view the velocity model from Figure 1a.<br />
3. Run<br />
scons wave.vpl<br />
to generate and observe a propagating wave on your screen.<br />
4. Run<br />
scons fronts.vpl<br />
to generate and observe a propagating first-arrival wavefront on your screen.<br />
5. Run<br />
scons snap.view
4<br />
a<br />
b<br />
Figure 1: (a) Velocity model for simple wave propagation experiments. (b) Wave<br />
snapshot with overlaid first-arrival wavefront.
5<br />
to generate and view a wave snapshot selected at 1 s as shown in Figure 1b.<br />
6. Open the file SConstruct in your favorite editor. Your task is to make the<br />
following modifications in it:<br />
• Find a parameter responsible for selecting the time frame for the snapshot<br />
in Figure 1b. Modify it to increase the time from 1 s to your favorite point<br />
in the movie. Run scons snap.view again to verify your change.<br />
• Can you observe a geometrical part of the wave that is not captured by<br />
the first-arrival wavefront? What is its physical meaning?<br />
• Find a parameter in the SConstruct file responsible for the vertical smoothness<br />
of the model in Figure 1a. Modify it to increase the smoothness of<br />
the model in such a way that the first-arrival wavefront follows the wave<br />
geometry exactly. Run scons snap.view again to verify your change.<br />
• (EXTRA CREDIT) For extra credit, modify SConstruct to generate a<br />
movie of pictures like Figure 1b for a gradually increasing smoothness.<br />
1 from r s f . p r o j import ∗<br />
2<br />
3 # Make a v e l o c i t y model with a h y p e r b o l i c r e f l e c t o r<br />
4 Flow ( ’ model ’ , None ,<br />
5 ’ ’ ’<br />
6 math n1=301 o1=−1 d1=0.01 output=” s q r t (1+x1∗x1 )” |<br />
7 u n i f 2 n1=201 d1=0.01 v00 =1,2 |<br />
8 put l a b e l 1=Depth unit1=km l a b e l 2=L a t e r a l unit2=km<br />
9 l a b e l=V e l o c i t y u n i t=km/ s |<br />
10 smooth r e c t 1=3<br />
11 ’ ’ ’ )<br />
12<br />
13 # Plot model<br />
14 Result ( ’ model ’ ,<br />
15 ’ ’ ’<br />
16 grey a l l p o s=y t i t l e =Model b i a s=1<br />
17 s c a l e b a r=y b a r r e v e r s e=y<br />
18 ’ ’ ’ )<br />
19<br />
20 # Source w a v e l e t<br />
21 Flow ( ’ wavelet ’ , None ,<br />
22 ’ ’ ’<br />
23 s p i k e nsp=1 n1=2000 d1 =0.001 k1=201 |<br />
24 r i c k e r 1 frequency=10<br />
25 ’ ’ ’ )<br />
26<br />
27 # Extended model ( f o r a b s o r b i n g boundaries )
6<br />
28 Flow ( ’ l e f t ’ , ’ model ’ ,<br />
29 ’ ’ ’<br />
30 window n2=1 | spray a x i s=2 n=50 o=−1.5 d=0.01 |<br />
31 math output=”input ∗ exp(−4∗(−1−x2 )ˆ2)”<br />
32 ’ ’ ’ )<br />
33 Flow ( ’ r i g h t ’ , ’ model ’ ,<br />
34 ’ ’ ’<br />
35 window n2=1 f2 =300 | spray a x i s=2 n=50 o=3.01 d=0.01 |<br />
36 math output=”input ∗ exp(−4∗(3−x2 )ˆ2)”<br />
37 ’ ’ ’ )<br />
38 Flow ( ’ emodel2 ’ , ’ l e f t model r i g h t ’ ,<br />
39 ’ cat a x i s=2 ${SOURCES[ 1 : 3 ] } ’ )<br />
40<br />
41 Flow ( ’ top ’ , ’ emodel2 ’ ,<br />
42 ’ ’ ’<br />
43 window n1=1 | spray a x i s=1 n=50 o=−0.5 d=0.01 |<br />
44 math output=”input ∗ exp(−4∗x1 ˆ2)”<br />
45 ’ ’ ’ )<br />
46 Flow ( ’ bottom ’ , ’ emodel2 ’ ,<br />
47 ’ ’ ’<br />
48 window n1=1 f1 =200 | spray a x i s=1 n=50 o=2.01 d=0.01 |<br />
49 math output=”input ∗ exp(−4∗(2−x1 )ˆ2)”<br />
50 ’ ’ ’ )<br />
51 Flow ( ’ emodel ’ , ’ top emodel2 bottom ’ ,<br />
52 ’ cat a x i s=1 ${SOURCES[ 1 : 3 ] } ’ )<br />
53<br />
54 # Source l o c a t i o n<br />
55 Flow ( ’ source ’ , None ,<br />
56 ’ ’ ’<br />
57 s p i k e k1=101 k2=251<br />
58 n2=401 o2=−1.5 d2=0.01 l a b e l 1=Depth unit1=km<br />
59 n1=301 o1=−0.5 d1=0.01 l a b e l 2=L a t e r a l unit2=km<br />
60 ’ ’ ’ )<br />
61<br />
62 # Modeling<br />
63 exe = Program ( ’ wave . c ’ )<br />
64 Flow ( ’ wave ’ , ’ source %s wavelet emodel ’ % exe [ 0 ] ,<br />
65 ’ ’ ’<br />
66 . / ${SOURCES[ 1 ] } wav=${SOURCES[ 2 ] } v=${SOURCES[ 3 ] }<br />
67 j t =5 f t =200<br />
68 ’ ’ ’ )<br />
69<br />
70 # Movie o f wave snapshots<br />
71 Plot ( ’ wave ’ ,<br />
72 ’ ’ ’
7<br />
73 window f 1 =50 f2=50 n1=201 n2=301 |<br />
74 grey gainpanel=a l l t i t l e =Wave<br />
75 ’ ’ ’ , view=1)<br />
76<br />
77 # Your f a v o r i t e time moment<br />
78 ###########################<br />
79 time = 1 . 0 # ! ! ! MODIFY ME<br />
80 ###########################<br />
81<br />
82 # Wavefield snapshot<br />
83 Plot ( ’ snap ’ , ’ wave ’ ,<br />
84 ’ ’ ’<br />
85 window f 1 =50 f2=50 n1=201 n2=301 n3=1 min3=%g |<br />
86 grey t i t l e =”Wave Snapshot at %g s ”<br />
87 l a b e l 1=Depth unit1=km l a b e l 2=L a t e r a l unit2=km<br />
88 ’ ’ ’ % ( time , time ) )<br />
89<br />
90 # First −a r r i v a l t r a v e l t i m e<br />
91 Flow ( ’ f i r s t ’ , ’ model ’ ,<br />
92 ’ e i k o n a l yshot=1 zshot =0.5 | add add=0.2 ’ )<br />
93<br />
94 # Movie o f f i r s t −a r r i v a l wavefronts<br />
95 f r o n t s = [ ]<br />
96 for snap in range ( 1 8 0 ) :<br />
97 f r o n t = ’ f r o n t%d ’ % snap<br />
98 f r o n t s . append ( f r o n t )<br />
99 tsnap = 0.2+ snap ∗0.01<br />
100 Plot ( front , ’ f i r s t ’ ,<br />
101 ’ contour nc=1 c0=%g t i t l e=”%g s ” ’ % ( tsnap , tsnap ) )<br />
102 Plot ( ’ f r o n t s ’ , f r o n t s , ’ Movie ’ , view=1)<br />
103<br />
104 # First −a r r i v a l wavefront<br />
105 Plot ( ’ f r o n t ’ , ’ f i r s t ’ ,<br />
106 ’ ’ ’<br />
107 contour nc=1 c0=%g w a n t t i t l e=n wantaxis=n<br />
108 p l o t c o l =3 p l o t f a t =5<br />
109 ’ ’ ’ % time )<br />
110<br />
111 # Overlay wavefront and t r a v e l t i m e<br />
112 Result ( ’ snap ’ , ’ snap f r o n t ’ , ’ Overlay ’ )<br />
113<br />
114 End ( )
8<br />
PROGRAMMING PART (EXTRA CREDIT)<br />
For extra credit, you can modify the wave modeling program to include anisotropic<br />
wave propagation effects. The program below (slightly modified from the original<br />
version by Paul Sava) implements wave modeling with equation<br />
∂ 2 P<br />
∂t 2<br />
= V 2 (x) ∇ 2 P + F (x, t) = V 2 (x)<br />
( ∂ 2 P<br />
∂x 2 1<br />
+ ∂2 P<br />
∂x 2 2<br />
)<br />
+ F (x, t) , (15)<br />
where F (x, t) is the source term. The implementation uses finite-difference discretization<br />
(second-order in time and fourth-order in space). Stepping in time involves the<br />
following computations:<br />
P t+∆t = [ V 2 (x) ∇ 2 P t + F (x, t) ] ∆t 2 + 2P t − P t−∆t , (16)<br />
where P represents the propagating wavefield discretized at different time steps.<br />
1 /∗ 2−D f i n i t e −d i f f e r e n c e a c o u s t i c wave propagation ∗/<br />
2 #include <br />
3<br />
4 #i f d e f OPENMP<br />
5 #include <br />
6 #endif<br />
7<br />
10<br />
8 static int n1 , n2 ;<br />
9 static float c0 , c11 , c21 , c12 , c22 ;<br />
11 static void l a p l a c i a n ( float ∗∗ uin /∗ [ n2 ] [ n1 ] ∗/ ,<br />
12 float ∗∗ uout /∗ [ n2 ] [ n1 ] ∗/ )<br />
13 /∗ Laplacian operator , 4 th−order f i n i t e −d i f f e r e n c e ∗/<br />
14 {<br />
15 int i1 , i 2 ;<br />
16<br />
17 #i f d e f OPENMP<br />
18 #pragma omp p a r a l l e l for \<br />
19 p r i v a t e ( i2 , i 1 ) \<br />
20 shared ( n2 , n1 , uout , uin , c11 , c12 , c21 , c22 , c0 )<br />
21 #endif<br />
22 for ( i 2 =2; i 2 < n2 −2; i 2++) {<br />
23 for ( i 1 =2; i 1 < n1 −2; i 1++) {<br />
24 uout [ i 2 ] [ i 1 ] =<br />
25 c11 ∗( uin [ i 2 ] [ i1 −1]+uin [ i 2 ] [ i 1 +1]) +<br />
26 c12 ∗( uin [ i 2 ] [ i1 −2]+uin [ i 2 ] [ i 1 +2]) +<br />
27 c21 ∗( uin [ i2 −1][ i 1 ]+ uin [ i 2 +1][ i 1 ] ) +<br />
28 c22 ∗( uin [ i2 −2][ i 1 ]+ uin [ i 2 +2][ i 1 ] ) +<br />
29 c0 ∗ uin [ i 2 ] [ i 1 ] ;<br />
30 }
9<br />
31 }<br />
32 }<br />
33<br />
34 int main ( int argc , char∗ argv [ ] )<br />
35 {<br />
36 int i t , i1 , i 2 ; /∗ index v a r i a b l e s ∗/<br />
37 int nt , n12 , ft , j t ;<br />
38 float dt , d1 , d2 , dt2 ;<br />
39<br />
40 float ∗ww,∗∗ vv ,∗∗ r r ;<br />
41 float ∗∗u0 ,∗∗ u1 ,∗∗ u2 ,∗∗ ud ;<br />
42<br />
43 s f f i l e Fw, Fv , Fr , Fo ; /∗ I /O f i l e s ∗/<br />
44<br />
45 /∗ i n i t i a l i z e <strong>Madagascar</strong> ∗/<br />
46 s f i n i t ( argc , argv ) ;<br />
47<br />
48 /∗ i n i t i a l i z e OpenMP support ∗/<br />
49 omp init ( ) ;<br />
50<br />
51 /∗ setup I /O f i l e s ∗/<br />
52 Fr = s f i n p u t ( ” in ” ) ; /∗ source p o s i t i o n ∗/<br />
53 Fo = s f o u t p u t ( ” out ” ) ; /∗ output w a v e f i e l d ∗/<br />
54<br />
55 Fw = s f i n p u t ( ”wav” ) ; /∗ source w a v e l e t ∗/<br />
56 Fv = s f i n p u t ( ”v” ) ; /∗ v e l o c i t y ∗/<br />
57<br />
58 /∗ Read/Write axes ∗/<br />
59 i f ( ! s f h i s t i n t ( Fr , ”n1”,&n1 ) ) s f e r r o r ( ”No n1= in inp ” ) ;<br />
60 i f ( ! s f h i s t i n t ( Fr , ”n2”,&n2 ) ) s f e r r o r ( ”No n2= in inp ” ) ;<br />
61 i f ( ! s f h i s t f l o a t ( Fr , ”d1”,&d1 ) ) s f e r r o r ( ”No d1= in inp ” ) ;<br />
62 i f ( ! s f h i s t f l o a t ( Fr , ”d2”,&d2 ) ) s f e r r o r ( ”No d2= in inp ” ) ;<br />
63<br />
64 i f ( ! s f h i s t i n t (Fw, ”n1”,&nt ) ) s f e r r o r ( ”No n1= in wav” ) ;<br />
65 i f ( ! s f h i s t f l o a t (Fw, ”d1”,&dt ) ) s f e r r o r ( ”No d1= in wav” ) ;<br />
66<br />
67 n12 = n1∗n2 ;<br />
68<br />
69 i f ( ! s f g e t i n t ( ” f t ”,& f t ) ) f t =0;<br />
70 /∗ f i r s t recorded time ∗/<br />
71 i f ( ! s f g e t i n t ( ” j t ”,& j t ) ) j t =1;<br />
72 /∗ time i n t e r v a l ∗/<br />
73<br />
74 s f p u t i n t (Fo , ”n3” , ( nt−f t )/ j t ) ;<br />
75 s f p u t f l o a t (Fo , ”d3” , j t ∗ dt ) ;
10<br />
76 s f p u t f l o a t (Fo , ”o3” , f t ∗ dt ) ;<br />
77<br />
78 dt2 = dt ∗ dt ;<br />
79<br />
80 /∗ s e t Laplacian c o e f f i c i e n t s ∗/<br />
81 d1 = 1 . 0 / ( d1∗d1 ) ;<br />
82 d2 = 1 . 0 / ( d2∗d2 ) ;<br />
83<br />
84 c11 = 4.0∗ d1 / 3 . 0 ;<br />
85 c12= −d1 / 1 2 . 0 ;<br />
86 c21 = 4.0∗ d2 / 3 . 0 ;<br />
87 c22= −d2 / 1 2 . 0 ;<br />
88 c0 = −2.0 ∗ ( c11+c12+c21+c22 ) ;<br />
89<br />
90 /∗ read wavelet , v e l o c i t y & source p o s i t i o n ∗/<br />
91 ww=s f f l o a t a l l o c ( nt ) ; s f f l o a t r e a d (ww , nt ,Fw) ;<br />
92 vv=s f f l o a t a l l o c 2 ( n1 , n2 ) ; s f f l o a t r e a d ( vv [ 0 ] , n12 , Fv ) ;<br />
93 r r=s f f l o a t a l l o c 2 ( n1 , n2 ) ; s f f l o a t r e a d ( r r [ 0 ] , n12 , Fr ) ;<br />
94<br />
95 /∗ a l l o c a t e temporary arrays ∗/<br />
96 u0=s f f l o a t a l l o c 2 ( n1 , n2 ) ;<br />
97 u1=s f f l o a t a l l o c 2 ( n1 , n2 ) ;<br />
98 u2=s f f l o a t a l l o c 2 ( n1 , n2 ) ;<br />
99 ud=s f f l o a t a l l o c 2 ( n1 , n2 ) ;<br />
100<br />
101 for ( i 2 =0; i2
11<br />
121 for ( i 1 =0; i1= f t && 0 == ( i t −f t )% j t ) {<br />
138 s f w a r n i n g ( ”%d ; ” , i t +1);<br />
139 s f f l o a t w r i t e ( u1 [ 0 ] , n12 , Fo ) ;<br />
140 }<br />
141 }<br />
142 s f w a r n i n g ( ” . ” ) ;<br />
143<br />
144 e x i t ( 0 ) ;<br />
145 }<br />
1 ! 2−D f i n i t e −d i f f e r e n c e a c o u s t i c wave propagation<br />
2 module l a p l a c e<br />
3 ! Laplacian operator , 4 th−order f i n i t e −d i f f e r e n c e<br />
4 implicit none<br />
5 real : : c0 , c11 , c21 , c12 , c22<br />
6 contains<br />
7 subroutine l a p l a c i a n s e t ( d1 , d2 )<br />
8 real , intent ( in ) : : d1 , d2<br />
9<br />
10 c11 = 4.0∗ d1 /3.0<br />
11 c12= −d1 /12.0<br />
12 c21 = 4.0∗ d2 /3.0<br />
13 c22= −d2 /12.0<br />
14 c0 = −2.0 ∗ ( c11+c12+c21+c22 )<br />
15 end subroutine l a p l a c i a n s e t<br />
16<br />
17 subroutine l a p l a c i a n ( uin , uout )<br />
18 real , dimension ( : , : ) , intent ( in ) : : uin<br />
19 real , dimension ( : , : ) , intent ( out ) : : uout
12<br />
20 integer n1 , n2<br />
21<br />
22 n1 = size ( uin , 1 )<br />
23 n2 = size ( uin , 2 )<br />
24<br />
25 uout ( 3 : n1 −2 ,3: n2−2) = &<br />
26 c11 ∗( uin ( 2 : n1 −3 ,3: n2−2) + uin ( 4 : n1 −1 ,3: n2 −2)) + &<br />
27 c12 ∗( uin ( 1 : n1 −4 ,3: n2−2) + uin ( 5 : n1 , 3 : n2 −2)) + &<br />
28 c21 ∗( uin ( 3 : n1 −2 ,2: n2−3) + uin ( 3 : n1 −2 ,4: n2 −1)) + &<br />
29 c22 ∗( uin ( 3 : n1 −2 ,1: n2−4) + uin ( 3 : n1 −2 ,5: n2 ) ) + &<br />
30 c0 ∗ uin ( 3 : n1 −2 ,3: n2−2)<br />
31 end subroutine l a p l a c i a n<br />
32 end module l a p l a c e<br />
33<br />
34 program Wave<br />
35 use r s f<br />
36 use l a p l a c e<br />
37 implicit none<br />
38<br />
39 integer : : i t , nt , ft , jt , n1 , n2<br />
40 real : : dt , d1 , d2 , dt2<br />
41<br />
42 real , dimension ( : ) , allocatable : : ww<br />
43 real , dimension ( : , : ) , allocatable : : vv , r r<br />
44 real , dimension ( : , : ) , allocatable : : u0 , u1 , u2 , ud<br />
45<br />
46 type ( f i l e ) : : Fw, Fv , Fr , Fo ! I /O f i l e s<br />
47<br />
48 c a l l s f i n i t ( ) ! i n i t i a l i z e <strong>Madagascar</strong><br />
49<br />
50 ! setup I /O f i l e s<br />
51 Fr = r s f i n p u t ( ” in ” ) ! source p o s i t i o n<br />
52 Fo = r s f o u t p u t ( ” out ” ) ! output w a v e f i e l d<br />
53<br />
54 Fw = r s f i n p u t ( ”wav” ) ! source w a v e l e t<br />
55 Fv = r s f i n p u t ( ”v” ) ! v e l o c i t y<br />
56<br />
57 ! Read/Write axes<br />
58 c a l l from par ( Fr , ”n1” , n1 )<br />
59 c a l l from par ( Fr , ”n2” , n2 )<br />
60 c a l l from par ( Fr , ”d1” , d1 )<br />
61 c a l l from par ( Fr , ”d2” , d2 )<br />
62<br />
63 c a l l from par (Fw, ”n1” , nt )<br />
64 c a l l from par (Fw, ”d1” , dt )
13<br />
65<br />
66 c a l l from par ( ” f t ” , ft , 0 ) ! f i r s t recorded time<br />
67 c a l l from par ( ” j t ” , jt , 0 ) ! time i n t e r v a l<br />
68<br />
69 c a l l t o p a r (Fo , ”n3” , ( nt−f t )/ j t )<br />
70 c a l l t o p a r (Fo , ”d3” , j t ∗ dt )<br />
71 c a l l t o p a r (Fo , ”o3” , f t ∗ dt )<br />
72<br />
73 dt2 = dt ∗ dt<br />
74 f t = f t +1<br />
75<br />
76 ! s e t Laplacian c o e f f i c i e n t s<br />
77 c a l l l a p l a c i a n s e t ( 1 . 0 / ( d1∗d1 ) , 1 . 0 / ( d2∗d2 ) )<br />
78<br />
79 ! read wavelet , v e l o c i t y & source p o s i t i o n<br />
80 allocate (ww( nt ) , vv ( n1 , n2 ) , r r ( n1 , n2 ) )<br />
81 c a l l r s f r e a d (Fw,ww)<br />
82 c a l l r s f r e a d (Fv , vv )<br />
83 c a l l r s f r e a d ( Fr , r r )<br />
84<br />
85 ! a l l o c a t e temporary arrays ∗/<br />
86 allocate ( u0 ( n1 , n2 ) , u1 ( n1 , n2 ) , u2 ( n1 , n2 ) , ud ( n1 , n2 ) )<br />
87<br />
88 u0=0.0<br />
89 u1=0.0<br />
90 u2=0.0<br />
91 ud=0.0<br />
92 vv = vv∗vv∗ dt2<br />
93<br />
94 ! Time loop<br />
95 do i t =1, nt<br />
96 c a l l l a p l a c i a n ( u1 , ud )<br />
97<br />
98 ! s c a l e by v e l o c i t y<br />
99 ud = ud∗vv<br />
100 ! i n j e c t w a v e l e t<br />
101 ud = ud + ww( i t ) ∗ r r<br />
102 ! time s t e p<br />
103 u2 = 2∗u1 − u0 + ud<br />
104 u0 = u1<br />
105 u1 = u2<br />
106<br />
107 ! w r i t e w a v e f i e l d to output<br />
108 i f ( i t >= f t . and . 0 == mod( i t −ft , j t ) ) then<br />
109 write (0 , ’ ( a , i 4 ) ’ ,advance=’ no ’ ) achar ( 1 3 ) , i t
14<br />
110 c a l l r s f w r i t e (Fo , u1 )<br />
111 end i f<br />
112 end do<br />
113 write ( 0 , ∗ )<br />
114<br />
115 c a l l exit ( 0 )<br />
116 end program Wave<br />
Your task is to modify the code to implement elliptically-anisotropic wave propagation<br />
according to equation<br />
∂ 2 P<br />
∂t 2 = V 2<br />
1 (x) ∂2 P<br />
∂x 2 1<br />
+ V 2<br />
2 (x) ∂2 P<br />
∂x 2 2<br />
+ F (x, t) (17)<br />
You can test your implementation using a constant velocity example shown in Figure<br />
2.<br />
Figure 2: Wavefield snapshot for<br />
propagation from a point-source<br />
in a homogeneous medium. Modify<br />
the code to make wave propagation<br />
anisotropic.<br />
1. Change directory to geo384w/hw1/code<br />
2. Run<br />
scons wave.vpl<br />
to compile and run the program and to observe a propagating wave on your<br />
screen.<br />
3. Open the file wave.c in your favorite editor and modify it to implement the<br />
wave operator from equation (17).<br />
4. Run
15<br />
scons wave.vpl<br />
again to compile and test your program.<br />
5. (EXTRA EXTRA CREDIT) For an additional test, modify the file SConstruct<br />
and run appropriate commands to output a snapshot of wave propagation in<br />
the Hess VTI model, shown in Figure 3 1 . Modify the file paper.tex to include<br />
your figure.<br />
a<br />
b<br />
Figure 3: Vertical velocity (a) and horizontal velocity (b) in the Hess VTI model.<br />
1 from r s f . p r o j import ∗<br />
2 from r s f . prog import RSFROOT<br />
3<br />
4 # Program compilation<br />
5 #####################<br />
6<br />
7 p r o j = P r o j e c t ( )<br />
8<br />
9 # To do the coding assignment in Fortran ,<br />
10 # comment the next l i n e and uncomment the l i n e s below<br />
11 #exe = p r o j . Program ( ’ wave . c ’)<br />
12<br />
13 exe = p r o j . Program ( ’ wave . f90 ’ ,<br />
14 F90PATH=os . path . j o i n (RSFROOT, ’ i n c l u d e ’ ) ,<br />
15 LIBS=[ ’ r s f f 9 0 ’ ]+ p r o j . get ( ’ LIBS ’ ) )<br />
16<br />
17 # Constant v e l o c i t y t e s t<br />
18 ########################<br />
19<br />
20 # Source w a v e l e t<br />
21 Flow ( ’ wavelet ’ , None ,<br />
22 ’ ’ ’<br />
23 s p i k e n1=1000 d1 =0.001 k1=201 |<br />
1 The Hess VTI model was generated at Hess Corporation and released at http://software.<br />
seg.org. For this exercise, we are going to approximate it with an elliptically anisotropic model
16<br />
24 r i c k e r 1 frequency=10<br />
25 ’ ’ ’ )<br />
26<br />
27 # Source l o c a t i o n<br />
28 Flow ( ’ source ’ , None ,<br />
29 ’ ’ ’<br />
30 s p i k e n1=201 n2=301 d1=0.01 d2=0.01<br />
31 l a b e l 1=x1 unit1=km l a b e l 2=x2 unit2=km<br />
32 k1=101 k2=151<br />
33 ’ ’ ’ )<br />
34<br />
35 # V e l o c i t y model<br />
36 Flow ( ’ v1 ’ , ’ source ’ , ’ math output=1 ’ )<br />
37 Flow ( ’ v2 ’ , ’ source ’ , ’ math output =1.5 ’ )<br />
38<br />
39 # Modeling<br />
40 Flow ( ’ wave ’ , ’ source %s wavelet v1 v2 ’ % exe [ 0 ] ,<br />
41 ’ ’ ’<br />
42 . / ${SOURCES[ 1 ] } wav=${SOURCES[ 2 ] }<br />
43 v=${SOURCES[ 3 ] } vx=${SOURCES[ 4 ] }<br />
44 f t =200 j t =5<br />
45 ’ ’ ’ )<br />
46<br />
47 Plot ( ’ wave ’ , ’ grey gainpanel=a l l t i t l e=Wave ’ , view=1)<br />
48<br />
49 Result ( ’ wave ’ ,<br />
50 ’ ’ ’<br />
51 window n3=1 min3=0.9 |<br />
52 grey t i t l e =Wave s c r e e n h t=8 screenwd=12<br />
53 ’ ’ ’ )<br />
54<br />
55 # Download Hess VTI model<br />
56 #########################<br />
57 zcat = WhereIs ( ’ gzcat ’ ) or WhereIs ( ’ zcat ’ )<br />
58 for case in ( ’ vp ’ , ’ e p s i l o n ’ ) :<br />
59 sgy = ’ t i m o d e l %s . segy ’ % case<br />
60 sgyz = sgy + ’ . gz ’<br />
61 Fetch ( sgyz , d i r=’ Hess VTI ’ ,<br />
62 s e r v e r=’ f t p : / / s o f tware . seg . org ’ ,<br />
63 top=’ pub/ d a t a s e t s /2D ’ )<br />
64 # Uncompress<br />
65 Flow ( sgy , sgyz , zcat + ’ $SOURCE ’ , s t d i n =0)<br />
66 # Convert to RSF format<br />
67 Flow ( case , sgy ,<br />
68 ’ ’ ’
17<br />
69 segyread read=data |<br />
70 window j 1=2 j2=2 | put d1=40 d2=40<br />
71 unit1=f t l a b e l 1=Depth unit2=f t l a b e l 2=Distance<br />
72 ’ ’ ’ )<br />
73<br />
74 # H o r i z o n t a l v e l o c i t y<br />
75 Flow ( ’ vx ’ , ’ vp e p s i l o n ’ ,<br />
76 ’ math e=${SOURCES[ 1 ] } output=”input ∗ s q r t (1+2∗ e )” ’ )<br />
77<br />
78 for case in ( ’ vp ’ , ’ vx ’ ) :<br />
79 Result ( case ,<br />
80 ’ ’ ’<br />
81 grey c o l o r=j p c l i p =100 a l l p o s=y b i a s =5000<br />
82 s c a l e b a r=y b a r r e v e r s e=y w a n t t i t l e=n<br />
83 b a r l a b e l=V e l o c i t y b a r u n i t=f t / s<br />
84 s c r e e n h t=5 screenwd=12 l a b e l s z =6<br />
85 ’ ’ ’ )<br />
86<br />
87 Flow ( ’ hsource ’ , ’ vp ’ , ’ s p i k e k1=300 k2=900 ’ )<br />
88 Flow ( ’ hess ’ , ’ hsource %s wavelet vp vx ’ % exe [ 0 ] ,<br />
89 ’ ’ ’<br />
90 . / ${SOURCES[ 1 ] } wav=${SOURCES[ 2 ] }<br />
91 v=${SOURCES[ 3 ] } vx=${SOURCES[ 4 ] }<br />
92 f t =200 j t =5<br />
93 ’ ’ ’ )<br />
94<br />
95 End ( )
18<br />
COMPLETING THE ASSIGNMENT<br />
1. Change directory to geo384w/hw1.<br />
2. Edit the file paper.tex in your favorite editor and change the first line to have<br />
your name instead of Newton’s.<br />
3. Run<br />
sftour scons lock<br />
to update all figures.<br />
4. Run<br />
sftour scons -c<br />
to remove intermediate files.<br />
5. Run<br />
scons <strong>pdf</strong><br />
to create the final document.<br />
6. Submit your result (file paper.<strong>pdf</strong>) on paper or by e-mail.<br />
REFERENCES<br />
Bamberger, A., B. Engquist, L. Halpern, and P. Joly, 1988, Parabolic wave equation<br />
approximation in heterogenous media: SIAM Journal on Appl. Math., 48, 99–128.<br />
Claerbout, J. F., 1985, Imaging the Earth’s interior: Blackwell Scientific Publications.<br />
Tappert, F. D., 1977, The parabolic approximation method, in Wave Propagation<br />
and Underwater Acoustics: Springer, 70, 224–287.