PHYSICS 141/241

Winter 2020

Laboratory Session IV.


Discussion of Assignment II

  • Assignment 2

  • package of Fortran version

  • description of the algorithm

  • Ahmad-Cohen n-body paper

  • Aarseth's paper on the nbody2 code

  • C Practice with the Aarseth Code

  • the gcc compiler is installed locally on each iMac workstation

  • nbody0-lab.c  C code 

  • initc.data

    Running the C code:
  • Compilation of C code: gcc -o xnbody nbody0-lab.c -lm
  • To run: xnbody reads in initc.data file and outputs sphere.data. 
  • initc.data  has 1 header line plus one line for each particle in 7 columns: mass, x, y, z, vx, vy, vz
  • header line of initc.data has 5 data: # of particles, eta=0.02, dt, tmax, epsilon**2=0.25
  • sphere.data has 4 columns: mass, x, y, z
  • Link to the fortran version  of the Aarseth Code:

    Aarseth web site