Solution (source code)

= Solution

Choose two independent labels for the <magnetic field lines>, constant along each line. These are <Euler potentials>: $\mathbf B\cdot\nabla\alpha=\mathbf B\cdot\nabla\beta=0$. Where the two <gradients> are independent, the vector <Orthogonality>[perpendicular] to both is $\nabla\alpha\times\nabla\beta$, so initially write
$$
\mathbf B=f\,\nabla\alpha\times\nabla\beta.
$$
The <Solenoidal vector field>[solenoidal condition] gives $0=\nabla\cdot\mathbf B=(\nabla\alpha\times\nabla\beta)\cdot\nabla f$. Thus $f$ is constant along a <Magnetic field line>[field line] and is locally a function of its labels. Redefining one label, for example $\widetilde\beta(\alpha,\beta)=\int^\beta f(\alpha,b)\,db$, absorbs this factor. Dropping the tilde gives
$$
\boxed{\mathbf B=\nabla\alpha\times\nabla\beta.}
$$
This representation automatically has zero <divergence>, since it is also $\nabla\times(\alpha\nabla\beta)$.

For an <magnetic arcade>, assign the labels on one polarity of the footpoint surface and transport them along each line to its other footpoint. They specify both line identity and <magnetic flux>: on a transverse surface, flux coordinates can be chosen so that the <Magnetic flux>[directed flux] element is $d\alpha\,d\beta$. In particular,
$$
B_z(x,y,0)=\partial_x\alpha_0\,\partial_y\beta_0-
\partial_y\alpha_0\,\partial_x\beta_0.
$$
The <Euler potentials>[boundary labels] at paired footpoints must agree, so prescribed <Boundary condition>[boundary functions] encode a compatible <Magnetic field line>[footpoint mapping], not independently arbitrary values at the two ends.

The construction assumes a smooth family of nonintersecting lines that can be labelled from a transverse boundary patch, with suitable patches at nulls or coordinate singularities. A local <Euler potentials>[Euler-potential representation] does not establish the existence of two globally single-valued regular labels for every possible <Solenoidal vector field>[solenoidal field]; closed, recurrent or more complicated <Magnetic field line>[field topology] can obstruct such a global choice. The line-tied <magnetic arcade> geometry supplies the relevant simplifying assumption here.