devsim 2.12.0__cp315-abi3t-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devsim/__init__.py +33 -0
- devsim/__init__.pyi +2155 -0
- devsim/devsim_py3.pyd +0 -0
- devsim/python_packages/Klaassen.py +336 -0
- devsim/python_packages/__init__.py +0 -0
- devsim/python_packages/fermi_physics.py +31 -0
- devsim/python_packages/model_create.py +261 -0
- devsim/python_packages/mos_physics.py +170 -0
- devsim/python_packages/pythonmesh.py +131 -0
- devsim/python_packages/ramp.py +101 -0
- devsim/python_packages/simple_dd.py +75 -0
- devsim/python_packages/simple_physics.py +463 -0
- devsim/umfpack/umfpack_lgpl.dll +0 -0
- devsim/umfpack/umfpack_loader.py +538 -0
- devsim/umfpack/umfshim.py +115 -0
- devsim-2.12.0.data/data/devsim_data/BUILD.md +135 -0
- devsim-2.12.0.data/data/devsim_data/CHANGES.md +935 -0
- devsim-2.12.0.data/data/devsim_data/CITATION.cff +33 -0
- devsim-2.12.0.data/data/devsim_data/CITATION.md +23 -0
- devsim-2.12.0.data/data/devsim_data/CODE_OF_CONDUCT.md +74 -0
- devsim-2.12.0.data/data/devsim_data/CONTRIBUTING.md +43 -0
- devsim-2.12.0.data/data/devsim_data/HOWTO.md +25 -0
- devsim-2.12.0.data/data/devsim_data/INSTALL.md +84 -0
- devsim-2.12.0.data/data/devsim_data/LICENSE +202 -0
- devsim-2.12.0.data/data/devsim_data/NOTICE +241 -0
- devsim-2.12.0.data/data/devsim_data/README.md +99 -0
- devsim-2.12.0.data/data/devsim_data/TEST.md +13 -0
- devsim-2.12.0.data/data/devsim_data/VERSION +3 -0
- devsim-2.12.0.data/data/devsim_data/doc/devsim.pdf +0 -0
- devsim-2.12.0.data/data/devsim_data/doc/symdiff.pdf +0 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/Ve0.jpg +0 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/Ve0_3d.jpg +0 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/Ve7.jpg +0 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/Ve7_3d.jpg +0 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/bioapp1_2d.py +85 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/bioapp1_3d.py +85 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/bioapp1_common.py +399 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/disk_2d.geo +62 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/disk_2d.msh +65606 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/disk_3d.geo +183 -0
- devsim-2.12.0.data/data/devsim_data/examples/bioapp1/disk_3d.msh +25808 -0
- devsim-2.12.0.data/data/devsim_data/examples/capacitance/cap.lay +1587 -0
- devsim-2.12.0.data/data/devsim_data/examples/capacitance/cap1d.py +155 -0
- devsim-2.12.0.data/data/devsim_data/examples/capacitance/cap2d.py +200 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/3dblock.geo +48 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_1d.py +94 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_1d_custom.py +159 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_2d.py +68 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_common.py +253 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_current.lay +3271 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_density.lay +3271 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/diode_potential.lay +3272 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode2d.msh +1477 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode2d.py +55 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode3d.msh +8557 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode3d.py +74 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode3d_equil.py +43 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/gmsh_diode3d_float128.py +85 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/laux2d.py +43 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/laux3d.py +54 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/laux_common.py +503 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/pythonmesh3d.py +61 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/ssac_diode.py +57 -0
- devsim-2.12.0.data/data/devsim_data/examples/diode/tran_diode.py +63 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/gmsh_mos2d.geo +160 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/gmsh_mos2d.msh +8599 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/gmsh_mos2d.py +96 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/gmsh_mos2d_create.py +174 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/gmsh_mos2d_kla.py +162 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/logElectrons.lay +1327 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/pythonmesh2d.py +100 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/test.lay +3385 -0
- devsim-2.12.0.data/data/devsim_data/examples/mobility/times.txt +34 -0
- devsim-2.12.0.data/data/devsim_data/examples/plotting/visualization.ipynb +160 -0
- devsim-2.12.0.data/data/devsim_data/examples/vectorpotential/twowire.geo +34 -0
- devsim-2.12.0.data/data/devsim_data/examples/vectorpotential/twowire.lay +1469 -0
- devsim-2.12.0.data/data/devsim_data/examples/vectorpotential/twowire.msh +13596 -0
- devsim-2.12.0.data/data/devsim_data/examples/vectorpotential/twowire.py +177 -0
- devsim-2.12.0.data/data/devsim_data/pyproject.toml +33 -0
- devsim-2.12.0.data/data/devsim_data/setup.py +64 -0
- devsim-2.12.0.data/data/devsim_data/testing/3dtetmesh.msh +281 -0
- devsim-2.12.0.data/data/devsim_data/testing/CMakeLists.txt +174 -0
- devsim-2.12.0.data/data/devsim_data/testing/Fermi1.py +59 -0
- devsim-2.12.0.data/data/devsim_data/testing/Fermi1_float128.py +18 -0
- devsim-2.12.0.data/data/devsim_data/testing/GaussFermi.py +38 -0
- devsim-2.12.0.data/data/devsim_data/testing/GaussFermi_float128.py +18 -0
- devsim-2.12.0.data/data/devsim_data/testing/cap2.py +439 -0
- devsim-2.12.0.data/data/devsim_data/testing/cap_mesh.py +33 -0
- devsim-2.12.0.data/data/devsim_data/testing/circ1.py +79 -0
- devsim-2.12.0.data/data/devsim_data/testing/circ2.py +79 -0
- devsim-2.12.0.data/data/devsim_data/testing/circ3.py +18 -0
- devsim-2.12.0.data/data/devsim_data/testing/circ4.py +105 -0
- devsim-2.12.0.data/data/devsim_data/testing/dio2_element_2d.py +136 -0
- devsim-2.12.0.data/data/devsim_data/testing/dio2_element_physics.py +302 -0
- devsim-2.12.0.data/data/devsim_data/testing/equation1.py +68 -0
- devsim-2.12.0.data/data/devsim_data/testing/erf1.py +52 -0
- devsim-2.12.0.data/data/devsim_data/testing/erf2.py +34 -0
- devsim-2.12.0.data/data/devsim_data/testing/fpetest1.py +21 -0
- devsim-2.12.0.data/data/devsim_data/testing/fpetest2.py +25 -0
- devsim-2.12.0.data/data/devsim_data/testing/gmsh_mos3d.geo +272 -0
- devsim-2.12.0.data/data/devsim_data/testing/info.py +15 -0
- devsim-2.12.0.data/data/devsim_data/testing/kahan.py +24 -0
- devsim-2.12.0.data/data/devsim_data/testing/kahan_float128.py +18 -0
- devsim-2.12.0.data/data/devsim_data/testing/laux1.py +232 -0
- devsim-2.12.0.data/data/devsim_data/testing/mctest.mc +30 -0
- devsim-2.12.0.data/data/devsim_data/testing/mctest_user.mc +33 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh1.msh +52 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh1.py +121 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh2.msh +70 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh2.py +210 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh2d.py +105 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh3.py +8 -0
- devsim-2.12.0.data/data/devsim_data/testing/mesh4.py +8 -0
- devsim-2.12.0.data/data/devsim_data/testing/mos_2d.py +111 -0
- devsim-2.12.0.data/data/devsim_data/testing/mos_2d_create.py +207 -0
- devsim-2.12.0.data/data/devsim_data/testing/mos_2d_restart.py +69 -0
- devsim-2.12.0.data/data/devsim_data/testing/mos_2d_restart2.py +24 -0
- devsim-2.12.0.data/data/devsim_data/testing/noise_res.py +51 -0
- devsim-2.12.0.data/data/devsim_data/testing/noise_res_2d.py +101 -0
- devsim-2.12.0.data/data/devsim_data/testing/other_blas.py +28 -0
- devsim-2.12.0.data/data/devsim_data/testing/ptest1.py +53 -0
- devsim-2.12.0.data/data/devsim_data/testing/ptest2.py +110 -0
- devsim-2.12.0.data/data/devsim_data/testing/pythonmesh1d.py +202 -0
- devsim-2.12.0.data/data/devsim_data/testing/res1.py +65 -0
- devsim-2.12.0.data/data/devsim_data/testing/res2.py +65 -0
- devsim-2.12.0.data/data/devsim_data/testing/res3.py +59 -0
- devsim-2.12.0.data/data/devsim_data/testing/rundifftest.py +62 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_cap.py +145 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_cap_2d_edge.py +199 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_cap_2d_element.py +214 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_cap_3d_edge.py +148 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_cap_3d_element.py +167 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_circ.py +18 -0
- devsim-2.12.0.data/data/devsim_data/testing/ssac_res.py +30 -0
- devsim-2.12.0.data/data/devsim_data/testing/symdiff1.py +54 -0
- devsim-2.12.0.data/data/devsim_data/testing/test_common.py +435 -0
- devsim-2.12.0.data/data/devsim_data/testing/testfunc.py +65 -0
- devsim-2.12.0.data/data/devsim_data/testing/testfunc_extended.py +8 -0
- devsim-2.12.0.data/data/devsim_data/testing/transient_circ.py +67 -0
- devsim-2.12.0.data/data/devsim_data/testing/transient_circ2.py +67 -0
- devsim-2.12.0.data/data/devsim_data/testing/transient_circ3.py +125 -0
- devsim-2.12.0.data/data/devsim_data/testing/transient_rc.py +157 -0
- devsim-2.12.0.data/data/devsim_data/testing/trimesh1.msh +47 -0
- devsim-2.12.0.data/data/devsim_data/testing/trimesh1.py +114 -0
- devsim-2.12.0.data/data/devsim_data/testing/trimesh2.py +114 -0
- devsim-2.12.0.data/data/devsim_data/testing/utf8_2.py +126 -0
- devsim-2.12.0.dist-info/METADATA +122 -0
- devsim-2.12.0.dist-info/RECORD +152 -0
- devsim-2.12.0.dist-info/WHEEL +5 -0
- devsim-2.12.0.dist-info/licenses/LICENSE +202 -0
- devsim-2.12.0.dist-info/licenses/NOTICE +241 -0
- devsim-2.12.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Copyright 2013 DEVSIM LLC
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from devsim import contact_equation, element_from_edge_model, equation, get_dimension
|
|
6
|
+
|
|
7
|
+
from devsim.python_packages.model_create import (
|
|
8
|
+
CreateElementModel2d,
|
|
9
|
+
CreateElementModelDerivative2d,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def CreateElementElectronContinuityEquation(device, region, current_model):
|
|
14
|
+
"""
|
|
15
|
+
Uses element current model for equation
|
|
16
|
+
"""
|
|
17
|
+
equation(
|
|
18
|
+
device=device,
|
|
19
|
+
region=region,
|
|
20
|
+
name="ElectronContinuityEquation",
|
|
21
|
+
variable_name="Electrons",
|
|
22
|
+
time_node_model="NCharge",
|
|
23
|
+
node_model="ElectronGeneration",
|
|
24
|
+
element_model=current_model,
|
|
25
|
+
variable_update="positive",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# TODO: expand for circuit
|
|
30
|
+
def CreateElementContactElectronContinuityEquation(device, contact, current_model):
|
|
31
|
+
"""
|
|
32
|
+
Uses element current model for equation
|
|
33
|
+
"""
|
|
34
|
+
contact_electrons_name = "{0}nodeelectrons".format(contact)
|
|
35
|
+
contact_equation(
|
|
36
|
+
device=device,
|
|
37
|
+
contact=contact,
|
|
38
|
+
name="ElectronContinuityEquation",
|
|
39
|
+
node_model=contact_electrons_name,
|
|
40
|
+
element_current_model=current_model,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
#### this version is from the direction of current flow
|
|
45
|
+
#### TODO: version from interface normal distance
|
|
46
|
+
def CreateNormalElectricFieldFromInterfaceNormal(device, region, interface):
|
|
47
|
+
### assume the interface normal already exists
|
|
48
|
+
#### Get the electric field on the element
|
|
49
|
+
element_from_edge_model(edge_model="ElectricField", device=device, region=region)
|
|
50
|
+
element_from_edge_model(
|
|
51
|
+
edge_model="ElectricField", device=device, region=region, derivative="Potential"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
#### Get the normal e field to current flow /// need to figure out sign importance for electron/hole
|
|
55
|
+
Enormal = "{0}_normal_x * ElectricField_x + {0}_normal_y * ElectricField_y".format(
|
|
56
|
+
interface
|
|
57
|
+
)
|
|
58
|
+
CreateElementModel2d(device, region, "Enormal", Enormal)
|
|
59
|
+
CreateElementModelDerivative2d(device, region, "Enormal", Enormal, "Potential")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
###### make this on a per carrier basis function
|
|
63
|
+
###### assume that low field model already exists, but not projected
|
|
64
|
+
def CreateNormalElectricFieldFromCurrentFlow(device, region, low_curr):
|
|
65
|
+
dimension = get_dimension(device=device)
|
|
66
|
+
if dimension != 2:
|
|
67
|
+
raise ValueError("Supported in 2d only")
|
|
68
|
+
|
|
69
|
+
element_from_edge_model(edge_model=low_curr, device=device, region=region)
|
|
70
|
+
element_from_edge_model(
|
|
71
|
+
edge_model=low_curr, device=device, region=region, derivative="Potential"
|
|
72
|
+
)
|
|
73
|
+
element_from_edge_model(
|
|
74
|
+
edge_model=low_curr, device=device, region=region, derivative="Electrons"
|
|
75
|
+
)
|
|
76
|
+
element_from_edge_model(
|
|
77
|
+
edge_model=low_curr, device=device, region=region, derivative="Holes"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
#### Get the current magnitude on the element
|
|
81
|
+
#### do we need the derivative, since this is only scaling the direction?
|
|
82
|
+
#### Worry about small denominator 1e-300 is about the limit
|
|
83
|
+
J_lf_mag = "pow({0}_x^2 + {0}_y^2 + 1e-300, 0.5)".format(low_curr)
|
|
84
|
+
CreateElementModel2d(
|
|
85
|
+
device, region, "{0}_mag".format(low_curr), "{0}".format(J_lf_mag)
|
|
86
|
+
)
|
|
87
|
+
for j in ("Electrons", "Holes", "Potential"):
|
|
88
|
+
for i in ("@en0", "@en1", "@en2"):
|
|
89
|
+
ex = "({0}_x * {0}_x:{1}{2} + {0}_y * {0}_y:{1}{2})/{0}_mag".format(
|
|
90
|
+
low_curr, j, i
|
|
91
|
+
)
|
|
92
|
+
CreateElementModel2d(
|
|
93
|
+
device, region, "{0}_mag:{1}{2}".format(low_curr, j, i), ex
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
### This calculates the normalized current in each direction
|
|
97
|
+
for i in ("x", "y"):
|
|
98
|
+
J_norm = "{0}_{1} / {0}_mag".format(low_curr, i)
|
|
99
|
+
CreateElementModel2d(device, region, "{0}_norm_{1}".format(low_curr, i), J_norm)
|
|
100
|
+
CreateElementModelDerivative2d(
|
|
101
|
+
device,
|
|
102
|
+
region,
|
|
103
|
+
"{0}_norm_{1}".format(low_curr, i),
|
|
104
|
+
J_norm,
|
|
105
|
+
"Electrons",
|
|
106
|
+
"Holes",
|
|
107
|
+
"Potential",
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
#### Get the electric field on the element
|
|
111
|
+
element_from_edge_model(edge_model="ElectricField", device=device, region=region)
|
|
112
|
+
element_from_edge_model(
|
|
113
|
+
edge_model="ElectricField", device=device, region=region, derivative="Potential"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
#### Get the parallel e field to current flow
|
|
117
|
+
Eparallel_J = "{0}_norm_x * ElectricField_x + {0}_norm_y * ElectricField_y".format(
|
|
118
|
+
low_curr
|
|
119
|
+
)
|
|
120
|
+
CreateElementModel2d(device, region, "Eparallel_{0}".format(low_curr), Eparallel_J)
|
|
121
|
+
CreateElementModelDerivative2d(
|
|
122
|
+
device, region, "Eparallel_{0}".format(low_curr), Eparallel_J, "Potential"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# magnitude e field
|
|
126
|
+
ElectricField_mag = "pow(ElectricField_x^2 + ElectricField_y^2 + 1e-300, 0.5)"
|
|
127
|
+
CreateElementModel2d(device, region, "ElectricField_mag", ElectricField_mag)
|
|
128
|
+
# the , turns this into an actual tuple
|
|
129
|
+
for j in ("Potential",):
|
|
130
|
+
for i in ("@en0", "@en1", "@en2"):
|
|
131
|
+
ex = "(ElectricField_x * ElectricField_x:{0}{1} + ElectricField_y * ElectricField_y:{0}{1})/ElectricField_mag".format(
|
|
132
|
+
j, i
|
|
133
|
+
)
|
|
134
|
+
CreateElementModel2d(
|
|
135
|
+
device, region, "ElectricField_mag:{0}{1}".format(j, i), ex
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
#### Get the normal e field to current flow
|
|
139
|
+
Enormal_J = "pow(max(ElectricField_mag^2 - Eparallel_{0}^2,1e-300), 0.5)".format(
|
|
140
|
+
low_curr
|
|
141
|
+
)
|
|
142
|
+
CreateElementModel2d(device, region, "Enormal_{0}".format(low_curr), Enormal_J)
|
|
143
|
+
|
|
144
|
+
# CreateElementModelDerivative2d $device $region Enormal_{low_curr} {Enormal_J} Electrons Holes Potential
|
|
145
|
+
for j in ("Electrons", "Holes", "Potential"):
|
|
146
|
+
for i in ("@en0", "@en1", "@en2"):
|
|
147
|
+
ex = "(ElectricField_mag * ElectricField_mag:{0}{1} - Eparallel_{2} * Eparallel_{2}:{0}{1})/Enormal_{2}".format(
|
|
148
|
+
j, i, low_curr
|
|
149
|
+
)
|
|
150
|
+
CreateElementModel2d(
|
|
151
|
+
device, region, "Enormal_{0}:{1}{2}".format(low_curr, j, i), ex
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def CreateElementElectronCurrent2d(device, region, name, mobility_model):
|
|
156
|
+
Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Electrons@en1*Bern01, Electrons@en1*vdiff, -Electrons@en0*Bern01)".format(
|
|
157
|
+
mobility_model
|
|
158
|
+
)
|
|
159
|
+
CreateElementModel2d(device, region, name, Jn)
|
|
160
|
+
for i in ("Electrons", "Holes", "Potential"):
|
|
161
|
+
CreateElementModelDerivative2d(device, region, name, Jn, i)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def CreateElementHoleCurrent2d(device, region, name, mobility_model):
|
|
165
|
+
Jp = "-ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Holes@en1*Bern01, -Holes@en0*Bern01, -Holes@en0*vdiff)".format(
|
|
166
|
+
mobility_model
|
|
167
|
+
)
|
|
168
|
+
CreateElementModel2d(device, region, name, Jp)
|
|
169
|
+
for i in ("Electrons", "Holes", "Potential"):
|
|
170
|
+
CreateElementModelDerivative2d(device, region, name, Jp, i)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
def parse_gmsh_file(file):
|
|
2
|
+
sections = set(["$MeshFormat", "$PhysicalNames", "$Nodes", "$Elements"])
|
|
3
|
+
lineno = 0
|
|
4
|
+
section_count = 0
|
|
5
|
+
section_expected = 0
|
|
6
|
+
dimension = 0
|
|
7
|
+
with open(file, "r") as ih:
|
|
8
|
+
state = "begin"
|
|
9
|
+
for line in ih:
|
|
10
|
+
line = line.rstrip()
|
|
11
|
+
lineno += 1
|
|
12
|
+
if state == "begin":
|
|
13
|
+
if line in sections:
|
|
14
|
+
state = line
|
|
15
|
+
else:
|
|
16
|
+
raise RuntimeError("Error Line %d" % lineno)
|
|
17
|
+
elif line.find("$End") == 0:
|
|
18
|
+
state = "begin"
|
|
19
|
+
section_count = 0
|
|
20
|
+
section_expected = None
|
|
21
|
+
elif state == "$MeshFormat":
|
|
22
|
+
continue
|
|
23
|
+
elif state == "$PhysicalNames":
|
|
24
|
+
if not section_expected:
|
|
25
|
+
section_expected = int(line)
|
|
26
|
+
physical_names = []
|
|
27
|
+
else:
|
|
28
|
+
line = line.split()
|
|
29
|
+
name = line[2][1:-1]
|
|
30
|
+
physical_names.append((name, int(line[0]), int(line[1])))
|
|
31
|
+
section_count += 1
|
|
32
|
+
elif state == "$Nodes":
|
|
33
|
+
if not section_expected:
|
|
34
|
+
section_expected = int(line)
|
|
35
|
+
nodes = []
|
|
36
|
+
else:
|
|
37
|
+
line = line.split()
|
|
38
|
+
nodes.append(
|
|
39
|
+
[int(line[0]), float(line[1]), float(line[2]), float(line[3])]
|
|
40
|
+
)
|
|
41
|
+
section_count += 1
|
|
42
|
+
elif state == "$Elements":
|
|
43
|
+
if not section_expected:
|
|
44
|
+
section_expected = int(line)
|
|
45
|
+
elements = [None] * section_expected
|
|
46
|
+
else:
|
|
47
|
+
elements[section_count] = [int(x) for x in line.split()]
|
|
48
|
+
section_count += 1
|
|
49
|
+
else:
|
|
50
|
+
raise RuntimeError("Unknown %s" % line)
|
|
51
|
+
dimension = max([x[1] for x in physical_names])
|
|
52
|
+
return {
|
|
53
|
+
"dimension": dimension,
|
|
54
|
+
"physical_names": physical_names,
|
|
55
|
+
"coordinates": nodes,
|
|
56
|
+
"elements": elements,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def read_gmsh_file(filename):
|
|
61
|
+
"""reads gmsh file and converts to python representation"""
|
|
62
|
+
data = parse_gmsh_file(filename)
|
|
63
|
+
# namemap = {}
|
|
64
|
+
print("%d dimension" % data["dimension"])
|
|
65
|
+
print("%d coordinates" % len(data["coordinates"]))
|
|
66
|
+
# for i in sorted(data['physical_names'].keys()):
|
|
67
|
+
# print "%s %s %d" % (i, data['physical_names'][i], len(data['elements'][i]))
|
|
68
|
+
# namemap[data['physical_names'][i]] = i
|
|
69
|
+
|
|
70
|
+
coordinate_indexes = [x[0] for x in data["coordinates"]]
|
|
71
|
+
max_coordinate_index = max(coordinate_indexes)
|
|
72
|
+
coordinate_to_index = [-1] * (max_coordinate_index + 1)
|
|
73
|
+
for i, j in enumerate(coordinate_indexes):
|
|
74
|
+
coordinate_to_index[j] = i
|
|
75
|
+
|
|
76
|
+
coordinates = []
|
|
77
|
+
for i in data["coordinates"]:
|
|
78
|
+
coordinates.extend(i[1:])
|
|
79
|
+
|
|
80
|
+
_all_physical_numbers = sorted(set([x[3] for x in data["elements"]]))
|
|
81
|
+
sorted_physical_names = sorted(data["physical_names"], key=lambda x: x[0])
|
|
82
|
+
physical_number_map = {
|
|
83
|
+
1: {},
|
|
84
|
+
2: {},
|
|
85
|
+
3: {},
|
|
86
|
+
}
|
|
87
|
+
for i, j in enumerate(sorted_physical_names):
|
|
88
|
+
# mapped dimension, physical number, new index
|
|
89
|
+
physical_number_map[j[1]][j[2]] = i
|
|
90
|
+
physical_names = [x[0] for x in sorted_physical_names]
|
|
91
|
+
|
|
92
|
+
# gmsh format
|
|
93
|
+
# elm-number elm-type number-of-tags < tag > ... node-number-list
|
|
94
|
+
# our format
|
|
95
|
+
elements = []
|
|
96
|
+
for i in data["elements"]:
|
|
97
|
+
t = i[1]
|
|
98
|
+
if t == 4:
|
|
99
|
+
# tetrahedron
|
|
100
|
+
etype = 3
|
|
101
|
+
dimension = 3
|
|
102
|
+
elif t == 2:
|
|
103
|
+
# triangle
|
|
104
|
+
etype = 2
|
|
105
|
+
dimension = 2
|
|
106
|
+
elif t == 1:
|
|
107
|
+
# edge
|
|
108
|
+
etype = 1
|
|
109
|
+
dimension = 1
|
|
110
|
+
elif t == 15:
|
|
111
|
+
# point
|
|
112
|
+
etype = 0
|
|
113
|
+
else:
|
|
114
|
+
raise RuntimeError("Cannot handle element type " % i)
|
|
115
|
+
|
|
116
|
+
# physical number
|
|
117
|
+
# will be remapped later
|
|
118
|
+
pnum = physical_number_map[dimension][i[3]]
|
|
119
|
+
|
|
120
|
+
# nodes
|
|
121
|
+
# position 2 + number of tags
|
|
122
|
+
nodes = i[i[2] + 3 :]
|
|
123
|
+
nodes = [coordinate_to_index[x] for x in nodes]
|
|
124
|
+
elements.extend([etype, pnum])
|
|
125
|
+
elements.extend(nodes)
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
"physical_names": physical_names,
|
|
129
|
+
"coordinates": coordinates,
|
|
130
|
+
"elements": elements,
|
|
131
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Copyright 2013 DEVSIM LLC
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import devsim as ds
|
|
6
|
+
from devsim.python_packages.simple_physics import GetContactBiasName, PrintCurrents
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def rampbias(
|
|
10
|
+
device,
|
|
11
|
+
contact,
|
|
12
|
+
end_bias,
|
|
13
|
+
step_size,
|
|
14
|
+
min_step,
|
|
15
|
+
max_iter,
|
|
16
|
+
rel_error,
|
|
17
|
+
abs_error,
|
|
18
|
+
callback,
|
|
19
|
+
):
|
|
20
|
+
"""
|
|
21
|
+
Ramps bias with assignable callback function
|
|
22
|
+
|
|
23
|
+
Uses devsim.get_parameter to get the bias currently at the contact being ramped.
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
-----------
|
|
27
|
+
|
|
28
|
+
device : name of the device
|
|
29
|
+
contact : contact name
|
|
30
|
+
end_bias : bias for last step
|
|
31
|
+
step_size : initial step size
|
|
32
|
+
min_step : minimum step size
|
|
33
|
+
max_iter : maximum number of iterations
|
|
34
|
+
rel_error : required relative error for convergence
|
|
35
|
+
abs_error : required absolute error for convergence
|
|
36
|
+
callback : callback function that should be called on success.
|
|
37
|
+
See printAllCurrents for an example.
|
|
38
|
+
|
|
39
|
+
Description:
|
|
40
|
+
------------
|
|
41
|
+
|
|
42
|
+
Uses GetContactBiasName to get the bias being applied at the contact specified.
|
|
43
|
+
|
|
44
|
+
On each successfull bias, the callback function is called.
|
|
45
|
+
|
|
46
|
+
Exceptions are raised if there is a failure at the last bias step attempted.
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
start_bias = ds.get_parameter(device=device, name=GetContactBiasName(contact))
|
|
51
|
+
if start_bias < end_bias:
|
|
52
|
+
step_sign = 1
|
|
53
|
+
else:
|
|
54
|
+
step_sign = -1
|
|
55
|
+
step_size = abs(step_size)
|
|
56
|
+
|
|
57
|
+
last_bias = start_bias
|
|
58
|
+
while abs(last_bias - end_bias) > min_step:
|
|
59
|
+
print(("%s last end %e %e") % (contact, last_bias, end_bias))
|
|
60
|
+
next_bias = last_bias + step_sign * step_size
|
|
61
|
+
if next_bias < end_bias:
|
|
62
|
+
next_step_sign = 1
|
|
63
|
+
else:
|
|
64
|
+
next_step_sign = -1
|
|
65
|
+
|
|
66
|
+
if next_step_sign != step_sign:
|
|
67
|
+
next_bias = end_bias
|
|
68
|
+
print("setting to last bias %e" % (end_bias))
|
|
69
|
+
print("setting next bias %e" % (next_bias))
|
|
70
|
+
ds.set_parameter(
|
|
71
|
+
device=device, name=GetContactBiasName(contact), value=next_bias
|
|
72
|
+
)
|
|
73
|
+
try:
|
|
74
|
+
ds.solve(
|
|
75
|
+
type="dc",
|
|
76
|
+
absolute_error=abs_error,
|
|
77
|
+
relative_error=rel_error,
|
|
78
|
+
maximum_iterations=max_iter,
|
|
79
|
+
)
|
|
80
|
+
except ds.error as msg:
|
|
81
|
+
if str(msg).find("Convergence failure") != 0:
|
|
82
|
+
raise
|
|
83
|
+
ds.set_parameter(
|
|
84
|
+
device=device, name=GetContactBiasName(contact), value=last_bias
|
|
85
|
+
)
|
|
86
|
+
step_size *= 0.5
|
|
87
|
+
print("setting new step size %e" % (step_size))
|
|
88
|
+
if step_size < min_step:
|
|
89
|
+
raise RuntimeError("Minimum step size too small")
|
|
90
|
+
continue
|
|
91
|
+
print("Succeeded")
|
|
92
|
+
last_bias = next_bias
|
|
93
|
+
callback(device)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def printAllCurrents(device):
|
|
97
|
+
"""
|
|
98
|
+
Prints all contact currents on device
|
|
99
|
+
"""
|
|
100
|
+
for c in ds.get_contact_list(device=device):
|
|
101
|
+
PrintCurrents(device, c)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Copyright 2013 DEVSIM LLC
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from devsim.python_packages.model_create import (
|
|
6
|
+
CreateEdgeModel,
|
|
7
|
+
CreateEdgeModelDerivatives,
|
|
8
|
+
InEdgeModelList,
|
|
9
|
+
EnsureEdgeFromNodeModelExists,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def CreateBernoulli(device, region):
|
|
14
|
+
"""
|
|
15
|
+
Creates the Bernoulli function for Scharfetter Gummel
|
|
16
|
+
"""
|
|
17
|
+
#### test for requisite models here
|
|
18
|
+
EnsureEdgeFromNodeModelExists(device, region, "Potential")
|
|
19
|
+
vdiffstr = "(Potential@n0 - Potential@n1)/V_t"
|
|
20
|
+
CreateEdgeModel(device, region, "vdiff", vdiffstr)
|
|
21
|
+
CreateEdgeModel(device, region, "vdiff:Potential@n0", "V_t^(-1)")
|
|
22
|
+
CreateEdgeModel(device, region, "vdiff:Potential@n1", "-vdiff:Potential@n0")
|
|
23
|
+
CreateEdgeModel(device, region, "Bern01", "B(vdiff)")
|
|
24
|
+
CreateEdgeModel(
|
|
25
|
+
device, region, "Bern01:Potential@n0", "dBdx(vdiff) * vdiff:Potential@n0"
|
|
26
|
+
)
|
|
27
|
+
CreateEdgeModel(device, region, "Bern01:Potential@n1", "-Bern01:Potential@n0")
|
|
28
|
+
# identity of Bernoulli functions
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# CreateEdgeModel(device, region, "Bern10", "Bern01 + vdiff")
|
|
32
|
+
# CreateEdgeModel(device, region, "Bern10:Potential@n0", "Bern01:Potential@n0 + vdiff:Potential@n0")
|
|
33
|
+
# CreateEdgeModel(device, region, "Bern10:Potential@n1", "Bern01:Potential@n1 + vdiff:Potential@n1")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def CreateElectronCurrent(device, region, mu_n):
|
|
37
|
+
"""
|
|
38
|
+
Electron current
|
|
39
|
+
"""
|
|
40
|
+
EnsureEdgeFromNodeModelExists(device, region, "Potential")
|
|
41
|
+
EnsureEdgeFromNodeModelExists(device, region, "Electrons")
|
|
42
|
+
EnsureEdgeFromNodeModelExists(device, region, "Holes")
|
|
43
|
+
# Make sure the bernoulli functions exist
|
|
44
|
+
if not InEdgeModelList(device, region, "Bern01"):
|
|
45
|
+
CreateBernoulli(device, region)
|
|
46
|
+
#### test for requisite models here
|
|
47
|
+
# Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*(Electrons@n1*Bern10 - Electrons@n0*Bern01)".format(mu_n)
|
|
48
|
+
Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Electrons@n1*Bern01, Electrons@n1*vdiff, -Electrons@n0*Bern01)".format(
|
|
49
|
+
mu_n
|
|
50
|
+
)
|
|
51
|
+
# Jn = "ElectronCharge*{0}*EdgeInverseLength*V_t*((Electrons@n1-Electrons@n0)*Bern01 + Electrons@n1*vdiff)".format(mu_n)
|
|
52
|
+
|
|
53
|
+
CreateEdgeModel(device, region, "ElectronCurrent", Jn)
|
|
54
|
+
for i in ("Electrons", "Potential", "Holes"):
|
|
55
|
+
CreateEdgeModelDerivatives(device, region, "ElectronCurrent", Jn, i)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def CreateHoleCurrent(device, region, mu_p):
|
|
59
|
+
"""
|
|
60
|
+
Hole current
|
|
61
|
+
"""
|
|
62
|
+
EnsureEdgeFromNodeModelExists(device, region, "Potential")
|
|
63
|
+
EnsureEdgeFromNodeModelExists(device, region, "Holes")
|
|
64
|
+
# Make sure the bernoulli functions exist
|
|
65
|
+
if not InEdgeModelList(device, region, "Bern01"):
|
|
66
|
+
CreateBernoulli(device, region)
|
|
67
|
+
##### test for requisite models here
|
|
68
|
+
# Jp ="-ElectronCharge*{0}*EdgeInverseLength*V_t*(Holes@n1*Bern01 - Holes@n0*Bern10)".format(mu_p)
|
|
69
|
+
Jp = "-ElectronCharge*{0}*EdgeInverseLength*V_t*kahan3(Holes@n1*Bern01, -Holes@n0*Bern01, -Holes@n0*vdiff)".format(
|
|
70
|
+
mu_p
|
|
71
|
+
)
|
|
72
|
+
# Jp ="-ElectronCharge*{0}*EdgeInverseLength*V_t*((Holes@n1 - Holes@n0)*Bern01 - Holes@n0*vdiff)".format(mu_p)
|
|
73
|
+
CreateEdgeModel(device, region, "HoleCurrent", Jp)
|
|
74
|
+
for i in ("Holes", "Potential", "Electrons"):
|
|
75
|
+
CreateEdgeModelDerivatives(device, region, "HoleCurrent", Jp, i)
|