-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mismatched frequency between eigenmode and Gaussian pulse launches wrong mode #1211
Comments
Is it finding the same mode? (see the mode frequency output in the simulation output) |
Yes, MPB is finding the same mode in all four cases. Does this mean therefore that the bug is in the way that the y mirror symmetry is implemented in a 2d cell with non-zero kz? no symmetries
symmetries = [mp.Mirror(mp.X, phase=+1)]
symmetries = [mp.Mirror(mp.Y, phase=-1)]
symmetries = [mp.Mirror(mp.X, phase=+1),mp.Mirror(mp.Y, phase=-1)]
|
A CW simulation might be clearer to visualize what mode is being launched? |
I think I've tracked down the cause of the bug: when the center frequency of the In the example posted above, the frequency of the eigenmode computed by MPB is When symmetries = [mp.Mirror(mp.Y, phase=-1)] symmetries = [mp.Mirror(mp.X, phase=+1),mp.Mirror(mp.Y, phase=-1)] The issue here is that a user launching an eigenmode via |
It looks like it was supposed to do that already, but there may be a bug. Try: diff --git a/src/mpb.cpp b/src/mpb.cpp
index cd507e25..66ada5ab 100644
--- a/src/mpb.cpp
+++ b/src/mpb.cpp
@@ -696,7 +696,7 @@ void fields::add_eigenmode_source(component c0, const src_time &src, direction d
global_eigenmode_data->amp_func = A ? A : default_amp_func;
src_time *src_mpb = src.clone();
- if (!match_frequency) src_mpb->set_frequency(frequency);
+ if (!match_frequency) src_mpb->set_frequency(global_eigenmode_data->frequency);
/*--------------------------------------------------------------*/
// step 2: add sources whose radiated field reproduces the */ |
In particular, it looks like it used to work, but was broken by #192. |
Note that this will not only work for a gaussian, but also for a CW source — it will set the frequency to the eigenmode frequency (but won't change the width or any other parameter of the source). |
Tested the patch and it looks like it fixed the bug (i.e., it now does not matter what the center frequency of the |
Note that, in |
(It won't set the frequency for a Python |
A 2d
EigenModeSource
in a 2d cell does not seem to correctly support y mirror symmetry. This is demonstrated using the parallel waveguide example from TutorialOptical Forces. In this example,eig_parity=mp.ODD_Y
is part of the eigenmode source definition.The Ey field profile is correct when there are no
symmetries
and whensymmetries = [mp.Mirror(mp.X, phase=+1)]
. However, whenever thesymmetries
object includesmp.Mirror(mp.Y, phase=-1)
, the fields are incorrect.This does not seem to be related to #1208.
no symmetries
symmetries = [mp.Mirror(mp.X, phase=+1)]
symmetries = [mp.Mirror(mp.Y, phase=-1)]
symmetries = [mp.Mirror(mp.X, phase=+1),mp.Mirror(mp.Y, phase=-1)]
The text was updated successfully, but these errors were encountered: