5
$\begingroup$

I've spent far too much time coding and debugging multigrid. While I clearly can't post all of my code as it would be silly to ask someone to go through all that code, is there anything I should pay special attention to?

Note: I'm posting this because I don't want people to have to waste the time I had. This may not be completely relevant to computational science, but I thought it could be helpful for any beginners (as I certainly still am one).

$\endgroup$
  • $\begingroup$ What language are you using? Would a simple working Python 1D multigrid code be of any use for comparison? $\endgroup$ – David Ketcheson Feb 17 '13 at 19:16
  • $\begingroup$ @DavidKetcheson I'm using Matlab. There's so many ways to code MG though, so I don't know how comparable it would be. (Thank you though). My thoughts are that I'm missing a scaling factor somewhere. According to my norm plots, it runs for a few iterations, then the error just kinks like crazy. But the fact that it works for a few iterations suggests that I'm missing a scaling factor (or need to remove one). But I'm no expert; that's just my interpretation. $\endgroup$ – TheRealFakeNews Feb 18 '13 at 23:06
5
$\begingroup$

The smoother, restriction and prolongation can be tested independently. In essence, take a periodic domain, put in a particular Fourier mode and see if the code behaves in accordance with Fourier analysis. Also, in Briggs, Henson and McCormick's A Multigrid Tutorial you will find a section called Diagnostic tools (Chapter 4). That should help you with systematic debugging.

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

We have collected a great deal of experience on how to debug finite element codes here: https://code.google.com/p/dealii/wiki/FrequentlyAskedQuestions

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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