Using the script command findresonances to analyze whispering gallery modes

The 2019A release comes with the new script command findresonances, which allows you to extract information about resonances from time-domain signals.This feature can be very useful when studying structures with resonant modes such as ring resonators, photonic crystal cavities, Bragg microcavities, among others.

Here we will analyze the whispering gallery modes supported by a GaN rod, previously discussed in this KB example using a DFT monitor with apodization. We take a different approach using the findresonances script command, which identifies resonances in time signals (for instance, the signal recorded by a time domain monitor) within a given frequency window [f_min, f_max] and returns their frequency, decay constant, Q-factor, amplitude and phase.

There are a few key points to have in mind:

  • The signal to analyze should start only after all sources have stopped injecting energy into the system. When the rising part of the signal is not removed, findresonances may report spurious resonances and in particular wrong Q-factors.
  • The longer the provided signal, the more accurate the reported modes will be. However, the decay/Q-factors are much more sensitive to this than the resonance frequency. It is often possible to obtain very accurate frequency information from only a few oscillation periods, while accurate Q-factors require significantly more data. This is a significant advantage over the high-Q analysis group since you can use short simulation times to identify resonant frequencies even if the system has high-Q resonances.
  • To reliably find modes, they must be excited with sufficient energy. It is important to make sure the the excitation bandwidth is comparable to or larger than the frequency window [f_min, f_max].
  • The command yields more reliable results near the center of the frequency interval [f_min, f_max]. When scanning large frequency intervals, it could be useful to use multiple runs with overlapping frequency windows.
  • When using findresonances, you don’t specify a number of resonances to look for. The script will report all the resonances found in the range provided. This is useful when the number of resonances or their frequencies are unknown.
  • You can look at different time traces of the data and compare the results for different time ranges.

In the simulation file cavity_whispering_gallery_findresonances.fsp (299.5 KB) we use magnetic dipole sources placed near the edge of the rod since we expect the fields of the resonant mode to be stronger in this region. We also randomly placed a few time monitors in this region (timemonitor1, timemonitor2 and timemonitor3).

For analyzing the results you can use the script analyze_resonances.lsf (2.5 KB), which plots the resonant frequencies and Q-factors calculated with different time traces. In the script you need to specify tStart and tStop (which must be within the simulation time). The script will use time traces within the range [tStart, t_max], where tStart<t_max<tStop and plot the result for each time t_max.

We propose the following workflow to study the resonances.

Step 1: Identify the resonances with a short simulation

Set the frequency bandwidth of the dipole sources to cover the range where the resonances of interest are expected; in this case we start with the range 400 to 450nm. Note that you can set this range for all dipoles using the Global properties for sources. This step can be initially run with a short simulation time; for instance, here we can use 500 fs, even though the auto shutoff level does not decrease below 0.2 within this time. The results from analyze_resonances.lsf for different time monitors are shown below (with tStart = 100 fs and tStop = 500 fs):

By comparing these plots we conclude there are four resonances in this frequency range near 679 THz (441 nm), 700 THz (428 nm), 717 THz (418 nm) and 741 THz (404 nm). In this example we will focus on the resonances at 418 and 428 nm.

Sometimes resonances are hard to find with certain monitors (you can see this for the resonance at 700 THz with timemonitor3). The reason is that monitors might be located at positions where the modal fields are weak (for example, near a node). For this reason, it is convenient to plot the modal fields at the frequencies of interest (using a DFT monitor with full apodization) and identify the optimal positions to place the time monitors. The magnetic field intensities from monitors 418nm_profile and 428nm_profile are shown below:

We have intentionally placed two time monitors (timemonitor_418nm and timemonitor_428nm) at optimal positions. We can now run analyze_resonances.lsf for these monitors with a smaller frequency range around the target ones ( 715 to 719 THz and 695 to 705 THz). We get the following results:

Note that the resonance at 700 THz (428 nm) has a low Q-factor and so the calculation becomes stable as t_max approaches tStop = 500 fs . The resonance at 717 THz (418 nm), on the other hand, has a large Q-factor and the results do not stabilize within this time range.

Step 2: Run longer simulations for systems with high Q-factor

Now we increase the simulation time to 6000 fs in order to get a better estimate of the Q-factor for the resonance at 717 THz (418 nm). In addition, we also set the dipole sources to have a narrower bandwidth around this frequency so that the resonance is excited more effectively by using the following Global source properties:

  • center wavelength = 418nm
  • wavelength span = 0
  • disable optimize for short pulse.

The results from analyze_resonances.lsf for tStart = 100 fs and tStop = 6000 fs show a much more stable value for the Q-factor, around 800000.

Note that there is an outlier near t_max = 3500 fs, which corresponds to a spurious resonance returned by findresonances. The script command provides an error estimate that can be used to identify these spurious resonances. This estimate is a measure of relative confidence, i.e. it is only meaningful by comparison between the estimates for all resonances found. If the value of the error estimate for a resonance stands out as significantly larger than the rest, there is a higher chance that it is a spurious resonance. The script analyze_resonances.lsf returns the error estimate whenever multiple resonances are found, along with the corresponding t_max and resonance frequency value. This information is stored in the log file multiple_resonances.log. For example, in the last run of analyze_resonances.lsf the log file reports something like this:

time (fs), resonance freq. (THz), error estimate

3568.92	716.378	0.000141166
3568.92	716.824	1.07677e-08

Note that this time corresponds precisely to the outlier we identified before. The resonance at 716.378 THz has an error estimate four orders of magnitude larger than the other one, which means the degree of confidence for this resonance is extremely low.