-
Notifications
You must be signed in to change notification settings - Fork 629
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
Use kpoint_func
as initial k_point
in fields::get_eigenmode
#2285
Conversation
I have added a unit test which is currently failing on master. The test is actually based on my tutorial presentation at MeepCon and involves verifying that the sum of all the reflectance and transmittance of all the diffracted orders of a binary grating are equivalent to one (i.e., conservation of energy). |
This makes no sense to me, because the kpoint corresponding to the boundary conditions is equivalent in the mode solver to the kpoint you are passing, because they are in different Brillouin zones. In particular, you are claiming that ω₁(kx, 0) ≠ ω₁(kx, integer × 2π/period), or that the mode fields are different, which violates Bloch's theorem. (And we've seen this to work many times in MPB.) So, I don't understand why this PR would fix your test. As a simple test, you could set up the same unit cell in MPB (an |
Suppose the periodic direction is the
Do you mean |
The confusion here is that that Bloch wavevector (what you pass to MPB) is not the same thing as the planewave wavevector for a finite period (discrete translational symmetry ≠ continuous translational symmetry). A quick way to make them the same might be to use the I think it should work as-is with an |
kpoint_func
as initial $vec{k}$ and search direction only if direction
is NO_DIRECTION
in fields::get_eigenmode
kpoint_func
as initial k_point
in fields::get_eigenmode
This approach works when the eigenmode volume is a single pixel ( |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2285 +/- ##
==========================================
+ Coverage 73.23% 74.08% +0.85%
==========================================
Files 17 18 +1
Lines 4931 5399 +468
==========================================
+ Hits 3611 4000 +389
- Misses 1320 1399 +79 |
Maybe it doesn't know how to interpolate with an eigenmode volume that is smaller than a single pixel? This can probably be fixed? |
Turns out I just needed to use a value for the size of the Note that a value of
|
As described in the user manual, the parameter$\vec{k}$ of band number $f=\omega/2\pi$ ." The manual also states that "If $\vec{k}$ vectors, but is also taken to be the direction of the waveguide."
kpoint_func
ofget_eigenmode_coefficients
"supplies a rough initial guess for then
at frequencydirection
is set tomp.NO_DIRECTION
, thenkpoint_func
is not only the initial guess and the search direction of theThis PR fixes a bug whereby if$\vec{k}$ which had been set to
direction = mp.NO_DIRECTION
then the initialkpoint_func
via the argument_kpoint
offields::get_eigenmode
was actually being overwritten by the components ofk_point
of theSimulation
object in the periodic directions of the cell for which the mode monitor extends to the cell edge.The fix ensures that the initial$\vec{k}$ is set to
kpoint_func
whendirection = mp.NO_DIRECTION
consistent with what is described in the manual.