# Understanding injection angles in broadband simulations

This page describes how to set up a simulation with a plane wave source injected at an angle. Issues that arise when using angled injection sources, including PML reflections, wavelength dependence of the injection angle, and other errors are also discussed. Even though only the plane wave source is discussed here, the same issues arise with all the sources including the mode source.

Note that the wavelength dependence issue can be avoided by using BFAST or multifrequency beam calculation for beam source and diffracting plane wave source.

## Simulation setup

### Source

To set a non-zero injection angle for a plane wave source, edit the source object. In the GENERAL tab of the edit source window, set ANGLE THETA and/or ANGLE PHI (Angle Theta alone for 2D, both for 3D, if needed).

ANGLE THETA sets the angle with respect to the injection axis. In this example, the injection axis is the z-axis and the XZ view is shown below.

This angle of injection is then rotated around the injection axis by ANGLE PHI in a right-hand context. The XY view in the image below shows phi in our example.

### Boundary conditions

Bloch boundary conditions are required when using a plane wave source injected at an angle. Bloch boundary conditions are similar to periodic boundary conditions, but they take into account a phase change across each period. Information about setting up Bloch boundary conditions can be found on the Bloch boundary conditions page.

However, when BFAST source technique is used, the boundary conditions set by the users in the plane of oblique incidence will be overridden by BFAST's own built_in boundary conditions.

## PML reflections

When injecting at steep angles, light will strike the PML boundaries at grazing angles. PML boundaries are optimized to absorb light at normal incidence. At grazing angles of incidence, large PML reflections can decrease the accuracy of the simulation results. Increasing the number of PML layers will reduce reflections.

Steeper injection angles require more PML layers. In the multi-layer stack calculation example, the model setup script is used to set the minimum number of PML layers used based on the angle of injection of the source.

## Broadband injection angles

When a non-zero injection angle is set for Bloch/periodic plane wave source type, the actual angle of injected in the simulation varies as a function of frequency in broadband simulations. To get the actual angle injected at any particular wavelength, you can use the getsourceangle function, or edit the source to see a plot of theta versus wavelength in the GENERAL tab.

### Background

Bloch/periodic plane wave source injects fields that have a constant in-plane wavevector at all frequencies. The following figure shows a source with a nominal injection angle of approximately 45 degrees (purple arrow). The in plane wave vector (dotted green line) is chosen such that the actual injection angle at the center frequency fsim of the simulation matches the nominal injection angle. Since the magnitude of the wavevector is proportional to frequency, the actual injection angle will change as a function of frequency. Higher frequencies will be injected at smaller angles, while lower frequencies will be injected at larger angles.

The in-plane wavevector is calculated with the following formula.

$$ k_{in\_plane} = k_{sim} sin(\theta_{sim}) $$

where

$$ k_{sim} = 2\pi\frac{f_{sim}}{c} $$

and qsim is the nominal injection angle, fsim is the center frequency of the source, n is the refractive index and c is the speed of light.

Since the magnitude of the wavevector is a function of frequency, while the in-plane component is fixed, the injection angle must change as a function of frequency. The angular dependence can be calculated with the following formula:

$$sin[\theta(f)] = \frac{k_{in-plane}}{k(f)} = \frac{sin(\theta_{sim}) f_{sim}}{f}$$

$$ \theta(f) = asin[\frac{sin(\theta_{sim})f_{sim}}{f}]$$

Therefore, while broadband sources can inject at angles, it must be recognized that the injection angle will change as a function of frequency. At close to normal incidence, the change in angles is smaller than at steeper angles. A source injecting light at 450 to 550 nm with a 5 degrees nominal incidence angle will actually inject at angles between 4.5 and 5.5 degrees. If the nominal angle is increased to 25 degrees, the range of angles will be between 23 and 28 degrees.

The getsourceangle function can be used to get the actual injection angle as a function of frequency. This data is also displayed in the GENERAL tab of the Plane wave and Gaussian sources.

## Injection angle example

In usr_broadband_injection_angles.fsp, the source injection angle is 30 degrees, and the frequency range is 100 to 150 THz (2-3um).

Run the simulation, then run associated script. The script first calculates the actual injection angle vs frequency with the getsourceangle function.

Notice that the injection angle changes as a function of frequency. At low frequencies, the injection angle is almost 40 degrees. At high frequencies, the angle is about 25 degrees.

Next, the script plots the fields profile at 100 and 150 THz. Both figures are from the SAME simulation. The actual propagation direction is obviously different.

Field profile at 100THz. Angle is about 40 degrees. |
Field profile at 150THz. Angle is about 25 degrees. |

Note: What to do If you encounter broadband injection angle error in your simulation, there are two options you can choose from to avoid this problem: you can run a series of narrowband simulations or run a series of single frequency simulations. When using a series of narrowband simulations, you need to again check to make sure that the angle deviance is at an acceptable level. If not, you would have to use a series of single frequency simulations to obtain accurate results. When running these series of simulations, a feature that is very helpful is the parameter sweep. BFAST can avoid this problem due to its special formulation, please refer BFAST page. |

Note: Bloch vector with Bloch boundary conditions When using bloch boundary conditions, the bloch vector should be set to kSIM. The Bloch BC option "set based on source angle" automatically sets the correct Bloch vector. |

Note: Angle going past 90 degrees When the center angle is going past 90 degrees, the source in an attempt to inject angle above 90 degrees injects evanescent fields. And this behavior is not desirable, and simply state, the source is not able to inject above 90 degrees. When the center angle is large and/or when the source is more broadband, this issue is more likely to occur. In such situations, it is usually necessary to reduce the center angle or source wavelength range. |

In order to get broadband results at a certain source angle, a parameter sweep task can be set up to run a series of single frequency simulations sweeping over the frequency range of interest. A guide to setting up parameter sweeps is available at the Parameter sweep tasks page.

To get the broadband results over a range of injection angles, a nested sweep can be set up to sweep over the range of injection angles and source frequencies. The Nested sweeps page provides a tutorial.

Additionally, this issue can be avoided by using BFAST instead of Bloch/periodic plane wave source.

## Injection errors

In broadband simulations with angled injection sources, there can be large injection errors at frequencies outside of the center frequency. This can lead to errors if you use the transmission through a monitor placed behind the source to measure reflected power. The alternative technique of using a monitor placed in front of the source is described on the Measuring reflection page.

## Advanced

### Longer source pulse

A longer source pulse can be used in the case where you are running a broadband simulation and injecting at a steep angles where wavelengths beyond a certain threshold are injected at 90 degrees. In the following image you can see that for this particular source setup, the wavelengths above approximately 0.8um will be injected at 90 degrees.

When light is injected at 90 degrees, it propagates across the simulation interfering constructively with itself. At these wavelengths, there can be a large field intensity because the light does not propagate out of the simulation region. The Fourier transform of the time signal will have a large peak corresponding to the wavelengths injected at 90 degrees, and the sidelobes of this peak can create noise at wavelengths of interest.

By default, FDTD uses the shortest possible source pulses in the time domain, which means they have a much broader spectral content than the specified source wavelength range. A longer source pulse will have narrower spectral content, and it is possible to increase the length of the source pulse until spectrum of the source pulse does not include the wavelengths that are injected at 90 degrees.

The spectrum vs wavelength is plot for the default source pulse. A significant amount of power is injected at wavelengths above 0.8um. |

The spectrum for a source pulse where the pulselength and offset have been increased to 10 times the default values. The power at wavelengths above 0.8um are reduced. |

### Interpolation

Another method for getting broadband results over a range of injection angles is discussed in Bloch BCs in broadband sweeps over angle of incidence. This method uses broadband simulations and runs one parameter sweep over a range of injection angles. This requires fewer simulations than the nested sweep method, but involves more post-processing to interpolate the data to a common source angle vector.

Since BFAST source fixes the incident angle for all the frequencies set in the source, the above interpolation is not necessary, as one simulation can give broadband results at the given angle. When users want to get broadband results at many different incident angles, a sweep of incident angles can be used. No interpolation will be needed since the sweep can give broadband results as a function of incident angles.