Magnetic field of coils
Profiles the magnetic field along a selectable curve for a helical (solenoidal or toroidal) current loop using the
Biot-Savart law. The Biot-Savart line integral is represented first symbolically in terms of a parametric path in
three dimensions, then converted to a function of the parameter and integrated numerically. The results are
compared to analytic results for an ideal solenoid or toroid.
Author: D. Carlsmith
Table of Contents
Introduction...............................................................................................................................................................1
Initialize.....................................................................................................................................................................2
Try this: Change the pitch Loopstep of the helix to see the impact on the central field strength..........................2
Try this: Change the sampling distance Zstep to create a smoother plot of the variation along the sampling
line........................................................................................................................................................................ 2
Try this: Change the transverse coordinates of the sampling line to profile the magnetic field along your choice
of line parallel to the solenoid axis........................................................................................................................2
Try this: Replace the solenoidal field with a toroidal winding. ............................................................................3
Try this: Change the range of the number of turns in the coil. .............................................................................3
Loop over number of turns in the coil....................................................................................................................... 3
Create symbolic expression for magnetic field integrand......................................................................................... 3
Plot the current loop in 3d space.............................................................................................................................. 4
Try this: Change toroidal sampling line radius to sample elsewhere within, exterior to, or interior to the torus....
5
Loop over field points along the profile line parallel to the -axis and compute ........................................................ 6
Loop over field components and perform integration over current. ......................................................................... 6
Plot field components along sampling curve. .......................................................................................................... 7
Try this: For the solenoid, compare the vertical line z-component to the exact axial field of an ideal coil...........7
Introduction
The Biot-Savart law expresses the magnetic field
at position due to a current I in a circuit as a line integral
over differential circuit elements :
.
By writing the vector differential element of length in terms of a parameter t as , we can convert
the vector line integral into an integral over the parameter t. The vector derivative is tangential to the
circuit.
The magnetic field within a helical coil of length L and number of turns Ncentered on the z-axis, for
and constant can be found using found using Ampere's law. It is uniform and axial and has magnitude
.
1