PLaSK library
Loading...
Searching...
No Matches
uniform.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
14import unittest
15
16from numpy import *
17from numpy.testing import assert_allclose
18
19from plask import *
20from plask import material, geometry, mesh
21from plask.geometry import Cartesian2D, Cylindrical
22
23from electrical.olddiffusion import OldDiffusion2D, OldDiffusionCyl
24
25
26@material.simple('GaAs')
27class GaAsQW(material.Material):
28
29 def A(self, T=300):
30 return 3e7
31
32 def B(self, T=300):
33 return 1.7e-10
34
35 def C(self, T=300):
36 return 6e-30
37
38 def D(self, T=300):
39 return 10
40
41
42class DiffusionTest:
43 name = None
44 Geometry = None
45 Solver = None
46 geometry_kwargs = {}
47
48 def setUp(self):
49 clad = geometry.Rectangle(0.500, 0.100, 'GaAs')
50 qw = geometry.Rectangle(0.500, 0.002, 'GaAsQW')
51 qw.role = 'QW'
52 ba = geometry.Rectangle(0.500, 0.001, 'GaAs')
53 active = geometry.Stack2D()
54 active.role = 'active'
60 stack = geometry.Stack2D()
61 stack.prepend(clad)
62 stack.prepend(active)
63 stack.prepend(clad)
64 self.geometry = self.Geometry(stack, **self.geometry_kwargs)
65 self.solver = self.Solver(self.name)
66 self.solver.geometry = self.geometry
67 self.solver.accuracy = 0.0001
68 # self.solver.fem_method = 'linear'
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_threshold()
77 n = array(self.solver.outCarriersConcentration(self.test_mesh))
78 assert_allclose(n, 9 * [self.n])
79
80
82 name = "diffusion2d"
83 Geometry = Cartesian2D
84 Solver = OldDiffusion2D
85 geometry_kwargs = {'left': 'mirror', 'right': 'air'}
86
87
89 name = "diffusioncyl"
90 Geometry = Cylindrical
91 Solver = OldDiffusionCyl