Boundaries

Devito

class stride.physics.boundaries.devito.SpongeBoundary2(grid)[source]

Bases: Boundary

Sponge boundary layer for a second-order equation as proposed in https://doi.org/10.1088/1742-2140/aaa4da.

apply(field, velocity, direction='forward', **kwargs)[source]

Generate the necessary pieces to make the boundary work.

Returns:

  • term – Any extra terms to add to the equations.

  • list – Equations to execute before the state equation.

  • list – Equations to execute after the state equation.

class stride.physics.boundaries.devito.ComplexFrequencyShiftPML2(grid)[source]

Bases: Boundary

Complex frequency shift PML for a second-order equation as presented in https://doi.org/10.1121/1.4938270.

apply(field, velocity, direction='forward', **kwargs)[source]

Generate the necessary pieces to make the boundary work.

Returns:

  • term – Any extra terms to add to the equations.

  • list – Equations to execute before the state equation.

  • list – Equations to execute after the state equation.

clear()[source]

Perform any clearing operations if needed.

deallocate()[source]

Perform any deallocation operations if needed.

Base

class stride.physics.boundaries.boundary.Boundary(grid)[source]

Bases: ABC

Base class for Boundaries that can be applied to the different problem types.

Parameters:

grid (DevitoGrid) –

abstract apply(*args, **kwargs)[source]

Generate the necessary pieces to make the boundary work.

Returns:

  • term – Any extra terms to add to the equations.

  • list – Equations to execute before the state equation.

  • list – Equations to execute after the state equation.

clear()[source]

Perform any clearing operations if needed.

damping(dimensions=None, damping_coefficient=None, mask=False, damping_type='sine', velocity=1.0, power_degree=2, reflection_coefficient=0.001, assign=False)[source]

Create a damping field based on the dimensions of the grid.

Parameters:
  • dimensions (tuple of ints, optional) – Whether or not to fill only certain dimensions, defaults to None, all dimensions.

  • damping_coefficient (float, optional) – Value of the maximum damping of the field.

  • mask (bool, optional) – Create the damping layer as a mask (interior filled with ones) or not (interior filled with zeros).

  • damping_type (str, optional) – Expression to be used for the shape of the damping function, defaults to sine.

  • velocity (ndarray or float, optional) – Velocity in the boundary region, defaults to 1.0.

  • power_degree (int, optional) – Degree of the power to use for power damping, defaults to 2.

  • reflection_coefficient (float, optional) – Theoretical reflection coefficient of the layer, defaults to 1e-3.

  • assign (bool, optional) – Whether to assign or sum the value at each location, defaults to False.

Returns:

Tensor containing the damping field.

Return type:

ndarray

deallocate()[source]

Perform any deallocation operations if needed.