Ansys Insight: Diverging Simulations

shkimshkim Ansys Employee Posts: 15
edited March 12 in Photonics

This page describes how to fix diverging simulations. Most diverging simulations are detected by the auto shut-off feature, which displays the message "ERROR: Early termination of simulation, the electromagnetic fields are diverging." when the overall field strength rises above a threshold value. Most diverging simulations fall into one of two categories. Either the simulation is diverging due to a dt stability factor problem, or a PML boundary condition problem.

It is easy to determine the type of instability by setting all of the simulation boundary conditions to Metal, then re-running the simulation.

  • If the simulation still diverges, it is a dt stability factor type of divergence.
  • If the simulation is stable, it is a PML type of divergence.

Divergence related to the dt stability factor

The theoretical maximum time step is calculated from the simulation mesh size based on the Courant stability criterion. By default, Lumerical software uses a time step that is 0.99 of the theoretical maximum time step. This theoretical maximum is calculated assuming the propagation of light in a homogeneous vacuum. Once physical structures and interfaces are included in the simulation, particularly when dispersive materials are involved, a smaller time step is sometimes required.

To resolve this type of divergence, reduce the dt stability factor until the simulation is stable. In many cases, a value of 0.95 or 0.9 will make the simulation stable. In other cases, a value of 0.5 or smaller may be required. Reducing the time step does not affect the accuracy or memory requirements of the simulation, but does increase the simulation time. Changing dt from 0.99 to 0.95 will increase the simulation time by 4%. This parameter can be accessed on the Mesh Settings tab of the Simulation region properties.

NOTE: Causes of dt stability factor type divergence

  • Material properties: Some dispersive material models can cause the simulation to be slightly unstable. If you discover that one of your materials causes the simulation to be unstable, use the Material explorer to ensure that the material properties are what you expect. In some cases, the automatic data fitting routine will create fits that are not very good. In this case, you should adjust the fit parameters to obtain a better fit. See this link for more details: Modify material fit. If the fit is good, then reduce the dt stability factor to make the simulation stable.
  • Mesh aspect ratio: A large mesh aspect ratio can cause the simulation to be unstable. If dx = 5nm and dy = 25nm, the aspect ratio is 5. In principle, there is nothing wrong with having a large aspect ratio, but in practice, it can be slightly unstable when dt is near the maximum theoretical limit.

PML and dispersive materials

Generally, we recommend that physical structures be extended through the boundary condition (BC) region. This gives the most accurate simulation results. Unfortunately, some dispersive materials can be unstable when extended through PML BCs. The fields will begin to diverge at the point where the dispersive material touches the PML BC. This is easy to see with a movie monitor.

The steps to take in order to fix a PML divergence depend on the PML implementation that is being used. Stretched Coordinate PML (SCPML) is recommended, but if you are using an older version of the software prior to the 2015a release, only the Uniaxial PML (UPML) type is available.

1. SCPML

One or more of the following changes should make the simulation stable if you are using SCPML:

  • Set PML profile to stabilized: Changing this setting alone typically solves the divergence problem. The alpha setting and number of PML layers are increased in the stabilized PML profile compared to the standard profile.
  • Increase alpha: Setting the PML profile to “Custom” allows you to set the alpha parameter. Increasing the value of alpha can make the simulation stable, but it can result in increased reflections, so increasing the number of PML layers is also recommended.
  • Increase the mesh size immediately before the PML: Adding a mesh override region to increase the size of the mesh step (in the direction normal to the PML surface) can make the PML more stable. This can affect the performance of the PML as there can be small reflections from the grading of the mesh itself.
  • Do not extend the metal layer through the PML: Reflections from the PML are minimized when structures are extended completely through the PML. However, if this causes the simulation to diverge, the only solution may be to stop this layer at the inside edge of the PML. This may cause higher reflections from the PML, but will make the simulation stable. Please note that by default structures that terminate at the PML are automatically extended through the PML. You must terminate the structure at least 1 dx from the PML, or disable the feature “extend structure through the pml” in the Advanced Options of the simulation region.

2. Legacy UPML Settings (Prior to 2015a release)

One or more of the following changes should make the simulation stable if you are using UPML:

  • Reduce PML sigma: This setting can be accessed in the Advanced tab of the Simulation region. When you reduce PML sigma, the absorption of the PML is reduced but the number of PML layers used will be automatically increased to compensate (until the number of layers exceeds the maximum number you have allowed). This means that the PML performance will not be affected, but your simulation will take more time and memory due to the increased number of PML layers.
  • Increase PML kappa: This setting can be accessed in the Advanced tab of the Simulation region. The default value is 2. Try increasing kappa to 10 or even 20. Very often this will stop the divergence. Increasing kappa has a very small effect on the rest of your simulation. A larger kappa will cause slightly more reflections from the PML at normal incidence, but will actually cause slightly less reflection at steeper angles. Values of kappa much larger than 20 can cause more significant degradation of the PML performance.
  • Increase the mesh size immediately before the PML: Adding a mesh override region to increase the size of the mesh step (in the direction normal to the PML surface) can make the PML more stable. This can affect the performance of the PML as there can be small reflections from the grading of the mesh itself.
  • Set Type of PML to Stabilized: This setting can be accessed in the Advanced tab of the Simulation region. This can degrade the performance of the PML at steeper angles of incidence.
  • Do not extend the metal layer through the PML: Reflections from the PML are minimized when structures are extended completely through the PML. However, if this causes the simulation to diverge, the only solution may be to stop this layer at the inside edge of the PML. This may cause higher reflections from the PML, but will make the simulation stable. Please note that by default structures that terminate at the PML are automatically extended through the PML. You must terminate the structure at least 1 dx from the PML, or disable the feature “extend structure through the pml” in the Advanced Options of the simulation region.

Comments

  • shkimshkim Posts: 71Ansys Employee
    edited March 12

    Other diverging situations

    1. Material fits with unphysical gain

    Occasionally, the fitting routine will generate fits with gain, even though the experimental material data does not have any gain. This will cause a simulation to diverge even if the frequency at which the fit has gain is well outside of the simulation region.

    To check if this is the case: open the material editor, select show extended-spectrum and fit and plot the index. If Im(index) is negative at some point then there will be a small region of gain. This problem can be solved either by slightly varying the simulation bandwidth or by changing the fit tolerance and maximum coefficient variables.

    2. Incorrect simulation setup

    Injecting a source with incompatible simulation region settings such as injecting a plane wave source with PML boundaries at the sides of the source can also cause a simulation to diverge.

    Automatic divergence checking

    Lumerical software has an automatic divergence checking feature. If the total energy in the simulation volume is many times larger than the injected energy, the simulation will be stopped. The following graphical warning shown will appear in the Job Manager and Object tree when a diverging simulation is detected.

    The automatic divergence checking feature properties are found in the Advanced tab of the Simulation region properties.

    Time and movie monitors can be helpful when debugging diverging simulations. Both will show the fields growing exponentially at some point. Simulations that suddenly become very slow (for example, the time remaining estimate increasing from 5 minutes to 1 hour) is another sign of divergence. The automatic divergence checking normally stops the simulation before the simulation becomes very slow.

  • liuliu Posts: 2Member

    Sometime the autoshutoff level will increase to larger than 1 and then decrease. Is this okay for the simulation?

  • shkimshkim Posts: 71Ansys Employee
    edited August 13

    The auto-shutoff level can occasionally go over 1. As long as the simulation terminates by reaching the specified "auto shutoff min" value, there is nothing to worry about.

Sign In or Register to comment.