17from numpy.testing
import assert_allclose
20from plask
import material, geometry, mesh
21from plask.geometry
import Cartesian2D, Cylindrical
22from plask.flow
import CurrentDensityProvider2D, CurrentDensityProviderCyl
24from electrical.olddiffusion
import OldDiffusion2D, OldDiffusionCyl
32@material.simple('GaAs')
33class GaAsQW(material.Material):
77 self.
solver.accuracy = 0.0001
83 return 1e19 * (
exp(-x**2) + 0.5)
86 return 2e27 * (2 * x**2 - 1) *
exp(-x**2)
90 nj = D * self.
d2nd2n(x) - A * n - B * n**2 - C * n**3
91 return -1e-7 * (
phys.qe * 0.006) * nj
94 self.
solver.compute_threshold()
96 assert_allclose(n, self.
nn(array(self.
test_mesh.axis0)), 1e-5)
101 Geometry = Cartesian2D
102 geometry_kwargs = {
'left':
'mirror',
'right':
'air'}
103 Solver = OldDiffusion2D
104 provider = CurrentDensityProvider2D
109 name =
"diffusioncyl"
110 Geometry = Cylindrical
111 Solver = OldDiffusionCyl
112 provider = CurrentDensityProviderCyl
116 return 4e27 * (x**2 - 1) *
exp(-x**2)
119if __name__ ==
'__main__':
120 for Test
in Diffusion2D, DiffusionCyl:
126 plot(x,
test.j(x), color=
'C0', label=
'current')
127 xlabel(f
"${config.axes[1]}$ (µm)")
131 plot(x,
test.n(x),
'C1', label=
'concentration (analytic)')
134 label=
'concentration (numeric)')
135 xlabel(f
"${config.axes[1]}$ (µm)")