  The shape gradient is a local sensitivity function that provides the change
in a figure of merit associated with a perturbation to the shape of the object.
The shape gradient can be used for gradient-based optimization, sensitivity
analysis, and tolerance calculations. However, it is generally expensive to
compute from finite-difference derivatives for shapes which are described by
many parameters, as is the case for stellarator geometry. In an accompanying
work (Antonsen et al. 2019), generalized self-adjointness relations are
obtained for MHD equilibria. These describe the relation between perturbed
equilibria due to changes in the rotational transform or toroidal current
profiles, displacements of the plasma boundary, modifications of currents in
the vacuum region, or the addition of bulk forces. These are applied to
efficiently compute the shape gradient of functions of magnetohydrodynamic
(MHD) equilibria with an adjoint approach. In this way, the shape derivative
with respect to any perturbation applied to the plasma boundary or coil shapes
can be computed with only one additional MHD equilibrium solution. We
demonstrate that this approach is applicable for several figures of merit of
interest for stellarator configuration optimization: the magnetic well, the
magnetic ripple on axis, the departure from quasisymmetry, the effective ripple
in the low-collisionality $1/\nu$ regime ($\epsilon_{\text{eff}}^{3/2})$ (Nemov
et al. 1999), and several finite collisionality neoclassical quantities.
Numerical verification is demonstrated for the magnetic well figure of merit
with the VMEC code (Hirshman & Whitson 1983) and for the magnetic ripple with
modification of the ANIMEC code (Cooper et al. 1992). Comparisons with the
direct approach demonstrate that to obtain agreement within several percent,
the adjoint approach provides a factor of $\mathcal{O}(10^3)$ in computational
savings.
