# Vector potential and energy calculations in magnetostatics

I have some trouble with the calculation of energy in magnetostatics, using the vector potential A. From the classic formula that uses B*H, I find the expression (in magnetostatics) in terms of A and J (current density):

\begin{align}W &=\frac{1}{2}\int_V{\vec{B}\cdot\vec{H}{\rm d}V}\\ &=\frac{1}{2}\int_V{\left(\vec{\nabla}\times\vec{A}\right)\cdot\vec{H}{\rm d}V}\\ &=\frac{1}{2}\int_V{\left(\vec{\nabla}\times\left(\vec{A}+\vec{\nabla}\psi\right)\right)\cdot\vec{H}{\rm d}V}\\ &=\frac{1}{2}\int_V{\left(\vec{A}+\vec{\nabla}\psi\right)\cdot\left(\vec{\nabla}\times\vec{H}\right){\rm d}V}\\ &=\frac{1}{2}\int_V{\left(\vec{A}+\vec{\nabla}\psi\right)\cdot\vec{J}{\rm d}V}\end{align}

Since the vector potential A is defined up to a gradient of some scalar field (the divergence of B is still 0), from the above equation, we can see that the energy will be depending on the gradient. However, there is only one energy that can be calculated for a given B and H. How can I find the value of the gradient to match the "real" energy?

thanks

## Answers and Replies

vanhees71
Science Advisor
Gold Member
Of course the total energy of the electromagnetic field must be gauge invariant, and indeed it is.

In magnetostatics, all fields are time-independent. From the continuity equation,

$$\partial_t \rho+\vec{\nabla} \cdot \vec{J}=\vec{\nabla} \cdot \vec{j}=0,$$

one concludes that the stationary current density must be source free and thus, using Green's integral theorem and the assumption that $\vec{j}$ vanishes at infinity, you get

$$\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x} \; (\vec{\nabla} \psi) \cdot \vec{J} = -\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x} \; \psi \vec{\nabla} \cdot \vec{J}=0.$$

If I define in 2D a rectangular conductor domain in air (infinitely long in Z), where J is oriented outside the plane in Z, it is only necessary to evaluate the scalar product A*J inside the conductor domain, since elsewhere J=0. If the vector potential is also outside the plane in Z, but I choose the additive gradient to be along -Z (and also very large in module so that the resulting vector potential becomes negative), the energy becomes negative. How can this be possible if the total energy is gauge invariant?

Bill_K
Science Advisor
Because in that situation J does not vanish at infinity, and you have a large contribution to the surface integral over the end caps at Z = ± ∞

But we also have div J = 0 in this case, since we have only a Jz component that does not depend on Z. So the equation of the previous poster should still be true:
$$\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x} \; (\vec{\nabla} \psi) \cdot \vec{J} = -\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x} \; \psi \vec{\nabla} \cdot \vec{J}=0$$