PLaSK library
Loading...
Searching...
No Matches
uniform.py
Go to the documentation of this file.
1
# This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
2
# Copyright (c) 2023 Lodz University of Technology
3
#
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, version 3.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
12
13
import
unittest
14
15
from
numpy
import
*
16
from
numpy.testing
import
assert_allclose
17
18
from
plask
import
*
19
from
plask
import
material, geometry, mesh
20
from
plask.geometry
import
Cartesian2D, Cylindrical
21
22
from
electrical.diffusion
import
Diffusion2D, DiffusionCyl
23
24
config.loglevel
=
'debug'
25
26
27
@material.simple('GaAs')
28
class
GaAsQW
(
material.Material
):
29
30
def
A
(self, T=300):
31
return
3e7
32
33
def
B
(self, T=300):
34
return
1.7e-10
35
36
def
C
(self, T=300):
37
return
6e-30
38
39
def
D
(self, T=300):
40
return
10
41
42
43
class
DiffusionTest
:
44
name =
None
45
Geometry =
None
46
Solver =
None
47
geometry_kwargs = {}
48
49
def
setUp
(self):
50
clad =
geometry.Rectangle
(0.500, 0.100,
'GaAs'
)
51
qw =
geometry.Rectangle
(0.500, 0.002,
'GaAsQW'
)
52
qw.role
=
'QW'
53
ba =
geometry.Rectangle
(0.500, 0.001,
'GaAs'
)
54
active =
geometry.Stack2D
()
55
active.role
=
'active'
56
active.prepend
(qw)
57
active.prepend
(ba)
58
active.prepend
(qw)
59
active.prepend
(ba)
60
active.prepend
(qw)
61
stack =
geometry.Stack2D
()
62
stack.prepend
(clad)
63
stack.prepend
(active)
64
stack.prepend
(clad)
65
self.
geometry
= self.
Geometry
(stack, **self.
geometry_kwargs
)
66
self.
solver
= self.
Solver
(self.
name
)
67
self.
solver
.geometry = self.
geometry
68
self.
solver
.maxerr = 0.0001
69
self.
test_mesh
=
mesh.Rectangular2D
(
linspace
(-0.4, 0.4, 9), [0.104])
70
71
self.
n
= 1.0e19
72
self.
j
= 1e-7 * (
qw.material.A
() * self.
n
+
qw.material.B
() * self.
n
**2 +
qw.material.C
() * self.
n
**3) * (
phys.qe
* 0.006)
73
74
def
test_diffusion
(self):
75
self.
solver
.inCurrentDensity =
vec
(0., self.
j
)
76
self.
solver
.compute()
77
n = array(self.
solver
.outCarriersConcentration(self.
test_mesh
))
78
assert_allclose(n, 9 * [self.
n
])
79
80
81
class
Diffusion2D
(
DiffusionTest
,
unittest.TestCase
):
82
name =
"diffusion2d"
83
Geometry = Cartesian2D
84
Solver = Diffusion2D
85
geometry_kwargs = {
'left'
:
'mirror'
,
'right'
:
'air'
}
86
87
88
class
DiffusionCyl
(
DiffusionTest
,
unittest.TestCase
):
89
name =
"diffusioncyl"
90
Geometry = Cylindrical
91
Solver = DiffusionCyl
92
93
94
if
__name__ ==
'__main__'
:
95
unittest.main
()
solvers
electrical
diffusion
tests
uniform.py
Generated by
1.9.8