# Calculating Magnetic field strength of a magnet

• I
I have been trying to calculate the magnetic flux thought a single loop of wire occurring from a magnet (meaning it has a nonuniform field), so I have the following equation:
Φ=∮BdAcosθ
Now my problem is that I do not know how to calculate the magnetic field strength (B)of that magnet (which has a cylindrical shape) in order to find out its flux. I have not seen a clear answer to this on the internet, although I think that is is possible to use the Biot Savart equation in some form to do this?

berkeman
Mentor
In general, I think it's pretty hard and usually done via simulation (like with COMSOL). However, I did a Google search on your thread title, and came across this link that seems to have some approximations that may give you what you want:

https://www.magnet-sdm.com/2017/08/01/magnetic-field-strength-permanent-magnet/ • Abhishek11235, bob012345, Charles Link and 1 other person
In general, I think it's pretty hard and usually done via simulation (like with COMSOL). However, I did a Google search on your thread title, and came across this link that seems to have some approximations that may give you what you want:

https://www.magnet-sdm.com/2017/08/01/magnetic-field-strength-permanent-magnet/

View attachment 287262
Thank you. Indeed this is the only thing I have come across earlier today. This distance X representing the air gap between the testing points, how is it determined? And how could I find it?? I am a bit confused about this part, maybe you can give me an explanation there.

• hutchphd
vanhees71
Gold Member
If it's about magnetostatics there are two general ways to address the problem. I'm assuming a "hard ferromagnet", i.e., you have a given magnetization ##\vec{M}## within the magnet, vanishing outside. Then the macroscopic Maxwell equations for the magnetic field read
$$\vec{\nabla} \times \vec{H}=0, \quad \vec{\nabla} \cdot \vec{B}=0$$
and the constitutive equation (in HL units)
$$\vec{B}=\vec{H}+\vec{M}.$$
(a) Use of a scalar potential for ##\vec{H}##

This works only for this special case of magnetostatics without "free currents", i.e., for ##\vec{j}=0##. Since ##\vec{H}## is then vortex free there's a scalar potential,
$$\vec{H}=-\vec{\nabla} \Phi.$$
Together with the constitutive equation you get
$$\vec{\nabla} \cdot \vec{B}=\vec{\nabla} \cdot (\vec{H}+\vec{M})=-\Delta \Phi + \vec{\nabla} \cdot \vec{M}=0.$$
Since ##\vec{M}## is given by assumption, we have
$$-\Delta \Phi=-\vec{\nabla} \cdot \vec{M}.$$
With the Green's function of the Laplace operator you get
$$\Phi(\vec{x})=-\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{\nabla}' \cdot \vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$
Integrating by parts gives
$$\Phi(\vec{x})=+\int_{\mathbb{R}^3} \mathrm{d}^3 x' \vec{M}(\vec{x}') \cdot \vec{\nabla}' \frac{1}{4 \pi|\vec{x}-\vec{x}'|} = -\vec{\nabla} \cdot \int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$

(b) Use of a vector potential for ##\vec{B}##

Since ##\vec{B}## is source free there's a vector potential,
$$\vec{B}=\vec{\nabla} \times \vec{A}.$$
Since it is determined only up to a gradient of a scalar field we can impose one "gauge fixing condition", and for static fields the Coulomb gauge is the most convenient one:
$$\vec{\nabla} \cdot \vec{B}=0.$$
Then using the constituent equation we have
$$\vec{\nabla} \times \vec{H}=\vec{\nabla} \times (\vec{B}-\vec{M})=\vec{\nabla} (\vec{\nabla} \times \vec{A}-\vec{M})=0,$$
from which you get
$$\vec{\nabla} \times (\vec{\nabla} \times \vec{A})=-\Delta \vec{A}=\vec{\nabla} \times \vec{M}=\vec{j}_m,$$
which means that the magnetization is equivalent to a current density ##\vec{j}_m##, and again you can use the Green's function of the Laplacian,
$$\vec{A}(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{j}_m(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$

Last edited:
• dextercioby, sysprog and Einstein44
If it's about magnetostatics there are two general ways to address the problem. I'm assuming a "hard ferromagnet", i.e., you have a given magnetization ##\vec{M}## within the magnet, vanishing outside. Then the macroscopic Maxwell equations for the magnetic field read
$$\vec{\nabla} \times \vec{H}=0, \quad \vec{\nabla} \cdot \vec{B}=0$$
and the constitutive equation (in HL units)
$$\vec{B}=\vec{H}+\vec{M}.$$
(a) Use of a scalar potential for ##\vec{H}##

This works only for this special case of magnetostatics without "free currents", i.e., for ##\vec{j}=0##. Since ##\vec{H}## is then vortex free there's a scalar potential,
$$\vec{H}=-\vec{\nabla} \Phi.$$
Together with the constitutive equation you get
$$\vec{\nabla} \cdot \vec{B}=\vec{\nabla} \cdot (\vec{H}+\vec{M})=-\Delta \Phi + \vec{\nabla} \cdot \vec{M}=0.$$
Since ##\vec{M}## is given by assumption, we have
$$-\Delta \Phi=-\vec{\nabla} \cdot \vec{M}.$$
With the Green's function of the Laplace operator you get
$$\Phi(\vec{x})=-\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{-\vec{\nabla}' \cdot \vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$
Integrating by parts gives
$$\Phi(\vec{x})=+\int_{\mathbb{R}^3} \mathrm{d}^3 x' \vec{M}(\vec{x}') \cdot \vec{\nabla}' \frac{1}{4 \pi|\vec{x}-\vec{x}'|} = -\vec{\nabla} \cdot \int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$

(b) Use of a vector potential for ##\vec{B}##

Since ##\vec{B}## is source free there's a vector potential,
$$\vec{B}=\vec{\nabla} \times \vec{A}.$$
Since it is determined only up to a gradient of a scalar field we can impose one "gauge fixing condition", and for static fields the Coulomb gauge is the most convenient one:
$$\vec{\nabla} \cdot \vec{B}=0.$$
Then using the constituent equation we have
$$\vec{\nabla} \times \vec{H}=\vec{\nabla} \times (\vec{B}-\vec{M})=\vec{\nabla} (\vec{\nabla} \times \vec{A}-\vec{M})=0,$$
from which you get
$$\vec{\nabla} \times (\vec{\nabla} \times \vec{A})=-\Delta \vec{A}=\vec{\nabla} \times \vec{M}=\vec{j}_m,$$
which means that the magnetization is equivalent to a current density ##\vec{j}_m##, and again you can use the Green's function of the Laplacian,
$$\vec{A}(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{j}_m(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$
Wow this is really helpful, thank you very much for your contribution and time.

• berkeman
If it's about magnetostatics there are two general ways to address the problem. I'm assuming a "hard ferromagnet", i.e., you have a given magnetization ##\vec{M}## within the magnet, vanishing outside. Then the macroscopic Maxwell equations for the magnetic field read
$$\vec{\nabla} \times \vec{H}=0, \quad \vec{\nabla} \cdot \vec{B}=0$$
and the constitutive equation (in HL units)
$$\vec{B}=\vec{H}+\vec{M}.$$
(a) Use of a scalar potential for ##\vec{H}##

This works only for this special case of magnetostatics without "free currents", i.e., for ##\vec{j}=0##. Since ##\vec{H}## is then vortex free there's a scalar potential,
$$\vec{H}=-\vec{\nabla} \Phi.$$
Together with the constitutive equation you get
$$\vec{\nabla} \cdot \vec{B}=\vec{\nabla} \cdot (\vec{H}+\vec{M})=-\Delta \Phi + \vec{\nabla} \cdot \vec{M}=0.$$
Since ##\vec{M}## is given by assumption, we have
$$-\Delta \Phi=-\vec{\nabla} \cdot \vec{M}.$$
With the Green's function of the Laplace operator you get
$$\Phi(\vec{x})=-\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{-\vec{\nabla}' \cdot \vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$
Integrating by parts gives
$$\Phi(\vec{x})=+\int_{\mathbb{R}^3} \mathrm{d}^3 x' \vec{M}(\vec{x}') \cdot \vec{\nabla}' \frac{1}{4 \pi|\vec{x}-\vec{x}'|} = -\vec{\nabla} \cdot \int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{M}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$

(b) Use of a vector potential for ##\vec{B}##

Since ##\vec{B}## is source free there's a vector potential,
$$\vec{B}=\vec{\nabla} \times \vec{A}.$$
Since it is determined only up to a gradient of a scalar field we can impose one "gauge fixing condition", and for static fields the Coulomb gauge is the most convenient one:
$$\vec{\nabla} \cdot \vec{B}=0.$$
Then using the constituent equation we have
$$\vec{\nabla} \times \vec{H}=\vec{\nabla} \times (\vec{B}-\vec{M})=\vec{\nabla} (\vec{\nabla} \times \vec{A}-\vec{M})=0,$$
from which you get
$$\vec{\nabla} \times (\vec{\nabla} \times \vec{A})=-\Delta \vec{A}=\vec{\nabla} \times \vec{M}=\vec{j}_m,$$
which means that the magnetization is equivalent to a current density ##\vec{j}_m##, and again you can use the Green's function of the Laplacian,
$$\vec{A}(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\vec{j}_m(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.$$
what exactly are you referring to with M? I know the magnetisation of the Magnet is N42, which is what I know, so to what units to I have to convert this in order to use this for this equation?

If it's about magnetostatics there are two general ways to address the problem. I'm assuming a "hard ferromagnet", i.e., you have a given magnetization ##\vec{M}## within the magnet, vanishing outside. Then the macroscopic Maxwell equations for the magnetic field read
$$\vec{\nabla} \times \vec{H}=0, \quad \vec{\nabla} \cdot \vec{B}=0$$
and the constitutive equation (in HL units)
$$\vec{B}=\vec{H}+\vec{M}.$$
(a) Use of a scalar potential for ##\vec{H}##
If I understand this correctly, the method a) would be appropriate in this case since the magnet has a "static field", am I correct? So it would be a scalar potential?

vanhees71
Gold Member
what exactly are you referring to with M? I know the magnetisation of the Magnet is N42, which is what I know, so to what units to I have to convert this in order to use this for this equation?
I don't know what N42 is. Magnetization is the magnetic-dipole-moment density (magnetic moment per unit volume) of the material.

vanhees71
Gold Member
If I understand this correctly, the method a) would be appropriate in this case since the magnet has a "static field", am I correct? So it would be a scalar potential?
Yes, in this case the method with the scalar potential is simpler. It applies in regions of space, where the (free) current density vanishes, because
$$\vec{\nabla} \times \vec{H}=\vec{j}_f.$$

• Einstein44
I don't know what N42 is. Magnetization is the magnetic-dipole-moment density (magnetic moment per unit volume) of the material.
But how can I exactly find this out?
The magnetization field or M-field can be defined according to the following equation: Is this what you mean?

• vanhees71
vanhees71
Gold Member
Yes. That's correct.

Yes. That's correct.
would you mind explaining the part with the greens function for the Laplace operator? Maybe like the brief steps, because I had a bit of trouble following along what you did there.
Thanks

vanhees71
Gold Member
The Green's function of the (negative) Laplace operator is defined by the equation
$$-\Delta G(\vec{x})=\delta^{(3)}(\vec{x}).$$
The physicists hand-waving solution is that this is (up to a factor ##Q##) the field of a point charge at rest in the origin. The solution is the Coulomb potential
$$G(\vec{x})=\frac{1}{4 \pi r}, \quad r=|\vec{x}|.$$
This Green's function of "free space" (i.e., no additional boundary conditions along surfaces applied) is usually used to calculate the electrostatic potential from Poisson's equation,
$$-\Delta \Phi(\vec{x})=\rho(\vec{x}).$$
You just have
$$\Phi(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' G(\vec{x}-\vec{x}') \rho(\vec{x}'),$$
because when you evaluate the Laplacian of this expression and using the defining equation you get that Poisson's equation indeed holds for this solution.

A more formal approach to finding the Green's function is to observe that
$$\Delta G(\vec{x})=0 \quad \text{for} \quad \vec{x} \neq 0,$$
and at ##0## there must be a singularity to give the ##\delta## distribution when you apply the Laplace operator to this function.

To find this solution, just exploit the symmetry. Since ##\delta^{(3)}(\vec{x})## doesn't change under rotations around the origin, we should have ##G(\vec{x})=g(r)##. Using the Laplacian in spherical coordinates this implies
$$\frac{1}{r} \frac{\mathrm{d}^2}{\mathrm{d} r^2}[r g(r)]=0 \quad \text{for} \quad r \neq 0.$$
You can just integrate twice to get
$$r g(r)=A+B r \; \Rightarrow \; g(r)=\frac{A}{r}+B$$
with integration constants ##A## and ##B##. Now you want ##g(r) \rightarrow 0## for ##r \rightarrow \infty##. So we set ##B=0##.

To determine ##A## we integrate the defining equation over a sphere of an arbitrary radius ##a## and use Gauss's integral theorem:
$$\int_{K_a} \mathrm{d}^3 x [-\Delta g(r)]=-\int_{\partial K_a} \mathrm{d}^2 \vec{f} \cdot \vec{\nabla} g(r)=\int_{K_a} \mathrm{d}^3 x \delta^{(3)}(\vec{x}) =1.$$
Now from our solution
$$\vec{\nabla} g(r)=\vec{e}_r g'(r)=-\frac{A}{r^2} \vec{e}_r$$
and
$$\mathrm{d}^2 \vec{f}=a^2 \sin \vartheta \mathrm{d} \vartheta \mathrm{d} \varphi \vec{e}_r$$
along the surface of the sphere (in standard spherical coordinates). So finally we get
$$-\int_{\partial K_a} \mathrm{d}^2 \vec{f} \cdot \vec{\nabla} g(r)=\int_0^{\pi} \mathrm{d} \vartheta \int_0^{2 \pi} \mathrm{d} \varphi a^2 \sin \vartheta \frac{A}{a^2}=4 \pi A\stackrel{!}{=}1 \; \Rightarrow \; A=\frac{1}{4 \pi},$$
and again you get the Coulomb potential as a solution
$$G(\vec{r})=g(r)=\frac{1}{4 \pi r}.$$

• • Einstein44 and Delta2
again you get the Coulomb potential as a solution
$$G(\vec{r})=g(r)=\frac{1}{4 \pi r}.$$
You got the coulomb potential as a result, but this is different than the result you have mentioned in your first post? Sorry if this is just me being stupid but I don't understand how that result has anything to do with your first one?

vanhees71
Gold Member
In my first post I just used the Green's function. If you have an equation like
$$-\Delta \Phi(\vec{x})=\rho(\vec{x})$$
then the solution is
$$\Phi(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' G(\vec{x}-\vec{x}') \rho(\vec{x}')=\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\rho(\vec{x}')}{4 \pi|\vec{x}-\vec{x}'|}.$$

• Einstein44
f95toli
Gold Member
Note that although Vanhees71's explanation is great it is somewhat unlikely that knowing the formal solution is going to be of much help unless your geometry is very, very simple.
The solution will be in the form of some integral over 3D space and will need to be evaluated numerically for most cases. Hence, in practice it is usually as "easy" to just use e.g. a FEM solver (e.g. COMSOL if you have access to that) to solve the problem directly.

Solving problems involving real-world magnets is far from trivial and is actually still an area of active research since there are some cases where e.g. FEM can't be easily used (e.g. certain deconvolution problems)

• hutchphd, Delta2 and Einstein44
Note that although Vanhees71's explanation is great it is somewhat unlikely that knowing the formal solution is going to be of much help unless your geometry is very, very simple.
The solution will be in the form of some integral over 3D space and will need to be evaluated numerically for most cases. Hence, in practice it is usually as "easy" to just use e.g. a FEM solver (e.g. COMSOL if you have access to that) to solve the problem directly.

Solving problems involving real-world magnets is far from trivial and is actually still an area of active research since there are some cases where e.g. FEM can't be easily used (e.g. certain deconvolution problems)
Yes you're right, I might just do that. I was unaware of how complex this would be. I wanted to do this mathematically but Ill probably go the easier way to find this out.

In my first post I just used the Green's function. If you have an equation like
$$-\Delta \Phi(\vec{x})=\rho(\vec{x})$$
then the solution is
$$\Phi(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 x' G(\vec{x}-\vec{x}') \rho(\vec{x}')=\int_{\mathbb{R}^3} \mathrm{d}^3 x' \frac{\rho(\vec{x}')}{4 \pi|\vec{x}-\vec{x}'|}.$$
Thank you!

vanhees71
Gold Member
A good exercise is the homogeneously magnetized sphere. It's however indeed true, in such cases it's much more economic not to use the explicit solution given above using the Green's function but start from the differential equations, imposing the obvious simplifications from symmetry.

Let's do this problem using the magnetic scalar potential method. In Heaviside Lorentz units we have to solve
$$-\Delta \Phi=-\vec{\nabla} \cdot \vec{M}.$$
We just choose the direction of ##\vec{M}## as the 3-axis of our Cartesian coordinate system. Then we have
$$\vec{M}=M \Theta(a-r) \vec{e}_z.$$
The divergence is
$$\vec{\nabla} \cdot \vec{M}=M \partial_z \Theta(a-r)=-M (\partial_z r) \delta(a-r)=-\frac{M z}{r} \delta(a-r).$$
Now it's most convenient to work in spherical coordinates. With ##z=r \cos \vartheta## we get
$$\vec{\nabla} \cdot \vec{M}=-M \cos \vartheta \delta(a-r).$$
Thus we have
$$-\Delta \Phi=M \cos \vartheta \delta(a-r).$$
To solve this it's obvious that the ansatz
$$\Phi=\phi(r) \cos \vartheta$$
looks promising.

Using the Laplacian in spherical coordinates we get
$$-\Delta \Phi=-\frac{r^2 \phi''(r)+2 r \phi'(r)+2 \phi(r)}{r^2} \cos \vartheta \stackrel{!}{=} M \cos \vartheta \delta(a-r). \qquad (*)$$
This gives
$$r^2 \phi''(r)+2 r \phi'(r)+2 \phi(r)=M a^2 \delta(a-r).$$
Except for ##a=r## this is 0. The general solution is
$$\phi(r)=\frac{A}{r^2}+B r.$$
We must have appropriate singularities at ##r=a##, which means that there are different values for the integration constants for ##r<a## and ##r>a##. Now there's no singularity at ##r=0##. Thus we have ##A=0## for ##r<a##. Further we expect that ##\phi(r) \rightarrow 0## for ##r \rightarrow \infty##, and thus we have ##B=0## for ##r>a##. So we find
$$\phi(r)=\begin{cases} Br & \text{for} \quad r<a \\ \frac{A}{r^2} & \text{for} \quad r>a. \end{cases} \qquad (**)$$
To find ##A## and ##B## we have to look at Eq. (*) again. The ##\delta## distribution singularity on the right-hand side must come from the highest derivative on the left-hand side. So ##\phi''## has some ##\delta(r-a)## singularity and thus ##\phi'(r)## must have a jump at ##r=a## and ##\phi(r)## itself is continuous at ##r=a##.

Continuity at ##r=a## implies from (**)
$$B a=\frac{A}{a^2}.$$
Integrating (*) over a small intervall ##(a-0^+,a+0^+)## leads to
$$\phi'(a+0^+)-\phi'(a-0^+)=M.$$
With (**) this gives
$$-\frac{2A}{a^3}-B=-M \; \Rightarrow \; B=\frac{M}{3}, \quad A=\frac{M}{3} a^3.$$
Finally we have
$$\phi(r)=\begin{cases} M r /3 & \text{for} \quad r<a, \\ M a^3/(3r^2) & \text{for} \quad r>a. \end{cases}$$
Finally plugging this in our ansatz we get
$$\Phi(\vec{x})=\begin{cases} \frac{M z}{3} & \text{for} \quad r<a \\ \frac{M a^3 z}{3r^3} & \text{for} \quad r>a.\end{cases}$$
$$\vec{H}=-\vec{\nabla} \Phi=\begin{cases} -\frac{M}{3} \vec{e}_z & \text{for} \quad r<a \\ \frac{M a^3}{3 r^5}(3 z \vec{r}-r^2 \vec{e}_z) & \text{for} \quad r>a.\end{cases}$$
So inside you have a constant magnetic field and outside a dipole field:
$$\vec{B}=\vec{H}+\vec{M}=\begin{cases} \frac{2M}{3} \vec{e}_z & \text{for} \quad r<a \\ \frac{M a^3}{3 r^5}(3 z \vec{r}-r^2 \vec{e}_z) & \text{for} \quad r>a.\end{cases}$$
This is all in Heaviside-Lorentz units!

• • Homework Helper
Gold Member
2020 Award
• vanhees71 and Einstein44
bob012345
Gold Member
I have been trying to calculate the magnetic flux thought a single loop of wire occurring from a magnet (meaning it has a nonuniform field), so I have the following equation:
Φ=∮BdAcosθ
Now my problem is that I do not know how to calculate the magnetic field strength (B)of that magnet (which has a cylindrical shape) in order to find out its flux. I have not seen a clear answer to this on the internet, although I think that is is possible to use the Biot Savart equation in some form to do this?
This discussion seems very general. Do you have a specific orientation of the magnet to the loop that you want to tell us? For example if the cylindrical magnet is in the center of the loop or off axis? Is the loop diameter much larger than the magnet or about the same size?

Also, If you have a specific magnet it was manufactured by some company. If you have that information they may be able to provide you with a model of the field. Here is some information on N42 magnets.

Last edited:
• Homework Helper
Gold Member
2020 Award
I think the remenance ## B_r ## could be an important value here. With ## B=\mu_o H +M ##, (if I'm not mistaken), it gives the value of the approximate ## M ## for the magnet. For N42 I see one data sheet that gives it as from 1.28 to 1.32 T. (See also post 2 of this thread by @berkeman ).
(Note: Sometimes the units are given with the formula ## B=\mu_o H+\mu_o M ##, so that care must be taken in using published formulas that involve ## M ##, to keep the units straight).

Last edited:
• Einstein44 and hutchphd
Also, there is this Wolfram demonstration project of the field of a cylindrical bar magnet.

https://demonstrations.wolfram.com/MagneticFieldOfACylindricalBarMagnet/
I just read this post. Here they gave the two equations attached below. Which one is for what? I see they are pretty similar but have some slight differences to them. In theory, can I just substitute values into this equation and obtain the value for B that I am looking for??