## 3 Optimization of the Field-Null Configuration
### The Iterative Optimizing Scheme  
The optimization problem of the field-null configuration could be abstracted to minimize the averaged \(\left|B_{\perp}^{2}\right|\) inside a given region. Expressed more explicitly, it is to minimize an optimizing function \(f\) by discretizing the tokamak cross-section into a set of grids as  
\[f(\mathbf{I})=\sum_{j}^{j\in\mathbf{\mathrm{A}}}\left|B_{p,j}^{2}(\mathbf{I})\right|=\sum_ {j}^{j\in\mathbf{\mathrm{A}}}\left|B_{R,j}^{2}(\mathbf{I})+B_{Z,j}^{2}(\mathbf{I})\right| \tag{7}\]  
Here, \(\mathbf{I}\) is the currents in coils and passive conductors, which is the same as in Equation (5), \(\mathbf{\mathrm{A}}\) represents the range of the desired field-null region, the subscript \(j\) refers to the grid number and \(B_{R,j}\), \(B_{z,j}\) and \(B_{p,j}\) are the horizontal component, vertical component and the sum of the poloidal magnetic field on the \(j\)th grid, respectively. By utilizing [PERSON]'s function, Equation (7) can be rewritten as a multi-variable, quadratic function:  
\[f(\mathbf{I})=\sum_{j}^{j\in\mathbf{\mathrm{A}}}\left|B_{R,j}^{2}(\mathbf{I})+B_{Z,j}^{2} (\mathbf{I})\right|=\sum_{j}^{j\in\mathbf{\mathrm{A}}}\left\{\left[\sum_{i=1}^{105}G_ {R,j}I_{i}\right]^{2}+\left[\sum_{i=1}^{105}G_{Z,j}I_{i}\right]^{2}\right\} \tag{8}\]  
Here, \(G_{R,j}\) and \(G_{Z,j}\) are [PERSON]'s functions that represent the \(R\) and \(Z\) components of the poloidal field induced by a 1-ampere current in the \(i\)th conductor on the \(j\)th grid, and \(I_{i}\) is the current in the \(i\)th conductor. Various methods could be applied to solve the minimization problem of \(f(\mathbf{I})\) as expressed by Equation (8). For simplicity, taking the quadratic form of \(f\) into consideration, a direct scheme is to calculate the solution of \(\frac{\partial f}{\partial\mathbf{I}}=0\) that simultaneously satisfies the positive-definite condition of the Hessian matrix, e.g., \(\left|\frac{\partial^{2}f}{\partial I_{1}\partial I_{2}}\right|>0\). The problem \(\frac{\partial f}{\partial\mathbf{I}}=0\) could be written as a set of linear equations:  
\[\mathbf{\mathrm{P}}\cdot\mathbf{I}=0 \tag{9}\]  
Here, \(\mathbf{\mathrm{P}}\equiv P_{fi}\) is an \(105\times 105\) matrix with \(P_{fi}=2\sum_{j}^{j\in\mathbf{\mathrm{A}}}\left(G_{R,\;\;{}^{\prime}j}\cdot G_{R, ij}+G_{Z,j}\cdot G_{Z,ij}\right)\). Equation (9) is homogeneous and has only a trivial solution \(I_{i}=0\) if all of the \(I_{i}\) values are unknowns. However, an exclusive, non-trivial solution usually exists if some elements in \(\mathbf{I}\) are treated as knowns. Without the loss of generality, assume that \(\mathbf{I}\) could be rewritten into the combination of two sub-vectors as  
\[\mathbf{I}=\left[ \begin{array}{c}I_{unknown}\\ I_{known}\end{array} \right] \tag{10}\]where \(\mathbf{I_{known}}\) and \(\mathbf{I_{unknown}}\) refer to the sub-vectors containing the known and unknown elements of vector \(\mathbf{I}\), respectively. Then, Equation (9) can be rewritten as  
\[\mathbf{P_{1}}\cdot\mathbf{I_{unknown}}=\mathbf{P_{2}}\cdot\mathbf{I_{known}} \tag{11}\]  
where \(\mathbf{P_{1}}\equiv P_{unknown,unknown}\) is a square, symmetric sub-matrix of \(\mathbf{P}\) that extracts the elements in \(\mathbf{P}\) with both the same row and column subscripts as \(\mathbf{I_{unknown}}\) within \(\mathbf{I}\), and \(\mathbf{P_{2}}\equiv P_{unknown,known}\) is another sub-matrix of \(\mathbf{P}\) that extracts the elements in \(\mathbf{P}\) with the same row and columns subscripts as \(\mathbf{I_{unknown}}\) and \(\mathbf{I_{known}}\) within \(\mathbf{I}\), respectively. Equation (11) is useful when some conductor currents can be treated as knowns, i.e., when the CS current waveform is fixed to optimize the field-null configuration with a certain level of \(E_{\phi}\), and setting some PF currents as zero to reduce the complexity of the optimization problem.