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
The EigenModeSource can be used to launch oblique-angle, forward-propagating planewaves as demonstrated by the following script.
importmeepasmpimportnumpyasnpimportmatplotlib.pyplotaspltresolution=50# pixels/μm cell_size=mp.Vector3(14,10,0)
pml_layers= [mp.PML(thickness=2,direction=mp.X)]
# rotation angle (in degrees) of planewave, counter clockwise (CCW) around z-axis rot_angle=np.radians(0)
fsrc=1.0# frequency of planewave (wavelength = 1/fsrc) n=1.5# refractive index of homogeneous material default_material=mp.Medium(index=n)
k_point=mp.Vector3(fsrc*n).rotate(mp.Vector3(z=1), rot_angle)
sources= [mp.EigenModeSource(src=mp.ContinuousSource(fsrc),
center=mp.Vector3(),
size=mp.Vector3(y=10),
direction=mp.AUTOMATICifrot_angle==0elsemp.NO_DIRECTION,
eig_kpoint=k_point,
eig_band=1,
eig_parity=mp.EVEN_Y+mp.ODD_Zifrot_angle==0elsemp.ODD_Z,
eig_match_freq=True)]
sim=mp.Simulation(cell_size=cell_size,
resolution=resolution,
boundary_layers=pml_layers,
sources=sources,
k_point=k_point,
default_material=default_material,
symmetries=[mp.Mirror(mp.Y)] ifrot_angle==0else [])
sim.run(until=100)
nonpml_vol=mp.Volume(center=mp.Vector3(), size=mp.Vector3(10,10,0))
ez_data=sim.get_array(vol=nonpml_vol, component=mp.Ez)
plt.figure()
plt.imshow(np.flipud(np.transpose(np.real(ez_data))), interpolation='spline36', cmap='RdBu')
plt.axis('off')
plt.show()
The three examples shown above for rotation angles (rot_angle) of 0°, 20°, and 40° involve a k_point in which all vector components have positive values. However, when trying to launch a planewave propagating in the negative direction at 0° via a negative k_point (shown below), the fields blow up:
This should be a simple bug somewhere — nothing fundamental prevents this, so there is probably a line or two that is incorrectly assuming the sign of k
The
EigenModeSource
can be used to launch oblique-angle, forward-propagating planewaves as demonstrated by the following script.The three examples shown above for rotation angles (
rot_angle
) of 0°, 20°, and 40° involve ak_point
in which all vector components have positive values. However, when trying to launch a planewave propagating in the negative direction at 0° via a negativek_point
(shown below), the fields blow up:The fields also blow up if the rotation angle is >90° which involves negative components for
k_point
.The text was updated successfully, but these errors were encountered: