# Introduction to Computational Physics - Class Project

## Lidia Langof- Physics, Technion.

This program simulates coupled oscillator motion with a driving force acting on one of the oscillators (the second from the left). Each oscillator is a pendulum connected to its neighbors by springs. There is  possibility to add a friction force to the system. The user  can  change the  number of oscillators,  spring coefficient,  friction force,  amplitude of the driving  force and the integration time .  You can see how  these changes effect the system .  For the maximum  number of  oscillators the wave propagation can be monitored.

To solve this problem one must solve a system of differential equations which contains trigonometric functions (sin) .  Not every algorithm will give a stable solution when used for this. There are four different algorithms in the program. Three of them are user written (Euler, Mid-point and Verlet ), and the fourth is the IMSL routine  IVPAG. IMSL is  mathematics library which enables one to use  its routines in order to solve  different mathematics problem. The Euler algorithm and IVPAG give stable solutions, and the Mid-Point and Verlet give a non convergent solution. This can be seen by monitoring the total energy of the system (with driving force and friction zero) through a few runs of the program. Integration time can be changed only for the first three algorithms. If you change  it you can check if the solution is more or less stable  (again by monitoring the energy). There is also a possibility to do the integration backward (by clicking the Inv. time). In this case you should see a backward motion on the screen, the oscillators should return to the start position, and the energy should be the same as in the beginning (when friction force is zero). If you continue running the program for some time, you should notice that the oscillators are entering some stable mode of motion.

This project uses FORTRAN,PGPLOT and IMSL; the programs can be obtained by http  from the Computational Physics http server. They are compiled on AIX machines such as turbo and minerva1 with the command

" xlf -o !:1.ex  -L/usr/local/lib -lpgplot -lX11 \$FFLAGS !:1.f  \$LINK_FNL "  .

On tx replace xlf with f77 for the same results. You need to write

source /usr/local/imsl/setup.csh

before compiling on Technion machines, more information on compilation and on this project by email.

### Online material is available for the Fall 1997

Computational Physics Class

Last updated on : Sun May 31