You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes the permittivity in simulation is different from what the user should expect. An example is as follows, where the permittivity should be 4 everywhere, but the value given by sim.get_epsilon() is different at the lateral boundaries.
The script is as follows.
import meep as mp
import numpy as np
from matplotlib import pyplot as plt
SiN = mp.Medium(epsilon=4)
Lx, Ly, dpml = 0.3149, 4, 1
resolution = 200
pml_layers = [mp.PML(dpml,direction=mp.Y)]
cell_size = mp.Vector3(Lx,Ly+2*dpml)
geometry = [mp.Block(center=mp.Vector3(), size=cell_size, material=SiN)]
sim = mp.Simulation(cell_size=cell_size,boundary_layers=pml_layers,eps_averaging=False,
geometry=geometry,k_point=mp.Vector3(),resolution=resolution)
sim.run(until_after_sources=1)
epsilon = sim.get_epsilon()
sim.reset_meep()
plt.figure(figsize=(10,5))
plt.subplot(1,2,1)
plt.imshow(np.transpose(epsilon))
plt.title('Permittivity')
plt.xlabel('X')
plt.ylabel('Y')
plt.colorbar()
plt.subplot(1,2,2)
plt.plot(epsilon);
plt.title('Permittivity projected to the x axis')
plt.xlabel('X')
plt.ylabel('Permittivity');
The flaw remains no matter eps_averaging=True or False. If k_point is changed to False, the flaw in permittivity will become different.
The text was updated successfully, but these errors were encountered:
Basically, it's an issue of what we should do right at the edge of the computational cell. Probably we should do subpixel averaging differently in that case. There is also some averaging with Yee grid points beyond the cell.
The simplest solution is to make the object a little bigger than the cell.
stevengj
changed the title
Flaw in permittivity
Subpixel averaging and material discretization at edges of domain
Sep 21, 2023
Sometimes the permittivity in simulation is different from what the user should expect. An example is as follows, where the permittivity should be 4 everywhere, but the value given by
sim.get_epsilon()
is different at the lateral boundaries.The script is as follows.
The flaw remains no matter
eps_averaging=True
orFalse
. Ifk_point
is changed toFalse
, the flaw in permittivity will become different.The text was updated successfully, but these errors were encountered: