# Analysis and Optimization of the Stray Capacitance of Rogowski Coils
## Appendix A  
This appendix presents the implementation details of the FEM solution to the constrained variational problem defined by Equation (20). Consider the interval \([R_{1},\ R_{2}]\), which is divided into \(n\) subintervals by \(n+1\) equidistant points \(u_{0}=R_{1},u_{1},\cdots,u_{i-1}\), \(u_{i},\cdots,u_{n-1},u_{n}=R_{2}\). The length of the sub-intervals  
\[\tau=u_{i}-u_{i-1}=\frac{R_{2}-R_{1}}{n}. \tag{11}\]  
By introducing the Lagrange multiplier and the definitions  
\[\frac{\Phi_{\text{m1}}}{2}=\int_{R_{1}}^{R_{2}}\frac{\mu i}{2\pi}\frac{1}{r}z (r)\text{d}r, \tag{12}\]  
\[A_{1}=\frac{\pi\Phi_{\text{m1}}}{\mu i}, \tag{13}\]  
the free variational problem to be minimized can be formulated as  
\[I^{*}[z(r)]=\int_{R_{1}}^{R_{2}}\left\{\sqrt{1+[z^{\prime}(r)]^{2}}+\lambda \frac{1}{r}z(r)-\lambda\frac{A_{1}}{R_{3}-R_{1}}\right\}\text{d}r. \tag{14}\]  
Within each sub-interval, a linear interpolation of \(z(r)\)  
\[z_{i}(r)=\frac{z_{i}-z_{i-1}}{\tau}(r-u_{i-1})+z_{i-1} \tag{15}\]  
is defined, where \(z_{i}\) and \(z_{i-1}\) are the function values of \(z(r)\) at \(u_{i}\) and \(u_{i-1}\), respectively. Then the contribution of the \(i\)-th sub-interval to \(I^{*}[z(r)]\) is  
\[I^{*}_{i}[z(r)]=\int_{u_{i-1}}^{u_{i}}\left\{\sqrt{1+[z^{\prime}(r)]^{2}}+ \lambda\frac{1}{r}z(r)-\lambda\frac{A_{1}}{R_{3}-R_{1}}\right\}\text{d}r. \tag{16}\]  
Substitution of Equation (15) into Equation (16) leads to \[I_{i}^{*}[z(r)]=\int_{u_{i-1}}^{u_{i}}\left\{\sqrt{1+\left(\frac{z_{i}-z_{i-1}}{ \tau}\right)^{2}}+\lambda\frac{1}{r}\bigg{[}\frac{z_{i}-z_{i-1}}{\tau}(r-u_{i-1 })+z_{i-1}\bigg{]}-\lambda\frac{A_{1}}{R_{3}-R_{1}}\right\}\mathrm{d}r \tag{10}\]  
Accumulating all \(I_{i}^{*}[z(r)]\) to obtain  
\[I^{*}[z(r)]=\sum_{i=1}^{n}I_{i}^{*}[z_{i}(r)]=I^{*}(z_{0},z_{1},z_{2},\cdots,z _{n}). \tag{11}\]  
To minimize \(I^{*}[z(r)]\), it is required that  
\[\left\{\begin{array}{l}\frac{\partial I^{*}}{\partial z_{0}}=\frac{\partial I _{1}^{*}}{\partial z_{0}^{2}}=0\\ \frac{\partial I^{*}}{\partial z_{i}^{2}}=\frac{\partial I_{1}^{*}}{\partial z _{i}^{2}}+\frac{\partial I_{i+1}^{*}}{\partial z_{i}}=0\\ \frac{\partial I^{*}}{\partial z_{n}^{2}}=\frac{\partial I_{n}^{*}}{\partial z _{n}^{2}}=0\end{array}\right.,\quad(i=1,2,\cdots,n-1)\enspace. \tag{12}\]  
Since \(z_{0}\) and \(z_{\max}\) can be determined by the boundary conditions and are given by Equations (36) and (37), only \(n-1\) effective equations can be extracted. Substitution of Equation (10) into Equation (12) results in  
\[\frac{\partial I^{*}}{\partial z_{i}}=\frac{z_{i}-z_{i-1}}{\tau}\frac{1}{\sqrt {1+\left(\frac{z_{i}-z_{i-1}}{\tau}\right)^{2}}}-\frac{z_{i+1}-z_{i}}{\tau} \frac{1}{\sqrt{1+\left(\frac{z_{i+1}-z_{i}}{\tau}\right)^{2}}}+K_{i}=0,\ (i=1,2,\cdots,n-1), \tag{13}\]  
where  
\[K_{i}=\lambda\Big{(}1+\frac{u_{i}}{\tau}\Big{)}\ln\!\left(\frac{u_{i+1}}{u_{i }}\right)-\lambda\frac{u_{i-1}}{\tau}\ln\!\left(\frac{u_{i}}{u_{i-1}}\right). \tag{14}\]  
The \(n-1\) nonlinear equations described by Equation (13) are coupled to each other, yet numerical solutions via MATLAB or Mathematica is straightforward. The curve in the interval \((R_{2},\ R_{3}]\) can be extracted in a similar manner.  
In our context, MATLAB R2022b is adopted and the numbers of sampling point in both \([R_{1},\ R_{2}]\) and \((R_{2},\ R_{3}]\) are set to be 50. The FEM results in Figure 12 agree well with those from the analytical formulation. The slight difference may be induced by the approximation of the optimal curve by the linear interpolation defined by Equation (11), and the unavoidable residual for solving coupled nonlinear equations.