Nonlinear simulations can be substantially more complicated to setup, analyze and to ensure convergence, compared to a similar linear simulation. This page describes a number of additional issues and advanced features that should be considered when doing nonlinear simulations.
Sources
Custom spectrum and time signal
For linear simulations, the precise shape of the source pulse used to excite the system is usually not important. Therefore, most users simply specify the minimum and maximum wavelength of interest and let the software automatically determine the optimal pulse shape. For many nonlinear applications, the precise pulse shape is very important. For instructions on creating a custom time signal, see the custom time signal and custom spectrum pages.
Source amplitude
For linear systems, the source amplitude used in the simulation is not important. For nonlinear simulations, it is often necessary to adjust the source amplitude to the appropriate value required to create the desired nonlinear effects. The source amplitude (units of V/m) can be setup in the General properties tab of each source. Note that a large source amplitude may affect the numerical stability in some cases for simplified material models. For simulations that require large field amplitudes, a more complex model, such as the Four-level Two-electron, may be required.
How does a large source amplitude cause numerical instability?
For small field amplitudes, the polarization can be expanded as a Taylor series of the electric field as
$$P = \epsilon_{0}E(\chi ^{(1)}+\chi ^{(2)}E+\chi ^{(3)}E^2+...) $$
For FDTD to be stable, and indeed for the Taylor expansion to be valid, the nonlinear terms have to be small compared to the linear terms. In other words, we must have,
$$ \chi ^{(2)}E \ll \chi^{(1)} $$
and
$$ \chi^{(3)} E^2 \ll \chi^{(1)} $$
If the non-linear terms become too large, the system can be numerically unstable for a simplified model, such as the Chi3/Chi2 material model. For example, If the source amplitude is E ~ 1e9 and chi3 ~ 5e-18 then χ(3)E2 ~ 5 while the linear χ(1) is likely on the order of 1. This is too large a perturbation for a simplified model. By reducing the source amplitude, E, to 1e7, we can ensure that χ(3)E2 ~ 5e-4 which is much less than χ(1).
Materials
Material fits
Default material fits are generated based on the source wavelength range. If it is important to accurately model the material properties outside the source wavelength, use the Advanced options of the Material Explorer to set a custom wavelength range for the material fitting algorithm.
Material explorer with plugin materials
The Material Explorer, which is used for viewing and modifying material fits, cannot be used to view the material properties of any plugin materials.
Creating custom material models
It is possible to create custom material models using the plugin material framework. For more information on this advanced feature, see the user-defined models page.
Monitors
Recording data outside the source spectrum
By default, frequency monitors record data within the source wavelength range. However, in some nonlinear applications, such as frequency doubling, you may wish to collect data at frequencies outside of the source spectrum. To do so, disable the 'use source limits' property of the frequency monitors and manually specify the frequencies of interest.
Note : when collecting data outside the source spectrum, you may need to disable the CW normalization. |
Sampling rate
It may be necessary to adjust the sampling rate of time or frequency monitors. The monitor sampling rate is automatically calculated to ensure aliasing does not occur, but high frequency components that may be generated via a nonlinear process will not be included in the sample rate calculation. This can lead to under-sampling and aliasing problems. The sampling rate can be adjusted in the Advanced options tab of the monitors.
Reducing simulation memory
Nonlinear simulations often require the use of 1D or 2D time domain monitors, as well as large DFT monitors. In this case, it is useful to consider using time or spatial downsampling to keep the amount of simulation memory under control. In addition, you may want to remove the field data that are not necessary under the Data to record tab.
Frequency monitors
Frequency monitors obtain their data using a fourier transform of the time domain EM fields. This data is can be very useful in non-linear simulations, but some caution is required. Interpreting this data to be the CW steady-state response of the system is only strictly correct for a linear system.
The apodization feature can be useful to control the portion of the time domain fields that are included in the fourier transform.
Measuring power transmission
To measure the amount of power transmitted through a monitor, we typically use the transmission script function, or the 'T' result that is automatically output by frequency monitors. Unfortunately, this result will not be meaningful in many nonlinear simulations. The problem is that the function automatically normalizes the transmitted power to the power injected by the source. For many nonlinear simulations, the source does not inject any power at the frequency of interest (eg: in 2nd harmonic generation the system is excited at one wavelength, but emits at a different wavelength). This leads to a 'divide by zero' error, since the sourcepower will be zero (or very close to zero) at the frequency of interest. In such cases, it may be necessary to manually integrate the poynting vector to calculate the transmitted power.
More resources:
Example script code to calculate transmitted power without source power normalization
# disable CW norm nonorm; # get poynting vector from monitor. Poynting = getresult("monitor","P"); # integrate real Pz to get power. Assume this monitor is 2D, in the XY plane # This quantity will have units of Watts/Hz^2 due to the use of the nonorm state Trans = 0.5 * integrate(real(Poynting.Pz),1:2,Poynting.x,Poynting.y); # package data into dataset T = matrixdataset("T"); # initialize dataset T.addparameter("lambda",c/Poynting.f,"f",Poynting.f); # add frequency parameter T.addattribute("T",Trans); # add transmission attribute # optionally, visualize data visualize(T);
Frequency monitors obtain their data using a fourier transform of the time domain EM fields. This data is can be very useful in non-linear simulations, but some caution is required. Interpreting this data to be the CW steady-state response of the system is only strictly correct for a linear system.
The apodization feature can be useful to control the portion of the time domain fields that are included in the fourier transform.
Simulation region and mesh setup
Simulation bandwidth override
Under the "Advanced options" tab of the FDTD or Propagator simulation region, there is a "set simulation bandwidth" option that will automatically:
- Fit all relevant materials over the specified bandwidth
- Generate the simulation mesh for all the relevant wavelengths
- Set the appropriate time downsampling for monitors
Simulation bandwidth override.
Mesh setup
The automatic non-uniform meshing algorithm attempts to generate the simulation mesh based on a number of inputs, including the source frequency range and materials properties. However, it will not consider any higher frequency components that may be generated via nonlinear processes. If such high frequency components will exist, it may be necessary to use mesh override regions to force a more appropriate mesh size. The 'override simulation bandwidth for mesh generation' option, in the advanced options tab of the simulation region may also be helpful.
For the purposes of mesh generation, all plugin materials are considered to have the same refractive index as their 'Base material' (or an index of 1 if no base material is specified). Again, it may be necessary to use mesh override regions to force a more appropriate mesh size.
By default, the Conformal meshing algorithm is not applied to plugin materials. This means that any interface involving at least one plugin material will revert to using the staircasing method, regardless of which mesh refinement method was chosen. In the material database, there is an option to "revert to base material for conformal mesh cells" for plugin materials, this allows the user to use conformal mesh cells from the base material. For more information, see mesh refinement options.
Tip: For all simulations, we strongly recommended using a large mesh size for your initial simulations. The large mesh size makes the simulation run quickly, allowing you to iterate and improve the simulation setup in a short amount of time. Once the simulation is setup properly and giving the expected results, you can make the mesh smaller and do other convergence testing to ensure the final result is as accurate as possible.
Revert to base material for conformal mesh cells.
Bloch boundary conditions
Careful consideration is required when attempting to use Bloch boundary conditions for nonlinear simulations. One potential issue is the use of complex fields in the time domain, rather than only real valued fields. Another potential issue relates to the way Bloch boundaries apply a fixed phase correction to the fields, as described on the Broadband injection angles page. To discuss these issues further, please visit the Support Center and provide a detailed description of your application.
Normalization and power conservation
CW normalization
The CW normalization option is designed to normalize the frequency monitor data to provide the CW, steady state response of the system, even though a short broadband pulse was actually used to excite the system. See CW normalization for more information on this option.
This normalization inherently assumes the system is linear, making it invalid for many nonlinear simulations. The normalization state can be switched between CW normalization and No normalization in the Settings menu, or with the script commands "cwnorm" and "nonorm". In the "nonorm" state, you may want to consider using Spectral averaging to get the results in units of Watts (power) or Watts*s (energy). For more information, please see Frequency domain normalization.
Power conservation
Nonlinear effects may lead to situations where power is not converged (ie. more power is emitted from the system than was injected by the source). This does not necessarily imply that the simulation is incorrect. It is important to remember that the the simulation only includes the electromagnetic aspects of the device. In the real world, other processes can supply or remove power from the system. For example, in a laser, an electric current supplies power to pump atoms within the gain material to a high energy state. The power supplied by the electric current is not directly included in the FDTD simulation. The Stability section below may also be relevant.
Energy conservation
In some situation, with the nonorm state, user may want to consider source energy instead of power for finite amount of energy carried by a pulse. User will need to pay attention to the default time-averaged commands e.g., sourcepower. For more information or an example of energy conservation, see Parseval's Theorem.
Convergence and stability
Convergence
Convergence testing is an important part of any simulation. A common convergence test is to run the simulation with a smaller and smaller mesh, until the results converge to a constant value. For a detailed discussion, see Convergence testing. For nonlinear simulations in particular, testing convergence with respect to the simulation time step dt can be important.
Stability
As a simulation runs, the total amount of power in the simulation volume is monitored. When the power becomes very small (relative to the amount of power injected by the source), the simulation will automatically stop. If the total power becomes very large, the simulation will again stop, but with a warning message stating that the simulation has diverged and that the simulation results will not be accurate. The automatic shut-off and divergence warning threshold settings can be modified in the Advanced tab of the simulation region.
For linear simulations, the divergence warning usually means there is a numerical stability problem with the simulation, and that the results will not be accurate. Instructions to correct these types of problems can be found on the Diverging simulations page.
For nonlinear simulations, the situation is a bit more complicated. In some cases, the divergence may be caused by a numerical stability problem, just like the linear simulations. In these cases, the instructions provided on the Diverging simulations page should be used to resolve the problem. However, in other cases, it may be reasonable to expect that the total amount of power in the simulation will be larger than what was injected by the source (eg. simulations with gain). In such cases, it may be necessary to disable the divergence checking feature. Obviously, before the divergence checking is disabled, some care must be taken to confirm that the large fields are due to an expected process like gain and not a numerical stability issue.
Other tips
As with any simulation, it is important to start with a simple test case that you understand, before attempting to simulate a more complex system. Once your simple test case runs properly and gives the expected results, additional complexity can be added one step at a time, until you are able to simulate the final system. This approach may appear to be more time consuming than starting with the final design, but in practice, it is usually more efficient.