Dielectric patch array#

Transmission spectrum.

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from scipy.constants import c, e, h

import nannos as nn

Results are compared to the reference [Tikhodeev2002].

eps_quartz = 2.132
eps_active = 3.97

N = 2**7
period = 0.68
l_patch = 0.8 * period

Define the lattice

lattice = nn.Lattice(([period, 0], [0, period]), discretization=(N, N))

Define the slab layer with a square patch

epsilon = lattice.ones() * eps_quartz
square = lattice.square(center=(0.5 * period, 0.5 * period), width=l_patch)
epsilon[square] = eps_active

slab = lattice.Layer("Slab", thickness=0.12)
slab.epsilon = epsilon

cmap = ListedColormap(["#dddddd", "#73a0e8"])


plt.figure(figsize=(3, 2.5))
im = slab.plot(cmap=cmap)
cbar = plt.colorbar(im[0], ticks=[eps_quartz, eps_active])
plt.xlabel(r"$x$ ($\mu$m)")
plt.ylabel(r"$y$ ($\mu$m)")
plt.title(r"$\varepsilon$")
plt.axis("scaled")
plt.tight_layout()
plt.show()
$\varepsilon$

Out:

/builds/nannos/nannos.gitlab.io/nannos/examples/basic/plot_square_patch.py:66: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()

Define the simulation

sup = lattice.Layer("Superstrate", epsilon=1)
sub = lattice.Layer("Substrate", epsilon=eps_quartz)
stack = [sup, slab, sub]


def compute_transmission(fev):
    w = h * c / e / (fev * 1e-6)
    pw = nn.PlaneWave(wavelength=w, angles=(0, 0, 90))
    sim = nn.Simulation(stack, pw, 100, formulation="tangent")
    R, T = sim.diffraction_efficiencies()
    print(f"f = {fev}eV")
    print("T = ", T)
    return T


freqsev = np.linspace(1, 2.6, 101)
fev_adapted, transmission = nn.adaptive_sampler(
    compute_transmission, freqsev, max_bend=10, max_x_rel=0.001, max_df=0.005
)

Out:

f = 1.0eV
T =  0.876380747233424
f = 1.016eV
T =  0.8745967305783725
f = 1.032eV
T =  0.8728093417542863
f = 1.048eV
T =  0.8710122197009736
f = 1.064eV
T =  0.8691967834016845
f = 1.08eV
T =  0.8673513696071037
f = 1.096eV
T =  0.8654599095990386
f = 1.112eV
T =  0.8634998206176038
f = 1.1280000000000001eV
T =  0.8614384905433814
f = 1.1440000000000001eV
T =  0.8592270840225132
f = 1.16eV
T =  0.8567888442319331
f = 1.176eV
T =  0.8539949146441101
f = 1.192eV
T =  0.8506078546214315
f = 1.208eV
T =  0.8461239175168027
f = 1.224eV
T =  0.8391829977065172
f = 1.24eV
T =  0.8233941232772651
f = 1.256eV
T =  0.8351378493465531
f = 1.272eV
T =  0.8584300370242451
f = 1.288eV
T =  0.8645190871664831
f = 1.304eV
T =  0.8671738726606723
f = 1.32eV
T =  0.8685577415706528
f = 1.336eV
T =  0.8693388281244567
f = 1.3519999999999999eV
T =  0.8697944043945727
f = 1.3679999999999999eV
T =  0.8700613657083123
f = 1.384eV
T =  0.8702156060809985
f = 1.4eV
T =  0.8703028576424126
f = 1.416eV
T =  0.8703524712764673
f = 1.432eV
T =  0.8703842410218187
f = 1.448eV
T =  0.8704120617031069
f = 1.464eV
T =  0.8704460167661469
f = 1.48eV
T =  0.8704936333481121
f = 1.496eV
T =  0.8705606706338811
f = 1.512eV
T =  0.870651634792184
f = 1.528eV
T =  0.8707701282181564
f = 1.544eV
T =  0.8709190964027237
f = 1.56eV
T =  0.87110101220826
f = 1.576eV
T =  0.8713180255296575
f = 1.592eV
T =  0.8715721028336908
f = 1.608eV
T =  0.8718651869732654
f = 1.624eV
T =  0.8721994316357528
f = 1.6400000000000001eV
T =  0.8725776374135782
f = 1.6560000000000001eV
T =  0.8730042505743717
f = 1.6720000000000002eV
T =  0.8734881754850226
f = 1.6880000000000002eV
T =  0.8740530313701161
f = 1.704eV
T =  0.8747934863274007
f = 1.72eV
T =  0.8766441001241304
f = 1.736eV
T =  0.8791183064454665
f = 1.752eV
T =  0.876156496120147
f = 1.768eV
T =  0.8769444135602444
f = 1.784eV
T =  0.8782427507992248
f = 1.8eV
T =  0.87924766514774
f = 1.816eV
T =  0.880372007685227
f = 1.832eV
T =  0.8800447675641208
f = 1.8479999999999999eV
T =  0.8807555280490234
f = 1.8639999999999999eV
T =  0.881865378503361
f = 1.88eV
T =  0.8831329652432827
f = 1.896eV
T =  0.8844942109647271
f = 1.912eV
T =  0.885920913175426
f = 1.928eV
T =  0.8873969791920158
f = 1.944eV
T =  0.8889114421804346
f = 1.96eV
T =  0.8904557712403447
f = 1.976eV
T =  0.892022631905989
f = 1.992eV
T =  0.8936052260611211
f = 2.008eV
T =  0.8951968878636134
f = 2.024eV
T =  0.8967907962333674
f = 2.04eV
T =  0.8983797344034653
f = 2.056eV
T =  0.8999558551232445
f = 2.072eV
T =  0.9015104202448151
f = 2.088eV
T =  0.9030334840093721
f = 2.104eV
T =  0.9045134827861347
f = 2.12eV
T =  0.9059366795874955
f = 2.136eV
T =  0.907286385929037
f = 2.152eV
T =  0.9085418391730687
f = 2.168eV
T =  0.9096765360351625
f = 2.184eV
T =  0.9106556841463209
f = 2.2eV
T =  0.9114321756879107
f = 2.216eV
T =  0.9119399866932429
f = 2.232eV
T =  0.9120828839928994
f = 2.248eV
T =  0.9117141089577461
f = 2.2640000000000002eV
T =  0.9105975688465059
f = 2.2800000000000002eV
T =  0.9083281087416808
f = 2.2960000000000003eV
T =  0.9041523812784914
f = 2.3120000000000003eV
T =  0.8965191332634883
f = 2.3280000000000003eV
T =  0.8817877632200317
f = 2.3440000000000003eV
T =  0.8500115400764701
f = 2.3600000000000003eV
T =  0.7747316325450353
f = 2.3760000000000003eV
T =  0.7299277281494905
f = 2.3920000000000003eV
T =  0.8889048592946192
f = 2.408eV
T =  0.9414240997650313
f = 2.424eV
T =  0.9513875541786804
f = 2.44eV
T =  0.9471778138860232
f = 2.456eV
T =  0.745112778716172
f = 2.472eV
T =  0.9645754918652717
f = 2.488eV
T =  0.9638893959084013
f = 2.504eV
T =  0.9634163966182108
f = 2.52eV
T =  0.9641998832930646
f = 2.536eV
T =  0.9649195422391992
f = 2.552eV
T =  0.9688901725370536
f = 2.568eV
T =  0.9657707892146644
f = 2.584eV
T =  0.9656649622635617
f = 2.6eV
T =  0.9657556757987505
f = 1.216eV
T =  0.8431230712932596
f = 1.232eV
T =  0.8334699291087687
f = 1.248eV
T =  0.7844878686709221
f = 1.264eV
T =  0.8515395635207543
f = 1.28eV
T =  0.8621880376719859
f = 1.296eV
T =  0.8660786470901317
f = 1.312eV
T =  0.8679684129918651
f = 1.328eV
T =  0.8690014684611067
f = 1.712eV
T =  0.8753750597010687
f = 1.744eV
T =  0.8761725086004177
f = 1.76eV
T =  0.8763855437770317
f = 1.776eV
T =  0.8777051331739113
f = 2.2720000000000002eV
T =  0.9096426258820133
f = 2.2880000000000003eV
T =  0.9065481900866534
f = 2.3040000000000003eV
T =  0.9009204077683023
f = 2.3200000000000003eV
T =  0.8904259457330801
f = 2.3360000000000003eV
T =  0.8691565209165597
f = 2.3520000000000003eV
T =  0.8201340231619143
f = 2.3680000000000003eV
T =  0.7235962501144036
f = 2.3840000000000003eV
T =  0.816242914651791
f = 2.416eV
T =  0.9486456927119784
f = 2.432eV
T =  0.9511969470429207
f = 2.448eV
T =  0.9288591315859445
f = 2.464eV
T =  0.9578116042906938
f = 2.48eV
T =  0.9644937306297418
f = 2.544eV
T =  0.9662249523381455
f = 2.56eV
T =  0.9660762681175373
f = 2.576eV
T =  0.9657641113114098
f = 1.228eV
T =  0.8366369773839533
f = 1.236eV
T =  0.8293174926720357
f = 1.244eV
T =  0.8134516538801138
f = 1.252eV
T =  0.8136772780718124
f = 1.26eV
T =  0.8454400337239196
f = 1.268eV
T =  0.8555723280543277
f = 1.276eV
T =  0.8605539078334317
f = 1.284eV
T =  0.863478716274893
f = 1.292eV
T =  0.8653713449407366
f = 1.3eV
T =  0.8666719081516309
f = 1.716eV
T =  0.875841412376531
f = 1.728eV
T =  0.885319991023584
f = 1.748eV
T =  0.8760981112122522
f = 2.3320000000000003eV
T =  0.876096246589476
f = 2.3400000000000003eV
T =  0.860616067272799
f = 2.3480000000000003eV
T =  0.8367509350746022
f = 2.3560000000000003eV
T =  0.7995010423052885
f = 2.3720000000000003eV
T =  0.7141298298239329
f = 2.3800000000000003eV
T =  0.7690361745921913
f = 2.4000000000000004eV
T =  0.9251114417455579
f = 2.42eV
T =  0.9504287494845214
f = 2.428eV
T =  0.9516442413732619
f = 2.436eV
T =  0.9498753674571252
f = 2.444eV
T =  0.9417149203082689
f = 2.452eV
T =  0.886252944948476
f = 2.46eV
T =  0.9218372652835816
f = 2.468eV
T =  0.9634379838410136
f = 2.476eV
T =  0.9646818148181064
f = 2.528eV
T =  0.9645197194182931
f = 2.548eV
T =  0.9690383427258745
f = 2.556eV
T =  0.9667628215353801
f = 2.564eV
T =  0.9658480814061203
f = 1.238eV
T =  0.8266585103039229
f = 1.242eV
T =  0.8192065616595549
f = 1.246eV
T =  0.8044710347330404
f = 1.25eV
T =  0.7897132811994338
f = 1.258eV
T =  0.8410479105398303
f = 1.262eV
T =  0.8488355843738249
f = 1.266eV
T =  0.8537430894059198
f = 1.724eV
T =  0.878508227983507
f = 1.732eV
T =  0.892359464567696
f = 1.74eV
T =  0.8766727231385691
f = 2.3640000000000003eV
T =  0.7475110087125714
f = 2.3740000000000006eV
T =  0.7185740589110671
f = 2.378eV
T =  0.7473607436812935
f = 2.3960000000000004eV
T =  0.9105216456797903
f = 2.412eV
T =  0.9457858014685918
f = 2.4219999999999997eV
T =  0.9510007515906885
f = 2.434eV
T =  0.9506656754771987
f = 2.4379999999999997eV
T =  0.9487526639563748
f = 2.442eV
T =  0.9449498227434244
f = 2.4459999999999997eV
T =  0.9368074255611951
f = 2.45eV
T =  0.9147256417682569
f = 2.4539999999999997eV
T =  0.8229520419897969
f = 2.458eV
T =  0.8420538953071847
f = 2.4619999999999997eV
T =  0.9483213720231434
f = 2.466eV
T =  0.9617028594728808
f = 2.4699999999999998eV
T =  0.9642317559612053
f = 2.54eV
T =  0.9652943552539511
f = 2.55eV
T =  0.970000299235164
f = 2.5540000000000003eV
T =  0.967562793778938
f = 2.558eV
T =  0.9663233074004556
f = 1.245eV
T =  0.8095588338123749
f = 1.2469999999999999eV
T =  0.7972000406109112
f = 1.249eV
T =  0.7650744611107699
f = 1.251eV
T =  0.8038632420605303
f = 1.254eV
T =  0.8267286935482365
f = 1.722eV
T =  0.8773445531254812
f = 1.726eV
T =  0.8806971032465849
f = 1.734eV
T =  0.8834070017491689
f = 1.738eV
T =  0.8774120924191718
f = 1.742eV
T =  0.8763304731650393
f = 2.37eV
T =  0.7162303148616553
f = 2.373eV
T =  0.7154843659588493
f = 2.3770000000000002eV
T =  0.7379810695014227
f = 2.3880000000000003eV
T =  0.8577913466136116
f = 2.3980000000000006eV
T =  0.9185426559259797
f = 2.404eV
T =  0.9348836082888545
f = 2.4139999999999997eV
T =  0.9473721407720092
f = 2.418eV
T =  0.9496526578464597
f = 2.441eV
T =  0.9461627505176786
f = 2.445eV
T =  0.9395319251659147
f = 2.447eV
T =  0.93334704445153
f = 2.449eV
T =  0.9228923823398233
f = 2.453eV
T =  0.8607983481478318
f = 2.457eV
T =  0.7771395494644096
f = 2.461eV
T =  0.9386084918637356
f = 2.463eV
T =  0.9541650589551807
f = 2.465eV
T =  0.9601575605756199
f = 2.469eV
T =  0.9639124713187154
f = 2.5460000000000003eV
T =  0.9673130615386951
f = 2.553eV
T =  0.96816409088349
f = 1.2530000000000001eV
T =  0.8210061597521975
f = 1.255eV
T =  0.8313378778934386
f = 1.2570000000000001eV
T =  0.8383285939782315
f = 1.725eV
T =  0.879414852145645
f = 1.7269999999999999eV
T =  0.882565757819495
f = 1.73eV
T =  0.8934514941430451
f = 1.7349999999999999eV
T =  0.8807665885877622
f = 1.737eV
T =  0.8780808502608451
f = 1.7389999999999999eV
T =  0.8769703345392769
f = 2.3660000000000005eV
T =  0.7345559323935873
f = 2.3710000000000004eV
T =  0.7144262526939087
f = 2.3750000000000004eV
T =  0.7234108093084517
f = 2.394eV
T =  0.9007505389779142
f = 2.4059999999999997eV
T =  0.9384814326248652
f = 2.41eV
T =  0.9438278573529615
f = 2.451eV
T =  0.9031723779190726
f = 2.455eV
T =  0.77473419992936
f = 2.459eV
T =  0.8921897974342867
f = 2.467eV
T =  0.9627379168479221
f = 2.545eV
T =  0.9666865995460137
f = 2.549eV
T =  0.9697854971940973
f = 1.729eV
T =  0.8891803050404112
f = 1.7309999999999999eV
T =  0.8952581430038535
f = 1.733eV
T =  0.8874325560223628
f = 2.369eV
T =  0.7193567024642122

Figure 4 from [Tikhodeev2002].

plt.figure()
plt.plot(fev_adapted * 1000, transmission, c="#be4c83")
plt.ylim(0.4, 1)
plt.xlabel("frequency (meV)")
plt.ylabel("Transmissivity")
plt.tight_layout()
plot square patch

Plot the fields at the resonant frequency of 2456meV

fev = 2.456
w = h * c / e / (fev * 1e-6)  # /1000

pw = nn.PlaneWave(wavelength=w, angles=(0, 0, 90))
sim = nn.Simulation(stack, pw, 151, formulation="tangent")
E, H = sim.get_field_grid("Superstrate", shape=(N, N))

Ex, Ey, Ez = E[:, :, :, 0]
Hx, Hy, Hz = H[:, :, :, 0]
nE2 = np.abs(Ex) ** 2 + np.abs(Ey) ** 2  # + np.abs(Ez)**2
nH2 = np.abs(Hx) ** 2 + np.abs(Hy) ** 2  # + np.abs(Hz)**2

Electric field

extent = [0, period, 0, period]
x, y = np.linspace(0, period, N), np.linspace(0, period, N)

plt.figure()
plt.imshow(epsilon.real, cmap="Greys", origin="lower", extent=extent)
plt.imshow(nE2, alpha=0.9, origin="lower", extent=extent)
plt.colorbar()
s = 3
plt.quiver(x[::s], y[::s], Ex[::s, ::s].real, Ey[::s, ::s].real, color="w")
plt.xlabel(r"$x$ ($\mu$m)")
plt.ylabel(r"$y$ ($\mu$m)")
plt.title("$E$")
plt.tight_layout()
plt.show()
$E$

Out:

/builds/nannos/nannos.gitlab.io/nannos/examples/basic/plot_square_patch.py:134: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()

Magnetic field

plt.figure()
plt.imshow(epsilon.real, cmap="Greys", origin="lower", extent=extent)
plt.imshow(nH2, alpha=0.9, origin="lower", extent=extent)
plt.colorbar()
plt.quiver(x[::s], y[::s], Hx[::s, ::s].real, Hy[::s, ::s].real, color="w")
plt.xlabel(r"$x$ ($\mu$m)")
plt.ylabel(r"$y$ ($\mu$m)")
plt.title("$H$")
plt.tight_layout()
plt.show()
$H$

Out:

/builds/nannos/nannos.gitlab.io/nannos/examples/basic/plot_square_patch.py:148: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()

Total running time of the script: ( 0 minutes 57.763 seconds)

Estimated memory usage: 29 MB

Gallery generated by Sphinx-Gallery