PLaSK library
Loading...
Searching...
No Matches
cond2d.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
# This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3
# Copyright (c) 2022 Lodz University of Technology
4
#
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, version 3.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
13
14
import
unittest
15
16
from
numpy
import
*
17
18
from
plask
import
*
19
from
plask
import
material, geometry, mesh
20
from
electrical.shockley
import
Shockley2D, ShockleyCyl, ActiveCond2D
21
22
eps0 = 8.854187817e-6
# pF/µm
23
24
@material.simple()
25
class
Conductor
(
material.Material
):
26
def
cond
(self, T):
27
return
(1e+12, 1e+12)
28
def
eps
(self, T):
29
return
1.
30
31
32
class
Cond2D_Test
(
unittest.TestCase
):
33
34
def
setUp
(self):
35
rect =
geometry.Rectangle
(1000., 300.,
Conductor
())
36
junc =
geometry.Rectangle
(1000., 0.2,
'GaAs'
)
37
junc.role
=
'active'
38
stack =
geometry.Stack2D
()
39
stack.append
(rect)
40
stack.append
(junc)
41
stack.append
(rect)
42
space =
geometry.Cartesian2D
(stack, length=1000.)
43
self.
solver
= ActiveCond2D(
"electrical2d"
)
44
self.
solver
.geometry = space
45
generator =
mesh.Rectangular2D.DivideGenerator
()
46
generator.prediv
= 2,1
47
self.
solver
.mesh = generator
48
self.
solver
.cond =
lambda
U, j, T: 0.05 + abs(j)
49
self.
solver
.maxerr = 1e-5
50
self.
solver
.
voltage_boundary.append
(self.
solver
.
mesh.Top
(), 0.)
51
self.
solver
.
voltage_boundary.append
(self.
solver
.
mesh.Bottom
(), 1.)
52
53
def
testComputations
(self):
54
self.
solver
.compute()
55
correct_current = 500.
56
self.assertAlmostEqual(self.
solver
.get_total_current(), correct_current, 3)
57
58
59
if
__name__ ==
'__main__'
:
60
test =
unittest.main
(exit=
False
)
61
show
()
62
sys.exit
(
not
test.result.wasSuccessful
())
solvers
electrical
shockley
tests
cond2d.py
Generated by
1.9.8