Meep Benchmarking Simulation of Organic Light Emitting Diode (OLED)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import meep as mp | |
from meep.materials import Al as ALU | |
import numpy as np | |
lambda_min = 0.4 # minimum source wavelength | |
lambda_max = 0.8 # maximum source wavelength | |
fmin = 1/lambda_max # minimum source frequency | |
fmax = 1/lambda_min # maximum source frequency | |
fcen = 0.5*(fmin+fmax) # source frequency center | |
df = fmax-fmin # source frequency width | |
resolution = 55 | |
nfreq = 25 | |
tABS = 0.5 | |
tPML = 0.5 | |
tGLS = 0.5 | |
tITO = 0.5 | |
tORG = 0.5 | |
tALU = 0.2 | |
L = 1.0 # length of OLED | |
# length of computational cell along Z | |
sz = tPML+tGLS+tITO+tORG+tALU | |
# length of non-absorbing region of computational cell in X and Y | |
sxy = L+2*tABS | |
cell_size = mp.Vector3(sxy,sxy,sz) | |
boundary_layers = [mp.Absorber(tABS,direction=mp.X), | |
mp.Absorber(tABS,direction=mp.Y), | |
mp.PML(tPML,direction=mp.Z,side=mp.High)] | |
ORG = mp.Medium(index=1.75) | |
geometry = [mp.Block(material=mp.Medium(index=1.5), | |
size=mp.Vector3(mp.inf,mp.inf,tPML+tGLS), | |
center=mp.Vector3(z=0.5*sz-0.5*(tPML+tGLS))), | |
mp.Block(material=mp.Medium(index=1.2), | |
size=mp.Vector3(mp.inf,mp.inf,tITO), | |
center=mp.Vector3(z=0.5*sz-tPML-tGLS-0.5*tITO)), | |
mp.Block(material=ORG, | |
size=mp.Vector3(mp.inf,mp.inf,tORG), | |
center=mp.Vector3(z=0.5*sz-tPML-tGLS-tITO-0.5*tORG)), | |
mp.Block(material=ALU, | |
size=mp.Vector3(mp.inf,mp.inf,tALU), | |
center=mp.Vector3(z=0.5*sz-tPML-tGLS-tITO-tORG-0.5*tALU))] | |
sources = [mp.Source(mp.ContinuousSource(fcen), | |
component=mp.Ez, | |
center=mp.Vector3(z=0.5*sz-tPML-tGLS-tITO-0.5*tORG))] | |
sim = mp.Simulation(resolution=resolution, | |
cell_size=cell_size, | |
boundary_layers=boundary_layers, | |
geometry=geometry, | |
sources=sources, | |
eps_averaging=False) | |
# surround source with a six-sided box of flux planes | |
srcbox_width = 0.05 | |
srcbox_top = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(z=0.5*sz-tPML-tGLS), size=mp.Vector3(srcbox_width,srcbox_width,0), direction=mp.Z, weight=+1)) | |
srcbox_bot = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(z=0.5*sz-tPML-tGLS-tITO-0.8*tORG), size=mp.Vector3(srcbox_width,srcbox_width,0), direction=mp.Z, weight=-1)) | |
srcbox_xp = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(0.5*srcbox_width,0,0.5*sz-tPML-tGLS-0.5*(tITO+0.8*tORG)), size=mp.Vector3(0,srcbox_width,tITO+0.8*tORG), direction=mp.X, weight=+1)) | |
srcbox_xm = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(-0.5*srcbox_width,0,0.5*sz-tPML-tGLS-0.5*(tITO+0.8*tORG)), size=mp.Vector3(0,srcbox_width,tITO+0.8*tORG), direction=mp.X, weight=-1)) | |
srcbox_yp = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(0,0.5*srcbox_width,0.5*sz-tPML-tGLS-0.5*(tITO+0.8*tORG)), size=mp.Vector3(srcbox_width,0,tITO+0.8*tORG), direction=mp.Y, weight=+1)) | |
srcbox_ym = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(0,-0.5*srcbox_width,0.5*sz-tPML-tGLS-0.5*(tITO+0.8*tORG)), size=mp.Vector3(srcbox_width,0,tITO+0.8*tORG), direction=mp.Y, weight=-1)) | |
# padding for flux box to fully capture waveguide mode | |
fluxbox_dpad = 0.05 | |
glass_flux = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(center=mp.Vector3(z=0.5*sz-tPML-(tGLS-fluxbox_dpad)), size = mp.Vector3(L,L,0), direction=mp.Z, weight=+1)) | |
wvgbox_xp = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(size=mp.Vector3(0,L,fluxbox_dpad+tITO+tORG+fluxbox_dpad),direction=mp.X, center=mp.Vector3(0.5*L,0,0.5*sz-tPML-tGLS-0.5*(tITO+tORG)), weight=+1)) | |
wvgbox_xm = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(size=mp.Vector3(0,L,fluxbox_dpad+tITO+tORG+fluxbox_dpad),direction=mp.X, center=mp.Vector3(-0.5*L,0,0.5*sz-tPML-tGLS-0.5*(tITO+tORG)), weight=-1)) | |
wvgbox_yp = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(size=mp.Vector3(L,0,fluxbox_dpad+tITO+tORG+fluxbox_dpad),direction=mp.Y, center=mp.Vector3(0,0.5*L,0.5*sz-tPML-tGLS-0.5*(tITO+tORG)), weight=+1)) | |
wvgbox_ym = sim.add_flux(fcen, df, nfreq, mp.FluxRegion(size=mp.Vector3(L,0,fluxbox_dpad+tITO+tORG+fluxbox_dpad),direction=mp.Y, center=mp.Vector3(0,-0.5*L,0.5*sz-tPML-tGLS-0.5*(tITO+tORG)), weight=-1)) | |
mp.verbosity(2) | |
sim.run(until=2.0) | |
sim.fields.reset_timers() | |
for _ in range(5): | |
sim.fields.step() | |
sim.output_times('oled_timings.csv') | |
print("field:, {}".format(np.real(sim.get_field_point(mp.Ez, mp.Vector3(0.1235,-0.3165,0.7298))))) | |
flux_srcbox_top = np.asarray(mp.get_fluxes(srcbox_top)) | |
flux_srcbox_bot = np.asarray(mp.get_fluxes(srcbox_bot)) | |
flux_srcbox_xp = np.asarray(mp.get_fluxes(srcbox_xp)) | |
flux_srcbox_xm = np.asarray(mp.get_fluxes(srcbox_xm)) | |
flux_srcbox_yp = np.asarray(mp.get_fluxes(srcbox_yp)) | |
flux_srcbox_ym = np.asarray(mp.get_fluxes(srcbox_ym)) | |
flux_wvgbox_xp = np.asarray(mp.get_fluxes(wvgbox_xp)) | |
flux_wvgbox_xm = np.asarray(mp.get_fluxes(wvgbox_xm)) | |
flux_wvgbox_yp = np.asarray(mp.get_fluxes(wvgbox_yp)) | |
flux_wvgbox_ym = np.asarray(mp.get_fluxes(wvgbox_ym)) | |
flux_glass = np.asarray(mp.get_fluxes(glass_flux)) | |
flux_total = flux_srcbox_top+flux_srcbox_bot+flux_srcbox_xp+flux_srcbox_xm+flux_srcbox_yp+flux_srcbox_ym | |
flux_waveguide = flux_wvgbox_xp+flux_wvgbox_xm+flux_wvgbox_yp+flux_wvgbox_ym | |
print("flux_glass:, {}".format(flux_glass)) | |
print("flux_waveguide:, {}".format(flux_waveguide)) | |
print("flux_total:, {}".format(flux_total)) | |
print("sum(flux_glass):, {}".format(np.sum(flux_glass))) | |
print("sum(flux_waveguide):, {}".format(np.sum(flux_waveguide))) | |
print("sum(flux_total):, {}".format(np.sum(flux_total))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
time spent on DFT field updates:
0.0122615 s
.time spent on DFT field updates:
0.151868 s
.