Jeremy Emmett edited Method.md  over 9 years ago

Commit id: 45d6d3682ae2cacac056595d22280e6d890aaba4

deletions | additions      

       

##Integration Scheme  A leap frog integration scheme was used to ensure conservation of total energy. Therefore, the trajectory of particles was calculated in discrete time steps. The time step duration was set to $dt = 0.02$, a number found to be small enough to adequately preserve total energy but large enough to run the code with a practical computation time (~ 2 days). Every time step, new accelerations, velocities, and positions were calculated for every each  particle, in that order, taking the previous state vectors of each particle and the gravitational influence of every other particle into account. Acceleration was calculated for every particle in a separate routine, and called upon in the main Do Loop. To set the velocity and position a half time step apart, as is required for the leap frog integration scheme, the initial velocity and position were redefined as the following: \begin {equation} 

x=x+v dt  \end {equation}  A force softening of $\epsilon = 0.001$ was included in the acceleration subroutine to prevent particles from being ejected from the system. This was adjusted until particle motion appeared smooth and total energy was preserved.  Every 1000 time steps, position data was output for every particle in the system, providing frequent 'snapshots' of the system over the course of the simulation.  Every 10 time steps, the program output Neptune's distance from the Sun as a function of time.