44@plask.material.simple()
45class Glass(plask.material.Material):
46 def nr(self, w, T=300., n=0.):
49@plask.material.simple()
50class Asym(plask.material.Material):
51 def nr(self, w, T=300., n=0.):
56 if axis == 0:
return vec(w, depth, h)
57 elif axis == 1:
return vec(depth, w, h)
58 raise ValueError(
"wrong axis")
61 if axis == 0:
return vec(w, 0, z)
62 elif axis == 1:
return vec(0, w, z)
63 raise ValueError(
"wrong axis")
66shelf = geometry.Align3D()
69 stack = geometry.Stack3D(left=0, back=0)
71 stack = geometry.Stack3D(xcenter=0, ycenter=0)
74asym = geometry.Block3D(
dims(wa, h), material.air)
75air = geometry.Block3D(
dims(w, h), material.air)
77air1 = geometry.Block3D(
dims(w-d, h), material.air)
78air2 = geometry.Block3D(
dims(w+d, h), material.air)
81 shelf.append(air1,
pos(-2*w-d))
82 shelf.append(core,
pos(-w))
83 shelf.append(core,
pos(0))
84 shelf.append(air2,
pos(w))
86 shelf.append(core,
pos(0))
87 shelf.append(air,
pos(w))
90p = stack.append(shelf)
93edges = dict(left=
'periodic', right=
'periodic', back=
'periodic', front=
'periodic')
94b0, b1 = ((
'back',
'front'), (
'left',
'right'))[axis]
95if not periodic: edges[b0] = edges[b1] =
None
96if symmetric: edges[b0] =
'mirror'
98main = geometry.Cartesian3D(stack, **edges)
100opt = optical.Fourier3D(
"opt")
111opt.set_interface(shelf, p)
113opt.pmls.tran.dist = 0.5
114opt.pmls.tran.size = 0.5
115opt.pmls.tran.order = 1
116opt.pmls.tran.factor = 1-2j
118opt.pmls.long = opt.pmls.tran
129AX = linspace(left, right, 4000)
132 msh = mesh.Rectangular3D(AX, [0], [0.5*h])
134 msh = mesh.Rectangular3D([0], AX, [0.5*h])
136 raise ValueError(
"wrong axis")
138eps = [main.get_material(
pos(ax, 0.5*h)).nr(opt.wavelength.real).real**2
for ax
in AX]
141eps = opt.outEpsilon(msh,
'fourier')
142plot(AX, eps.array[:,:,0,2,2].ravel().real,
'r', label=
'Fourier')
145 msh = mesh.Rectangular3D(AX, [0], [0.5*h])
147 msh = mesh.Rectangular3D([0], AX, [0.5*h])
162gcf().canvas.set_window_title(
"%s %s" % (
'Symmetric' if symmetric
else 'Asymmetric',
'periodic' if periodic
else ''))