Skip to content

Instantly share code, notes, and snippets.

@oskooi
Last active July 31, 2021 01:09
Show Gist options
  • Save oskooi/f44a8e26113470032e574957be12a210 to your computer and use it in GitHub Desktop.
Save oskooi/f44a8e26113470032e574957be12a210 to your computer and use it in GitHub Desktop.
simplified benchmarking test
import meep as mp
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 = 150
tABS = 0.5
tPML = 0.5
tGLS = 0.5
tITO = 0.5
tORG = 0.5
tALU = 0.2
L = 10.0
sz = tPML+tGLS+tITO+tORG+tALU
sxy = L+2*tABS
cell_size = mp.Vector3(sxy,sxy,sz)
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=mp.Medium(index=1.75),
size=mp.Vector3(mp.inf,mp.inf,tORG),
center=mp.Vector3(z=0.5*sz-tPML-tGLS-tITO-0.5*tORG)),
mp.Block(material=mp.Medium(index=1.2),
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,
geometry=geometry,
sources=sources,
eps_averaging=False)
sim.init_sim()
sim.fields.step()
sim.fields.reset_timers()
for _ in range(5):
sim.fields.step()
sim.output_times('oled_timings.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment