Example # 7 : ESRF Quadrupole in 2D and 3D using Automatic Triangulation
Version : 0.6 of 13th April 2008 by J. Chavanne, O. Chubar, P. Elleaume
This notebook example requires Mathematica 6.0 and Radia 4.25 or higher to execute. It makes use of the automatic mesh generation of extruded Triangle borrowed from Jonathan Richard Shewchuk (http://www.cs.cmu.edu/~quake/triangle.html).
It computes in 2D and 3D the field from the storage ring quadrupole of the ESRF. The simulation of any other quadrupole can be derived from this notebook by changing the routines / parameters in the "Iron, Coil, Yoke and Build Functions" section. Dipole and sextupole could also be bilt in a similar fashion.
To run, one must first execute all cells of the next section (Iron, Coil, Yoke and Build Functions) which execute rapidly. Graphics production and field solving as well as post-processing takes more time and are triggered by the execution of the cells in the other sections ("2 - Dimensional Simulation" and "3 - Dimensional Simulation"). Some of the cells may take a lot of time to execute. Take your time to explore this notebook. Start with 2D computation and then move to 3D when you fill at ease. Read all comments written in each cell. This example is longer and quite more involved than any one of the examples 1 to 6.
Iron, Coil, Yoke and Build Functions
Introduction
The quadrupole is defined through the:
- "B vs H" ("M vs H") dependence of the iron type material;
- Coil geometrical parameters;
- Yoke geometrical parameters.
The figure below defines a number of variables used in the following functions to built the quadrupole.
Load and Initialize Radia
Iron Functions
Defining non-linear "M vs H" dependence for iron-type material
Coil Functions
Auxiliary function to be used for the definition of coils
Yoke Functions
Auxiliary functions defining the yoke boundary
Draw the contor of the lamination
Build 2D Functions
Defining the "Build" function for 2D Geometry
Defining the general "Solve" function and auxiliary functions for 2D case
Build 3D Functions
Defining the "Build" function for 3D Geometry
Auxiliary functions for 3D case
2 - Dimensional Simulation
Introduction
To simulate the qaudrupole in 2D, the yoke is created with a single layer of very large thickness.
Show in 2D
Instantiating the Quadrupole and compute the memory requirement
Show the Geometry
Solve in 2D
Solving
The following computation assumes a linear magnetic material with relative permeability mu. This is usefull to compare with the prediction of the Ampere Theorem. Note that with infinite permeability, the only difference with the Ampere Theorem comes from the multipole content and imperfect segmentation.
Post-Processing in 2D
Harmonic Analysis
The Harmonic Analysis to compute the multipole content around an axis requires the calculation of the field at equidistant points over a circle of radius R. The precision depends on the value of the radius R in relation to rint (the inscribed radius of the quadrupole). The optimal precision is reached if one uses R value not in the immediate vicinity of 0 or rint. A value between 1/4 rint and 3/4 rint is safe. One may want to check that the harmonic content weakly depends on R
Field Plot
Gradient Homogeneity
Field and Magnetization Line Plots
Energy and Inductance in 2D
Auxiliary Functions
Energy and Self-Inductance
Gradient vs Current in 2D
3 - Dimensional Simulation
Introduction
This part concerns the 3D simulation of the same quadrupole. The yoke is created with its actual length. The extremities of the pole are machined to generate the chamfer. The model is created with a number of layers along the beam axis (longitudinal segmentation). At the end, the multipole expansion is computed as well as the magnetic length of the quadrupole. The accurate computation requires a large longitudinal segmentation and the memory requirement is significant. For this type of computation, the time longer than 10 minutes, as well as memory well above 200 MB are required.
Show in 3D
Instantiating the Quadrupole and compute the memory requirement
Show the Geometry
Solve in 3D
Solving
The solving time and memory requirement largely depends on nz (the longitudinal segmentation).To debug and accelerate the computation use e.g. nz = {2, 1}, the price is a poor absolute precision. For lmag = 400, some stability of the gradient versus horizontal position as well as magnetic length is obtained with nz = {32, 1}, which need quite some cpu and memory. In practice one must increase nz[[1]] to check the stability of the result.
Post-Processing in 3D
Harmonic Analysis
The Harmonic Analysis to compute the multipole content around an axis requires the computation of the field on equidistant points over a circle of radius R. The precision depends on the value of the radius R in relation to rint (the inscribed radius of the quadrupole). The optimum precision is reached if one uses a R value not in the immediate vicinity of 0 or rint. A value between 1/4 rint and 3/4 rint is safe. One may want to check that the harmonic content weakly depends on R.
Field Integral Plot
Gradient along Horizontal Coordinate
Gradient along the Quadrupole
Field and Magnetization Line Plots near the Pole Boundary
Energy and Inductance in 3D
Auxiliary Functions
Magnetic Energy and Self-Inductance
Gradient vs Current in 3D
If you are ready to wait some ~30 minutes, depending on your CPU, run this section ...
Integrated Gradient and Multipole vs. Horizontal Position as a function of Segmentation, Chamfer dimension, Current, ...