Is the current density constant in magnetostatics? I'm thinking about the conditions needed for magnetostatics, in other words magnetic fields that do not change with time. My textbook says that this requires a steady, continuous current without any charge piling up anywhere, and that by the continuity equation the requirement for magnetostatics is
$$ \mathbf{\nabla}\cdot\mathbf J  = 0$$
by the justification that otherwise there would be pile-up of charge. I don't understand why this is the requirement for producing a magnetic field that does not vary with time. In my mind, the equations
$$ \mathbf{\nabla}\cdot\mathbf B  = 0 \\ \mathbf{\nabla}\times\mathbf B  = \mu_0\mathbf{J}$$
(assuming no electric field), taken together with Helmholtz's theorem means that $\mathbf B$ is determined by $\mathbf J$. In that case, shouldn't the condition for magnetostatics be $\mathbf J$ that does not vary with time? For the statement that $ \mathbf{\nabla}\cdot\mathbf J  = 0$ does not guarantee constant $\mathbf J$ either. What am I missing here?
 A: While at first glance this might seem a trivial question, I do not believe that it is. It depends on what exactly one defines the regime of magnetostatics to be. If you define magnetostatics to be the regime where the equations that govern the magnetic field are given by:
\begin{aligned}
\nabla \cdot \mathbf{B} &= 0, \\
\nabla \times \mathbf{B} &= \mu_0 \mathbf{J},
\end{aligned}
then by consistency it must be that $\nabla \cdot \mathbf{J} = 0$. You can see this by taking the divergence of the second equation above. Since, for any vector field $\mathbf{V}$, $$\nabla \cdot \left (\nabla \times \mathbf{V} \right) = 0,$$
this means that:
$$\nabla \times \mathbf{B} = \mu_0 \mathbf{J} \quad \quad\implies \quad \quad \nabla \cdot \mathbf{J} = 0. $$
But you should be able to see that what we have assumed when we write the equations above is not simply that the magnetic field is constant, but that both the electric and magnetic fields are constant! I believe that this is the common (though often not explicitly stated) definition of magnetostatics.
Now, you are right in saying that a divergenceless $\mathbf{J}$ does not imply that the current is time-independent. They are two separate assumptions. So could we just as well say that we are only interested in the regime where the magnetic field is constant? In this case, the equation for the curl of $\mathbf{B}$ would also have a term involving the electric field. (This is not a huge generalisation, the equation of continuity still tells us that if $\mathbf{J}$ is a constant in time, then the charge density $\rho$ is at most linear in $t$, and this constrains how the electric field can behave.)
From @tparker's answer here: Question about the definition of magnetostatics:

If you require the current to only be time-independent but not divergenceless, then it turns out that the resulting magnetic field is also constant in time and given exactly by the Biot-Savart law. But you can have steady charge buildup, and the electric field is given by Coulomb's law with the charges evaluated at the present time, not the retarded time - a situation that may appear to, but doesn't actually, violate causality. This is a rather subtle situation, and whether or not you consider it to be "magnetostatic" is a matter of personal preference - but most people probably wouldn't, because even though the magnetic field is constant in time, it still has a contribution from the time-changing electric field via Ampere's law.

So in other words, in such fortuitous situations the magnetic field is indeed constant, but it is kept constant thanks to a time-varying electric field. Convention seems to dictate that this is not "magnetostatics", but that can be debated. This has been discussed in a paper by Griffiths here: Time-dependent generalizations of the Biot-Savart and Coulomb laws, where the author defines an interesting "hierarchy":

*

*Static ($\rho$ and $\mathbf{J}$ constant in $t$): Biot-Savart, Coulomb, and Ampere laws all hold


*Semistatic ($\rho$ linear, $\mathbf{J}$ constant): Biot-Savart and Coulomb hold, Ampere fails


*Demisemistatic ($\rho$ constant, $\mathbf{J}$ linear): Biot-Savart and Ampere hold, Coulomb fails


*General (arbitrary $\rho$ and $\mathbf{J}$): Biot-Savart, Coulomb, and Ampere all fail
So in summary, if you want a regime in which you can apply all three laws (Biot-Savart, Coulomb, and Ampere), then you require both $\rho$ and $\mathbf{J}$ to be constant in time, and the equation of continuity further requires that $\nabla \cdot \mathbf{J} = 0$. This leads to the conventional definition of magnetostatics.
A: Yes, for magnetostatics J would need to be constant. However if there is a constant net current flowing into a volume of space the charge in that volume will build up, eventually reaching an unsustainable value. The condition $\mathbf{\nabla}\cdot\mathbf J=0$ is needed to ensure this does not happen.
