  This study proposes a versatile and efficient optimisation method for
discrete coils that induce a magnetic field by their steady currents. The prime
target is gradient coils for MRI (Magnetic Resonance Imaging). The derivative
(gradient) of the $z$-component the magnetic field, which is calculated by the
Biot--Savart's law, with respect to the $z$-coordinate in the Cartesian $xyz$
coordinate system is considered as the objective function. Then, the derivative
of the objective function with respect to a change of coils in shape is
formulated according to the concept of shape optimisation. The resulting shape
derivative (as well as the Biot--Savart's law) is smoothly discretised with the
closed B-spline curves. In this case, the control points (CPs) of the curves
are naturally selected as the design variables. As a consequence, the shape
derivative is discretised to the sensitivities of the objective function with
respect to the CPs. Those sensitivities are available to solve the present
shape-optimisation problem with a certain gradient-based nonlinear-programming
solver. The numerical examples exhibit the mathematical reliability,
computational efficiency, and engineering applicability of the proposed
methodology based on the shape derivative/sensitivities and the closed B-spline
curves.
