Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am searching some libraries or toolboxes (preferred MATLAB) for solving acoustic wave equation in heterogeneous media with time varying source term, i.e. $$\nabla^2 \psi(\vec{r},t) - \frac{1}{c(\vec{r})^2} \frac{\partial^2}{\partial t^2}\psi(\vec{r},t) = s(\vec{r},t)$$

Actually I want to verify the k-Wave toolbox I modified, which solves another version of the above equation, by using some other softwares, so are there any other recommendations other than k-Wave? Thanks!

share|improve this question
It's hard to recommend something without knowing more about the geometry (1D? 2D? 3D? Unit square or arbitrary domain?), the data (smooth? discontinuous? rapidly varying?), and the desired accuracy. As a starting point, Program 6 in Nick Trefethen's Spectral Methods in Matlab solves the wave equation for variable coefficients. – Christian Clason Jan 14 '13 at 21:21
@ChristianClason it's can be either 2D or 3D in arbitrary domain. To compare with k-wave, which uses the k-space pseudo-spectral method, the media heterogeneity should be weak (c(r) should be smooth), but I guess the tool that can be applied in discontinuous media can also be used in media with small variation. So any recommendation is welcome. – chaohuang Jan 14 '13 at 21:39
Then why not just use a five-point stencil and Newmark on the unit square (you can adapt the code in Quarteroni's Scientific Computing with MATLAB and Octave, Program 8.4)? I don't think there's any general purpose wave equation solver in Matlab. – Christian Clason Jan 14 '13 at 22:35
Very humble contribution: from a seismic point of view you could use Madagascar Api.It has 2D/3D implementations finite differences (enough accuracy for simple seismic modeling, don't know if was your objective though). – eusoubrasileiro Jul 23 '13 at 17:25
up vote 4 down vote accepted

There is a tutorial program for this in deal.II: step-24, at

(Disclaimer: I'm one of the authors of this library.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.