Isotropic Acoustic
Devito
- class stride.physics.iso_acoustic.devito.IsoAcousticDevito(**kwargs)[source]
Bases:
stride.physics.problem_type.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.
- save_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.
- 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
or2
), 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.
- 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.
- 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
- 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.
save_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.
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
or2
), 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.
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
- 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
- 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
- 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
- time_order = 2
- property worker
- property zmq_context