Question of solve

Dear DEVSIM developer,
I am new user of DEVSIM.
Could you give me more details about the definition of “absolute_error” and “relative_error” in solve()?
How to determine the values to make the solver converge?

# diode_1d.py
solve(type="dc", absolute_error=1e10, relative_error=1e-10, maximum_iterations=30)

#  absolute_error=1e10 is very large number

Best,
Tao

Hello @Tao ,

Thank you for your interest in the software.

Both the absolute and relative error criteria have to be met for the simulator to consider the problem converged.

If x_i is one of the solution variables at iteration i, then the absolute error is:

aerr_i = {\left| x_i - x_{i-1} \right|}

and the relative error is:

rerr_i = \frac{\left| x_i - x_{i-1} \right\|}{\left| x_{i-1} \right|+10^{-10}}

The maximum value of aerr and rerr over all of the nodes is used for the convergence test. When carrier density is one of the solution variables, then 10^{10} is not so large compared to a carrier density of 10^{20}, and would be equivalent to a relative error of 10^{-10}.

A relative error of 10^{-15} is at the limit of double precision floating point accuracy. If you use the extended precision mode of DEVSIM, a relative error approaching 10^{-30} may be achieved, depending on the problems being solved.

I have been told that the terms absolute error and relative error are not the appropriate terms for these parameters, and the phrase “update norm” would be more appropriate.

Dear @Juan ,

Thanks for your reply!
I have another question about the error. As you mentioned in your reply, the “absolute_error” “relative_error” are corresponding to carrier density. But depends on the printed log information, like

# diode_1d.py
Iteration: 6
  Device: "MyDevice"    RelError: 5.36553e-15   AbsError: 4.51984e+02
    Region: "MyRegion"  RelError: 5.36553e-15   AbsError: 4.51984e+02
      Equation: "ElectronContinuityEquation"    RelError: 1.88664e-15   AbsError: 2.77507e+02
      Equation: "HoleContinuityEquation"        RelError: 2.86939e-15   AbsError: 1.74476e+02
      Equation: "PotentialEquation"     RelError: 6.09494e-16   AbsError: 4.46912e-17
top     0.5     0.011810543175282616    0.006344611998005865    0.01815515517328848
bot     0.0     -0.012249431878576914   -0.005905798880927595   -0.01815523075950451

there are 5 types errors:

  1. from Device: “MyDevice”
  2. from Region: “MyRegion”
  3. from Equation: “ElectronContinuityEquation”
  4. from Equation: “HoleContinuityEquation”
  5. from Equation: “PotentialEquation”

Do they all need to compare with “absolute_error” “relative_error”?I find the “absolute_error” from Equation: “PotentialEquation” is small → 4.46912e-17.

And for my understanding, there are 3 variables that should be solved: \psi (potential), n (electron density), and p (hole density), but there is only one specification of “error” in solve().

Best,
Tao

Hello @Tao,

You are correct that there is only the one error specification for all of the equations. It appears that the errors from each equation are summed become the error for the region. The device errors are than the maximum error of all of the regions. The device error is compared with the errors in the solve command. I usually use a “large” absolute error specification with a “small” relative error specification. I am open to suggestions to change the solver behavior.

Thanks for your reply!