Seismic waves - seismicwaves2d

Functions to calculate acoustic and elastic wave propagation in 2D.

pestoseis.seismicwaves2d.animateacousticwaves(inpfile, clipamplitude=0.1, showanim=False)[source]

Function to ‘animate’ the results of a 2D acoustic finite difference simulation. It produces (and saves to a file) an .mp4 movie.

Parameters:
  • inpfile (string) – input HDF5 file name

  • clipamplitude (float) – amplitude clipping factor

  • showanim (bool) – show plot or not

pestoseis.seismicwaves2d.animateelasticwaves(inpfile, showwhatela='VxVz', clipamplitude=0.1, showanim=False)[source]

Function to ‘animate’ the results of a 2D elastic finite difference simulation. It produces (and saves to a file) an .mp4 movie.

Parameters:
  • inpfile (string) – input HDF5 file name

  • showwhatela (string) – what to show, either ‘VxVz’ or ‘PS’

  • clipamplitude (float) – amplitude clipping factor

  • showanim (bool) – show plot or not

pestoseis.seismicwaves2d.gaussource(t, t0, f0)[source]

Derivative of a Gaussian source time function.

Parameters:
  • t (ndarray) – time array

  • t0 (float) – time shift for the onset

  • f0 (float) – central frequency

Returns:

the source time function

Return type:

source (ndarray)

pestoseis.seismicwaves2d.rickersource(t, t0, f0)[source]

Ricker wavelet source time function.

Parameters:
  • t (ndarray) – time array

  • t0 (float) – time shift for the onset

  • f0 (float) – central frequency

Returns:

the source time function

Return type:

source (ndarray)

pestoseis.seismicwaves2d.solveacoustic2D(inpar, ijsrc, velmod, sourcetf, srcdomfreq, recpos, saveh5=True, outfileh5='acoustic_snapshots.h5')[source]

Solve the acoustic wave equation in 2D using finite differences on a staggered grid. Wrapper function for various boundary conditions.

Parameters:
  • inpar (dict) –

    dictionary containing various input parameters

    • inpar[“ntimesteps”] (int) number of time steps

    • inpar[“nx”] (int) number of grid nodes in the x direction

    • inpar[“nz”] (int) number of grid nodes in the z direction

    • inpar[“dt”] (float) time step for the simulation

    • inpar[“dh”] (float) grid spacing (same in x and z)

    • inpar[“savesnapshot”] (bool) switch to save snapshots of the entire wavefield

    • inpar[“snapevery”] (int) save snapshots every “snapevery” iterations

    • inpar[“freesurface”] (bool) True for free surface boundary condition at the top, False for PML

    • inpar[“boundcond”] (string) Type of boundary conditions “PML”,”GaussTap” or “ReflBou”

  • ijsrc (ndarray(int,int)) – integers representing the position of the source on the grid

  • velmod (ndarray(nx,nz)) – two-dimensional velocity model

  • sourcetf (ndarray) – source time function

  • srcdomfreq (float) – source dominant frequency

  • recpos (ndarray) – position of the receivers, a two-column array [x,z]

  • saveh5 (bool) – whether to save results to HDF5 file or not

  • outfileh5 (string) – name of the output HDF5 file

Returns:

seismograms recorded at the receivers psave (ndarray): set of snapshots of the wavefield (if inpar[“savesnapshot”]==True)

Return type:

seism (ndarray)

pestoseis.seismicwaves2d.solveelastic2D(inpar, rockprops, ijsrc, sourcetf, srcdomfreq, recpos, saveh5=True, outfileh5='elastic_snapshots.h5')[source]

Solve the elastic wave equation in 2D using finite differences on a staggered grid. Wrapper function for various boundary conditions.

Parameters:
  • inpar (dict) –

    dictionary containing various input parameters:

    • inpar[“ntimesteps”] (int) number of time steps

    • inpar[“nx”] (int) number of grid nodes in the x direction

    • inpar[“nz”] (int) number of grid nodes in the z direction

    • inpar[“dt”] (float) time step for the simulation

    • inpar[“dh”] (float) grid spacing (same in x and z)

    • inpar[“savesnapshot”] (bool) switch to save snapshots of the entire wavefield

    • inpar[“snapevery”] (int) save snapshots every “snapevery” iterations

    • inpar[“freesurface”] (bool) True for free surface boundary condition at the top, False for PML

    • inpar[“boundcond”] (string) Type of boundary conditions “PML” or “ReflBou”

  • rockprops (dict) – rho (ndarray) density array lambda (ndarray) lambda module array mu (ndarray) shear module array

  • ijsrc (ndarray(int,int)) – integers representing the position of the source on the grid

  • sourcetf (ndarray) – source time function

  • srcdomfreq (float) – source dominant frequency

  • recpos (ndarray) – position of the receivers, a two-column array [x,z]

  • saveh5 (bool) – whether to save results to HDF5 file or not

  • outfileh5 (string) – name of the output HDF5 file

Returns:

seismograms, Vx and Vz components, recorded at the receivers (vxsave,vzsave) (ndarray,ndarray): set of Vx and Vz snapshots of the wavefield (if inpar[“savesnapshot”]==True)

Return type:

receiv (ndarray)