# Analytic Solutions to Magnetic Fields of Circular Current Loop

I came across an interesting problem and am wondering if there is a quick answer to it from someone who's done this before before I whip out the books of integral tables.

Analytic expressions from assorted works for the magnetic field from a circular current loop seem to be badly divergent and have strange artifacts. I am doing some simulations to design some field coils for an experiment (common) and I started off with a finite element sim which seems to work well:




and the max field matches up to analytical expressions given my # of windings, etc ($$B_{max} = (4/5)^{3/2} \mu_0 N I / R$$) to within 5-10%, great. The caveat, of course is when I increase the number of windings (will need over 1000 for the fields I need) and this takes forever in my notebook. I sought out analytic solutions from prior works and came across the following:

Both have similar expressions with slightly different conventions (only component of vector potential is $$A_\varphi$$ which can be expressed with elliptic integrals). In cylindrical coordinates ($$\rho, \varphi, z$$), where z is offset from the ring center, the form for $$B_\rho$$ in these works is:

$$B_\rho = \frac{Cz}{2\alpha^2\beta} \frac{1}{\rho} \left[ (R^2 + \rho^2 + z^2) E(k^2) - \alpha^2 K(k^2) \right]$$

where R is the ring radius and,

$$\alpha^2 = R^2 + \rho^2 + z^2 - 2R\rho \\ \beta^2 = R^2 + \rho^2 + z^2 + 2R\rho \\ k^2 = 1 - \alpha^2/\beta^2$$

It would make sense that the fields fall off with $$\rho$$, and this form is claimed to be the form for all space (indeed the NASA work claims it reduces to the correct forms in certain limits ($$x, y << R$$, $$z=0$$). However, even looking at that expression it's obvious that it will be divergent at $$\rho = 0$$ as the numerator does not go to zero with $$\rho \rightarrow 0$$. Indeed, when this is coded up and executed, the divergence near $$\rho = 0$$ is extreme and obvious:




Isolating for one ring, the divergence we would expect is clear, and there is this strange artifact that loops around (in red):




I am using the numerical scheme in the meantime, but I am curious as to what is going on here and will swing back around to this when I can. Any insights are appreciated, cheers.

EDIT: I am asking about the forms in the linked papers and why they are assumed to be correct in those works when they clearly violate $$\nabla \cdot B = 0$$ near $$\rho = 0$$, as shown in the plots.

• What is this question about? Should we check both articles or your numerical method? – Alex Trounev Apr 18 at 20:30
• Hey, I'm asking about the forms in the articles. My numerical method (as stated) seems to be producing reasonable fields. I am simply plotting the forms in those articles and they clearly violate $\nabla \cdot B = 0$ near $\rho = 0$ and result in strange artifacts. I can link my notebook but I am simply plotting the equations I linked and using np.ellipk1m, np.ellipe. – Steve Novakov Apr 18 at 21:27
• Is it Mathematica notebook? – Alex Trounev Apr 18 at 21:39
• Jupyter, I'll link it shortly, I should have done it originally but I can't at the moment. – Steve Novakov Apr 18 at 21:44
• For what it's worth, enforcing $\nabla\cdot\mathbf{B}=0$ can be tricky in numerical simulations. Is that what's happening here, IDK; but it's often something that is overlooked when writing code. – Kyle Kanos Apr 18 at 21:47

I derived expressions $$B_{\rho},B_z$$ using expression $$A_{\phi }$$ in cylindrical coordinates. These expressions coincided with those given in the article Simple Analytic Expressions for the Magnetic Field of a Circular Current Loop- see eqs (24),(25). For the output, I used Mathematica 12. Figure 1 shows the magnetic field lines of the current loop at different scales