I'm learning Meep, and in the spirit of "walk before you run" and
wanting to make sure I am solid on the concepts, I've been experimenting
with some simple tests.
In one experiment, I set the computation cell to be 20 units tall (y
direction) and inserted a "block" of material that's centered in y, and
also 20 units tall.
I am using Bloch periodicity, and illuminating the material with a plane
If the y-size of the block of material is exactly 20 units, I get what
appears to be diffraction around the end of the block (outside the cell!).
If I extend the block of material by a few tenths of a unit, the effect
diminishes, and appears to be completely gone at 0.1 unit of extra
height. The resolution is set to 10, so I'm wondering if the block is
extending to the next grid point (top and bottom).
Increasing the resolution to 20 does, indeed, half the amount of
extension outside the cell that's required to suppress this diffraction.
This behavior was unexpected to me, so my question is whether this is
expected behavior, or a bug...
Or, it is more likely that this is simply a bug in my understanding of
how things are meant to work.
If anyone is interested, here's the code. The extra block y-size is the
variable "xtra" and the code, as copied here, should show this diffraction.
from __future__ import division
import meep as mp
posx=-sx/2 + 4
cell = mp.Vector3(sx, sy, 0)
geometry = [mp.Block(mp.Vector3(t, xtra+sy, 1e20), #top half
fcen = 1.5# pulse center frequency
#df = 0.02 # turn-on bandwidth
kdir = mp.Vector3(k_x,k_y) # direction of k (length is irrelevant)
k = kdir.unit().scale(2 * math.pi * fcen) # k with correct length
bloch_k_point=kdir*fcen # kdir.unit().scale(fcen) # there's a scale
factor that eludes me here...
sources = [
center=mp.Vector3(-sx/2 +2 , 0),
pml_layers = [mp.PML(thickness=1.0 ,direction=mp.X)]
resolution = 10
sim = mp.Simulation(cell_size=cell,
import numpy as np
import matplotlib.pyplot as plt
eps_data = sim.get_array(mp.Vector3(), cell, mp.Dielectric)
ez_data = sim.get_array(mp.Vector3(), cell, mp.Ez,cmplx=False)
interpolation='spline36', cmap='RdBu', alpha=0.9)
meep-discuss mailing list