Equivalence of magnetic flux and energy