Wolfram Blog
Michael Trott

Musing about Rectangular Bar Magnets

August 27, 2013 — Michael Trott, Chief Scientist

(This is the third post in a three-part series about electrostatic and magnetostatic problems involving sharp edges.)

In the first blog post of this series, we looked at magnetic field configurations of piecewise straight wires. In the second post, we discussed charged cubes and orbits of test particles in their electric field. Today we will look at magnetic systems, concretely, mainly at a rectangular bar magnet with uniform magnetization.

As a warm-up, let’s use Wolfram|Alpha for the visualization of the magnetic induction of a magnetizable ball in a constant magnetic field. While this is a standard exercise for calculations involving spherical harmonic expansions, it is very convenient to have the magnetic field inside and outside the ball ready at one’s fingertips.

MagnetizableBallData

We define the magnetic induction in a cross section through the center of the sphere parallel to the outer field.

MagnetizableBallInCrossSection

Using the StreamPlot function, we can quickly and conveniently show the magnetic field direction in a cross section of the sphere.

StreamPlot

And here is a plot of the magnitude of the field strength.

ContourPlot

What is the energy stored in magnetic induction of the sphere outside the sphere? We use the total magnetic field and subtract the external field and integrate the magnetic energy density in spherical coordinates.

BOutsideGeneral

Now let’s come to the rectangular bar magnet. To visualize the field of a bar magnet, we first need a closed-form expression for the magnetic field strength. Again we use Wolfram|Alpha through the WolframAlpha[] function to obtain the needed formulas. Already the scalar magnetic vector potential is a pretty large expression; we display a scaled-down version.

ImageResize

As a side note, the last expression is intimately related to the above used potential of a cube. The scalar magnetic vector potential equals the derivative of the electric potential with respect to z. We also now use the more general form for arbitrary edge lengths a, b, and c to be able to model a bar magnet of realistic edge length ratios. Here is the corresponding expression for the magnetic field HRight(x, y, z). (While elementary, a closed-form expression for the magnetic field around a rectangular bar magnet was only published in 2004 by Engel-Herbert and Hesjedal.)

BarMagnetHeld

For the following examples, we choose a bar magnet of dimensions 1 x 1 x 2. Plotting the magnetic field strength in the vicinity of an edge (in the x = 0 plane) shows a pronounced singularity of the magnetic field strength along the edge.

Plot3D

Calculating a series expansion around the center of an edge shows that the type of the singularity of the field strength is logarithmic.

SeriesHBarMagnet

Magnetic materials with smooth boundaries do not exhibit arbitrarily large field strength. The existence of the edges on the cube boundary causes the logarithmic singularities in the field strengths. Practically, one cannot measure arbitrarily high field strength at the edge of a bar magnet because of the discrete atomic nature of the magnet. But the fields near an edge of a magnet are used to produce larger magnetic fields; see for instance the two papers by Samofalov ([1] [2]).

Compared with magnetic field value at the face center, in a distance one millionth of the size of the magnet from the corner, the field strength is about four times larger.

NormHBarMagnet

A look at the magnetic field in the cross section of the magnet shows the upper and lower faces as the source of the field. (These are quantitative correct versions of the typical qualitative textbook sketches for the magnetic lines of a bar magnet.)

Cross section of the magnet

Here is a slightly different view—a 3D plot of the surfaces of constant magnitude of the HRight-field.

ContourPlot3D

While the magnetic field HRight has sources, the magnetic induction BRight is source-free (remember the Maxwell equation div BRight = 0). We obtain the magnetic field BRight by adding the magnetization MRight to the magnetic field HRight. (Here we use all dimensions set to 1; of course, in SI units the magnetic field strength and the magnetic induction have different units.) The right plot shows the field lines, which now are closed. The field lines of HRight and BRight coincide outside the magnet.

BBarMagnet

Using the function LineIntegralConvolutionPlot, we can make a visualization of the field lines quite similar to the images one obtains using a real magnet and iron filings.

LineIntegralConvolutionPlot

We know that the normal components of BRight and the tangential components of HRight should be continuous functions across the boundary of a magnet. We can quickly verify this for the fields along the right vertical and top face of the magnet in the equatorial plane.

tangentialNormalPlotSide

tangentialNormalPlotTop

The magnetic induction within the magnet is approximately constant in direction and magnitude. Here is a closed form for the value at the center.

BCenter

The next two plots show the magnetic field and the magnetic induction over the magnet.

GraphicsRow

GraphicsRowVisual

We can even calculate the series expansion at the center of the magnet to get a quantitative estimation of how constant the magnetic induction is at the center for symbolic edge lengths. The first nonvanishing contributions for the deviation from a constant field value are of second order. (Meaning the constancy is less than that of a Helmholtz coil discussed in the first blog post of this series.)

Series-D

We will end this blog post with an interactive example of two rectangular bar magnets. We assume both magnets are in a plane, and we can move them freely around. What does the resulting magnetic field look like? And, more important for many applications (such as for magnetic drug delivery), what is the force on a small magnetizable particle in the field of two magnets? Because the force will be proportional to UpsideDownDelta|BRight|^2, an interesting and, in the first moment, counterintiuitive situation can arise:

The force always points toward the magnet, either to the North Pole or to the South Pole, but never away from it. By properly aligning two magnets, we can have a point outside of the two magnets where the magnetic induction BRight vanishes due to the two superimposed fields. On the side of this point toward the magnets, the force on a test particle is toward one of the two magnets, but on the other half-space, the force is away from the magnets. This effect, that the combined magnetic field of two simple magnets can be used for pushing a magnetic object away from the magnets, is of great relevance for controlled magnetic drug delivery in the human body. The following interactive demonstration lets us study the position of these points of vanishing field strength by changing the positions, orientations, and pole strengths of the two magnets.

ManipulateColumn

We end here and let the reader continue, for instance, by calculating the trajectories of a magnetic point dipole mRightSmall in the field of a rectangular bar magnet. The force on the dipole is given either by FRight ~ grad(mRightSmall.BRight) or through FRight ~ (mRightSmall.UpsideDownDelta)BRight).

Many more interesting and novel calculations can be carried out for charged cubes and bar magnets, for example, what is the equivalent to Coulomb’s (Newton’s law) of attraction between two cubes, which leads to some interesting and challenging six-dimensional integrals. We will continue our cube investigations in a later blog post.

Download this post as a Computable Document Format (CDF) file.

Posted in: Mathematics
Leave a Comment

One Comment


T Saab

Wow. Just discovered these posts and I am very impressed. FWIW, I was thinking of how I might use Mathematica to visualize problem in a college EM course I’m teaching, and these demos go a long way towards answering my problem :)
Please keep them coming.

Posted by T Saab    December 19, 2013 at 6:52 am


Leave a comment

Loading...

Or continue as a guest (your comment will be held for moderation):