[Solved] FYS4150 Project 3

$25

File Name: FYS4150_Project_3.zip
File Size: 160.14 KB

SKU: [Solved] FYS4150 Project 3 Category: Tag:
5/5 - (1 vote)

The aim of this project is to develop a code for simulating the solar system using a widely popular algorithm for solving coupled ordinary differential equations, the so-called velocity Verlet algorithm. An important aspect of this project is to be able to object orient your code. There are several coupled ordinary differenatial equations where the basic equations, except for various physical constants and variables, are rather similar. Thus, write once and run many times, one of the central points of object orientation, is something which makes our program easier to extend and build upon when we add more planets or moons or other astronomical objects. The basic equations which govern the system are rather simple, a set of coupled equations that codify Newtons law of motion due the gravitational force.

In the first part however, we will limit ourselves (in order to test the algorithm) to a hypothetical solar system with the Earth only orbiting around the sun. The only force in the problem is gravity. Newtons law of gravitation is given by a force FG=GM⊙MEarthr2,“>FG=GMMEarthr2,FG=GMMEarthr2,

where MEarth“>MEarthMEarth is the mass of the Earth. The gravitational constant is r“>rr is the distance between the Earth and the Sun. We assume that the Sun has a mass which is much larger than that of the Earth. We can therefore safely neglect the motion of the Sun in this problem. In the first part of this project, your aim is to compute the motion of the the Earth using different methods for solving ordinary differential equations.

We assume that the orbit of the Earth around the Sun is co-planar, and we take this to be the d2xdt2=FG,xMEarth,“>d2xdt2=FG,xMEarth,d2xdt2=FG,xMEarth,

and

FG,x“>FG,xFG,x and x“>xx and 1“>11 AU = Msun=M⊙=2×1030“>Msun=M=21030Msun=M=21030 kg. The masses of all relevant planets and their distances from the sun are listed in the table here in kg and AU.

Planet Mass in kg Distance to sun in AU
Earth MJupiter=1.9×1027“>MJupiter=1.91027MJupiter=1.91027 kg 5.20 AU
Mars MVenus=4.9×1024“>MVenus=4.91024MVenus=4.91024 kg 0.72 AU
Saturn MMercury=3.3×1023“>MMercury=3.31023MMercury=3.31023 kg 0.39 AU
Uranus MNeptun=1.03×1026“>MNeptun=1.031026MNeptun=1.031026 kg 30.06 AU
Pluto x“>xx and NASA has an excellent site at http://ssd.jpl.nasa.gov/horizons.cgi#top. From there you can extract initial conditions in order to start your differential equation solver. At the above website you need to change from OBSERVER to VECTOR and then write in the planet you are interested in. The generated data contain the y“>yy and x=1“>x=1x=1 AU and FG=MEarthv2r=GM⊙MEarthr2,“>FG=MEarthv2r=GMMEarthr2,FG=MEarthv2r=GMMEarthr2,

where v2r=GM⊙=4π2AU3/yr2.“>v2r=GM=42AU3/yr2.v2r=GM=42AU3/yr2.

Discretize the above differential equations and set up an algorithm for solving these equations using Eulers forward algorithm and the so-called velocity Verlet method discussed in the lecture notes and lecture slides.

You can choose if you wish to study the systems in this project in two or three dimensions.

Project 3b): Writing an object oriented code for the Earth-Sun system

Write then a program which solves the above differential equations for the Earth-Sun system using Eulers method and the velocity Verlet method. Write these codes without object orientation first in order to make sure everything is running correctly. Thereafter you should start planning to object orient your code. Try to figure out which parts and operations could be written as classes and generalized. Your task here is to think of the program flow and figure out which parts can be abstracted and reused for many types of operations.

For those of you who will focus on the Molecular Dynamics version of Project 5, much of the structures developed here as well as the implementation of the Verlet algorithm, can be used in that project as well.

Project 3c): Tests of the algorithms

Find out which initial value for the velocity that gives a circular orbit and test the stability of your algorithm as function of different time steps x“>xx and z“>zz-value as well) orbiting the Sun.

Check also for the case of a circular orbit that both the kinetic and the potential energies are conserved. Explain why these quantities should be conserved for circular motion.

Discuss eventual differences between the Verlet algorithm and the Euler algorithm. Consider also the number of FLOPs involved and perform a timing of the two algorithms for equal final times.

We will use the velocity Verlet algorithm in the remaining part of the project.

Project 3d): Conservation of angular momentum

Use Keplers second law to show that angular momentum is conserved. Discuss your results with circular and elliptical orbits for the Earth-Sun system.

Project 3e): Testing forms of the force

Till now we have assumed that we have an inverse-square force

FG=GM⊙MEarthrβ,“>FG=GMMEarthr,FG=GMMEarthr,

with β∈[2,3]“>[2,3][2,3]. What happens to the Earth-Sun system when 3“>33? Comment your results. Can you use the observations of planetary motion to determine by what amount Nature deviates from a perfect inverse-square law?

Consider also an elliptical orbit with an initial position 1 AU from the Sun and an initial velocity of 5 AU/yr. Show that the total energy is a constant (the kinetic and potential energies will vary). Show also that the angular momentum is a constant. If you change the parameter F(r)∝−1/rβ“>F(r)1/rF(r)1/r from β=3“>=3=3, are these quantities conserved ? Discuss your results. (Hint: relate your results to Keplers laws).

Project 3f): Escape velocity

Consider then a planet which begins at a distance of 1 AU from the sun. Find out by trial and error what the initial velocity must be in order for the planet to escape from the sun. Can you find an exact answer? How does that match your numerical results?

Project 3g): The three-body problem

We will now study the three-body problem, still with the Sun kept fixed as the center of mass of the system but including Jupiter (the most massive planet in the solar system, having a mass that is approximately 1000 times smaller than that of the Sun) together with the Earth. This leads to a three-body problem. Without Jupiter, the Earths motion is stable and unchanging with time. The aim here is to find out how much Jupiter alters the Earths motion.

The program you have developed can easily be modified by simply adding the magnitude of the force betweem the Earth and Jupiter.

This force is given again by

MJupiter“>MJupiterMJupiter is the mass of the sun and G“>GG and xy“>xyxy-plane (you can easily extend the equations to three dimensions). Modify your first-order differential equations in order to accomodate both the motion of the Earth and Jupiter by taking into account the distance in y“>yy between the Earth and Jupiter. Set up the algorithm and plot the positions of the Earth and Jupiter using the velocity Verlet algorithm. Discuss the stability of the solutions using your Verlet solver.

Repeat the calculations by increasing the mass of Jupiter by a factor of 10 and 1000 and plot the position of the Earth. Study again the stability of the Verlet solver.

Project 3h): Final model for all planets of the solar system

Finally, using our Verlet solver, we carry out a real three-body calculation where all three systems, the Earth, Jupiter and the Sun are in motion. To do this, choose the center-of-mass position of the three-body system as the origin rather than the position of the sun. Give the Sun an initial velocity which makes the total momentum of the system exactly zero (the center-of-mass will remain fixed). Compare these results with those from the previous exercise and comment your results. Extend your program to include all planets in the solar system (if you have time, you can also include the various moons, but it is not required) and discuss your results. Use the above NASA link to set up the initial positions and velocities for all planets.

Project 3i): The perihelion precession of Mercury

An important test of the general theory of relativity was to compare its prediction for the perihelion precession of Mercury to the observed value. The observed value of the perihelion precession, when all classical effects (such as the perturbation of the orbit due to gravitational attraction from the other planets) are subtracted, is 43“>4343 arc seconds) per century.

Closed elliptical orbits are a special feature of the Newtonian 1/r2“>1/r21/r2 behaviour will lead to an orbit which is not closed, i.e. after one complete orbit around the Sun, the planet will not be at exactly the same position as it started. If the correction is small, then each orbit around the Sun will be almost the same as the classical ellipse, and the orbit can be thought of as an ellipse whose orientation in space slowly rotates. In other words, the perihelion of the ellipse slowly precesses around the Sun.

You will now study the orbit of Mercury around the Sun, adding a general relativistic correction to the Newtonian gravitational force, so that the force becomes

MMercury“>MMercuryMMercury is the mass of Mercury, l=|r→×v→|“>l=|r v |l=|rv| is the magnitude of Mercurys orbital angular momentum per unit mass, and x“>xx axis. Check then the value of the perihelion angle tan⁡θp=ypxp“>tanp=ypxptanp=ypxp

where yp“>ypyp) is the y“>yy) position of Mercury at perihelion, i.e. at the point where Mercury is at its closest to the Sun. You may use that the speed of Mercury at perihelion is 0.3075AU“>0.3075AU0.3075AU. You need to make sure that the time resolution used in your simulation is sufficient, for example by checking that the perihelion precession you get with a pure Newtonian force is at least a few orders of magnitude smaller than the observed perihelion precession of Mercury. Can the observed perihelion precession of Mercury be explained by the general theory of relativity?

Introduction to numerical projects

Here follows a brief recipe and recommendation on how to write a report for each project.

  • Give a short description of the nature of the problem and the eventual numerical methods you have used.
  • Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself.
  • Include the source code of your program. Comment your program properly.
  • If possible, try to find analytic solutions, or known limits in order to test your program when developing the code.
  • Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes.
  • Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc.
  • Try to give an interpretation of you results in your answers to the problems.
  • Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts youve made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it.
  • Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you dont properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning.

Format for electronic delivery of report and programs

The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report:

  • Use Canvas to hand in your projects, log in at https://www.uio.no/english/services/it/education/canvas/ with your normal UiO username and password.
  • Upload only the report file! For the source code file(s) you have developed please provide us with your link to your github domain. The report file should include all of your discussions and a list of the codes you have developed. Do not include library files which are available at the course homepage, unless you have made specific changes to them. Alternatively, you can just upload the address to your GitHub or GitLab repository.
  • In your git repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters.
  • In this and all later projects, you should include tests (for example unit tests) of your code(s).
  • Comments from us on your projects, approval or not, corrections to be made etc can be found under your Canvas domain and are only visible to you and the teachers of the course.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] FYS4150 Project 3
$25