Can magnetic loops with no source current knot or link? The answer to this question is obviously no. I would like to pose a variation of that question. Suppose a simply connected domain of a 3-d vacuum space has no source current. Does there exist a case where two closed loops of magnetic field residing in that domain knot into a link? (Either static or dynamic answer would be great.)
 A: A magnetic field line is a line that is tangent to the magnetic field vector at every point along the line. The question asks if two magnetic field lines can be linked, if the magnetic field is consistent with Maxwell's equations in a vacuum. The answer is yes, which I'll prove by constructing an example.
 The example 
In terms of the complex-valued field $\mathbf{F}\equiv\mathbf{E}+i\mathbf{B}$, Maxwell's equations in a vacuum can be written as a pair of equations
$$
\newcommand{\bfA}{\mathbf{A}}
\newcommand{\bfB}{\mathbf{B}}
\newcommand{\bfE}{\mathbf{E}}
\newcommand{\bfF}{\mathbf{F}}
\nabla\cdot\bfF=0
\hspace{2cm}
i\dot\bfF=\nabla\times\bfF.
$$
Any field that satisfies the first equation at time $t=0$ can be evolved in time using the second equation, and the first equation is equivalent to the pair of uncoupled equations $\nabla\cdot\bfB=0=\nabla\cdot\bfE$, so the question reduces to this purely spatial question about the magnetic field at time $t=0$: If the vector field $\bfB$ satisfies $\nabla\cdot\bfB=0$, then can two of its lines be linked?
If $\bfB=\nabla\times\bfA$ for some smooth nonsingular vector field $\bfA$, then we automatically have $\nabla\cdot\bfB=0$. We can use this fact to construct an example. Use a Cartesian coordinate system $x,y,z$, and use the abbreviations
$$
 f(x,y)\equiv x^2+y^2
\hspace{2cm}
 g(x,z)\equiv (x-1)^2+z^2
$$
and consider these two circles:

*

*Circle $C'$ is defined by $f(x,y)=1$ and $z=0$.


*Circle $C''$ is defined by $g(x,z)=1$ and $y=0$.
These circles are linked. The goal is to construct a field $\bfA$ such that both of these circles are everywhere tangent to the field $\bfB\equiv \nabla\times\bfA$, so that $C'$ and $C''$ are both lines of $\bfB$. To do this, write $\bfA=\bfA'+\bfA''$ with
$$
\bfA'=
\begin{cases}
 (0,0,(f(x,y))^{-1/2}) & \text{for }|f(x,y)-1|<0.001\text{ and }|z|<0.001\\
 (0,0,0) & \text{for } |f(x,y)-1| > 0.002\text{ or }|z|>0.002
\end{cases}
$$
and
$$
\bfA''=
\begin{cases}
 (0,(g(x,z))^{-1/2},0) & \text{for }|g(x,z)-1|<0.001\text{ and }|y|<0.001\\
 (0,0,0) & \text{for } |g(x,z)-1| > 0.002\text{ or }|y|>0.002,
\end{cases}
$$
and interpolate smoothly between $0.001$ and $0.002$ in each case. Then $\bfA'$ is nonzero only in a small neighborhood of $C'$, and $\bfA''$ is nonzero only in a small neighborhood of $C''$, and both $\bfA'$ and $\bfA''$ are smooth and nonsingular everywhere. This implies that $\bfB$ is smooth and nonsingular everywhere. Within the neighborhoods defined by the $0.001$ cutoff, the fields satisfy
\begin{align}
 \nabla\times\bfA' &\propto (f(x,y))^{-3/2}(y,-x,0) \\
 \nabla\times\bfA'' &\propto (g(x,z))^{-3/2}(z,0,-(x-1)),
\end{align}
and these are everywhere tangent to the circles $C'$ and $C''$, respectively. The supports of $\bfA'$ and $\bfA''$ do not overlap, so $\bfB\equiv\nabla\times(\bfA'+\bfA'')$ is also everywhere tangent to the circles $C'$ and $C''$, and these circles are linked. This completes the construction.
 The intuition that led to the example 
Here's the intuition that led to the example. Consider two straight current-carrying wires $W'$ and $W''$, one on the line $x=y=0$ and one on the line $x-1=z=0$. The magnetic field produced by either one of these wires by itself has circular field lines centered on that wire. Let $\bfA'$ and $\bfA''$ be the corresponding vector potentials. Choose the circles $C'$ and $C''$ as above, and modify $\bfA'$ and $\bfA''$ to drop smoothly to zero as we move away from those respective circles, so that their supports don't overlap, and take the currents to be zero for consistency. Now take $\bfB$ to be the magnetic field with vector potential $\bfA'+\bfA''$, and we have two linked magnetic field lines in a magnetic field that is everywhere smooth and nonsingular and satisfies Maxwell's equations in a vacuum at $t=0$. What happens at $t\neq 0$ can be inferred from Maxwell's equations using this initial condition together with an additional initial condition on the electric field, but the question allows for a dynamic answer, so what happens at $t\neq 0$ is not important. The magnetic field lines are linked at $t=0$, at least.
 Can a magnetic field line form an arbitrary knot? 
As Hans suggested in a comment, the idea described above can be simplified and generalized by using (temporary) solenoids instead of (temporary) individual wires. Take any knot drawn in 3d space, which may have multiple linked components. Replace the drawn line with a long-and-thin solenoid so that the original line coincides with a magnetic field line enclosed by the solenoid. Let $\bfA$ be the vector potential of the whole set-up, and modify $\bfA$ so that it falls rapidly but smoothly to zero away from the original drawn line.  For consistency with Maxwell's equations, also delete the current (the solenoid), because now $\bfA$ is zero in the space where the current was. Since $\bfA$ is still the same as before in a neighborhood of the drawn line, taking the curl of $\bfA$ will give a magnetic field that is well-defined everywhere, satisfies $\nabla\cdot\bfB=0$ everywhere, and has a line that coincides with the original drawn line.
A: As @benrg mentioned in his comment, there are papers on exactly this topic, e.g.,

*

*Carlos Hoyos, Nilanjan Sircar and Jacob Sonnenschein, New knotted solutions of Maxwell’s equations.

*Hridesh Kedia, Iwo Bialynicki-Birula, Daniel Peralta-Salas,
and William T.M. Irvine, Tying knots in light fields.

There, the electromagnetic field is constructed using the Batesman's constuct, where the fields $({\bf E},{\bf B})$ is encoded by the Riemann-Silberstein vector
$${\bf F = E}+ i{\bf B}=\nabla\alpha\times\nabla\beta$$
where $\alpha$ and $\beta$ are complex functions of $(t,x,y,z)$ and $i$ is the imaginary unit. This is then substituted in to the Maxwell's equations to obtain an equation constraining $(\alpha,\beta)$. The solutions of linked field lines are then constructed through some transformations such as conformal mapping.
