Solvers and convergence#
Note
The legacy solver (use_accelerated_solver=False) will be removed in a
future version of Tidy3D. We recommend switching to the accelerated solver,
the default. See Migrating from the legacy solver.
Tolerances and iteration settings of the charge solver. |
Charge simulations run on the accelerated solver by default
(HeatChargeSimulation.use_accelerated_solver=True). Setting
use_accelerated_solver=False selects the legacy solver. Only charge
simulations accept it. Heat and conduction simulations always run on the
accelerated solver. Many models, boundary conditions and outputs exist only on
the accelerated solver. They are listed in
Accelerated-only features below.
Tolerances#
ChargeToleranceSpec.rel_tol bounds the normalized residual of the Poisson,
electron and hole equations and is the only convergence criterion. Keep it at
the default 1e-10 or tighter. A looser value lets the solver stop early and
report a converged but inaccurate solution, so loosening it is never a fix for a
run that does not converge. A value looser than the default emits a warning.
abs_tol is used only by the legacy solver.
A terminal current is computed from the converged solution, so its error
follows rel_tol. Currents that are many orders of magnitude below the
typical currents of the device, such as leakage, dark currents or currents near
zero bias, need a tighter value such as 1e-12 or 1e-13. To check a
result, run it again with rel_tol two orders of magnitude smaller. A
quantity that changes was not converged.
Bias sweeps#
On the accelerated solver the first solve raises every contact held at a single
voltage from 0 V to that voltage, in steps of at most
SteadyChargeDCAnalysis.convergence_dv (default 1 V). A simulation with a
single voltage is approached in these steps too.
A voltage sweep always starts from the 0 V solution. Positive voltages are
solved in increasing order, then negative voltages in order of increasing
magnitude, again starting from 0 V. Where two consecutive points are more than
convergence_dv apart, intermediate points are inserted, including between
0 V and the first requested voltage. A voltage sweep may also solve an extra
1 mV step before a point. Only the requested voltages appear in the output.
Current sweeps on a CurrentBC do not insert intermediate points.
The legacy solver ramps every requested bias from 0 V in steps of
convergence_dv.
Linear solver#
Each nonlinear iteration solves a linear system. HeatChargeSimulation.linear_solver
selects how:
'direct'factorizes the matrix. It is the default of a charge simulation on the accelerated solver. It converges most reliably, because the linear solve cannot stall the nonlinear iterations. It uses considerably more memory than the iterative solver, increasingly so on large meshes.'iterative'solves the system approximately and uses less memory.linear_rel_tol,max_itersandpreconditioner_iterationsinChargeToleranceSpecconfigure it.
The memory a run needs is estimated from its mesh. A simulation that is too
large to run is rejected with an error after meshing, before the solve starts.
Where the run would fit with the iterative solver, the error suggests
linear_solver='iterative'. Otherwise reduce the mesh size, with coarser mesh
settings or a smaller simulation domain.
A small-signal analysis solves its system with the same choice. With
'direct', a small-signal analysis whose factorization does not fit in the
memory of the run is skipped with a warning. The simulation then returns its DC
results and sets DeviceCharacteristics.ac_analysis_skipped. The iterative
small-signal solve fails with an error on two kinds of simulation that the
direct one solves: a doped region that reaches no contact, such as a floating
base, at low frequencies, and a device biased where its differential mobility
is negative.
The legacy solver always solves directly and ignores linear_solver.
Parameters#
The defaults converge most problems. These are the settings worth changing, with the field defaults:
rel_tol(ChargeToleranceSpec,1e-10): see Tolerances above.convergence_dv(SteadyChargeDCAnalysis,1V): the largest bias step, see Bias sweeps above. A smaller value makes each step easier to solve and adds solves.max_pseudo_steps(ChargeToleranceSpec,60): the maximum number of nonlinear iterations at each bias point.linear_rel_tol(ChargeToleranceSpec,1e-2): the factor by which the iterative linear solver reduces the linear residual at each nonlinear iteration. A smaller value makes each nonlinear iteration more accurate and more expensive.max_iters(ChargeToleranceSpec,120) andpreconditioner_iterations(50): the iteration limits of the iterative linear solver at each nonlinear iteration. They do not limit the nonlinear iterations.
linear_rel_tol, max_iters and preconditioner_iterations configure
the iterative linear solver of the DC solve. They have no effect with the direct
linear solver, the default, and a non-default value then emits a warning.
The remaining fields control the pseudo-time damping of the nonlinear
iterations and the start-up of the solve. Leave them at their defaults.
cfl_number (1e9) is the upper bound of the damping parameter and
cfl_min (None, meaning 1) its lower bound. Do not set
cfl_number below its default. ramp_up_iters (1) introduces the
doping in several steps at the start of the solve. Values above 1
generally make convergence worse.
A non-default max_pseudo_steps, cfl_number, cfl_min or
preconditioner_iterations emits a warning about runtime and convergence.
The warning is expected when you change them on purpose.
Troubleshooting#
When a run on the accelerated solver ends with a non-convergence warning, work through these steps in order.
Read the convergence history in
sim_data.device_characteristics.dc_convergence(SteadyConvergenceData):conv = sim_data.device_characteristics.dc_convergence conv.converged, conv.n_iters, conv.residual_history, conv.cfl_history
residual_historyholds the residual of each equation at each nonlinear iteration and bias point. The Poisson, electron and hole residuals are on the same scale asrel_tol. It shows whether the residual was still decreasing when the iteration limit was reached, or had stopped decreasing above the tolerance.cfl_historyholds the damping parameter. If it ended at its lower bound, the solver was damping the iterations as much as it is allowed to. If it ended at its upper bound, damping was not what limited convergence. The non-convergence warning names the bound when the trace ends on one.If the residual was still decreasing at the last iteration, raise
max_pseudo_steps.If the residual oscillates or stagnates with
linear_solver='iterative', the linear solve is often not accurate enough. Lowerlinear_rel_tolto1e-4or1e-6, or raisemax_itersorpreconditioner_iterations. This matters most where one equation’s residual stays orders of magnitude below the others, as in undoped regions, heterojunctions, oxides and degenerately doped junctions with band-to-band tunneling. Returning to the direct solver, the default, is the alternative when memory allows.If a high-bias point fails, lower
convergence_dv, so that the solver approaches it in smaller steps. This applies to a single voltage too.If the residual still stagnates, check the setup. The usual causes are a mesh that does not resolve junctions, heterointerfaces or contact edges, and a doping profile that changes faster than the mesh can follow.
Migrating from the legacy solver#
A ChargeToleranceSpec tuned for the legacy solver does not carry over. In
most cases td.ChargeToleranceSpec() is the right starting point.
Set
rel_tolback to the default1e-10. A legacy value such as1e-5is met almost immediately on the accelerated solver and returns an unconverged result.Remove
abs_tol. The accelerated solver does not use it.Remove
ramp_up_itersand any reducedconvergence_dvchosen for the legacy solver. Start from the defaults, and lowerconvergence_dvonly if a high-bias point fails.
Results can also differ because the accelerated solver honors settings that the
legacy solver ignores, such as SemiconductorMedium.electron_affinity. See
Other differences on the legacy solver.
Accelerated-only features#
The legacy solver does not support the features below, and new features are
added to the accelerated solver only. Except where noted, a simulation that uses
one of them together with use_accelerated_solver=False is rejected with an
error that names the feature.
Semiconductor models:
MasettiMobilityandAlloyMobility.CanaliFieldDependenceandTransferredElectronFieldDependence, attached to any mobility model throughfield_dependence.LombardiSurfaceDependence.PalankovskiQuayApproxCarrierLifetime.HurkxTrapAssistedTunneling, set throughfield_enhancement.SelberherrImpactIonizationwithformulation="GradQuasiFermi".Incomplete ionization, set through
SemiconductorMedium.donor_ionizationandacceptor_ionization.AnisotropicPermittivity.DualValleyEffectiveDOS. It is not rejected when the simulation is created, and the legacy solver fails on it.Protected doping,
ProtectedDopingRef. It is rejected when the simulation is uploaded.Heterojunctions. The legacy solver sets
electron_affinityto 0 eV with a warning, ignores the Richardson constants and treats every interface between semiconductors as continuous.
As a result, none of the semiconductors of the charge material library runs on the legacy solver.
Contacts and boundary conditions:
CurrentBC.Schottky contacts,
model="schottky_mott".A
VoltageBCwith a face on an insulator, such as a gate.A swept or small-signal terminal placed through several
boundary_specentries.SurfaceRecombinationBC, with any recombination model.
Analyses and solver settings:
A prescribed lattice temperature field,
SteadyChargeDCAnalysis.temperature.at_voltagesof a small-signal analysis.Heat and conduction simulations, which always run on the accelerated solver.
In a charge simulation that solves the lattice temperature: temperature-dependent thermal conductivity or heat capacity,
SolidMedium.velocity,AnisotropicConductivity,ThermalContactResistance,RadiationBCandConvectionBCwith a positiveemissivity.
Monitors and outputs:
SteadyChargeResidualMonitor,SteadyGenerationRecombinationMonitor,SteadyDopingMonitorandSelfHeatingMonitor.The legacy solver does not return
DeviceCharacteristics.dc_convergence,ac_admittance_voltage,ac_capacitance_voltageorac_photocurrent_voltage.
Other differences on the legacy solver#
The legacy solver also differs from the accelerated solver in these ways:
rel_tolandabs_tolare the relative and absolute tolerances of the nonlinear solve. Typical values are around1e-5forrel_toland1e7to1e8forabs_tol.max_iterslimits the nonlinear iterations, andmax_pseudo_steps,cfl_number,cfl_min,preconditioner_iterations,linear_rel_tolandlinear_solverare not used.convergence_dvhas the meaning given under Bias sweeps above.Each bias point is solved separately, starting from the 0 V solution. A bias point that fails returns NaN values instead of an error. The 0 V point is always included in the device characteristics.
A small-signal analysis runs at 0 V and at every voltage of the DC sweep.
SlotboomBandGapNarrowingapplies no narrowing belown2and ignoresmin_N. It is not converted under Fermi-Dirac statistics.SelberherrImpactIonizationwith"Selberherr"or"PQ"is driven by the electric field instead of the gradient of the conduction band edge. The two differ where the band-gap narrowing varies.Only the last of several
DistributedGenerationentries in one medium’sRis used.Without a
GroundVoltage, all voltages are shifted so that the smallest single-valued source voltage becomes 0 V.The device capacitances leave out bias points where the potential difference between the two contacts has the opposite sign to its 0 V value, such as forward bias beyond the built-in potential.
A metal without a charge boundary condition is a region with zero normal current and does not join the terminal of a metal it touches.
When the lattice temperature is solved, conductors take no part in the heat solve and heat sources are ignored.
With
symmetry, the device characteristics cover only the simulated part of the device.The mesh is limited to one million nodes.