Devsim numerical accuracy issue

Hi Devsim team,

I tried to run the examples/diode/ssac_diode.py.

I added couple of lines to print the diode capacitance versus voltage (see at the bottom). no change to other lines.

The C-V curve is very noisy as shown below.

How to improve the accuracy? I tried smaller values of absolute_eror and relative_error, it leads to either no improvement or divergence.

Kejun

xx=[]

yy=[]

v=0.0

while v < 0.51:

circuit_alter(name="V1", value=v)

solve(type="dc", absolute_error=1e3, relative_error=1e-12, maximum_iterations=1000)

#TODO: get out circuit information

# PrintCurrents(device, "top")

PrintCurrents(device, "bot")

solve(type="ac", frequency=1.0)

cap=get_circuit_node_value(node="V1.I", solution="ssac_imag")/ (-2*math.pi)

print("capacitance {0} {1}".format(v, cap))

v += 0.01

xx.append(v)

yy.append(cap)

for x in get_circuit_node_list():

for y in get_circuit_solution_list():

z = get_circuit_node_value(node=x, solution=y)

print(("{0}\t{1}\t{2}".format(x, y, z)))

import matplotlib

import matplotlib.pyplot

matplotlib.pyplot.plot(xx, yy)

This is what I am getting running in windows on the original ssac_diode example:
Figure_1

with this adapted script:

xx=[]
yy=[]
v=0.0
while v < 0.51:
    circuit_alter(name="V1", value=v)
    solve(type="dc", absolute_error=1e10, relative_error=1e-10, maximum_iterations=30)
    #TODO: get out circuit information
#  PrintCurrents(device, "top")
    PrintCurrents(device, "bot")
    solve(type="ac", frequency=1.0)
    cap=get_circuit_node_value(node="V1.I", solution="ssac_imag")/ (-2*math.pi)
    print("capacitance {0} {1}".format(v, cap))
    xx.append(v)
    yy.append(cap)
    v += 0.1

for x in get_circuit_node_list():
    for y in get_circuit_solution_list():
        z = get_circuit_node_value(node=x, solution=y)
        print(("{0}\t{1}\t{2}".format(x, y, z)))

import matplotlib
import matplotlib.pyplot
matplotlib.pyplot.plot(xx, yy)
matplotlib.pyplot.show()

Please report your operating system and version of python you are using. Also it would be helpful to print this value from devsim:

>>>
print(devsim.get_parameter(name="info"))
{'copyright': 'Copyright © 2009-2023 DEVSIM LLC', 'explicit_math_load': True, 'extended_precision': True, 'license': 'Apache License, Version 2.0', 'mkl_version': 'Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications', 'superlu_version': '5.3.0', 'version': '2.3.8', 'website': 'https://devsim.org'}

Please make sure you have the Intel MKL installed. If it is not installed, it reverts to using SuperLU as the direct solver. Setting the voltage step to 0.01 in the previous script, I can reproduce the type of behavior you are seeing:
Figure_1

In Anaconda:

conda install mkl

or in a Python virtual environment.

pip install mkl

Juan,
Indeed. The problem has been resolved with mkl. Thank you very much.

Thanks @sharkjune for bringing up this issue. SuperLU is the default for Apple M1 (arm64), as the Intel MKL is not available. This warrants additional investigation.

Are these low current stability issues resolved in Windows? I’m running the basic drift-diffusion formulation for the problem (from examples) & noticed similar instabilities when the diode is in very lightly forward biased or reverse biased.

I installed the tool through pip and am running with Visual Studio Code. Is there a way to increase the precision for the basic windows install (as advised above for other systems) or do I need to reformulate the problem in terms of quasi fermi levels to avoid the error induced when two very large current terms (drift and diffusion) are subtracted from one another.

Thanks!

My info test looks as follows:

{‘copyright’: ‘Copyright © 2009-2024 DEVSIM LLC’, ‘direct_solver’: (‘mkl_pardiso’,), ‘extended_precision’: True, ‘license’: ‘Apache License, Version 2.0’, ‘math_libraries’: (‘mkl_rt.2.dll’,), ‘mkl_version’: ‘Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications’, ‘version’: ‘2.7.3’, ‘website’: ‘https://devsim.org’}

The issue related to SuperLU are gone, now that it has been replaced with UMFPACK on all platforms, when Intel MKL is not available. Near zero bias, there is going to be noise in the electron and hole currents when they are very small.

One way to improve numerical precision is to use:

devsim.set_parameter(name = "extended_solver", value=True)
devsim.set_parameter(name = "extended_model", value=True)
devsim.set_parameter(name = "extended_equation", value=True)

in your simulation script. I would also check the quality of your mesh.

I haven’t had good luck with quasi-fermi levels, but your contribution would be appreciated if you figure it out.

Hi Juan - thanks, I had given this a try but I had done so immediately prior to the “solve” command. It seems they need to be set earlier in the script to have the intended effect.

My issues with current instability were resolved by setting extended_solver, extended_model, extended_equation to true, as you suggested. Appreciate your support!

I’m glad it worked out for you