Skip to content

Commit

Permalink
examples: Add kwargs to operators and wavesolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas authored and mloubout committed Aug 27, 2020
1 parent 378e2c6 commit 14ef980
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion examples/seismic/elastic/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ def ForwardOperator(model, geometry, space_order=4, save=False, **kwargs):
"""

v = VectorTimeFunction(name='v', grid=model.grid,
save=geometry.nt if save else None,
space_order=space_order, time_order=1)
tau = TensorTimeFunction(name='tau', grid=model.grid,
save=geometry.nt if save else None,
space_order=space_order, time_order=1)

lam, mu, b = model.lam, model.mu, model.b
Expand All @@ -63,6 +65,7 @@ def ForwardOperator(model, geometry, space_order=4, save=False, **kwargs):
model.damp * dt * mu * (grad(v.forward) + grad(v.forward).T))

srcrec = src_rec(v, tau, model, geometry)
op = Operator([u_v] + [u_t] + srcrec, subs=model.spacing_map, name="ForwardElastic")
op = Operator([u_v] + [u_t] + srcrec, subs=model.spacing_map, name="ForwardElastic",
**kwargs)
# Substitute spacing terms to reduce flops
return op
7 changes: 4 additions & 3 deletions examples/seismic/tti/tti_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


def tti_setup(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=250.0,
space_order=4, nbl=10, preset='layers-tti', **kwargs):
kernel='centered', space_order=4, nbl=10, preset='layers-tti',
**kwargs):

# Two layer model for true velocity
model = demo_model(preset, shape=shape, spacing=spacing,
Expand All @@ -17,15 +18,15 @@ def tti_setup(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=250.0,
# Source and receiver geometries
geometry = setup_geometry(model, tn)

return AnisotropicWaveSolver(model, geometry, space_order=space_order)
return AnisotropicWaveSolver(model, geometry, space_order=space_order, **kwargs)


def run(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=250.0,
autotune=False, time_order=2, space_order=4, nbl=10,
kernel='centered', full_run=False, **kwargs):

solver = tti_setup(shape=shape, spacing=spacing, tn=tn, space_order=space_order,
nbl=nbl, **kwargs)
nbl=nbl, kernel=kernel, **kwargs)
info("Applying Forward")

rec, u, v, summary = solver.forward(autotune=autotune, kernel=kernel)
Expand Down

0 comments on commit 14ef980

Please sign in to comment.