shape = (200, 200) area = [0, 60000, 0, 60000] # Make a density and S wave velocity model density = 2400 * np.ones(shape) pvel = 6600 svel = 3700 mu = wavefd.lame_mu(svel, density) lamb = wavefd.lame_lamb(pvel, svel, density) # Make a wave source from a mexican hat wavelet that vibrates in the x and z # directions equaly sources = [[wavefd.MexHatSource(30000, 40000, area, shape, 10000, 1, delay=1)], [wavefd.MexHatSource(30000, 40000, area, shape, 10000, 1, delay=1)]] # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, pvel) duration = 20 maxit = int(duration / dt) stations = [[55000, 0]] # x, z coordinate of the seismometer snapshot = int(0.5 / dt) # Plot a snapshot of the simulation every 0.5 seconds simulation = wavefd.elastic_psv(lamb, mu, density, area, dt, maxit, sources, stations, snapshot, padding=50, taper=0.01,
pvel[int(600/dz)+int(120/dz):int(600/dz)+int(240/dz), :] = 3540 # basalt flow 2 svel = 1600*np.ones(shape) # botucatu svel[0:int(600/dz), :] = 1166 # bauru svel[int(600/dz):int(600/dz)+int(120/dz), :] = 2611 # basalt flow 1 svel[int(600/dz)+int(120/dz):int(600/dz)+int(240/dz), :] = 1900 # basalt flow 2 mu = wavefd.lame_mu(svel, density) lamb = wavefd.lame_lamb(pvel, svel, density) # Make a wave source from a gauss derivative that vibrates in the z direction only # (removes the shear component amplitude equals zero, simulating a default seismic acquisition) sources = [[wavefd.GaussSource(2000, 0, area, shape, 0.0, 5.)], # x source or shear source [wavefd.GaussSource(2000, 0, area, shape, 100.0, 25.)]] # z source or z compressional source # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, np.max(pvel)) duration = 3.0 maxit = int(duration/dt) stations = [[2200+i*dx, 0] for i in range(220)] # x, z coordinate of the seismometers snapshot = int(0.004/dt) # Plot a snapshot of the simulation every 4 miliseconds print "dt for simulation is ", dt print "max iteration for simulation is ", maxit print "duration for simulation is ", duration simulation = wavefd.elastic_psv(lamb, mu, density, area, dt, maxit, sources, stations, snapshot, padding=50, taper=0.01) # This part makes an animation using matplotlibs animation API fig = mpl.figure(figsize=(12, 5)) # Start with everything zero and grab the plot so that it can be updated later mpl.imshow(pvel[::-1], extent=area, alpha=0.25) wavefield = mpl.imshow(np.zeros(shape), extent=area, vmin=-10**-7, vmax=10**-7, alpha=0.75, cmap=mpl.cm.gray_r)
shape = (200, 200) area = [0, 60000, 0, 60000] # Make a density and S wave velocity model density = 2400 * np.ones(shape) pvel = 6600 svel = 3700 mu = wavefd.lame_mu(svel, density) lamb = wavefd.lame_lamb(pvel, svel, density) # Make a wave source from a mexican hat wavelet that vibrates in the x and z # directions equaly sources = [[wavefd.MexHatSource(30000, 40000, area, shape, 10000, 1, delay=1)], [wavefd.MexHatSource(30000, 40000, area, shape, 10000, 1, delay=1)]] # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, pvel) duration = 20 maxit = int(duration / dt) stations = [[55000, 0]] # x, z coordinate of the seismometer snapshot = int(0.5 / dt) # Plot a snapshot of the simulation every 0.5 seconds simulation = wavefd.elastic_psv(lamb, mu, density, area, dt, maxit, sources, stations, snapshot, padding=50, taper=0.01, xz2ps=True) # This part makes an animation using matplotlibs animation API fig = mpl.figure(figsize=(12, 5)) mpl.subplot(2, 2, 2) mpl.title('x component') xseismogram, = mpl.plot([], [], '-k') mpl.xlim(0, duration) mpl.ylim(-10 ** (-3), 10 ** (-3))
from fatiando.seismic import wavefd from fatiando.vis import mpl # Set the parameters of the finite difference grid shape = (150, 150) area = [0, 60000, 0, 60000] # Make a density and S wave velocity model density = 2400 * np.ones(shape) velocity = 3700 mu = wavefd.lame_mu(velocity, density) # Make a wave source from a mexican hat wavelet sources = [wavefd.MexHatSource(30000, 15000, area, shape, 100, 1, delay=2)] # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, velocity) duration = 20 maxit = int(duration / dt) stations = [[50000, 0]] # x, z coordinate of the seismometer snapshot = int(0.5 / dt) # Plot a snapshot of the simulation every 0.5 seconds simulation = wavefd.elastic_sh(mu, density, area, dt, maxit, sources, stations, snapshot, padding=50, taper=0.01) # This part makes an animation using matplotlibs animation API fig = mpl.figure(figsize=(14, 5)) ax = mpl.subplot(1, 2, 2) mpl.title('Wavefield') # Start with everything zero and grab the plot so that it can be updated later wavefield_plt = mpl.imshow(np.zeros(shape), extent=area, vmin=-10 ** (-5), vmax=10 ** (-5), cmap=mpl.cm.gray_r) mpl.points(stations, '^b')
# Set the parameters of the finite difference grid shape = (200, 1000) area = [0, 800000, 0, 160000] # Make a density and S wave velocity model density = 2400 * np.ones(shape) svel = 3500 * np.ones(shape) mu = wavefd.lame_mu(svel, density) # Make a wave source from a mexican hat wavelet sources = [wavefd.MexHatSource(10000, 10000, area, shape, 100000, 0.5, delay=2)] # Get the iterator. This part only generates an iterator object. The actual # computations take place at each iteration in the for loop below dt = wavefd.maxdt(area, shape, svel.max()) duration = 250 maxit = int(duration / dt) stations = [[100000, 0], [700000, 0]] snapshots = int(1. / dt) simulation = wavefd.elastic_sh(mu, density, area, dt, maxit, sources, stations, snapshots, padding=70, taper=0.005) # This part makes an animation using matplotlibs animation API fig = mpl.figure(figsize=(10, 8)) mpl.subplots_adjust(right=0.98, left=0.11, hspace=0.3, top=0.93) mpl.subplot(3, 1, 1) mpl.title('Seismogram 1') seismogram1, = mpl.plot([], [], '-k') mpl.xlim(0, duration) mpl.ylim(-0.1, 0.1)
# Make a density and S wave velocity model density = 2400 * np.ones(shape) svel = 3500 * np.ones(shape) moho = 50 density[moho:] = 2800 svel[moho:] = 4500 mu = wavefd.lame_mu(svel, density) # Make a wave source from a mexican hat wavelet sources = [ wavefd.MexHatSource(10000, 10000, area, shape, 100000, 0.5, delay=2) ] # Get the iterator. This part only generates an iterator object. The actual # computations take place at each iteration in the for loop below dt = wavefd.maxdt(area, shape, svel.max()) duration = 250 maxit = int(duration / dt) stations = [[100000, 0], [700000, 0]] snapshots = int(1. / dt) simulation = wavefd.elastic_sh(mu, density, area, dt, maxit, sources, stations, snapshots, padding=70, taper=0.005)
svel[int(600 / dz) + int(120 / dz):int(600 / dz) + int(240 / dz), :] = 1900 # basalt flow 2 mu = wavefd.lame_mu(svel, density) lamb = wavefd.lame_lamb(pvel, svel, density) # Make a wave source from a gauss derivative that vibrates in the z direction only # (removes the shear component amplitude equals zero, simulating a default seismic acquisition) sources = [ [wavefd.GaussSource(2000, 0, area, shape, 0.0, 5.)], # x source or shear source [wavefd.GaussSource(2000, 0, area, shape, 100.0, 25.)] ] # z source or z compressional source # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, np.max(pvel)) duration = 3.0 maxit = int(duration / dt) stations = [[2200 + i * dx, 0] for i in range(220)] # x, z coordinate of the seismometers snapshot = int(0.004 / dt) # Plot a snapshot of the simulation every 4 miliseconds print "dt for simulation is ", dt print "max iteration for simulation is ", maxit print "duration for simulation is ", duration simulation = wavefd.elastic_psv(lamb, mu, density, area, dt, maxit,
from fatiando.seismic import wavefd from fatiando.vis import mpl # Set the parameters of the finite difference grid shape = (150, 150) area = [0, 60000, 0, 60000] # Make a density and S wave velocity model density = 2400 * np.ones(shape) velocity = 3700 mu = wavefd.lame_mu(velocity, density) # Make a wave source from a mexican hat wavelet sources = [wavefd.MexHatSource(30000, 15000, area, shape, 100, 1, delay=2)] # Get the iterator for the simulation dt = wavefd.maxdt(area, shape, velocity) duration = 20 maxit = int(duration / dt) stations = [[50000, 0]] # x, z coordinate of the seismometer snapshot = int(0.5 / dt) # Plot a snapshot of the simulation every 0.5 seconds simulation = wavefd.elastic_sh(mu, density, area, dt, maxit, sources, stations, snapshot, padding=50, taper=0.01)
""" import numpy as np import sys from fatiando.seismic import wavefd # Set the parameters of the finite difference grid 3D shape = (100, 100, 100) ds = 10. # spacing area = [0, shape[2]*ds, 0, shape[1]*ds, 0, shape[0]*ds] # Set the parameters of the finite difference grid velocity = np.ones(shape)*2500. # m/s velocity[50:100, 50:100, 50:100] = 1500. # m/s # avoiding spatial alias, frequency of source should be smaller than this fc = 0.5*np.min(velocity)/ds # based on plane waves v=l*f fc -= 0.5*fc sources = [wavefd.GaussSource((40*ds, 40*ds, 30*ds), area, shape, 10**(-8), fc)] dt = wavefd.maxdt(area, shape, np.max(velocity)) duration = 0.6 maxit = int(duration/dt) # x, y, z coordinate of the seismometer stations = [[45*ds, 45*ds, 65*ds], [65*ds, 65*ds, 30*ds]] snapshots = 5 # every 1 iterations plots one simulation = wavefd.scalar3(velocity, area, dt, maxit, sources, stations, snapshots) movie = np.zeros(((maxit/snapshots)+2, 100, 100, 100)) i = 0 for t, u, seismogram in simulation: movie[i] = u sys.stdout.write("\rprogressing .. %.1f%% time %.3f"%(100.0*float(t)/maxit, (dt*t))) sys.stdout.flush() i += 1