Skip to content

Elastic

sweep.equations.Elastic

Elastic(spatial_order=4, device='cpu', backend='torch')

Bases: sweep.equations.base.FirstOrderEquation

First-order 2-D elastic wave equation on a staggered grid (Virieux 1986).

Velocity-stress formulation. The five physical fields (vx, vz, sxx, szz, sxz) are evolved together with ten CPML memory variables (one per first-derivative direction). Sources are typically an explosion (['sxx', 'szz'] — the default in the propagator) or a directional body force; receivers usually read particle velocities (['vx'] or ['vz']) or stresses.

Reference: J. Virieux, 1986, P-SV wave propagation in heterogeneous media: velocity-stress finite-difference method, Geophysics 51(4), 10.1190/1.1442147.

Models (constructor input order)

  • vp (m/s): Elastic P-wave velocity model.
  • vs (m/s): Elastic S-wave velocity model.
  • rho (kg/m^3): Density model.

Wavefields

  • vx (aliases: velocity_x): Particle velocity in the x direction; default receiver.
  • vz (aliases: velocity_z): Particle velocity in the z direction; default receiver.
  • sxx (aliases: stress_xx): Normal stress in the x direction; default source.
  • szz (aliases: stress_zz): Normal stress in the z direction; default source.
  • sxz (aliases: stress_xz, shear_xz): Shear stress component.
  • m_vxx: CPML memory variable for dvx/dx (internal).
  • m_vxz: CPML memory variable for dvx/dz (internal).
  • m_vzx: CPML memory variable for dvz/dx (internal).
  • m_vzz: CPML memory variable for dvz/dz (internal).
  • m_txxx: CPML memory variable for dsxx/dx (internal).
  • m_txxz: Reserved elastic auxiliary field (internal).
  • m_tzzx: Reserved elastic auxiliary field (internal).
  • m_tzzz: CPML memory variable for dszz/dz (internal).
  • m_txzx: CPML memory variable for dsxz/dx (internal).
  • m_txzz: CPML memory variable for dsxz/dz (internal).

Defaults

  • source_type: ['sxx', 'szz']
  • receiver_type: ['vx', 'vz']
  • pml_type: 'cpmls'

Build the elastic equation operator.

Parameters:

  • spatial_order –

    FD accuracy order of the staggered first-derivative operator — e.g. spatial_order=4 is fourth-order accurate. Internally the half-stencil width is M = spatial_order // 2 (used for loop bounds and PML padding). Must be an even integer (2, 4, 6, 8, 10, …). Higher orders reduce grid dispersion — most visibly on the slower S-wave, which is the first thing to alias at marginal ppw — at the cost of more compute per step and a wider PML halo. Performance note (impl='c' on CUDA): the compiled kernels are template-specialised only for spatial_order ∈ {2, 4, 6, 8}. Above 8 the dispatcher falls through to the generic order = -1 runtime path (see src/sweep/csrc/cuda/equations/elastic2d/kernels.cu) which is noticeably slower; the PyTorch eager path is unaffected. Defaults to 4.

  • device –

    Device for the operator's static gradient kernels. Use 'cuda' / a torch.device for GPU runs so the propagator can follow without a host↔device copy. Defaults to 'cpu'.

  • backend –

    Array / programming backend, 'torch' or 'jax'. When you later want impl='c', leave this on 'torch' — the compiled CUDA kernels go through the Torch binding. Defaults to 'torch'.

C_NAME class-attribute

C_NAME = 'elastic2d'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

supports_batched_models class-attribute

supports_batched_models = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

supports_bs_free_surface class-attribute

supports_bs_free_surface = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

supports_image_topography class-attribute

supports_image_topography = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

supports_image_topography_c class-attribute

supports_image_topography_c = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

supports_per_edge_free_surface class-attribute

supports_per_edge_free_surface = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

supports_per_edge_free_surface_c class-attribute

supports_per_edge_free_surface_c = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

interior_substeps

interior_substeps()

The Virieux leapfrog as reversible sub-steps, REUSING the shared elastic_velocity_substep / elastic_stress_substep that :func:elastic_step_core (and thus func) is built from — no rewritten copy of the physics. Called with pml zeroed (boundary saving reconstructs only the lossless interior) but the free-surface BC KEPT, so the eager boundary-saving 'substep' driver inverts the step exactly by composing the list in reverse order at -dt.