In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib notebook

Overview of Accelerator Magnets

There are many common type of magnets used accelerators, they are grouped using the order of multi-pole expansion in the vicinity of the center of the beam pipe, where the particles is transported. Here are the list of common type of magnets:

Magnet Types Usages
Dipoles Form the Geometry of Accelerator
Quadrupoles Focus/Defocus the beam
Sextrupole Chromatic correction, nonlinear effects
Octopole Damping of the collective effects
Solenoid Focusing for low energy beam
Correctors Steer the beam

Magnetic field

Static magnet used in accelerator is either powered by the DC current in the coil or use permanent magnetic materials. From the Maxwell equations

\begin{align} \nabla \cdot \mathbf{E} &= \frac {\rho} {\varepsilon_0} \\ \nabla \cdot \mathbf{B} &= 0 \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}} {\partial t} \\ \nabla \times \mathbf{B} &= \mu_0\left(\mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}} {\partial t} \right) \end{align}

we vanish the contribution of the charge and the time derivative of the electro-magnetic field and found the magnetic field in the magnet satisfy:

\begin{align} \nabla \cdot \mathbf{B} &= 0 \\ \nabla \times \mathbf{B} &= \mu_0\mathbf{J} \end{align}

The magnetic field is always divergenceless and can be written as the curl of the vector potential $\mathbf{B}=\nabla \times \mathbf{A}$. In the free space where the vacuum chamber is installed, the magnetic field's curl also vanish. The magnetic field can be alternatively express as the gradient of a 'magnetic scalar potential' $\mathbf{B}=-\nabla \phi_M $, which satisfy:

\begin{equation} \nabla^2 \phi_M =0 \end{equation}

Transverse field

When the magnetic field is transverse only, in Cartesian coordinate $\left(\hat{x},\hat{y},\hat{s}\right)$, we write:

\begin{equation} \mathbf{B}=B_x\left(x,y\right)\hat{x}+B_y\left(x,y\right)\hat{y} \end{equation}

The vector potential only need longitudinal components.

\begin{equation} \mathbf{B}=\nabla \times A_s \left(x,y\right) \hat{s} \end{equation}

In the mean time, there exist a scalar potential and satisfy:

\begin{equation} \mathbf{B}=-\nabla \phi_M \left(x,y\right) \end{equation}

Therefore we can calculate the two transverse components as:

\begin{align} B_x &= \frac{\partial A_s}{\partial y} = -\frac{\partial \phi_M}{\partial x} \\ B_y &= -\frac{\partial A_s}{\partial x} = -\frac{\partial \phi_M}{\partial y} \end{align}

We can construct a complex function $f\left(z=x+iy\right)=A_s\left(x,y\right)+i\phi_M\left(x,y\right)$, which satisfy Cauchy–Riemann equations. Therefore, the complex function $f$ is complex differentiable in the entire sourceless region and can be Taylor expanded.

We use Taylor expansion of $f$ at the vicinity of the center of magnet as

\begin{align} f\left(z=x+iy\right) & = A_s\left(x,y\right)+i\phi_M\left(x,y\right) \nonumber\\ & = -B_0 \sum_{n=0}^\infty \frac {b_n + i a_n}{n+1} \left(x+iy\right)^{n+1} &&\quad\text{(U.S. convention)}\\ & = -B_0 \sum_{m=1}^\infty \frac {b_m + i a_m}{m} \left(x+iy\right)^{m} &&\quad\text{(European convention)} \end{align}

There are two widely used conventions on the index of the Taylor expansion. The US convention starts with subscript $n=0$ and the European convention start with $m=1$.

Then we take the derivative of the complex potential $f$ with respective to $z$

\begin{align} \frac{df}{dz} &=\frac{1}{2}\left(\frac{\partial f}{\partial x}-i\frac{\partial f}{\partial y}\right)\nonumber\\ &=\frac{1}{2}\left(\frac{\partial A_s}{\partial x}+\frac{\partial \phi_M}{\partial y}-i\frac{\partial A_s}{\partial y}+i\frac{\partial \phi_M}{\partial x}\right)\nonumber\\ &=-\left(B_y+iB_x\right) \end{align}

The magnetic field can be expressed as:

\begin{align} B_y+iB_x &= B_0 \sum_{n=0}^\infty \left(b_n + i a_n\right) \left(x+iy\right)^{n} &&\quad\text{(U.S. convention)}\\ &= B_0 \sum_{m=1}^\infty \left(b_m + i a_m\right) \left(x+iy\right)^{m-1} &&\quad\text{(European convention)} \end{align}

Here, $B_0$ is the main dipole field strength. The $b_n$ and $a_n$ are called the $2(n+1)^{th}$ multipole coefficients in 'U.S. convention'; while the $b_m$ and $a_m$ are called $2m^{th}$ multipole coefficients in 'European convention'. The set of $b$ coefficients are the normal components while the set of $a$ coefficients are the skew components.

This complex field representation in 2-D plane is named Beth representation.

Example Magnets

Here we give the low order transverse magnets as the examples, using the U.S. convention:

Dipoles

The magnet is named dipole when the dipole coefficient $b_0$ and/or $a_0$ are non-zero. The scalar potential reads: $$\phi_M=-B_0\left(b_0 y+ a_0 x\right) $$

Therefore, a non-zero $b_0$ gives verticle field. With the normalization factor $B_0$, usually $b_0$ is 1. A non-zero $a_0$ corresponds to a horizontal magnetic field. The contours of the scalar potential are horizontal or vertical lines.

The scew field ($a_0\ne 0$) can be made after $\pi/2$ rotation from normal field ($b_0\ne 0$)

In [21]:
fig, (ax1,ax2)=plt.subplots(1,2)
ax1.set_aspect('equal');ax2.set_aspect('equal')
xlist = np.linspace(-5.0, 5.0, 40)
ylist = np.linspace(-5.0, 5.0, 40)
X, Y = np.meshgrid(xlist, ylist)
qdratio1=0.05
qdratio2=0.2
Z1 = (Y)
Z2 = (X)

ax1.set_title('Normal Dipole', )
ax2.set_title('Skew Dipole', )
ax1.set_xlabel('x')
ax2.set_xlabel('x')
ax1.set_ylabel('y')
cp_n =ax1.contour(X, Y, Z1, np.array([-6,-4,-2,2,4,6]))
cp_s =ax2.contour(X, Y, Z2, np.array([-6,-4,-2,2,4,6]))
ax1.quiver(X[::3,::3], Y[::3,::3], (0*Y)[::3,::3], (1+0*X)[::3,::3])
ax2.quiver(X[::3,::3], Y[::3,::3], (1+0*X)[::3,::3], (0*Y)[::3,::3])
ax1.clabel(cp_n, inline=True, fontsize=3)
ax2.clabel(cp_s, inline=True, fontsize=3)
Out[21]:
<a list of 4 text.Text objects>

Quadrupoles

The magnet is named quadrupole when the quad coefficient $b_1$ and/or $a_1$ are non-zero. The scalar potential reads:

\begin{equation} \phi_M=-B_0\left[b_1 x y+ a_1 \left(x^2-y^2\right)/2\right] \end{equation}

The contours of the scalar potential for the normal and the skew quadrupole are plotted in the following figure:

In [19]:
fig, (ax1,ax2)=plt.subplots(1,2)
ax1.set_aspect('equal');ax2.set_aspect('equal')
xlist = np.linspace(-5.0, 5.0, 40)
ylist = np.linspace(-5.0, 5.0, 40)
X, Y = np.meshgrid(xlist, ylist)
Zn = X*Y
Zs = (X*X-Y*Y)/2

ax1.set_title('Normal Quad', )
ax2.set_title('Skew Quad', )
ax1.set_xlabel('x')
ax2.set_xlabel('x')
ax1.set_ylabel('y')
cp_n =ax1.contour(X, Y, Zn, [-6,-4,-2,2,4,6])
cp_s =ax2.contour(X, Y, Zs, [-6,-4,-2,2,4,6])
ax1.quiver(X[::3,::3], Y[::3,::3], Y[::3,::3], X[::3,::3])
ax2.quiver(X[::3,::3], Y[::3,::3], X[::3,::3], -Y[::3,::3])
ax1.clabel(cp_n, inline=True, fontsize=3)
ax2.clabel(cp_s, inline=True, fontsize=3)
Out[19]:
<a list of 12 text.Text objects>

The normal quadrupole has the magnetic field as:

\begin{equation} \mathbf{B}=B_0 b_1\left(y \hat{x}+x \hat{y}\right) \end{equation}

while the skew quadrupole has the magnetic field as:

\begin{equation} \mathbf{B}=B_0 a_1\left(x \hat{x}-y \hat{y}\right) \end{equation}

A skew quadrupole can be achieved by rotating $\pi/4$ from a normal quadrupole

Combined function magnet

Many cases requires a combination of dipole and quadrupoles, which is a combined function magnet. Let's only talk about the normal components: $$\phi_M=-B_0 \left(b_0 y + b_1 x y \right) $$

In [2]:
fig, (ax1,ax2)=plt.subplots(1,2)
ax1.set_aspect('equal');ax2.set_aspect('equal')
xlist = np.linspace(-5.0, 5.0, 40)
ylist = np.linspace(-5.0, 5.0, 40)
X, Y = np.meshgrid(xlist, ylist)
qdratio1=0.05
qdratio2=0.2
Z1 = (Y+qdratio1*X*Y)
Z2 = (Y+qdratio2*X*Y)

ax1.set_title('Weak Quad-component', )
ax2.set_title('Strong Quad-component', )
ax1.set_xlabel('x')
ax2.set_xlabel('x')
ax1.set_ylabel('y')
cp_n =ax1.contour(X, Y, Z1, np.array([-6,-4,-2,2,4,6]))
cp_s =ax2.contour(X, Y, Z2, np.array([-6,-4,-2,2,4,6]))
ax1.quiver(X[::3,::3], Y[::3,::3], (qdratio1*Y)[::3,::3], (1+qdratio1*X)[::3,::3])
ax2.quiver(X[::3,::3], Y[::3,::3], (qdratio2*Y)[::3,::3], (1+qdratio2*X)[::3,::3])
ax1.clabel(cp_n, inline=True, fontsize=3)
ax2.clabel(cp_s, inline=True, fontsize=3)
Out[2]:
<a list of 6 text.Text objects>

Sextrupole

The magnet is named Sextrupole when the sextrupole coefficient $b_2$ and/or $a_2$ are non-zero. The scalar potential reads:

\begin{equation} \phi_M=-B_0\left[b_2 \left(3x^2y-y^3\right)+ a_2 \left(x^3-3xy^2\right)\right]/3 \end{equation}

The contours of the scalar potential for the normal and the skew sextrupole are plotted in the following figure:

In [20]:
fig, (ax1,ax2)=plt.subplots(1,2)
ax1.set_aspect('equal');ax2.set_aspect('equal')
xlist = np.linspace(-5.0, 5.0, 40)
ylist = np.linspace(-5.0, 5.0, 40)
X, Y = np.meshgrid(xlist, ylist)
Zn = (3*X*X*Y-Y*Y*Y)/3
Zs = (X*X*X-3*X*Y*Y)/3

ax1.set_title('Normal Sextrupole', )
ax2.set_title('Skew Sextrupole', )
ax1.set_xlabel('x')
ax2.set_xlabel('x')
ax1.set_ylabel('y')
cp_n =ax1.contour(X, Y, Zn, np.array([-6,-4,-2,2,4,6])*3)
cp_s =ax2.contour(X, Y, Zs, np.array([-6,-4,-2,2,4,6])*3)
ax1.quiver(X[::3,::3], Y[::3,::3], (2*X*Y)[::3,::3], (X*X-Y*Y)[::3,::3])
ax2.quiver(X[::3,::3], Y[::3,::3], (X*X-Y*Y)[::3,::3], (-2*X*Y)[::3,::3])
ax1.clabel(cp_n, inline=True, fontsize=3)
ax2.clabel(cp_s, inline=True, fontsize=3)
Out[20]:
<a list of 18 text.Text objects>

The normal sextrupole has the magnetic field as:

\begin{equation} \mathbf{B}=B_0 b_2\left[2xy \hat{x}+\left(x^2-y^2\right) \hat{y}\right] \end{equation}

while the skew Sextrupole has the magnetic field as:

\begin{equation} \mathbf{B}=B_0 a_2\left[\left(x^2-y^2\right) \hat{x}- 2xy\hat{y}\right] \end{equation}

A skew sextrupole can be achieved by rotating $\pi/6$ from a normal sextrupole

Magnet with iron core -- Iron Dominated Magnet

To achieve high field, accelerator usually use high permeability material to boost the flux density $\mathbf{B}$ for the same magnetic field generated by the coil.

\begin{equation} \mathbf{B}=\mu_r \mu_0 \mathbf{H} \end{equation}

The comparision of permability of different materials is shown in the figure (from Wikipedia) below:

As seen from the above graph, for ferromagnet material has much larger permeability and the permeability is a function of the magnetic field. For example, iron (99.8% pure) may have initial $\mu_r$ of 150 and can reach maximum of 5000; while the %99.95 pure ion will have initial $\mu_r$ of 10000 and reach maximum 200000[1].

However some ferromagnet material, like iron, has the effect of saturation. It is a state that the magnetization of the material do not increase as the increase of the external magnetic field. As a result the permeability of the material at saturation is back to $\mu_0$, the vacuum permeability.

The figure below shows the permeability of ferromagnet material as function of the external magnetic field $\mathbf{H}$:

Later on, we will demonstrate that the nonlinear behavior of large permeability will have very small impact in the field of magnet in accelerator.

Ampere Turns

At the edge of the iron core, we can use the Stoke's theorem ($\oint \mathbf{H} \cdot d\mathbf{l}=0$) to easily get the magnetic field is perpendicular to the surface of the iron. The integration loop is shown below: Here we assume the relative permeability of iron is infinite.

We also know that from the magnetic field is everywhere perpendicular to the iso-scalar-potential line of $\phi_M$. Therefore, ideally, the boundary of the iron core of magnets should be aligned with the iso-scalar-potential line.

Ampere Turns in Dipole

The common layout of the dipole in accelerator is either 'H-type' or 'C-type', as shown in the following figure:

Apply the Stoke's theorem again along the red line for either case, we have

\begin{align} H_{air}&=\mu_r H_{iron}\\ H_{air}g+H_{iron}l&=NI \end{align}

Therefore:

\begin{equation} NI=B_{air}\left(g+l/\mu_r\right)/\mu_0\sim B_{air}g/\mu_0 \end{equation}

Ampere Turns in Quadrupole

Similar as in Quad, we can choose a triangle pass of the Stoke's integral, and a circle of radius $R$ that reaches the edge of the magnet bore, or inscribed circle. So that: $$\int_0^R B dr=\mu_0NI$$ Here the magnetic field has the relation ship of $B=B_1 r$. The gradient $B_1=B_0 b_1$ or $B_1=B_0 a_1$ in the above notation. Therefore the required ampere turn for one pole of the quadrupole gives:

\begin{equation} NI=\frac{B_1R^2}{2\mu_0} \end{equation}

Ampere Turns in Sextrupole

Take the similar steps for sextrupoles, the magnetic field takes the form of $B=B_2r^2$ along the integral pass to the inscribed circle with radius R, and we have: $$\int_0^R B dr=\mu_0NI$$ The sextrupole strength $B_2=3B_0 b_2$ or $B_2=3B_0 a_2$ in the above notation. And the required ampere turn for one pole of the sextrupole gives: $$NI=\frac{B_2R^3}{3\mu_0}$$

The dipole gap g, and inscribed radius R of multi-pole define the aperture of the accelerator. The drive current, measured in ampere turn for dipole will grow linearly as function of the aperture. The current will grow as function of the power of $n+1$ of the aperture for order $n^{th}$ multi-poles.

Hysteresis

A unpleasent effect of iron dominated magnet is the magnetic hysteresis effect as shown below:

The atomic dipoles are aligned with the external magnetic field and alignment is partially retained when the external source is decreased. To fight with the 'memory' effect, a hysteresis cycle is needed to ensure we alway work at the same side of the hysteresis loop.

Errors in Magnets

The error of the magnet rises both in the design of the magnet and the in manufacture stage. There are inevitable factors in the magnet design that causes error:

  • The permeability of the iron is not infinity and the asymmetric structure of the iron
  • The surface of the iron can not follow the iso-scalar potential line, edge effect

Nowadays, the magnets are designed by 2-D or 3-D design software using finite element methods. The design tool does not make any above approximations and generate field map in the entire domain.

The manufacture error also contribute to the error of the magnetic field. The field can be measured with Hall probe or other integrated method using conducting wires.

When we have the 2-D field map from simulation or field measurement, the multi-pole coefficients can be determined from the definition of the complex representation. In U.S. convention:

\begin{equation} B_y+iB_x= B_0 \sum_{n=0}^\infty \left(b_n + i a_n\right) \left(x+iy\right)^{n} \end{equation}\begin{equation} b_n=\frac{1}{B_0 n!}\frac{\partial^n B_y}{\partial x^n}, a_n=\frac{1}{B_0 n!}\frac{\partial^n B_x}{\partial x^n}\label{eq:get_bn_an} \end{equation}

In European convention:

\begin{equation} B_y+iB_x= B_0 \sum_{m=1}^\infty \left(b_m + i a_m\right) \left(x+iy\right)^{m-1} \end{equation}\begin{equation} b_m=\frac{1}{B_0 (m-1)!}\frac{\partial^{m-1} B_y}{\partial x^{m-1}}, a_m=\frac{1}{B_0 (m-1)!}\frac{\partial^{m-1} B_x}{\partial x^{m-1}}\label{eq:get_bm_am} \end{equation}

The derivative is taken at the origin of the Taylor expansion. Certainly, the result of such derivative depends on the area of analysis. We only interested in the area that the charge particle can locate, usually limited by the size of the vacuum chamber. We define a circle with radius $R_0$, named"good field region", in which the magnet is designed to deliver satisfied field quality.

We can get the field on the circle and inside the circle (not necessary). From Eq.$\ref{eq:get_bn_an}$ or $\ref{eq:get_bm_am}$, we can take numerical derivative and get all $b_n$ and $a_n$. However, determining the Taylor coefficient, especially high order ones, are noisy. Alternatively, we may rewrite the Beth representation in terms of $B_r$ and $B_\phi$ (as shown in above figure),

\begin{align} B_\phi+iB_r &= B_0 \sum_{n=0}^\infty \left(b_n + i a_n\right)e^{i(n+1)\phi} r^{n} &&\quad\text{(U.S. convention)} \label{eq:Bcomplex_us}\\ &= B_0 \sum_{m=1}^\infty \left(b_m + i a_m\right)e^{i m\phi} r^{m-1} &&\quad\text{(European convention)} \label{eq:Bcomplex_european} \end{align}

where $z\equiv x+iy=re^{i\phi}$. Or, we may seperately write as:

\begin{align} B_\phi&=B_0 \sum_{n=0}^\infty \left[b_n\cos(n+1)\phi-a_n\sin(n+1)\phi\right]r^n &&\quad\text{(U.S. convention)} \label{eq:Bphi_us}\\ &=B_0 \sum_{m=1}^\infty \left[b_m\cos m\phi-a_m\sin m\phi\right]r^{m-1} &&\quad\text{(European convention)} \label{eq:Bphi_european}\\ B_r&=B_0 \sum_{n=0}^\infty \left[b_n\sin(n+1)\phi+a_n\cos(n+1)\phi\right]r^n &&\quad\text{(U.S. convention)}\label{eq:Br_us} \\ &=B_0 \sum_{m=1}^\infty \left[b_m\sin m\phi+a_m\cos m\phi\right]r^{m-1} &&\quad\text{(European convention)} \label{eq:Br_european} \end{align}

Then we measure the magnetic field along the circle, $B_r(r=R_0,\phi)$ and $B_\phi(r=R_0,\phi)$. Take integral $\int_0^{2\pi}e^{-i(n'+1)\phi}d\phi$ on both side of $\ref{eq:Bcomplex_us}$:

\begin{align} \int_0^{2\pi}e^{-i(n'+1)\phi}\left(B_\phi+iB_r\right)d\phi &= B_0 \sum_{n=0}^\infty \left(b_n + i a_n\right)R_0^n\int_0^{2\pi}e^{-i(n'+1)\phi}e^{i(n+1)\phi}d\phi\\ &=2\pi B_0 \sum_{n=0}^\infty \left(b_n + i a_n\right)R_0^n \delta_{n',n}\\ &=2\pi B_0 \left(b_{n'} + i a_{n'}\right)R_0^{n'} \end{align}

Therefore, we can get the coefficient in U.S convention by:

\begin{equation} b_n + i a_n=\frac{1}{2\pi B_0 R_0^n}\int_0^{2\pi}e^{-i(n+1)\phi}\left(B_\phi+iB_r\right)d\phi \end{equation}

Similarly, using European convention gives:

\begin{equation} b_m + i a_m=\frac{1}{2\pi B_0 R_0^{m-1}}\int_0^{2\pi}e^{-i m\phi}\left(B_\phi+iB_r\right)d\phi \end{equation}

Even for arbitrary field due to design and manufacture errors, the above analysis still hold. We can get the multi-pole coefficient of the errors using the above integrals.

One can prove that the radial and the azimuthal component has the same contribution

\begin{align} b_n + i a_n&=\frac{1}{\pi B_0 R_0^n}\int_0^{2\pi}e^{-i(n+1)\phi}B_\phi d\phi\nonumber\\ &=\frac{i}{\pi B_0 R_0^n}\int_0^{2\pi}e^{-i(n+1)\phi}B_r d\phi \end{align}

Other type of Magnets

Coil Dominated Magnet

For some simple dipole correctors, the wire can be directly planed around the vacuum chamber to provide weak field on the beam. Usually such simple setup cannot produce very precise field.

Similar principle is used in the superconducting magnet, where the current can be pushed to ~10 Kilo Ampere. Many technical challenges have be conquered to reach ~10T level (LHC, 8 Tesla).

LHC 15m dipole Cartoon of wiring

Permanent Magnet

Another group magnet does not involve current and power supplies, instead, uses permanent magetic material as the source to create desire field.

A Halbach array of permanent magnet is a special arrangement to provide field in desire region and cancel the contribution in the rest areas. This can be specially useful in designing a magnet in accelerator.

A recent example of using permanent magnet is the FFAG arc used in the CBETA project (collaborated by BNL and Cornell University). The Halbach array is used to provide both pure quadrupole magnets or the combine function magnet (contains both the dipole and quadrupole field). Some example is retrived from "Halbach Magnets for CBeta" by D. Trbojevic et.al. 2017.

The raw design can be found below. Left is the pure quadrupole, while the right is the combine function magnet that provides the opposite sign of the quadrupole strength.

However, we still need to do fine tuning of the the magnet. Therefore a small coil based corrector is added outside of the halbach design:

Introduction to 3D magnets

At the edge of the magnet, the transverse field has longitudinal dependence. $$\frac{\partial B_x}{\partial z}\ne 0\;\;\text{and/or}\;\;\frac{\partial B_y}{\partial z}\ne 0$$

To satisfy $\nabla\times B=0$, we need to satisfy:

\begin{align} \frac{\partial B_x}{\partial z}&=\frac{\partial B_z}{\partial x}\\ \frac{\partial B_y}{\partial z}&=\frac{\partial B_z}{\partial y} \end{align}

Therefore we can not assume the the field is transverse only. A non-constant longitudinal magnetic must involve.

Integrated field

In many applications, we care about the integrated field over the direction of beam, viz. $z$ direction.

In three dimension, the source-less magnetic field gives:

\begin{equation} \nabla^2\phi_M =\frac{\partial^2\phi_M}{\partial x^2}+\frac{\partial^2\phi_M}{\partial y^2}+\frac{\partial^2\phi_M}{\partial z^2}=0 \end{equation}

Then integration over $z$ gives:

\begin{equation} \left(\frac{\partial^2}{\partial x^2}+\frac{\partial^2}{\partial y^2}\right)\int_{z_1}^{z_2} \phi_M(x,y,z)dz + \left.\frac{\partial \phi_M}{\partial z} \right|_{z_1}^{z_2}=0 \end{equation}

If we define $\phi_{T,M}=\int_{z_1}^{z_2} \phi_M(x,y,z)dz$, the equation yields:

\begin{equation} \left(\frac{\partial^2}{\partial x^2}+\frac{\partial^2}{\partial y^2}\right) \phi_{T,M} (x,y)= B_z(x,y,z_2)-B_z(x,y,z_1) \end{equation}

By choosing the proper integrated region to vanish the right hand side, the analysis for 2-D can be extrapolated to the integrated field.

The integrated strength of the multi-poles is important to characterize the effect to be beam. We may define the field integral of component $b_n$:

\begin{equation} I_{b_n}=\int_{-\infty}^{\infty}b_n(z)dz \end{equation}

The integral can be used to define a equivalent length of a hard edge model, which has constant field in the range and zero outside:

\begin{equation} L_{eqv}=\frac{\int_{-\infty}^{\infty}b_n(z)dz}{b_n(z=0)} \end{equation}
In [4]:
fig,ax=plt.subplots()
ax.set_title("Hard edge equivalent")
ax.set_xlabel("longitudinal position[m]")
ax.set_ylabel("Norm. Magnetic field [Arb-unit]")
ax.set_xlim(0,1)
field_size=0.2
slist=np.linspace(0,1,100)
actual_field=np.exp(-slist*slist/2/field_size/field_size)

ax.plot(slist,actual_field, label="Soft edge")
integral=np.sum(actual_field)*(slist[1]-slist[0])
equiv_field=slist<integral
ax.plot(slist,equiv_field,label="Hard edge")

ax.legend(loc='best')
Out[4]:
<matplotlib.legend.Legend at 0x10a37fac8>

To characterize different edge shape, the following second order field integral is useful for the dipole field:

\begin{equation} I_2=\frac{\int_{-\infty}^{\infty}B(z)(B_0-B(z))dz}{B_0^2} \end{equation}
Edge Shapes Linear Lorentz Gaussian
$I_2$ 0.167 0.078 0.073
In [5]:
def I2(field, pos):
    return np.sum(field*(1-field)*(pos[1]-pos[0]))

fig,ax=plt.subplots()
ax.set_xlabel("longitudinal position[m]")
ax.set_ylabel("Norm. Magnetic field [Arb-unit]")
ax.set_xlim(0,1)
ax.set_ylim(0,1)
field_size=0.2
slist=np.linspace(0,1,100)
actual_field_1=np.exp(-slist*slist/2/field_size/field_size)
ax.plot(slist,actual_field_1, label='Gaussian')
print("Field shape Gaussian:", I2(actual_field_1,slist))

actual_field_2=2/(1+np.exp(slist*slist/2/field_size/field_size))
ax.plot(slist,actual_field_2, label='Lorentz')
print("Field shape Lorentz:", I2(actual_field_2,slist))

actual_field_3=1-slist
ax.plot(slist,actual_field_3, label='Linear')
print("Field shape Linear:", I2(actual_field_3,slist))

ax.legend(loc='best')
Field shape Gaussian: 0.07341731669704057
Field shape Lorentz: 0.07786112831679921
Field shape Linear: 0.16664966159915653
Out[5]:
<matplotlib.legend.Legend at 0x10a466860>

[1]""Magnetic Properties of Ferromagnetic Materials", ''Iron''". C.R Nave Georgia State University. Retrieved 2013-12-01.