T10: Dynamical Friction
We are now going to use a live plummer sphere and inject a heavy particle on
a circular orbit to see it sinking down to the minimum potential due to dynamical friction.
Before the tutorials:
Do, think about, and research the following:
-  Bring your own program to the level of the example given for the last tutorial,
so that you can start from a clean and working version.
 
-  What is dynamical friction ?
 
-  What is the approximate timescale of the process ?
      Hint: For a short introduction to the subject, see chapter 4.5 of the PhD thesis of
      Francesca Iannuzzi.
     
 
During the tutorials:
Program it!
  -  load the particles from the file
     plummer_1000.ascii or  plummer_10000.ascii.gz or  plummer_100000.ascii.gz
     Hint: Switch the internal units to
    m_unit = 1.989e43;           // 1e10 Msol
    l_unit = 3.085678e21;        // kpc      
    v_unit = 1e5;                // km/s     
    t_unit = l_unit / v_unit;    
  -  Add a particle with a twenty time larger mass on a circular
    orbit at a distance of five length units. Recall how to calculate
    the circular velocity of such particle. 
 
  -  Try to plot the orbit of the test particle with time and compare
    to the expectation.
 
Example programs:
These are just examples.
- C/C++:
 - F90:
- Simple version (this is sufficient for the moment, but it doesn’t hurt you to start improving it as suggested above):
T10.f90
(colorized),
Makefile
(colorized) (rename to “Makefile” or use with “make -f Makefile_gfortran”)
 - More complex version:
(To be added later.  We will reorganize the program structure when we get to multiple particles; think about how you would do this on your own.)
 
 
Discussion of the results:
Plot your results with gnuplot and plot the behaviour of the systems.
  Can you explain what you see ?
  
Example plots:
Programming goals for T10:
Having many particles in our system and getting the program slow, we might think on a trivial
  parallelization. If you havn't done last time (T9), then think about:
  
    -  What independent within a independent loop ?
 
    -  What is the most time consuming loop where you should do something ?
 
    -  Which loop is difficult to be paralleled and why ?
 
  
  If your computer has multiple cores, you can parallelize independent loops by adding 
   #pragma omp parallel for  
  in front of it. To tell the compiler to compile with OpenMP, you have to add
   -openmp  
  to the options in the Makefile. You can control how may cores should be
  used by the program by the setting the environment variable
   export OMP_NUM_THREADS=4