Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

typodupeerror

## Numerically Approximating the Wave Equation?260

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?"
This discussion has been archived. No new comments can be posted.

## Numerically Approximating the Wave Equation?

• #### Just reverse the polarity! (Score:4, Funny)

by Anonymous Coward on Wednesday September 05, 2007 @01:32AM (#20475539)
Or perhaps you could modify the phase variance. That always works on TV.
• #### Best way to get a quick answer. (Score:4, Funny)

on Wednesday September 05, 2007 @01:34AM (#20475547) Journal

You could try putting your question online as an Ask Slashdot post. Use the Submit Story [slashdot.org] link on the left. Good luck finding your answer!

• #### Re:Best way to get a quick answer. (Score:5, Funny)

on Wednesday September 05, 2007 @05:56AM (#20476989)

You could try putting your question online as an Ask Slashdot post. Use the Submit Story link on the left. Good luck finding your answer!

No use, I can already foresee the answers you will get!

* In Soviet Russia, Wave Equations approximate YOU!
* 42
* Re: 42 - But... does it run Linux?
* I've got Dyscalculia you insensitive clod!
* Frost Pist

etc.
• #### you forgot: (Score:2, Interesting)

you forgot: "I for one welcome our variable wave speed overlords".
• #### Re:you forgot: (Score:4, Funny)

on Wednesday September 05, 2007 @10:15AM (#20479891)

variable wave speed overlords
I know what I'm gonna call my next band!
• #### Re:Best way to get a quick answer. (Score:5, Informative)

on Wednesday September 05, 2007 @09:25AM (#20479177)
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 [waves2007.org].

• #### Re:Best way to get a quick answer. (Score:4, Funny)

on Wednesday September 05, 2007 @03:21PM (#20485137) Journal
To quote an old numerical methods for PDE's specializing professor of mine...

"Godunov is good enough."

Sorry, couldn't resist.

Seriously though, if you have to ask all these questions what you really need is some mentoring. If you aren't at a university, go to one and find either the applied math guys or the engineers. Or maybe just call up the people who make fluent...
• #### What's wrong with FE/FD? (Score:4, Interesting)

by Anonymous Coward on Wednesday September 05, 2007 @01:36AM (#20475557)
Not exactly my field, but if the issues with FE/FD are ones of stability and/or convergence, have you looked into using multigrid methods? It requires more memory, but a good preconditioned, multigrid method should help reduce problems of variable speeds, no?
• #### More information is needed (Score:5, Informative)

on Wednesday September 05, 2007 @01:37AM (#20475561)
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.

• #### Re: (Score:3, Funny)

The approximate solution is, of course:

42

• #### Re: (Score:2)

Don't listen to this guy... I on the other hand recently proved a closed form time-domain solution to your problem. I think I wrote it in a margin of a book somewhere. I'll get back to it sometime and publish it...
• #### usenet (Score:4, Informative)

on Wednesday September 05, 2007 @01:40AM (#20475571)
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).
• #### Re: (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.
• #### Re: (Score:2, Informative)

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

(Google cache [72.14.205.104] of Mr Johnson's cv)
• #### Re: (Score:2)

sci.math.num-analysis might be more focused on this type of problem than sci.math and has fewer kooks. Search on google gives 148 hits for "wave equation" in that group.
• #### Perhaps here's an answer (Score:2)

I don't know enough from the question to know if this would supply the answers he needs. My answer below requires any system equations, set up as an initial-value problem. However, I would like to suggest that he try looking at the Parker-Sochacki solution to the Picard iteration (officially written up here [acm.org] in Neural, Parallel & Scientific Computations, and mentioned here [wikipedia.org] in Wikipedia, and explained here [jmu.edu]. This can give you a taylor series solution. It occurs to me that the system might be modifiable
• #### Re: (Score:3, Insightful)

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).

I think that is probably an inaccurate statement. I am guessing there are more than 50 mathematicians that read Slashdot. Problem is not quantity, it is sifting through the jokes and the offtopic posts, and the helpful suggestions to look elsewhere :) before you get to the guy that actually knows what you are asking and might have an idea of what you want.

• #### Let's try to be helpful (Score:3, Interesting)

on Wednesday September 05, 2007 @01:41AM (#20475581)
and not make fun of this person for asking a question that has nothing to do with our hobby horses. I hope this question has a small number of posts. Only well-meaning and helpful ones.
• #### Point of Order (Score:3, Insightful)

and not make fun of this person for asking a question that has nothing to do with our hobby horses.

Point of order: Is it still OK to make fun of the editors for letting this question through?

I move that the Chair recognize kdawson is an idiot.

• #### better yet, have more questions like this (Score:5, Funny)

on Wednesday September 05, 2007 @02:45AM (#20475979) Journal
Slashdot has been getting infested with non-nerds lately. We need some weed-out topics. They should appear as pop-up windows and pop-under windows in addition to appearing as normal articles. Nerds will only see one (very enjoyable) copy; non-nerds will face three terrifying articles that resemble the cruel word problems of their childhood.
• #### Re: (Score:2)

Slashdot has been getting infested with non-nerds lately.
mathematician referred to as "not nerdy enough". world confirmed coming to an end. news at 11.
• #### Re: (Score:3, Funny)

by rk (6314)
"A train leaves Cincinnati heading west at an average speed of 60 km/hr. Two hours later, another train leaves Indianapolis heading south at an average speed of 70 km/hr. What is the straight line distance between the trains 8 hours after the Cincinnati train departed? For simplicity's sake, assume Cincinnati is at 39.1 degrees north latitude, 84.5 degrees west longitude; Indianapolis is at 39.5 north latitude, 86.0 degrees west longitude, and the Earth is an oblate spheroid with polar radius 6,360 km an
• #### Re:Let's try to be helpful (Score:4, Funny)

on Wednesday September 05, 2007 @02:47AM (#20475997)
I think he'd receive a lot more meaningful and helpful comments if he had placed his problem in context.

Such as:
- Numerically solving the wave functions describing the taut jiggle of Natalie Portman's bum.
- Mapping out the three dimensional wave constructs of that odd humming in your basement.
- Discovering the finite elements of romantic pursuit and the finite differences between romantic pursuit and stalking.

You know, when in Rome...
• #### Re: (Score:2)

You seem to be missing:

-PROFIT!
• #### Don't seem to work very well? (Score:4, Informative)

on Wednesday September 05, 2007 @01:44AM (#20475601)

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.

• #### Re: (Score:2)

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

Standard level centered differencing for the wave equation has instabilities, related to the CFL condition [wikipedia.org]. Unless c*dt/dx is exactly equal to one. Greater than one and the solution is unstable. Less than one and the solution invariably develops about a 5% error per time unit. Variable wave speed means I can't get a stable mesh without drastically customizing it based on the specifics of every sp

• #### Information is scarce (Score:3, Informative)

on Wednesday September 05, 2007 @01:51AM (#20475641)
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.
• #### Re:Information is scarce (Score:5, Informative)

on Wednesday September 05, 2007 @03:31AM (#20476249)

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.
• #### Re: (Score:2)

I wanted to elaborate on Green's functions. I was working on a problem like this all summer, and Green's functions made it possible. Specifically, I used Weber's theorem to turn the 2D Helmholtz equation into a boundary integral equation. Numerical integration is much simpler to program, and the number of dimensions in my problem was reduced. Head over to the nearest Physics department. They know about Green's functions, if the other mathematicians don't.
• #### Finite element (Score:5, Informative)

on Wednesday September 05, 2007 @01:54AM (#20475663) Homepage
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.
• #### Many many options (Score:5, Informative)

by Anonymous Coward on Wednesday September 05, 2007 @01:58AM (#20475703)
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/ [web.psi.ch]). 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.
• #### Re:Many many options (Score:5, Informative)

on Wednesday September 05, 2007 @04:34AM (#20476563)
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 [mit.edu]). Installs on Linux and has a feature list rivaling commercial packages. We have used it successfully for simulating various nanophotonic structures.
• #### Re: (Score:2)

There are two free (GPL) 3d electromagnetics FDTD solvers, RadarFDTD [freshmeat.net] and Tessa [debian.org].
• #### Be much more specific... (Score:5, Interesting)

<gwowen@gmail.com> on Wednesday September 05, 2007 @01:58AM (#20475705) Homepage Journal
Are you doing the time harmonic case (3-D Helmholtz) or an unsteady case?
What does the domain look like (regular/rectangular and you may be able to use spectral methods)? In irregular domains, multigrid methods seem to converge most quickly for elliptic equations, but again, that depends on their exact form.
You don't say what goes wrong with finite difference codes... For pure Adams-Bashforth schemes often give extremely good numerical stability. You talk about variable wave speeds, but the Mathworld equation you link to doesn't cover that. In many cases you can use multiple-scales/WKB approaches, but that depends on how the wave speed varies (relative to the wavelength).

Finally: there are many things for which Googling sucks. This is one. For an proper overview, try a proper textbook, like "Waves in Layered Media", mentioned above, or "Modern Methods in Analytical Acoustics" (Crighton, Dowling et al).
• #### To Elaborate on the Submission (Score:5, Informative)

<`obsessivemathsfreak' `at' `eircom.net'> on Wednesday September 05, 2007 @10:25AM (#20480049) Homepage Journal
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 [wikipedia.org]. 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 [wikipedia.org]. 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

• #### How complicated is the problem? (Score:4, Interesting)

on Wednesday September 05, 2007 @01:59AM (#20475715)
Hi, I'm currently doing a Masters Thesis on Diffusion PDE's (Parabolic and Elliptic) correct me If i'm wrong but the wave equation is a hyperbolic PDE. I use a MATLAB Toolbox called PDE Toolbox GUI and although I don't use it I know it includes a hyperbolic solver. I haven't investigated how detailed it is, but I suggest having a look through the manual, to see if it meets your requirements. Cheers
• #### Re: (Score:2)

I was going to suggest MATLAB, too. I used it in Diff. Eq. in college whenever we needed to get numerical answers. It's too bad I've forgotten nearly everything and I can't offer any help past that.

• #### wikipedia (Score:2, Insightful)

didja try wikipedia [wikipedia.org]? :-)
• #### Finite Element Methods - CLAWPACK (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.
• #### Hm, a PDE. (Score:3, Informative)

on Wednesday September 05, 2007 @02:26AM (#20475879) Journal
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.
• #### Re: (Score:2)

Well, if you're looking at large matrices and purely numerical things, I'd advise Matlab myself. I haven't used Maple much though, and I haven't even touched Mathematica, so there's a disclaimer before the flames :).

visualisation options in Matlab are quite extensive as well.
• #### Re: (Score:2)

I've used that one too. Better than the two I listed, but still one of "those". Quite frankly, I find all of these things... lacking in there correctness. Mathematica being the worst (from what I've seen). Nothing like getting silent errors with "results" returned.

But, I didn't exactly say to use it/them, merely to investigate what methods are used so the OP could use it/them in his/her own program. After all, Maple/etc do have some serious limitations with speed/memory/etc. And at times, these limita
• #### Wave codes (Score:4, Interesting)

on Wednesday September 05, 2007 @02:36AM (#20475927)
I'm a plasma physicist and I work in the domain of radiofrequency waves propagation and absorption in fusion plasmas. I've been busy developping a code that solves the Maxwell's equations, which are equivalent to the wave equation (3-D full-wave calculation). The case of a plasma is tricky because it both time *and* space dispersive.
I won't be able to even start explaining this stuff in this post, but my code uses finite elements for the radial direction and Fourier decompositions for the two periodic directions of a fusion device. These numerical methods work well. I also know finite difference codes which work well. So, I think you should look a bit harder, because FE or FD methods usually do the trick, even for "variable wave speed at different points in the domain"... Regarding the boundary conditions, well, you'd better be very careful, because they will usually completely determine the solution. Again, it is my experience that Finite elements are well adapted to this task but you'll have to do some research.
Finally, for the vizualisation, matplotlib [sourceforge.net] and vtk [vtk.org] work for me.
First, try to determine and explain more precisely what it is you want to do: "to obtain good numerical approximations to the classic second-order wave equation, preferably in three space dimensions" sounds a but vague. Pick up the right textbooks, scientific journals, learn, exchange with the community. I know my post sounds a bit patronizing but this is science, and this kind of effort takes dedication, time and patience. I think Slashdot and Google are hardly the right places to start...
• #### Re: (Score:2)

It would be nice if you could name the "codes which work well".

I gather he's doing passive radar/sonar on variable terrain with variable weather.

• #### Here is my wave model: (Score:4, Interesting)

on Wednesday September 05, 2007 @02:36AM (#20475929)
http://kim.oyhus.no/wave.html [oyhus.no]

It is a Java applet. Note the low dispersion. Try clicking on it!

In order to make this, I avoided the standard textbook methods.
They can give good waves, but at a high cost in computation and memory.

It is not standard finite differencing, since those methods introduce dispersion
and similar errors to an unnecessary degree. But it IS a finite differencing method,
and I have done variants of it with variable speed and in 3 dimensions.

Here is one with variable speed:
http://kim.oyhus.no/seismic.mpg [oyhus.no]

One of the tricks I use is to use a hexagonal grid.

Kim Øyhus, M.Sc. Physics
• #### Re: (Score:2)

Care to give more mathematical details? While it *looks* good, there's no way to tell if your method is actually numerically doing the right thing without details on your implementation.

The way research works is that you provide technical details of how things are implemented for others to judge/validate/reproduce your results. A pretty picture, no matter how appealing, a research result doesn't make.

I'm actually interested in this, so I'd be happy to have a look at a research paper backing your Java appl
• #### need i say more (Score:2)

What numerical methods do you use, and which programs do you find best suited to the task?

Matlab.

How do you deal with stability issues, boundary/initial values, and other pitfalls?

Matlab.

Are there different methods for electromagnetic wave problems?

There's probably a toolbox that can model your problem well and at least two more that can do it poorly, assuming that you can get somewhere by throwing enough fourier transforms and PDEs into the mix. I'd probably start with the PDE toolbox and end up writing a few mex extensions in C before the day was over.

Finally, when the numbers have all been crunched, how do you visualize your hard-earned data?

Matlab or, if your results are in any way amenable to hammering with neural networks or other data mining techniques, Weka.

• #### Visualize with /dev/audio!! (Score:2, Interesting)

It's not entirely clear what you are trying to do, but one of the sweetest ways to 'visualize' wave data is to output it directly to /dev/audio and LISTEN to it as a sound waveform (actually /dev/dsp would work better for this, because it expects uncompressed data). All you have to do is open /dev/dsp, convert your data to a series of 8 bit integers, scaled to where 255 is the maximum and 0 is the minimum, do a write() on your data to /dev/dsp and viola! You have music! If you want to change things like t
• #### Re: (Score:2)

Viola? It sounds like a viola, a musical instrument that's basically a larger violin? Or did you mean voila, as in the French word?

• #### Re: (Score:2)

I think he meant "the stringed instrument which burns slightly longer than a violin". But I can't be certain.
• #### Re: (Score:2)

Hmmmm, very clever, wouldn't you say? My post talking about music has a musical pun. Not only that, it was done completely by my subconscious mind, because I hadn't even considered that viola and voila would both be let through by a spell checker. I'm so smart. Good we have human spell-checkers on slashdot to notice such things.
• #### Try J. Comput. Phys. and J. Sci. Comput. (Score:5, Informative)

on Wednesday September 05, 2007 @02:58AM (#20476069) Homepage

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 [sciencedirect.com]. You should probably also try the Journal of Scientific Computing [springerlink.com].

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 [netlib.org], 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

• #### Re: (Score:2)

If it's an easy problem, you can use Matlab/Maple, but not if it's a big one.

I'd suggest looking at PETSc, a C/C++ scientific computation toolkit. It follows a few modern programming paradigms (gah, I hate that word) which make it singularly pleasant to work with, yet has all the speed of the crap you get from netlib.

Netlib is great for low level algorithms written by experts, but is the pits for usability. For example, a matrix-vector multiply in BLAS is called DGEMV (not exactly obvious to beginners), a
• #### preconditioning (Score:2)

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.

As far as I know, when you have such kind of problem, you have to precondition your matrices. Google for preconditioning.

• #### Kreiss ... (Score:2)

Brown, David L.; Henshaw, William D.; Kreiss, Heinz-Otto; Chesshire, Geoffrey
Affiliation: AA(Los Alamos National Laboratory, NM), AB(IBM Thomas J. Watson Research Center, Yorktown Heights, NY), AC(California, University, Los Angeles; Kungliga Tekniska Hogskolan, Stockholm, Sweden)
"The fundamental principles, implementation, and applications of CMPGRD are reviewed; CMPGRD is a software package developed by Brown et al. (1988) to generate two- and three-
• #### XMDS, open source PDE modeling package might do it (Score:4, Informative)

on Wednesday September 05, 2007 @03:23AM (#20476193) Homepage
Your question is pretty general, but take a look at the FAQ [xmds.org] and the examples [xmds.org] and see if XmdS would help you with what you want.

• 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)
• #### One word: (Score:2, Interesting)

XMDS
http://www.xmds.org/ [xmds.org]
• #### Umm... (Score:3, Interesting)

on Wednesday September 05, 2007 @04:22AM (#20476495)

...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.
Look closer. Wave speed is a parameter in the DE, and all solution methods of linear DEs are local. If you treat the parameter as variable, it will be obvious what you need to do in both FEM and FDM.

What numerical methods do you use, and which programs do you find best suited to the task?
Well, always fit the method to the problem. As usual, FEM if you've got an odd boundary conditions, FDM otherwise. And don't forget other methods like integral transforms and greens functions, which can simplify or complicate your problem to varying degrees. Mathematica and Maple are good for a lot of things, having features for symbolic manipulation. Of course, D/C/LISP/Python/your-favourite-language-here work well enough for the actual crunching.

How do you deal with stability issues, boundary/initial values, and other pitfalls?
Stability issues: The best thing you can do is prove stability. See if you can fit backwards and forwards together a-la Crank-Nicholson, and check that for stability. Or, use something nicer like Runge-Kutta in the time domain.
Boundary/Initial Values: You do what you have to, I guess. That's a lot more problem specific. If you haven't got the standard initial-time/bounded space situation, you can approximate an unbounded region. It's a lot simpler than you would think, but you need to solve it for your specific problem. Bounded-time is different, but you can then do FDM in the time domain.
Other pitfalls: Stiffness can point to a flaw in your reasoning. Scaling is worth a try. Otherwise, there are always methods to deal with your specific problem. Talk to your friendly neighborhood mathematician.

Are there different methods for electromagnetic wave problems?
I think they are usually easier with analytic methods. IANA electrodynamicist, but try a few things out.

Finally, when the numbers have all been crunched, how do you visualize your hard-earned data?
Matplotlib is good if you work in Python. If your employer uses Matlab/Maple/Mathematica, use those. I find Matlab awkward, and Matplotlib is similar and has most of the same features.
• #### Finally, (Score:2)

when the numbers have all been crunched, how do you visualize your hard-earned data?

Well I start off using my fingers, and if the problem is really complicated, I take off my shoes and socks and use my toes too.
• #### Good job (Score:2)

You're asking the mental midgets at Slashdot this? Just what on Earth were you hoping to accomplish by doing that?
• #### Re: (Score:2)

That was also my first reaction, but you know, there are quite a few interesting replies. I am positively surprised. Of course there are quite a bunch of science geeks in the slashdot crowd (I'm one myself), not all readers here are "IT monkeys". Those science geeks are not very vocal on the regular IT topics, but they may speak up when their particular area of expertise plays a role in the ongoing discussion. Such expert comments (if they are genuine) are always very interesting.

Could be that the submitt

• #### Journal of Computational Physics (Score:2)

Check out copies of Journal of Computational Physics [google.com] at your university's library. It should be a good starting place for computational solutions to physical problems.
• #### General Finite Element Method (Score:2)

I've got a paper in the works that deals with something like what you've got. It's more theoretical than numerical, but it basically lays down a theoretical framework justifying and proving convergence of the finite element method for general coefficients, including discontinuous coefficients. It is based on the work of Lions and Magenes that was published in their PDE book back in the 50's, but isn't terribly widely known. My boss also has a lot of experience on the more strictly numerical side. If you
• #### Ask Slashdot (Score:2)

Dear Slashdot,

My brain exploded all over my monitor after reading that question. Since this is usually the first place I go for legal advice, I ask you: how would you go about starting a personal injury suit against the guy who asked the question?

Thanks!

• #### Ansoft HFSS (Score:2)

There are (expensive, but probably an academic discount if that's what you're doing) commercial packages for various PDE problems, usually tailored to specific applications. For example, I use Ansoft HFSS, which is an electromagnetic simulator. Our main use for the software is electromagnetic, of course, but I've used it for doing thermal resistance calculations, which can be mapped onto low frequency resistance measurements. However, the limitations are that it (1) solves the vector wave equation, not
• #### Hey, that's 6 questions! (Score:2)

Not fair. One is fine, but six are just begging someone to do the work for you. ^^

But have you considered particle modeling? Fill your experiment space with a large number of points representing your medium, and model each one only in how it reacts to its environment and neighbors. Then let it run, and watch the results. It is not determinstic, but you can often get a statistically close simulation of the real thing.
• #### Use OpenFOAM (Score:2, Interesting)

Just download OpenFOAM suite, then spend a few weeks studying how to use it, and you will learn how to make this code solve numerically almost any system of PDE-s that you throw on it. It's finite volume method.
• #### Visualization tool (Score:2)

A really powerful and flexible (generalized) viz tool is OpenDx http://www.opendx.org/ [opendx.org] which started as a commercial IBM venture and is now an open source project. It uses visual programming (EG plugging modules together) to generate the visualizations so you don't need to write your on OpenGL or something. Even with just three "modules" plugged together (and all default settings) you'll start to see your data in 2-space or 3-space.
• #### Sad (Score:2)

...that Google passes for "literature review" these days.
• #### try physicsforums (Score:2)

I haven't worked on such problems myself but I'm quite sure you'll find somebody knowledgeable and willing to help on http://www.physicsforums.com/ [physicsforums.com]
• #### Try using a commercial FDTD solver with dieletrics (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. F
• #### Re:Try using a commercial FDTD solver with dieletr (Score:2)

Out of curiosity, does this problem have a direct application, or just solving it out of academic interest?
My grant application proclaims the usefulness of my work to all and sundry, from the bade in the crib to the heights of international space programs. I however am engaged in the process, as they say nowadays, "for the love of the game".
• #### Discontinuous Galerkin Methods (Score:2, Interesting)

I'm currently getting my PhD in that area, and I'd recommend looking into Discontinuous Galerkin methods. Those are higher-order finite-element methods, and they work very well for hyperbolic problems. I can whole-heartedly recommend a book by my advisor: Nodal DG Methods [amazon.com] (it comes out next month).

DG Methods take a little time to implement, but their accuracy and speed is well worth the effort. If you'd like some precooked software, check out http://git.tiker.net/?p=hedge.git;a=summary [tiker.net]. (but be aware that t
• #### Action Minimizer (Score:2)

As an undergrad I wrote a general purpose action minimizer for the intention of approximating the shape of nuclei. If you figure out the action for the wave in four space, I can plug it in for you. Now I never got past 2d visualization, via a simple vb program making use of mschart, or exporting it in a list Mathematica could visualize. Its been 6 or so years since I've looked at it so it would take some time to figure it out. And looking back on it, I'm a bit embarrassed /impressed at the coding level. Its
• #### Exploration Geophysics (Score:3, Informative)

on Wednesday September 05, 2007 @11:07AM (#20480777) Journal
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 [seg.org] at the search site of the Society of Exploration Geophysics. [seg.org]
• #### Try FVM? (Score:2)

It's hard to say what's best, because you've given little info on the application.

The wave equation is a hyperbolic problem - I'd probably use something like Finite Volume - it's well-suited to this type of problem. People have suggested multigrid, etc - that probably won't work well.

Variable wave speeds sounds like you might end up with some shocks, depending on that velocity field. That's where FVM will really shine. I really like Randall Leveque's "Finite Volume Methods of Hyperbolic Problems". That has
• #### Meshless methods (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:

(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 d

#### Related LinksTop of the: day, week, month.

To see a need and wait to be asked, is to already refuse.

Working...