Galactic Collider 1.0 an interesting physics simulation Download it here! only 8939 bytes Source code available only 8403 bytes
Galactic Collider is an applet that simulates the gravitational interactions between two galaxies.
Click here to see the Applet at work
Applet Installation
Simply upload the file GalacticCollider1.zip to your site and put these HTML tags in your page:
<APPLET CODE=GalacticCollider.class
ARCHIVE=GalacticCollider1.zip WIDTH=500 HEIGHT=350>
</APPLET>
Galactic Collider: 27th Anniversary

This Applet is a commemorative alpha edition written for the 25th anniversary of a simulator developed 27 years ago (in 1972, "now" is 1999) to explain galactic structures (click the left image to run the applet). I have submitted it to JARS Java Applet Rating Service in the Science-Physics category and it was included in the TOP 25% Applets: this is a fairly good result because at that time I had a 20K memory limit for classes and HTML text.
Presentation
This applet looks very schematic. At this stage of development, 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:
- 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.
- 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.
- A "view" list field used to choose one of the three points of sight
available.
- 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 to Vector)
- DynamicPoint(mass added to KineticPoint)
- Galaxy (star cloud added to DynamicPoint).
Such an implementation 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 shorter step of time makes the simulation more precise, but a
longer one speeds up the animation.
|