Isotropic Acoustic

Devito

class stride.physics.iso_acoustic.devito.IsoAcousticDevito(**kwargs)[source]

Bases: ProblemTypeBase

This class represents the second-order isotropic acoustic wave equation, implemented using Devito.

Parameters:
  • name (str, optional) – Name of the PDE, defaults to an automatic name.

  • grid (Grid, optional) – Existing grid, if not provided one will be created. Either a grid or space, time and slow_time need to be provided.

  • space (Space, optional) –

  • time (Time, optional) –

  • slow_time (SlowTime, optional) –

Notes

For forward execution of the PDE, the following parameters can be used:

waveletsTraces

Source wavelets.

vpScalarField

Compressional speed of sound fo the medium, in [m/s].

rhoScalarField, optional

Density of the medium, defaults to homogeneous, in [kg/m^3].

alphaScalarField, optional

Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

problemProblem

Sub-problem being solved by the PDE.

save_wavefieldbool, optional

Whether or not to solve the forward wavefield, defaults to True when a gradient is expected, and to False otherwise.

time_boundstuple of int, optional

If saving the wavefield, specify the (min timestep, max timestep) where the wavefield should be saved

save_undersamplingint, optional

Amount of undersampling in time when saving the forward wavefield. If not given, it is calculated given the bandwidth.

save_compressionstr, optional

Compression applied to saved wavefield, only available with DevitoPRO. Defaults to no compression in 2D and bitcomp in 3D.

save_interpolationbool, optional

Whether to interpolate the saved wavefield using natural cubic splines (only available in some versions of Stride). Defaults to True.

boundary_typestr, optional

Type of boundary for the wave equation (sponge_boundary_2 or complex_frequency_shift_PML_2), defaults to sponge_boundary_2. Note that complex_frequency_shift_PML_2 boundaries have lower OT4 stability limit than other boundaries.

interpolation_typestr, optional

Type of source/receiver interpolation (linear for bi-/tri-linear or hicks for sinc interpolation), defaults to linear.

attenuation_powerint, optional

Power of the attenuation law if attenuation is given (0 or 2), defaults to 0.

drpbool, optional

Whether or not to use dispersion-relation preserving coefficients (only available in some versions of Stride). Defaults to False.

kernelstr, optional

Type of time kernel to use (OT2 for 2nd order in time or OT4 for 4th order in time). If not given, it is automatically decided given the time spacing.

diff_sourcebool, optional

Whether the source should be injected as is, or as its 1st time derivative. Defaults to False, leaving it unchanged.

adaptive_boxesbool, optional

Whether to activate adaptive boxes (requires DevitoPRO and only available in some versions of Stride). Defaults to False.

platformstr, optional

Platform on which to run the operator, None to run on the CPU or nvidia-acc to run on the GPU with OpenACC. Defaults to None.

devito_configdict, optional

Additional keyword arguments to configure Devito before operator generation.

devito_argsdict, optional

Additional keyword arguments used when calling the generated operator.

add_sub_op(sub_op)[source]
async after_adjoint(adjoint_source, wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Clean up after the adjoint run and retrieve the time gradients (if needed).

Parameters:
  • adjoint_source (Traces) – Adjoint source.

  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

Returns:

Tuple with the gradients of the variables that need them

Return type:

tuple of gradients

async after_forward(wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Clean up after the state run and retrieve the time traces.

Parameters:
  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

Returns:

Time traces produced by the state run.

Return type:

Traces

async before_adjoint(adjoint_source, wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Prepare the problem type to run the adjoint problem.

Parameters:
  • adjoint_source (Traces) – Adjoint source.

  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

async before_forward(wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Prepare the problem type to run the state or forward problem.

Parameters:
  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

  • save_wavefield (bool, optional) – Whether or not to solve the forward wavefield, defaults to True when a gradient is expected, and to False otherwise.

  • time_bounds (tuple of int, optional) – If saving the wavefield, specify the (min timestep, max timestep) where the wavefield should be saved

  • save_undersampling (int, optional) – Amount of undersampling in time when saving the forward wavefield. If not given, it is calculated given the bandwidth.

  • save_compression (str, optional) – Compression applied to saved wavefield, only available with DevitoPRO. Defaults to no compression in 2D and bitcomp in 3D.

  • boundary_type (str, optional) – Type of boundary for the wave equation (sponge_boundary_2 or complex_frequency_shift_PML_2), defaults to sponge_boundary_2. Note that complex_frequency_shift_PML_2 boundaries have lower OT4 stability limit than other boundaries.

  • interpolation_type (str, optional) – Type of source/receiver interpolation (linear for bi-/tri-linear or hicks for sinc interpolation), defaults to linear.

  • attenuation_power (int, optional) – Power of the attenuation law if attenuation is given (0 or 2), defaults to 0.

  • drp (bool, optional) – Whether or not to use dispersion-relation preserving coefficients (only available in some versions of Stride). Defaults to False.

  • kernel (str, optional) – Type of time kernel to use (OT2 for 2nd order in time or OT4 for 4th order in time). If not given, it is automatically decided given the time spacing.

  • diff_source (bool, optional) – Whether the source should be injected as is, or as its 1st time derivative. Defaults to False, leaving it unchanged.

  • adaptive_boxes (bool, optional) – Whether to activate adaptive boxes (requires DevitoPRO and only available in some versions of Stride). Defaults to False.

  • platform (str, optional) – Platform on which to run the operator, None to run on the CPU or nvidia-acc to run on the GPU with OpenACC. Defaults to None.

  • devito_config (dict, optional) – Additional keyword arguments to configure Devito before operator generation.

  • devito_args (dict, optional) – Additional keyword arguments used when calling the generated operator.

clear_operators()[source]
property comms
async get_grad_rho(rho, **kwargs)[source]

Retrieve the gradients calculated wrt to rho.

The variable is updated inplace.

Parameters:

rho (ScalarField) – Density variable to calculate the gradient.

Returns:

Gradient wrt Density.

Return type:

ScalarField

async get_grad_vp(vp, **kwargs)[source]

Retrieve the gradients calculated wrt to the input.

The variable is updated inplace.

Parameters:

vp (ScalarField) – Vp variable to calculate the gradient.

Returns:

Gradient wrt Vp.

Return type:

ScalarField

property head
async init_grad_rho(rho, **kwargs)[source]

Initialise buffers in the problem type to calculate the gradients wrt rho.

Parameters:

rho (ScalarField) – Density variable to calculate the gradient.

async init_grad_vp(vp, **kwargs)[source]

Initialise buffers in the problem type to calculate the gradients wrt Vp.

Parameters:

vp (ScalarField) – Vp variable to calculate the gradient.

classmethod local(*args, uid=None, **kwargs)
classmethod local_parameter(*args, uid=None, **kwargs)
property logger
property loop
property monitor
property node
classmethod parameter(*args, uid=None, **kwargs)
async prepare_grad_rho(rho, **kwargs)[source]

Prepare the problem type to calculate the gradients wrt rho.

Parameters:

rho (ScalarField) – Density variable to calculate the gradient.

Returns:

Tuple of gradient and preconditioner updates.

Return type:

tuple

async prepare_grad_vp(vp, **kwargs)[source]

Prepare the problem type to calculate the gradients wrt Vp.

Parameters:

vp (ScalarField) – Vp variable to calculate the gradient.

Returns:

Tuple of gradient and preconditioner updates.

Return type:

tuple

classmethod remote(*args, **kwargs)
async run_adjoint(adjoint_source, wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Run the adjoint problem.

Parameters:
  • adjoint_source (Traces) – Adjoint source.

  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

async run_forward(wavelets, vp, rho=None, alpha=None, **kwargs)[source]

Run the state or forward problem.

Parameters:
  • wavelets (Traces) – Source wavelets.

  • vp (ScalarField) – Compressional speed of sound fo the medium, in [m/s].

  • rho (ScalarField, optional) – Density of the medium, defaults to homogeneous, in [kg/m^3].

  • alpha (ScalarField, optional) – Attenuation coefficient of the medium, defaults to 0, in [dB/cm].

  • problem (Problem) – Sub-problem being solved by the PDE.

property runtime
async classmethod select_worker(runtime=None)

Select an available worker.

Parameters:

runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.

Returns:

UID of the target worker.

Return type:

str

space_order = 10
property subdomains
time_order = 2
property wavefield
property worker
property zmq_context