To create specific simulations by configuring parameters, build a .txt file following the guidelines below.
Use option (20) from the main menu and then option (2) so the software can read the parameters contained in the .txt file.
To save a template file, use option (20) and then option (3). After that, modify the template to create your simulation.
I) Instructions to create the file "Parameters.txt":
There are two options to create the parameter file:
1) Build a "Parameters.txt" file to program the simulation parameters. You can create this file by following the instructions below.
2) Automatically create and save a default "Parameters.txt", ready for the simulation “Three balls. (default)”. Use option (3) in the previous menu. Edit this file and change the variable values to create your customized simulation.
----
Use any text editor, but always save it as plain text “.txt”. You may choose a different filename and create different files for each simulation you create.
After the file is created, load it by selecting option (1) from the previous menu to run your specific simulations.
----
The file must contain all variables (a total of 40). Each variable must be placed on a single line in the format [the variable, one or more spaces, and the value], as shown in the example:
VARIABLE value
Example:
NBALLS 2
This means we are defining the parameter “NBALLS”, the number of balls in the simulation, with value “2”.
Note: the maximum number of balls depends on your computer’s capacity but is internally limited by the size of the integer type (32767). We have not tested or programmed for extreme conditions.
Example:
BALL_MASS 1.0
This means we are defining the parameter “BALL_MASS”, which is the mass of the balls in the simulation, with value “1.0”.
Below is a complete example of all parameters for initializing the “Three balls. (default)” simulation (option 1 in the menu):
(Beginning of file)
GAS_MODE 0
NBALLS 3
BALL_RADIUS 20
BALL_SPEED 60
BALL_MASS 0.1
BALL_GRAVITY 0
BALL_G 0
PUSH_PULL 1
NEGATIVE_FORCE 0
COEF_RESTITUTION 1.0
IS_TESTING 0
IS_INFO_SIMULATION 0
INTER_PERIOD 7.0
BALL0_SPEED 0.0
BALL0_VEL_ANGLE 90
BALL0_X 0
BALL0_Y 0
BALL0_RADIUS 12
BALL0_MASS 1e-6
BALL0_TIME 0
BALL0_DELTA_SPEED 0.0
BALL0_DELTA_ANGLE 0
BALL1_SPEED 0
BALL1_VEL_ANGLE 0
BALL1_X 1000
BALL1_Y 1000
BALL1_RADIUS 200
BALL1_MASS 0.0
PISTON_MASS 10
PISTON_GRAVITY 0.0
BOTTOM_TEMP_MIN 0.0
BOTTOM_TEMP_MAX 100.0
BACKGROUND 1
ECHOES 0
SCREEN_WIDTH 480
PERCENT_WIDTH 0.50
SCREEN_HEIGHT 480
PERCENT_HEIGHT 0.80
WALL_WIDTH 20
ZOOM_FACTOR 1.0
(End of file)
Do not write “(Beginning of file)” and “(End of file)”. Write only the names and values of all the 40 variables and the blank lines between them.
The file contains a few blank lines between related parameter groups.
These lines are optional. You may remove them or add more to make the blocks clearer.
Tip: 1) Select the entire area above with the mouse. 2) Right-click and choose “Copy”. 3) Go to the text editor and choose “Paste”. The file will still work correctly even if there are spaces before each variable. 4) Save the file in “.txt” format.
----
In the next section, we explain each group and variable.
The first group is:
GAS_MODE 0
NBALLS 3
BALL_RADIUS 20
BALL_SPEED 60
BALL_MASS 0.1
BALL_GRAVITY 0
BALL_G 0
PUSH_PULL 1
NEGATIVE_FORCE 0
COEF_RESTITUTION 1.0
It contains the simulation mode (GAS_MODE x), the number of balls (NBALLS x), the ball radius (BALL_RADIUS x), the initial ball speed (BALL_SPEED x), the mass of each ball (BALL_MASS x.x), the gravity acting on the balls (BALL_GRAVITY x), the gravitational constant for gravitational simulations (BALL_G x), the collision algorithm mode (PUSH_PULL x), and the coefficient of restitution for partially inelastic simulations (COEF_RESTITUTION x.x). PUSH_PULL is an internal configuration in the algorithm (feel free to test to see the differences) and can be “0” or “1”; the default is “1”.
NEGATIVE_FORCE enables a negative force between two balls that are colliding in gravitational simulations. If “0” (default), no negative forces are applied.
The next group has three blocks and begins with IS_TESTING:
IS_TESTING 0
IS_INFO_SIMULATION 0
INTER_PERIOD 7.0
BALL0_SPEED 0.0
BALL0_VEL_ANGLE 90
BALL0_X 0
BALL0_Y 0
BALL0_RADIUS 12
BALL0_MASS 1e-6
BALL0_TIME 0
BALL0_DELTA_SPEED 0.0
BALL0_DELTA_ANGLE 0
BALL1_SPEED 0
BALL1_VEL_ANGLE 0
BALL1_X 1000
BALL1_Y 1000
BALL1_RADIUS 200
BALL1_MASS 0.0
When “IS_TESTING 1”, the simulation reads the parameters related to balls 0 and 1 (the first two). All parameters from BALL0_SPEED to BALL1_MASS control the first two balls (ball 0 and ball 1). They control positions, sizes, masses, and initial velocities (magnitude and angle). This is useful for testing and simulating satellite launching.
For ball 0, it is also possible to control a “second velocity” or “delta speed”, a velocity that is added at a specific time to change its trajectory, using BALL0_TIME (the instant), BALL0_DELTA_SPEED (the added speed), and BALL0_DELTA_ANGLE (the angle of that speed).
In the “Three balls. (default)” simulation, IS_TESTING is “0”, so you may ignore these parameters. But there are other cases where this option is useful. See the example of “Satellite launching” explained below.
IS_INFO_SIMULATION activates the information propagation simulation. The ball that contains the information begins in red and remains in that phase while propagating it. When it collides with another ball, that ball becomes red. After that phase ends, the ball turns green. INTER_PERIOD controls the duration of this phase.
Continuing: after these three blocks, the next group is:
PISTON_MASS 10
PISTON_GRAVITY 0.0
We have the piston mass (PISTON_MASS x) and the gravity acting on the piston (PISTON_GRAVITY x.x).
The next group is:
BOTTOM_TEMP_MIN 0.0
BOTTOM_TEMP_MAX 100.0
This corresponds to a simulation of “energy injection” from the bottom (an approximation). It controls how much energy can be inserted using → and ← keys.
The final group is:
BACKGROUND 1
ECHOES 0
SCREEN_WIDTH 480
PERCENT_WIDTH 0.50
SCREEN_HEIGHT 480
PERCENT_HEIGHT 0.80
WALL_WIDTH 20
ZOOM_FACTOR 1.0
These are the rendering options, such as drawing area size in points/pixels (SCREEN_WIDTH, SCREEN_HEIGHT) and background color (BACKGROUND), which may be ‘0’ or ‘1’. PERCENT_WIDTH is the fraction of horizontal screen space used by the cylinder, and likewise PERCENT_HEIGHT vertically. ZOOM_FACTOR creates a zoom effect, allowing you to choose a large area and apply a smaller zoom factor to fit it on screen.
ECHOES controls the number of echoes in the “echo effect” of the simulations. If “0” (default), the effect is disabled.
----
II) Elementary simulation: “Satellite launching”:
As a challenge, you may find the parameters for an elementary satellite launch. You must define NBALLS 2 and IS_TESTING 1 to program the first two balls. One will be the planet and the other the satellite.
You will need to define the satellite size (BALL0_RADIUS) and the planet size (BALL1_RADIUS), their masses (BALL1_MASS, BALL0_MASS), and their positions (BALL0_X, BALL0_Y) and (BALL1_X, BALL1_Y).
You must also define BALL0_SPEED (launch speed), BALL0_VEL_ANGLE (launch angle; set it to 90 degrees), BALL0_TIME (the instant the orbit velocity should be activated), BALL0_DELTA_SPEED (orbit velocity), and BALL0_DELTA_ANGLE (initial orbit velocity angle; set it to 0 degrees).
Example of “Satellite launching” (three values omitted with xxx):
(Beginning of file)
GAS_MODE 0
NBALLS 2
BALL_RADIUS 8
BALL_SPEED 0
BALL_MASS 1.0
BALL_GRAVITY 0
BALL_G 100000.0
PUSH_PULL 1
NEGATIVE_FORCE 0
COEF_RESTITUTION 1.0
IS_TESTING 1
IS_INFO_SIMULATION 0
INTER_PERIOD 7.0
BALL0_SPEED xxx
BALL0_VEL_ANGLE 90
BALL0_X 1000
BALL0_Y 788
BALL0_RADIUS 12
BALL0_MASS 1e-6
BALL0_TIME xxx
BALL0_DELTA_SPEED xxx
BALL0_DELTA_ANGLE 0
BALL1_SPEED 0
BALL1_VEL_ANGLE 0
BALL1_X 1000
BALL1_Y 1000
BALL1_RADIUS 200
BALL1_MASS 50.0
PISTON_MASS 1e10
PISTON_GRAVITY 0.0
BOTTOM_TEMP_MIN 0.0
BOTTOM_TEMP_MAX 100.0
BACKGROUND 1
ECHOES 0
SCREEN_WIDTH 2000
PERCENT_WIDTH 0.90
SCREEN_HEIGHT 2000
PERCENT_HEIGHT 0.90
WALL_WIDTH 20
ZOOM_FACTOR 0.40
(End of file)
Regarding the parameters above, you must program BALL0_SPEED (initial launch speed), BALL0_TIME (when the orbit velocity will be activated), and BALL0_DELTA_SPEED (the second velocity, i.e., the initial orbit velocity). Note that the initial launch angle is BALL0_VEL_ANGLE 90, and the angle of the second velocity (delta speed) is BALL0_DELTA_ANGLE 0.
Tip: set BALL0_DELTA_SPEED to zero, but BALL0_TIME to an instant long enough for the ball to reverse velocity. Pay attention to the values printed by the program. You will discover the altitude these values can reach.
----
III) Partially inelastic collision of two balls:
Programming with “IS_TESTING 1” is also useful for simulating the collision of two balls and studying the effect of the coefficient of restitution in a partially inelastic collision. Just set NBALLS 2 and adjust the remaining parameters. Below is an example:
(Beginning of file)
GAS_MODE 0
NBALLS 2
BALL_RADIUS 8
BALL_SPEED 60
BALL_MASS 0.1
BALL_GRAVITY 0
BALL_G 0
PUSH_PULL 1
NEGATIVE_FORCE 0
COEF_RESTITUTION 0.8
IS_TESTING 1
IS_INFO_SIMULATION 0
INTER_PERIOD 7.0
BALL0_SPEED 40.0
BALL0_VEL_ANGLE 0
BALL0_X 200
BALL0_Y 200
BALL0_RADIUS 20
BALL0_MASS 10
BALL0_TIME 0
BALL0_DELTA_SPEED 0.0
BALL0_DELTA_ANGLE 0
BALL1_SPEED 0
BALL1_VEL_ANGLE 0
BALL1_X 280
BALL1_Y 200
BALL1_RADIUS 20
BALL1_MASS 10
PISTON_MASS 1e6
PISTON_GRAVITY 0.0
BOTTOM_TEMP_MIN 0.0
BOTTOM_TEMP_MAX 100.0
BACKGROUND 1
ECHOES 0
SCREEN_WIDTH 480
PERCENT_WIDTH 0.50
SCREEN_HEIGHT 480
PERCENT_HEIGHT 0.80
WALL_WIDTH 20
ZOOM_FACTOR 1.0
(End of file)
Observe the coefficient of restitution and how the parameters after IS_TESTING 1 were configured. Ball 0 is programmed to collide with ball 1.
Enjoy your simulations!