Skip to content
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

add support for out-of-plane wavevector in 2d cell to fields::get_eigenmode #1968

Merged
merged 3 commits into from
Mar 17, 2022

Conversation

oskooi
Copy link
Collaborator

@oskooi oskooi commented Feb 27, 2022

Closes #1957.

@codecov-commenter
Copy link

Codecov Report

Merging #1968 (56dd42e) into master (35b10e5) will increase coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1968      +/-   ##
==========================================
+ Coverage   73.09%   73.13%   +0.04%     
==========================================
  Files          17       17              
  Lines        4917     4917              
==========================================
+ Hits         3594     3596       +2     
+ Misses       1323     1321       -2     
Impacted Files Coverage Δ
python/simulation.py 76.94% <0.00%> (+0.08%) ⬆️

@oskooi
Copy link
Collaborator Author

oskooi commented Mar 1, 2022

The unit test for mode decomposition and the kz_2d feature added in this PR to test_binary_grating.py as test_binary_grating_special_kz is failing because of a possible bug in this feature (or possibly the test itself, which is unlikely). The test attempts to verify that the total reflected and transmitted flux obtained using get_fluxes for an incident planewave with out-of-plane wavevector is equivalent to the sum of the flux of all the individual reflected and transmitted diffraction orders computed using get_eigenmode_coefficients. The test is failing using kz_2d="3d" and I have yet to try it with the other two options "complex" and "real/imag". This test is identical to the existing test_binary_grating_oblique in test_binary_grating.py which involves an in-plane wavector and is passing.

@stevengj
Copy link
Collaborator

stevengj commented Mar 3, 2022

Maybe try a longer wavelength where there is only the 0th (specular) diffracted order, just to simplify things.

@oskooi
Copy link
Collaborator Author

oskooi commented Mar 8, 2022

With only a single reflected or transmitted diffraction order, the results from the mode decomposition agree with the Poynting flux. It is only when where there are more than one orders that the results disagree. Here is a unit test which demonstrates this. This is strange because the dominant planewave used to compute the mode coefficient and shown in the output is correct. Perhaps there is a bug in MPB's maxwell_set_planewave function?

@stevengj
Copy link
Collaborator

Don't forget that kz ≠ 0 allows the grating structure to couple the s and p polarizatios. So you have to compute both the s and p diffracted orders and add up their powers.

@oskooi
Copy link
Collaborator Author

oskooi commented Mar 10, 2022

Summing up the flux in each of the diffraction orders for both the S- and P-polarizations does indeed produce the same result as the total Poynting flux. I have added a unit test in test_binary_grating.py which verifies this result for each of the three cases for kz_2d of real/imag, complex, and 3d.

@stevengj
Copy link
Collaborator

stevengj commented Mar 17, 2022

Notes:

  • you are specifying kx and kz, but that doesn't mean ky = 0. ky is determined by ω, kx, and kz.
  • this means that the plane of incidence is oblique with respect to the xy or xz planes.
  • you used an Ez line source, but this will generate an incident wave that has some S and some P component, because z is not orthogonal to or parallel to the plane of incidence.
  • even if your incident wave were purely S or purely P, the scattered wave would contain both S and P, because the surface breaks the mirror symmetry of the plane of incidence.

@stevengj
Copy link
Collaborator

Might be nice to have a test for the relative phase of the eigenmode coefficients. You can just do a transmission calculations through a flat interface between a material ε1 and air, and another simulation through ε2 and air; then the relative phase of the two eigenmode transmission coefficients should match the prediction from the Fresnel equations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mode decomposition for 2d cell with out-of-plane wavevector
3 participants