PLaSK library
Loading...
Searching...
No Matches
carriers.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
from
numpy.testing
import
assert_array_equal, assert_array_almost_equal
18
19
from
plask
import
*
20
from
plask
import
material, geometry, mesh
21
from
plask.geometry
import
Cartesian2D, Cylindrical
22
23
from
optical.effective
import
EffectiveIndex2D, EffectiveFrequencyCyl
24
from
electrical.diffusion
import
Diffusion2D, DiffusionCyl
25
26
27
@material.simple('GaAs')
28
class
Conc
(
material.Material
):
29
30
def
A
(self, T=300):
31
return
30000000
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
def
nr
(self, lam, T, n):
43
return
3.0 + 1e-19 * n
44
45
46
class
CarriersTest
:
47
name =
None
48
Geometry =
None
49
Solver =
None
50
Diffusion =
None
51
geometry_kwargs = {}
52
53
def
setUp
(self):
54
clad =
geometry.Rectangle
(0.500, 0.100,
Conc
())
55
qw =
geometry.Rectangle
(0.500, 0.006,
Conc
())
56
qw.roles
=
'QW'
,
'active'
57
stack =
geometry.Stack2D
()
58
stack.prepend
(clad)
59
stack.prepend
(qw)
60
stack.prepend
(clad)
61
self.
geometry
= self.
Geometry
(stack, **self.
geometry_kwargs
)
62
self.
solver
= self.
Solver
(self.
name
)
63
self.
solver
.geometry = self.
geometry
64
self.
solver
.inGain = 1000.
65
self.
test_mesh
=
mesh.Rectangular2D
([0.], [0.050, 0.103, 0.156])
66
67
def
test_no_carriers
(self):
68
nr = self.
solver
.outRefractiveIndex(self.
test_mesh
).array[0,:].real
69
assert_array_equal(nr, 3.0)
70
71
def
test_carriers
(self):
72
diffusion = self.
Diffusion
(
'diffusion'
)
73
diffusion.geometry
= self.
geometry
74
diffusion.inCurrentDensity
=
vec
(0., 10.)
75
diffusion.compute
()
76
cc =
diffusion.outCarriersConcentration
(
mesh.Rectangular2D
([0.250], [0.103]))[0]
77
self.assertLess(1e18, cc)
78
79
self.
solver
.inCarriersConcentration =
diffusion.outCarriersConcentration
80
nr = self.
solver
.outRefractiveIndex(self.
test_mesh
).array[0,:].real
81
assert_array_almost_equal(nr, [3.0, 3.0 + 1e-19 * cc, 3.0])
82
83
84
class
EffectiveIndexCarriers
(
CarriersTest
,
unittest.TestCase
):
85
name =
"eim"
86
Geometry = Cartesian2D
87
Solver = EffectiveIndex2D
88
Diffusion = Diffusion2D
89
geometry_kwargs = {
'left'
:
'mirror'
}
90
91
92
class
EffectiveFrequencyCarriers
(
CarriersTest
,
unittest.TestCase
):
93
name =
"efm"
94
Geometry = Cylindrical
95
Solver = EffectiveFrequencyCyl
96
Diffusion = DiffusionCyl
solvers
optical
effective
tests
carriers.py
Generated by
1.9.8