Well, in the AmpĂ¨re Maxwell equation, you integrate by part vA\cdot\nabla\times\nabla\times A (here vA is the test function), to get the boundary term. There replace the \nabla\times A by the desired value of the magnetic fieldâ€¦This gives something like this in your weak form in freefem