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:
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 False.
- dump_forward_wavefieldbool or int, optional
If True or a positive integer, the forward wavefield will be dumped after running the forward kernel. If True, the wavefield will be sampled every
save_undersampling
timesteps. If an integer, the wavefield will be sampled everydump_forward_wavefield
timesteps. Defaults to False.- dump_adjoint_wavefieldbool or int, optional
If True or a positive integer, the adjoint wavefield will be dumped after running the adjoint kernel. If True, the wavefield will be sampled every
save_undersampling
timesteps. If an integer, the wavefield will be sampled everydump_adjoint_wavefield
timesteps. Defaults to False.- dump_wavefield_idint, optional
ID of the shot to dump wavefields. If not provided, all IDs are dumped.
- boundary_typestr, optional
Type of boundary for the wave equation (
sponge_boundary_2
orcomplex_frequency_shift_PML_2
), defaults tosponge_boundary_2
. Note thatcomplex_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 orhicks
for sinc interpolation), defaults tolinear
.- attenuation_powerint, optional
Power of the attenuation law if attenuation is given (
0
,2
, or None), defaults to0
.- 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 orOT4
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.
- local_precbool, optional
Whether to apply local preconditioning. Only available in some versions of Stride. Defaults to True.
- platformstr, optional
Platform on which to run the operator,
None
to run on the CPU ornvidia-acc
to run on the GPU with OpenACC. Defaults toNone
.- devito_configdict, optional
Additional keyword arguments to configure Devito before operator generation.
- devito_argsdict, optional
Additional keyword arguments used when calling the generated operator.
- 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
- 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:
- 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.
- 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 savedsave_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.save_interpolation (bool, optional) – Whether to interpolate the saved wavefield using natural cubic splines (only available in some versions of Stride). Defaults to True.
dump_forward_wavefield (bool or int, optional) – If True or a positive integer, the forward wavefield will be dumped after running the forward kernel. If True, the wavefield will be sampled every
save_undersampling
timesteps. If an integer, the wavefield will be sampled everydump_forward_wavefield
timesteps. Defaults to False.dump_adjoint_wavefield (bool or int, optional) – If True or a positive integer, the adjoint wavefield will be dumped after running the adjoint kernel. If True, the wavefield will be sampled every
save_undersampling
timesteps. If an integer, the wavefield will be sampled everydump_adjoint_wavefield
timesteps. Defaults to False.dump_wavefield_id (int, optional) – ID of the shot to dump wavefields. If not provided, all IDs are dumped.
boundary_type (str, optional) – Type of boundary for the wave equation (
sponge_boundary_2
orcomplex_frequency_shift_PML_2
), defaults tosponge_boundary_2
. Note thatcomplex_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 orhicks
for sinc interpolation), defaults tolinear
.attenuation_power (int, optional) – Power of the attenuation law if attenuation is given (
0
,2
, or None), defaults to0
.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 orOT4
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 ornvidia-acc
to run on the GPU with OpenACC. Defaults toNone
.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.
- property comms
- 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:
- 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:
- property head
- 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.
- 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)
- 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
- 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)
- 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.
- 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