Convergence failure transient - 1D diode

Hi there!

I’m stuck and could really use some help. I’m simulating a 1D diode and I keep hitting convergence failures that I can’t figure out. I’ve scrolled through old forum threads ([2D device Convergence failure - models - DEVSIM TCAD] (2D device Convergence failure)) and tried to take into account all the advice and tips there, but no luck.

Even when I set the voltage ramp super low or even to zero, I still get the same error. It feels like there’s something fundamental I might be missing or misinterpreting.

This is my mesh:

def CreateMesh(device, region):





add_1d_mesh_line(mesh=“dio”, pos=0, ps=1e-7, tag=“top”)

add_1d_mesh_line(mesh=“dio”, pos=0.5e-4, ps=1e-9, tag=“mid”) # RLZ in der Mitte bei 0,5 um

add_1d_mesh_line(mesh=“dio”, pos=1e-4, ps=1e-7, tag=“bot”)

add_1d_contact(mesh=“dio”, name=“top”, tag=“top”, material=“metal”)

add_1d_contact(mesh=“dio”, name=“bot”, tag=“bot”, material=“metal”)

add_1d_region(mesh=“dio”, material=“Si”,

region=region, tag1=“top”, tag2=“bot”)


create_device(mesh=“dio”, device=device)

This is my doping:

def SetNetDoping(device, region, acceptor="1.0e18step(0.5e-5-x)", donor="1.0e18





CreateNodeModel(device, region, “Acceptors”, acceptor)

CreateNodeModel(device, region, “Donors”, donor)

CreateNodeModel(device, region, “NetDoping”, “Donors-Acceptors”)

This is my Code:

#This requires a circuit element to integrated current

voltage = 0.5 # Startspannung

circuit_element(name=“V1”, n1=GetContactBiasName(“top”), n2=0, value=voltage, acreal=1.0, acimag=0.0)

CreateMesh(device=device, region=region)

SetParameters(device=device, region=region)

set_parameter(device=device, region=region, name=“taun”, value=1e-12)

set_parameter(device=device, region=region, name=“taup”, value=1e-12)

SetNetDoping(device=device, region=region)

InitialSolution(device, region)

solve(type=“transient_dc”, absolute_error=1.0, relative_error=1e-10,


DriftDiffusionInitialSolution(device, region)

solve(type=“transient_dc”, absolute_error=1e12, relative_error=1e-12, maximum_iterations=3)


devsim.circuit_alter(name=“V1”, value=0.0)


devsim.solve(type=“transient_tr”, absolute_error=1.0, relative_error=1e-14, maximum_iterations=3, tdelta=1e-3, charge_error=1e-2)


Are there specific parameters or settings that are particularly critical for convergence in these simulations? Or maybe some common pitfalls I might be overlooking?

Thanks a ton for any help or insights you can provide!


Hi @Viviana

Thanks for your question. I suspect there may be a few things that could go wrong.

Are you trying to step the bias from 0 to .5 volts? To do this you would need to have your initial solution at 0 bias and then ramp the bias over several time steps.

Are you trying to step the bias from 0 to .5 volts? To do this you would need to have your initial solution at 0 bias and then ramp the bias over several time steps.

For example, start with an initial solution and then do dc ramping from 0 to .5 V.

Then over several tdelta ramp the bias from to the final voltage. For example, if you are ramping from 0 to .5 V over 1e-3 seconds. Try ramping the bias with tdelta=1e-4. Then continue the simulation for several time steps. If the tdelta is too large to capture the transient phenomena you are interested in, then reduce it to the appropriate time scale.

Also, please experiment with transient_bdf1 vs transient_tr.

I am having difficulty copying your script. If you can, please reformat the text as 1 script using the </> above instead of the block quote.

Hi @Juan

Thank you so much for your fast response. I’ve managed to pinpoint the error.

As described in Transient diode example - models - DEVSIM TCAD, we took a closer look at the file (located in examples) and understood the proper way to integrate a diode into the circuit.

Combining insights from the other four files in testing (transient_*.py ), we’ve crafted the following updated code (This can now be executed when added to examples/diode):

import devsim
from devsim.python_packages.simple_physics import *
import diode_common

def print_circuit_solution():
    for node in get_circuit_node_list():
        r = get_circuit_node_value(solution='dcop', node=node)
        print("%s\t%1.15e" % (node, r))

device = "MyDevice"
region = "MyRegion"

# Set extended parameters
set_parameter(name="extended_solver", value=True)
set_parameter(name="extended_model", value=True)
set_parameter(name="extended_equation", value=True)

#This requires a circuit element to integrated current
voltage = 0.0
circuit_element(name="V1", n1=GetContactBiasName("top"), n2=0, value=voltage, acreal=1.0, acimag=0.0)

diode_common.CreateMesh2(device=device, region=region)
diode_common.SetParameters(device=device, region=region)

#Übergeben der Werte an SetNetDoping
diode_common.SetNetDoping(device=device, region=region)

diode_common.InitialSolution(device, region, circuit_contacts="top")

# Initial DC solution
devsim.solve(type="dc", absolute_error=1.0, relative_error=1e-12, maximum_iterations=30)

diode_common.DriftDiffusionInitialSolution(device, region, circuit_contacts=["top"])

devsim.solve(type="transient_dc", absolute_error=1.0, relative_error=1e-14, maximum_iterations=30)


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

time_step = 1e-3
total_time = 1e-2
current_time = 0

while current_time < total_time:
    devsim.solve(type="transient_bdf1", absolute_error=1e10, relative_error=1e-10, maximum_iterations=30, tdelta=time_step, charge_error=1)


    current_time += time_step

The primary oversight was that we hadn’t set the charge_error, which, if I’m not mistaken, defaults to 0.0. Upon setting it to 1, the code executed without any convergence issues.
However, no current was observed, irrespective of my adjustments to the voltage jump. After setting circuit_contacts="top" and circuit_contacts=["top"] for DriftDiffusionInitialSolution and InitialSolution, we noticed the current flow.

I have a small question regarding this: Yet, when applying a positive voltage, the current appears negative. Is this an error, or is it a matter of the perspective from which we’re observing the circuit?

Best regards

Hi @Viviana

Thanks for sharing your example. That is a good catch with the charge_error. This is meant to check whether a forward projection is within a certain tolerance of the integration. Since it is a relative error, the maximum value in this error will be 1. This check is done after the solution has converged. Please make sure the value you use in your simulation is reasonable.

As of now, it is up to the user to determine the appropriate value for this parameter, as well as the time step size, and integration methods.

The negative current comes from the SPICE (circuit simulator) convention that

P = V \cdot I

is negative for a circuit element providing power, and positive for a circuit element dissipating power. The current should be fed into the circuit appropriately when solving Kirchoff’s current law at each circuit node.

If you don’t mind, I would like to include your example with the simulator distribution?

Your suggestions to improve the use of transient solver are welcome.

Hi @Juan,

Thank you for your detailed explanation. Of course you can include my example in the simulator distribution.

Regarding the negative current observation, it makes sense now that it is a matter of perspective and convention within the circuit simulation environment.

As for suggestions on improving the transient solver, I will certainly share any insights or ideas I come across as I continue to work with the simulator in this thread.

Thank you once again for your support.

1 Like