leouieda/fatiando — pull request #52 by leouieda (2013-08-26 18:59:35+00:00)
Title: Refactor and better implementations of `fatiando.seismic.wavefd`

I have changed and simplified a lot the interface for the finite difference simulation functions. They can now take care of recording seismograms at specified stations, calculating grid spacings, etc. They are still iterators but instead of yielding on every time step, a `snapshot` parameter controls how often the results are yielded.

The methods used for the finite differences have evolved from simple forward differences to staggared grid methods. For SH waves, I used the Equivalent Staggared Grid of Di Bartolo et al. (2012). This method can and should also be used for acoustic (scalar) waves. For P-SV waves I used the Parsimonious Staggared Grid of Luo and Schuster (1990). These methods have the advantages of being more stable to physical property gradients and high Poisson ratios. Because of these new algorithms, simulations now require the Lamé parameters and density instead of wave velocities.

Instead of 3, now only 2 grids are stored for each displacement. The `t+1` grid can overwrite the `t-1` grid because I only need it at `i,j`.

The absorbing boundaries have also improved. I still use a Gaussian tapering (damping) in extended borders of the grid. But now I do it right. Damping is applied to grids at times `t + 1` and `t` for more efficiency. There are also special non-reflecting boundary conditions help reduce plain wave reflections.

For P-SV waves, an option was added to convert x and z displacements into representations of P and S waves. They are calculated from the divergence and curl of the displacement vector, respectively, using forth order centered differences. This way, only one wavefield panel can be plotted with more intuitive representations of the wave field.

![psv_p_s_waves](https://f.cloud.github.com/assets/290082/1028226/5add1426-0e81-11e3-96b8-b1b045b92789.png)

I also added a new source function for simulating a blast in all directions. This function actually produces various point sources. This is useful because this source only produces P waves in P-SV simulations:

![blast_p_wave](https://f.cloud.github.com/assets/290082/1028235/721120f6-0e81-11e3-9e59-f578ca4a28b4.png)

This is cools because its then easy to see that when the wave reaches an interface:

![blast_reflect](https://f.cloud.github.com/assets/290082/1028240/8ac14694-0e81-11e3-95a3-87b0abf44774.png)

It splits into a P and an S wave that wasn't there before