PHYSICS 141/241

Winter 2006

Lecture 1: Computer Modeling and the Course Project


Three Components of Computer Simulations

Computer modeling plays a very important role in science today. In the past, physical sciences were characterized by an interplay between experiment and theory. In experiment, a system is subjected to measurements, and results, expressed in numeric form, are obtained. In theory, a model of the system is constructed, usually in the form of a set of mathematical equations. The model is then validated by its ability to describe the system behavior in a few selected cases, simple enough to allow a solution to be computed from the equations. In many cases, this implies a considerable amount of simplification in order to eliminate all the complexities invariably associated with real world problems, and make the problem solvable.

In the past, theoretical models could be easily tested only in a few simple ``special circumstances''. So, for instance, in condensed matter physics a model for intermolecular forces in a specific material could be verified in a diatomic molecule, or in a perfect, infinite crystal. Even then, approximations were often required to carry out the calculation. Unfortunately, many physical problems of extreme interest (both academic and practical) fall outside the realm of these ``special circumstances''. Among them, one could mention astrophysical problems, like star formation, collisions of galaxies, and the large scale structure of the universe, the theory of the strong force which confines quarks permanently within the nucleon, termonuclear fusion, turbulunce, the physics and chemistry of defects, surfaces, clusters of atoms, organic molecules, involving a large amount of degrees of freedom; an accurate treatment of temperature effects, including anharmonicities and phase transitions; disordered systems in general, where symmetry is of no help to simplify the treatment; and this list could be continued almost indefinitely. Each computer simulation project outside the ``special circumstances'' requires three major components:

  • The physical problem and its theoretical model

    In computer modeling you are first and foremost a theorist. It is necessary to master the underlying physics of the proble we attack on the computer and to understand analytically as much as possible. We only want to ask the computer to do the things which cannot be done otherwise. The more analytic input we use, the more robust and powerful the computer simulation becomes. Needless to say, the development of computer experiments altered substantially the traditional relationship between theory and experiment. On one side, computer simulations increased the demand for accuracy of the models. For instance, a molecular dynamics simulation allows to evaluate the melting temperature of a material, modelled by means of a certain interaction law. This is a difficult test for the theoretical model to pass--and a test which has not been available in the past. Therefore, simulation ``brings to life'' the models, disclosing critical areas and providing suggestions to improve them. On the other side, simulation can often come very close to experimental conditions, to the extent that computer results can sometimes be compared directly with experimental results. When this happens, simulation becomes an extremely powerful tool not only to understand and interpret the experiments at the microscopic level, but also to study regions which are not accessible experimentally, or which would imply very expensive experiments, such as under extremely high pressure. Last but not least, computer simulations allow thought experiments--things which are just impossible to do in reality, but whose outcome greatly increases our understanding of phenomena--to be realized. Fantasy and creativity are important qualities for the computer modeller!

  • Algorithm and software implementation

    The advent of high speed computers--which started to be used in the 50s--altered the picture by inserting a new element right in between experiment and theory: the computer experiment. In a computer experiment, a model is still provided by theorists, but the calculations are carried out by the machine by following a ``recipe'' (the algorithm, implemented in a suitable programming language). In this way, complexity can be introduced and more realistic systems can be investigated, opening a road towards a better understanding of real experiments.

  • Analysis and visualization

    Analysis involves the physical interpretation of the data generated by the computer simulation. Visualization tools are indispensable in the interpretation of the results. For illustration we will discuss briefly the three components on the main theme of this course which is the computer modeling of N-body problems with particular applications to the collision of two galaxies and molecular dynamics.


  • Course Project Example: N-Body Modeling

    This course is an introduction to N-body simulations. We will briefly survey here the three main components of simulation projects on our chosen topic of the course.

    1. Physics and the theoretical model

    This part will illustrate the physical problem and its theoretical model as the first component of computer modeling in the general topic of N-body simulations. We will start with the underlying theoretical framework which is general enough to capture a very broad range of physical applications.
  • N-body equations of motion

    Any gravitational system may be idealized as a collection of N point-sized bodies, each with mass m_i, position r_i, and velocity v_i. The hamiltonian H=K+V for such a system is given by Newtonian mechanics where H depends on all body positions and velocities, the first sum runs over all Npairs of bodies (twice, hence the factor of 1/2), and G is the gravitational constant. Then the equations of motion are Newtonian where the sum runs over all bodies except body i

    N-body systems obey several basic conservation laws which are derived by manipulating Newton's equation. However, they may also be recognized directly from the form of the hamiltonian; Noether's theorem states that each symmetry of H gives rise to a corresponding conservation law. A symmetry of the hamiltonian is a transformation which leaves the physical system unchanged. For example, translation in time, t -> t + Delta t, is a symmetry of Eq. 1 because H is not an explicit function of time; consequently the total system energy E = T + U = H is conserved. Likewise, symmetry with respect to translation in space, r -> r + Delta r, implies conservation of total linear momentum, and symmetry with respect to rotation gives rise to conservation of total angular momentum.

    Newton's equation applies to molecular dynamics, if we replace the gravitational force by the appropriate molecular force acting between molecules in the system we are modeling.

  • Galaxy collisions

    We will illustrate the power of solving the N-body equations with  the simulation of two colliding galaxies on parabolic orbits as shown in the figure (sequence) . At close encounter during the collision, the simulation is a close match to what is observed on the sky for galaxy N4676 which is also known as the Mice. The observation on the sky is shown on the left and the simulation results are shown on the right:

    Josh Barnes and John Hibbard

    Links to Galaxy projects:

    Sloan Sky Survey

    Course Notes on Galaxy Structures

    More Astrophysics Course Notes

  • 2. Algorithm and software implementation

    The 6N coupled ordinary differential equations as displayed in Eq. 2 have to be solved numerically using some finite discretization of the time variable. Variable discretization schemes are used in the literature, like the leapfrog algorithm, or the Nordsieck predictor-corrector method. The force calculation on the right side of Eq. 2 is also a challenging problem. A naive approach will require N^2 calculations, sophisticated procedures, like FFT or the Treecode will reduce the number of operations to NlogN.

    To keep software development accessible to every student, the code we will work with will  be available in Fortran and C/C++ programming languages. It will be the student's choice which language to use. Since the discussions and applications will never be completely symmetric, it is advantageous if teams have some knowledge in both languages.

    The Fortran implementation of the famous Treecode for the collision of two galaxies is about 3000 lines and organized in a very transparent fashion. We will also work in the class with its equivalent C language implementation.

    3. Analysis and visualization

    The above example of N-body simulations and some other famous galaxy simulations are briefly discussed here.

    Two movies on the Mice (N4676)

    The first movie Mice is the final product of the project on galaxy collision. The second movie Mice (rotate) shows that the two tidal tails are not in the same plane which explains the observed skyview of N4676.

    Black Hole at the Galactic Center (Milky Way) 

    Black hole at galatic center is seen from the observation of 13 orbiting stars. The mpeg movie.

    Galaxy Collisions 

    The first simulation galaxy collision is the collision of two galaxies with black holes at galaxy centers. The second simulation galaxy cluster shows continuous galaxy collisions in a large galaxy cluster.