Galaxy is an n–body simulator that uses a Barnes–Hut quad–tree to
calculate gravitational interactions. Typical usage is to read
a galaxy file (see galaxy(6)) from standard input using the –i
command–line option or from a file using the –f option. If no file
is read then the simulator starts with an empty universe.
Holding mouse button 1 while dragging repositions the visible
region of the galaxy. Holding mouse button 2 while dragging up
or down zooms the visible region of the galaxy in or out, respectively.
Mouse button 3 opens a menu with the following options:
Creates a new galactic body. Holding button 1 positions the body.
Holding a button 1–2 chord changes the mass/size of the body. Holding
a button 1–3 chord changes the initial velocity of the body. Releasing
button 1 restarts the simulator with the new body in motion. When
new bodies are created, the
simulator maintains the Galilean (inertial) reference frame where
the center of mass of the galaxy is at rest.|
Prompts for a floating point value to change the speed of the
simulation. E.g. a value of 2 will double the speed of the simulation
and a value of 0.5 will halve the speed. Accuracy is sacrificed
for greater speed.|
savePrompts for a file name to save the current galaxy as a galaxy(6)
Prompts for a floating point value to change the gravitational
constant. E.g. a value of 2 will double the force exerted by gravity
and a value of 0.5 will halve it.|
loadPrompts for a file name to load the galaxy from the galaxy(6)
exitExits the simulator.
The following keys are recognized as commands:
a Show accelerations as vectors.
v Show velocities as vectors.
s Show statistics such as the number of bodies being simulated,
the maximum depth of the quad–tree, and the average number of calculations
made per body.
q Exit the simulator.
del Exit the simulator.
Pause and unpause the simulator.|
Certain aspects of the galaxy simulator are controlled by the
Sets the gravitational constant to gravity. The default value
i Reads a galaxy file from standard input.
Reads the galaxy file file (see galaxy(6)).|
Specifies the number of extra processes to use in order to calculate
the gravitational force on each body in parallel. The default
value is $NPROC–1.|
Causes the process that calculates forces to relinquish the processor
for throttle milliseconds after each calculation.|
Sets the softening factor to prevent gravitational singularities
during collisions or near–collisions. The default value is 500.|
Mkgalaxy is a utility to create galaxies for simulation. Galaxies
can be assembled incrementally by reading an existing galaxy file
from standard input with the –i command–line option or from a file
with the –f option. Mkgalaxy then writes to standard output a galaxy(6)
file with a galaxy of the given size together with
the previously read galaxy. Galaxies generated by mkgalaxy have
characteristics determined by the following options:
determines the spacing between bodies. The default value is 100.|
Bodies have the given size. The default value is 25.|
av angular velocity
Bodies have the given velocity in a random direction. The default
value is 0.|
Bodies have the given angular velocity relative to the center
of mass of the new galaxy being generated. The default value is
The entire galaxy being generated is given the directional velocity
determined by the vector (x,y). The default value is (0, 0).|
sq The galaxy being generated is a square. Without this option,
the galaxy will be circular.
The entire galaxy being generated is offset by the vector (x,y).
The default value is (0, 0).|
The arguments to the –d, –s, –v, and –av arguments have the form s
or s±r where s and r are double–precision floating point numbers.
S is the base value and r if given determines a range in which
the value will vary randomly from the base.