I have been working on using a non-linearly squares algorithm to approximate device properties using devsim. Currently, I am running the diode program with ten parameters: n_i, mu_n, mu_p, T, n1, p1, taun, taup, acceptors, and donors. I first run the diode program with a set of default parameters to obtain a set of experimental data. These default parameters are the original parameters set in the diode example, e.g., n_i = 1e10, mu_n = 400, mu_p = 200, etc. The diode program is then given an inital guess of parameters to obtain a set of simulated data that has been fitted to the experimental data using the scipy.optimize.least_squares() algorithm in python. So far I’ve been running my program with an initial guess of parameters that are equivalent to the default parameters, so the data should already be fitted.
The problem I’ve been running into is that the 1D diode example, when running with the default parameters, sometimes gives me a “devsim_py3.error: Convergence failure!” This does not occur every time the program is run, but it does occur often. My code stores the results of the diode program (the values of the permittivity and other node models and edge models at each point on the mesh) after each execution of the program, so when a convergence failure occurs, the result is a 0-d array. This 0-d array causes errors when iterating over arrays – and while this error can be avoided using a “while True” loop to run the diode program over and over until the diode program returns an array whose dimension is greater than zero – such a workaround can greatly increase runtime since the convergence failure occurs so often.
So my question is, why does the convergence failure occur and how do I fix it? Here is a screenshot of my terminal output of the error:
(This output was generated by running the original 1-d diode example using the code shown in the documentation)