Please note that this is an advanced source feature that can substantially increase simulation time, and we don’t recommend using it unless strictly necessary. If you choose to use the frequency dependent profile option, we strongly recommend beginning all simulations without this feature, and only proceeding to using it after all other project settings have been configured and you are obtaining good results at the center frequency of your simulation.

**Requirements**

Control of the maximum convolution time window requires 2020a R4 or newer.

## Default injection method

FDTD sources that are injected on a plane (gaussian, plane, custom, mode and ports) are injected into the FDTD simulation using electric and magnetic fields as a function of time that are given by:

\( \vec{E}_{FDTD} (x,y,z_0,t) = \vec{E}_{source}(x,y,z_0,\omega_0) s(t) \)

\( \vec{H}_{FDTD} (x,y,z_0,t) = \vec{H}_{source}(x,y,z_0,\omega_0) s(t) \)

where \(\omega_0 = 2\pi f_0\) is the angular frequency corresponding to the center frequency of the FDTD simulation, \( \vec{E}_{source}(x,y,z0,\omega_0) \) and \( \vec{H}_{source}(x,y,z0,\omega_0) \) are the frequency domain electric and magnetic source profiles calculated at the center frequency of the simulation, and \(s(t)\) is the source time signal\(^*\).

\(^*\)Note that \(s(t)\) is calculated for all sources based on the input parameters in the “Frequency/Wavelength” tab. In most cases, the user simply chooses a target wavelength range and the optimal source signal \(s(t)\) is automatically calculated. Less frequently, the user will adjust the time domain parameters or define a custom time signal for \(s(t)\). Frequency domain data is normalized to the frequency spectrum of the source signal, \(s(\omega)\), to obtain the impulse response of the system; see Understanding frequency domain CW normalization for more details.

## When to use frequency dependent profiles

For many simulations, the default approach is appropriate since the source profile has a negligible variation over the bandwidth of the simulation. However, there are some cases where frequency dependent profiles should be used:

- Beam sources (gaussian or thin lens) where the source profile changes substantially over the simulation bandwidth. The beam profile becomes increasingly frequency dependent as the beam NA increases.
- Mode sources or ports where the mode profile changes substantially over the bandwidth.
- Beam sources at angles where a frequency independent source angle is desired. The frequency dependence of the angle of injection increases with increasing nominal source angle.
- Plane waves injected at angles where a frequency independent source angle is desired. Note that this will be a diffracting plane wave, so consider BFAST as an alternative for periodic structures.
- Plane waves injected into a dispersive medium where the ratio of \(\vec{E}\) and \(\vec{H}\) changes substantially with frequency.

## When NOT to use frequency dependent profiles

If you are working with linear materials and have a source profile that can be written as the product of functions of space and frequency as

\( \vec{E}_{source} (x,y,z_0,\omega) = \vec{E}_{spatial}(x,y,z_0) g(\omega) \)

\( \vec{H}_{source} (x,y,z_0,\omega) = \vec{H}_{spatial}(x,y,z_0) g(\omega) \)

then you should NOT use frequency dependent profiles, no matter how complex the frequency dependence of \(g(\omega)\). To improve performance, multiply the \(\vec{E}\) and \(\vec{H}\) fields collected by frequency domain monitors by \(g(\omega)\) as a post-processing step following the FDTD simulation. This works because the standard usage of FDTD (with cw normalization on) calculates the impulse response of the system.

## How they work

When using frequency dependent source profiles, the electric and magnetic fields injected into the FDTD simulation are given by

\( \vec{E}_{FDTD} (x,y,z_0,t) = {FT}^{-1}\{\vec{E}_{source}(x,y,z0,\omega) s(\omega) \} =\vec{E}_{source}(x,y,z0,t) \ast s(t) \)

\( \vec{H}_{FDTD} (x,y,z_0,t) = {FT}^{-1}\{\vec{H}_{source}(x,y,z0,\omega) s(\omega) \} =\vec{H}_{source}(x,y,z0,t) \ast s(t) \)

Where \({FT}^{-1}\) is the inverse Fourier transform. In the time domain, we therefore have a convolution product of the source pulse and the time domain source field profile.

In order to calculate the convolution product, we must be able to accurately interpolate the source profile in the frequency domain. Since many beam calculations are computationally expensive, especially thin-lens and mode sources, we use Chebyshev interpolation and therefore sample the profile on a Chebyshev frequency grid. This provides the optimal discrete sampling grid to approximate the continuous functions \( \vec{E}_{source} (x,y,z_0,\omega) \) and \( \vec{H}_{source} (x,y,z_0,\omega) \).

The convolution product results in injected fields (\(\vec{E}_{FDTD}(x,y,z_0,t)\) and \(\vec{H}_{FDTD}(x,y,z_0,t)\) ) the duration of which cannot be known beforehand; it depends on the complexity of the frequency dependence of the source field. FDTD will attempt to autodetect the injected pulse duration and may allow the injected pulse to last for the entire FDTD simulation. In addition, when sources are injected at angles, additional time may be added to the FDTD simulation because the injected pulse will arrive at different times across the source plane. Longer simulations, and longer times required to inject the beam are the main computational costs associated with injecting frequency dependent beam profiles.

## Meaning of the settings

**number of field profile samples**is the number of frequency samples of the source profile we take on a Chebyshev grid for the subsequent calculations. The number of points required depends greatly on how much frequency dependence the profile has with frequency. We recommend starting with a small number (such as 7) and increasing it using usual convergence testing approaches.**set maximum convolution time window**and**maximum convolution time window**allow you to optionally limit the maximum amount of time that will be used for the injected pulse generated by the convolution product. When unchecked, the maximum convolution time window is equal to the maximum simulation time.

## Custom field profiles

When you load custom source field profiles they will be used to create \( \vec{E}_{source} (x,y,z_0,\omega) \) and \( \vec{H}_{source} (x,y,z_0,\omega) \). If you load only a single frequency, there is no purpose in turning on frequency dependent profiles. If you load multiple frequencies, the data will be interpolated onto the Chebyshev grid that covers the specified frequency range of the source, using the number of field profile samples specified. There are no restrictions on the frequency sampling of your custom data, or even that there is perfect overlap between the frequency range of the data and the frequency range of the source. However, for greatest accuracy with the least amount of custom data, it is best to load custom data sampled on a Chebyshev grid that corresponds to the same frequency range you intend to use for your source, and choose the **number of field profiles samples** to be equal to the number of frequency samples in your data. If the field data comes from a prior FDTD simulation, you can easily choose to sample frequency domain monitors on a Chebyshev grid.

## Frequency extrapolation

In order to calculate the convolution product, the field profile data must be extrapolated outside the frequency range provided to all frequencies that may be present in the FDTD simulation. The choice of extrapolation method does not affect the final FDTD results calculated within the desired simulation bandwidth, but it can affect the length of the convolution time window required for the simulation. By default, we use a fourth order polynomial extrapolation that preserves the continuity of the first and second derivatives at the edge of the simulation bandwidth. Since release 2020 R2.2, we allow advanced users to control the extrapolation method used for imported field profiles and mode sources by allowing a third order extrapolation that preserves only the continuity of the first derivative at the edge of the simulation bandwidth. This can be necessary because an incorrect second derivative may lead to significant overshoot effects when extrapolating using the fourth order scheme. This advanced property, called "frequency extrapolation" is accessible only through script and has the following options:

- "
**auto**" is the default value. With this setting, fourth order extrapolation will be used if the frequency grid is a Chebyshev grid and, otherwise, third order will be used because the interpolation step loses the accuracy of the second derivative. - "
**fourth order**" and "**third order**" can be used to force either extrapolation method. Third order may be desirable if, despite having a Chebyshev grid, there are any errors in the data that affect the accuracy of the second derivative.

The property can be written and read with the script commands set, get, setnamed and getnamed. For example,

set("frequency extrapolation","third order");

can be used when an imported source or mode source is selected.

## Performance considerations

Increasing the number of field profile samples can greatly increase the initialization time, particularly for large, thin-lens sources. For mode sources and ports, it can increase the time to save files because the modes are pre-calculated in the design environment.

The convolution product itself is computationally expensive during the FDTD simulation and you may see the simulation speed slow substantially while the source is injected. The maximum duration of the injected pulse is stored as a result for the source called “convolution_time_window”. In 2D the result name has “_TE” or “_TM” appended because sources can create both TE and TM simulations, depending on the source polarization, and each type of source may have a different convolution time window. You may choose to limit the **maximum convolution time window** for two reasons:

- You are running a simulation with a very long maximum simulation time that is substantially longer than the convolution time window required. Limiting the
**maximum convolution time window**over which the source will attempt to determine the actual necessary convolution time window will improve the performance of the source during initialization. - You decide that the convolution time window determined by the source is longer than necessary and includes a long period of very weak source signal, which can be ignored. If you reduce the
**maximum convolution time window**for this reason, it will likely reduce the accuracy of the results, but it may be an acceptable tradeoff. Also, this will improve performance while the simulation is running because it is reducing the amount of time the source is actually injected, and may even reduce the total simulation time by allowing the autoshutoff conditions to occur sooner.

In either case, if you reduce the **maximum convolution time window** it is worth monitoring the result “convolution_time_window” to be sure you understand which of the above situations you are in, and what the impact on performance and accuracy may be.

## Advanced method to improve performance

You should use frequency dependent source profiles if you are working with linear systems and can write the field profile as

\( \vec{E}_{source} (x,y,z_0,\omega) = \vec{E}_{simple}(x,y,z_0,\omega) g(\omega) \)

\( \vec{H}_{source} (x,y,z_0,\omega) = \vec{H}_{simple}(x,y,z_0,\omega) g(\omega) \)

where \(g(\omega)\) has complicated frequency dependence and the frequency dependence of \( \vec{E}_{simple} (x,y,z_0,\omega) \) and \( \vec{H}_{simple} (x,y,z_0,\omega) \) has very little frequency dependence (in amplitude and phase) but enough that it cannot be ignored entirely. In this case, use \( \vec{E}_{simple} (x,y,z_0,\omega) \) and \( \vec{H}_{simple} (x,y,z_0,\omega) \) as the frequency dependent source profile. Then, AFTER the FDTD simulation, multiply the \(\vec{E}\) and \(\vec{H}\) fields collected by frequency domain monitors by \(g(\omega)\). This can greatly reduce the duration of the convolution time window as well as the total simulation time until the autoshutoff conditions are met, while giving the same results.

## Examples

### Frequency dependent beam profile example

As discussed above, when the frequency dependent profile calculation is disabled, the beam profile is calculated only for the center frequency. Enabling this option then makes the beam profile frequency dependent and allows for more physically accurate broadband simulation. The images below demonstrates how much the beam profile changes with wavelength from 400nm to 1000nm for a filled thin lens beam with NA=0.6:

### Broadband injection angles example

As discussed above, another type of simulation that can greatly benefit from the frequency dependent profiles are broadband simulations with angled injection of beams. The figure below shows a comparison of a beam that is injected at a nominal angle theta=45 degrees over a range of wavelengths from 400nm to 700nm. With frequency dependent beam profiles, the source injects light under a constant angle of 45 degrees, however, when the feature is disabled the injection angle ranges from 34 degrees at 400nm to almost 80 degrees at 700nm.

The following example is using a 2D field monitor to demonstrate the propagation of a Gaussian beam injected at an angle and interacting with a dielectric/air interface. The plots below show how the frequency dependent profile calculation can benefit the reflection/transmission simulations since the R/T characteristics are highly dependent on the angle of incidence. See the associated files to run this example on your computer. This example also demonstrates that the frequency dependent profile calculation has negligible simulation time penalty in 2D mode despite the fact that the **number of field profile samples** is set to 125. In 3D such a large number of field profile samples can have a more significant computational cost.

### See also

Plane waves - Angled injection, Beam source, BFAST, Understanding frequency domain CW normalization