Nbody tutorial


1. Displaying motion using axes origins and transformed coordinates


Start with the '2-body' example. Tap the 'Examples' tab bar button, tap the '2-body' example in the table, and tap the 'Load' button. You will be taken back to the Motion view. Tap the 'go' button (triangle at lower right) to start the simulation. The button image will change to a square, indicating 'stop'. The 'reset' button is next to it. The motion should look like the image at left.

Tap the 'Masses' tab bar button to go to the Masses view. This view shows a table of all masses in the simulation. The mass in kilograms is shown on the main line of each row, and the initial position ({x, y, z}) in meters is shown on the subtitle line. Tap the '>' detail button for Mass 1. Tap the Mass text field and enter a value of 1.25. Then tap 'return' on the keyboard. Tap the 'Save' button, and then tap the Motion view button in the tab bar. Tap the 'reset' button (at lower right, backward triangle with a vertical line). Then tap the 'go' button. Now you should see both masses spiraling off to the left. Tap and drag the display to rotate them into view, like the image at left.

Tap the 'Settings' tab bar button to go to the Settings view. In the middle of the set of items is the 'Axes origin' control. Tap the 'Centroid' segment of the control, and then tap the 'Save' button. Back in the Motion view, tap 'reset' and then 'go', and you should now see the motion depicted at left. The axes origin is now set to the center of mass (centroid), which follows the masses as they move off along the -y axis. The trails of each mass therefore seem to move off along the +y axis, although they are actually standing still. Thus, the centroid coordinate system is a moving coordinate system which follows the center of mass.

Tap the 'Settings' tab bar button again to go back to the Settings view. Now tap the 'Transform trails' switch so that it is set to 'on'. Tap the 'Save' button. Tap 'reset' and then 'go', and you should now see the motion depicted at left, which is the familiar elliptical orbits of the two masses. However, the masses are still moving along -y, and the coordinate system is following them, but now the {x, y, z} coordinates of all trails are being transformed to the moving coordinate system as well, so that only the relative motion between the two masses is being shown.

Tap the 'Settings' tab bar button again to go back to the Settings view. Tap the 'Mass #' segment of the 'Axes origin' control. The text field next to the control should read '1' (tap and edit it if it doesn't). Tap the 'Save' button. Tap 'reset' and then 'go', and you should now see the motion depicted at left, which shows the motion from the viewpoint of mass 1 (you may need to zoom out by tapping the '-' button at upper left). If this mass were the Earth, this would be called 'geocentric' coordinates. You can set the 'Mass #' text field to '2' (remembering to then tap 'Save') to see the motion from the viewpoint of mass 2.

Finally, go to the Masses view, tap the '>' button for mass 2, tap the text field for 'VY0' and enter '.625'. Tap 'return' and then 'Save'. Go to the Settings view and tap the '{0, 0, 0}' segment of the 'Axes origin' control, then tap 'Save'. Tap 'reset' and then 'go', and you should now see the motion depicted at left. You are now seeing the actual {x, y, z} coordinates of each mass in a closed elliptical orbit without moving along -y (verify this by turning off the 'Transform trails' switch). This is because now the total momentum of the system is equal to zero. Specifically, 1.25 * 0.5 = 1.00 * 0.625 = 0.625 Kg m/s. When you set the mass of mass 1 to 1.25 earlier, the total momentum became negative along the y axis, so the center of mass moved that way. By increasing the initial y speed of mass 2 to 0.625, the net momentum was returned to zero, so the masses now stay in place again.


NOTE: After editing the initial position or velocity of a mass, you MUST tap the 'reset' button for the changes to take effect.


SUMMARY:
1. The coordinate axes can be set to display motion based on fixed {x, y, z} values, based on the moving coordinates of the center of all masses, or relative to the moving coordinates of a specific mass.
2. Motion trails can be displayed as unmoving {x, y, z} coordinates, or they can be transformed to the current (possibly moving) coordinate system to show relative motion.
3. If the total momentum (sum of mass * signed velocity for all masses) is zero, the center of mass will stay in one place, otherwise it will move.


© 2009 Sky Coyote