Galactic Collider: 25th Anniversary

Galactic Collider 1.0JARS TOP 25% This week Science History and Weekly Applets are linked togheter. In fact, the applet provided is Galactic Collider 1.0 a commemorative alpha edition of a simulator developed 25 years ago (in 1972, "now" is 1997) to explain galactic structures (click the image to run the applet). I have submitted it to JARS Java Applet Rating Service in the Science-Physics category and it was recently included in the TOP 25% Applets: this is a fairly good result because I had a 20K memory limit for classes and HTML text. As soon as possible I'll provide a new and better version here in GeoCities.

Submission Data

Resource name: Galaxies
Official name: Galactic Collider 1.0 alpha
       Author: Leonardo Boselli
Email Address: tetractys@oocities.com
  Program URL: http://www.oocities.org/SiliconValley/Lakes/3015/galaxies.html
   Source URL: click here to download the source code (8.20 Kb).
   Review URL: click here to read the detailed review of JavaWorld.

Presentation

This applet looks very schematic. At this stage of development, owing to page size constraints (20K), I have removed some non essential features and implemented a simple graphic interface with a double buffered panel for real time animation. However, the final effect is rather realistic, because stars are represented with randomly distributed pixels, giving the idea of real world galaxies.

Purpose

This program is a simulator that shows the gravitational force effects in the evolution of galactic structures. The reasons for such an applet are two. First of all it proves one more time that Java is a fundamental language for educational purposes useful even when the computation speed is critical (this is a success of the processor independent machine code added to fast JIT compilers). In second place, this year (1997) is the 25th anniversary of the publication of the Toomre brothers' article in which the evolution of characteristic structures of observed galaxies were explained for the first time with computer simulations. That work demonstrated that the newtonian laws of gravitation and inertia are the only responsible for such structures, getting rid of other theories which gave that role to magnetic forces.

Performance

The present code has no known bug. I mean that the simulator acts as we expect for every combination of significative starting values. However, there are some annoying behaviours: sometimes the random location generator constructs isolated stars in the neighbourhood of the galaxy and stars near the kernel are shot away when the galaxy mass is set to high values (e.g. more than 500e9 sun masses). Both malfunctions are currently not fixed to privilege the computation speed. Moreover, the algorithms used are optimized for this purpose and are chosen as fast as possible.

Content

This applet performs a simulator of interactions among galaxies using more or less the same assumptions made in the Toomre's article cited before: every galaxy is an ellipsoid in which stars follow circular orbits. Stars are subject to the gravitational attraction (inverse square distance law) and the only massive bodies are the kernels. With this simple model it's possible to obtain the most common galactic structures (e.g. spiral arms) and even particular ones (i.e. filaments, bridges of matter, rings, etc.).

There are four components in the panel of the applet:

  1. A "Start/Stop" button. It permits to stop the simulation when an interesting configuration in reached. It must be used also to alter the starting values because changes in the text fields are updated only when the simulation is stopped and restarted.
  2. Text fields for starting values. They set the mass of both galaxies (in sun masses), the speed of the small galaxy along the x axis in the initial view (in light-years/years) and the time step of the simulation (in years), useful to speed up the calculation or to increase the precision of rendering.
  3. A "view" list field used to choose one of the three points of sight available.
  4. An "edit" list field that is used to select the property (location or angle) to be changed with click and drag operations. The galaxy nearest the click is altered and this modifies its property until the drag operation ends. If the simulation is interrupted, changes are shown in real time, otherwise the animation panel is updated only at the end.
The user can't change the radii or the number of stars and the construction-destruction of galaxies is one of the removed features.

Source Code

The source code is included (click here to download). This applet uses the object oriented characteristics of Java. Stars and kernels are implemented through a hierarchy of the following classes: Vector (it's not the java.util.Vector; it includes space coordinates and related methods) -> KineticPoint (Vector velocity added) -> DynamicPoint (mass added) -> Galaxy (star cloud added). Such an implementation is disk space consuming (because of the constant pool overload for small and very similar classes - drawback perhaps overcomed with JDK 1.1), but makes the code easy to undestand. The tecnique used to develop the simulator is the usual one: at a given time stars and kernels have location and velocity. For such location is calculated the acceleration, which is used to find the velocity after the given step of time. Then the position is updated with the obtained velocity. A short step of time makes the simulation more precise, but a long one speeds up the animation.

Future Plans

Now that I homestead at GeoCities, as soon as possible I shall add some interesting features. First of all the possibility to create and destroy galaxies (choosing radius, depth and stars number) will be restored. Then a more appealing and user-friendly interface will be implemented, for example including slide bars for data and a control for the elapsed time. Finally, the galaxies will be no longer represented with scattered pixels, but with an uniformly distributed color intensity proportional to the density of stars, getting a photo-realistic effect. Presently I don't know if this last feature could be realized with acceptable loss of performance.


TETRACTYS Freeware Main Page

In the next Issue Weekly Applet will be

Applet Loader

while Science History will be

Alan Turing: can machines think?

GeoCities