Here we consider a cavity formed by a 2D hexagonal photonic crystal structure. A small gain region is added to the center of the cavity.

## Simulation setup

For the gain material ("Gain_Material") we use a Lorentz model material with Lorentz permittivity -0.04 and resonance frequency close to 207THz, which is the expected resonance of the cavity.

## Results

The imaginary part of the refractive index of the gain material is about -0.1 at 207THz. This value is enough to cause exponential growth of the fields. Plots of Hz(t) from the time monitor (located within the cavity) and the corresponding FFT, are shown below. The field resonance is at 207THz, as expected.

## Script Analysis

We will determine the value of the imaginary part of the refractive index of the Gain_material that is required to make this simulation diverge. Use the script file *gain_PC_cavity.lsf* to run a sweep over the Lorentz permittivity, from -0.1 to 0. For each simulation, we will study the time signal of the fields. For small values of |k| (low gain), we expect the field intensity to exponentially decay. For large values of |k| (large gain), we expect the field intensity to exponentially increase. The overall gain of the system is related to the logarithm of the rate of increase/decrease of the field amplitude. When the script is complete, the following figure will be produced. It shows "slope of log10(Hz(t))" vs "k".

All positive values of "slope of log10(Hz(t))" mean the simulation will diverge. As expected, the more negative k is, the faster the simulation diverges because the system has more gain. The value of k at which the simulations begin to diverge is between k=-0.01 and -0.02.Note, "k" is the imaginary refractive index of the material, which is a function of frequency. In the simulation, only one frequency is monitored.