Changes for CIS 455
- Code Maintenance and Cleanup
Some of my original code for this project was quite ugly as some of the program was hacked together at the last minute. Several methods were rewritten or reorganized to make the code easier to read and work with. A number of monster-sized methods were decomposed into more tightly-defined procedures. The code was also converted to Java 2 (JDK 1.2.1). This required the rewriting of some routines using deprecated methods, but was basically trivially. Not that the GUI was not converted to Swing. Note that despite this clean-up, the code is still not perfectly designed. Ideally, the code could use a complete rewrite.
- Reworked Thread Design
This could probably go under the above category, but was a somewhat major task. At least, I did a fair bit of research on Java threads so things are done right now. The actually number of lines rewritten was small.
- Reworked Data Recording Facility
The ability to store simulation data to a file was available in the first version, but many new feature have been added. The data recording dialog box has been completely reworked, so that now any combination of parameters can be selected for writing to the data file.
- Fourth-Order Runge-Kutta Numerical Integration
This is the major new feature added. Even more so than with the threads, the major work was in research and figuring out how to implement the method. The Runge-Kutta code is probably only 100 lines or so. Though general information on the Runge-Kutta method is available, I did not find any description of it applied to the n-body problem. Well, actually I did find something, but only after I had done my implementation. The page did provide nice confirmation that my implementation was correct.
- Variable Timestep for RK4 Integration
A well-known way to improve the accuracy of numerical integration (or equivalently lessen computational time) is to vary the timestep. A small timestep should be used for fast moving bodies, and a larger timestep can be used for rapidly moving bodies. I wanted to apply this technique to my simulation, but I also wanted to keep the simulation real time, and moreover have wall clock time be proportional to time passing in the simulation. The dynamic timestep scheme I came up with does (roughly) accomplish these goals, but it really is no improvement over the standard RK4 method I implemented.
- Facilities for Judging Numerical Accuracy
I wanted to build in some features that would allow the effective comparison of the RK4 and Euler methods. This proved somewhat more difficult than I anticipated. For a full discussion, see the intro/overview page. The one main feature added to the program (as opposed to external data analysis) was the ability to display and record the total linear momentum of the system at any time.
Page Maintained By: Brendan McMahan
Email to: email@example.com
Last Modified: May 26, 1999