  We present a general construction of divergence-free knotted vector fields
from complex scalar fields, whose closed field lines encode many kinds of knots
and links, including torus knots, their cables, the figure-8 knot and its
generalizations. As finite-energy physical fields they represent initial states
for fields such as the magnetic field in a plasma, or the vorticity field in a
fluid. We give a systematic procedure for calculating the vector potential,
starting from complex scalar functions with knotted zero filaments, thus
enabling an explicit computation of the helicity of these knotted fields. The
construction can be used to generate isolated knotted flux tubes, filled by
knots encoded in the lines of the vector field. Lastly we give examples of
manifestly knotted vector fields with vanishing helicity. Our results provide
building blocks for analytical models and simulations alike.
