Slashdot Mirror


Numerically Approximating the Wave Equation?

ObsessiveMathsFreak writes "I'm an applied mathematician who has recently needed to obtain good numerical approximations to the classic second-order wave equation, preferably in three space dimensions. A lot of googling has not revealed much on what I had assumed would be a well-studied problem. Most of the standard numerical methods, finite difference/finite element methods, don't seem to work very well in the case of variable wave speed at different points in the domain, which is exactly the case that I need. Are any in this community working on numerically solving wave equation problems? What numerical methods do you use, and which programs do you find best suited to the task? How do you deal with stability issues, boundary/initial values, and other pitfalls? Are there different methods for electromagnetic wave problems? Finally, when the numbers have all been crunched, how do you visualize your hard-earned data?"

23 of 260 comments (clear)

  1. More information is needed by DrJimbo · · Score: 4, Informative

    You say you want an approximate solution but you give us no clue as to the part of the problem you want to approximate. For variable wave speed, I've used both normal modes and the parabolic equation approximation.

    The question you have posed is so unspecific, it would be impossible to fully answer it without writing a text book. There are many good ones, for example, Waves in Layered Media by L. M. Brekhovskikh.

    --
    We don't see the world as it is, we see it as we are.
    -- Anais Nin
  2. usenet by poopdeville · · Score: 4, Informative

    Mathematician here, though this isn't my field. Slashdot isn't a very good place to ask this kind of question, since there aren't many mathematicians on here, and it's a very broad topic. I suggest Usenet -- specificially the sci.math newsgroup. I know at least 50 mathematicians who post regularly, and a lot more lurk (and occassionally answer questions).

    --
    After all, I am strangely colored.
    1. Re:usenet by WallaceAndGromit · · Score: 2, Informative

      Look for references in outdoor sound propagation. The Journal of the Acoustical Society of America or the Journal of Sound and Vibration are good starts, there are also many books (too numerous to list here) on this topic worth investigating. Outdoor sound propagation is a classical example of wave propagation in varying sound speed media and is well documented. You will find many approaches (other than finite element, boundary element, or finite difference) applicable to your problem.

      --
      Name: Mr. Anon E Mouse; SSN: 555-55-5555
    2. Re:usenet by Mikkeles · · Score: 2, Informative

      Garth Johnson, Darboux Transformations of the Wave Equation ( only partial Google cached html of pdf as the site no longer seems to exist.)

      (Google cache of Mr Johnson's cv)

      --
      Great minds think alike; fools seldom differ.
  3. Don't seem to work very well? by mochan_s · · Score: 3, Informative

    Most of the standard numerical methods, finite difference/finite element methods, don't seem to work very well in the case of variable wave speed at different points in the domain, which is exactly the case that I need.

    In what ways does it not work well for you? It doesn't converge, takes too long to converge? What is the problem?

    A numerical algorithm would give you the assumptions that guarantee convergence and you should be able to figure out under what conditions it would "not work well". Just look up the assumptions and see what assumption your variable wave speed violates to not give you convergence.

  4. Information is scarce by SoapDish · · Score: 3, Informative

    Well, having just taken a basic course in PDE's, I'd automatically say use finite difference, with a crank-nicholson scheme (for convergence), and gauss-seidel iteration. Of course, since it was a basic course, we only dealt with a 1-D wave equation.

    I can tell you that the internet is lacking for stuff even as simple as that, and it's hard to find a good textbook. You might have better luck with a text book, since your need is more focused than the course I took.

    1. Re:Information is scarce by Verte · · Score: 4, Informative

      I'd automatically say use finite difference, with a crank-nicholson scheme (for convergence), and gauss-seidel iteration. Here here! And for different wave rates, notice where the wave rates appear in the matrix. Best to derive by hand, keeping the wave rates as functions of position. If you've got weird boundary conditions you can't work out how to use yourself, take it to a numerical mathematician. Most of them have studied this stuff to death, and can give you good error estimations too.

      And if the problem is significantly complex or you need more general solution, try a Greens function.
      --
      We at slashdot are scientists, specialists and kernel hackers. Your FUD will be found out.
  5. Finite element by badinsults · · Score: 5, Informative

    Your question is rather specific given the crowd here on slashdot. Personally, I think you should ask other professional mathematitians at universities. If your problem is interesting, I'm sure you will have no problem finding someone who will give you advice. I personally only have limited experience in modeling of heat flow, which is somewhat similar to what your problem is. We use a finite element approach, where variables such as porosity, permiability, and composition can be changed for each element. It would likely be computationally expensive to create a functionally variable wave speed, so partioning it so that each element had different velocity paramenters would likely be suitable. As for programs, you might be forced to break out the C (or even FORTRAN) book and create your own. More often than not in specialized physics problems, there are no programs that are specifically applicable to your problem. If there were, you would have already found it.

  6. Many many options by Anonymous Coward · · Score: 5, Informative

    If you're doing an electromagnetics problem in 3D (I *am* a physicist specialising in this field), there are many options. This is a VERY well studied problem.

    If your problem domain is not too many wavelengths big (i.e. near-field), you want a FDTD solver. There are many commercial packages available but most are expensive (just google for FDTD). FDTD is quite simple in concept but there are various details to get right to make a general purpose solver (e.g. boundary conditions). There are a number of hardware-based solvers on the market utilising GPUs for electromagnetics calculations. If you only need a single-frequency (eigenmode) solution, then Finite Element Method might be for you (e.g. see http://people.web.psi.ch/geus/pyfemax/). If you have extreme aspect ratios you need to model (i.e. interaction between widely spaced components), then the Boundary Element Method might suit (but it's harder to understand and implement).

    If you're rolling your own solution, Python makes an excellent "glue language" to tie solvers together and visualise results with VTK (www.vtk.org) and add configuration GUIs.

    1. Re:Many many options by Diffraction · · Score: 5, Informative

      FDTD doesn't have to be expensive - in fact the guys at MIT are nice enough to have published their own implementation under GNU GPL (see http://ab-initio.mit.edu/wiki/index.php/Meep). Installs on Linux and has a feature list rivaling commercial packages. We have used it successfully for simulating various nanophotonic structures.

  7. Feynman invented Monte Carlo? Me don't think so by mickkelly2000 · · Score: 2, Informative

    That was more like Metropolis, Ulam (I think Teller had something to do with it)
    see: Wikipedia

    --
    -- may you ever drink deep --
  8. People to contact who might know by Anonymous Coward · · Score: 1, Informative

    Contact Dr. Mohammad Rammaha (analysis) at the University of Nebraska (Lincoln). He's been working on PDE's for the last decade. While he works on analytical solutions, I'm sure that he also is familiar with numberical methods. Dr. David Logan (applied mathematics) surely would have the resources at his fingers. e-mail addresses are: mrammaha1@math.unl.edu, and dlogan@math.unl.edu. Worth a shot.

  9. Finite Element Methods - CLAWPACK by Bob_Geldof · · Score: 2, Informative

    Have you tried CLAWPACK, unless you aren't really solving a hyperbolic problem? Disclamer: I recieved my M.Sc. in Applied Mathematics at the University of Washington and CLAWPACK was written by R.J. Leveque, a professor in that department.

    --
    887321 = 337*2633
  10. Hm, a PDE. by Secret+Rabbit · · Score: 2, Informative

    You're looking at a PDE solver which are rather difficult beasts to solve. Perhaps a look at what methods Maple or Mathematica use would provide some insight. At least it'll be a starting point.

    When it comes to display, the programs I've written always dumped the formated output to a text file. I then used gnuplot (http://www.gnuplot.info/) to view the data of interest. It can also dump the graph to a ps for inclusion in a paper is desired.

    Hope that was helpful.

  11. Try J. Comput. Phys. and J. Sci. Comput. by macklin01 · · Score: 5, Informative

    This isn't my area, but my Ph.D. is in applied and computational math, and I've spent a great deal of time solving first-order hyperbolic problems where characteristics cross. (In my context, level set methods where the zero contours can split and/or merge.)

    For a hyperbolic problem like this, you'll want to be careful. Since the waves have variable propagation speeds, there's a possibility for shock formation. (characteristics can cross) Think of Burger's equation as a nice, tangible first-order analog. In such a case, it will be important to choose a numerical method that satisfies some kind of entropy condition to handle the shock. Similar things have been encountered in level set methods, where you solve an equation of the form ft + V |grad(f)| = 0, where V is the variable speed of an interface that's represented as the zero contour of f.

    Since second-order wave equations are so important in physics, you may want to check out the Journal of Computational Physics. You should probably also try the Journal of Scientific Computing.

    As for visualization, you'll probably want to check out the "industry standards" Matlab and Mathematica. You could plot the time evolution of level surfaces of your wave equation, for instance. As for other softare, I'd generally advise pulling together what you can find at netlib, although more cutting-edge stuff may require you to roll your own C/C++ or FORTRAN. But any of that stuff will be faster than running in Matlab or Mathematica, and it will take a whole lot less memory.

    Best of luck, and have fun! :-) -- Paul

    --
    OpenSource.MathCancer.org: open source comp bio
  12. XMDS, open source PDE modeling package might do it by sidney · · Score: 3, Informative
    Your question is pretty general, but take a look at the FAQ and the examples and see if XmdS would help you with what you want.

    Quote from the home page:

    • An open-source XML based simulation package
    • From Ordinary Differential Equations (ODEs) up to stochastic Partial Differential Equations (PDEs)
    [...]
    • Documentation and source are free!
    • Runs on Linux, Unix, MacOS X and Cygwin (Windows)
  13. Re:Monte Carlo? by PDAllen · · Score: 2, Informative

    Feynman didn't invent Monte Carlo (that's Ulam, IIRC). And it wouldn't be any use here.

    Monte Carlo is useful when you have some finite input for a question (whose answer you can easily calculate given the input) and you need some kind of idea about what the output usually is: throw in random inputs until you think you have an idea. Then prove it.

    This is different: he wants to know how to calculate the answer to his problem, because it's not easy. Making random guesses won't help. Grid methods will, but they will cost a hell of a lot of memory and computation. Maybe pestering the computational fluid dynamics community would be a good idea?

  14. Re:Best way to get a quick answer. by attonitus · · Score: 5, Informative
    This is a well studied problem. I work on (time homogeneous) Maxwell's equations and we use finite elements successfully with variable coefficients. Peter Monk's book, "Finite Elements for Maxwell's Equations" has some good details. However, this is probably a more complicated problem that you want.

    I don't have any good references to hand, but for the plain old wave equation (time inhomogeneous and homogeneous) you could try looking at discontinuous Galerkin methods. Depending on the inhomogeneity in your coefficients, you might be able to use a Godunov scheme. Your local friendly applied mathematics professor specialising in numerical methods for PDEs should be able to tell you more.

    If you're interested in contemporary research, there are plenty of conferences on this kind of stuff. Here's a recent one.

  15. To Elaborate on the Submission by ObsessiveMathsFreak · · Score: 4, Informative
    There wasn't a lot one can say about a problem in the space of a Slashdot summary, so that's why it's fairly patchy. I'll take this opportunity to more fully expound my problem.

    I work on sonar/seismic/radar inversion problems. Essentially the problem of mapping terrain or subterrain by measuring scattered sound or radio signals, e.g. with synthetic aperture radar. One thing I seriously lack at the moment is a good wave simulation that I can simply play around with to get a feel for both wave mechanics itself and for the equations and techniques of the field.

    Analytical, asymptotic and ray tracing methods to approximate the wave equation are all very well, but at some point I feel I need to see a full solution, or a good approximation to one. I also need a method of simulating emitted sonar and radar pulses, their interaction with "obstacles" or features they encounter, and the returned or scattered signals from this interaction. I need a way of doing this with highly irregular scattering obstacles, both in terms of geometry and wave speed.

    What I would most like to get is a model of wave propagation in a simulated 3D domain with highly irregular boundaries and speeds, something that would defy most analytical approaches. My goal is to try and simulate actual subterranean features via fractals and other techniques, and use the numerical wave equation simulation to get a good simulation of what real life returned signals would look like. I need a good simulation because, as you would expect, the inversion algorithms that map out the terrain from the returned signals, can be very sensitive to variations in the signals they receive.

    Are you doing the time harmonic case (3-D Helmholtz) or an unsteady case?

    I'll be working in the unsteady case as I have reservations about transforming to the Helmholtz equation, not least of which is the necessity of taking the fourier transform of the source signal. I'm trying to get as exact a solution as possible.

    You don't say what goes wrong with finite difference codes...

    The ones I have tried suffer from the problems related to the CFL condition. To sum it up -if c*dt/dx is not exactly equal to one, problems arise. Greater than one and the method is unstable(horribleness). Equal to one and things are peachy. Unfortunately, less than one and the method, though stable, seems to suffer from either a numerical or some other more subtle type of instability. I'm not a numerical analysit, nor do I have time to probe further. This rules out these methods as c will be variable in any practical problem I use the code on. I'm also worried about other types of potential pitfalls; caustics, shocks, infinities, etc.

    In many cases you can use multiple-scales/WKB approaches, but that depends on how the wave speed varies (relative to the wavelength).

    Which is exactly why I don't want to use those methods, or any method that requires me to nurse or otherwise "prep" the method before use. I intend to throw multiple simulated terrains at the method and I'd like it to perform well across all ranges. I was hoping that in this day and age such a solution existed, but I'm aware I may be asking for the impossible.

    I posted the question because I was tired of unsuccessfully Googling and unwilling to waste more time playing lucky dip with tedious textbook monographs. The reason I've posted this question on Slashdot is because the comments on many a science story suggest that a lot of professional scientists do post comments here. I'm holding out that the question may catch the eye of a meteorologist or radio modeling specialist who has worked on such a problem, and who has precisely the right technique, program and visualization method I'm looking for. Here's hoping.

    There's been a lot of good suggestions so

    --
    May the Maths Be with you!
    1. Re:To Elaborate on the Submission by Nontagonist · · Score: 2, Informative

      I've been following the OpenFOAM user's mailing list for a while because I have an interest in CFD.

      While OpenFOAM is usually used for fluid dynamics, I get the impression that if it can be done in three dimensions with PDEs and the Finite Volume method, it can be done with OpenFOAM.

      I suggest you access their forums and ask what the denizens think of your problem.

      http://openfoam.cfd-online.com/cgi-bin/forum/show. cgi?1/5314

      Will take you to a fairly recent posting from the forum, from which you can navigate using the menu on the left of the screen to other postings, to search the site, or to register. (Can't post a query until you register.)

      If you want to read about OpenFOAM, just go to

      http://www.opencfd.co.uk/openfoam/

      "The OpenFOAM (Open Field Operation and Manipulation) CFD Toolbox can simulate anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics, electromagnetics and the pricing of financial options. OpenFOAM is produced by OpenCFD Ltd, is freely available and open source, licensed under the GNU General Public Licence."

      Hope you can do C++.

      Regards, Non.

      --
      There is another theory that states that this has already happened.
  16. Try using a commercial FDTD solver with dieletrics by integra_antennas · · Score: 2, Informative

    This is coming from an electrical engineer who uses 3D numerical solvers every day at work. The best package is something called CST Microwave office. You can adjust it to fit your problem by creating different dielectric materials in different regions (and thereby adjusting the velocity of the EM waves). You can adjust the material parameters (mu and epsilon) to create any material you want, including materials with negative refractive index...very interesting from a physics/mathematics point of view. For broadband applications, CST is the fastest, most stable, and user-friendly in terms of parameterization, optimization, and learning curve. It has excellent post-processing of the results, including field distributions and animation. Other packages include XFDTD, SemCad, HFSS (FEM), Comsol (FEM). Writing the code to do this on your own is a big undertaking, especially for 3D, and you should expect to spend about 12-18 months being a code-monkey. There is free 3D fdtd source code written in fortran on the net and also part of the FDTD bible published about 12 years ago by Luebbers, et. al. Out of curiosity, does this problem have a direct application, or just solving it out of academic interest?

  17. Exploration Geophysics by rumblin'rabbit · · Score: 2, Informative

    Exploration geophysics has published hundreds of papers on this topic, both for finite difference and Kirchhoff (ray tracing) methods. They refer to running the wave equation backwards in time as "migration". It corrects for the fact that seismic waves are recorded at the surface, and not at the geological reflectors. The velocity typically varies continuously, as you would expect within the earth.

    Search for "wave equation" or "finite difference" here at the search site of the Society of Exploration Geophysics.

  18. Meshless methods by Digana · · Score: 2, Informative

    As a matter of fact, I *am* an applied mathematician, and I do work in this field.

    I am just a beginner, though. Here are is a solution of the shallow water wave equations in a circular tub:

    http://platinum.linux.pl/~jordi/movies/sw-solution .ogg

    (Ogg Theora. If you can't play it, get VLC or any other free software player.)

    The method I used is a very flexible meshless method that is a relatively modern alternative to finite element methods. Btw, finite volumes are much more popular for fluid dynamical problems, but the other big two methods (finite elements and differences) are also widely used. The meshless method I used (of which there are also many available) is radial basis functions, what looks to me like a thriving area of modern research. Pros is that you avoid all the mesh generation that takes about 80% of the computational time with finite elements and you manage to keep the flexibility of meshes by allowing finer detail at problematic sites (just put more basis functions where the problems could happen). Cons is that you get ugly matrices, but if you play your method right, you can arrange it so that you only have to factorise the ugly matrix once and then just do forward and back substitutions at each iteration. I did unsymmetric collocation for my matrices, since experience seems to show that the extra work required to make the matrices symmetric yields only very small dividends. There are also ways of coupling this method with domain decomposition in order to get smaller matrices. This is in fact my thesis work. :-) If you're interested in more details and seeing my C++ source, contact me at jordigh@gmail.com

    As for visualisation software, I indirectly used VTK through Octaviz, a visualisation addon for Octave. The movies I generated with mplayer's encoder, mencoder.

    HTH :-)