  Modeling a single crystal of cuprate high-$T_c$ superconductor, such as
$\rm{Bi_2Sr_2CaCu_2O_{8+\delta}}$, as a stack of intrinsic Josephson junctions,
we formulate explicitly the cavity phenomenon of plasma oscillations and
electromagnetic (EM) waves in mesas of cylindrical and annular shapes. When the
mesa thickness is small compared with the EM wavelength, the boundary condition
for the inductively coupled sine-Gordon equations is the Neumann-type one to a
good approximation, addressed first theoretically and verified in a recent
experiment. This renders the superconductor mesa a cavity. Biasing a dc voltage
in the $c$ direction, a state with $\pm\pi$ kinks in the superconductivity
phase difference piled up alternatively along the c axis is stabilized. The
$\pm\pi$ phase kinks provide inter-lock between superconductivity phases in
adjacent junctions, taking the advantage of huge inductive couplings inherent
in the cuprate superconductors, which establishes the coherence across the
whole system of more than $\sim 600$ junctions. They also permit a strong
coupling between the lateral cavity mode and the transverse Josephson plasma,
enhance the plasma oscillation significantly at the cavity modes which radiates
EM waves in the terahertz band when the lateral size of mesa is set to tens of
micrometers. In order to overcome the heating effect, we propose to use annular
geometry. The dependence of frequency on the aspect ratio is analyzed, which
reveals that the shape tailor is quite promising for improving the present
technique of terahertz excitation. The annular geometry may be developed as a
waveguide resonator, mimic the fiber lasers for visible lights.
