I have a question about two magnetic dipoles in the form of coaxial current carrying loops both of radius $r_0$ a distance $h_0 \gg r_0$ apart. Using $h_0 \gg r_0$ we can assume the B-field from one of the loops is uniform along the axis at the other loop.
To calculate the force experienced by one of the loops, we can use $F = -\nabla U = -\frac{d}{dx}U$, and for $U$ we use the fact that $m\cdot B = U$ for magnetic moment $m = IA = I \pi r_0^2$.
This yields the correct answer of $F=3\mu_0 \pi r_0^4 I^2 / 2h_0^4$, using $B = \mu_0 I r_0^2 / 2(h_0^2 + r_0^2)^{\frac{3}{2}} \approx \mu_0 I r_0^2 / 2h_0^3$, but I have some confusion working out what is actually going on in this scenario.
From intuition, we can treat these two loops like mini bar magnets, and from experience they should repel or attract one another (depending on the relative direction of current in each loop etc). This results in a translational force along the axis of the loops.
However, the expression for $U$ is obtained by considering the work done in rotating the coil against the external B-field from a perpendicular starting point: $U = -W = \int_{\frac{\pi}{2}}^{\theta} \tau d\theta '$, $\tau = m \times B$ for a current loop in a B-field; integrating gives a final ans. of $mB\cos \theta = m \cdot B$. In this example, the coils are perpendicular to the axis, and so $\theta = 0$ and $m\cdot B = mB$.
So the potential energy from which we derive our translational force is associated with a rotation of the loops against a B-field instead of the translational separation of the two loops.
Can anyone explain how/why this potential energy gradient leads to a translational motion instead of a rotational one?
Please ask for clarification if it would be necessary.