T5: Kepler fitting
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.
- Which integrator showed the best performace in the last exercise? Lets use it from now on.
- What are the 3 Kepler laws ?
- How is a ellipse defined ?
- In our configuration, where is the focus of the orbits ?
- What do you need to calculate to prove the second law and how can you do it numerically ?
During the tutorials:
Program it!
- Take your leap-frog integrator from last time and produce some orbits.
For simplicity, put your sun in (0,0), your planet at (1,0) and only modify
the initial y velocity.
- Can you fit all orbits with ellipses ?
Use the simplifications to obtain an easy way to fit the ellipses. Remember the exercises with gnuplot !
- Modify your integrator to test the Kepler's second law.
What do you need to output additionally ?
- Measure the orbit time.
Together with the fits from before,
can you prove Kepler's third law ?
Maybe you can further explore the power of C++ (if not done already):
- Try write the output directly into a file instead of the standard output.
- Try to use a Makefile.
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):
T5.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 use it's ability to fit the orbits to obtain the orbital
parameters. Can you plot the Kepler Laws ?
Example plots:
Programming goals for T5:
Goal of this tutorial is that you acquire proficiency in
using gnuplot and learn how to use it for fiting functions to data.
In addition you should become familiar with a Makefile.