Figure 4: Optimal design problem of a Halbach cylinder creating a homogeneous strayfield inside of the cylinder.
From: Solving Large-Scale Inverse Magnetostatic Problems using the Adjoint Method

Starting from a homogeneous strayfield the presented algorithm reproduces a Halbach like magnetization configuration within
m (red arrows). A constant-norm regularization with α = 104 is used and shows a nearly perfect match with the analytical solution (green arrows). The resulting strayfield is calculated inside
h and shows a nearly homogeneous distribution (red arrows). The relative errors of the magnetization magnitude and the reconstruced strayfield are indicated by the gray-scale, and their maximum amount to 2% and 6%, respectively.