Smooth Particle Applied Mechanics: The State of the Art

"Bugs" are programming errors. The list of underlying causes is endless: misspelling a variable name, omitting a comma, continuing to type past column 72, typing 0 rather than 0 or 1 rather than 1, using inconsistent array lengths, et cetera, et cetera, et cetera.
Compilers detect many bugs, but those which elude this automatic detection become the responsibility of the programmer. Debugging a program is as challenging an aspect of numerical simulation as is the original design and development of the project. Though debugging is a highly individual endeavor, a systematic process will include some of the following ideas:
Test any new program against known solutions of simple problems. Both the propagation of sinusoidal density perturbations and the decay of sinusoidal temperature perturbations can be compared with the analytical solutions from the wave and diffusion equations, as in the Example Problems of Chapter 2 .
Diagnostics, confirming that appropriate conservation laws are satisfied, are valuable checks of algorithms. In the development stages it is useful to print the total momentum and energy at every timestep.
If the problem stops with an overflow, lack of initialization, perhaps through misspelling, or division by zero, are the likely culprits. "Runtime" error messages ( including the traceback to the offending routine ) automatically generated by the system software, are usually the simplest and most reliable clues to follow in such a case. The offending location or variable can often be found by using a commercial debugging tool to generate a...