PH3110 Fall 2006 Runge-Kutta Integration Toolkit
John A. Jaszczak/MTU Physics
These files are designed to allow you to integrate a one-dimensional
equation of motion easily using a 4th order Runge-Kutta
integration
scheme. These are Fortran based codes meant to be run
in Unix. They will
work on phy.mtu.edu and phylab.mtu.edu. I don't know if it will work on linux. Click on the
file names below to save them on
your computer.
Here are short descriptions of the purpose of each file:
int.for The
main program to set up the problem, read in parameters
and
and contains the Runge-Kutta
subroutine
int2.for
You don't have access to this file as it contains
the solution to your PH4390 homework for next year.
Instead, you can use the compiled version (int.o)
to
create an executable code.
int.o
A compiled version of the above code using the command
f77 -e -c int.for
int2.o
A compiled version of the above code using the command
f77
-e -c int.for
(updated for driving force)
int2-g.o A compiled
version of the above code using
gnu fortran
g77 (updated for driving force)for Windows.
deriv.for This subroutine
may be edited to control the computation
if the particle's acceleration based on some force law.
It is currently set up to treat a harmonic oscillator
with a drag that is proportional to the velocity.
deriv2.for Updated to
include a driving force.
in.dat
This file contains the input parameters for the harmonic
oscillator problem and integration control parameters.
Definitions of the variables are given in the file. These
are read in by int.for so if you need to read
in other
variables you'll have
to see me to change the code for you.
in2.dat
Updated to include a driving force.
out.dat A
sample of output data from int.for. It has a
summary of
the input parameters at the top for your convenience.
The format of the data is three columns:
time, position, velocity
If you want other columns written, such as
energy
you can see me to change the code for you.
You may want to rename the out.dat file so you
can compare data sets as you vary parameters. I use a
system like out.dat01, out.dat24, etc. and keep notes
so I know which files have which varying parameters.
It is very convenient to plot this file with gnuplot
on
Unix or Windows. If you want the windows
version you
can download it from:
http://archives.math.utk.edu/software/multi-platform/gnuplot/msdos/
and click on the gplt35win.zip file. You should be able
to self extract it and get going pretty quickly if you
have used gnuplot on unix. Typical commands to run would
be:
plot "dat.out01" using 1:2 with lines
replot "dat.out02" using 1:2 with
lines
(using 1:2 selects x=column 1 and y=column 2 from the
data file "dat.out01", etc.)
lkint
Is a command script to compile deriv.for, link
it with
int.o and create the executable file int.x
Make
sure this file has command permission
(chmod u+x lkint) and you can execute it by just typing
the file name.
lkint2 Compiles the
updated (for driving force) codes.
int.x
This is the executable file. After you create it,
or you should be able to just type int.x to run it.
int2.x
It will read the data from in.dat and create a
new
file out.dat with the output data.