Ids=0 for the example mos_2d.py file

Hi Juan,
I got ids=0 with the mos_2d.py file under folder testing.
below is the code i modified a little bit to plot it. please help.

Copyright 2013 DEVSIM LLC

Licensed under the Apache License, Version 2.0 (the “License”);

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an “AS IS” BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

import mos_2d_create
from mos_2d_physics import *
from devsim.python_packages.ramp import *

import devsim
device=devsim.get_device_list()[0]
oxide_regions = (“oxide”,)
silicon_regions = (“gate”, “bulk”)
all_regions = (“gate”, “bulk”, “oxide”)

for i in all_regions:
createSolution(device, i, “Potential”)

for i in silicon_regions:
setSiliconParameters(device, i)
createSiliconPotentialOnly(device, i)
for i in oxide_regions:
setOxideParameters(device, i)
createOxidePotentialOnly(device, “oxide”)

createSiliconPotentialOnlyContact(device, “gate”, “gate”)
createSiliconPotentialOnlyContact(device, “bulk”, “drain”)
createSiliconPotentialOnlyContact(device, “bulk”, “source”)
createSiliconPotentialOnlyContact(device, “bulk”, “body”)

createSiliconOxideInterface(device, “bulk_oxide”)
createSiliconOxideInterface(device, “gate_oxide”)

devsim.solve(type=“dc”, absolute_error=1.0e-13, relative_error=1e-12, maximum_iterations=30)
devsim.solve(type=“dc”, absolute_error=1.0e-13, relative_error=1e-12, maximum_iterations=30)

createSolution(device, “gate”, “Electrons”)
createSolution(device, “gate”, “Holes”)
devsim.set_node_values(device=device, region=“gate”, name=“Electrons”, init_from=“IntrinsicElectrons”)
devsim.set_node_values(device=device, region=“gate”, name=“Holes”, init_from=“IntrinsicHoles”)
createSiliconDriftDiffusion(device, “gate”)
createSiliconDriftDiffusionAtContact(device, “gate”, “gate”)

createSolution(device, “bulk”, “Electrons”)
createSolution(device, “bulk”, “Holes”)
devsim.set_node_values(device=device, region=“bulk”, name=“Electrons”, init_from=“IntrinsicElectrons”)
devsim.set_node_values(device=device, region=“bulk”, name=“Holes”, init_from=“IntrinsicHoles”)
createSiliconDriftDiffusion(device, “bulk”)

createSiliconDriftDiffusionAtContact(device, “bulk”, “drain”)
createSiliconDriftDiffusionAtContact(device, “bulk”, “source”)
createSiliconDriftDiffusionAtContact(device, “bulk”, “body”)

devsim.solve(type=“dc”, absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)

devsim.element_from_edge_model(edge_model=“ElectricField”, device=device, region=“bulk”)

devsim.write_devices(file=“mos_2d_dd.msh”, type=“devsim”)

devsim.write_devices( file=“mos_2d_dd”, type=“vtk”)

devsim.set_parameter(device=device, name=GetContactBiasName(‘drain’), value=0.1)
devsim.solve(type=“dc”, absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)

printCurrents(device, “drain”, 0)

#write_devices(file=“gmsh_mos2d_dd_kla.dat”, type=“tecplot”)
#write_devices(file=“gmsh_mos2d_dd_kla”, type=“vtk”)

vgs=[]
cgg=[]
ids=[]

v=0.0
while v < 10.1:

devsim.set_parameter(device=device, name=GetContactBiasName('gate'), value=v)
devsim.solve(type="dc", absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)
#solve(type="dc", absolute_error=1e30, relative_error=1e-10, maximum_iterations=100)
#PrintCurrents(device, "drain")

contact_bias_name = GetContactBiasName('drain')
electron_current= get_contact_current(device=device, contact='drain', equation="ElectronContinuityEquation")
hole_current= get_contact_current(device=device, contact='drain', equation="HoleContinuityEquation")
total_current= electron_current + hole_current

#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))

vgs.append(v)
#cgg.append(cap)
ids.append(total_current)

v += 1

import matplotlib
import matplotlib.pyplot

matplotlib.pyplot.figure(2)
matplotlib.pyplot.plot(vgs, ids, linestyle=‘-’, marker=‘o’)
#matplotlib.pyplot.yscale(‘log’)
matplotlib.pyplot.xlabel(‘vgs (v)’)
matplotlib.pyplot.ylabel(‘ids (A)’)
matplotlib.pyplot.show()

when posting, please use the code block markdown, so that the python indentation is preserved

Juan,
How to make code block markdown?

Please use the button in the red circle to create a preformatted text block.

All of the code should be between the first and last line of back ticks.

import mos_2d_create
from mos_2d_physics import *
from devsim.python_packages.ramp import *

import devsim
device=devsim.get_device_list()[0]
oxide_regions   = ("oxide",)
silicon_regions = ("gate", "bulk")
all_regions     = ("gate", "bulk", "oxide")

for i in all_regions:
    createSolution(device, i, "Potential")

for i in silicon_regions:
    setSiliconParameters(device, i)
    createSiliconPotentialOnly(device, i)
for i in oxide_regions:
    setOxideParameters(device, i)
    createOxidePotentialOnly(device, "oxide")

createSiliconPotentialOnlyContact(device, "gate", "gate")
createSiliconPotentialOnlyContact(device, "bulk", "drain")
createSiliconPotentialOnlyContact(device, "bulk", "source")
createSiliconPotentialOnlyContact(device, "bulk", "body")

createSiliconOxideInterface(device, "bulk_oxide")
createSiliconOxideInterface(device, "gate_oxide")

devsim.solve(type="dc", absolute_error=1.0e-13, relative_error=1e-12, maximum_iterations=30)
devsim.solve(type="dc", absolute_error=1.0e-13, relative_error=1e-12, maximum_iterations=30)

createSolution(device, "gate", "Electrons")
createSolution(device, "gate", "Holes")
devsim.set_node_values(device=device, region="gate", name="Electrons", init_from="IntrinsicElectrons")
devsim.set_node_values(device=device, region="gate", name="Holes",     init_from="IntrinsicHoles")
createSiliconDriftDiffusion(device, "gate")
createSiliconDriftDiffusionAtContact(device, "gate", "gate")

createSolution(device, "bulk", "Electrons")
createSolution(device, "bulk", "Holes")
devsim.set_node_values(device=device, region="bulk", name="Electrons", init_from="IntrinsicElectrons")
devsim.set_node_values(device=device, region="bulk", name="Holes",     init_from="IntrinsicHoles")
createSiliconDriftDiffusion(device, "bulk")


createSiliconDriftDiffusionAtContact(device, "bulk", "drain")
createSiliconDriftDiffusionAtContact(device, "bulk", "source")
createSiliconDriftDiffusionAtContact(device, "bulk", "body")

devsim.solve(type="dc", absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)

devsim.element_from_edge_model(edge_model="ElectricField", device=device, region="bulk")

devsim.write_devices(file="mos_2d_dd.msh", type="devsim")

devsim.write_devices( file="mos_2d_dd", type="vtk")


devsim.set_parameter(device=device, name=GetContactBiasName('drain'), value=0.1)
devsim.solve(type="dc", absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)

printCurrents(device, "drain", 0)

#write_devices(file="gmsh_mos2d_dd_kla.dat", type="tecplot")
#write_devices(file="gmsh_mos2d_dd_kla", type="vtk")

vgs=[]
cgg=[]
ids=[]

v=0.0
while v < 10.1:

    devsim.set_parameter(device=device, name=GetContactBiasName('gate'), value=v)
    devsim.solve(type="dc", absolute_error=1.0e30, relative_error=1e-5, maximum_iterations=30)
    #solve(type="dc", absolute_error=1e30, relative_error=1e-10, maximum_iterations=100)
    #PrintCurrents(device, "drain")

    contact_bias_name = GetContactBiasName('drain')
    electron_current= get_contact_current(device=device, contact='drain', equation="ElectronContinuityEquation")
    hole_current= get_contact_current(device=device, contact='drain', equation="HoleContinuityEquation")
    total_current= electron_current + hole_current

    #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))

    vgs.append(v)
    #cgg.append(cap)
    ids.append(total_current)

    v += 1

import matplotlib
import matplotlib.pyplot

matplotlib.pyplot.figure(2)
matplotlib.pyplot.plot(vgs, ids, linestyle='-', marker='o')
#matplotlib.pyplot.yscale('log')
matplotlib.pyplot.xlabel('vgs (v)')
matplotlib.pyplot.ylabel('ids (A)')
matplotlib.pyplot.show()

Juan,
Here is the code.

1 Like

Thanks, I hope to be able to look at it this weekend

Hi @sharkjune,

Thanks for reporting this issue. It looks like there are bugs in that script. I have filed that here:
https://github.com/devsim/devsim/issues/104

For now, please experiment with examples/mobility/gmsh_mos2d.py, which seems to reporting non zero Id current

Juan, ok.
i have tried that one which is ok. I will like to understand what’s wrong with the one reported.

I suspect there is something wrong with these scripts, as they are not consistent with those in the examples/mobility or the python_packages scripts. Due to the limits of numerical precision, I would never expect the currents to be exacly 0. If you wanted to experiment with the structure, I would recommend using it with the mobility example scripts.