Hi everyone,
I have encoutered a problem with the build-in circuit elements and a reverse biased pn-diode. When the diode is put in reverse with the set_parameter() strategy everything works fine. But, if you are doing the same with a circuit element voltage source, the current through the source explodes. I have build a MWE based on the diode3d devsim example to reproduce the problem, executed with devsim 2.6.0 and python 3.10:
# Copyright 2013 DEVSIM LLC
#
# SPDX-License-Identifier: Apache-2.0
from devsim import *
from devsim.python_packages.simple_physics import *
import diode_common
def print_currents(device, contact):
"""
Print out contact currents
"""
ece_name = "ElectronContinuityEquation"
hce_name = "HoleContinuityEquation"
contact_bias_name = GetContactBiasName(contact)
electron_current= get_contact_current(device=device, contact=contact, equation=ece_name)
hole_current = get_contact_current(device=device, contact=contact, equation=hce_name)
total_current = electron_current + hole_current
if contact in ["top", "bot"]:
voltage = get_circuit_node_value(solution='dcop', node=f"n{contact}")
else:
voltage = get_parameter(device=device, name=GetContactBiasName(contact))
data = (voltage, electron_current, hole_current, total_current)
print(f"{contact:10}{voltage:+.3e}\t{electron_current:+.3e}\t{hole_current:+.3e}\t{total_current:+.3e}")
return data
def print_all_currents():
"""
Prints all currents to console and returns outmap of values. !Currently only functional when all contacts are
silicon contacts!
:return:
"""
print("\nSolution:")
print("{0:10}{1:15}{2:12}{3:12}{4:10}".format("Contact", "Voltage", "Electron", "Hole", "Total"))
print(" Current Current Current")
device_list = get_device_list()
for device in device_list:
contact_list = get_contact_list(device=device)
outmap = {}
for contact in contact_list:
outmap[contact] = print_currents(device, contact)
print_circuit_solution()
return outmap
def print_circuit_solution():
print('Circuit Solution')
nodes = get_circuit_node_list()
for node in get_circuit_node_list():
r = get_circuit_node_value(solution='dcop', node=node)
print("%s\t%1.15e" % (node, r))
device="diode3d"
region="Bulk"
diode_common.Create3DGmshMesh(device, region)
# this is the devsim format
write_devices (file="gmsh_diode3d_out.msh")
diode_common.SetParameters(device=device, region=region)
v_source_top = circuit_element(name="VSourceTop", n1="ntop", n2="GND", value=0.0)
v_source_bot = circuit_element(name="VSourceBot", n1="nbot", n2="GND", value=0.0)
circuit_node_alias(node="ntop", alias="top_bias")
circuit_node_alias(node="nbot", alias="bot_bias")
####
#### NetDoping
####
node_model(device=device, region=region, name="Acceptors", equation="1.0e18*step(0.5e-5-z);")
node_model(device=device, region=region, name="Donors", equation="1.0e18*step(z-0.5e-5);")
node_model(device=device, region=region, name="NetDoping", equation="Donors-Acceptors;")
diode_common.InitialSolution(device, region, circuit_contacts=["top", "bot"])
####
#### Initial DC solution
####
solve(type="transient_dc", absolute_error=1.0, relative_error=1e-12, maximum_iterations=30)
###
### Drift diffusion simulation at equilibrium
###
diode_common.DriftDiffusionInitialSolution(device, region, circuit_contacts=["top", "bot"])
solve(type="transient_dc", absolute_error=1e10, relative_error=1e-8, maximum_iterations=50)
v = -0.1
while v > -1.01:
circuit_alter(name="VSourceTop", value=v)
solve(type="transient_bdf1", absolute_error=1e10, relative_error=1e-06,
maximum_iterations=30, tdelta=1e-8, charge_error=1.0)
print_all_currents()
v -= 0.1
When you now look at the last solution which is printed to console, you can see that the current through the voltage source “VSourceTop” is extremly high in the 1e8 regime, while the current from the device behaves as expected:
Solution:
Contact Voltage Electron Hole Total
Current Current Current
bot +0.000e+00 +4.008e-10 +1.568e-20 +4.008e-10
top -1.000e+00 -3.273e-20 -3.992e-10 -3.992e-10
Circuit Solution
VSourceBot.I -4.180081894749284e-10
VSourceTop.I -1.304888058639660e+08
nbot 0.000000000000000e+00
ntop -9.999999999999999e-01
Any thoughts about this? My goal at the end would be to create a diode in reverse as a photodiode and attach a capacitor which integrates the generated current, therefore it would be really nice to use the circuit elements.
Thanks a lot!