|
|
|
Gravity simulation on a desktop computer |
|
|
Software
|
There are 3 Grav-Sim command-line simulators (note that Windows executables have the extension .exe):
They all accept the same set of arguments.
You can specify a model file to load (default "model.csv") with the –f option, e.g.:
You can specify a model file to save (default "result.csv") with the –r option, e.g.:
You can choose to save an orbit file (default "none") with the –o option, e.g.:
You can run a simulation for a specific simulated-time with the –m option, e.g.:
For help on the other options available, try:
Grav-Sim uses comma-separated-values (.csv) files for convenience. The layout is simple, efficient and human-readable.
The files can be loaded into any text editor and are readily accepted by a variety of other software packages such as Microsoft Excel.
Each body appears once in a Grav-Sim model file on a separate line. Each body has a unique id, a mass, a position and a velocity. Position and velocity are 3D vectors, specified as x,y,z components.
The first line in the file contains the header info:
<no. of bodies>,Mass,Pos(x),Pos(y),Pos(z),Vel(x),Vel(y),Vel(z)
All subsequent lines contain 8 columns of numbers separated by commas.
For example, the Grav-Sim 2-body model file "model2.csv" appears as follows in a text editor:
If you view it in Microsoft Excel, it appears as follows:
| 2 | Mass | Pos(x) | Pos(y) | Pos(z) | Vel(x) | Vel(y) | Vel(z) | |
| 0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.02 | 0.0 | |
| 1 | 0.1 | 5.0 | 0.0 | 0.0 | 0.0 | -0.2 | 0.0 |
Each body can appear on multiple lines in a Grav-Sim orbit file. Each line represents a portion of an orbit and has a unique id, a mass, a starting position and a finishing position. The unique ids are carried across from the model file and let you tally which body is which. Positions are 3D vectors with x,y,z components as before.
The first line in the file contains the header info:
<no. of bodies>,Mass,Pos1(x),Pos1(y),Pos1(z),Pos2(x),Pos2(y),Pos2(z)
All subsequent lines contain 8 columns of numbers separated by commas.
For example, if you run a Grav-Sim simulation on the 2-body model file "model2.csv" and output the orbits to a file "orbit2.csv", the first few lines would appear as follows in a text editor:
If you load "orbit2.csv" into Microsoft Excel, it would appear as follows:
| 2 | Mass | Pos1(x) | Pos1(y) | Pos1(z) | Pos2(x) | Pos2(y) | Pos2(z) |
| 1 | 0.1 | 5 | 0 | 0 | 4.99 | -0.141318 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0.00100035 | 0.0141318 | 0 |
| 1 | 0.1 | 4.99 | -0.141318 | 0 | 4.95992 | -0.282009 | 0 |
| 0 | 1 | 0.00100035 | 0.0141318 | 0 | 0.00400733 | 0.0282009 | 0 |
A minimal viewer is provided for the purpose of visualising Grav-Sim model and orbit files:
This also uses the -f option to specify the file to load.
Depending on whether the file loaded is a model file or an orbit file, GravView either runs the simulation in real-time as you watch or replays the sequence as pre-recorded in the file.
The images in the Models section were produced using GravView.