Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Model Magnetic Field

  1. Sep 29, 2008 #1
    Hi guys, I have been wondering how can one model the field around a bar magnet in an analytical manner. I was talking to my A-level teacher and implied that a it could be done and an whole area of maths was developed specifically for it. I wouldn't go that far, but I am sure that the idea of force fields came about though studying physical phenomena which required forces for every point in space. I am looking to understand how you can model the Magnetic field around a bar magnet.

    I have considered many ways but still cant figure out how, I get as far as being able to come up with models of interacting point particles, most likely because I haven't learn't about the concepts yet in Physics. I would love to know how to do this, and as much as possible the maths that went in to developing modeling fields like this. The idea being is that I want to write some programs that are designed to explore how the fields interact, for my personal benefit they will be by no means developed to the point that many other people would want to use them.

    Thanks Guys :-)
  2. jcsd
  3. Sep 29, 2008 #2
    Fundamentally, a bar magnet with uniform magnetization can be modeled as a solenoid with a uniform (bound) surface current:

    \vec K = \vec n \times \vec M

    Where n is an outward unit normal vector to the surface. In principle, all you have to do, then, is to plug this into the Biot-Savart law:

    \vec B=\frac{\mu_0}{4\pi}\int_\mathcal{S}\frac{\vec K \times \vec{ \hat r}}{r^2} dA
    However, Like the solenoid, this can only be evalutated to a closed form on the symmetry axis of the geometry.

    A soleniod can also be modeled as a superposition of infinitely many flat coils. In case of a cirkular geometry, the field of the flat coil (current loop) can be expressed in terms of Eliptic integrals, see https://www.physicsforums.com/showthread.php?t=200602", thus in priciple you should also be able to integrate these equations to get the field, but my guess is that this will lead to something very messy also (the last post in the thread referes to a book that supposedly treats the off-axis field of solenoids and bar magnets, so who knows...).

    If you only need points far from the magnet, you could treat is as a stack of magnetic dipoles, which can be evaluated analytically.

    However, as there are no free currents in a bar magnet, my suggestion is that you introduce a magnetic skalar potential for the magnetic H-field:


    which, in complete analogy with the electric potential, obey the Poisson equation:

    \nabla^2\Phi=-\nabla\cdot\vec M

    With the divergence of M as the "charge density". This equation is very easy and efficient to solve using Finite Element Analysis.

    As a curriosity, In case of a uniformly magnetized bar magnet, the only places the divergence of M is non-zero is at the ends, thus, the H-field is identical to the E-field of a parallel plate capacitor.

    I hope I have pointed you in the right directions as to what to look for in literature, the details of either of these methods is far to comprehensive to discuss in detail in a forum. Good luck :)
    Last edited by a moderator: Apr 23, 2017
  4. Sep 29, 2008 #3


    User Avatar
    Science Advisor
    Gold Member

    To amplify on Troels' post, the effective magnetic charge density on each pole is a fictitious quantity but very useful for solving your problem. When you calculate the field lines, the outer ones are those you observe (with iron filings, e.g.), while the inner one is called a "demagnetizing field" because it is opposite to the magnetization in the physical material.

    The book by Reitz and Milford presents the whole thing, at least for the simpler case of a sphere (it turns out that a rectangular or cylindrical bar magnet is harder to compute). Understanding it (and the post above) might be tough going if you haven't taken physics yet because the math required includes vector calculus. Two of the better elementary college books are by Sears and Zemansky, and by Halliday and Resnik; they will talk in more general terms.

    You might start with the Wikipedia articles on magnets.
  5. Sep 29, 2008 #4


    User Avatar
    Science Advisor

    The B field on the axis of a cylindrical bar magnet is not too hard to get.
    It is done in more advanced texts than Reitz and Milford.
    The field can be extended off the axis by using a Legendre Polynomial expansion.
    This is probably too advanced for you at this time.
    If you are relatively far from the magnet, you can use a dipole approximation, in which case the field is [tex]{3(\vec m}\cdot{\vec r}){\vec r}/r^5-{\vec m}/r^3.[/tex]
    Last edited: Sep 29, 2008
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook