Skip to content

Commit 77d4e82

Browse files
authored
Merge pull request #2173 from ofmla/fs_tti_eqs
examples: free surface for coupled tti eqs
2 parents fde335d + 4db0c98 commit 77d4e82

4 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎examples/seismic/preset_models.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ def demo_model(preset, **kwargs):
216216

217217
model = SeismicModel(space_order=space_order, vp=v, origin=origin, shape=shape,
218218
dtype=dtype, spacing=spacing, nbl=nbl, epsilon=epsilon,
219-
delta=delta, theta=theta, phi=phi, bcs="damp", **kwargs)
219+
delta=delta, theta=theta, phi=phi, bcs="damp",
220+
fs=fs, **kwargs)
220221

221222
if kwargs.get('smooth', False):
222223
if len(shape) > 2 and preset.lower() not in ['layers-tti-noazimuth']:

‎examples/seismic/tti/operators.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from devito import (Eq, Operator, Function, TimeFunction, NODE, Inc, solve,
22
cos, sin, sqrt)
33
from examples.seismic import PointSource, Receiver
4+
from examples.seismic.acoustic.operators import freesurface
45

56

67
def second_order_stencil(model, u, v, H0, Hz, qu, qv, forward=True):
@@ -20,10 +21,16 @@ def second_order_stencil(model, u, v, H0, Hz, qu, qv, forward=True):
2021
stencilp = solve(m * u.dt2 - H0 - qu + damp * udt, unext)
2122
stencilr = solve(m * v.dt2 - Hz - qv + damp * vdt, vnext)
2223

23-
first_stencil = Eq(unext, stencilp)
24-
second_stencil = Eq(vnext, stencilr)
24+
first_stencil = Eq(unext, stencilp, subdomain=model.grid.subdomains['physdomain'])
25+
second_stencil = Eq(vnext, stencilr, subdomain=model.grid.subdomains['physdomain'])
2526

2627
stencils = [first_stencil, second_stencil]
28+
29+
# Add free surface
30+
if model.fs:
31+
stencils.append(freesurface(model, Eq(unext, stencilp)))
32+
stencils.append(freesurface(model, Eq(vnext, stencilr)))
33+
2734
return stencils
2835

2936

‎examples/seismic/tti/wavesolver.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def __init__(self, model, geometry, space_order=4, kernel='centered',
3434
self.geometry = geometry
3535
self.kernel = kernel
3636

37+
if model.fs and kernel == 'staggered':
38+
raise ValueError("Free surface only supported for centered TTI kernel")
39+
3740
if space_order % 2 != 0:
3841
raise ValueError("space_order must be even but got %s"
3942
% space_order)

‎tests/test_adjoint.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
presets = {
1212
'constant': {'preset': 'constant-isotropic'},
1313
'layers': {'preset': 'layers-isotropic', 'nlayers': 2},
14+
'layers-fs': {'preset': 'layers-isotropic', 'nlayers': 2, 'fs': True},
1415
'layers-tti': {'preset': 'layers-tti', 'nlayers': 2},
16+
'layers-tti-fs': {'preset': 'layers-tti', 'nlayers': 2, 'fs': True},
1517
'layers-viscoacoustic': {'preset': 'layers-viscoacoustic', 'nlayers': 2},
1618
}
1719

@@ -27,6 +29,8 @@ class TestAdjoint(object):
2729
('layers', (60, 70), 'OT2', 8, 2, acoustic_setup),
2830
('layers', (60, 70), 'OT2', 4, 2, acoustic_setup),
2931
('layers', (60, 70), 'OT4', 2, 2, acoustic_setup),
32+
# 2D test with 2 layers and freesurface
33+
('layers-fs', (60, 70), 'OT2', 4, 2, acoustic_setup),
3034
# 3D tests with varying time and space orders
3135
('layers', (60, 70, 80), 'OT2', 8, 2, acoustic_setup),
3236
('layers', (60, 70, 80), 'OT2', 6, 2, acoustic_setup),
@@ -42,6 +46,8 @@ class TestAdjoint(object):
4246
('layers-tti', (30, 35), 'centered', 4, 2, tti_setup),
4347
('layers-tti', (30, 35), 'staggered', 8, 1, tti_setup),
4448
('layers-tti', (30, 35), 'staggered', 4, 1, tti_setup),
49+
# 2D TTI test with 2 layers and freesurface
50+
('layers-tti-fs', (30, 35), 'centered', 4, 2, tti_setup),
4551
# 3D TTI tests with varying space orders
4652
('layers-tti', (30, 35, 40), 'centered', 8, 2, tti_setup),
4753
('layers-tti', (30, 35, 40), 'centered', 4, 2, tti_setup),
@@ -123,13 +129,17 @@ def test_adjoint_F(self, mkey, shape, kernel, space_order, time_order, setup_fun
123129
('layers', (60, 70), 'OT2', 12, 2, acoustic_setup),
124130
('layers', (60, 70), 'OT2', 8, 2, acoustic_setup),
125131
('layers', (60, 70), 'OT2', 4, 2, acoustic_setup),
132+
# 2D test with 2 layers and freesurface
133+
('layers-fs', (60, 70), 'OT2', 4, 2, acoustic_setup),
126134
# 3D tests with varying time and space orders
127135
('layers', (40, 50, 30), 'OT2', 12, 2, acoustic_setup),
128136
('layers', (40, 50, 30), 'OT2', 8, 2, acoustic_setup),
129137
('layers', (40, 50, 30), 'OT2', 4, 2, acoustic_setup),
130138
# 2D TTI tests with varying space orders
131139
('layers-tti', (20, 25), 'centered', 8, 2, tti_setup),
132140
('layers-tti', (20, 25), 'centered', 4, 2, tti_setup),
141+
# 2D TTI test with 2 layers and freesurface
142+
('layers-tti-fs', (20, 25), 'centered', 4, 2, tti_setup),
133143
# 3D TTI tests with varying space orders
134144
('layers-tti', (20, 25, 30), 'centered', 8, 2, tti_setup),
135145
('layers-tti', (20, 25, 30), 'centered', 4, 2, tti_setup),

0 commit comments

Comments
 (0)