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:
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 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:
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.
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.
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!