# esys.downunder.forwardmodels.acoustic Package

Forward model for acoustic wave forms

## Classes

- `AcousticWaveForm`

- `ForwardModel`

class esys.downunder.forwardmodels.acoustic.AcousticWaveForm(domain, omega, w, data, F, coordinates=None, fixAtBottom=False, tol=1e-10, saveMemory=True, scaleF=True)

  Forward Model for acoustic waveform inversion in the frequency domain. It defines a cost function:

  Math

    `defect = 1/2 integrate( ( w * ( a * u - data ) ) ** 2 )`

  where w are weighting factors, data are the measured data (as a 2-comp vector of real and imaginary part) for real frequency omega, and u is the corresponding result produced by the forward model. u (as a 2-comp vector) is the solution of the complex Helmholtz equation for frequency omega, source F and complex, inverse, squared p-velocity sigma:

  Math

    `-u_{ii} - omega**2 * sigma * u = F`

  It is assumed that the exact scale of source F is unknown and the scaling factor a of F is calculated by minimizing the defect.

  __init__(domain, omega, w, data, F, coordinates=None, fixAtBottom=False, tol=1e-10, saveMemory=True, scaleF=True)

    initializes a new forward model with acoustic wave form inversion.

    Parameters

      - domain (`Domain`) – domain of the model

      - w (`Scalar`) – weighting factors

      - data (`escript.Data` of shape (2,)) – real and imaginary part of data

      - F (`escript.Data` of shape (2,)) – real and imaginary part of source given at Dirac points, on surface or at volume.

      - coordinates (`ReferenceSystem` or `SpatialCoordinateTransformation`) – defines coordinate system to be used (not supported yet)

      - tol (positive `float`) – tolerance of underlying PDE

      - saveMemory (`bool`) – if true stiffness matrix is deleted after solution of PDE to minimize memory requests. This will require more compute time as the matrix needs to be reallocated.

      - scaleF (`bool`) – if true source F is scaled to minimize defect.

      - fixAtBottom (`bool`) – if true pressure is fixed to zero at the bottom of the domain

  getArguments(sigma)

    Returns precomputed values shared by `getDefect()` and `getGradient()`.

    Parameters

      sigma (`escript.Data` of shape (2,)) – a suggestion for complex 1/V**2

    Returns

      solution, uTar, uTai, uTu

    Return type

      `escript.Data` of shape (2,), 3 x `float`

  getCoordinateTransformation()

    returns the coordinate transformation being used

    Return type

      `CoordinateTransformation`

  getDefect(sigma, u, uTar, uTai, uTu)

    Returns the defect value.

    Parameters

      - sigma (`escript.Data` of shape (2,)) – a suggestion for complex 1/V**2

      - u (`escript.Data` of shape (2,)) – a u vector

      - uTar (`float`) – equals `integrate( w * (data[0]*u[0]+data[1]*u[1]))`

      - uTai – equals `integrate( w * (data[1]*u[0]-data[0]*u[1]))`

      - uTu (`float`) – equals `integrate( w * (u,u))`

    Return type

      `float`

  getDomain()

    Returns the domain of the forward model.

    Return type

      `Domain`

  getGradient(sigma, u, uTar, uTai, uTu)

    Returns the gradient of the defect with respect to density.

    Parameters

      - sigma (`escript.Data` of shape (2,)) – a suggestion for complex 1/V**2

      - u (`escript.Data` of shape (2,)) – a u vector

      - uTar (`float`) – equals `integrate( w * (data[0]*u[0]+data[1]*u[1]))`

      - uTai – equals `integrate( w * (data[1]*u[0]-data[0]*u[1]))`

      - uTu (`float`) – equals `integrate( w * (u,u))`

  getSourceScaling(u)

    returns the scaling factor s required to rescale source F to minimize defect `|s * u- data|^2`

    Parameters

      u (`escript.Data` of shape (2,)) – value of pressure solution (real and imaginary part)

    Return type

      `complex`

  getSurvey(index=None)

    Returns the pair (data, weight)

    If argument index is ignored.

  rescaleWeights(scale=1.0, sigma_scale=1.0)

    rescales the weights such that

    Math

      integrate( ( w omega**2 * sigma_scale * data * ((1/L_j)**2)**-1) +1 )/(data*omega**2 * ((1/L_j)**2)**-1) * sigma_scale )=scale

    Parameters

      - scale (positive `float`) – scale of data weighting factors

      - sigma_scale (`Scalar`) – scale of 1/vp**2 velocity.

  setUpPDE()

    Creates and returns the underlying PDE.

    Return type

      `lpde.LinearPDE`

class esys.downunder.forwardmodels.acoustic.ForwardModel

  An abstract forward model that can be plugged into a cost function. Subclasses need to implement `getDefect()`, `getGradient()`, and possibly `getArguments()` and ‘getCoordinateTransformation’.

  __init__()
  getArguments(x)
  getCoordinateTransformation()
  getDefect(x, *args)
  getGradient(x, *args)

## Functions

## Others

- HAVE_DIRECT

## Packages