User:Thypingvinen/sandbox/Halbach

The method used to find the field created by the cylinder is mathematically very similar to that used to investigate a uniformly magnetised sphere.

Because of the symmetry of the arrangement along the cylinder's axis, the problem can be treated as two-dimensional. Work in plane-polar coordinates $$(r, \theta)$$ with associated unit vectors $$\hat\mathbf{r}$$ and $$\hat\boldsymbol{\theta}$$, and let the the cylinder have radial extent $$r_\mathrm{i} < r < r_\mathrm{o}$$. Then the magnetisation in the cylinder walls, which has magnitude $$M_0$$, rotates smoothly as
 * $$\mathbf{M}_\mathrm{cyl} = M_0 (\cos\theta\, \hat\mathbf{r} + \sin\theta\, \hat\boldsymbol{\theta})$$,

while the magnetisation vanishes outside the walls, that is for the bore $$r < r_\mathrm{i}$$ and surroundings $$r > r_\mathrm{o}$$.

By definition, the auxilliary magnetic field strength $$\mathbf{H}$$ is related to the magnetisation and magnetic flux density $$\mathbf{B}$$ by $$\mathbf{B} = \mu_0 (\mathbf{H} + \mathbf{M})$$. Using Gauss' law $$\nabla\cdot\mathbf{B} = 0$$, this is equivalently

Since the problem is static there are no free currents and all time derivatives vanish, so Ampère's law additionally requires $$\nabla\times\mathbf{H}=0 \implies \mathbf{H} = \nabla\phi$$, where $$\phi$$ is the magnetic scalar potential (up to a sign under some definitions). Substituting this back into the previous Equation $$ governing $$\mathbf{H}$$ and $$\mathbf{M}$$, we find that we need to solve

which has the form of Poisson's equation.

Consider now the boundary conditions at the cylinder-air interfaces $$r = r_\mathrm{i}$$ and $$r = r_\mathrm{o}$$. Integrating $$\nabla \times \mathbf{H} = 0$$ over a small loop straddling the boundary and applying Stokes' theorem requires that the parallel component of $$\mathbf{H}$$ is continuous. This in turn requires that $$\phi$$ is continuous across the boundary. (More properly this implies that $$\phi$$ must differ by a constant across the boundary, but since the physical quantities we are interested in depend on gradients of this potential, we can arbitrarily set the constant to zero for convenience.) To obtain a second set of conditions, integrate Equation $$ across a small volume straddling the boundary and apply the divergence theorem to find
 * $$\left[\frac{\partial \phi}{\partial r}\right] = \pm \mathbf{M} \cdot \hat{\mathbf{r}}$$,

where the notation $$[f]$$ denotes a jump in the quantity $$f$$ across the boundary, and in our case the sign is negative at $$r = r_\mathrm{i}$$ and positive at $$r = r_\mathrm{o}$$. The sign difference is due to the relative orientation of the magnetisation and the surface normal to the part of the integration volume inside the cylinder walls being opposite at the inner and outer boundaries.

In plane-polar coordinates, the divergence of a vector field $$\mathbf{F} = F_r\hat\mathbf{r} + F_\theta \hat\boldsymbol{\theta}$$ is given by

Similarly, the gradient of a scalar field $$f$$ is given by

Combining these two relations, the Laplacian $$\nabla^2 f = \nabla\cdot(\nabla f)$$ becomes

Using Equation $$, the magnetisation divergence in the cylinder walls is

\begin{align} \nabla \cdot \mathbf{M}_\mathrm{cyl} &= \frac{1}{r}\frac{\partial}{\partial r}(r M_0 \cos\theta) + \frac{1}{r}\frac{\partial}{\partial\theta}(M_0 \sin\theta)\\ &= \frac{M_0 \cos\theta}{r} + \frac{M_0 \cos\theta}{r}\\ &= \frac{2M_0 \cos\theta}{r} \end{align} $$. Hence Equation $$, which is that we want to solve, becomes by using Equation $$ {{NumBlk | : | $$ \frac{1}{r}\frac{\partial}{\partial r}\left(r \frac{\partial \phi}{\partial r}\right) + \frac{1}{r^2}\frac{\partial^2 \phi}{\partial\theta^2} = \left\{ \begin{matrix} 0 & r < r_\mathrm{i}\\ -\frac{2M_0 \cos\theta}{r} & r_\mathrm{i} < r < r_\mathrm{o}\\ 0 & r > r_\mathrm{0} \end{matrix} \right. $$. | $$ }} Look for a particular solution of this equation in the cylinder walls. With the benefit of hindsight, consider $$\phi_\mathrm{p} = r \ln r \cos\theta$$, because then we have

\begin{align} \frac{1}{r}\frac{\partial}{\partial r}\left(r \frac{\partial\phi_\mathrm{p}}{\partial r}\right) &= \frac{1}{r}\frac{\partial}{\partial r}\left[r \frac{\partial}{\partial r}(r \ln r \cos\theta)\right]\\ &= \frac{\cos\theta}{r}\left[r(\ln r + 1)\right]\\ &= \frac{\cos\theta}{r}(\ln r + 1 + 1)\\ &= \frac{\ln r\cos\theta}{r} + \frac{2 \cos\theta}{r} \end{align} $$ and also

\begin{align} \frac{1}{r^2}\frac{\partial^2 \phi_\mathrm{p}}{\partial\theta^2} &= \frac{1}{r^2}\frac{\partial^2}{\partial\theta^2}(r \ln r \cos\theta)\\ &= -\frac{\ln r \cos\theta}{r} \end{align} $$. Hence $$\nabla^2 \phi_\mathrm{p} = \frac{2 \cos\theta}{r}$$, and comparison with Equation $$ shows that $$-M_0 \phi_\mathrm{p} = - M_0 r \ln r \cos\theta$$ is the appropriate particular solution.

Now consider the homogenous equation for Equation $$, namely $$\nabla^2 \phi_\mathrm{h} = 0$$. This has the form of Laplace's equation. Through the method of separation of variables, it can be shown that the general homogenous solution whose gradient is periodic in $$\theta$$ (such that all the physical quantities are single-valued) is given by
 * $$\phi_\mathrm{h} = A_0 + B_0 \theta + C_0 \ln r + \sum_{n=1}^\infty \left(A_n r^n + B_n r^{-n}\right)\cos n\theta + \sum_{n=1}^\infty \left(C_n r^n + D_n r^{-n}\right)\sin n\theta$$,

where the $$A_i,\ B_i,\ C_i,\ D_i$$ are arbitrary constants. The desired solution will be the sum of the particular and homogenous solutions that satisfies the boundary conditions. Again with the benefit of hindsight, let us set most of the constants to zero immediately and assert that the solution is

\phi = \left\{ \begin{matrix} \alpha r \cos\theta & r < r_\mathrm{i}\\ \beta r \cos \theta - M_0 r \ln r \cos\theta & r_\mathrm{i} < r < r_\mathrm{o}\\ 0 & r > r_\mathrm{o} \end{matrix} \right. $$, where now $$\alpha,\ \beta$$ are constants to be determined. If we can choose the constants such that the boundary conditions are satisfied, then by the uniqueness theorem for Poisson's equation, we must have found the solution.

The continuity conditions give

at the inner boundary and

at the outer boundary. The potential gradient has non-vanishing radial component $$\beta\cos\theta - M_0 \ln r \cos\theta - M_0 \cos\theta$$ in the cylinder walls and $$\alpha\cos\theta$$ in the bore, and so the conditions on the potential derivative become
 * $$(\beta\cos\theta - M_0 \ln r_\mathrm{i} \cos\theta - M_0\cos\theta) - \alpha \cos\theta = -M_0\cos\theta \implies \beta - M_0 \ln r_\mathrm{i} - \alpha = 0 \implies \alpha = \beta - M_0 \ln r_\mathrm{i}$$

at the inner boundary and
 * $$0 - (\beta\cos\theta - M_0 \ln r_\mathrm{0} \cos\theta - M_0\cos\theta) = M_0\cos\theta \implies \beta - M_0 \ln r_\mathrm{o} = 0$$

at the outer boundary. Note that these are identical to Equations $$ and $$, so indeed the guess was consistent. Hence we have $$\beta = M_0 \ln r_\mathrm{o}$$ and $$\alpha = M_0 \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right)$$, giving the solution

\phi = \left\{ \begin{matrix} M_0 \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right) r \cos\theta & r < r_\mathrm{i}\\ M_0 \ln\left(\frac{r_\mathrm{o}}{r}\right) r \cos\theta & r_\mathrm{i} < r < r_\mathrm{o}\\ 0 & r > r_\mathrm{o} \end{matrix} \right. $$. Consequently the magnetic field is given by

\mathbf{H} = \nabla\phi = \left\{ \begin{matrix} M_0 \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right) \cos\theta\,\hat\mathbf{r} - M_0 \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right) \sin\theta\,\hat\boldsymbol{\theta} & r < r_\mathrm{i}\\ M_0 \cos\theta \left[\ln\left(\frac{r_\mathrm{o}}{r}\right)-1\right]\,\hat\mathbf{r} - M_0 \ln\left(\frac{r_\mathrm{o}}{r}\right) \sin\theta\,\hat\boldsymbol{\theta} & r_\mathrm{i} < r < r_\mathrm{o}\\ 0 & r > r_\mathrm{o} \end{matrix} \right. $$, while the magnetic flux density can then be found everywhere using the previous definition $$\mathbf{B} = \mu_0 (\mathbf{H} + \mathbf{M})$$. In the bore, where the magnetisation vanishes, this reduces to $$\mathbf{B}_\mathrm{bore} = \frac{1}{\mu_0}\mathbf{H}_\mathrm{bore}$$. Hence the magnitude of the flux density there is
 * $$B_\mathrm{bore} = \left|\mathbf{B}_\mathrm{bore}\right| = \sqrt{\cos^2\theta + \sin^2\theta}\frac{M_0}{\mu_0} \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right) = \frac{M_0}{\mu_0} \ln\left(\frac{r_\mathrm{o}}{r_\mathrm{i}}\right)$$,

which is independent of position. Similarly, outside the cylinder the magnetisation also vanishes, and since the magnetic field vanishes there, the flux density does too. So indeed the field is uniform inside and zero outside the ideal Halbach cylinder, with a magnitude depending on its physical dimensions.