**5. Numerical methods for magnet design**

Due to the complex structure of electromagnetic devices and the compact design requirements, the design of modern magnets no longer relies on simple analytical calculations. Usually, the designers employ complex high-level numerical analysis technology to decide the electromagnetic structure parameters. With the geometry, the material distribution and the driven sources given, the numerical analysis of the electromagnetic field distribution with respect to space and time can be conducted by solving the Maxwell's equations numerically under predefined initial and boundary conditions. During the design of magnet devices, the designer should propose a configuration satisfying the functional needs as far as possible. The inverse problem is: given the magnetic field distribution in space and time, one must find the geometric parameters and the material distribution, as well as the field source (K. Huang & X. Zhao. 2005). Magnet design is such an electromagnetic field inverse problem. Its task is to find the field source (current distribution or permanent magnet material distribution) on the basis of a given magnetic field spatial distribution. The inverse problem has two different aspects: the design optimization itself and the parameter identification. (Ye Bai et al. 2006; W. Zhang, H. He & A. P. Len. 2005).

The deterministic method is doing the search gradually during the iterative process according to the search direction determined by each step of the iteration, so that the objective function value of the current step iterative solution is certain to be smaller than the preceding values. Different deterministic methods have different search directions, such as the "steepest decent", the "conjugating gradient method", the "Quasi-Newton law" (Chunzhong Wang, Q. Wang & Q. Zhang. 2010), the "Levenberg-Marquard algorithm", etc. The deterministic method depends on the neighborhood characteristics of the current search position to determine the next step search position (with partial linearization in a non-linear problem). Therefore it is local optimization and the efficiency of seeking for the local optimal solution is very high, but it does not have global optimization capability in a multi-extreme value problem. Another shortcoming of the deterministic method is that it is necessary to know the first- or second-order partial derivative of the objective function and it usually requires the objective function to not be too complex and to have an analytic expression, which increases the computing time and cost. On the other hand, the ill-posed inverse problem is often inherited with an optimization problem. Therefore, the regularization processing should be added to each iteration step of the deterministic method, as otherwise big errors will occur, and the iteration may not work.

96 Superconductors – Materials, Properties and Applications

**5. Numerical methods for magnet design** 

H. He & A. P. Len. 2005).

**Figure 11.** Configuration of (*a*) stellarator, (*b*) force-free, and (*c*) snake-shaped magnets.

Due to the complex structure of electromagnetic devices and the compact design requirements, the design of modern magnets no longer relies on simple analytical calculations. Usually, the designers employ complex high-level numerical analysis technology to decide the electromagnetic structure parameters. With the geometry, the material distribution and the driven sources given, the numerical analysis of the electromagnetic field distribution with respect to space and time can be conducted by solving the Maxwell's equations numerically under predefined initial and boundary conditions. During the design of magnet devices, the designer should propose a configuration satisfying the functional needs as far as possible. The inverse problem is: given the magnetic field distribution in space and time, one must find the geometric parameters and the material distribution, as well as the field source (K. Huang & X. Zhao. 2005). Magnet design is such an electromagnetic field inverse problem. Its task is to find the field source (current distribution or permanent magnet material distribution) on the basis of a given magnetic field spatial distribution. The inverse problem has two different aspects: the design optimization itself and the parameter identification. (Ye Bai et al. 2006; W. Zhang,

The deterministic method is doing the search gradually during the iterative process according to the search direction determined by each step of the iteration, so that the objective function value of the current step iterative solution is certain to be smaller than the preceding values. Different deterministic methods have different search directions, such as the "steepest decent", the "conjugating gradient method", the "Quasi-Newton law" (Chunzhong Wang, Q. Wang & Q. Zhang. 2010), the "Levenberg-Marquard algorithm", etc. The deterministic method depends on the neighborhood characteristics of the current search position to determine the next step search position (with partial linearization in a non-linear problem). Therefore it is local optimization and the efficiency of seeking for the local optimal solution is very high, but it does not have global optimization capability in a multi-extreme value problem. Another shortcoming of the deterministic method is that it is necessary to know the first- or second-order partial derivative of the objective function and it usually requires the objective function to not be too complex and to have an analytic expression, which increases the computing time and cost. On the other hand, the ill-posed inverse In order to avoid the limits of the deterministic method, the stochastic method (Monte Carlo) is suggested (N. Metropolis & S. M. Ulam. 1949). The Monte Carlo method works in such a way that each iteration step is determined by a random number. The traditional Monte Carlo method carries on a completely stochastic blind search, assuming that all possible solutions have equal probability. In contrast, the modern Monte Carlo methods, such as the well-known simulated annealing method (S. C. Kirkpatrick, D. Gelatt & M. P. Vecchi. 1983), the genetic algorithm (Qiuliang Wang et al. 2009), the evolutionary algorithm (ant colony algorithm and particle swarm optimization), the taboo search method, and the neural network and other stochastic algorithms, carry on the random search in a more instructive way, giving the different possible solutions with different probabilities. The merits of the Monte Carlo method are: it is universally serviceable and no target problems need to be differentiated as to whether they are linear or non-linear, ill-posed or well-posed. A problem can be processed by the Monte Carlo method, even if its operator is very complex and cannot be expressed with an analytical formula. Besides, the method has a strong optimization capability in all situations. Its shortcoming is that the calculation time is usually very large, growing inordinately with the order of the problem, while the convergence rate is very slow.

In order to combine the respective merits of the above algorithms, many researchers have been striving to work for the unification of these methods. In order to reduce the computing time, a new kind of optimizing strategy has emerged in recent years – the unification of the response surface model and the stochastic optimized algorithm (J. H. Holland. 1992; C.W. Trowbridge. 1991). This method firstly separates the space of the target variable for a series of sampling points and then applies the numerical calculus method to compute the value of the objective function on these sampling points; with these values, it uses a response model to reconstruct the objective function and then the optimization computation is carried out using the optimizing algorithm on the restructured objective function. Because it is only necessary to calculate the value of the electromagnetic field objective function on the sampling points, the algorithm efficiency is enhanced greatly. Sometimes in the optimization design of an electromagnetic installation, unifying the Moving Least Squares method with the simulated annealing method has very good results (Chao Wang et al. 2006). The convergence rate of these algorithms, however, still cannot satisfy the requirements for computing complex large-scale systems, for example, three-dimensional calculations, transient processes or coupled systems, at present. In magnet design, a combination of the deterministic and the stochastic algorithms has been adopted.
