  Cavities, because they trap waves for long times due to their reflecting
walls, are used in a vast number of scientific domains. Indeed, in these closed
media and due to interferences, the free space continuum of solutions becomes a
discrete set of stationary eigenmodes. These enhanced stationary fields are
commonly used in fundamental physics to increase wave-matter interactions. The
eigenmodes and associated eigenfrequencies of a cavity are imposed by its
geometrical properties through the boundary conditions. In this paper, we show
that one can control the wave fields created by point sources inside cavities
by tailoring only the boundaries of the cavities. This is achieved through the
use of a tunable reflecting metasurface, which is part of the frontiers of the
cavity, and can switch its boundary conditions from Dirichlet to Neumann. Based
on the use of arrays of subwavelength resonators, a mathematical modeling of
the physical mechanism underlying the concept of tunable metasurfaces is
provided.
