The quality factor, Q, of photonic resonators
permeates most figures of merit in applications that rely on cavity-enhanced
light–matter interaction such as all-optical information processing,
high-resolution sensing, or ultralow-threshold lasing. As a consequence,
large-scale efforts have been devoted to understanding and efficiently
computing and optimizing the Q of optical resonators
in the design stage. This has generated large know-how on the relation
between physical quantities of the cavity, e.g., Q, and controllable parameters, e.g., hole positions, for engineered
cavities in gaped photonic crystals. However, such a correspondence
is much less intuitive in the case of modes in disordered photonic
media, e.g., Anderson-localized modes. Here, we demonstrate that the
theoretical framework of quasinormal modes (QNMs), a non-Hermitian
perturbation theory for shifting material boundaries, and a finite-element
complex eigensolver provide an ideal toolbox for the automated shape
optimization of Q of a single photonic mode in both
ordered and disordered environments. We benchmark the non-Hermitian
perturbation formula and employ it to optimize the Q-factor of a photonic
mode relative to the position of vertically etched holes in a dielectric
slab for two different settings: first, for the fundamental mode of
L3 cavities with various footprints, demonstrating that the approach
simultaneously takes in-plane and out-of-plane losses into account
and leads to minor modal structure modifications; and second, for
an Anderson-localized mode with an initial Q of 200,
which evolves into a completely different mode, displaying a threefold
reduction in the mode volume, a different overall spatial location,
and, notably, a 3 order of magnitude increase in Q.