next up previous


Magnetostatics with FORTRAN and Mathematica

Aleksandar Donev - Dr. Phillip Duxbury

Due Friday 10th Nov - two weeks

Physics 201 home

During the next two weeks you will develop a Mathematica code and a FORTRAN code to find the magnetic field generated by a current ring.

PROBLEM 1

Consider current flowing in a circular ring of radius R. Set R=1 and define the product: Permeability *current/4*pi = 1. Now we will use the Biot-Savart law to find the magnetic field due to this current ring centered at (0,0,0) and lying in the x-y plane.

(a) Find a general integral expression for the magnetic field at an arbitrary point (x,y,z).

(b) Evaluate your expression analytically (using Mathematica) for the special case (0,0,z). What is the magnetic field at (0,0,0)?

(c) For general (x,0,z), the integrals are called elliptic integrals and must be done numerically. Mathematica knows how to evaluate them. Using the package Graphics`PlotField`, plot the x and z components of the magnetic field in the x-z plane.

In case you have forgotten how to use the Biot-Savart law(haven't we all at some point!), here is ADDITIONAL HELP in setting up the problem.

Doing the integrals using Fortran 90

Numerical analysis is a very broad area which spans most of the areas of applications of computers, from mathematics to engineering and data analysis. In computational physics, the emphasis is on large scale number crunching and this is an area in which Mathematica is not competitive, however it takes some work to use understand and design efficient code. Some basic areas of numerical analysis are:
(i) Roots, derivatives, integrals.
(ii) Linear algebra: Equations, eigenvalues.
(iii) Partial differential equations.
(iv) Curve fitting.
In this worksheet you will write a Fortran 90 code to find the value of an integral using the Trapezoid rule. Read the introduction to numerical integration given at the site (Sections 4.0,4.1).

The numerical recipes site

PROBLEM 2. Now repeat the calculation 1(c) by writing a Fortran 90 code to evaluate the integral using the trapezoid rule. Use the trapezoid rule formula from Section 4.1 of numerical recipes. You can use the code given in Section 4.2 as a base, but convert it to Fortran 90 syntax, and write your own comments. Structure your code so that the trapezoid rule is placed in a separate module containing a function. Illustrate the convergence of the trapezoid rule by plotting the value of the integral as a function of the number of elements used in the integration, for a selected value of (x,0,z), with neither x or z non-zero(use xmgrace for this). Check that Mathematica gives the same result. Now use the vector plot facility (in FunGraphics) you used in workshseet 7 to plot the x-z vectors of the magnetic field.

Try to write this code on your own. However Aleksandar has develop some additional suggestions which you are welcome to look at.

About this document ...

This document was generated using the LaTeX2HTML translator Version 98.1p1 release (March 2nd, 1998)

Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.

The command line arguments were:
latex2html -split 0 worksheet8_f00.tex.

The translation was initiated by Phil Duxbury on 2000-10-27


next up previous
Phil Duxbury
2000-10-27