Skip to content

Commit

Permalink
Restore buoy
Browse files Browse the repository at this point in the history
  • Loading branch information
ccuetom committed Oct 5, 2023
1 parent 25c880c commit 2779afc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stride/physics/iso_acoustic/devito.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ async def before_forward(self, wavelets, vp, rho=None, alpha=None, **kwargs):

rho_with_halo = self.dev_grid.with_halo(rho.extended_data)
self.dev_grid.vars.rho.data_with_halo[:] = rho_with_halo
self.dev_grid.vars.buoy.data_with_halo[:] = 1/rho_with_halo

if alpha is not None:
self.logger.perf('(ShotID %d) Using attenuation with power %d' % (problem.shot_id, self.attenuation_power))
Expand Down Expand Up @@ -526,6 +527,7 @@ def _rm_tmpdir():
self.dev_grid.deallocate('rec')
self.dev_grid.deallocate('vp')
self.dev_grid.deallocate('rho')
self.dev_grid.deallocate('buoy')
self.dev_grid.deallocate('alpha', collect=True)

return traces
Expand Down Expand Up @@ -640,6 +642,7 @@ async def before_adjoint(self, adjoint_source, wavelets, vp, rho=None, alpha=Non
if rho is not None:
rho_with_halo = self.dev_grid.with_halo(rho.extended_data)
self.dev_grid.vars.rho.data_with_halo[:] = rho_with_halo
self.dev_grid.vars.buoy.data_with_halo[:] = 1/rho_with_halo

if alpha is not None:
db_to_neper = 100 * (1e-6 / (2*np.pi))**self.attenuation_power / (20 * np.log10(np.exp(1)))
Expand Down Expand Up @@ -732,6 +735,7 @@ async def after_adjoint(self, adjoint_source, wavelets, vp, rho=None, alpha=None
self.dev_grid.deallocate('rec')
self.dev_grid.deallocate('vp')
self.dev_grid.deallocate('rho')
self.dev_grid.deallocate('buoy')
self.dev_grid.deallocate('alpha', collect=True)

return await self.get_grad(wavelets, vp, rho, alpha, **kwargs)
Expand Down Expand Up @@ -1219,7 +1223,7 @@ def _medium_functions(self, vp, rho=None, alpha=None, **kwargs):

if rho is not None:
rho_fun = self.dev_grid.function('rho', **_kwargs)
buoy_fun = 1/rho_fun
buoy_fun = self.dev_grid.function('buoy', **_kwargs)
else:
rho_fun = buoy_fun = None

Expand Down

0 comments on commit 2779afc

Please sign in to comment.