# 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)) mpl.subplot(2, 2, 4) mpl.title('z component')
# 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) mpl.points(stations, '.k') mpl.ylim(area[2:][::-1]) mpl.xlabel('x (km)') mpl.ylabel('z (km)') mpl.m2km() times = np.linspace(0, maxit*dt, maxit) # the only way for getting the feedback response of the seimograms global seismograms
mu = wavefd.lame_mu(svel, density) lamb = wavefd.lame_lamb(pvel, svel, density) # Make a wave source from a mexican hat wavelet for the x and z directions sources = [ [wavefd.MexHatSource(350000, 20000, area, shape, 100000, 0.5, delay=2)], [wavefd.MexHatSource(350000, 20000, 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, pvel.max()) duration = 100 maxit = int(duration/dt) stations = [[550000, 0]] snapshots = int(1./dt) simulation = wavefd.elastic_psv(lamb, mu, density, area, dt, maxit, sources, stations, snapshots, padding=70, taper=0.005, xz2ps=True) # This part makes an animation using matplotlibs animation API background = 10**-5*((pvel - pvel.min())/pvel.max()) fig = mpl.figure(figsize=(10, 8)) mpl.subplots_adjust(right=0.98, left=0.11, hspace=0.3, top=0.93) mpl.subplot(2, 1, 1) mpl.title('x seismogram') xseismogram, = mpl.plot([],[],'-k') mpl.xlim(0, duration) mpl.ylim(-0.05, 0.05) mpl.ylabel('Amplitude') ax = mpl.subplot(2, 1, 2) mpl.title('time: 0.0 s') wavefield = mpl.imshow(density, extent=area, cmap=mpl.cm.gray_r,